From c7a73739b5498101fc4ad0a2d8a065dcf4acd66c Mon Sep 17 00:00:00 2001
From: Your Name <123456>
Date: 星期一, 23 五月 2022 14:43:07 +0800
Subject: [PATCH] '巡检记录'

---
 config/dev.env.js                                                                 |    8 +-
 src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue             |   19 ++++
 src/views/doublePreventAction/hiddenDanger/inspectionRecord/components/detail.vue |  154 +++++++++++++++++++++++++++++++++++---
 3 files changed, 164 insertions(+), 17 deletions(-)

diff --git a/config/dev.env.js b/config/dev.env.js
index dede865..99de487 100644
--- a/config/dev.env.js
+++ b/config/dev.env.js
@@ -18,12 +18,12 @@
   //   IMG_API: '"http://220.171.99.118:4100/upload/"',
       // BASE_API: '"http://192.168.0.35:8006"',
       // // IMG_API: '"http://192.168.0.35:8006/upload/"',
-      // BASE_API: '"http://192.168.0.35:8006"',
-      // IMG_API: '"http://192.168.0.35:8006/upload/"',
+      BASE_API: '"http://192.168.0.35:8006"',
+      IMG_API: '"http://192.168.0.35:8006/upload/"',
       // BASE_API: '"http://192.168.0.62:8006"',
       // IMG_API: '"http://192.168.0.62:8006/upload/"',
-    BASE_API: '"http://222.92.213.22:8006/zhongtai"',
-    IMG_API: '"http://222.92.213.22:8006/zhongtai/upload/"',
+    // BASE_API: '"http://222.92.213.22:8006/zhongtai"',
+    // IMG_API: '"http://222.92.213.22:8006/zhongtai/upload/"',
     NANO_API: '"http://222.92.213.22:8006/nanoweb"',
     ZT_API:'"http://123.56.127.115:8011"'
     // BASE_API: '"http://localhost:8006"',
diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/components/detail.vue b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/components/detail.vue
index acd9920..e3b1d0e 100644
--- a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/components/detail.vue
+++ b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/components/detail.vue
@@ -197,7 +197,122 @@
                         </el-col>
                     </el-row>
                 </div>
-                <div  style="text-align: center">
+                <div v-if="ifLook">
+                    <el-row>
+                        <el-col :span="24">
+                            <el-form-item label="异常通知部门" prop="noticeDepId">
+                                <el-select v-model="inspectionRecordDetailForm.problem.noticeDepId" filterable clearable class="input" @change="changeDepartment('notice')" readonly>
+                                    <el-option
+                                        v-for="item in departmentList"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.department"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                    <el-row>
+                        <el-col :span="24">
+                            <el-form-item label="异常通知人员" prop="noticeUid">
+                                <el-select v-model="inspectionRecordDetailForm.problem.noticeUid" clearable filterable readonly class="input">
+                                    <el-option
+                                        v-for="item in noticeUserList"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.realname"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                    <el-row>
+                        <el-col :span="24">
+                            <el-form-item label="整改时间" prop="fixTime">
+                                <el-date-picker placeholder="选择时间" v-model="inspectionRecordDetailForm.problem.fixTime" class="input" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" readonly></el-date-picker>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                    <el-row>
+                        <el-col :span="24">
+                            <el-form-item label="异常整改部门" prop="fixDepId">
+                                <el-select v-model="inspectionRecordDetailForm.problem.fixDepId" filterable clearable class="input" readonly>
+                                    <el-option
+                                        v-for="item in departmentList"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.department"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                    <el-row >
+                        <el-col :span="24">
+                            <el-form-item label="整改人" prop="fixUid">
+                                <el-select v-model="inspectionRecordDetailForm.problem.fixUid" clearable filterable readonly class="input">
+                                    <el-option
+                                        v-for="item in fixUserList"
+                                        :key="item.id"
+                                        :value="item.id"
+                                        :label="item.realname"
+                                    ></el-option>
+                                </el-select>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                    <el-row>
+                        <el-col :span="24">
+                            <el-form-item label="巡检结果备注" prop="info" >
+                                <el-input type="textarea" :rows="3" v-model="inspectionRecordDetailForm.problem.info" aria-readonly="true" class="input">
+                                </el-input>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                    <el-row>
+                        <el-col :span="24">
+                            <el-form-item label="上报图片" prop="imgInfoList">
+                                <el-upload
+                                    accept=".pdf,.jpg,.png"
+                                    :action="fileRoad"
+                                    class="upload-demo"
+                                    ref="upload"
+                                    :headers="header"
+                                    :data="uploadForm"
+                                    list-type="picture-card"
+                                    :file-list="fileList"
+                                    v-model="inspectionRecordDetailForm.imgInfoList"
+                                    :on-change="handleChangeFile"
+                                    :on-success="onFileSuccess"
+                                    :auto-upload="true">
+                                    <i slot="default" class="el-icon-plus"></i>
+                                    <div slot="file" slot-scope="{file}">
+                                        <img
+                                            class="el-upload-list__item-thumbnail"
+                                            :src="file.url" alt=""
+                                        >
+                                        <span class="el-upload-list__item-actions">
+                                <span
+                                    class="el-upload-list__item-preview"
+                                    @click="handleFile(file)"
+                                >
+                                  <i class="el-icon-zoom-in"></i>
+                                </span>
+                                <span
+                                    v-if="!disabled"
+                                    class="el-upload-list__item-delete"
+                                    @click="handleRemove(file,'one')"
+                                >
+                                  <i class="el-icon-delete"></i>
+                                </span>
+                              </span>
+                                    </div>
+                                </el-upload>
+                            </el-form-item>
+                        </el-col>
+                    </el-row>
+                </div>
+                <div  style="text-align: center" v-show="ifConfirm">
                     <el-button @click="inspectionRecordDetailFormVisible = false">取消</el-button>
                     <el-button type="primary" @click="submitInspectionRecordDetail()">确认</el-button>
                 </div>
