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 |   69 ++++++++++++++++++++++++++++++++--
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue
index 8f3883f..7cb8619 100644
--- a/src/views/system/modules/UserModal.vue
+++ b/src/views/system/modules/UserModal.vue
@@ -139,6 +139,22 @@
           label="杞﹂棿鍒嗛厤"
           :labelCol="labelCol"
           :wrapperCol="wrapperCol"
+          v-show="!factoryDisabled"
+        >
+          <j-select-factory
+            v-model="model.selectedFactory"
+            :multi="true"
+            @back="backFactoryInfo"
+            :backProduction="true"
+            :treeProductOpera="true"
+          ></j-select-factory>
+        </a-form-model-item>
+
+        <!--杞﹂棿鍒嗛厤-->
+        <a-form-model-item
+          label="MDC杞﹂棿鍒嗛厤"
+          :labelCol="labelCol"
+          :wrapperCol="wrapperCol"
           v-show="!productionDisabled"
         >
           <j-select-production
@@ -154,7 +170,7 @@
           <!--label="閫夋嫨璁惧"-->
           <!--:labelCol="labelCol"-->
           <!--:wrapperCol="wrapperCol"-->
-          <!--v-show="!productionDisabled"-->
+          <!--v-show="!factoryDisabled"-->
         <!--&gt;-->
           <!--<a-input-search-->
             <!--:readOnly="true"-->
@@ -162,7 +178,7 @@
             <!--@search="deviceSearch"-->
             <!--enter-button-->
             <!--placeholder="璇烽�夋嫨璁惧"-->
-            <!--:disabled="!model.selectedProduction"-->
+            <!--:disabled="!model.selectedFactory"-->
           <!--/>-->
         <!--</a-form-model-item>-->
 
@@ -350,20 +366,23 @@
   import { addUser, editUser, queryUserRole, queryall } from '@/api/api'
   import { disabledAuthFilter } from '@/utils/authFilter'
   import { duplicateCheck } from '@/api/api'
-  import JSelectProduction from '../../../components/jeecgbiz/JSelectProduction'
+  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,
       JSelectProduction
     },
     data() {
       return {
         departDisabled: false, //鏄惁鏄垜鐨勯儴闂ㄨ皟鐢ㄨ椤甸潰
+        factoryDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰
         productionDisabled: false, //鏄惁鏄垜鐨勮溅闂磋皟鐢ㄨ椤甸潰
         roleDisabled: false, //鏄惁鏄鑹茬淮鎶よ皟鐢ㄨ椤甸潰
         modalWidth: 800,
@@ -420,9 +439,11 @@
         tenantsOptions: [],
         rolesOptions: [],
         nextDepartOptions: [],
+        nextFactoryOptions: [],
         nextProductionOptions: [],
         isDepartType: '',
         model: {
+          selectedFactory: '',
           selectedProduction: ''
         }
       }
@@ -433,12 +454,23 @@
           if (value) this.initDictData('password_length')
         }
       },
-      'model.selectedProduction': {
+      'model.selectedFactory': {
         handler(newVal, oldVal) {
           if (newVal) {
             // 濡傛灉杞﹂棿閫夋嫨鍓嶅悗涓嶄竴鑷村垯閲嶇疆閫夋嫨璁惧
             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,6 +513,7 @@
           userIdentity: 1,
           selectedroles: '',
           selecteddeparts: '',
+          selectedFactory: '',
           selectedProduction: ''
         })
       },
@@ -578,6 +611,24 @@
         // 鑾峰彇杞﹂棿鍒嗛厤
         getAction(that.url.userProductionList, { userId: userid }).then((res) => {
           if (res.success) {
+            let FactoryOptions = []
+            let selectFactoryKeys = []
+            for (let i = 0; i < res.result.length; i++) {
+              selectFactoryKeys.push(res.result[i].key)
+              //鏂板璐熻矗閮ㄩ棬閫夋嫨涓嬫媺妗�
+              FactoryOptions.push({
+                value: res.result[i].key,
+                label: res.result[i].title
+              })
+            }
+
+            this.$set(this.model, 'selectedFactory', selectFactoryKeys.join(','))
+            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++) {
@@ -602,6 +653,14 @@
           return c
         })
       },
+      backFactoryInfo(info) {
+        this.model.factoryIds = this.model.selectedFactory
+        this.nextFactoryOptions = info.map((item, index, arr) => {
+          let c = { label: item.text, value: item.value + '' }
+          return c
+        })
+      },
+
       backProductionInfo(info) {
         this.model.productionIds = this.model.selectedProduction
         this.nextProductionOptions = info.map((item, index, arr) => {
@@ -613,6 +672,7 @@
       refresh() {
         this.userId = ''
         this.nextDepartOptions = []
+        this.nextFactoryOptions = []
         this.nextProductionOptions = []
         this.departIdShow = false
       },
@@ -621,6 +681,7 @@
         this.visible = false
         this.disableSubmit = false
         this.nextDepartOptions = []
+        this.nextFactoryOptions = []
         this.nextProductionOptions = []
         this.departIdShow = false
         this.$refs.form.resetFields()

--
Gitblit v1.9.3