From 585fb0bbd4a7bc7f8f333ecba7c5fecd2ee5cbc2 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期四, 28 三月 2024 09:46:44 +0800
Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/vue_mdc_430 into develop

---
 src/views/eam/DailyInspectionStandardList.vue |  376 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 331 insertions(+), 45 deletions(-)

diff --git a/src/views/eam/DailyInspectionStandardList.vue b/src/views/eam/DailyInspectionStandardList.vue
index 1f7cf59..8ce3764 100644
--- a/src/views/eam/DailyInspectionStandardList.vue
+++ b/src/views/eam/DailyInspectionStandardList.vue
@@ -1,6 +1,6 @@
 <template>
   <a-card
-    title="鏃ュ父鐐规"
+    title="鑷富缁存姢鐐规鏍囧噯"
     :bordered='false'
   >
     <div class='table-page-search-wrapper'>
@@ -67,7 +67,25 @@
         type='primary'
         icon='plus'
         v-has="'dailyInspectionStandard:add'"
-      >鏂板</a-button>
+      >缂栧埗</a-button>
+      <a-upload
+        name="file"
+        :showUploadList="false"
+        :multiple="false"
+        :headers="tokenHeader"
+        :action="importExcelUrl"
+        @change="handleImportExcel"
+      >
+        <a-button
+          type="primary"
+          icon="import"
+        >瀵煎叆</a-button>
+      </a-upload>
+      <a-button
+        type="primary"
+        @click="handleDownload"
+        icon="download"
+      >妯$増涓嬭浇</a-button>
       <a-button
         type="primary"
         @click="searchQuery"
@@ -79,6 +97,22 @@
         icon="reload"
         style="margin-left: 8px"
       >閲嶇疆</a-button>
+      <a-button
+        v-show="this.selectedRowKeys.length > 0 && this.queryParam.versionStatus == '1'"
+        type="primary"
+        @click="batchHandleOK"
+        icon="reload"
+        style="margin-left: 8px"
+        v-has="'dailyInspectionStandard:batchHandleOK'"
+      >鎵归噺閫氳繃</a-button>
+      <a-button
+        v-show="this.selectedRowKeys.length > 0 && this.queryParam.versionStatus == '1'"
+        type="primary"
+        @click="batchHandleReject"
+        icon="reload"
+        style="margin-left: 8px"
+        v-has="'dailyInspectionStandard:batchHandleReject'"
+      >鎵归噺椹冲洖</a-button>
     </div>
 
     <!-- table鍖哄煙-begin -->
@@ -99,7 +133,7 @@
         size='middle'
         bordered
         rowKey='id'
-        :scroll="{ x: 'calc(1600px + 50%)', y: 900 }"
+        :scroll="{ x: 'calc(2300px + 50%)', y: 900 }"
         :columns='columns'
         :dataSource='dataSource'
         :pagination='ipagination'
@@ -108,6 +142,24 @@
         :customRow='clickThenSelect'
         @change='handleTableChange'
       >
+        <span
+          slot="disUda1"
+          slot-scope="text"
+        >
+          <j-ellipsis
+            :value="text"
+            :length="10"
+          />
+        </span>
+        <span
+          slot="teamName"
+          slot-scope="text"
+        >
+          <j-ellipsis
+            :value="text"
+            :length="10"
+          />
+        </span>
 
         <!-- <span
           slot='action'
@@ -135,32 +187,51 @@
           slot="action"
           slot-scope="text, record"
         >
+
           <a
-            v-if="record.versionStatus == '2'"
-            @click="handleRevise(record)"
-            v-has="'dailyInspectionStandard:revise'"
-          >鍗囩増</a>
+            v-show="record.versionStatus == '1' && record.approvalStatus == '1' "
+            @click="handleAuditApproval(record)"
+            v-has="'dailyInspectionStandard:audit'"
+          >瀹℃牳</a>
           <a-divider type="vertical" />
           <a
-            v-if="record.versionStatus == '1'"
-            @click="handleTakeEffect(record)"
-            v-has="'dailyInspectionStandard:takeEffect'"
-          >鐢熸晥</a>
+            v-show="record.versionStatus == '1' && record.approvalStatus == '4'"
+            @click="handleAuditApproval(record)"
+            v-has="'dailyInspectionStandard:againAudit'"
+          >閲嶆柊瀹℃牳</a>
           <a-divider type="vertical" />
           <a
-            v-if="record.versionStatus == '1'"
+            v-show="record.versionStatus == '1'&& record.approvalStatus == '3' "
+            @click="handleAuditApproval(record)"
+            v-has="'dailyInspectionStandard:approval'"
+          >瀹℃壒</a>
+          <a-divider type="vertical" />
+          <a
+            v-show="record.versionStatus == '1' && (record.approvalStatus == '1' || record.approvalStatus == '2')"
             @click="handleEdit(record)"
             v-has="'dailyInspectionStandard:edit'"
           >缂栬緫</a>
           <a-divider type="vertical" />
           <a-popconfirm
