Ver código fonte

fix user avatar

scorpio 2 anos atrás
pai
commit
a6f95b58f2

+ 6 - 0
src/api/common.js

@@ -8,6 +8,12 @@ export default {
       ...params
     })
   },
+  dicChildList(params) {
+    return fetch('/blade-system/dict-biz/child-list', {
+      clientId: website.clientId,
+      ...params
+    })
+  },
   submit(params) {
     // 保存上传文件素材
     return fetch('/wutong-library/library/save', params, 'post', 'json')

+ 1 - 1
src/layout/top.vue

@@ -179,7 +179,6 @@ export default {
   mounted() {
     this.initWebSocket()
     this.readCount()
-    setWaterMark(this.user.info.deptName, this.user.info.nickName)
   },
   unmounted() {
     this.websock.close() // 离开路由之后断开websocket连接
@@ -271,6 +270,7 @@ export default {
     start() {
       // 开启心跳
       console.log('开启心跳')
+      setWaterMark(this.user.info.deptName, this.user.info.nickName)
       const self = this
       self.timeoutObj && clearTimeout(self.timeoutObj)
       self.serverTimeoutObj && clearTimeout(self.serverTimeoutObj)

+ 167 - 28
src/views/project/componens/info1.vue

@@ -42,13 +42,35 @@
         <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>
+            <el-select
+              v-model="form.responsible_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"
+              />
+            </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>
-            <el-input></el-input>
+            <el-select
+              v-model="form.competent_unit"
+              placeholder="请选择项目标签"
+              class="full-width"
+            >
+              <el-option
+                v-for="item in deptDic"
+                :key="item.dictValue"
+                :label="item.dictValue"
+                :value="item.dictKey"
+              />
+            </el-select>
           </div>
         </el-form-item>
         <el-form-item class="full-width flex-child-average">
@@ -73,14 +95,78 @@
         </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-input></el-input>
           </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>
-            <el-input></el-input>
+            <span class="title">产业项目:</span>
+            <el-select
+              v-model="form.social_investment"
+              placeholder="是否是产业项目"
+              class="full-width"
+            >
+              <el-option
+                v-for="item in yesOrNo"
+                :key="item.label"
+                :label="item.label"
+                :value="item.value"
+              />
+            </el-select>
+          </div>
+        </el-form-item>
+      </div>
+      <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>
+            <el-select
+              v-model="form.social_investment"
+              placeholder="是否民间投资项目"
+              class="full-width"
+            >
+              <el-option
+                v-for="item in yesOrNo"
+                :key="item.label"
+                :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>
+            <el-select
+              v-model="form.social_investment"
+              placeholder="是否获得资金支持"
+              class="full-width"
+            >
+              <el-option
+                v-for="item in yesOrNo"
+                :key="item.label"
+                :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>
+            <el-select
+              v-model="form.project_stage"
+              placeholder="请选择项目标签"
+              class="full-width"
+            >
+              <el-option
+                v-for="item in projectSituation"
+                :key="item.dictValue"
+                :label="item.dictValue"
+                :value="item.dictKey"
+              />
+            </el-select>
           </div>
         </el-form-item>
       </div>
@@ -90,7 +176,7 @@
             class="flex flex-center flex-justify-start full-width"
             style="width: 99%"
           >
-            <span style="width: 90px" class="text-left">项目位置:</span>
+            <span style="width: 100px" class="text-left">项目位置:</span>
             <div class="full-width">
               <map-picker
                 :project-id="form.id"
@@ -101,12 +187,6 @@
             </div>
           </div>
         </el-form-item>
-        <el-form-item class="full-width" style="flex: 1">
-          <div class="flex flex-center full-width item">
-            <span class="title">项目标签:</span>
-            <el-input></el-input>
-          </div>
-        </el-form-item>
       </div>
       <div class="flex flex-justify-center">
         <el-form-item class="full-width" style="flex: 1">
@@ -149,6 +229,7 @@
 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'
 
 export default {
   components: {
@@ -168,31 +249,89 @@ export default {
     info: {
       handler(val) {
         this.form = val
-        this.mapForm = [
-          this.form.latitude,
-          this.form.longitude,
-          this.form.address
-        ]
+        if (val.tags === 1) {
+          // 1 政府项目,主管单位和责任单位都为政府机构
+          this.getDepList()
+        } else {
+          // 2 企业项目,主管单位为机构,责任单位为企业
+          this.getDepList()
+          this.getCompList()
+        }
+        this.getDict('project-situation')
+        // fixme需要接口
+        this.getChildDict('industry-classification')
       },
       immediate: true
-    },
-    mapForm: {
-      handler(val) {
-        this.form.latitude = val[0]
-        this.form.longitude = val[1]
-        this.form.address = val[2]
-      },
-      immediate: false
     }
   },
+  setup() {
+    const user = useStore()
+    return { user }
+  },
   data() {
     return {
       disabled: true,
       form: {},
-      photoList: []
+      photoList: [],
+      yesOrNo: [
+        {
+          label: '否',
+          value: 0
+        },
+        {
+          label: '是',
+          value: 1
+        }
+      ],
+      projectSituation: [],
+      deptDic: [],
+      compDic: []
     }
   },
   methods: {
+    getDict(code) {
+      this.$api.common.dicList({ code }).then(res => {
+        if (res.code === 200) {
+          this.projectSituation = res.data
+        }
+      })
+    },
+    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
+      }
+      this.deptDic.push(local)
+      this.$api.system
+        .getDeptLazy({ parentId: this.user.info.deptId, deptCategory: 3 })
+        .then(res => {
+          if (res.code === 200) {
+            const tmp = res.data.map(ele => {
+              const item = { label: ele.deptName, value: ele.id }
+              return item
+            })
+            this.deptDic = this.deptDic.concat(tmp)
+          }
+        })
+    },
+    getCompList() {
+      this.$api.system.getNewDeptLazy({ deptCategory: 4 }).then(res => {
+        if (res.code === 200) {
+          const tmp = res.data.map(ele => {
+            const item = { label: ele.deptName, value: ele.id }
+            return item
+          })
+          this.compDic = this.compDic.concat(tmp)
+        }
+      })
+    },
     save() {
       if (this.photoList.length > 0) {
         this.$api.project.addPhotoProject(this.photoList).then(res => {
@@ -230,12 +369,12 @@ export default {
 
 <style lang="scss" scoped>
 .title {
-  width: 100px;
+  width: 120px;
   text-align: left;
 }
 
 .title-textarea {
-  width: 85px;
+  width: 100px;
   text-align: left;
 }
 

+ 24 - 24
src/views/project/componens/top.vue

@@ -3,17 +3,17 @@
     <div class="white-bg border radius-5 picker flex flex-center">
       <span class="padding">项目阶段:</span>
       <el-select
-          class="padding-right"
-          style="width: 200px"
-          clearable
-          v-model="stage"
-          @change="changeStage"
+        class="padding-right"
+        style="width: 200px"
+        clearable
+        v-model="stage"
+        @change="changeStage"
       >
         <el-option
-            v-for="item in stages"
-            :key="item.id"
-            :label="item.name"
-            :value="item.id"
+          v-for="item in stages"
+          :key="item.id"
+          :label="item.name"
+          :value="item.id"
         />
       </el-select>
     </div>
@@ -51,23 +51,23 @@ export default {
      */
     getStage() {
       this.$api.project
-          .includeStage({projectId: this.projectId})
-          .then(res => {
-            if (res.code === 200) {
-              this.stages = res.data
-              this.stage = this.stages.find(ele => ele.isLastSelect === 1).id
-              this.$emit('change', this.stage)
-            }
-          })
+        .includeStage({ projectId: this.projectId })
+        .then(res => {
+          if (res.code === 200) {
+            this.stages = res.data
+            this.stage = this.stages.find(ele => ele.isLastSelect === 1).id
+            this.$emit('change', this.stage)
+          }
+        })
     },
     changeStage(res) {
-      this.$api.project.changeStage({projectId: this.projectId, stageId: res}).then(res => {
-        if (res.code === 200) {
-          this.$emit('change', res)
-        }
-      })
-
-
+      this.$api.project
+        .changeStage({ projectId: this.projectId, stageId: res })
+        .then(res => {
+          if (res.code === 200) {
+            this.$emit('change', res)
+          }
+        })
     }
   }
 }