6
0

2 کامیت‌ها 4976cd4e71 ... 58c0704642

نویسنده SHA1 پیام تاریخ
  LXXXY 58c0704642 Merge branch 'msg-sever' of http://39.106.8.246:3003/web/ibms into msg-sever 5 سال پیش
  LXXXY 3ff83a8fe3 标签更新业务空间 5 سال پیش

+ 6 - 0
src/api/scan/request.js

@@ -189,6 +189,12 @@ export function zoneQueryByPoint(param, success) {
     http.postJson(url, param.data, success)
 }
 
+//更新业务空间图片
+export function updateZonePic(param, success) {
+    let url = `${baseUrl}/equip-component/space/update-space-picinfo`;
+    http.postJson(url, param, success)
+}
+
 //扫楼作业-位置标签-删除图片
 export function deleteLocationImg(param, success) {
     let url = `${baseUrl}/datacenter/location-point/delete-image`;

+ 147 - 0
src/components/data_admin/zoneInput.vue

@@ -0,0 +1,147 @@
+<template>
+  <div id="zoneinput">
+    <el-form label-position="left" :label-width="labelWidth" :model="form">
+      <div v-for="(titem, tkey) in inputTypeList" :key="tkey">
+        <h4>{{ tkey }}</h4>
+        <el-form-item v-for="(item, key) in titem" :key="key" :label="item.InfoPointName" class="input-item">
+          <el-input v-model="item.inputValue" v-if="item.InputMode == 'A1'|| item.InputMode == 'A2'" type="number">
+            <template slot="append" v-if="item.Unit">{{item.Unit}}</template>
+          </el-input>
+          <el-input v-model="item.inputValue" v-else-if="item.InputMode == 'B1' || item.InputMode == 'L' || item.InputMode == 'M'"></el-input>
+          <el-select v-model="item.inputValue" v-else-if="item.InputMode == 'D1' && item.SelectType == 'select'" placeholder="请选择">
+            <el-option v-for="(soption,skey) in item.options" :key="skey" :label="soption.Name" :value="soption.Code">
+            </el-option>
+          </el-select>
+          <el-cascader v-model="item.inputValue" v-else-if="item.InputMode == 'D1' && item.SelectType == 'cascader'" placeholder="请选择"
+            :props="item.props" :options="item.options" filterable :show-all-levels="false"></el-cascader>
+          <el-input v-model="item.inputValue" v-else></el-input>
+        </el-form-item>
+      </div>
+    </el-form>
+  </div>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      form: {},
+      inputTypeList: {},//输入框表头种类
+      inputData: [],//所有输入框
+    }
+  },
+  props: {
+    labelWidth: {
+      default: "130px",
+      type: String
+    },
+    inputList: {
+      type: Array,
+      default: []
+    }
+  },
+  created() {
+  },
+  methods: {
+    //初始化
+    init() {
+      this.inputTypeList = {};
+      this.inputData = [];
+      this.inputData = this.inputList.concat()
+      this.filterInput();
+      this.inputGroup();
+    },
+    //数据过滤
+    filterInput() {
+      this.inputData = this.inputData.filter(item => {
+        return item.Editable == true && item.Visible == true && item.FirstName && item.InfoPointCode;
+      })
+      let numbersInput = ['A1', 'A2'];
+      let stringInput = ['B1', 'L', 'M'];
+      let arrayInput = ['D1'];
+      this.inputData.map(item => {
+        if (numbersInput.indexOf(item.InputMode) != -1) {
+          item.inputValue = null;
+        }
+        else if (stringInput.indexOf(item.InputMode) != -1) {
+          item.inputValue = '';
+        }
+        else if (arrayInput.indexOf(item.InputMode) != -1) {
+          let options = JSON.parse(item.DataSource)
+          if (options[0] && options[0].Content) {
+            item.SelectType = 'cascader';
+            item.props = {
+              value: 'Code',
+              label: 'Name',
+              children: 'Content'
+            }
+            item.inputValue = [];
+          }
+          else {
+            item.SelectType = 'select';
+            item.inputValue = '';
+          }
+          item.options = options;
+
+        }
+        else {
+          item.inputValue = '';
+        }
+      });
+
+    },
+    //数据分组
+    inputGroup() {
+      this.inputData.map(item => {
+        if (!this.inputTypeList[item.FirstName]) {
+          this.inputTypeList[item.FirstName] = [];
+        }
+        this.inputTypeList[item.FirstName].push(item)
+      })
+      for (let key in this.inputTypeList) {
+        if (this.inputTypeList[key] instanceof Array) {
+          this.inputTypeList[key].sort((item1, item2) => { return item1.Sort < item2.Sort });
+        }
+      }
+    },
+    //父组件获取form
+    getFormData() {
+      let f = {}
+      for (let key in this.inputTypeList) {
+        this.inputTypeList[key].map(item => {
+          if (item.inputValue != '' && item.inputValue != null) {
+            if (item.inputValue instanceof Array) {
+              f[item.InfoPointCode] = item.inputValue.pop();
+            }
+            else {
+              f[item.InfoPointCode] = item.inputValue;
+            }
+          }
+        })
+      }
+      return f;
+    }
+  },
+  watch: {
+    "inputList.length": {
+      handler() {
+        this.init();
+      },
+      immediate: true
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+.input-item {
+  display: inline-block;
+  position: relative;
+  margin-right: 10px;
+}
+#zoneinput {
+  /deep/ .el-form-item__content {
+    width: 220px;
+  }
+}
+</style>

+ 19 - 33
src/views/data_admin/buildGraphy/createPointZone.vue

@@ -16,7 +16,7 @@
           </div>
           <div>
             <label><span style="color:red;">*</span>所属建筑楼层</label>
-            <el-cascader placeholder='请选择' :options="options" @change="changeFloor" :props="floorProps" filterable ref="buildfloor"
+            <el-cascader placeholder='请选择' v-model="buildFloor" :options="options" :props="floorProps" filterable ref="buildfloor"
               style="width:215px;margin-right:10px;"></el-cascader>
             <label><span style="color:red;">*</span>业务空间类型</label>
             <el-select v-model="space" placeholder="请选择空间" style="width:215px;margin-right:10px;" @change="changeSpace">
@@ -30,13 +30,7 @@
           <i style="cursor: pointer;" :class="showEx"
             @click="showEx = (showEx == 'el-icon-arrow-up' ? 'el-icon-arrow-down' : 'el-icon-arrow-up')"></i>
           <div v-show="showEx == 'el-icon-arrow-up'" v-loading="loadingOtherMsg">
-            <div v-if="otherList.length">
-              <div class="suppMsg" v-for="(item, key) in otherList" :key="key">
-                <label>{{item.InfoPointName}}:</label>
-                <el-input :placeholder="`请输入${item.InfoPointName}`" v-model="item.inputValue" clearable style="width:215px;margin-right:10px;">
-                </el-input>
-              </div>
-            </div>
+            <zoneInput v-if="otherList.length" :inputList="otherList" labelWidth="140px" ref="zoneInput"></zoneInput>
             <p v-else>请选择业务空间类型</p>
           </div>
         </div>
@@ -53,6 +47,7 @@
 import locationPointMsg from '@/views/data_admin/buildGraphy/locationPointMsg'
 import { queryDictionaryHead, getDataDictionary, createZone } from '@/api/scan/request';
 import { mapGetters } from 'vuex'
+import zoneInput from '@/components/data_admin/zoneInput'
 export default {
   data() {
     return {
@@ -72,7 +67,6 @@ export default {
       RoomLocalName: '',//业务空间名称
       otherList: [],//可补充信息list
       loadingOtherMsg: false,
-      test: '1'
     }
   },
   computed: {
@@ -82,7 +76,8 @@ export default {
 
   },
   components: {
-    locationPointMsg
+    locationPointMsg,
+    zoneInput
   },
   created() {
     this.options = this.$route.params.floorData
@@ -97,33 +92,28 @@ export default {
           content: []
         }
       }
-      let reqData = {
-        Pic: {}
-      };
-      //图片信息
-      this.$refs.pointMsg.choImg.map((item,key) => {
-        reqData.Pic[`additionalProp${key + 1}`] = item;
-      })
-      //其他补充信息
-      this.otherList.map(item => {
-        if (item.inputValue) {
-          reqData[item.InfoPointCode] = item.inputValue;
-        }
-      });
+      let zObj = this.$refs.zoneInput.getFormData();
+      zObj.Pic = this.$refs.pointMsg.choImg.concat();
+      zObj.Pic = zObj.Pic.map(item => ({
+        Id: item.ObjectId,
+        Key: item.Key,
+        Name: item.Name,
+        Type: item.Type
+      }))
       if (this.RoomLocalName && this.buildFloor.length && this.space) {
-        reqData.RoomLocalName = this.RoomLocalName;
-        reqData.RoomLocalID = this.RoomLocalID;
-        reqData.BuildingId = this.buildFloor[0];
-        reqData.FloorId = this.buildFloor[1];
+        zObj.RoomLocalName = this.RoomLocalName;
+        zObj.RoomLocalID = this.RoomLocalID;
+        zObj.BuildingId = this.buildFloor[0];
+        zObj.FloorId = this.buildFloor[1];
         param.zone = this.space;
-        param.data.content = [reqData];
+        param.data.content = [zObj];
         createZone(param, res => {
           this.$message.success("创建成功");
+          this.$refs.pointMsg.clearImg();
           this.RoomLocalName = ''
           this.RoomLocalID = ''
           this.buildFloor = []
           this.space = ''
-          
         })
       }
       else if (!this.RoomLocalName) {
@@ -146,10 +136,6 @@ export default {
         this.spaceList = res.Content.filter((item => { return item.Name != '元空间' }));
       });
     },
-    //选择楼层
-    changeFloor(val) {
-      this.buildFloor = val;
-    },
     //选择业务空间
     changeSpace(val) {
       this.space = val;

+ 5 - 1
src/views/data_admin/buildGraphy/locationPointMsg.vue

@@ -35,7 +35,6 @@ export default {
     pointObj: {},//标签对象
   },
   created() {
-    console.log(this.pointObj)
   },
   methods: {
     //是否全选
@@ -49,6 +48,11 @@ export default {
       this.checkAll = checkedCount === this.pointObj.ImageList.length;
       this.isIndeterminate = checkedCount > 0 && checkedCount < this.pointObj.ImageList.length;
     },
+    //清空选项
+    clearImg(){
+      this.choImg = [];
+      this.isIndeterminate = false;
+    }
   }
 }
 </script>

+ 46 - 27
src/views/data_admin/buildGraphy/updatePointZone.vue

@@ -9,15 +9,18 @@
         <div class="item">
           <p>将位置标签图片批量补充到业务空间:</p>
           <div v-for="item in zoneList" :key="item.objid" class="zone-item">
-            <el-tooltip class="item" effect="light" :content="item.RoomLocalName || item.RoomName" placement="top">
+            <el-tooltip class="item" effect="light"
+              :content="`${item.Building.BuildLocalName} / ${item.Floor.FloorLocalName} / ${item.DClassDef.Name} / ${item.RoomLocalName}`"
+              placement="top">
               <p>{{item.RoomLocalName || item.RoomName}}</p>
             </el-tooltip>
-            <el-button type="info" icon="el-icon-delete" circle style="float:right;" size="mini" @click="deleteZone(item.RoomID)"></el-button>
+            <i class="el-icon-delete" circle style="float:right;line-height:32px;padding: 0 9px 0 0;cursor: pointer;" size="mini"
+              @click="deleteZone(item.RoomID)"></i>
           </div>
-          <div class="zone-item" style="border:none;">
+          <div class="zone-item" style="border:none;border-left:-4px;width:auto;">
             <el-cascader :props="zoneCascader" :show-all-levels="false" v-model="zoneCa" @change="changeCascader" filterable style="float:left;">
             </el-cascader>
-            <el-button type="primary" icon="el-icon-plus" circle style="float:right;" size="mini" @click="addZone"></el-button>
+            <el-button type="primary" icon="el-icon-plus" circle style="float:right;margin:2px 10px;" size="mini" @click="addZone"></el-button>
           </div>
         </div>
         <div class="item">
@@ -31,7 +34,7 @@
 
 <script>
 import locationPointMsg from '@/views/data_admin/buildGraphy/locationPointMsg'
-import { queryDictionaryHead, zoneQueryByPoint, queryZone } from '@/api/scan/request';
+import { queryDictionaryHead, zoneQueryByPoint, queryZone, updateZonePic } from '@/api/scan/request';
 import { mapGetters } from 'vuex'
 export default {
   data() {
@@ -64,20 +67,30 @@ export default {
   methods: {
     //创建
     updateZ() {
-      console.log(this.zoneList);
-      if (this.$refs.pointMsg.choImg.length && this.zoneList.length) {
-        let imgs = {};
-        this.$refs.pointMsg.choImg.map((item, key) => {
-          imgs[`additionalProp${key + 1}`] = item;
-        })
-        this.zoneList.map(item => {
-          item.Pic = imgs;
+      let imgs = this.$refs.pointMsg.choImg.concat();
+      imgs = imgs.map(item => ({
+        Id: item.ObjectId,
+        Key: item.Key,
+        Name: item.Name,
+        Type: item.Type
+      }))
+      if (imgs.length && this.zoneList.length) {
+        let zones = this.zoneList.map(item => {
+          if (item.Pic) {
+            item.Pic = item.Pic.concat(imgs);
+          }
+          else {
+            item.Pic = imgs;
+          }
+          return { RoomID: item.RoomID, Pic: item.Pic, ObjectType: item.ObjectType };
         })
         let param = {
-          data: {
-            content: this.zoneList
-          }
+          Content: zones
         }
+        updateZonePic(param, res => {
+          this.$message.success("更新成功");
+          this.$refs.pointMsg.clearImg();
+        })
       }
       else if (!this.$refs.pointMsg.choImg.length) {
         this.$message("请至少选择一张图片");
@@ -92,7 +105,10 @@ export default {
       let pa = {
         X: this.pointItem.X,
         Y: this.pointItem.Y,
-        data: { Filters: `buildingId = '${this.pointItem.BuildId}' and floorId = '${this.pointItem.FloorId}'` }
+        data: {
+          Filters: `buildingId = '${this.pointItem.BuildId}' and floorId = '${this.pointItem.FloorId}'`,
+          "Cascade": [{ "Name": "floor" }, { "Name": "building" }, { "Name": "objectTypeO" }]
+        }
       }
       zoneQueryByPoint(pa, res => {
         this.zoneList = res.Content;
@@ -151,11 +167,16 @@ export default {
           }
         }
         queryZone(pa, res => {
-          let nodes = res.Content.map(item => ({
-            value: item,
-            label: item.RoomLocalName || item.RoomName,
-            leaf: level >= 3
-          }))
+          let nodes = res.Content.map(item => {
+            item.Building = { BuildLocalName: node.parent.parent.label };
+            item.Floor = { FloorLocalName: node.parent.label };
+            item.DClassDef = { Name: node.label };
+            return {
+              value: item,
+              label: item.RoomLocalName || item.RoomName,
+              leaf: level >= 3
+            }
+          })
           resolve(nodes)
         })
       }
@@ -168,7 +189,6 @@ export default {
     addZone() {
       if (this.newZoneObj.RoomID && this.zoneList.findIndex((item) => (item.RoomID == this.newZoneObj.RoomID)) == -1) {
         this.zoneList.push(this.newZoneObj)
-        console.log(this.zoneList)
       }
       else if (!this.newZoneObj.RoomID) {
         this.$message("请选择业务空间后添加")
@@ -237,17 +257,16 @@ export default {
   display: inline-block;
   position: relative;
   width: 245px;
-  padding: 5px 10px;
-  margin: 0 5px 5px 0;
+  margin: 5px 15px 10px 0;
+  border: 1px solid rgb(220, 223, 230);
+  border-radius: 5px;
 }
 .zone-item p {
   width: 200px;
   float: left;
   height: 32px;
   overflow: hidden;
-  border: 1px solid rgb(220, 223, 230);
   padding-left: 15px;
   padding: 0 0 0 15px;
-  border-radius: 5px;
 }
 </style>