scorpioyq 2 rokov pred
rodič
commit
ed5dc4e17b

+ 30 - 19
src/views/home/component/owner_serach.vue

@@ -120,7 +120,7 @@
             </el-form-item>
             <el-form-item class="full-width" label="机构选择">
               <div class="grey-9 pointer chose-box nowrap" @click="getOrg">
-                选择机构
+                {{ deptName }}
               </div>
             </el-form-item>
           </div>
@@ -192,14 +192,14 @@
 
 <script>
 import baseButton from '../../../components/base-button.vue'
-import { useStore } from '@/store/user.js'
+import {useStore} from '@/store/user.js'
 
 export default {
   name: 'owner_serach',
-  components: { baseButton },
+  components: {baseButton},
   watch: {
     keyWords: {
-      handler (val) {
+      handler(val) {
         setTimeout(() => {
           this.change()
         }, 500)
@@ -207,11 +207,11 @@ export default {
       immediate: true
     }
   },
-  setup () {
+  setup() {
     const user = useStore()
-    return { user }
+    return {user}
   },
-  data () {
+  data() {
     return {
       deptList: [],
       form: {
@@ -284,19 +284,20 @@ export default {
       keyWords: '',
       checked: false,
       time1: null, // 计划 实际开工时间
-      time2: null // 计划 实际入库时间
+      time2: null, // 计划 实际入库时间
+      deptName: '机构选择'
     }
   },
-  created () {
+  created() {
     this.getTypeList()
   },
   methods: {
-    getTypeList () {
+    getTypeList() {
       this.$api.project.typeList().then(res => {
         this.typeList = res.data.records
       })
     },
-    sure () {
+    sure() {
       this.form.type = true
       if (this.time1 !== null && this.form.isStart.length === 0) {
         this.$message.error('请先选择是否开工')
@@ -328,7 +329,7 @@ export default {
       }
       this.$bus.emit('serach', this.form)
     },
-    visibleTime (event, type) {
+    visibleTime(event, type) {
       if (event) {
         console.log(this.form.isStart)
         if (type === 1) {
@@ -344,7 +345,7 @@ export default {
         }
       }
     },
-    clear () {
+    clear() {
       this.form.projectName = ''
       this.form.typeId = ''
       this.form.isStorage = ''
@@ -360,16 +361,21 @@ export default {
       this.form.storageTime = ''
       this.time1 = null
       this.time2 = null
+      this.deptName = '机构选择'
       this.$bus.emit('serach', this.form)
     },
-    changeAmount () {
+    changeAmount() {
       const tmps = this.form.amount.split(',')
       this.form.totalAmountMin = tmps[0] === '-' ? '' : tmps[0]
       this.form.totalAmountMax = tmps[1] === '-' ? '' : tmps[1]
     },
-    getOrg () {
+    getOrg() {
+      if (this.deptList.length > 0) {
+        this.showOrg = true
+        return
+      }
       const parentId = [0, 2].includes(this.user.info.viewStage) ? this.user.info.parentDeptId : this.user.info.deptId
-      this.$api.system.getDeptLazy({ parentId }).then(res => {
+      this.$api.system.getDeptLazy({parentId}).then(res => {
         if (res.code === 200) {
           this.showOrg = true
           this.deptList = res.data.map(e => {
@@ -381,15 +387,20 @@ export default {
         }
       })
     },
-    changeChecked (index) {
+    changeChecked(index) {
       this.deptList[index].checked = !this.deptList[index].checked
     },
-    orgCheck () {
+    orgCheck() {
       const checked = this.deptList.filter(sub => sub.checked)
       this.form.deptIds = checked.map(sub => sub.id).join(',')
+      let tmp = checked.map(e => e.deptName)
+      if (tmp.length > 0) {
+        this.deptName = tmp[0]
+      }
       this.showOrg = false
+
     },
-    change () {
+    change() {
       if (this.keyWords.length === 0) {
         this.deptList.forEach(sub => sub.search = false)
         return

+ 13 - 13
src/views/home/component/params/params1.vue

@@ -224,14 +224,14 @@ export default {
   },
   watch: {
     detail: {
-      handler (val) {
+      handler(val) {
         this.form = val
         this.form.construction_start_and_end_new = ''
       },
       immediate: true
     },
     disabled: {
-      handler (val) {
+      handler(val) {
         if (val) {
           this.updata()
         }
@@ -239,29 +239,29 @@ export default {
       immediate: false
     }
   },
-  data () {
+  data() {
     return {
       disabled: true,
       form: {},
       areaDic: [],
       yesOrNo: [
-        { label: '否', value: 0 },
-        { label: '是', value: 1 }
+        {label: '否', value: 0},
+        {label: '是', value: 1}
       ]
     }
   },
-  created () {
+  created() {
     this.areaList()
   },
   methods: {
-    areaList () {
-      this.$api.common.region({ code: '' }).then(res => {
+    areaList() {
+      this.$api.common.region({code: ''}).then(res => {
         if (res.code === 200) {
           this.areaDic = res.data.map(item => this.mapTree(item))
         }
       })
     },
-    mapTree (item) {
+    mapTree(item) {
       const haveChildren = Array.isArray(item.children) && item.children.length > 0
       return {
         key: item.id,
@@ -270,7 +270,7 @@ export default {
         children: haveChildren ? item.children.map(i => this.mapTree(i)) : []
       }
     },
-    updata () {
+    updata() {
       this.form.projectId = this.detail.id
       this.form.total_amount = Number.parseFloat(this.detail.total_amount)
       delete this.detail._id
@@ -282,9 +282,8 @@ export default {
         }
       })
     },
-    changeDate (res) {
-      console.log(res)
-      this.form.construction_start_and_end = res.join('-')
+    changeDate(res) {
+      this.form.construction_start_and_end = res.join(',')
     }
   }
 }
@@ -298,6 +297,7 @@ export default {
   :deep(.el-input.is-disabled .el-input__inner) {
     color: #343434;
   }
+
   :deep(.el-textarea.is-disabled .el-textarea__inner) {
     color: #343434;
   }