From e0e111d15a3f3995799b8b480c162c619ec897aa Mon Sep 17 00:00:00 2001
From: hyingbo <1363390067@qq.com>
Date: 星期五, 12 九月 2025 17:15:38 +0800
Subject: [PATCH] 大修项修现场问题处理

---
 src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue |    5 +
 src/views/eam/repair/EamMajorPartialRepairList.vue                |   59 ++++++++++---------
 src/views/eam/repair/modules/EamMajorPartialRepairForm.vue        |   70 +++++++++++++++++++++-
 3 files changed, 100 insertions(+), 34 deletions(-)

diff --git a/src/views/eam/repair/EamMajorPartialRepairList.vue b/src/views/eam/repair/EamMajorPartialRepairList.vue
index b3176e9..cce8691 100644
--- a/src/views/eam/repair/EamMajorPartialRepairList.vue
+++ b/src/views/eam/repair/EamMajorPartialRepairList.vue
@@ -14,39 +14,40 @@
               <a-input placeholder="璇疯緭鍏ラ」鐩悕绉�" v-model="queryParam.repairName"></a-input>
             </a-form-item>
           </a-col>
-          <template v-if="toggleSearchStatus">
-            <a-col :xl="6" :lg="7" :md="8" :sm="24">
-              <a-form-item label="缁翠慨鐘舵��">
-                <j-dict-select-tag placeholder="璇烽�夋嫨缁翠慨鐘舵��" v-model="queryParam.repairStatus" dictCode="major_partial_repair_status"/>
-              </a-form-item>
-            </a-col>
-            <a-col :xl="6" :lg="7" :md="8" :sm="24">
-              <a-form-item label="缁翠慨绫诲瀷">
-                <a-select v-model="queryParam.repairType" placeholder="璇烽�夋嫨缁翠慨绫诲瀷">
-                  <a-select-option value="澶т慨">澶т慨</a-select-option>
-                  <a-select-option value="椤逛慨">椤逛慨</a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :xl="6" :lg="7" :md="8" :sm="24">
-              <a-form-item label="璁″垝寮�濮嬫棩鏈�">
-                <a-range-picker
-                  v-model="planDateRange"
-                  @change="selectDateChange"
-                  format="YYYY-MM-DD"
-                  value-format="YYYY-MM-DD"
-                />
-              </a-form-item>
-            </a-col>
-          </template>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="缁翠慨鐘舵��">
+              <j-dict-select-tag placeholder="璇烽�夋嫨缁翠慨鐘舵��" v-model="queryParam.repairStatus" dictCode="major_partial_repair_status"/>
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="缁翠慨绫诲瀷">
+              <a-select v-model="queryParam.repairType" placeholder="璇烽�夋嫨缁翠慨绫诲瀷">
+                <a-select-option value="澶т慨">澶т慨</a-select-option>
+                <a-select-option value="椤逛慨">椤逛慨</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="璁″垝寮�濮嬫棩鏈�">
+              <a-range-picker
+                v-model="planDateRange"
+                @change="selectDateChange"
+                format="YYYY-MM-DD"
+                value-format="YYYY-MM-DD"
+              />
+            </a-form-item>
+          </a-col>
+<!--          <template v-if="toggleSearchStatus">-->
+<!--            -->
+<!--          </template>-->
           <a-col :xl="6" :lg="7" :md="8" :sm="24">
             <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
               <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>
               <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button>
-              <a @click="handleToggleSearch" style="margin-left: 8px">
-                {{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }}
-                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
-              </a>
+<!--              <a @click="handleToggleSearch" style="margin-left: 8px">-->
+<!--                {{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }}-->
+<!--                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
+<!--              </a>-->
             </span>
           </a-col>
         </a-row>