-            v-if="record.versionStatus == '1'"
+            v-show="record.versionStatus == '1' && (record.approvalStatus == '1' || record.approvalStatus == '2')"
             title="纭畾鍒犻櫎鍚�?"
             @confirm="() => handleDelete(record.id)"
             v-has="'dailyInspectionStandard:delete'"
           >
             <a>鍒犻櫎</a>
           </a-popconfirm>
+          <a-divider type="vertical" />
+          <a
+            v-show="record.versionStatus != '1'"
+            @click="handleRevise(record)"
+            v-has="'dailyInspectionStandard:revise'"
+          >鍗囩増</a>
+          <a-divider type="vertical" />
+          <a
+            v-show="record.versionStatus == '2'"
+            @click="handleTakeEffect(record)"
+            v-has="'dailyInspectionStandard:loseEfficacy'"
+          >澶辨晥</a>
         </span>
 
       </a-table>
@@ -184,6 +255,11 @@
       ref='modalForm'
       @ok='modalFormOk'
     ></dailylnspection-standard-modal>
+
+    <audit-approval-modal
+      ref='auditApprovalModal'
+      @ok='modalFormOk'
+    ></audit-approval-modal>
   </a-card>
 </template>
 
@@ -191,17 +267,21 @@
 
 import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 
-import { getAction, requestPut } from '@/api/manage'
+import { getAction, requestPut, downFile } from '@/api/manage'
 import DailyInspectionStandardDetail from './modules/dailyInspectionStandard/DailyInspectionStandardDetail'
 import DailylnspectionStandardModal from './modules/dailyInspectionStandard/DailylnspectionStandardModal'
+import AuditApprovalModal from './modules/dailyInspectionStandard/AuditApprovalModal'
 import '@/assets/less/TableExpand.less'
+import JEllipsis from "@/components/jeecg/JEllipsis";
 
 export default {
   name: 'DailyInspectionStandardList',
   mixins: [JeecgListMixin],
   components: {
+    JEllipsis,
     DailyInspectionStandardDetail,
-    DailylnspectionStandardModal
+    DailylnspectionStandardModal,
+    AuditApprovalModal
   },
   data() {
     return {
@@ -216,28 +296,26 @@
             return parseInt(index) + 1
           }
         },
-        {
-          title: '鐗堟湰',
-          align: 'center',
-          dataIndex: 'version',
-        },
-        {
-          title: '鐗堟湰鐘舵��',
-          align: 'center',
-          dataIndex: 'versionStatusName',
-        },
+
         {
           title: '鏍囧噯缂栫爜',
           align: 'center',
           dataIndex: 'num',
         },
         {
-          title: '瀵硅薄閮ㄩ棬',
+          title: '绠$悊鍒跺害',
           align: 'center',
-          dataIndex: 'useDepartName',
+          dataIndex: 'disUda1',
+          scopedSlots: { customRender: 'disUda1' },
         },
         {
-          title: '璁惧缂栫爜',
+          title: '绛惧鐘舵��',
+          align: 'center',
+          dataIndex: 'approvalStatusName',
+        },
+
+        {
+          title: '缁熶竴缂栫爜',
           align: 'center',
           dataIndex: 'equipmentNum',
         },
@@ -252,35 +330,95 @@
           dataIndex: 'equipmentModel',
         },
         {
+          title: '浣跨敤閮ㄩ棬',
+          align: 'center',
+          dataIndex: 'useDepartName',
+        },
+        {
           title: '璐d换鐝粍',
           align: 'center',
           dataIndex: 'teamName',
+          scopedSlots: { customRender: 'teamName' },
+        },
+        // {
+        //   title: '娲惧伐鏂瑰紡',
+        //   align: 'center',
+        //   dataIndex: 'assignModeName',
+        // },
+        {
+          title: '瀹℃牳缁撴灉',
+          align: 'center',
+          dataIndex: 'disUda2',
         },
         {
-          title: '娲惧伐鏂瑰紡',
+          title: '瀹℃牳鎰忚',
           align: 'center',
-          dataIndex: 'assignModeName',
+          dataIndex: 'auditFeedback',
+        },
+        {
+          title: '瀹℃壒缁撴灉',
+          align: 'center',
+          dataIndex: 'disUda3',
+        },
+        {
+          title: '瀹℃壒鎰忚',
+          align: 'center',
+          dataIndex: 'approvalFeedback',
+        },
+        {
+          title: '缂栧埗浜�',
+          align: 'center',
+          dataIndex: 'writePerson',
+        },
+        {
+          title: '瀹℃牳浜�',
+          align: 'center',
+          dataIndex: 'auditPerson',
+        },
+        {
+          title: '瀹℃壒浜�',
+          align: 'center',
+          dataIndex: 'approvalPerson',
+        },
+        {
+          title: '澶辨晥浜�',
+          align: 'center',
+          dataIndex: 'loseEfficacyPerson',
+        },
+        {
+          title: '缂栧埗鏃ユ湡',
+          align: 'center',
+          dataIndex: 'createTime',
+          width: 150,
         },
         {
           title: '鐢熸晥鏃堕棿',
           align: 'center',
           dataIndex: 'takeEffectTime',
+          width: 150,
         },
         {
           title: '澶辨晥鏃堕棿',
           align: 'center',
           dataIndex: 'loseEfficacyTime',
+          width: 150,
         },
         {
-          title: '鍒涘缓浜�',
+          title: '鐗堟湰',
           align: 'center',
-          dataIndex: 'createBy',
+          dataIndex: 'version',
         },
         {
-          title: '鍒涘缓鏃ユ湡',
+          title: '鐗堟湰鐘舵��',
           align: 'center',
-          dataIndex: 'createTime',
+          dataIndex: 'versionStatusName',
         },
