From 9d67939cb72ce57e3717b45b48c28655adc628a7 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期一, 28 七月 2025 22:54:30 +0800
Subject: [PATCH] MDC车间分配

---
 src/views/system/modules/UserModal.vue |   67 ++++++++++++++++++++++++++++++++-
 1 files changed, 64 insertions(+), 3 deletions(-)

diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue
index 5cd27b2..7cb8619 100644
--- a/src/views/system/modules/UserModal.vue
+++ b/src/views/system/modules/UserModal.vue
@@ -150,6 +150,22 @@
           ></j-select-factory>
         </a-form-model-item>
 
+        <!--杞﹂棿鍒嗛厤-->
+        <a-form-model-item
+          label="MDC杞﹂棿鍒嗛厤"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
+          v-show="!productionDisabled"
+        >
+          <j-select-production
+            v-model="model.selectedProduction"
+            :multi="true"
+            @back="backProductionInfo"
+            :backProduction="true"
+            :treeProductOpera="true"
+          ></j-select-production>
+        </a-form-model-item>
+
         <!--<a-form-model-item-->
           <!--label="閫夋嫨璁惧"-->
           <!--:labelCol="labelCol"-->
@@ -353,18 +369,21 @@
   import JSelectFactory from '../../../components/jeecgbiz/JSelectFactory'
   import { mapActions } from 'vuex'
   import { ajaxGetDictItems, getDictItemsFromCache } from '@/api/api'
+  import JSelectProduction from '../../../components/jeecgbiz/JSelectProduction'
   // import SelectDeviceModal from './SelectDeviceModal'
 
   export default {
     name: 'UserModal',
     components: {
       // SelectDeviceModal,
-      JSelectFactory
+      JSelectFactory,
+      JSelectProduction
     },
     data() {
       return {
         departDisabled: false, //鏄惁鏄垜鐨勯儴闂ㄨ皟鐢ㄨ椤甸潰
         factoryDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰
+        productionDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰
         roleDisabled: false, //鏄惁鏄鑹茬淮鎶よ皟鐢ㄨ椤甸潰
         modalWidth: 800,
         drawerWidth: 700,
@@ -421,9 +440,11 @@
         rolesOptions: [],
         nextDepartOptions: [],
         nextFactoryOptions: [],
+        nextProductionOptions: [],
         isDepartType: '',
         model: {
-          selectedFactory: ''
+          selectedFactory: '',
+          selectedProduction: ''
         }
       }
     },
@@ -439,6 +460,17 @@
             // 濡傛灉杞﹂棿閫夋嫨鍓嶅悗涓嶄竴鑷村垯閲嶇疆閫夋嫨璁惧
             if ((oldVal && newVal !== oldVal)) this.model.equipmentIds = ''
             //this.$refs.selectDeviceModal.queryTreeData(newVal)
+          }
+          // 濡傛灉娓呯┖杞﹂棿鍊煎垯閲嶇疆閫夋嫨璁惧
+          if (newVal === '') this.model.equipmentIds = ''
+        }
+      },
+      'model.selectedProduction': {
+        handler(newVal, oldVal) {
+          if (newVal && this.$refs.selectDeviceModal) {
+            // 濡傛灉杞﹂棿閫夋嫨鍓嶅悗涓嶄竴鑷村垯閲嶇疆閫夋嫨璁惧
+            if ((oldVal && newVal !== oldVal)) this.model.equipmentIds = ''
+            this.$refs.selectDeviceModal.queryTreeData(newVal)
           }
           // 濡傛灉娓呯┖杞﹂棿鍊煎垯閲嶇疆閫夋嫨璁惧
           if (newVal === '') this.model.equipmentIds = ''
@@ -481,7 +513,8 @@
           userIdentity: 1,
           selectedroles: '',
           selecteddeparts: '',
-          selectedFactory: ''
+          selectedFactory: '',
+          selectedProduction: ''
         })
       },
       edit(record) {
@@ -593,6 +626,24 @@
             that.nextFactoryOptions = FactoryOptions
           }
         })
+
+        getAction(that.url.userProductionList, { userId: userid }).then((res) => {
+          if (res.success) {
+            let ProductionOptions = []
+            let selectProductKeys = []
+            for (let i = 0; i < res.result.length; i++) {
+              selectProductKeys.push(res.result[i].key)
+              //鏂板璐熻矗閮ㄩ棬閫夋嫨涓嬫媺妗�
+              ProductionOptions.push({
+                value: res.result[i].key,
+                label: res.result[i].title
+              })
+            }
+
+            this.$set(this.model, 'selectedProduction', selectProductKeys.join(','))
+            that.nextProductionOptions = ProductionOptions
+          }
+        })
         //杞﹂棿鐨剈rl
       },
       backDepartInfo(info) {
@@ -610,10 +661,19 @@
         })
       },
 
+      backProductionInfo(info) {
+        this.model.productionIds = this.model.selectedProduction
+        this.nextProductionOptions = info.map((item, index, arr) => {
+          let c = { label: item.text, value: item.value + '' }
+          return c
+        })
+      },
+
       refresh() {
         this.userId = ''
         this.nextDepartOptions = []
         this.nextFactoryOptions = []
+        this.nextProductionOptions = []
         this.departIdShow = false
       },
       close() {
@@ -622,6 +682,7 @@
         this.disableSubmit = false
         this.nextDepartOptions = []
         this.nextFactoryOptions = []
+        this.nextProductionOptions = []
         this.departIdShow = false
         this.$refs.form.resetFields()
       },

--
Gitblit v1.9.3