Selaa lähdekoodia

闲置厂房资源加适用产业

yin_yu820 4 päivää sitten
vanhempi
commit
062dbcf408

+ 37 - 5
jp-ui/src/views/modules/idlefactorybuildings/IdleFactoryBuildingsForm.vue

@@ -21,7 +21,7 @@
                 :rules="[
                   {required: true, message:'板块不能为空', trigger:'blur'}
                  ]">
-                <el-select v-model="inputForm.park" placeholder="请选择"  style="width: 100%;">
+                <el-select v-model="inputForm.park+''" placeholder="请选择"  style="width: 100%;">
                           <el-option
                             v-for="item in $dictUtils.getDictList('sys_park')"
                             :key="item.value"
@@ -43,7 +43,7 @@
             <el-form-item label="厂房权属" prop="ownership"
                 :rules="[
                  ]">
-                <el-select v-model="inputForm.ownership" placeholder="请选择"  style="width: 100%;">
+                <el-select v-model="inputForm.ownership+''" placeholder="请选择"  style="width: 100%;">
                           <el-option
                             v-for="item in $dictUtils.getDictList('sys_ownership')"
                             :key="item.value"
@@ -65,7 +65,7 @@
             <el-form-item label="单层或多层" prop="singleLayer"
                 :rules="[
                  ]">
-                <el-select v-model="inputForm.singleLayer" placeholder="请选择"  style="width: 100%;">
+                <el-select v-model="inputForm.singleLayer+''" placeholder="请选择"  style="width: 100%;">
                           <el-option
                             v-for="item in $dictUtils.getDictList('sys_single_layer')"
                             :key="item.value"
@@ -97,6 +97,23 @@
           <el-input-number v-model="inputForm.idleArea" placeholder="请填写闲置厂房面积(㎡)"     style="width: 100%;"></el-input-number>
            </el-form-item>
         </el-col>
+
+
+        <el-col :span="12">
+          <el-form-item label="适用产业" prop="des1" :rules="[
+            { required: true, message: '适用产业不能为空', trigger: 'blur' }
+          ]">
+            <el-select v-model="inputForm.des1" placeholder="请选择" style="width: 100%;" multiple
+              @change="changePersonnelType">
+              <el-option v-for="item in $dictUtils.getDictList('sys_industry')" :key="item.value"
+                :label="item.label" :value="item.value">
+              </el-option>
+            </el-select>
+
+          </el-form-item>
+        </el-col>
+
+
         <el-col :span="12">
             <el-form-item label="备注" prop="remark"
                 :rules="[
@@ -109,7 +126,7 @@
                 :rules="[
                   {required: true, message:'厂房状态不能为空', trigger:'blur'}
                  ]">
-                <el-select v-model="inputForm.state" placeholder="请选择"  style="width: 100%;">
+                <el-select v-model="inputForm.state+''" placeholder="请选择"  style="width: 100%;">
                           <el-option
                             v-for="item in $dictUtils.getDictList('sys_factory_state')"
                             :key="item.value"
@@ -150,13 +167,25 @@
           floorHeight: '',
           idleArea: '',
           remark: '',
-          state: ''
+          state: '',
+          des1: '',
+          des2: ''
         }
       }
     },
     components: {
     },
     methods: {
+      changePersonnelType (vals) {
+          // 直接从字典里拿,不再依赖 $refs
+          const dict = this.$dictUtils.getDictList('sys_industry') || []
+          const selectedLabels = []
+          vals.forEach(v => {
+            const item = dict.find(d => d.value === v)
+            if (item) selectedLabels.push(item.label)
+          })
+          this.inputForm.des2 = selectedLabels.join(',')
+        },
       init (method, id) {
         this.method = method
         this.inputForm.id = id
@@ -175,6 +204,8 @@
             this.loading = true
             idleFactoryBuildingsService.queryById(this.inputForm.id).then(({data}) => {
               this.inputForm = this.recover(this.inputForm, data)
+              this.inputForm.des1 = data.des1 ? data.des1.split(',') : [],
+              console.log(this.inputForm)
               this.loading = false
             })
           }
@@ -185,6 +216,7 @@
         this.$refs['inputForm'].validate((valid) => {
           if (valid) {
             this.loading = true
+            this.inputForm.des1 = this.inputForm.des1.toString()
             idleFactoryBuildingsService.save(this.inputForm).then(({data}) => {
               this.visible = false
               this.$message.success(data)

+ 6 - 0
jp-ui/src/views/modules/idlefactorybuildings/IdleFactoryBuildingsList.vue

@@ -150,6 +150,12 @@
         sortable
         title="闲置厂房面积(㎡)">
       </vxe-column>
+    <vxe-column
+        field="des2"
+        width="300"
+        sortable
+        title="适用产业">
+      </vxe-column>
     <vxe-column
         field="state"
         sortable