From 32f13d15d67172b9b2dd12d8c5c661c9602c7d2e Mon Sep 17 00:00:00 2001
From: zhaowei <zhaowei>
Date: 星期二, 01 七月 2025 15:30:20 +0800
Subject: [PATCH] 设备管理模块设备车间管理页面新增机构类型字段以及限制条件

---
 src/views/eam/base/EamProductionUserManagement.vue |   17 +++++------------
 src/views/eam/base/modules/EamProductionUser.vue   |   20 ++++++++++----------
 src/views/eam/base/modules/EamProductionModal.vue  |   22 ++++++++++++++--------
 3 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/src/views/eam/base/EamProductionUserManagement.vue b/src/views/eam/base/EamProductionUserManagement.vue
index 221ec10..f26c4ef 100644
--- a/src/views/eam/base/EamProductionUserManagement.vue
+++ b/src/views/eam/base/EamProductionUserManagement.vue
@@ -5,12 +5,7 @@
         <!-- 鎸夐挳鎿嶄綔鍖哄煙 -->
         <a-row style="margin-left: 14px">
           <a-button @click="handleAdd(1)" type="primary">娣诲姞鏈烘瀯</a-button>
-          <a-button @click="handleAdd(2)" type="primary">娣诲姞涓嬬骇</a-button>
-          <!--<a-button type="primary" icon="download" @click="handleExportXls('杞﹂棿淇℃伅')">瀵煎嚭</a-button>-->
-          <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"-->
-          <!--:action="importExcelUrl" @change="handleImportExcel">-->
-          <!--<a-button type="primary" icon="import">瀵煎叆</a-button>-->
-          <!--</a-upload>-->
+          <a-button @click="handleAdd(2)" type="primary" v-if="currSelected.factoryCategory!=3">娣诲姞涓嬬骇</a-button>
           <a-button @click="handleDelete" v-if="selectedKeys.length>0">鍒犻櫎</a-button>
           <a-button title="鍒犻櫎澶氭潯鏁版嵁" @click="batchDel" v-if="checkedKeys.length>0">鎵归噺鍒犻櫎</a-button>
         </a-row>
@@ -148,15 +143,13 @@
           sm: { span: 16 }
         },
         validatorRules: {
-          factoryName: [{ required: true, message: '璇疯緭鍏ユ満鏋勫悕绉�!' }]
+          factoryName: [{ required: true, message: '璇疯緭鍏ユ満鏋勫悕绉�!', trigger: 'change' }]
         },
         url: {
           getProductionTreeList: '/eam/BaseFactory/queryTreeList',
           delete: '/eam/BaseFactory/delete',
           edit: '/eam/BaseFactory/edit',
-          deleteBatch: '/eam/BaseFactory/deleteBatch',
-          exportXlsUrl: '/eam/BaseFactory/exportXls',
-          importExcelUrl: '/eam/BaseFactory/importExcel'
+          deleteBatch: '/eam/BaseFactory/deleteBatch'
         },
         isIncludesNotLeaf: false,
         confirmLoading: false
@@ -304,6 +297,7 @@
         this.model = this.currSelected
         this.selectedKeys = [record.key]
         this.$refs.userList.show(record.id)
