From 44d7a737dc0d63ad1dd7c52d45fc2233d1950173 Mon Sep 17 00:00:00 2001
From: lyfO_o <764716047@qq.com>
Date: 星期四, 09 六月 2022 09:56:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'remotes/origin/shf' into master

---
 src/views/hiddenDangerRectification/index.vue |   91 ++++++++++++++++++++++++++++++---------------
 1 files changed, 60 insertions(+), 31 deletions(-)

diff --git a/src/views/hiddenDangerRectification/index.vue b/src/views/hiddenDangerRectification/index.vue
index 521cf84..6f72fa9 100644
--- a/src/views/hiddenDangerRectification/index.vue
+++ b/src/views/hiddenDangerRectification/index.vue
@@ -45,7 +45,7 @@
                         v-for="item in YHBMList"
                         :key="item.branch_id"
                         :label="item.branch_name"
-                        :value="item.branch_id">
+                        :value="item.branch_name">
                     </el-option>
                 </el-select>
             </el-form-item>
@@ -141,7 +141,8 @@
                 <el-button type="primary" class="btns" size="small" icon="el-icon-search" @click="getPageList()">查询
                 </el-button>
                 <el-button type="primary" class="btns" size="small" @click="reset()">重置</el-button>
-                <el-button type="primary" class="btns" size="small" icon="el-icon-upload2" @click="exportData">导出excel</el-button>
+                <el-button type="primary" class="btns" size="small" icon="el-icon-upload2" @click="exportData">导出excel
+                </el-button>
             </el-form-item>
         </el-form>
         <el-row class="title-center">
@@ -149,7 +150,7 @@
                 <el-button class="btns" type="primary" size="small" @click="applyDelay()">申请延期</el-button>
             </el-col>
         </el-row>
-        <el-table :data="tableData" ref="dangerRectificationTable" style="width: 100%">
+        <el-table :data="tableData" ref="dangerRectificationTable" style="width: 100%" v-loading="loading">
             <el-table-column type="selection" width="55" align="center"></el-table-column>
             <el-table-column prop="number" label="编号" align="center" width="120">
                 <template slot-scope="scope">
@@ -162,11 +163,11 @@
             <el-table-column label="隐患项目" align="center">
                 <el-table-column prop="check_date" label="检查时间" width="120" align="center">
                     <template slot-scope="scope">
-                        <label>{{ formatDate(scope.row.check_date)}}</label><br/>
-                        <label>{{ scope.row.check_class}}</label>
+                        <label>{{ formatDate(scope.row.check_date) }}</label><br/>
+                        <label>{{ scope.row.check_class }}</label>
                     </template>
                 </el-table-column>
-                <el-table-column prop="address" label="地点"   align="center"></el-table-column>
+                <el-table-column prop="address" label="地点" align="center"></el-table-column>
                 <el-table-column prop="ht_content" label="内容" width="150" align="center">
                     <template slot-scope="scope">
                         <el-popover trigger="hover" placement="top">
@@ -195,13 +196,16 @@
                 </el-table-column>
                 <el-table-column prop="ht_branch" label="隐患部门" align="center"></el-table-column>
                 <el-table-column prop="duty_officer" label="责任人" align="center"></el-table-column>
-                <el-table-column prop="alter_time" label="限改时间" width="120" :formatter="formatColumnDate" align="center"></el-table-column>
+                <el-table-column prop="alter_time" label="限改时间" width="120" :formatter="formatColumnDate"
+                                 align="center"></el-table-column>
             </el-table-column>
             <el-table-column label="整改情况" align="center">
-                <el-table-column prop="ACCOMPLISHTIME" label="完成时间" :formatter="formatColumnDate" width="120" align="center"></el-table-column>
+                <el-table-column prop="ACCOMPLISHTIME" label="完成时间" :formatter="formatColumnDate" width="120"
+                                 align="center"></el-table-column>
                 <el-table-column prop="CALLBACKRESULT" label="复查结果" align="center"></el-table-column>
                 <el-table-column prop="CALLBACKPERSON" label="复查人" align="center"></el-table-column>