@@ -262,12 +377,14 @@
                 inspectionRecordDetailFormVisible:false,
                 ifShow:true,
                 ifNormal:false,
+                ifLook:false,
+                ifConfirm:false,
                 userList:[],
                 noticeUserList:[],
                 fixUserList:[],
                 departmentList:[],
                 fileList:[],
-                resultList:[{id:0,name:'未操作'},{id:1,name:'正常'},{id:2,name:'异常'}],
+                resultList:[{id:0,name:'未巡检'},{id:1,name:'正常'},{id:2,name:'异常'}],
                 typeList:[{id:1,name:'日常检查'},{id:2,name:'周期检查'}],
                 statusList:[{id:1,name:'待巡检'},{id:2,name:'巡检中'},{id:3,name:'已完成'},{id:4,name:'超时未巡检'},{id:5,name:'已取消'}],
             }
@@ -282,24 +399,28 @@
             },
             showInspectionRecordDetailForm(value,type,userList,departmentList) {
                 this.inspectionRecordDetailFormVisible = true
+                this.$nextTick(() =>{
+                    this.$refs["inspectionRecordDetailForm"].clearValidate()
+                })
                 this.userList = userList
                 this.departmentList = departmentList
                 if(type === '查看'){
-                    this.titleDetail = '巡检单元查看'
-                    this.ifShow = true
+                    this.titleDetail = '查看单元上报'
+                    this.ifNormal = false
+                    this.ifLook = true
+                    this.ifConfirm = false
                     this.inspectionRecordDetailForm = JSON.parse(JSON.stringify(value))
-                    if(value.result !== 1){
-                        this.ifNormal = true
+                    if(this.inspectionRecordDetailForm.problem.imageInfoList === null){
                         this.fileList = []
-                        this.fileList =(value.img === null ? [] : [ {url:process.env.IMG_API + value.img} ])
+                    }else{
+                        this.fileList = this.inspectionRecordDetailForm.problem.imageInfoList.map( item => { return { url : process.env.IMG_API + item.imgPath}})
                     }
                 }else{
                     this.titleDetail = '巡检单元上报'
                     this.ifShow = false
                     this.ifNormal = false
-                    this.$nextTick(() =>{
-                        this.$refs["inspectionRecordDetailForm"].clearValidate()
-                    })
+                    this.ifLook = false
+                    this.ifConfirm = true
                     this.inspectionRecordDetailForm = {
                         execUid: Cookies.get('userId'),
                         fixTime: null,
@@ -327,9 +448,18 @@
                 }
                 this.$refs["inspectionRecordDetailForm"].validate((valid) =>{
                     if(valid){
-                        this.inspectionRecordDetailForm.imgInfoList = this.inspectionRecordDetailForm.imgInfoList.map(item =>{ return { url:item.url}})
+                        if(this.inspectionRecordDetailForm.result === 0){
+                            this.$message({
+                                type:'warning',
+                                message:'请选择正确的巡检结果'
+                            })
+                            return
+                        }
+                        this.inspectionRecordDetailForm.imgInfoList = this.inspectionRecordDetailForm.imgInfoList.map(item =>{ return { imagePath:item.imagePath}})
                         submitUnitOne(this.inspectionRecordDetailForm).then( res =>{
                             if(res.data.code === '200'){
+                                this.inspectionRecordDetailFormVisible = false
+                                this.$emit('getList')
                                 this.$message({
                                     type:'success',
                                     message:'上报成功',
@@ -374,7 +504,7 @@
             },
             onFileSuccess(response){
                 if(response.code === '200'){
-                    this.inspectionRecordDetailForm.imgInfoList.push({url:response.result.path,name:response.result.name,})
+                    this.inspectionRecordDetailForm.imgInfoList.push({imagePath:response.result.path,name:response.result.name,})
                     this.fileList.push({url:process.env.IMG_API + response.result.path,name:response.result.name,})
                     this.$notify({
                         type:'success',
diff --git a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue
index e40c8bd..9f03856 100644
--- a/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue
+++ b/src/views/doublePreventAction/hiddenDanger/inspectionRecord/index.vue
@@ -83,6 +83,9 @@
                             <el-table-column label="上报说明" prop="info" align="center">
                             </el-table-column>
                             <el-table-column label="上报照片" prop="img" align="center">
+                                <template slot-scope="scope">
+                                    <el-button type="text" @click="downloadFile(scope.row)">下载</el-button>
+                                </template>
                             </el-table-column>
                             <el-table-column label="状态" prop="status" align="center">
                                 <template slot-scope="scope">
@@ -140,7 +143,7 @@
             />
             <br>
         </div>
-        <detail ref="detail"></detail>
+        <detail ref="detail" @getList="getInspectionRecordData"></detail>
     </div>
 </template>
 
@@ -292,6 +295,7 @@
                         taskId: value.id
                     })
                     if(res.data.code === '200'){
+                        this.getInspectionRecordData()
                         this.$message({
                             type:'success',
                             message:'提交成功',
@@ -311,6 +315,19 @@
                     })
                 }
             },
+            downloadFile(value){
+                debugger
+                if(value.problem.imageInfoList === null){
+                    this.$message({
+                        type:'warning',
+                        message:'无文件可下载'
+                    })
+                }else{
+                    for(let i in value.problem.imageInfoList){
+                        window.open(process.env.IMG_API + value.problem.imageInfoList[i].imgPath, '_blank')
+                    }
+                }
+            },
             refreshHandle(){
                 this.getInspectionRecordData()
             },

--
Gitblit v1.9.2