scorpio 2 years ago
parent
commit
5f65899ba3

+ 7 - 15
src/views/home/component/dash.vue

@@ -307,20 +307,8 @@
                 />
               </el-select>
             </el-form-item>
-            <el-form-item class="full-width" label="行业分类" prop="tags">
-              <el-select
-                v-model="projectForm.dictKey"
-                clearable
-                placeholder="选择行业分类"
-                style="width: 100%"
-              >
-                <el-option
-                  v-for="item in industryList"
-                  :key="item.dictKey"
-                  :label="item.dictValue"
-                  :value="item.dictKey"
-                />
-              </el-select>
+            <el-form-item class="full-width" label="所属行业" prop="dictKey">
+              <industry-picker @change="changeIndustry" />
             </el-form-item>
             <el-form-item class="full-width" label="建设内容">
               <el-input
@@ -411,10 +399,11 @@ import summaryDialog from '@/views/home/component/summary_dialog.vue'
 import { useStore } from '@/store/user.js'
 import confing from '@/config/website'
 import { ElMessageBox } from 'element-plus'
+import industryPicker from '@/components/industry-picker/index.vue'
 
 export default {
   name: 'dash',
-  components: { BaseButton, formDialog, summaryDialog },
+  components: { BaseButton, formDialog, summaryDialog, industryPicker },
   setup() {
     const permissions = permissionStore()
     const user = useStore()
@@ -1047,6 +1036,9 @@ export default {
       if (tmp) {
         this.projectForm.createDept = tmp.id
       }
+    },
+    changeIndustry(list) {
+      this.projectForm.dictKey = JSON.stringify(list)
     }
   }
 }

+ 12 - 6
src/views/project/componens/info1.vue

@@ -27,11 +27,13 @@
             <span class="title">地区:</span>
             <area-picker
               :placeholder="
-                form.province_name +
-                '/' +
-                form.city_name +
-                '/' +
-                form.district_name
+                form.province_name !== undefined
+                  ? form.province_name +
+                    '/' +
+                    form.city_name +
+                    '/' +
+                    form.district_name
+                  : ''
               "
               @change="changeArea"
             />
@@ -299,7 +301,10 @@ export default {
     getDict(code) {
       this.$api.common.dicList({ code }).then(res => {
         if (res.code === 200) {
-          this.projectSituation = res.data
+          this.projectSituation = res.data.map(ele => {
+            ele.dictKey = Number.parseInt(ele.dictKey)
+            return ele
+          })
         }
       })
     },
@@ -366,6 +371,7 @@ export default {
     },
     changeIndustry(tmps) {
       this.form.dict_key = tmps
+      this.$emit('industry', tmps[0])
     }
   }
 }

+ 6 - 1
src/views/project/componens/info2.vue

@@ -1,5 +1,6 @@
 <template>
   <wt-card title="前期情况" class="mt-10">
+    {{ industry }}
     <div class="flex flex-justify-start full-width mt-15">
       <avue-crud
         :option="option"
@@ -51,6 +52,10 @@ export default {
       required: true,
       type: String,
       default: ''
+    },
+    industry: {
+      type: String,
+      default: 'traffic'
     }
   },
   watch: {
@@ -117,7 +122,7 @@ export default {
         if (res.code === 200) {
           if (code === 'traffic') {
             this.dictList = res.data.map(e => {
-              return { label: e.dictValue, value: e.dictKey, code: code }
+              return { label: e.dictValue, value: e.dictKey, code }
             })
           }
         }

+ 4 - 1
src/views/project/componens/top.vue

@@ -55,7 +55,10 @@ export default {
         .then(res => {
           if (res.code === 200) {
             this.stages = res.data
-            this.stage = this.stages.find(ele => ele.isLastSelect === 1).id
+            const tmp = this.stages.find(ele => ele.isLastSelect === 1)
+            if (tmp) {
+              this.stage = tmp.id
+            }
             this.$emit('change', this.stage)
           }
         })

+ 8 - 2
src/views/project/index.vue

@@ -12,8 +12,8 @@
     </tips-custom>
     <!--    content-->
     <div style="margin-bottom: 65px">
-      <info1 :info="detail" />
-      <info2 :project-id="projectId" :stage-id="stageId" />
+      <info1 :info="detail" @industry="changeIndustry" />
+      <info2 :project-id="projectId" :stage-id="stageId" :industry="industry" />
       <info3 :project-id="projectId" :stage-id="stageId" />
       <info4 :project-id="projectId" />
       <info5 :info="detail" />
@@ -75,6 +75,7 @@ export default {
     return {
       projectId: '',
       stageId: '',
+      industry: null,
       detail: {}
     }
   },
@@ -94,6 +95,8 @@ export default {
           const status = confing.reportTypes.find(
             ele => ele.value === this.detail.report_type
           )
+          this.detail.dict_key = JSON.parse(this.detail.dict_key)
+          this.industry = this.detail.dict_key[0]
           if (status) {
             this.detail.report_type_name = status.label
           }
@@ -102,6 +105,9 @@ export default {
     },
     changeStage(res) {
       this.stageId = res
+    },
+    changeIndustry(industry) {
+      this.industry = industry
     }
   }
 }