scorpio 3 years ago
parent
commit
9d749f669e
2 changed files with 208 additions and 157 deletions
  1. 32 28
      src/components/basic-form/sub.vue
  2. 176 129
      src/views/home/component/proinfo.vue

+ 32 - 28
src/components/basic-form/sub.vue

@@ -4,7 +4,7 @@
       <div class='flex item full-width'>
         <el-form-item class='full-width '>
           <template v-slot:label>
-            <div class='label light-red-bg full-width padding-left text-left bold' >
+            <div class='label  full-width padding-left text-left bold' >
               {{ item.label }}
             </div>
           </template>
@@ -83,8 +83,7 @@
           </template>
           <div class='full-width flex flex-align-start full-height text-left full-width'
                style='white-space: pre-wrap;text-overflow: ellipsis;'>
-            <el-select class="m-2" :placeholder="`请选择${item.label}`" @change='change($event,item)'
-                       :disabled='disable'>
+            <el-select v-if='!disable' class="m-2" v-model="editData[item.prop]" :placeholder="`请选择${item.label}`" @change='change($event,item)'>
               <el-option
                   v-for="item in item.dict"
                   :key="item.value"
@@ -92,6 +91,7 @@
                   :value="item.value"
               />
             </el-select>
+            <input v-else disabled v-model='editData[item.prop]' />
             <el-icon v-if='!disable' class="padding-right padding-top">
               <edit/>
             </el-icon>
@@ -105,14 +105,15 @@
           <template v-slot:label>
             <div :style='`height:` + item.rows * 35 + `px`'
                  class='label white-bg full-width text-left padding-left bold'>
-              {{ item.label }}{{ item.type }}
+              {{ item.label }}
             </div>
           </template>
           <div class='full-width flex flex-align-start full-height text-left full-width'
                style='white-space: pre-wrap;text-overflow: ellipsis;'>
-            <el-cascader ref='area' :options="item.dict" v-model="editData[item.prop]" :disabled='disable' class="m-2"
+            <el-cascader v-if='!disable' ref='area' :options="item.dict" v-model="editData[item.prop]" :disabled='disable' class="m-2"
                          :placeholder="`请选择${item.label}`" @change='change($event,item)'>
             </el-cascader>
+            <input v-else disabled v-model='editData[item.prop]' />
             <el-icon v-if='!disable' class="padding-right padding-top">
               <edit/>
             </el-icon>
@@ -127,12 +128,13 @@
           <template v-slot:label>
             <div :style='`height:` + item.rows * 35 + `px`'
                  class='label white-bg full-width text-left padding-left bold'>
-              {{ item.label }}{{ item.type }}
+              {{ item.label }}
             </div>
           </template>
           <div class='full-width flex flex-align-start full-height text-left full-width'
                style='white-space: pre-wrap;text-overflow: ellipsis;'>
             <el-date-picker
+                v-if='!disable'
                 v-model="editData[item.prop]"
                 :disabled='disable'
                 type="daterange"
@@ -143,6 +145,7 @@
                 value-format='YYYY-MM-DD'
                 format='YYYY-MM-DD'
             />
+            <input v-else disabled v-model='editData[item.prop]' />
             <el-icon v-if='!disable' class="padding-right padding-top">
               <edit/>
             </el-icon>
@@ -157,14 +160,14 @@
           <template v-slot:label>
             <div :style='`height:` + item.rows * 35 + `px`'
                  class='label white-bg full-width text-left padding-left bold'>
-              {{ item.label }}{{ item.type }}
+              {{ item.label }}
             </div>
           </template>
-          <div class='full-width flex flex-align-start full-height text-left full-width'
+          <div class='full-width flex  flex-align-center full-height text-left full-width'
                style='white-space: pre-wrap;text-overflow: ellipsis;'>
-            <el-input-number v-model='editData[item.prop]' :disabled='disable'
+            <input v-model='editData[item.prop]' :disabled='disable' type='number' class='full-width'
                              :placeholder='`请输入` + item.label' step='2'
-                             @change='change($event,item)'></el-input-number>
+                             @change='change($event,item)'/>
             <el-icon v-if='!disable' class="padding-right padding-top">
               <edit/>
             </el-icon>
