Przeglądaj źródła

批量关联资产

zhangyu 5 lat temu
rodzic
commit
42779aff6f

+ 1 - 1
src/components/ledger/handsontables/device.vue

@@ -59,7 +59,7 @@
     <change-rea @changeProperty="changeProperty" :dialog="myDialog" :category="deviceType"></change-rea>
     <look-pic :dialog="myDialog" :keysArr="picsArr"></look-pic>
     <!-- 新增设备 -->
-    <el-dialog title="确定新增设备的类型" :visible.sync="myDialog.addDevice" width="30%">
+    <el-dialog title="确定新增设备的类型" :visible.sync="myDialog.addDevice" width="670px">
       <el-row>
         <my-cascader ref="cascader" @change="changeAddType" :all="true"></my-cascader>
       </el-row>

+ 153 - 0
src/components/ledger/lib/buildFloor.vue

@@ -0,0 +1,153 @@
+<template>
+  <div id="buildFloor">
+    <span class="buildFloor" style="margin-right: 12px;">建筑楼层:</span>
+    <el-cascader placeholder="请选择建筑楼层" :options="options" v-model="value" filterable size="small" :style="isWidth ? '' : 'width:160px;'" @change="changeCascader"></el-cascader>
+  </div>
+</template>
+<script>
+import tools from "@/utils/scan/tools"
+import { floorQuery, buildingQuery } from '@/api/scan/request'
+import { mapGetters, mapActions } from "vuex"
+
+export default {
+  props: {
+    isWidth: {
+      type: Boolean,
+      default: true
+    },
+    type: {
+      type: String,
+      default: "yes"
+    }
+  },
+  computed: {
+    ...mapGetters("layout", [ "projectId", "secret", "userId" ])
+  },
+  data() {
+    return {
+      options: [],
+      param: {
+        ProjId: '',
+        secret: ''
+      },
+      value: ['all']
+    };
+  },
+  created() {
+    this.param.ProjId = this.projectId
+    this.param.secret = this.secret
+    this.getData()
+  },
+  watch: {
+    projectId() {
+      this.value = ['all'];
+      this.options = [];
+      this.param.ProjId = this.projectId
+      this.param.secret = this.secret
+      this.getData()
+      this.changeCascader(['all'])
+    }
+  },
+  methods: {
+    //设置默认选项
+    setValue(val) {
+      if (val && val.length) {
+        this.value = val
+      }
+    },
+    //获取数据
+    getData() {
+      let data, buildParams = {
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "BuildID",
+          "BuildLocalName"
+        ]
+      }, floorParams = {
+        Orders: "FloorSequenceID desc",
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "BuildID",
+          "FloorID",
+          "FloorLocalName",
+          "FloorSequenceID"
+        ]
+      }
+      let promise1 = new Promise((resolve, reject) => {
+        buildingQuery(buildParams, res => {
+          resolve(res)
+        })
+      })
+      let promise2 = new Promise((resolve, reject) => {
+        floorQuery(floorParams, res => {
+          resolve(res)
+        })
+      })
+      Promise.all([promise1, promise2]).then(values => {
+        let builData = values[0].Content, floorData = values[1].Content
+        data = builData.map(build => {
+          return {
+            value: build.BuildID,
+            label: build.BuildLocalName
+          }
+        })
+        data.unshift({
+          value: "all",
+          label: "全部"
+        }, {
+            value: "noKnow",
+            label: "不在建筑内"
+          })
+        data.forEach(build => {
+          floorData.forEach(floor => {
+            if (build.value == floor.BuildID && floor.FloorID && floor.FloorLocalName && this.type == "yes") {
+              if (build.children) {
+                build.children.push({
+                  value: floor.FloorID,
+                  label: floor.FloorLocalName,
+                  FloorSequenceID: floor.FloorSequenceID
+                })
+              } else {
+                build.children = []
+                build.children.push({
+                  value: "all",
+                  label: "全部"
+                }, {
+                    value: 'noKnow',
+                    label: "不在楼层内"
+                  }, {
+                    value: floor.FloorID,
+                    label: floor.FloorLocalName,
+                    FloorSequenceID: floor.FloorSequenceID
+                  })
+              }
+            }
+          })
+        })
+        this.options = data
+      })
+    },
+    //改变item
+    changeCascader(value) {
+      this.$emit("change", value)
+    }
+  }
+};
+</script>
+<style lang="less">
+.el-cascader .el-input .el-input__inner {
+  vertical-align: bottom;
+}
+</style>
+<style lang="less" scoped>
+#buildFloor {
+  margin-left: 10px;
+  float: left;
+  .buildFloor {
+    color: #999999;
+    font-size: 14px;
+  }
+}
+</style>

