123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <template>
- <div id="dynamicdata">
- <!-- tab分页 -->
- <el-row class="top-tab">
- <el-tabs v-model="curType">
- <el-tab-pane v-for="(item) in typeList" :key="item.Name" :label="item.Name+'('+item.Sum+'/'+item.Rcount+')'" :name="item.Name">
- </el-tab-pane>
- </el-tabs>
- <div class="pos-right">
- <span style="margin-right:10px;" v-show="lastUpdateTime">最后配置时间:{{lastUpdateTime}}</span>
- <span v-if="tipsType==2" class="tips">
- 原始点位变化,部分标识受到影响,请重新执行对应规则
- <i class="el-icon-right"></i>
- </span>
- <span v-if="tipsType==3" class="tips">
- 对应规则有更新,记得执行哦
- <i class="el-icon-right"></i>
- </span>
- <el-tooltip class="item" effect="dark" :content="'按对应规则自动设定实例动态参数信息点'" placement="left">
- <el-badge :is-dot="ruleDialogShow||tipsType>1" class="item">
- <el-button size="small" type="primary" @click="apply" icon="el-icon-refresh" style="float:right;">配置</el-button>
- </el-badge>
- </el-tooltip>
- </div>
- </el-row>
- <equip-rules v-if="curType=='设备'" ref="equip" :typeName="curType" @refresh="equipRefresh"></equip-rules>
- <!-- <parts-rules v-if="!curType=='设备'" ref="parts" :typeName="'设备'"></parts-rules> -->
- <!-- 应用规则弹窗 -->
- <apply-rules-dialog ref="apply" @refresh="getPrompt"></apply-rules-dialog>
- <!-- 规则更新提示 -->
- <el-dialog title="提示" :visible.sync="ruleDialogShow" width="25%" @close="rulesClose">
- <span>{{tipCon}}</span>
- <span slot="footer" class="dialog-footer">
- <el-button size="small" @click="rulesClose">稍后处理</el-button>
- <el-button size="small" type="primary" @click="apply">现在执行</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 equipRules from "@/components/point/dynamicdata/equipRules";
- import partsRules from "@/components/point/dynamicdata/partsRules";
- import {
- dynamicClashConfirm,
- dynamicPromptmessage,
- dynamicPointTypeList
- } from "@/api/scan/request";
- export default {
- computed: {
- ...mapGetters("layout", ["projectId"])
- },
- data() {
- return {
- curType: "", //当前所在tab页
- typeList: [], //tab页list
- lastUpdateTime: "", //最后更新时间
- tipsType: 1, //提示信息种类
- ruleDialogShow: false, //规则提示执行弹窗
- tipCon: '', //配置按钮提示文字-规则提示执行弹窗文字
- };
- },
- components: {
- applyRulesDialog,
- equipRules,
- partsRules
- },
- created() {
- let typeName = this.$route.query.typeName;
- if (typeName) {
- this.curType = typeName
- }
- this.init();
- },
- mounted() { },
- methods: {
- //获取查询条件-提示信息
- init() {
- let param = { Related: true };
- //对象类型
- this.getTypeNames();
- //获取提示信息
- this.getPrompt();
- },
- //获取提示消息
- getPrompt() {
- 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 = this.tipsType > 1 ? this.tipsType : 1;
- this.lastUpdateTime = res.Content[i].Content.substr(0, res.Content[i].Content.lastIndexOf('.'));
- }
- if (res.Content[i].Type == "原始点位增删") {
- this.tipsType = 2;
- this.tipCon = "原始点位变化,部分标识受到影响,请重新执行对应规则";
- this.ruleDialogShow = true;
- }
- if (res.Content[i].Type == "未执行对应规则") {
- this.tipsType = 3;
- this.tipCon = "对应规则更新,是否现在执行?";
- this.ruleDialogShow = true;
- }
- }
- } else {
- this.tipsType = 1;
- this.tipCon = '';
- this.lastUpdateTime = ''
- }
- }
- });
- },
- //获取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;
- } else {
- this.tableData = [];
- }
- }
- });
- },
- //执行对应结果
- apply() {
- this.ruleDialogShow = false;
- this.tipsType = 1;
- this.$refs.apply.showDialog();
- },
- //规则执行弹窗
- rulesClose() {
- this.ruleDialogShow = false;
- },
- //刷新设备类表
- equipRefresh(val) {
- this.curType = val;
- this.getTypeNames()
- }
- },
- watch: {
- projectId() {
- this.init();
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- #dynamicdata {
- overflow: hidden;
- height: 100%;
- background-color: #fff;
- padding: 10px;
- position: relative;
- .top-tab {
- position: relative;
- height: 54px;
- .pos-right {
- position: absolute;
- right: 0;
- top: 0;
- .tips {
- color: red;
- position: absolute;
- right: 73px;
- width: 390px;
- text-align: right;
- padding-right: 10px;
- background-color: #fff;
- }
- }
- }
- }
- </style>
|