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/productionschedul/index.vue        |   97 ++++++++++++++++++++++++++++++------------------
 src/views/plan/masterproductionschedule/index.vue |   10 +++--
 src/api/plan/productionschedul.js                 |    7 +++
 src/views/common/ztt-table.vue                    |    5 ++
 4 files changed, 77 insertions(+), 42 deletions(-)

diff --git a/src/api/plan/productionschedul.js b/src/api/plan/productionschedul.js
index 14363dd..5784b65 100644
--- a/src/api/plan/productionschedul.js
+++ b/src/api/plan/productionschedul.js
@@ -8,6 +8,13 @@
   })
 }
 
+export function fetchRecordsList(mId) {
+  return request({
+    url: '/mes/productionSchedul/pageRecords/'+mId,
+    method: 'get',
+  })
+}
+
 export function fetchScheduleById(id) {
   return request({
     url: '/mes/productionSchedul/selTime/'+id,
diff --git a/src/views/common/ztt-table.vue b/src/views/common/ztt-table.vue
index 0701521..4996b43 100644
--- a/src/views/common/ztt-table.vue
+++ b/src/views/common/ztt-table.vue
@@ -182,6 +182,7 @@
           v-if="options.multiSelect && !isEdit"
           style="width: 55px;"
           :selectable="selectHandle"
+
         >
         </el-table-column>
         <!--鍗曢�夋-->
@@ -571,7 +572,9 @@
     //闇�瑕佸悎骞剁殑瀛楁闆嗗悎
     mergeSpanArr: {
         type: Array,
-        default: []
+        default: ()=>{
+            return []
+        }
     },
     toolbarMaxLength: {
       type: Number,
diff --git a/src/views/plan/masterproductionschedule/index.vue b/src/views/plan/masterproductionschedule/index.vue
index ef87846..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
               >
@@ -661,7 +663,7 @@
         label: '鑷姩鏂板',
         command: 'AUTO',
         disabled: false,
-        permitArr: ['01pending','04completed']
+        permitArr: ['04completed']
       })
     }
     this.getSysParam(sysParam.IS_REPORT_OPERATION)
@@ -1049,7 +1051,7 @@
           this.stateTagArr[i].disabled = true
         }
       }
