123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <template>
- <div id="equipRules">
- <!-- 查询条件 -->
- <div class="query-area">
- <el-row>
- <el-col :span="22">
- <el-form ref="form" :model="form" :inline="true">
- <el-row>
- <div class="query-item special" style="margin-bottom:20px;">
- <el-input :placeholder="`请输入${typeName}标识关键字`" v-model="form.EquipmentMark" @keyup.enter.native="queryTableData">
- <i slot="suffix" class="el-input__icon el-icon-search" @click="queryTableData"></i>
- </el-input>
- </div>
- <div class="query-item">
- <label style="padding-right:9px">数据源</label>
- <dataSource :Related="null" @change="changeDataSource" :typeName="typeName"></dataSource>
- </div>
- <!-- <div class="query-item">
- <dictionary-device @change="changeDictionary" :Related="null" :typeName="typeName"></dictionary-device>
- </div> -->
- <div class="query-item">
- <label style="padding-right:9px">位置标签</label>
- <locationFlag :Related="null" @change="changeLocationFlag" :typeName="typeName"></locationFlag>
- </div>
- </el-row>
- </el-form>
- </el-col>
- <el-col :span="2">
- <el-tooltip class="item" effect="dark" :content="`填充${typeName}标识与实例对应规则`" placement="left">
- <el-button size="small" type="primary" @click="toAddRelation" icon="el-icon-edit-outline" style="float:right;margin-left:10px;"
- :disabled="isPending">
- </el-button>
- </el-tooltip>
- <el-tooltip class="item" effect="dark" :content="`根据${typeName}标识自动填充实例`" placement="left">
- <el-button size="small" type="primary" @click="autoGroupRela" :icon="autoLoading?'iconfont icon-jiazai':'iconfont icon-zidong'"
- style="float:right;padding:7px 14px;width:44px;margin-left:0;" :disabled="autoLoading"></el-button>
- </el-tooltip>
- </el-col>
- </el-row>
- </div>
- <el-row>
- <el-col :span="12" style="padding-left:10px;font-size:13px;border-left:2px solid #000;">点位表中出现的所有{{typeName}}</el-col>
- <el-col :span="12" style="padding-left:10px;font-size:13px;border-left:2px solid #000;">对应物理世界中的{{typeName}}实例</el-col>
- </el-row>
- <!-- 列表区域 -->
- <div class="table-area">
- <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
- <el-table-column prop="EquipmentMark" :label="`${typeName}标识`" show-overflow-tooltip min-width="200"></el-table-column>
- <el-table-column prop="LocationFlag" label="位置标签" min-width="200">
- <template slot-scope="scope">
- <el-tooltip :content="scope.row.LocationFlag.toString()" placement="top">
- <div class="tool-tip">{{scope.row.LocationFlag.toString()}}</div>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column prop="Datasource" label="数据源" show-overflow-tooltip min-width="100"></el-table-column>
- <!-- <el-table-column prop="SubTypeName" :label="`${typeName}类型`" show-overflow-tooltip min-width="100"></el-table-column> -->
- <el-table-column prop="ObjectLocalName" :label="`${typeName}实例`" show-overflow-tooltip min-width="100" class-name="td-bl"></el-table-column>
- <el-table-column :label="`${typeName}顺序号`" show-overflow-tooltip min-width="100">
- <template slot-scope="scope">
- <el-tooltip :content="(scope.row.ObjectSequenceID&&scope.row.ObjectSequenceID!='null')?scope.row.ObjectSequenceID:''" placement="top">
- <div class="tool-tip">
- {{(scope.row.ObjectSequenceID&&scope.row.ObjectSequenceID!='null')?scope.row.ObjectSequenceID:''}}</div>
- </el-tooltip>
- </template>
- </el-table-column>
- <el-table-column label="所属建筑" min-width="200">
- <template slot-scope="scope">
- <el-tooltip
- :content="scope.row.BuildLocalName?scope.row.FloorLocalName?scope.row.BuildLocalName+'-'+scope.row.FloorLocalName:scope.row.BuildLocalName:''"
- placement="top">
- <div class="tool-tip">
- {{scope.row.BuildLocalName?scope.row.FloorLocalName?scope.row.BuildLocalName+'-'+scope.row.FloorLocalName:scope.row.BuildLocalName:''}}
- </div>
- </el-tooltip>
- </template>
- </el-table-column>
- <!-- <el-table-column prop="RoomLocalName" label="所在业务空间" show-overflow-tooltip min-width="100"></el-table-column>
- <el-table-column prop="CascadeEquipLocalName" label="所属设备实例" show-overflow-tooltip min-width="100"></el-table-column> -->
- <el-table-column prop="action" label="操作" min-width="100">
- <template slot-scope="scope">
- <el-tooltip class="item" effect="dark" content="清除对应规则" placement="left">
- <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain
- :disabled="isPending||scope.row.Related=='False'" icon="el-icon-delete"></el-button>
- </el-tooltip>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <!-- 分页 -->
- <el-pagination class="fr" 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>
- <!-- 清除对应关系弹窗 -->
- <del-relation-dialog ref="del" @refresh="refresh" :typeName="'floor'"></del-relation-dialog>
- </div>
- </template>
- <script>
- import tools from "@/utils/tools";
- import { mapGetters, mapActions } from "vuex";
- import applyRulesDialog from "@/components/point/dynamicdata/applyRulesDialog";
- import delRelationDialog from "@/components/point/dynamicdata/delRelationDialog";
- import dictionaryDevice from "@/components/point/dynamicdata/dictionaryDevice";
- import dataSource from "@/components/point/dynamicdata/dataSource";
- import locationFlag from "@/components/point/dynamicdata/locationFlag";
- import equipRules from "@/components/point/dynamicdata/equipRules";
- import {
- dynamicClashConfirm,
- dynamicExecute,
- dynamicQuery,
- dynamicQueryPoint,
- dynamicPointTypeList,
- floorQuery, //数据中心查询楼层
- } from "@/api/scan/request";
- export default {
- computed: {
- ...mapGetters("layout", ["projectId"])
- },
- data() {
- return {
- headerStyle: {
- backgroundColor: '#e1e4e5',
- color: '#2b2b2b',
- lineHeight: '30px'
- },
- sourceList: [], //数据源
- DynEquipList: [], //数据字典部件类型
- LocFlagList: [], //位置标签
- tableData: [], //列表数据
- page: {
- pageSize: 50,
- pageSizes: [10, 20, 50, 100],
- pageNumber: 1,
- total: 0
- },
- form: {
- EquipmentMark: "", //部件标识关键字
- SubTypeName: [], //数据字典部件类型
- LocationFlag: [], //位置标签
- Datasource: [] //数据源
- }, //查询条件
- loading: false, //列表loading
- autoLoading: false, //自动对应实例
- };
- },
- components: {
- applyRulesDialog,
- delRelationDialog,
- dictionaryDevice,
- dataSource,
- locationFlag
- },
- props: {
- typeName: {},
- isPending: {
- default: false
- }
- },
- created() {
- this.init();
- },
- mounted() { },
- methods: {
- //获取查询条件-提示信息
- init() {
- this.getTableData()
- },
- //清除对应关系
- handleDelete(index, row) {
- this.$refs.del.showDialog(row);
- },
- //改变pagesize
- handleSizeChange(pageSize) {
- this.page.pageSize = pageSize;
- this.getTableData();
- },
- //改变pageno
- handleCurrentChange(pageNo) {
- this.page.pageNumber = pageNo;
- this.getTableData();
- },
- //跳转至填充对应规则
- toAddRelation() {
- this.$router.push({ path: "floorRela", query: { typeName: this.typeName } });
- },
- //获取表格数据
- getTableData() {
- let param = {
- PageNumber: this.page.pageNumber,
- PageSize: this.page.pageSize,
- TypeNameList: [this.typeName]
- };
- //处理查询条件
- if (this.form.EquipmentMark && this.form.EquipmentMark.length) {
- param.EquipmentMark = this.form.EquipmentMark;
- }
- if (this.form.SubTypeName.length) {
- param.SubTypeNameList = this.form.SubTypeName;
- }
- if (this.form.LocationFlag.length) {
- param.LocationFlagList = this.form.LocationFlag;
- }
- if (this.form.Datasource.length) {
- param.DatasourceList = this.form.Datasource;
- }
- this.loading = true;
- // 查询对应关系(P1)
- dynamicQuery(param, res => {
- let dyData = res.Content;
- let tempArr = dyData.map(t => {
- if (t.Related == 'True') {
- t.FloorID = t.TypeCode + t.ProjectId + t.ObjectID;
- return t.FloorID;
- }
- return undefined;
- }).filter(item => item);
- if (tempArr.length) {
- floorQuery({
- PageSize: this.page.pageSize,
- Cascade: [{ Name: 'building' }],
- Filters: `FloorID in ${JSON.stringify(tempArr)}`
- }, response => {
- let Data = response.Content;
- dyData.forEach(item => {
- Data.forEach(t => {
- if (t.FloorID == item.FloorID) {
- item.ObjectLocalName = t.FloorLocalName;
- item.ObjectSequenceID = t.FloorSequenceID;
- item.BuildLocalName = t.Building ? t.Building.BuildLocalName : '';
- }
- })
- })
- this.loading = false;
- this.tableData = dyData;
- })
- } else {
- this.loading = false;
- this.tableData = dyData;
- }
- this.page.total = res.PageSize < 50 ? res.PageSize : res.Total;
- });
- },
- //刷新列表
- refresh() {
- this.page.pageNumber = 1;
- this.$emit('refresh', this.typeName);
- this.getTableData();
- },
- //数据字典部件类型修改
- changeDictionary(val) {
- this.page.pageNumber = 1;
- this.form.SubTypeName = val;
- this.getTableData();
- },
- //数据源修改
- changeDataSource(val) {
- this.page.pageNumber = 1;
- this.form.Datasource = val;
- this.getTableData();
- },
- //修改位置标签
- changeLocationFlag(val) {
- this.page.pageNumber = 1;
- this.form.LocationFlag = val;
- this.getTableData();
- },
- //查询列表
- queryTableData() {
- this.page.pageNumber = 1;
- this.getTableData();
- },
- //自动对应实例
- autoGroupRela() {
- this.$emit('autoGroupRela', 'floor');
- }
- },
- watch: {
- projectId() {
- this.init();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- #equipRules {
- height: calc(100% - 54px);
- /deep/ .text-right {
- text-align: right;
- }
- .query-item {
- float: left;
- & + .query-item {
- margin-left: 10px;
- }
- }
- /deep/ .special .el-input__inner {
- width: 220px;
- }
- /deep/ .table-area {
- width: 100%;
- height: calc(100% - 71px);
- margin-bottom: 10px;
- td div {
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- .td-bl {
- border-left: 1px solid #ebeef5;
- }
- .tool-tip {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- }
- }
- </style>
|