+ 142 - 0
src/components/ledger/lib/deviceParts.vue

@@ -0,0 +1,142 @@
+<template>
+  <div id="cascaderMap">
+    <span class="buildFloor" style="margin-right: 12px;">设备类型:</span>
+    <el-select v-model="value" placeholder="请选择" :props="props" filterable :style="isWidth ? '' : 'width:160px;'" size="small" @change="changeVal">
+      <el-option  v-for="item in options" :key="item.code" :label="item.facility" :value="item.code"></el-option>
+    </el-select>
+  </div>
+</template>
+<script>
+import { mapGetters } from 'vuex';
+import { getEquipBelongs, queryEquip } from "@/api/scan/request";
+export default {
+  name: "getCode",
+  props: {
+    isWidth: {
+      type: Boolean,
+      default: true
+    },
+    all: {
+      type: Boolean,
+      default: false,
+    }
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId"])
+  },
+  data() {
+    return {
+      value: "",
+      options: [],
+      props: {
+        value: "code",
+        label: "facility"
+      },
+      falg: true,
+      content: []
+    };
+  },
+  created() {
+    this.getData();
+  },
+  watch: {
+    projectId() {
+      this.value = '';
+      this.getData();
+    }
+  },
+  methods: {
+    setValue(val) {
+      this.value = val
+    },
+    //修改val
+    changeVal(val) {
+      let value = {}
+      this.options.map(item => {
+        if (item.code == val) {
+          value = item
+        }
+      })
+      this.value = val
+      this.$emit("change", value)
+    },
+    //获取当前项目下的设备类型(只拿到编码-需要过滤)
+    getData() {
+      let param2 = {
+        Distinct: true,
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "Category"
+        ]
+      }
+      let param1 = {
+        data: {
+          Distinct: true,
+          Orders: "EquipName asc",
+          PageNumber: 1,
+          PageSize: 500,
+          Projection: [
+            "EquipCode", "EquipName"
+          ]
+        }
+      }
+      let promise2 = new Promise((resolve, reject) => {
+        queryEquip(param2, res => {
+          resolve(res)
+        })
+      })
+      let promise1 = new Promise((resolve, reject) => {
+        getEquipBelongs(param1, res => {
+          resolve(res)
+        })
+      })
+      Promise.all([promise1,promise2]).then((res) => {
+        let allData = res[0], data = res[1]
+        this.options = this.formatOptions(allData.Content)
+        if (this.value) {
+          this.changeVal(this.value)
+        }
+        if(!this.all) {
+          this.content = data.Content.map(t => {
+            return t.Category
+          });
+          this.filterForOptions();
+          if (this.value) {
+            this.changeVal(this.value)
+          }
+        }
+      })
+    },
+    //格式化options数据
+    formatOptions(arr) {
+      let data = [];
+      arr.map(t => {
+        let temp = {};
+        temp.code = t.EquipCode;
+        temp.facility = t.EquipName;
+        data.push(temp)
+      })
+      return data;
+    },
+    //过滤
+    filterForOptions() {
+      this.options = this.options.filter(item => {
+        if (this.content.indexOf(item.code) > -1) {
+          return item
+        }
+      })
+    }
+  }
+};
+</script>
+<style lang="less" scoped>
+#cascaderMap {
+  float: left;
+  margin-left: 10px;
+  .buildFloor {
+    color: #999999;
+    font-size: 14px;
+  }
+}
+</style>

