From 9ca1d8a5c10cf277d02445845bd62510bebf6989 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期四, 20 二月 2025 18:00:09 +0800
Subject: [PATCH] 项目增加项目子类型字段回显bug

---
 src/views/projectEngineering/projectLibrary/component/BasicInfo.vue |   58 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue b/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue
index 4a1e250..488b476 100644
--- a/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue
+++ b/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue
@@ -58,19 +58,18 @@
             </el-col>
 
             <el-col :span="6">
-              <el-col :span="6">
-                <el-form-item label="寤鸿鎬ц川" label-width="100px" prop="constructionNature" style="width: 100%; min-width: 260px">
-                  <el-select
-                    v-model="projectForm.constructionNature"
-                    clearable
-                    placeholder="璇烽�夋嫨"
-                    style="width: 100%"
-                  >
-                    <el-option v-for="item in dict.type.construction_nature" :key="item.value" :label="item.label"
-                               :value="item.value"/>
-                  </el-select>
-                </el-form-item>
-              </el-col>
+              <el-form-item label="寤鸿鎬ц川" label-width="100px" prop="constructionNature"
+                            style="width: 100%; min-width: 260px">
+                <el-select
+                  v-model="projectForm.constructionNature"
+                  clearable
+                  placeholder="璇烽�夋嫨"
+                  style="width: 100%"
+                >
+                  <el-option v-for="item in dict.type.construction_nature" :key="item.value" :label="item.label"
+                             :value="item.value"/>
+                </el-select>
+              </el-form-item>
             </el-col>
           </el-row>
           <el-row :gutter="20">
@@ -105,12 +104,12 @@
                           placeholder="璇疯緭鍏�"/>
               </el-form-item>
             </el-col>
-            <!--        <el-col :span="6">-->
-            <!--          <el-form-item label="椤圭洰涓氫富鍗曚綅" label-width="100px" prop="projectOwnerUnit" style="width: 100%">-->
-            <!--            <el-input v-model.trim="projectForm.projectOwnerUnit" class="item" clearable maxlength="255"-->
-            <!--                      placeholder="璇疯緭鍏�"/>-->
-            <!--          </el-form-item>-->
-            <!--        </el-col>-->
+<!--                    <el-col :span="6">-->
+<!--                      <el-form-item label="椤圭洰涓氫富鍗曚綅" label-width="100px" prop="projectOwnerUnit" style="width: 100%">-->
+<!--                        <el-input v-model.trim="projectForm.projectOwnerUnit" class="item" clearable maxlength="255"-->
+<!--                                  placeholder="璇疯緭鍏�"/>-->
+<!--                      </el-form-item>-->
+<!--                    </el-col>-->
           </el-row>
           <el-row :gutter="20">
             <el-col :span="6">
@@ -431,7 +430,8 @@
 import {addProject, getProject, updateProject, getProjectCode, editProject} from '@/api/projectEngineering/projectInfo';
 import {approvalList} from "@/api/system/dept";
 import {getByDept} from "@/api/system/user";
-import {getChildList} from "@/api/system/dict/data";
+import {getChildList, getDicts} from "@/api/system/dict/data";
+import log from "@/views/monitor/job/log";
 
 export default {
   name: 'BasicInfo',
@@ -556,8 +556,13 @@
       }
       if (this.projectForm.projectType) {
         // 鏍规嵁椤圭洰绫诲瀷鏌ュ瓙绫诲瀷
-        getChildList(this.dict.type.sys_project_type.filter(item => item.raw.dictValue === this.projectForm.projectType)[0].raw.dictCode).then(res => {
-          this.projectSubTypeList = res.data
+        getDicts("sys_project_type").then(res => {
+          const projectType = res.data.find(item => item.dictValue === this.projectForm.projectType);
+          if (projectType) {
+            getChildList(projectType.dictCode).then(res => {
+              this.projectSubTypeList = res.data
+            })
+          }
         })
       }
       this.$emit('updateIsShow', true);
@@ -658,8 +663,13 @@
         }
         if (this.projectForm.projectType) {
           // 鏍规嵁椤圭洰绫诲瀷鏌ュ瓙绫诲瀷
-          getChildList(this.dict.type.sys_project_type.filter(item => item.raw.dictValue === this.projectForm.projectType)[0].raw.dictCode).then(res => {
-            this.projectSubTypeList = res.data
+          getDicts("sys_project_type").then(res => {
+            const projectType = res.data.find(item => item.dictValue === this.projectForm.projectType);
+            if (projectType) {
+              getChildList(projectType.dictCode).then(res => {
+                this.projectSubTypeList = res.data
+              })
+            }
           })
         }
         this.$emit('updateIsShow', true);

--
Gitblit v1.8.0