Pārlūkot izejas kodu

adm:feat > 修改添加/修改建筑输入类型

shaun-sheep 4 gadi atpakaļ
vecāks
revīzija
68c0292c12

+ 61 - 62
src/components/ready/buildfloor/addBuild.vue

@@ -19,34 +19,35 @@
         <div
           :key="item.InfoPointCode"
           v-for="item in val"
-          :class="[{'upload-file':item.inputMode == 'F2' ||  item.Path === 'infos.pic'}]"
+          :class="[{'upload-file':item.dataType == 'ATTACHMENT' ||  item.Path === 'infos.pic'}]"
           style="width: 50%;display: inline-block">
 
           <el-form-item
-            :class="{FloorTypeSelect:item.inputMode == 'D1'||item.Unit}"
+            :class="{FloorTypeSelect:item.dataType == 'ENUM'||item.Unit}"
             :label="item.InfoPointName"
             :prop="item.InfoPointCode"
             v-if="all||item.Visible">
             <el-input
-              v-if="item.inputMode == 'B1' || item.inputMode == 'B2'"
+              :disabled="!item.editable"
+              v-if="item.dataType == 'STRING'"
               v-model="form[item.Path]"/>
 
             <el-input
-              v-else-if="item.inputMode == 'A1'||item.inputMode == 'A2'"
+              v-else-if="item.dataType == 'INTEGER' || item.dataType == 'DOUBLE'"
               type="number"
               v-model="form[item.Path]">
               <template slot="append" v-if="item.Unit">{{ item.Unit }}</template>
             </el-input>
 
             <el-select
-              v-else-if="item.inputMode == 'D1' || item.inputMode == 'E2'"
+              v-else-if="item.dataType == 'ENUM' || item.dataType == 'BOOLEAN'"
               placeholder="请选择"
               v-model="form[item.Path]">
               <el-option :key="op.name" :label="op.name" :value="op.code" v-for="op in item.options"></el-option>
             </el-select>
 
             <el-select
-              v-else-if="item.inputMode == 'D2'"
+              v-else-if="item.dataType == 'MENUM'"
               placeholder="请选择"
               v-model="form[item.Path]"
               multiple
@@ -54,41 +55,41 @@
               <el-option :key="op.name" :label="op.name" :value="op.code" v-for="op in item.options"></el-option>
             </el-select>
 
-            <el-date-picker
-              v-else-if="item.inputMode == 'C6'"
-              v-model="form[item.Path]"
-              type="daterange"
-              value-format="yyyy-MM-dd"
-              range-separator="至"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"/>
+            <!--            <el-date-picker-->
+            <!--              v-else-if="item.dataType == 'DATETIME'"-->
+            <!--              v-model="form[item.Path]"-->
+            <!--              type="daterange"-->
+            <!--              value-format="yyyy-MM-dd"-->
+            <!--              range-separator="至"-->
+            <!--              start-placeholder="开始日期"-->
+            <!--              end-placeholder="结束日期"/>-->
 
-            <el-cascader
-              v-else-if="item.inputMode == 'D1L'"
-              placeholder="请选择"
-              :options="item.options"
-              v-model="form[item.Path]"
-              :props="item.props"
-              filterable
-              :show-all-levels="false"
-              clearable
-              style="width: 200px"/>
+            <!--            <el-cascader-->
+            <!--              v-else-if="item.inputMode == 'D1L'"-->
+            <!--              placeholder="请选择"-->
+            <!--              :options="item.options"-->
+            <!--              v-model="form[item.Path]"-->
+            <!--              :props="item.props"-->
+            <!--              filterable-->
+            <!--              :show-all-levels="false"-->
+            <!--              clearable-->
+            <!--              style="width: 200px"/>-->
 
-            <el-input
-              v-else-if="item.inputMode == 'L'||item.inputMode == 'L1'||item.inputMode == 'L2'||item.inputMode == 'M'"
-              v-model="form[item.Path]">
-              <template slot="append" v-if="item.Unit">{{ item.Unit }}</template>
-            </el-input>
+            <!--            <el-input-->
+            <!--              v-else-if="item.inputMode == 'L'||item.inputMode == 'L1'||item.inputMode == 'L2'||item.inputMode == 'M'"-->
+            <!--              v-model="form[item.Path]">-->
+            <!--              <template slot="append" v-if="item.Unit">{{ item.Unit }}</template>-->
+            <!--            </el-input>-->
 
             <el-date-picker
-              v-else-if="item.inputMode == 'C5'" v-model="form[item.Path]"
+              v-else-if="item.dataType == 'DATETIME'"
+              v-model="form[item.Path]"
               placeholder="选择日期"
-              value-format="yyyy-MM-dd"
               type="date">
             </el-date-picker>
 
             <uploadImgs
-              v-else-if="item.inputMode == 'F2'&& item.Path === 'infos.Pic'"
+              v-else-if="item.dataType == 'ATTACHMENT'&& item.Path === 'infos.Pic'"
               :readOnly="false"
               v-model="form[item.Path]"
               :keysArr="Array.isArray(buildData[item.Path]) ? buildData[item.Path]:[]"
