Browse Source

添加楼层form兼容BOOLEAN

duxiangyu 2 years ago
parent
commit
f8012958a2
1 changed files with 51 additions and 44 deletions
  1. 51 44
      src/components/ready/buildfloor/formItems.vue

+ 51 - 44
src/components/ready/buildfloor/formItems.vue

@@ -23,7 +23,7 @@
             v-model.trim="form[item.path]"
             v-if="
               item.infoPointCode == 'bimLocation' ||
-              item.infoPointCode == 'modelId'
+                item.infoPointCode == 'modelId'
             "
             disabled
           />
@@ -41,8 +41,8 @@
                   style="width: 200px; height: 200px"
                   :src="
                     '/image-service/common/file_get/' +
-                    form[item.path] +
-                    '?systemId=dataPlatform'
+                      form[item.path] +
+                      '?systemId=dataPlatform'
                   "
                   alt="二维码"
                 />
@@ -63,8 +63,8 @@
                   style="width: 200px; height: 200px"
                   :src="
                     '/image-service/common/file_get/' +
-                    form[item.path] +
-                    '?systemId=dataPlatform'
+                      form[item.path] +
+                      '?systemId=dataPlatform'
                   "
                   alt="二维码"
                 />
@@ -87,8 +87,8 @@
             <div
               v-if="
                 item.dataType == 'STRING' &&
-                item.path === 'localId' &&
-                isShowTitle
+                  item.path === 'localId' &&
+                  isShowTitle
               "
               style="color: gray; font-size: 12px"
             >
@@ -108,7 +108,7 @@
           <el-select
             v-model="form[item.path]"
             placeholder="请选择"
-            v-else-if="item.dataType == 'ENUM'"
+            v-else-if="item.dataType == 'ENUM' || item.dataType == 'BOOLEAN'"
           >
             <el-option
               v-for="op in item.options"
@@ -135,13 +135,12 @@ import rules from "../../../api/fm/rules";
 export default {
   props: {
     type: {
-      default: "floor",
-    },
+      default: "floor"
+    }
   },
   data() {
-
     let validateId = (rule, value, callback) => {
-      console.log('localId', rule, value, callback)
+      console.log("localId", rule, value, callback);
       if (!value) {
         this.isShowTitle = false;
         return callback(new Error("请输入楼层本地编码"));
@@ -158,12 +157,12 @@ export default {
       rules: {
         localId: [{ validator: validateId, trigger: "blur", required: true }],
         localName: [
-          { required: true, message: "请输入楼层本地名称", trigger: "blur" },
+          { required: true, message: "请输入楼层本地名称", trigger: "blur" }
         ],
         floorSequenceID: [
-          { required: true, message: "请输入楼层顺序号",  trigger: "blur" },
-        ],
-      },
+          { required: true, message: "请输入楼层顺序号", trigger: "blur" }
+        ]
+      }
     };
   },
 
@@ -177,48 +176,56 @@ export default {
         // orders: "sort asc,infoPointCode asc",
         pageNumber: 1,
         pageSize: 1000,
-        orders: "sort asc, name desc",
+        orders: "sort asc, name desc"
       };
       getDataDictionary(params, res => {
-        let arr = res.content.map(item => {
-          const category = ['ENUM', 'MENUM', 'BOOLEAN']
-          if (item.category == 'STATIC' && category.includes(item.dataType) && item.dataSource) {
-            item.options = item.dataSource
-            if (item.options[0]) {
-              item.props = {
-                value: "code",
-                label: "name",
-                children: "content",
-                checkStrictly: true,
-              };
+        let arr = res.content
+          .map(item => {
+            const category = ["ENUM", "MENUM", "BOOLEAN"];
+            if (
+              item.category == "STATIC" &&
+              category.includes(item.dataType) &&
+              item.dataSource
+            ) {
+              item.options = item.dataSource;
+              if (item.options[0]) {
+                item.props = {
+                  value: "code",
+                  label: "name",
+                  children: "content",
+                  checkStrictly: true
+                };
+              }
             }
-          }
-          switch (
-            item.code //过滤掉待删除的
+            switch (
+              item.code //过滤掉待删除的
             ) {
-            case "floorIdentity":
-            case "relatedSchedule":
-            case "outPeopleFlow":
-            case "inPeopleFlow":
-            case "exsitPeopleNum":
-              break;
-            default:
-              return item;
-          }
-        }).filter(_c=>{return !!_c;});
+              case "floorIdentity":
+              case "relatedSchedule":
+              case "outPeopleFlow":
+              case "inPeopleFlow":
+              case "exsitPeopleNum":
+                break;
+              default:
+                return item;
+            }
+          })
+          .filter(_c => {
+            return !!_c;
+          });
         this.InforsList = arr;
       });
     },
     submitForm(call) {
-      this.$refs.ruleForm.validate((valid) => {
+      this.$refs.ruleForm.validate(valid => {
         if (valid) {
           call();
         } else {
           return false;
         }
       });
-    },
-  },
+    }
+  }
 };
 </script>
 <style lang="scss" scoped>