@@ -196,16 +199,7 @@ export default {
     item: {
       handler (val) {
         if (val.type === 'autoInput') {
-          const tmp = {
-            dict: '/blade-system/region/lazy-tree?parentCode=00',
-            props: {
-              label: 'title',
-              value: 'key'
-            }
-          }
-          val.expand = JSON.stringify(tmp, null, 4)
-          val.expand = JSON.parse(val.expand)
-          this.getDic(val.expand).then(res => {
+          this.getDic(val).then(res => {
             val.dict = res
           })
           console.log(val.dict)
@@ -219,7 +213,11 @@ export default {
           }
           val.expand = JSON.stringify(tmp, null, 4)
           val.expand = JSON.parse(val.expand)
-          this.getDic(val.expand).then(res => {
+          this.getDic(val).then(res => {
+            val.dict = res
+          })
+        } else if (val.type === 'select') {
+          this.getDic(val).then(res => {
             val.dict = res
           })
         }
@@ -245,14 +243,20 @@ export default {
     }
   },
   methods: {
-    async getDic (expand) {
-      const local = localStorage.getItem('lazy-list')
-      if (local) {
-        return JSON.parse(local)
+    async getDic (item) {
+      let result = []
+      if (item.type === 'area') {
+        const local = localStorage.getItem('lazy-list')
+        if (local) {
+          return JSON.parse(local)
+        }
+        const tmp = await this.$api.common.basicFormRequest(item.expand.dict)
+        result = tmp.data.map(sub => this.mapTree(sub, item.expand))
+        localStorage.setItem('lazy-list', JSON.stringify(result))
+      } else {
+        const tmp = await this.$api.common.basicFormRequest(item.expand.dict)
+        result = tmp.data.map(sub => this.mapTree(sub, item.expand))
       }
-      const tmp = await this.$api.common.basicFormRequest(expand.dict)
-      const result = tmp.data.map(item => this.mapTree(item, expand))
-      localStorage.setItem('lazy-list', JSON.stringify(result))
       return result
     },
     mapTree (item, expand) {

+ 176 - 129
src/views/home/component/proinfo.vue

@@ -82,7 +82,7 @@ export default {
       handler (val) {
         if (val && val.hasOwnProperty('property')) {
           const config = JSON.parse(val.property)
-          this.option.column = config
+          // this.option.column = config
         }
       },
       immediate: true
@@ -104,194 +104,241 @@ export default {
         labelWidth: '200px',
         column: [
           {
-            label: '项目统一名称',
             prop: 'name',
+            id: 1,
+            label: '名称',
             type: 'input',
-            span: 24
+            span: '24'
           },
           {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '总投资(万元)',
                 prop: 'totalAmount',
-                type: 'textarea',
-                span: 24
-              },
-              {
-                label: '区划',
-                prop: 'provinceCode',
-                type: 'textarea',
-                span: 24
-              }
-            ]
-          },
-          {
-            type: 'row',
-            column: [
-              {
-                label: '地市',
-                prop: 'cityCode',
-                type: 'textarea',
-                span: 24
+                id: 21,
+                label: '总投资(万元)',
+                type: 'number',
+                parentId: 2,
+                span: '24'
               },
               {
-                label: '区县',
-                prop: 'districtCode',
-                type: 'textarea',
-                span: 24
+                label: '地区',
+                type: 'area',
+                prop: 'province',
+                expand: {
+                  dict: '/blade-system/region/lazy-list',
+                  prop: {
+                    label: 'name',
+                    value: 'id'
+                  }
+                },
+                id: 22,
+                parentId: 2,
+                span: '24'
               }
-            ]
+            ],
+            id: 2,
+            type: 'row'
           },
           {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '不含专项债的资本金',
                 prop: 'capital',
-                type: 'textarea',
-                span: 24
+                id: 41,
+                label: '不含专项债的资本金',
+                type: 'number',
+                parentId: 4,
+                span: '24'
               },
               {
+                prop: 'debt',
+                id: 42,
                 label: '项目领域',
-                prop: 'dictName',
-                type: 'textarea',
-                span: 24
+                type: 'select',
+                parentId: 4,
+                span: '24',
+                expand: {
+                  dict: '/blade-system/dict-biz/dictionary?code=pc-debt-type',
+                  prop: {
+                    label: 'dictValue',
+                    value: 'dictKey'
+                  }
+                }
               }
-            ]
+            ],
+            id: 4,
+            type: 'row'
           },
           {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '申请专项债总额',
-                prop: 'data2',
-                type: 'textarea',
-                span: 24
-              },
-              {
-                label: '项目业主',
-                prop: 'implementingAgency',
-                type: 'textarea',
-                span: 24
-              }
-            ]
-          },
-          {
-            type: 'row',
-            column: [
-              {
-                label: '其他债务融资',
+                label: '其他债务融资(万元)',
+                type: 'number',
                 prop: 'portfolioFinancing',
-                type: 'textarea',
-                span: 24
+                expand: '',
+                id: 61,
+                parentId: 6,
+                span: '24'
               },
               {
-                label: '建设期',
                 prop: 'startDate',
-                type: 'textarea',
-                span: 24
+                id: 62,
+                label: '建设期',
+                type: 'daterange',
+                parentId: 6,
+                span: '24'
               }
-            ]
+            ],
+            id: 6,
+            type: 'row'
           },
           {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '专项债做资本金',
+                label: '专项债做资本金(万元)',
+                type: 'number',
                 prop: 'debtsAsCapital',
-                type: 'textarea',
-                span: 24
+                expand: '',
+                id: 71,
+                parentId: 7,
+                span: '24'
               },
               {
-                label: '运营期',
                 prop: 'operationStartDate',
-                type: 'textarea',
-                span: 24
+                id: 72,
+                label: '运营期',
+                type: 'daterange',
+                parentId: 7,
+                span: '24'
               }
-            ]
+            ],
+            id: 7,
+            type: 'row'
           },
           {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '预期收入(收益)',
+                label: '预期收益(万元)',
+                type: 'number',
                 prop: 'expectedReturn',
-                type: 'textarea',
-                span: 24
+                expand: '',
+                id: 81,
+                parentId: 8
+
               },
               {
-                label: '成本',
                 prop: 'cost',
-                type: 'textarea',
-                span: 24
+                id: 82,
+                label: '成本',
+                type: 'number',
+                parentId: 8
+
               }
-            ]
+            ],
+            id: 8,
+            type: 'row'
           },
           {
-            label: '收入来源',
-            prop: 'sourceIncome',
-            type: 'textarea',
-            span: 24,
-            rows: 3
-          },
-          {
-            label: '建设内容',
-            prop: 'introduction',
-            type: 'textarea',
-            span: 24,
-            rows: 4
-          },
-          {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '其他债务融资来源',
-                prop: 'data2',
-                type: 'textarea',
-                span: 24
+                prop: 'costIncomePercent',
+                id: 121,
+                label: '成本/收入',
+                type: 'number',
+                parentId: 12
               },
               {
-                label: '主管部门',
-                prop: 'projectSubject',
-                type: 'textarea',
-                span: 24
+                prop: 'coverageMultiple',
+                id: 131,
+                label: '覆盖倍数',
+                type: 'number',
+                parentId: 13
               }