@@ -97,7 +98,7 @@
               @change="changeItem"/>
 
             <upload-files
-              v-else-if="item.inputMode == 'F2'"
+              v-else-if="item.dataType == 'ATTACHMENT'"
               v-model="form[item.Path]"
               :readOnly="false"
               :isShow="1"
@@ -106,8 +107,6 @@
               :context-key="item.Path"
               @change="changeItem"/>
 
-            <el-input disabled title="暂不支持" v-else v-model="form[item.Path]"/>
-
           </el-form-item>
         </div>
       </template>
@@ -187,20 +186,20 @@ export default {
       //获取信息
       let buildData = data || {};  // string =>array key
       buildData = flattenKeys(buildData);
-      for (let key in this.buildMessage) {
-        let arr = this.buildMessage[key];
-        if (Array.isArray(arr)) {
-          let list = arr.filter(i => i.inputMode == 'D2' || i.inputMode == 'C6');
-          list.forEach(j => {
-            if (buildData.hasOwnProperty(j.Path)) {
-              if (!Array.isArray(buildData[j.Path])) {
-                buildData[j.Path] = buildData[j.Path].split(',');
-              }
-            }
-
-          })
-        }
-      }
+      // for (let key in this.buildMessage) {
+      //   let arr = this.buildMessage[key];
+      //   if (Array.isArray(arr)) {
+      //     let list = arr.filter(i => i.dataType == 'MENUM' || i.dataType == 'DATETIME');
+      //     list.forEach(j => {
+      //       if (buildData.hasOwnProperty(j.Path)) {
+      //         if (!Array.isArray(buildData[j.Path])) {
+      //           buildData[j.Path] = buildData[j.Path].split(',');
+      //         }
+      //       }
+      //
+      //     })
+      //   }
+      // }
       this.buildData = buildData;
       this.timeoutSetVal()
       this.buildDialogVis = true
@@ -223,19 +222,19 @@ export default {
       this.$refs[formName].validate((valid) => {
         if (valid) {
           this.buildDisabled = true
-          for (let key in this.buildMessage) {
-            let arr = this.buildMessage[key];
-            if (Array.isArray(arr)) {
-              let list = arr.filter(i => i.inputMode == 'D2' || i.inputMode == 'C6');
-              list.forEach(j => {
-                if (this.form.hasOwnProperty(j.Path)) {
-                  if (Array.isArray(this.form[j.Path])) {
-                    this.form[j.Path] = this.form[j.Path].join(',');
-                  }
-                }
-              })
-            }
-          }
+          // for (let key in this.buildMessage) {
+          //   let arr = this.buildMessage[key];
+          //   if (Array.isArray(arr)) {
+          //     let list = arr.filter(i => i.inputMode == 'D2' || i.inputMode == 'C6');
+          //     list.forEach(j => {
+          //       if (this.form.hasOwnProperty(j.Path)) {
+          //         if (Array.isArray(this.form[j.Path])) {
+          //           this.form[j.Path] = this.form[j.Path].join(',');
+          //         }
+          //       }
+          //     })
+          //   }
+          // }
           this.$emit('handleBuild', this.form)
           setTimeout(() => {
             this.buildDisabled = false

+ 16 - 10
src/views/ready/buildfloor/index.vue

@@ -224,17 +224,20 @@ export default {
         //一级循环出来一级标签
         let list = res.content.filter(i => (i.firstName !== '工作历') && (i.firstName !== '能耗信息') && (i.firstName !== '人员信息'))
         list.map(item => {
-          if ((item.inputMode === 'D1' || item.inputMode === 'D2' || item.inputMode === 'E2' || item.inputMode === 'D1L') && item.dataSource) {
-            // item.options = JSON.parse(item.dataSource)
+          console.table(item.category, item.dataType)
+          const category = ['ENUM', 'MENUM', 'BOOLEAN']
+          // if ((item.inputMode === 'D1' || item.inputMode === 'D2' || item.inputMode === 'E2' || item.inputMode === 'D1L') && item.dataSource) {
+          // item.options = JSON.parse(item.dataSource)
+          if (item.category == 'STATIC' && item.dataType.includes(category) && item.dataSource) {
             item.options = item.dataSource
-            if (item.options[0] && item.options[0].content) {
-              item.props = {
-                value: 'code',
-                label: 'name',
-                children: 'content',
-                checkStrictly: true
-              }
+            // if (item.options[0] && item.options[0].content) {
+            item.props = {
+              value: 'code',
+              label: 'name',
+              children: 'content',
+              checkStrictly: true
             }
+            // }
           }
           if (first[item.firstName] && first[item.firstName].length) {
           } else {
@@ -251,7 +254,10 @@ export default {
               options: item.dataSource,
               props: item.props,
               Unit: item.unit,
-              Path: item.path
+              Path: item.path,
+              dataType: item.dataType,
+              category: item.category,
+              editable: item.editable
             })
           }
         })