+        // {
+        //   title: '鍒涘缓浜�',
+        //   align: 'center',
+        //   dataIndex: 'createBy',
+        // },
+
         // {
         //   title: '鏇存柊浜�',
         //   align: 'center',
@@ -297,7 +435,7 @@
           align: 'center',
           fixed: 'right',
           scopedSlots: { customRender: 'action' },
-          width: 200,
+          width: 230,
         }
       ],
       url: {
@@ -305,14 +443,18 @@
         delete: '/eam/inspectionStandard/delete',
         deleteBatch: '/eam/inspectionStandard/deleteBatch',
         versionTakeEffect: "/eam/inspectionStandard/versionTakeEffect",
+        importExcelUrl: "/eam/inspectionStandard/importExcel",
+        passBatch: '/eam/inspectionStandard/auditApprovalBatch',
+        download: '/sys/upload/downloadFile',
+        uploadList: '/sys/upload/list',
       },
       version: '1.0',
       dictOptions: {},
       /* 鍒嗛〉鍙傛暟 */
       ipagination: {
         current: 1,
-        pageSize: 5,
-        pageSizeOptions: ['5', '10', '50'],
+        pageSize: 20,
+        pageSizeOptions: ['5', '10', '20', '50'],
         showTotal: (total, range) => {
           return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�'
         },
@@ -321,6 +463,11 @@
         total: 0
       },
       inspectionStandardId: '-1'
+    }
+  },
+  computed: {
+    importExcelUrl: function () {
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
     }
   },
   methods: {
@@ -361,6 +508,12 @@
       this.$refs.modalForm.isRevise = false;
     },
 
+    //瀹℃牳瀹℃壒
+    handleAuditApproval: function (record) {
+      this.$refs.auditApprovalModal.showModals(record);
+      this.$refs.auditApprovalModal.title = "瀹℃牳";
+    },
+
     //鍗囩増
     handleRevise: function (record) {
       this.$refs.modalForm.edit(record);
@@ -368,23 +521,22 @@
       this.$refs.modalForm.disableSubmit = false;
       this.$refs.modalForm.isRevise = true;
     },