+ 63 - 0
src/components/ledger/lib/linkassets.vue

@@ -0,0 +1,63 @@
+<template>
+  <el-dialog title="批量关联资产" :visible.sync="dialog.linkAssets" width="900px">
+    <el-row>
+      <build-floor></build-floor>
+      <zone-space :isWidth="false"></zone-space>
+    </el-row>
+    <el-row style="margin-top:30px;">
+      <device-parts></device-parts>
+    </el-row>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="handleClickClose">取 消</el-button>
+      <el-button type="primary" @click="toAddDevice">确 认</el-button>
+    </span>
+  </el-dialog>
+</template>
+<script>
+
+import { mapGetters } from "vuex"
+import buildFloor from "@/components/ledger/lib/buildFloor"
+import zoneSpace from "@/components/ledger/lib/zoneSpace"
+import deviceParts from "@/components/ledger/lib/deviceParts"
+export default {
+  components: {
+    buildFloor,
+    zoneSpace,
+    deviceParts
+  },
+  props: {
+    dialog: {
+      type: Object,
+      default: function () {
+        return {
+          linkAssets: false
+        };
+      }
+    }
+  },
+  data() {
+    return {
+      
+    };
+  },
+  created() {
+    
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId", "secret", "userId"])
+  },
+  mounted() { },
+  methods: {
+    handleClickClose() {
+      this.dialog.linkAssets = false
+    }
+  },
+  watch: {
+    
+  }
+};
+</script>
+
+<style lang="less">
+
+</style>

+ 164 - 0
src/components/ledger/lib/zoneSpace.vue

@@ -0,0 +1,164 @@
+<template>
+  <div id="buildFloor">
+    <span class="buildFloor" style="margin-right: 12px;">分区类型空间实例:</span>
+    <el-cascader 
+    v-model="value"
+    filterable
+    clearable
+    collapse-tags
+    size="small"
+    :options="options"
+    :props="props" 
+    :style="isWidth ? '' : 'width:400px;'" 
+    @change="changeCascader">
+    </el-cascader>
+  </div>
+</template>
+<script>
+import tools from "@/utils/scan/tools"
+import { floorQuery, buildingQuery } from '@/api/scan/request'
+import { mapGetters, mapActions } from "vuex"
+
+export default {
+  props: {
+    isWidth: {
+      type: Boolean,
+      default: true
+    },
+    type: {
+      type: String,
+      default: "yes"
+    }
+  },
+  computed: {
+    ...mapGetters("layout", [ "projectId", "secret", "userId" ])
+  },
+  data() {
+    return {
+      props: { multiple: true },
+      options: [],
+      param: {
+        ProjId: '',
+        secret: ''
+      },
+      value: ['all']
+    };
+  },
+  created() {
+    this.param.ProjId = this.projectId
+    this.param.secret = this.secret
+    this.getData()
+  },
+  watch: {
+    projectId() {
+      this.value = ['all'];
+      this.options = [];
+      this.param.ProjId = this.projectId
+      this.param.secret = this.secret
+      this.getData()
+      this.changeCascader(['all'])
+    }
+  },
+  methods: {
+    //设置默认选项
+    setValue(val) {
+      if (val && val.length) {
+        this.value = val
+      }
+    },
+    //获取数据
+    getData() {
+      let data, buildParams = {
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "BuildID",
+          "BuildLocalName"
+        ]
+      }, floorParams = {
+        Orders: "FloorSequenceID desc",
+        PageNumber: 1,
+        PageSize: 500,
+        Projection: [
+          "BuildID",
+          "FloorID",
+          "FloorLocalName",
+          "FloorSequenceID"
+        ]
+      }
+      let promise1 = new Promise((resolve, reject) => {
+        buildingQuery(buildParams, res => {
+          resolve(res)
+        })
+      })
+      let promise2 = new Promise((resolve, reject) => {
+        floorQuery(floorParams, res => {
+          resolve(res)
+        })
+      })
+      Promise.all([promise1, promise2]).then(values => {
+        let builData = values[0].Content, floorData = values[1].Content
+        data = builData.map(build => {
+          return {
+            value: build.BuildID,
+            label: build.BuildLocalName
+          }
+        })
+        data.unshift({
+          value: "all",
+          label: "全部"
+        }, {
+            value: "noKnow",
+            label: "不在建筑内"
+          })
+        data.forEach(build => {
+          floorData.forEach(floor => {
+            if (build.value == floor.BuildID && floor.FloorID && floor.FloorLocalName && this.type == "yes") {
+              if (build.children) {
+                build.children.push({
+                  value: floor.FloorID,
+                  label: floor.FloorLocalName,
+                  FloorSequenceID: floor.FloorSequenceID
+                })
+              } else {
+                build.children = []
+                build.children.push({
+                  value: "all",
+                  label: "全部"
+                }, {
+                    value: 'noKnow',
+                    label: "未明确楼层的设备"
+                  }, {
+                    value: floor.FloorID,
+                    label: floor.FloorLocalName,
+                    FloorSequenceID: floor.FloorSequenceID
+                  })
+              }
+            }
+          })
+        })
+        this.options = data
+      })
+    },
+    //改变item
+    changeCascader(value) {
+      this.$emit("change", value)
+    }
+  }
+};
+</script>
+<style lang="less">
+.el-cascader .el-input .el-input__inner {
+  vertical-align: bottom;
+}
+</style>
+<style lang="less" scoped>
+#buildFloor {
+  margin-left: 10px;
+  float: left;
+  .buildFloor {
+    color: #999999;
+    font-size: 14px;
+  }
+}
+</style>

