From d896d25a2bee6dc9496f102035b2d68d17f3de65 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期二, 05 三月 2024 13:58:13 +0800
Subject: [PATCH] 生产调度变更记录功能

---
 src/views/plan/masterproductionschedule/index.vue |  146 ++++++++++++++++++------------------------------
 1 files changed, 55 insertions(+), 91 deletions(-)

diff --git a/src/views/plan/masterproductionschedule/index.vue b/src/views/plan/masterproductionschedule/index.vue
index 38dffbb..8618138 100644
--- a/src/views/plan/masterproductionschedule/index.vue
+++ b/src/views/plan/masterproductionschedule/index.vue
@@ -22,6 +22,7 @@
               <el-dropdown-item
                 :command="item.command"
                 v-for="item in orderTypeArr"
+                :key="item.value"
                 :disabled="item.disabled"
                 >{{ item.label }}</el-dropdown-item
               >
@@ -40,6 +41,7 @@
               <el-dropdown-item
                 :command="item.command"
                 v-for="item in stateTagArr"
+                :key="item.value"
                 :disabled="item.disabled"
                 >{{ item.label }}</el-dropdown-item
               >
@@ -65,7 +67,7 @@
             </el-dropdown-menu>
           </el-dropdown> -->
           <!--瀹℃牳鐘舵�佹敼鍙�-->
-          <el-dropdown
+          <!-- <el-dropdown
             v-if="permissions.masterproductionschedule_audit_change"
             @command="handleCommitCommand"
             style="margin-left: 10px"
@@ -81,15 +83,15 @@
                 >{{ item.label }}</el-dropdown-item
               >
             </el-dropdown-menu>
-          </el-dropdown>
-          <el-button
+          </el-dropdown> -->
+          <!-- <el-button
             v-if="permissions.masterproductionschedule_submit_oa"
             @click="commitOa()"
             type="primary"
             style="margin-left:10px;"
             :loading="loadingOa"
             >鎻愪氦OA
-          </el-button>
+          </el-button> -->
           <!-- <el-button
             v-if="permissions.masterproductionschedule_sync_scm"
             @click="syncScm()"
@@ -213,7 +215,8 @@
       statesList: [
         { value: '01pending', label: '寰呭鐞�' },
         { value: '02processed', label: '宸插鐞�' },
-        { value: '03canceled', label: '宸蹭綔搴�' }
+        { value: '03canceled', label: '宸蹭綔搴�' },
+        { value: '04completed', label: '宸插畬鎴�' }
       ],
       isAuditList: [
         {
@@ -239,19 +242,25 @@
           label: '鏍囪寰呭鐞�',
           command: 'PENDING',
           disabled: false,
-          permitArr: ['02processed']
+          permitArr: ['01pending']
         },
         {
           label: '鏍囪宸插鐞�',
           command: 'PROCESSED',
           disabled: false,
-          permitArr: ['01pending']
+          permitArr: ['02processed']
         },
         {
           label: '鏍囪宸蹭綔搴�',
           command: 'CANCELED',
           disabled: false,
-          permitArr: ['01pending']
+          permitArr: ['03canceled']
+        },
+        {
+          label: '鏍囪宸插畬鎴�',
+          command: 'COMPLETED',
+          disabled: false,
+          permitArr: ['04completed','02processed']
         }
       ],
       documentTagArr: [
@@ -411,7 +420,7 @@
             isSearch: true,
             searchInfoType: 'text'
           },
-          {
+          /* {
             minWidth: '140',
             prop: 'inventoryReservedQuantity',
             label: '搴撳瓨棰勭暀鏁伴噺',
@@ -419,8 +428,8 @@
             isTrue: true,
             isSearch: false,
             searchInfoType: 'text'
-          },
-          {
+          }, */
+          /* {
             minWidth: '140',
             prop: 'outsourcingNumber',
             label: '濮斿鏁伴噺',
@@ -428,7 +437,7 @@
             isTrue: true,
             isSearch: false,
             searchInfoType: 'text'
-          },
+          }, */
           {
             minWidth: '140',
             prop: 'manufacturingQuantity',
@@ -552,7 +561,7 @@
             isTrue: true,
             isSearch: true,
             searchInfoType: 'text'
-          },
+          }/* ,
           {
             minWidth: '140',
             prop: 'outerColor',
@@ -588,39 +597,14 @@
             isTrue: true,
             isSearch: true,
             searchInfoType: 'text'
-          }
+          } */
         ],
         toolbar: [],
