Browse Source

Merge branch 'master' of git.sagacloud.cn:web/ibms

zhangyu 5 years ago
parent
commit
5ed117ad40
2 changed files with 345 additions and 12 deletions
  1. 13 12
      src/framework/style/layout.scss
  2. 332 0
      src/views/point/dynamicdata/index.vue

+ 13 - 12
src/framework/style/layout.scss

@@ -157,6 +157,7 @@ body {
     display: flex;
     flex-direction: column;
     justify-content: flex-start;
+    overflow: hidden;
     .page-bar {
         flex-grow: 0;
         flex-shrink: 0;
@@ -199,20 +200,20 @@ body {
         // margin-top: 10px;
     }
     >.data-table-pagination {
-    //     z-index: 99999;
+        //     z-index: 99999;
         margin-top: 10px;
-    //     flex-grow: 0;
-    //     flex-shrink: 0;
-    //     display: flex;
-    //     justify-content: flex-end;
+        //     flex-grow: 0;
+        //     flex-shrink: 0;
+        //     display: flex;
+        //     justify-content: flex-end;
         text-align: right;
-    //     position: fixed;
-    //     bottom: 0;
-    //     background: #f2f2f2;
-    //     left: 242px;
-    //     right: 0;
-    //     padding-top: 10px;
-    //     padding-bottom: 10px;
+        //     position: fixed;
+        //     bottom: 0;
+        //     background: #f2f2f2;
+        //     left: 242px;
+        //     right: 0;
+        //     padding-top: 10px;
+        //     padding-bottom: 10px;
     }
 }
 

+ 332 - 0
src/views/point/dynamicdata/index.vue

@@ -0,0 +1,332 @@
+<template>
+  <div id="dynamicdata">
+    <!-- 按钮及提示 -->
+    <div class="text-right">
+      <span v-if="tipsType==1">最后一次执行时间:{{lastUpdateTime}}</span>
+      <span v-if="tipsType==2" style="color:red;">
+        原始点位变化,部分标识受到影响,请重新执行对应规则
+        <i class="el-icon-right"></i>
+      </span>
+      <span v-if="tipsType==3" style="color:red;">
+        对应规则有更新,记得执行哦
+        <i class="el-icon-right"></i>
+      </span>
+      <el-button size="medium" @click="apply">按对应规则自动设定动态参数信息点</el-button>
+      <el-button size="medium" type="primary" @click="toAddRelation">填充对应规则</el-button>
+    </div>
+    <!-- tab分页 -->
+    <el-tabs v-model="curType">
+      <el-tab-pane v-for="(item) in typeList" :key="item.Name" :label="item.Name+'('+item.Rcount+'/'+item.Sum+')'" :name="item.Name"></el-tab-pane>
+    </el-tabs>
+    <!-- 查询条件 -->
+    <div class="query-area">
+      <el-form ref="form" :model="form" :inline="true">
+        <el-row>
+          <div class="query-item">
+            <el-form-item>
+              <el-input placeholder="请输入设备标识关键字" v-model="form.EquipmentMark" class="input-with-select">
+                <el-button slot="append" icon="el-icon-search" @click="queryTableData"></el-button>
+              </el-input>
+            </el-form-item>
+          </div>
+          <div class="query-item">
+            <label>数据源</label>
+            <dataSource :Related="true" @change="changeDataSource"></dataSource>
+          </div>
+          <div class="query-item">
+            <dictionary-device @change="changeDictionary" :Related="true"></dictionary-device>
+          </div>
+          <div class="query-item">
+            <label>位置标签</label>
+            <locationFlag :Related="true" @change="changeLocationFlag"></locationFlag>
+          </div>
+        </el-row>
+      </el-form>
+    </div>
+    <!-- 列表区域 -->
+    <div class="table-area">
+      <el-table :data="tableData" style="width: 100%" height="100%" v-show="1" v-loading="loading">
+        <el-table-column label="点位表中出现的所有设备">
+          <el-table-column prop="EquipmentMark" label="设备标识" show-overflow-tooltip></el-table-column>
+          <el-table-column prop="LocationFlag" label="位置标签" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <el-tooltip :content="scope.row.LocationFlag.toString()" placement="top">
+                <span>{{scope.row.LocationFlag.toString()}}</span>
+              </el-tooltip>
+            </template>
+          </el-table-column>
+          <el-table-column prop="Datasource" label="数据源" show-overflow-tooltip></el-table-column>
+          <el-table-column prop="SubTypeName" label="数字字典设备类型" show-overflow-tooltip></el-table-column>
+        </el-table-column>
+        <el-table-column label="对应物理世界中的设备实例">
+          <el-table-column prop="EquipLocalName" label="对应的设备实例" show-overflow-tooltip></el-table-column>
+          <el-table-column prop="FloorLocalName" label="实例所在建筑楼层" show-overflow-tooltip></el-table-column>
+          <el-table-column prop="RoomLocalName" label="实例所在业务空间" show-overflow-tooltip></el-table-column>
+        </el-table-column>
+        <el-table-column prop="action" label="操作">
+          <template slot-scope="scope">
+            <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain :disabled="scope.row.Related=='False'">清除对应</el-button>
+          </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>
+    <!-- 应用规则弹窗 -->
+    <apply-rules-dialog ref="apply"></apply-rules-dialog>
+    <!-- 清除对应关系弹窗 -->
+    <del-relation-dialog ref="del" @refresh="refresh"></del-relation-dialog>
+    <!-- 规则更新提示 -->
+    <el-dialog title="提示" :visible.sync="ruleDialogShow" width="25%" @close="rulesClose">
+      <span>{{ruleDialogStr}}</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" @click="rulesClose">稍后处理</el-button>
+        <el-button size="small" type="primary" @click="nowDo">现在执行</el-button>
+      </span>
+    </el-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 {
+  dynamicClashConfirm,
+  dynamicExecute,
+  dynamicPromptmessage,
+  dynamicPromptobjs,
+  dynamicQuery,
+  dynamicQueryPoint,
+  dynamicPointTypeList
+} from "@/api/scan/request";
+export default {
+  computed: {
+    ...mapGetters("layout", ["projectId"])
+  },
+  data() {
+    return {
+      curType: "", //当前所在tab页
+      typeList: [], //tab页list
+      sourceList: [], //数据源
+      DynEquipList: [], //数据字典设备类型
+      LocFlagList: [], //位置标签
+      tableData: [], //列表数据
+      page: {
+        pageSize: 50,
+        pageSizes: [10, 20, 50, 100],
+        pageNumber: 1,
+        total: 0
+      },
+      form: {
+        EquipmentMark: "", //设备标识关键字
+        SubTypeName: [], //数据字典设备类型
+        LocationFlag: [], //位置标签
+        Datasource: [] //数据源
+      }, //查询条件
+      lastUpdateTime: "", //最后更新时间
+      tipsType: 1, //提示信息种类
+      ruleDialogShow: false, //规则提示执行弹窗
+      ruleDialogStr: "", //规则提示执行弹窗文字
+      loading: false //列表loading
+    };
+  },
+  components: {
+    applyRulesDialog,
+    delRelationDialog,
+    dictionaryDevice,
+    dataSource,
+    locationFlag
+  },
+  created() {
+    this.init();
+  },
+  mounted() {},
+  methods: {
+    //获取查询条件-提示信息
+    init() {
+      let param = { Related: true };
+      //对象类型
+      this.getTypeNames();
+      //获取提示信息
+      dynamicPromptmessage({}, res => {
+        if (res.Result == "success") {
+          if (res.Content.length) {
+            for (let i = 0; i < res.Content.length; i++) {
+              if (res.Content[i].Type == "未执行对应规则") {
+                this.tipsType = 3;
+                this.ruleDialogStr = "对应规则更新,是否现在执行?";
+                this.ruleDialogShow = true;
+                return;
+              }
+              if (res.Content[i].Type == "原始点位增删") {
+                this.tipsType = 2;
+                this.ruleDialogStr =
+                  "原始点位变化,部分标识受到影响,请重新执行对应规则";
+                this.ruleDialogShow = true;
+                return;
+              }
+              if (res.Content[i].Type == "最后一次执行时间") {
+                this.lastUpdateTime = res.Content[i].Content;
+                this.tipsType = 1;
+                this.ruleDialogShow = false;
+                return;
+              }
+            }
+          }
+        }
+      });
+    },
+    //获取tab页
+    getTypeNames() {
+      let param = { Related: true };
+      //对象类型
+      dynamicPointTypeList(param, res => {
+        if (res.Result == "success") {
+          this.typeList = res.Content;
+          if (this.typeList.length) {
+            //记录上次操作的tab页
+            this.curType =
+              this.curType != 0 ? this.curType : this.typeList[0].Name;
+            this.getTableData();
+          } else {
+            this.tableData = [];
+          }
+        }
+      });
+    },
+    //执行对应结果
+    apply() {
+      dynamicExecute({}, res => {
+        if (res.Result == "success") {
+          this.$message.success("应用成功");
+        }
+      });
+      // this.$refs.apply.showDialog();
+    },
+    //清除对应关系
+    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({ name: "addRelation" });
+    },
+    //获取表格数据
+    getTableData() {
+      let param = {
+        PageNumber: this.page.pageNumber,
+        PageSize: this.page.pageSize,
+        TypeNameList: [this.curType]
+      };
+      //处理查询条件
+      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 => {
+        this.loading = false;
+        if (res.Result == "success") {
+          this.tableData = res.Content;
+          this.page.total = res.Total;
+        }
+      });
+    },
+    //刷新列表
+    refresh() {
+      this.page.pageNumber = 1;
+      this.getTypeNames();
+    },
+    //规则执行弹窗
+    rulesClose() {
+      this.ruleDialogShow = false;
+    },
+    //现在执行
+    nowDo() {},
+    //数据字典设备类型修改
+    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();
+    }
+  },
+  watch: {
+    projectId() {
+      this.init();
+    }
+  }
+};
+</script>
+<style lang="scss" scoped>
+#dynamicdata {
+  overflow: hidden;
+  height: 100%;
+  background-color: #fff;
+  padding: 10px;
+  position: relative;
+  /deep/ .text-right {
+    text-align: right;
+  }
+  .query-item {
+    float: left;
+    & + .query-item {
+      margin-left: 10px;
+    }
+  }
+  .table-area {
+    width: 100%;
+    height: calc(100% - 215px);
+    td div {
+      white-space: nowrap;
+      text-overflow: ellipsis;
+      overflow: hidden;
+    }
+  }
+  .fr {
+    padding-top: 10px;
+    float: right;
+  }
+}
+</style>
+