+        if (this.$refs.form) this.$refs.form.clearValidate()
       },
 
       onClearSelected() {
@@ -348,8 +342,7 @@
       },
 
       emptyCurrForm() {
-        this.$refs.form.resetFields()
-        this.model = {}
+        this.model = { parentId: this.model.parentId }
       },
 
       handleAdd(num) {
diff --git a/src/views/eam/base/modules/EamProductionModal.vue b/src/views/eam/base/modules/EamProductionModal.vue
index b24cdd5..7f15578 100644
--- a/src/views/eam/base/modules/EamProductionModal.vue
+++ b/src/views/eam/base/modules/EamProductionModal.vue
@@ -19,8 +19,13 @@
                        v-model="model.parentId" placeholder="璇烽�夋嫨涓婄骇鏈烘瀯" disabled>
         </a-tree-select>
       </a-form-model-item>
-      <a-form-model-item v-if="!seen" label="鏈烘瀯绫诲瀷" hasFeedback prop="factoryCategory">
-        <j-dict-select-tag dict-code="eam_production_type" placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷" v-model="model.factoryCategory"/>
+      <a-form-model-item v-if="!seen&&(model.parentFactoryCategory==1||model.parentFactoryCategory==2)" label="鏈烘瀯绫诲瀷"
+                         hasFeedback
+                         prop="factoryCategory">
+        <a-select v-model="model.factoryCategory" placeholder="璇烽�夋嫨鏈烘瀯绫诲瀷">
+          <a-select-option :value="2" v-if="model.parentFactoryCategory!=2">宸ュ尯</a-select-option>
+          <a-select-option :value="3">宸ユ</a-select-option>
+        </a-select>
       </a-form-model-item>
       <a-form-model-item label="鎺掑簭">
         <a-input-number v-model="model.sorter"/>
@@ -55,8 +60,8 @@
         },
         confirmLoading: false,
         validatorRules: {
-          factoryName: [{ required: true, message: '璇疯緭鍏ユ満鏋勫悕绉�!' }],
-          factoryCategory: [{ required: true, message: '璇烽�夋嫨鏈烘瀯绫诲瀷!' }]
+          factoryName: [{ required: true, message: '璇疯緭鍏ユ満鏋勫悕绉�!', trigger: 'change' }],
+          factoryCategory: [{ required: true, message: '璇烽�夋嫨鏈烘瀯绫诲瀷!', trigger: 'change' }]
         },
         url: {
           queryById: '/eam/BaseFactory/queryIdTree',
@@ -80,12 +85,14 @@
       },
 
       add(record) {
-        const factoryCategory = record ? record.factoryCategory : ''
-        const parentId = record ? record.parentId : factoryCategory
+        if (this.$refs.form) this.$refs.form.clearValidate()
+        const parentFactoryCategory = record ? record.factoryCategory : ''
+        const parentId = record ? record.id : ''
         if (parentId) this.seen = false
         else this.seen = true
         this.visible = true
-        this.model = Object.assign({}, { parentId })
+        this.model = Object.assign({}, { parentId, parentFactoryCategory })
+        if (parentFactoryCategory == 2) this.model.factoryCategory = +parentFactoryCategory + 1
         this.loadTreeData()
       },
 
@@ -123,7 +130,6 @@
 
       close() {
         this.$emit('close')
-        if (this.$refs.form) this.$refs.form.clearValidate()
         this.visible = false
       },
 
diff --git a/src/views/eam/base/modules/EamProductionUser.vue b/src/views/eam/base/modules/EamProductionUser.vue
index ee10aa0..21bb4c6 100644
--- a/src/views/eam/base/modules/EamProductionUser.vue
+++ b/src/views/eam/base/modules/EamProductionUser.vue
@@ -1,6 +1,6 @@
 <template>
   <a-card :bordered="false">
-    <template v-if="queryParam.baseFactoryId">
+    <template v-if="queryParam.factoryId">
       <div class="table-page-search-wrapper">
         <a-form layout="inline" @keyup.enter.native="searchQuery">
           <a-row :gutter="24">
@@ -114,15 +114,15 @@
         visible: false,
         url: {
           list: '/eam/BaseFactoryUser/BaseFactoryUserList',
-          add: '/eam/BaseFactory/add',
-          delete: '/eam/BaseFactory/delete',
-          deleteBatch: '/eam/BaseFactory/deleteBatch'
+          add: '/eam/BaseFactoryUser/add',
+          delete: '/eam/BaseFactoryUser/delete',
+          deleteBatch: '/eam/BaseFactoryUser/deleteBatch'
         }
       }
     },
     methods: {
-      show(baseFactoryId) {
-        this.$set(this.queryParam, 'baseFactoryId', baseFactoryId)
+      show(factoryId) {
+        this.$set(this.queryParam, 'factoryId', factoryId)
         this.loadData(1)
       },
 
@@ -132,7 +132,7 @@
 
       handleDelete(id) {
         const that = this
-        deleteAction(that.url.delete, { id, baseFactoryId: this.queryParam.baseFactoryId })
+        deleteAction(that.url.delete, { id, factoryId: this.queryParam.factoryId })
           .then((res) => {
             if (res.success) {
               //閲嶆柊璁$畻鍒嗛〉闂
@@ -164,7 +164,7 @@
             that.loading = true
             deleteAction(that.url.deleteBatch, {
               ids,
-              baseFactoryId: that.queryParam.baseFactoryId
+              factoryId: that.queryParam.factoryId
             })
               .then((res) => {
                 if (res.success) {
@@ -193,7 +193,7 @@
         const that = this
         const params = {
           userId: selectedUserIdsArray.join(),
-          baseFactoryId: this.queryParam.baseFactoryId
+          factoryId: this.queryParam.factoryId
         }
         that.loading = true
         postAction(that.url.add, params)
@@ -224,7 +224,7 @@
       },
 
       searchReset() {
-        this.queryParam = { baseFactoryId: this.queryParam.baseFactoryId }
+        this.queryParam = { factoryId: this.queryParam.factoryId }
         this.loadData(1)
       }
 

--
Gitblit v1.9.3