+ 1 - 5
src/views/ledger/cenotelist/cenoteadd/index.vue

@@ -55,11 +55,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters("layout", [
-        "projectId",
-        "secret",
-        "userId"
-    ])
+    ...mapGetters("layout", [ "projectId", "secret", "userId" ])
   },
   created() {
     this.getTableHeader()

+ 10 - 9
src/views/ledger/facility/index.vue

@@ -12,6 +12,7 @@
       <hanson-table @close="close" :graphyId="graphyId" ref="tableMain"></hanson-table>
     </div>
     <!-- <table-transfers></table-transfers> -->
+    <linkassets-dialog :dialog="dialog"></linkassets-dialog>
   </div>
 </template>
 <script>
@@ -20,6 +21,7 @@ import floorCascader from "@/components/ledger/lib/floorCascader";
 import myCascader from "@/components/ledger/lib/cascader";
 import hansonTable from "@/components/ledger/handsontables/device";
 import tableTransfers from "@/components/ledger/tableTransfers";
+import linkassetsDialog from "@/components/ledger/lib/linkassets";
 import {
   getSpaceName,
   getGraphyId,
@@ -36,7 +38,8 @@ export default {
     floorCascader,
     myCascader,
     hansonTable,
-    tableTransfers
+    tableTransfers,
+    linkassetsDialog
   },
   data() {
     return {
@@ -61,16 +64,14 @@ export default {
         secret: ""
       },
       assetGroupList: [],
-      graphyId: null
+      graphyId: null,
+      dialog: {
+        linkAssets: false
+      }
     };
   },
   computed: {
-    ...mapGetters("layout", [
-      "projectId",
-      "projects",
-      "secret",
-      "userId"
-    ])
+    ...mapGetters("layout", [ "projectId", "projects", "secret", "userId" ])
   },
   created() {
     this.param.ProjId = this.projectId
@@ -173,7 +174,7 @@ export default {
     },
     // 批量关联资产
     handleLinkAssets() {
-      this.$message('添加弹窗')
+      this.dialog.linkAssets = true
     }
   }
 };

+ 1 - 5
src/views/ledger/rentlist/rentadd/index.vue

@@ -54,11 +54,7 @@ export default {
     };
   },
   computed: {
-    ...mapGetters("layout", [
-        "projectId",
-        "secret",
-        "userId"
-    ])
+    ...mapGetters("layout", [ "projectId", "secret", "userId" ])
   },
   created() {
     this.getTableHeader()