From 34ec919649adfefeecd0418284dd7b02e9ed49b8 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期三, 23 四月 2025 15:42:17 +0800
Subject: [PATCH] 添加批发仓库监测预警

---
 src/views/selfCheck/components/repair.vue |  203 ++++++++++++++++++++++++++------------------------
 1 files changed, 104 insertions(+), 99 deletions(-)

diff --git a/src/views/selfCheck/components/repair.vue b/src/views/selfCheck/components/repair.vue
index deafa3f..7323096 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">
@@ -19,65 +19,27 @@
             >
 
                 <el-table-column type="index" label="序号" align="center" width="80"/>
-
-                <el-table-column label="检查出的隐患问题" prop="info" align="center" width="180">
+                <el-table-column label="检查出的隐患问题" prop="hiddendangerRemark" align="center" width="180"></el-table-column>
+                <el-table-column label="检查时间" prop="checkTime" align="center"></el-table-column>
+                <el-table-column label="最后整改期限" prop="rectifyDeadlineTime" align="center"></el-table-column>
+                <el-table-column label="整改资金(元)" prop="rectifyPrice" align="center"></el-table-column>
+                <el-table-column label="整改措施" prop="rectifyMeasure" width="130" align="center" sortable></el-table-column>
+                <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.info }}</span>
+                        <span>{{ scope.row.rectifyStatus ==1?'已整改':'未整改' }}</span>
                     </template>
                 </el-table-column>
-
-                <el-table-column label="检查时间" prop="checkTime" align="center">
+                <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.checkTime}}</span>
+                        <span>{{ scope.row.hiddendangerLevel==1 ? '一般隐患' : '重大隐患' }}</span>
                     </template>
                 </el-table-column>
-
-                <el-table-column label="最后整改期限" prop="deadline" align="center">
+                <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
                     <template slot-scope="scope">
-                        <span>{{ scope.row.deadline }}</span>
-                    </template>
-                </el-table-column>
-
-                <el-table-column label="整改资金(元)" prop="money" align="center">
-                    <template slot-scope="scope">
-                        <span>{{ scope.row.money }}</span>
-                    </template>
-                </el-table-column>
-
-                <el-table-column label="整改措施" prop="action" width="130" align="center" sortable>
-                    <template slot-scope="scope">
-                        <span>{{ scope.row.action }}</span>
-                    </template>
-                </el-table-column>
-
-                <el-table-column label="负责人" prop="principal" align="center">
-                    <template slot-scope="scope">
-                        <span>{{ scope.row.principal }}</span>
-                    </template>
-                </el-table-column>
-
-                <el-table-column label="整改状态" prop="fixStatus" align="center">
-                    <template slot-scope="scope">
-                        <span>{{ scope.row.fixStatus ==0?'未整改':'已整改' }}</span>
-                    </template>
-                </el-table-column>
-
-                <el-table-column label="完成整改时间" prop="finishTime" align="center">
-                    <template slot-scope="scope">
-                        <span>{{ scope.row.finishTime }}</span>
-                    </template>
-                </el-table-column>
-
-                <el-table-column label="隐患等级" prop="level" align="center">
-                    <template slot-scope="scope">
-                        <span>{{ scope.row.level==0 ? '一般隐患' : '重大隐患' }}</span>
-                    </template>
-                </el-table-column>
-
-                <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-                    <template slot-scope="scope">
-                        <el-button v-if="scope.row.fixStatus==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>
@@ -97,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"
@@ -106,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.finishDate"
-                        type="date"
+                        v-model="fixForm.completeRectifyTime"
+                        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.money"></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.actions"></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.name"></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" v-stop-re-click @click="confirmFix('fixForm')">提交</el-button>
             </span>
         </el-dialog>
     </el-dialog>
@@ -140,51 +104,40 @@
 
 <script>
     import {computePageCount} from "@/utils";
+    import { getSelfRectifyInfo, saveSelfRectifyInfo } from "@/api/selfCheck";
 
     export default {
         name: "repair",
         data(){
             return{
+                id: null,
                 listLoading: false,
                 dialogFix: false,
                 recordTotal: 0,
                 pageSize: 10,
-                pageTotal: 0,
                 currentPage: 1,
                 tableKey: 0,
                 dialogVisible:false,
-                checkList:[
-                    {
-                        info: '虫吃鼠咬',
-                        checkTime: '2022-10-31',
-                        deadline: '2022-11-01',
-                        money: '30',
-                        action: '补充灭虫药',
-                        principal: '叼毛',
-                        fixStatus: 1,
-                        finishTime: '2022-11-01',
-                        level: 1
-                    },
-                    {
-                        info: '虫吃鼠咬',
-                        checkTime: '2022-10-31',
-                        deadline: '2022-11-01',
-                        money: '3000',
-                        action: '补充灭虫药',
-                        principal: '叼毛',
-                        fixStatus: 0,
-                        finishTime: '2022-11-01',
-                        level: 0
-                    }
-                ],
+                checkList:[],
                 fixForm:{
+                    id: null,
+                    enterpriseSubmitId: null,
                     info: '',
-                    finishDate: '',
-                    money: '',
-                    actions: '',
-                    name: ''
+                    completeRectifyTime: '',
+                    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()
         },
         watch: {
         },
@@ -199,17 +152,69 @@
                 // this.getDataList()
             },
 
+            async getSelfRectifyInfo(){
+                const t = this
+                t.listLoading = true
+                let res = await getSelfRectifyInfo({id: t.id})
+                if(res.data.code === "200"){
+                    t.checkList = res.data.result.hiddendangerBaseInfos
+                }else{
+                    t.$message({
+                        type:'warning',
+                        message:res.data.message
+                    })
+                }
+                t.listLoading = false
+            },
 
             confirm(){
                 this.dialogVisible = false
+                this.$parent.getUncheckList()
             },
 
-            confirmFix(){
-                this.dialogFix = false
+            toFix(row){
+                const t= this
+                t.fixForm.info = row.hiddendangerRemark
+                t.fixForm.id = row.id
+                t.dialogFix = true
             },
 
-            toFix(){
-                this.dialogFix = true
+            async confirmFix(formName){
+                const t = this
+                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: ''
+                }
             }
         },
     }

--
Gitblit v1.9.2