From d271f2493796a557eac67b95b310df776abaf48b Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期一, 06 五月 2024 16:15:24 +0800
Subject: [PATCH] 修改产品检,不合格处理等页面

---
 src/views/quality/finishedProductInspection/index.vue |   56 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/src/views/quality/finishedProductInspection/index.vue b/src/views/quality/finishedProductInspection/index.vue
index 6a959ab..1856df6 100644
--- a/src/views/quality/finishedProductInspection/index.vue
+++ b/src/views/quality/finishedProductInspection/index.vue
@@ -2,7 +2,7 @@
 	<div class="content-main">
 		<div class="rawPage">
             <basic-container>
-                <ttable 
+                <ttable
                 :table="table"
                 @handleSelectionChange="handleSelectionChange"
                 :prelang="prelang"
@@ -33,11 +33,12 @@
     import ttable from '@/views/common/ztt-table.vue'
     import * as fecha from 'element-ui/lib/utils/date'
 	import finishedProductInspectionAdd from './finishedProduct-form'
-    import { page,deletePro,exportExaminationProducts,queryById } from '@/api/quality/finishedProduct'
+    import { page,deletePro,exportExaminationProducts,queryById,downloadReport } from '@/api/quality/finishedProduct'
     import { transform } from '@/util/fileTransform'
     import { mapGetters } from 'vuex'
     import printTemplate from './finishedProducter-print.vue'
     import PrintJS from 'print-js'
+    import { transformZip } from '@/util/fileTransform'
 	export default {
     components: {
         finishedProductInspectionAdd,
@@ -46,6 +47,7 @@
     },
     data() {
         return {
+            multipleSelection: [],
             printFormData: null,
             printDialogVisible: false,
             result:[{label:'鍏ㄩ儴',value: ''},{label:'鍚堟牸',value: '1'},{label:'涓嶅悎鏍�',value: '0'}],
@@ -108,7 +110,6 @@
                     },
                     {
                         minWidth: '130',
-                        width: '150',
                         prop: 'projectName',
                         label: '宸ョ▼鍚嶇О',
                         sort: true,
@@ -134,8 +135,9 @@
                     },
                     {
                         minWidth: '120',
+                        width: '150',
                         prop: 'material',
-                        label: '浜у搧澶х被',
+                        label: '浜у搧鍚嶇О',
                         isTrue: true,
                         isSearch: true,
                         searchInfoType: 'text'
@@ -167,7 +169,7 @@
                     {
                         minWidth: '120',
                         prop: 'createTime',
-                        label: '妫�楠屾棩鏈�',
+                        label: '鎶ユ鏃ユ湡',
                         sort: true,
                         isTrue: true,
                         isSearch: true,
@@ -198,11 +200,13 @@
             },
         }
     },
-    created() { 
+    created() {
         if(this.permissions.quality_finishedProductInspection_download){
             this.table.toolbar.push({
                 text: '涓嬭浇妫�楠屾姤鍛�',
                 type: 'primary',
+                loading: false,
+                disabled: false,
                 fun: this.downloadProReport
             })
         }
@@ -227,6 +231,36 @@
     },
     methods: {
         downloadProReport(){
+            const _than = this
+            let selection = this.multipleSelection
+            if(!selection || selection.length < 1){
+                this.$message.error("璇峰厛閫夋嫨妫�楠屾暟鎹�")
+                return
+            }else{
+                let arr = selection.filter(s=>{
+                    return s.result==null || s.result==''
+                })
+                if(arr.length > 0){
+                    this.$message.error("鍙兘閫夋嫨宸叉娴嬬殑鏁版嵁")
+                    return
+                }
+                let ids = []
+                selection.forEach(ele=>{
+                    ids.push(ele.id)
+                })
+                _than.table.toolbar.find((e) => e.text === '涓嬭浇妫�楠屾姤鍛�').loading = true
+                _than.table.toolbar.find((e) => e.text === '涓嬭浇妫�楠屾姤鍛�').disabled = true
+                try {
+                    downloadReport({ids : ids}).then(res=>{
+                        transformZip(res)
+                    })
+                } catch (error) {
+                    console.log(error)
+                } finally{
+                    _than.table.toolbar.find((e) => e.text === '涓嬭浇妫�楠屾姤鍛�').loading = false
+                    _than.table.toolbar.find((e) => e.text === '涓嬭浇妫�楠屾姤鍛�').disabled = false
+                }
+            }
         },
         //鎵撳嵃鎸夐挳
         printFun() {
@@ -285,11 +319,11 @@
             }
             this.$router.push({
                 name: 'finishedProductForm',
-                query: { 
+                query: {
                     id: row == null ? null : row.id,
                 },
                 params: {
-                    resultVal: row == null ? null : row.result 
+                    resultVal: row == null ? null : row.result
                 }
             })
         },
@@ -305,7 +339,9 @@
         formatDateTime(row, column, cellValue) {
             return cellValue ? fecha.format(new Date(cellValue), 'yyyy-MM-dd') : ''
         },
-        handleSelectionChange(){ },
+        handleSelectionChange(val){
+            this.multipleSelection = val
+        },
         getData() {
             this.$refs.finishedProduct.getDataList()
         },
@@ -397,4 +433,4 @@
     flex: 1;
     overflow-y: scroll;
 } */
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3