diff --git a/src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue b/src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue
index 96bef70..5e63cad 100644
--- a/src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue
+++ b/src/views/eam/repair/modules/EamMajorPartialRepairDetailModal.vue
@@ -91,6 +91,11 @@
   },
   methods: {
     open(record) {
+      // 鍏堟竻绌哄師鏈夋暟鎹�
+      this.detail.dataSource = []
+      if (this.$refs.editableDetailTable) {
+        this.$refs.editableDetailTable.clearData()
+      }
       this.visible = true
       getAction(this.url.queryDetailList, { repairId: record.id }).then((res) => {
         if (res.success) {
diff --git a/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue
index 9a95c52..c125a99 100644
--- a/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue
+++ b/src/views/eam/repair/modules/EamMajorPartialRepairForm.vue
@@ -28,18 +28,19 @@
           </a-col>
           <a-col :span="8">
             <a-form-model-item label="鐢宠浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicant">
-              <j-search-select-tag  placeholder="璇烽�夋嫨鐢宠浜�" v-model="model.applicant" dict="sys_user,realname, username, del_flag=0 and status=1"/>
+              <j-search-select-tag disabled placeholder="璇烽�夋嫨鐢宠浜�" v-model="model.applicant" dict="sys_user,realname, username, del_flag=0 and status=1"/>
             </a-form-model-item>
           </a-col>
           <a-col :span="8">
             <a-form-model-item label="鐢宠杞﹂棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="applicantProduction">
               <a-tree-select v-model="model.applicantProduction"
                              style="width: 100%"
-                             :tree-data="treeData"
+                             :tree-data="treeDataAlias"
                              :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
                              placeholder="璇烽�夋嫨鐢宠杞﹂棿"
                              allow-clear
                              tree-default-expand-all
+                             @change="handleWorkShopChange"
               >
               </a-tree-select>
             </a-form-model-item>
@@ -74,7 +75,7 @@
               <a-input v-model="model.applicantReason" placeholder="璇疯緭鍏ョ敵璇峰師鍥�"  ></a-input>
             </a-form-model-item>
           </a-col>
-          <a-col :span="8">
+          <a-col :span="8" v-if="disabled">
             <a-form-model-item label="璐d换浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="responsiblePerson">
               <j-search-select-tag  placeholder="璇烽�夋嫨璐d换浜�" v-model="model.responsiblePerson" dict="sys_user,realname, username, del_flag=0 and status=1"/>
             </a-form-model-item>
@@ -120,6 +121,8 @@
 import { getAction, httpAction } from '@/api/manage'
 import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
 import { JVXETypes } from '@/components/jeecg/JVxeTable'
+import Vue from 'vue'
+import { USER_INFO } from '@/store/mutation-types'
 
 export default {
     name: 'EamMajorPartialRepairForm',
@@ -137,6 +140,7 @@
     data () {
       return {
         model: {},
+        treeDataAlias: [],
         labelCol: {
           xs: { span: 24 },
           sm: { span: 7 },
@@ -154,7 +158,7 @@
           planStartDate: { required: true, message: '璇烽�夋嫨璁″垝寮�濮嬫棩鏈�!' },
           planEndDate: { required: true, message: '璇烽�夋嫨璁″垝缁撴潫鏃ユ湡!' },
           applicantReason: { required: true, message: '璇疯緭鍏ョ敵璇峰師鍥�!' },
-          responsiblePerson: { required: true, message: '璇疯緭鍏ヨ矗浠讳汉!' },
+          // responsiblePerson: { required: true, message: '璇疯緭鍏ヨ矗浠讳汉!' },
           faultDescription: { required: true, message: '璇疯緭鍏ユ晠闅滄弿杩�!' }
         },
         treeData: [],
@@ -169,6 +173,7 @@
           queryById: "/eam/eamMajorPartialRepair/queryById",
           queryDetailList: "/eam/eamMajorPartialRepairDetail/list",
           queryEquipmentList: "/eam/equipment/asyncLoadEquipment",
+          queryEquipmentByProductionList: "/eam/equipment/asyncLoadEquipmentByProduction",
           loadWorkShopOptions:'/mdc/mdcProduction/loadProductionTreeOptions'
         }
       }
@@ -233,16 +238,71 @@
         getAction(this.url.loadWorkShopOptions).then(res => {
           if (res.success) {
             this.treeData = [...res.result]
+            this.treeDataAlias = this.deepCopyAndModify(res.result)
           }else {
             that.$message.warning(res.message)
           }
         })
       },
+      handleWorkShopChange(productionId) {
+        this.detail.dataSource = []
+        if (productionId) {
+          this.getEquipmentList(productionId);
+        } else {
+          this.equipmentOptions = [];
+        }
+      },
+      getEquipmentList(productionId) {
+        //鍔犺浇杞﹂棿閫夋嫨鏍�
+        getAction(this.url.queryEquipmentByProductionList, {productionId: productionId}).then((res) => {
+          if (res.success) {
+            this.equipmentOptions = res.result.map(item => {
+              return {
+                label: item.text,
+                value: item.value
+              }
+            })
+          }
+        })
+      },
+      deepCopyAndModify(arr) {
+        // 濡傛灉褰撳墠鍏冪礌涓嶆槸鏁扮粍鎴栧璞★紝鐩存帴杩斿洖
+        if (!Array.isArray(arr) && typeof arr !== 'object' || arr === null || arr.length === 0) {
+          return arr;
+        }
+
+        // 濡傛灉鏄暟缁勶紝鍒涘缓涓�涓柊鏁扮粍骞堕�掑綊澶勭悊姣忎釜鍏冪礌
+        if (Array.isArray(arr)) {
+          const newArray = [];
+          for (let i = 0; i < arr.length; i++) {
+            newArray.push(this.deepCopyAndModify(arr[i]));
+          }
+          return newArray;
+        }
+
+        // 濡傛灉鏄璞★紝鍒涘缓涓�涓柊瀵硅薄骞堕�掑綊澶勭悊姣忎釜灞炴��
+        const newObj = {};
+        for (const key in arr) {
+          if (arr.hasOwnProperty(key)) {
+            if(key === 'selectable') {
+              newObj[key] = true;
+            } else if(key === 'children') {
+              newObj[key] = this.deepCopyAndModify(arr[key]);
+            }else {
+              newObj[key] = arr[key];
+            }
+          }
+        }
+        return newObj;
+      },
       add () {
         this.edit(this.modelDefault)
       },
       edit (record) {
-        this.model = Object.assign({}, record);
+        this.model = Object.assign({
+          applicant: Vue.ls.get(USER_INFO).username
+        }, record);
+        console.log("this.model", this.model)
         this.visible = true
         if (this.model.id) {
           getAction(this.url.queryDetailList, { repairId: this.model.id }).then((res) => {

--
Gitblit v1.9.3