-                <el-table-column prop="CALLBACKTIME" label="复查时间" width="120" align="center"></el-table-column>
+                <el-table-column prop="CALLBACKTIME" label="复查时间" :formatter="formatColumnDate" width="120"
+                                 align="center"></el-table-column>
             </el-table-column>
             <el-table-column label="隐患处理状态" align="center">
                 <template slot-scope="scope">
@@ -215,7 +219,7 @@
             <el-table-column prop="DTRisk_level" label="风险等级" align="center"></el-table-column>
             <el-table-column prop="warningLevel" label="初始警情" align="center"></el-table-column>
             <el-table-column prop="curWarningLevel" label="当前警情" align="center"></el-table-column>
-            <el-table-column prop="date" label="流程操作" align="center">
+            <el-table-column prop="date" label="流程操作" align="center" fixed="right">
                 <template slot-scope="scope">
                     <el-button @click="handleClick(scope.row)" type="text" size="small">点击发送</el-button>
                 </template>
@@ -223,7 +227,7 @@
         </el-table>
         <!--申请延期弹窗-->
         <el-dialog
-            title="提示"
+            title="申请延期"
             :visible.sync="dialogVisible"
             :close-on-click-modal="false"
             width="30%"
@@ -249,6 +253,7 @@
                         <el-form-item label="附件上传" prop="desc">
                             <el-upload
                                 class="upload-demo"
+                                action="https://jsonplaceholder.typicode.com/posts/"
                                 ref="upload"
                                 :http-request="uploadSectionFile"
                                 :on-preview="handlePreview"
@@ -258,7 +263,7 @@
                                 :auto-upload="true"
                             >
                                 <el-button slot="trigger" size="small" type="primary" class="btns">选择文件</el-button>
-                                <div slot="tip" class="el-upload__tip">只能上传.jpg,.gif,.bmp,.png,.jpeg格式的图片</div>
+                                <div slot="tip" class="el-upload__tip">只能上传.jpg,.gif,.bmp,.png,.doc,.docx,.pdf,.ppt,.pptx,.xls,.xlsx,.rar,.zip格式的图片</div>
                             </el-upload>
                         </el-form-item>
                     </el-col>
@@ -293,7 +298,7 @@
     </div>
 </template>
 <script>
