zhangyu vor 5 Jahren
Ursprung
Commit
6a8b55c830

+ 9 - 2
src/components/ledger/lib/linkassets.vue

@@ -244,8 +244,9 @@ export default {
           deviceType: this.deviceType,
           buildFloor: this.buildFloor,
           spaceList: this.space.map(item => {
-            if(item[0] == 'noKnow')
-            return item[0]
+            if(item[0] == 'noKnow'){
+              
+            }
             if(item[1])
             return item[1]
           })
@@ -256,6 +257,11 @@ export default {
           buildFloor: this.buildFloor
         }
       }
+      debugger
+      this.$router.push({
+        name: "batchlinkAssets",
+        params: query
+      })
     }
   },
   watch: {
@@ -273,6 +279,7 @@ export default {
     margin-right: 12px;
     color: #999999;
     font-size: 14px;
+    vertical-align: top;
   }
   /deep/ .el-dialog__body {
     max-height: 420px;

+ 7 - 0
src/router/system.js

@@ -53,6 +53,7 @@ import propertyadd from '@/views/ledger/property/addproperty'
 import propertyLedger from '@/views/ledger/property'
 import spacelist from '@/views/ledger/spacelist'//业务空间台账
 import addPropertys from '@/views/ledger/property/addpropertys'//根据未关联资产的设备或部件批量创建设备
+import batchlinkAssets from '@/views/ledger/facility/batchlink' //批量关联资产
 import cenotelist from '@/views/ledger/cenotelist' //竖井清单
 import cenoteadd from '@/views/ledger/cenotelist/cenoteadd' //添加竖井
 import rentlist from '@/views/ledger/rentlist' //租户清单
@@ -257,6 +258,12 @@ export default [
                 meta: { keepAlive: false, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '设备台账', path: '/ledger/facility' }, { label: '添加设备' }] }
             },
             {
+                path: 'batchlinkAssets',
+                name: 'batchlinkAssets',
+                component: batchlinkAssets,
+                meta: { keepAlive: true, breadcrumbs: [{ label: '台账管理', path: '/ledger/facility' }, { label: '设备台账', path: '/ledger/facility' }, { label: '批量关联资产' }] }
+            },
+            {
                 path: 'property',
                 name: 'propertyLedger',
                 component: propertyLedger,

+ 242 - 0
src/views/ledger/facility/batchlink.vue

@@ -0,0 +1,242 @@
+<template>
+  <div class="box">
+    <div class="condition">
+      <div class="header">
+        <!-- <i style="float:left;font-size:30px;padding-right:10px;cursor:pointer;" title="返回" @click="goBack" class="el-icon-back"></i> -->
+        <el-button style="float:left;" size="small" type="default" icon="el-icon-back" @click="goBack"></el-button>
+        <die-cascader ref="dieCascader" :Family="params.Family" @change="changeDevice"></die-cascader>
+        <floor-cascader ref="floorCascader" @change="changeFloor"></floor-cascader>
+        <el-button style="float:right;margin-top:1px;" @click="handleClickCreate">创建已选</el-button>
+      </div>
+      <div class="main">
+        <el-table ref="multipleTable" :data="tableData" v-loading='loading' stripe height="100%" @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55"></el-table-column>
+          <el-table-column label="设备名称" width="200">
+            <template slot-scope="scope">{{ scope.row.EquipLocalName?scope.row.EquipLocalName:scope.row.EquipName }}</template>
+          </el-table-column>
+          <el-table-column label="设备本地编码" show-overflow-tooltip>
+            <template slot-scope="scope">{{ scope.row.EquipLocalID?scope.row.EquipLocalID:scope.row.EquipID }}</template>
+          </el-table-column>
+          <el-table-column prop="EquipCategory.EquipName" label="设备类型" show-overflow-tooltip width="200"></el-table-column>
+          <el-table-column prop="Building.BuildLocalName" label="所属建筑"></el-table-column>
+          <el-table-column prop="Floor.FloorLocalName" label="所属楼层"></el-table-column>
+          <el-table-column prop="address" label="操作" width="100">
+            <template slot-scope="scope">
+              <el-button @click.native.prevent="handleOpenDetail(scope.row, tableData)" type="text" size="small">详情</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+      <div class=footer>
+        <el-pagination
+          class="right"
+          v-show="tableData && tableData.length"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+          :current-page="page.pageNumber"
+          :page-sizes="page.pageSizes"
+          :page-size="page.pageSize"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="page.total">
+        </el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import { mapGetters } from "vuex"
+//组件
+import floorCascader from "@/components/ledger/lib/floorCascader"
+import dieCascader from "@/components/ledger/lib/partsDieList"
+//api
+import { queryPartsDie, createPropertys } from "@/api/scan/request";
+export default {
+  data() {
+    return {
+      params: {},
+      loading: false,
+      page: {
+        pageSize: 50,
+        pageSizes: [10, 20, 50, 100],
+        pageNumber: 1,
+        total: 0
+      },
+      tableData: [],
+      multipleSelection:[]
+    }
+  },
+  computed: {
+    ...mapGetters("layout", ["projectId", "userId", "secret"])
+  },
+  components: {
+    floorCascader,
+    dieCascader
+  },
+  created() {
+    this.params = this.$route.query
+  },
+  mounted() {
+    if (this.params.category) {
+      this.$refs.dieCascader.setValue(this.params.category)
+    }
+    if (this.params.buildId && this.params.floorId) {
+      this.$refs.floorCascader.setValue([this.params.buildId,this.params.floorId])
+    } else if (this.params.buildId && !this.params.floorId) {
+      this.$refs.floorCascader.setValue([this.params.buildId])
+    } else {
+      this.$refs.floorCascader.setValue(['all'])
+    }
+  },
+  watch: {
+    projectId() {}
+  },
+  methods: {
+    //返回
+    goBack() {
+      this.$router.push({
+        name: "propertyLedger",
+        params: { Family: this.params.Family }
+      })
+    },
+    //选择设备或部件
+    changeDevice(val) {
+      if(val.code) {
+        this.params.category = val.code
+      } else {
+        this.params.category = ''
+      }
+      this.page.pageNumber = 1
+      this.getTableData()
+    },
+    //选择建筑楼层
+    changeFloor(value) {
+      if (value[0]) {
+        this.params.buildId = value[0]
+      }
+      if (value[1]) {
+        this.params.floorId = value[1]
+      } else {
+        this.params.floorId = ''
+      }
+      this.page.pageNumber = 1
+      this.getTableData()
+    },
+    //获取表格数据
+    getTableData() {
+      this.loading = true
+      let param = this.formatFilter()
+      queryPartsDie(param, res => {
+        this.tableData = res.Content
+        this.page.total = res.Total
+        this.loading = false
+      })
+    },
+    //格式化条件
+    formatFilter() {
+      let param = {
+        Cascade: [
+          {
+            Name: "equipCategory",
+            Projection: ["EquipCode", "EquipName"]
+          },
+          {
+            Name: "building",
+            Projection: [ "BuildLocalName", "BuildName", "BuildID" ]
+          },
+          {
+            Name: "floor",
+            Projection: [ "FloorLocalName", "FloorName", "FloorID" ]
+          }
+        ],
+        Filters: `category='${this.params.category}';PropertyId isNull`,
+        Orders: "createTime desc, EquipID asc",
+        PageNumber: this.page.pageNumber,
+        PageSize: this.page.pageSize
+      }
+
+      if (this.params.buildId == "noKnow") {
+        param.Filters += `;buildingId isNull`
+      } else if (this.params.buildId && this.params.buildId != "all") {
+        param.Filters += `;buildingId='${this.params.buildId}'`
+      }
+
+      if (this.params.floorId == "noKnow") {
+        param.Filters += `;floorId isNull`
+      } else if (this.params.floorId && this.params.floorId != "all") {
+        param.Filters += `;floorId='${this.params.floorId}'`
+      }
+
+      return param
+    },
+    //选择的设备或部件
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    //切换每页显示多少条数据
+    handleSizeChange(val) {
+      this.page.pageSize = val
+      this.getTableData()
+    },
+    //切换页数
+    handleCurrentChange(val) {
+      this.page.pageNumber = val
+      this.getTableData()
+    },
+    //查看详情
+    handleOpenDetail(row) {
+      // window.open(`http://adm.sagacloud.cn:8058/spread?id=${row.EquipID}&pid=${this.projectId}&secret=${this.secret}`,"_blank")
+      this.$message("开发中...")
+    },
+    //创建已选
+    handleClickCreate() {
+      let list = this.multipleSelection.map((item) => {
+        return item.EquipID
+      })
+      let param = {
+        Filters: `EquipID in ${JSON.stringify(list)}`
+      }
+      createPropertys(param, res => {
+        this.$message.success("创建成功!")
+        this.$router.push({
+          name: "propertyLedger",
+          params: { Family: this.params.Family }
+        })
+      })
+    }
+  }
+};
+</script>
+
+<style scoped lang='less'>
+.box {
+  .condition {
+    padding: 10px;
+    display: flex;
+    height: 100%;
+    flex-direction: column;
+    border: 1px solid #dfe6ec;
+    background: #fff;
+    margin-bottom: 10px;
+    .header{
+      padding-bottom: 10px;
+      border-bottom: 1px solid #bcbcbc;
+    }
+    .main{
+      margin-top: 10px;
+      height: calc(100% - 96px);
+    }
+    .footer{
+      margin-bottom: 10px;
+    }
+  }
+}
+</style>
+
+<style lang="less">
+.el-table th {
+  background-color: #d9d9d9;
+  color: #000;
+}
+</style>
+