From 90de81ed138823dc498b201bc7873f74016d2f65 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: 星期三, 23 十一月 2022 15:20:23 +0800
Subject: [PATCH] 新增安全专项检查与用户层级

---
 src/views/selfCheck/components/repair.vue |  103 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 64 insertions(+), 39 deletions(-)

diff --git a/src/views/selfCheck/components/repair.vue b/src/views/selfCheck/components/repair.vue
index 8f1e622..16033f7 100644
--- a/src/views/selfCheck/components/repair.vue
+++ b/src/views/selfCheck/components/repair.vue
@@ -3,7 +3,7 @@
         :visible.sync="dialogVisible"
         append-to-body
         :close-on-click-modal="false"
-        width="60%"
+        width="80%"
         center
     >
         <div class="table_cont">
@@ -27,19 +27,19 @@
                 <el-table-column label="负责人" prop="chargePerson" align="center"></el-table-column>
                 <el-table-column label="整改状态" prop="rectifyStatus" align="center">
                     <template slot-scope="scope">
-                        <span>{{ scope.row.rectifyStatus ==0?'未整改':'已整改' }}</span>
+                        <span>{{ scope.row.rectifyStatus ==1?'已整改':'未整改' }}</span>
                     </template>
                 </el-table-column>
-                <el-table-column label="完成整改时间" prop="completeRectifyTime	" align="center"></el-table-column>
+                <el-table-column label="完成整改时间" prop="completeRectifyTime" align="center"></el-table-column>
                 <el-table-column label="隐患等级" prop="hiddendangerLevel" align="center">
                     <template slot-scope="scope">
                         <span>{{ scope.row.hiddendangerLevel==1 ? '一般隐患' : '重大隐患' }}</span>
                     </template>
                 </el-table-column>
-                <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+                <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
                     <template slot-scope="scope">
-                        <el-button v-if="scope.row.rectifyStatus==0" type="text" @click="toFix(scope.row)">整改填报</el-button>
-                        <el-button v-else type="text">--</el-button>
+                        <span v-if="scope.row.rectifyStatus==1">已整改</span>
+                        <el-button v-else type="text" @click="toFix(scope.row)">整改填报</el-button>
                     </template>
                 </el-table-column>
             </el-table>
@@ -59,7 +59,7 @@
         </div>
         <span slot="footer" class="dialog-footer">
           <el-button @click="dialogVisible = false">取消</el-button>
-          <el-button type="primary" @click="confirm()">提交</el-button>
+          <el-button type="primary" @click="confirm()">确认</el-button>
         </span>
         <el-dialog
             :visible.sync="dialogFix"
@@ -68,32 +68,34 @@
             :close-on-click-modal="false"
             width="40%"
             center
+            @close="resetFix()"
         >
-            <el-form ref="fixformRef" :model="fixForm" label-width="140px">
+            <el-form ref="fixForm" :model="fixForm" :rules="fixRule" label-width="160px">
                 <el-form-item label="当前隐患:">
-                    <el-input type="textarea" v-model="fixForm.info"></el-input>
+                    <el-input type="textarea" readonly v-model="fixForm.info"></el-input>
                 </el-form-item>
 
-                <el-form-item label="当前完成整改日期:">
+                <el-form-item label="当前完成整改日期:" prop="completeRectifyTime">
                     <el-date-picker
                         v-model="fixForm.completeRectifyTime"
-                        type="date"
+                        type="datetime"
+                        value-format="yyyy-MM-dd HH:mm:ss"
                         placeholder="请选择整改日期">
                     </el-date-picker>
                 </el-form-item>
-                <el-form-item label="整改资金:">
-                    <el-input v-model="fixForm.rectifyPrice"></el-input>
+                <el-form-item label="整改资金:" prop="rectifyPrice">
+                    <el-input v-model="fixForm.rectifyPrice" type="number" placeholder="请输入整改资金金额"></el-input>
                 </el-form-item>
-                <el-form-item label="整改措施:">
-                    <el-input type="textarea" autosize v-model="fixForm.rectifyMeasure"></el-input>
+                <el-form-item label="整改措施:" prop="rectifyMeasure">
+                    <el-input type="textarea" autosize v-model="fixForm.rectifyMeasure" placeholder="请输入整改措施"></el-input>
                 </el-form-item>