-        operator: [
-          {
-            text: '璁㈠崟棰勭暀',
-            type: 'text',
-            size: 'small',
-            fun: this.customReserved
-          },
-          // {
-          //   text: '鏌ョ湅搴撳瓨',
-          //   type: 'text',
-          //   size: 'small',
-          //   fun: this.stockHandle
-          // },
-          {
-            text: '鏉ユ簮',
-            type: 'text',
-            size: 'small',
-            fun: this.searchMasterPlanSourceHandle
-          },
-          {
-            text: '璁㈠崟',
-            type: 'text',
-            size: 'small',
-            fun: this.searchOrderHandle
-          }
-        ],
+        operator: null,
         operatorConfig: {
           fixed: 'right',
           label: '鎿嶄綔',
-          width: 240,
+          width: 100,
           minWidth: 100
         }
       },
@@ -662,47 +646,24 @@
   },
   created() {
     this.getManufactureAttrs()
-    /*
-          {
-            text: '鏂板',
-            type: 'primary',
-            fun: this.addMasterProductionSchedule,
-            disabled: false,
-            permitArr: []
-          },
-          {
-            text: '鍒涘缓濮斿璁㈠崟',
-            fun: this.createOutsourcingOrder
-          } */
-    if (this.permissions.plan_masterproductionschedule_add) {
-      this.table.toolbar.push({
-        text: '鏂板',
-        type: 'primary',
-        fun: this.addMasterProductionSchedule,
-        disabled: false,
-        permitArr: []
-      })
+    let optionList = []
+    if(this.permissions.masterproductionschedule_view_source){
+      optionList.push({
+            text: '鏉ユ簮',
+            type: 'text',
+            size: 'small',
+            fun: this.searchMasterPlanSourceHandle
+          })
     }
-    if (this.permissions.masterproductionschedule_create_outsourcing) {
-      this.table.toolbar.push({
-        text: '鍒涘缓濮斿璁㈠崟',
-        fun: this.createOutsourcingOrder
-      })
-    }
-    if (this.permissions.masterproductionschedule_create_order_manual) {
-      this.orderTypeArr.push({
-        label: '鎵嬪姩鏂板',
-        command: 'MANUAL',
-        disabled: false,
-        permitArr: ['02processed']
-      })
+    if(optionList.length>0){
+      this.table.operator = optionList
     }
     if (this.permissions.masterproductionschedule_create_order_auto) {
       this.orderTypeArr.push({
         label: '鑷姩鏂板',
         command: 'AUTO',
         disabled: false,
-        permitArr: ['01pending']
+        permitArr: ['04completed']
       })
     }
     this.getSysParam(sysParam.IS_REPORT_OPERATION)
@@ -749,6 +710,10 @@
     },
     // 淇敼
     addOrUpdateHandle(row) {
+      if(!this.permissions.plan_masterproductionschedule_edit && row.id!=null){
+        this.$message.error("璇ヨ鑹叉病鏈夋搷浣滄潈闄�");
+        return
+      }
       this.addOrUpdateVisible = true
       this.$nextTick(() => {
         this.$refs.addOrUpdate.init(row ? row.id : row, row ? row.state : row)
@@ -762,22 +727,6 @@
         }
       }
       return ''
-    },
-    // 鍒犻櫎
-    deleteHandle(row) {
-      this.$confirm('鏄惁纭鍒犻櫎ID涓�' + row.id, '鎻愮ず', {
-        confirmButtonText: '纭畾',
-        cancelButtonText: '鍙栨秷',
-        closeOnClickModal: false,
-        type: 'warning'
-      })
-        .then(function() {
-          return delObj(row.id)
-        })
-        .then((data) => {
-          this.$message.success('鍒犻櫎鎴愬姛')
-          this.getData()
-        })
     },
     // 鏌ョ湅鐢熶骇璁″垝鏉ユ簮
     searchMasterPlanSourceHandle(row) {
@@ -944,6 +893,8 @@
         eventName = '寰呭鐞�'
       } else if (event == 'PROCESSED') {
         eventName = '宸插鐞�'
+      } else if (event == 'COMPLETED') {
+        eventName = '宸插畬鎴�'
       } else {
         eventName = '宸蹭綔搴�'
       }
@@ -1100,6 +1051,19 @@
           this.stateTagArr[i].disabled = true
         }
       }
+       for (var i = 0; i < this.orderTypeArr.length; i++) {
+        if (
+          uniqueStateArr.every((val) =>
+            this.orderTypeArr[i].permitArr.length <= 0
+              ? true
+              : this.orderTypeArr[i].permitArr.includes(val)
+          )
+        ) {
+          this.orderTypeArr[i].disabled = true
+        } else {
+          this.orderTypeArr[i].disabled = false
+        }
+      }
       this.masterPlanSelection = val
     },
     // 鏌ョ湅搴撳瓨

--
Gitblit v1.9.3