scorpio 2 years ago
parent
commit
f72db408b3

+ 1 - 1
src/api/common.js

@@ -9,7 +9,7 @@ export default {
     })
   },
   dicChildList(params) {
-    return fetch('/blade-system/dict-biz/child-list', {
+    return fetch('/blade-system/dict-biz/dictionary-tree', {
       clientId: website.clientId,
       ...params
     })

+ 0 - 1
src/components/area-picker/index.vue

@@ -60,7 +60,6 @@ export default {
       const tmps = res.map(ele => {
         return { key: ele.key, title: ele.title }
       })
-      console.log(this.area)
       this.$emit('change', tmps)
     }
   }

+ 67 - 0
src/components/industry-picker/index.vue

@@ -0,0 +1,67 @@
+<template>
+  <div class="full-width">
+    <el-cascader
+      :placeholder="placeholder"
+      clearable
+      class="full-width"
+      v-model="industry"
+      :options="industryList"
+      filterable
+      @change="change"
+    />
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    placeholder: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      industry: '',
+      industryList: []
+    }
+  },
+  mounted() {
+    this.getList()
+  },
+  methods: {
+    getList() {
+      this.$api.common
+        .dicChildList({ code: 'industry-classification' })
+        .then(res => {
+          if (res.code === 200) {
+            this.industryList = res.data.map(item => this.mapTree(item))
+          }
+        })
+    },
+    mapTree(item) {
+      const haveChildren =
+        Array.isArray(item.children) && item.children.length > 0
+      return {
+        key: item,
+        value: item,
+        label: item.dictValue,
+        children: haveChildren ? item.children.map(i => this.mapTree(i)) : []
+      }
+    },
+    change(res) {
+      const tmps = res.map(ele => {
+        return {
+          id: ele.id,
+          title: ele.dictValue,
+          value: ele.dictKey,
+          code: ele.code
+        }
+      })
+      this.$emit('change', tmps)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 24 - 27
src/views/project/componens/info1.vue

@@ -41,34 +41,34 @@
       <div class="flex flex-justify-center">
         <el-form-item class="full-width flex-child-average">
           <div class="flex flex-center full-width item">
-            <span class="title">责任单位:</span>
+            <span class="title">主管单位:</span>
             <el-select
-              v-model="form.responsible_unit"
+              v-model="form.competent_unit"
               placeholder="请选择项目标签"
               class="full-width"
             >
               <el-option
-                v-for="item in form.tags === 1 ? deptDic : compDic"
-                :key="item.dictValue"
-                :label="item.dictValue"
-                :value="item.dictKey"
+                v-for="item in deptDic"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
               />
             </el-select>
           </div>
         </el-form-item>
         <el-form-item class="full-width flex-child-average">
           <div class="flex flex-center full-width item">
-            <span class="title">主管单位:</span>
+            <span class="title">责任单位:</span>
             <el-select
-              v-model="form.competent_unit"
+              v-model="form.responsible_unit"
               placeholder="请选择项目标签"
               class="full-width"
             >
               <el-option
-                v-for="item in deptDic"
-                :key="item.dictValue"
-                :label="item.dictValue"
-                :value="item.dictKey"
+                v-for="item in form.tags === 1 ? deptDic : compDic"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
               />
             </el-select>
           </div>
@@ -96,7 +96,7 @@
         <el-form-item class="full-width flex-child-average">
           <div class="flex flex-center full-width item">
             <span class="title">所属行业:</span>
-            <el-input></el-input>
+            <industry-picker placeholde="行业" @change="changeIndustry" />
           </div>
         </el-form-item>
         <el-form-item class="full-width flex-child-average">
@@ -230,12 +230,14 @@ import wtCard from '@/components/wt-card/index.vue'
 import areaPicker from '@/components/area-picker/index.vue'
 import mapPicker from '@/views/project/componens/map-picker.vue'
 import { useStore } from '@/store/user.js'
+import industryPicker from '@/components/industry-picker/index.vue'
 
 export default {
   components: {
     wtCard,
     areaPicker,
-    mapPicker
+    mapPicker,
+    industryPicker
   },
   props: {
     info: {
@@ -258,10 +260,8 @@ export default {
           this.getCompList()
         }
         this.getDict('project-situation')
-        // fixme需要接口
-        this.getChildDict('industry-classification')
       },
-      immediate: true
+      immediate: false
     }
   },
   setup() {
@@ -296,21 +296,15 @@ export default {
         }
       })
     },
-    getChildDict(code) {
-      this.$api.common.dicChildList({ code }).then(res => {
-        if (res.code === 200) {
-          this.projectSituation = res.data
-        }
-      })
-    },
     getDepList() {
       const local = {
-        label: this.user.info.deptName,
-        value: this.user.info.deptId
+        label: this.form.competent_unit_name,
+        value: this.form.competent_unit
       }
       this.deptDic.push(local)
+      console.log(this.deptDic)
       this.$api.system
-        .getDeptLazy({ parentId: this.user.info.deptId, deptCategory: 3 })
+        .getDeptLazy({ parentId: this.form.competent_unit, deptCategory: 3 })
         .then(res => {
           if (res.code === 200) {
             const tmp = res.data.map(ele => {
@@ -362,6 +356,9 @@ export default {
       this.form.longitude = res.longitude
       this.form.latitude = res.latitude
       this.photoList = list
+    },
+    changeIndustry(tmps) {
+      this.form.dict_value = tmps
     }
   }
 }