-import {getPageList, uploadFile, saveDelayApply,danger_export_do} from "@/api/sgyhpczl/hiddenDangerRectification";
+import {getPageList, uploadFile, saveDelayApply, danger_export_do} from "@/api/sgyhpczl/hiddenDangerRectification";
 import {initJCBM, initYHLX, initBC, initJCLB, initYHBM, initYHJB, initLlr} from "@/api/sgyhpczl/initSelect";
 
 export default {
@@ -312,6 +317,8 @@
             YHBMList: [],
             YHJBList: [],
             tableData: [],
+            fileNameList: [],
+            loading: false,
             listQuery: {
                 page: 1,
                 limit: 10,
@@ -429,7 +436,9 @@
         getPageList() {
             this.listQuery.page = 1
             this.checkTime()
+            this.loading = true;
             getPageList(this.listQuery).then(res => {
+                this.loading = false;
                 if (res.data.ok == 1) {
                     this.tableData = res.data.data.items
                     this.recordTotal = res.data.data.total
@@ -505,7 +514,7 @@
         handleClick(row) {
             this.$router.push({
                 path: "/sendHiddenDangerList",
-                query:{"id":row.id}
+                query: {"id": row.id}
             })
         },
         handleClose(done) {
@@ -517,17 +526,22 @@
                 });
         },
         handleRemove(file, fileList) {
-            console.log(file, fileList)
+            var fileUidList = [];
+            fileList.forEach(file => {
+                fileUidList.push(file.uid);
+            })
+            this.fileNameList = this.fileNameList.filter(n => fileUidList.indexOf(n.uid) != -1);
         },
         handlePreview(file) {
             console.log(file)
         },
         beforeUpload(file) {
             var FileExt = file.name.replace(/.+\./, "");
-            if (['jpg', 'png', 'bmp', 'gif', 'jpeg'].indexOf(FileExt.toLowerCase()) === -1) {
+            //.jpg,.gif,.bmp,.png,.doc,.docx,.pdf,.ppt,.pptx,.xls,.xlsx,.rar,.zip
+            if (['jpg', 'png', 'bmp', 'gif', 'jpeg','doc','docx','pdf','ppt','xls','pptx','xls','xlsx','rar','zip'].indexOf(FileExt.toLowerCase()) === -1) {
                 this.$message({
                     type: 'warning',
-                    message: '请上传后缀名为jpg、png、bmp、gif、jpeg的图片!'
+                    message: '请上传后缀名为jpg,gif,bmp,png,doc,docx,pdf,ppt,pptx,xls,xlsx,rar,zip的图片!'
                 });
                 return false;
             }
@@ -549,6 +563,11 @@
         applyDelaySave() {
             this.$refs["ruleForm"].validate((valid) => {
                 if (valid) {
+                    this.ruleForm.realFileName = "";
+                    this.fileNameList.forEach(n => {
+                        this.ruleForm.realFileName += n.fileName + ",";
+                    })
+                    this.ruleForm.realFileName.substring(0, this.ruleForm.realFileName.length - 1);
                     saveDelayApply(this.ruleForm).then(res => {
                         this.dialogVisible = false;
                         this.$message({
@@ -571,21 +590,27 @@
                 if (data.ok) {
                     var fileName = data.data.fileName[0];
                     if (!fileName.endsWith("a62b")) {
-                        fileName = fileName + param.file.realFileName;
+                        fileName = fileName + "a62b";
                     }
-                    that.ruleForm.realFileName = that.ruleForm.realFileName + "," + fileName;
+                    var fileObj = {
+                        "fileName": fileName,
+                        "uid": param.file.uid
+                    }
+                    this.fileNameList.push(fileObj);
+                    // that.ruleForm.realFileName = that.ruleForm.realFileName + "," + fileName;
                 }
-            }).error(res => {
-                this.$message({
-                    type: 'error',
-                    message: '附件上传失败,请重试!'
-                });
             })
+            //     .error(res => {
+            //     this.$message({
+            //         type: 'error',
+            //         message: '附件上传失败,请重试!'
+            //     });
+            // })
         },
         //方法区
         formatDate(data) {
             // 获取单元格数据
-            if(data == null) {
+            if (data == null) {
                 return null
             }
             let dt = new Date(data)
@@ -596,19 +621,21 @@
         formatColumnDate(row, column) {
             // 获取单元格数据
             let data = row[column.property]
-            if(data == null) {
+            if (data == null) {
                 return null
             }
             let dt = new Date(data)
             return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate() + ' '
         },
-        exportData(){
-            var requestData = this.listQuery;
+        exportData() {
+            this.listLoading = true
+            var requestData = JSON.parse(JSON.stringify(this.listQuery));
             requestData.export_type = 2;
             //删除分页参数
             this.$delete(requestData, 'page')
             this.$delete(requestData, 'limit')
             danger_export_do(requestData).then(res => {
+                this.listLoading = false
                 var blob = new Blob([res.data])
                 var downloadElement = document.createElement('a')
                 var href = window.URL.createObjectURL(blob) //创建下载的链接
@@ -622,10 +649,10 @@
                 console.log(err)
             })
         },
-        showDetails(row){
+        showDetails(row) {
             this.$router.push({
                 path: "/dangerDetails",
-                query:{"id":row.id}
+                query: {"id": row.id}
             })
         }
     }
@@ -656,10 +683,12 @@
     max-height: 80px;
     overflow-y: auto
 }
-.blue-font-color:hover{
+
+.blue-font-color:hover {
     cursor: pointer;
     color: blue;
 }
+
 /deep/ .el-dialog .button .el-form-item__content {
     margin-left: 0;
 }

--
Gitblit v1.9.2