From 9a0e4f1641f41a3dc1df4453ad416fb1522bd2ea Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期四, 18 一月 2024 17:30:49 +0800
Subject: [PATCH] 	modified:   src/page/wel.vue 	modified:   src/views/quality/rawMaterial/rawMaterial-form.vue

---
 src/views/plan/customerorder/index.vue |   55 ++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/src/views/plan/customerorder/index.vue b/src/views/plan/customerorder/index.vue
index 990cd87..7990386 100644
--- a/src/views/plan/customerorder/index.vue
+++ b/src/views/plan/customerorder/index.vue
@@ -54,11 +54,6 @@
             type="primary"
             @click="()=>exportDialogVisible=true"
             >瀵煎嚭鍙拌处</el-button>
-          <el-button
-            style="margin-left:10px;"
-            type="primary"
-            @click="downloadWord"
-            >涓嬭浇</el-button>
         </template>
       </ttable>
       <!-- 寮圭獥, 鏃ユ湡閫夋嫨 -->
@@ -290,6 +285,7 @@
 export default {
   data() {
     return {
+      uniqueStateArr: [],
       dataForm: {
         selectTime: null,
         exportTime: null
@@ -855,14 +851,23 @@
         text: '璁剧疆閿�鍞欢',
         type: 'primary',
         fun: this.setSalesPart,
-        disabled: false
+        disabled: false,
+        permitArr: []
       })
     }
+    this.table.toolbar.push({
+        text: '涓嬭浇Word',
+        disabled: false,
+        type: 'primary',
+        fun: this.downloadWord,
+        permitArr: ['03plan','04planed'],
+    })
     if (this.permissions.customerorder_create_masterplan) {
       this.table.toolbar.push({
         text: '涓荤敓浜ц鍒�',
         disabled: false,
-        fun: this.masterPlanHandle
+        fun: this.masterPlanHandle,
+        permitArr: []
       })
     }
   },
@@ -874,7 +879,23 @@
             this.$message.error("璇烽�夋嫨涓�鏉℃暟鎹�")
             return
         }
-        downloadWordFile(ids)
+        downloadWordFile(ids).then(response=>{
+          // 澶勭悊杩斿洖鐨勬枃浠舵祦
+          const blob = response.data
+          const link = document.createElement('a')
+          link.href = URL.createObjectURL(blob)
+          const disposition = response.headers["content-disposition"]
+          let temp = disposition.substring(disposition.lastIndexOf('=') + 1)
+          link.download = decodeURI(temp)
+          document.body.appendChild(link)
+          link.click()
+          window.setTimeout(function() {
+            URL.revokeObjectURL(blob)
+            document.body.removeChild(link)
+          }, 0)
+        }).catch(error=>{
+            console.error(error);
+        })
     },
     getOtcPartSyncOptionList() {
       return this.otcPartSyncOptionList
@@ -1028,7 +1049,8 @@
             }
           })
           if (flag) {
-            checkOA(this.multipleSelection.map((e) => e.id)).then((res) => {
+
+            checkOA(this.multipleSelection.map((e) => e.id),{}).then((res) => {
               if (!res.data.data.success) {
                 this.$confirm(`${res.data.data.message}`, '鎻愮ず', {
                   confirmButtonText: '纭畾',
@@ -1192,6 +1214,21 @@
           this.stateTagArr[i].disabled = true
         }
       }
+      // 寰幆琛ㄥご鎸夐挳锛屽垽鏂瘡涓寜閽殑permitArr鏄惁瀹屽叏鍖呭惈閫変腑鐘舵�侊紝鑻ュ畬鍏ㄥ寘鍚紝鍒欐寜閽寒锛屽惁鍒欐寜閽伆
+      var toolbar = this.table.toolbar
+      for (var j = 0; j < toolbar.length; j++) {
+        if (
+          uniqueStateArr.every((val) =>
+            toolbar[j].permitArr.length <= 0
+              ? true
+              : toolbar[j].permitArr.includes(val)
+          )
+        ) {
+          toolbar[j].disabled = false
+        } else {
+          toolbar[j].disabled = true
+        }
+      }
       this.multipleSelection = val
     },
     getCustomerCoState(row, column, cellValue) {

--
Gitblit v1.9.3