-            ]
+            ],
+            id: 11,
+            type: 'row'
           },
           {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '成本/收入',
-                prop: 'costIncomePercent',
-                type: 'textarea',
-                span: 24
+                prop: 'projectSubject',
+                id: 112,
+                label: '主管部门',
+                type: 'number',
+                parentId: 11
+
               },
               {
-                label: '会计所',
-                prop: 'data3',
-                type: 'textarea',
-                span: 24
+                prop: 'implementingAgency',
+                id: 52,
+                label: '项目业主',
+                type: 'input',
+                parentId: 5
+
               }
-            ]
+            ],
+            id: 5,
+            type: 'row'
           },
           {
-            type: 'row',
-            column: [
+            children: [
               {
-                label: '覆盖倍数',
-                prop: 'coverageMultiple',
-                type: 'textarea',
-                span: 24
+                prop: 'accountingFirm',
+                id: 122,
+                label: '会计所',
+                type: 'number',
+                parentId: 12
+
               },
               {
-                label: '律所',
                 prop: 'lawFirm',
-                type: 'textarea',
-                span: 24
+                id: 132,
+                label: '律所',
+                type: 'number',
+                parentId: 13
+
+              }
+            ],
+            id: 12,
+            type: 'row'
+          },
+          {
+            children: [
+              {
+                prop: 'issueCumulative',
+                id: 51,
+                label: '申请专项债总额(累计发行)',
+                type: 'number',
+                parentId: 5
+
               }
-            ]
+            ],
+            id: 11,
+            type: 'row'
+          },
+          {
+            prop: 'sourceIncome',
+            id: 9,
+            label: '收入来源',
+            type: 'textarea',
+            rows: 3,
+            span: '24'
+          },
+          {
+            prop: 'introduction',
+            id: 10,
+            label: '建设内容',
+            type: 'textarea',
+            rows: 4,
+            span: '24'
+          },
+          {
+            prop: 'portfolioFinancing',
+            id: 111,
+            label: '其他债务融资来源',
+            type: 'textarea',
+            parentId: 11,
+            rows: 4,
+            span: '24'
           }
         ]
       },