-                <el-form-item label="负责人:">
-                    <el-input v-model="fixForm.chargePerson"></el-input>
+                <el-form-item label="负责人:" prop="chargePerson">
+                    <el-input v-model="fixForm.chargePerson" placeholder="请输入整改负责人"></el-input>
                 </el-form-item>
             </el-form>
             <span slot="footer" class="dialog-footer">
               <el-button @click="dialogFix = false">取消</el-button>
-              <el-button type="primary" @click="confirmFix()">提交</el-button>
+              <el-button type="primary" @click="confirmFix('fixForm')">提交</el-button>
             </span>
         </el-dialog>
     </el-dialog>
@@ -113,7 +115,6 @@
                 dialogFix: false,
                 recordTotal: 0,
                 pageSize: 10,
-                pageTotal: 0,
                 currentPage: 1,
                 tableKey: 0,
                 dialogVisible:false,
@@ -123,14 +124,20 @@
                     enterpriseSubmitId: null,
                     info: '',
                     completeRectifyTime: '',
-                    rectifyPrice: 0,
+                    rectifyPrice: null,
                     rectifyMeasure: '',
                     chargePerson: ''
+                },
+                fixRule:{
+                    completeRectifyTime: [{ required: true, message: '请选择完成整改日期', trigger: 'blur' }],
+                    rectifyPrice: [{ required: true, message: '请输入整改资金', trigger: 'blur' }],
+                    rectifyMeasure: [{ required: true, message: '请输入整改措施', trigger: 'blur' }],
+                    chargePerson: [{ required: true, message: '请输入负责人', trigger: 'blur' }]
                 }
             }
         },
         created() {
-            this.getSelfRectifyInfo()
+            // this.getSelfRectifyInfo()
         },
         watch: {
         },
@@ -148,7 +155,7 @@
             async getSelfRectifyInfo(){
                 const t = this
                 t.listLoading = true
-                let res = await getSelfRectifyInfo(t.id)
+                let res = await getSelfRectifyInfo({id: t.id})
                 if(res.data.code === "200"){
                     t.checkList = res.data.result.hiddendangerBaseInfos
                 }else{
@@ -162,6 +169,7 @@
 
             confirm(){
                 this.dialogVisible = false
+                this.$parent.getUncheckList()
             },
 
             toFix(row){
@@ -171,25 +179,42 @@
                 t.dialogFix = true
             },
 
-            async confirmFix(){
+            async confirmFix(formName){
                 const t = this
-                t.listLoading = true
-                t.fixForm.enterpriseSubmitId = t.id
-                let {info,...data} = t.fixForm
-                let res = await saveSelfRectifyInfo(data)
-                if(res.data.code === "200"){
-                    t.$message({
-                        type:'success',
-                        message:res.data.message
-                    })
-                }else{
-                    t.$message({
-                        type:'warning',
-                        message:res.data.message
-                    })
+                t.$refs[formName].validate(async (valid) => {
+                    if(valid){
+                        t.fixForm.enterpriseSubmitId = t.id
+                        let {info,...data} = t.fixForm
+                        let res = await saveSelfRectifyInfo(data)
+                        if(res.data.code === "200"){
+                            t.$message({
+                                type:'success',
+                                message: '提交成功'
+                            })
+                        }else{
+                            t.$message({
+                                type:'warning',
+                                message:res.data.message
+                            })
+                        }
+                        t.dialogFix = false
+                        t.getSelfRectifyInfo()
+                    } else {
+                        console.log('error submit!!');
+                        return false;
+                    }
+                })
+            },
+            resetFix(){
+                this.fixForm = {
+                    id: null,
+                    enterpriseSubmitId: null,
+                    info: '',
+                    completeRectifyTime: '',
+                    rectifyPrice: null,
+                    rectifyMeasure: '',
+                    chargePerson: ''
                 }
-                t.listLoading = false
-                t.dialogFix = false
             }
         },
     }

--
Gitblit v1.9.2