-       for (var i = 0; i < this.stateTagArr.length; i++) {
+       for (var i = 0; i < this.orderTypeArr.length; i++) {
         if (
           uniqueStateArr.every((val) =>
             this.orderTypeArr[i].permitArr.length <= 0
@@ -1057,9 +1059,9 @@
               : this.orderTypeArr[i].permitArr.includes(val)
           )
         ) {
-          this.orderTypeArr[i].disabled = false
-        } else {
           this.orderTypeArr[i].disabled = true
+        } else {
+          this.orderTypeArr[i].disabled = false
         }
       }
       this.masterPlanSelection = val
diff --git a/src/views/plan/productionschedul/index.vue b/src/views/plan/productionschedul/index.vue
index 98e9d55..20ddc6d 100644
--- a/src/views/plan/productionschedul/index.vue
+++ b/src/views/plan/productionschedul/index.vue
@@ -10,6 +10,8 @@
         :ajaxFun="ajaxFun"
         :paramObj="queryParams"
         :mergeSpanArr="spanArr"
+        :selColValArr="paramSelArr"
+        :selCol="paramSelCol"
         ref="ttable">
         <template #toolbar>
             <el-dropdown @command="changeTable">
@@ -134,12 +136,27 @@
             </div>
         </el-card>
     </el-dialog>
+    <!-- 鏌ョ湅鍙樻洿璁板綍 -->
+    <el-dialog
+    title="鍙樻洿璁板綍"
+    :visible.sync="showRecordsDialog"
+    width="60%">
+        <el-table border :data="recordsList">
+            <el-table-column type="index" width="50" label="搴忓彿" align="center"/>
+            <el-table-column prop="createTime" min-width="120" show-overflow-tooltip label="鎿嶄綔鏃堕棿" align="center"/>
+            <el-table-column prop="createUser" min-width="120" show-overflow-tooltip label="鎿嶄綔浜�" align="center"/>
+            <el-table-column prop="recordType" min-width="120" show-overflow-tooltip label="鎿嶄綔绫诲瀷" align="center"/>
+            <el-table-column prop="oldRecord" min-width="200" show-overflow-tooltip label="鏃у��" align="center"/>
+            <el-table-column prop="newRecord" min-width="200" show-overflow-tooltip label="鏂板��" align="center"/>
+        </el-table>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import {
   fetchScheduleList,
+  fetchRecordsList,
   fetchScheduleById,
   fillTime,
   deleteSchedul,
@@ -149,13 +166,16 @@
 } from '@/api//plan/productionschedul'
 import ttable from '@/views/common/ztt-table.vue'
 import { mapGetters } from 'vuex'
-import { remote } from '@/api/admin/dict'
 export default {
     data() {
     return {
       queryParams: {
         state: false
       },
+      showRecordsDialog: false,
+      recordsList: [],
+      paramSelArr: [false],
+      paramSelCol: 'hasEdit',
       ajaxFun: fetchScheduleList,
       prelang: 'productSchedul',
       options: {
@@ -170,7 +190,7 @@
         isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
         isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳H
         isSearch: true, // 楂樼骇鏌ヨ鎸夐挳
-        defaultOrderBy: { column: 'createdTime', direction: 'desc' },
+        defaultOrderBy: { column: 'time', direction: 'desc' },
         cancelRunCreated: false,
         tableCellMerge: true
       },
@@ -332,8 +352,8 @@
         operatorConfig: {
             fixed: 'right',
             label: '鎿嶄綔',
-            width: 100,
-            minWidth: 100
+            width: 150,
+            minWidth: 150
         }
       },
       dropdownTitleStyle: {
@@ -384,47 +404,51 @@
     }
   },
   methods: {
-    getProductionSchedulStaffDict(){
-        const _than = this
-        remote('productionschedul_staff').then((response) => {
-            if (response.status === 200) {
-                response.data.data.map((ele)=>{
-                    _than.productionSchedulStaffOptions.push(ele.value)
-                })
-            } else {
-                _than.productionSchedulStaffOptions = []
-            }
-        })
+    showChangeRecords(row){
+        this.recordsList = []
+        if(row){
+            fetchRecordsList(row.mid).then((res)=>{
+                if(res.status===200){
+                    this.recordsList = res.data.data.records
+                }
+            }).catch((error)=>{
+                console.error(error);
+            })
+        }
+        this.showRecordsDialog = true
     },
     showOperator(){
+        this.table.operator = [{
+            text: '鍙樻洿璁板綍',
+            type: 'text',
+            size: 'small',
+            fun: this.showChangeRecords,
+        }]
         if(this.showUnDownTable){
             if(this.permissions.plan_productionschedul_edit){
-                this.table.operator = [{
+                this.table.operator.push({
                     text: '缂栬緫',
                     type: 'text',
                     size: 'small',
-                    fun: this.editHandle
-                }]
+                    fun: this.editHandle,
+                    show: {
+                        key: 'hasEdit',
+                        val: [true]
+                    }
+                })
             }
             if(this.permissions.plan_productionschedul_del){
-                if(this.table.operator == null){
-                    this.table.operator = [{
-                        text: '鍒犻櫎',
-                        type: 'text',
-                        size: 'small',
-                        fun: this.deleteHandle
-                    }]
-                }else{
-                    this.table.operator.push({
-                        text: '鍒犻櫎',
-                        type: 'text',
-                        size: 'small',
-                        fun: this.deleteHandle
-                    })
-                }
+                this.table.operator.push({
+                    text: '鍒犻櫎',
+                    type: 'text',
+                    size: 'small',
+                    fun: this.deleteHandle,
+                    show: {
+                        key: 'hasEdit',
+                        val: [true]
+                    }
+                })
             }
-        }else{
-            this.table.operator = null
         }
     },
     handleClickCell(row){
@@ -462,8 +486,7 @@
       updateState(ids).then(res=>{
         if(res.status===200){
           this.$message.success("鏇存柊鎴愬姛")
-          this.getUnFinishedData()
-          this.getFinishedData()
+          this.getDataList()
         }
       }).catch(error=>{
         console.error(error);

--
Gitblit v1.9.3