-
-    //鐢熸晥
+    //澶辨晥
     handleTakeEffect(record) {
       const that = this;
       that.confirmLoading = true;
       this.$confirm({
-        title: '鏃ュ父鐐规鏍囧噯鐗堟湰鐢熸晥锛�',
-        content: '鎻愮ず锛氱増鏈敓鏁堝悗涓婁竴鐗堟湰灏嗚嚜鍔ㄥけ鏁堬紝璇疯皑鎱庢搷浣滐紒',
+        title: '鏃ュ父鐐规鏍囧噯鐗堟湰澶辨晥锛�',
+        content: '鎻愮ず锛氱増鏈け鏁堝悗灏嗙姝娇鐢紝璇疯皑鎱庢搷浣滐紒',
         okText: '纭',
         cancelText: '鍙栨秷',
         onOk() {
-          requestPut(that.url.versionTakeEffect, { id: record.id, num: record.num, versionStatus: '2' }).then((res) => {
+          requestPut(that.url.versionTakeEffect, { id: record.id, num: record.num, versionStatus: '3' }).then((res) => {
             if (res.success) {
-              that.$message.success("鐗堟湰鐢熸晥鎴愬姛锛�")
+              that.$message.success("鐗堟湰澶辨晥鎴愬姛锛�")
               that.loadData(1)
             } else {
-              that.$message.warning("鐗堟湰鐢熸晥澶辫触锛�")
+              that.$message.warning("鐗堟湰澶辨晥澶辫触锛�")
             }
           }).finally(() => {
             that.confirmLoading = false;
@@ -423,9 +575,143 @@
     },
     searchReset() {
       this.inspectionStandardId = '-1'
-      this.queryParam = {}
+      this.queryParam = { versionStatus: '2' }
       this.loadData(1);
     },
+    modalFormOk() {
+      // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃
+      this.loadData();
+      //娓呯┖鍒楄〃閫変腑
+      // this.onClearSelected()
+    },
+    batchHandleReject: function () {
+      if (this.selectedRowKeys.length <= 0) {
+        // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒');
+        this.$notification.warning({
+          message: '娑堟伅',
+          description: "璇烽�夋嫨涓�鏉¤褰�"
+        });
+        return;
+      } else {
+
+        var that = this;
+        this.$confirm({
+          title: "纭鎵归噺椹冲洖",
+          content: "鏄惁鎵归噺椹冲洖閫変腑鏁版嵁?",
+          onOk: function () {
+            that.loading = true;
+            that.confirmLoading = true;
+            let formData = {};
+            let dailyInspectionStandardlist = that.selectionRows
+            for (var i = 0; i < dailyInspectionStandardlist.length; i++) {
+              let record = dailyInspectionStandardlist[i]
+              if (record.approvalStatus == '1') {
+                record.approvalStatus = '2'
+              } else if (record.approvalStatus == '3') {
+                record.approvalStatus = '4'
+              } else if (record.approvalStatus == '4') {
+                record.approvalStatus = '2'
+              }
+            }
+            formData.dailyInspectionStandardlist = dailyInspectionStandardlist
+            requestPut(that.url.passBatch, formData).then((res) => {
+              if (res.success) {
+                that.$message.success("鎵归噺椹冲洖鎴愬姛锛�")
+                that.loadData(1)
+              } else {
+                that.$message.warning("鎵归噺閫氳繃澶辫触锛�")
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.loading = false;
+            })
+          }
+        });
+      }
+    },
+
+    batchHandleOK: function () {
+      if (this.selectedRowKeys.length <= 0) {
+        // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒');
+        this.$notification.warning({
+          message: '娑堟伅',
+          description: "璇烽�夋嫨涓�鏉¤褰�"
+        });
+        return;
+      } else {
+
+        var that = this;
+        this.$confirm({
+          title: "纭鎵归噺閫氳繃",
+          content: "鏄惁鎵归噺閫氳繃閫変腑鏁版嵁?",
+          onOk: function () {
+            that.loading = true;
+            that.confirmLoading = true;
+            let formData = {};
+            let dailyInspectionStandardlist = that.selectionRows
+            for (var i = 0; i < dailyInspectionStandardlist.length; i++) {
+              let record = dailyInspectionStandardlist[i]
+              if (record.approvalStatus == '1') {
+                record.approvalStatus = '3'
+              } else if (record.approvalStatus == '2') {
+                record.approvalStatus = '3'
+              } else if (record.approvalStatus == '3') {
+                record.approvalStatus = '5'
+              } else if (record.approvalStatus == '4') {
+                record.approvalStatus = '3'
+              }
+            }
+            formData.dailyInspectionStandardlist = dailyInspectionStandardlist
+            requestPut(that.url.passBatch, formData).then((res) => {
+              if (res.success) {
+                that.$message.success("鎵归噺閫氳繃鎴愬姛锛�")
+                that.loadData(1)
+              } else {
+                that.$message.warning("鎵归噺閫氳繃澶辫触锛�")
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.loading = false;
+            })
+          }
+        });
+      }
+    },
+
+    handleDownload() {
+      var params = {}//鏌ヨ鏉′欢
+      params.type = "inspection"
+      params.pageNo = 1
+      params.pageSize = 10
+      getAction(this.url.uploadList, params).then((res2) => {
+        if (res2.success) {
+          if (res2.result.records.length > 0) {
+            downFile(this.url.download, { id: res2.result.records[0].id }).then((res) => {
+              if (!res) {
+                this.$message.warning('鏂囦欢涓嬭浇澶辫触')
+                return
+              } else {
+                let fileName = res2.result.records[0].name
+                if (typeof window.navigator.msSaveBlob !== 'undefined') {
+                  window.navigator.msSaveBlob(new Blob([res]), fileName)
+                } else {
+                  let url = window.URL.createObjectURL(new Blob([res]))
+                  let link = document.createElement('a')
+                  link.style.display = 'none'
+                  link.href = url
+                  link.setAttribute('download', fileName)
+                  document.body.appendChild(link)
+                  link.click()
+                  document.body.removeChild(link) //涓嬭浇瀹屾垚绉婚櫎鍏冪礌
+                  window.URL.revokeObjectURL(url) //閲婃斁鎺塨lob瀵硅薄
+                }
+              }
+            })
+          }
+        }
+      })
+    },
+
   }
 }
 </script>

--
Gitblit v1.9.3