index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div id="dynamicdata">
  3. <!-- tab分页 -->
  4. <el-row class="top-tab">
  5. <el-tabs v-model="curType">
  6. <el-tab-pane v-for="(item) in typeList" :key="item.Name" :label="item.Name+'('+item.Sum+'/'+item.Rcount+')'" :name="item.Name">
  7. </el-tab-pane>
  8. </el-tabs>
  9. <div class="pos-right">
  10. <span style="margin-right:10px;" v-show="lastUpdateTime">最后配置时间:{{lastUpdateTime}}</span>
  11. <span v-if="tipsType==2" class="tips">
  12. 原始点位变化,部分标识受到影响,请重新执行对应规则
  13. <i class="el-icon-right"></i>
  14. </span>
  15. <span v-if="tipsType==3" class="tips">
  16. 对应规则有更新,记得执行哦
  17. <i class="el-icon-right"></i>
  18. </span>
  19. <el-tooltip class="item" effect="dark" :content="'按对应规则自动设定实例动态参数信息点'" placement="left">
  20. <el-badge :is-dot="ruleDialogShow||tipsType>1" class="item">
  21. <el-button size="small" type="primary" @click="apply" icon="el-icon-refresh" style="float:right;">配置</el-button>
  22. </el-badge>
  23. </el-tooltip>
  24. </div>
  25. </el-row>
  26. <equip-rules v-if="curType=='设备'" ref="equip" :typeName="curType" @refresh="equipRefresh"></equip-rules>
  27. <!-- <parts-rules v-if="!curType=='设备'" ref="parts" :typeName="'设备'"></parts-rules> -->
  28. <!-- 应用规则弹窗 -->
  29. <apply-rules-dialog ref="apply" @refresh="getPrompt"></apply-rules-dialog>
  30. <!-- 规则更新提示 -->
  31. <el-dialog title="提示" :visible.sync="ruleDialogShow" width="25%" @close="rulesClose">
  32. <span>{{tipCon}}</span>
  33. <span slot="footer" class="dialog-footer">
  34. <el-button size="small" @click="rulesClose">稍后处理</el-button>
  35. <el-button size="small" type="primary" @click="apply">现在执行</el-button>
  36. </span>
  37. </el-dialog>
  38. </div>
  39. </template>
  40. <script>
  41. import tools from "@/utils/tools";
  42. import { mapGetters, mapActions } from "vuex";
  43. import applyRulesDialog from "@/components/point/dynamicdata/applyRulesDialog";
  44. import equipRules from "@/components/point/dynamicdata/equipRules";
  45. import partsRules from "@/components/point/dynamicdata/partsRules";
  46. import {
  47. dynamicClashConfirm,
  48. dynamicPromptmessage,
  49. dynamicPointTypeList
  50. } from "@/api/scan/request";
  51. export default {
  52. computed: {
  53. ...mapGetters("layout", ["projectId"])
  54. },
  55. data() {
  56. return {
  57. curType: "", //当前所在tab页
  58. typeList: [], //tab页list
  59. lastUpdateTime: "", //最后更新时间
  60. tipsType: 1, //提示信息种类
  61. ruleDialogShow: false, //规则提示执行弹窗
  62. tipCon: '', //配置按钮提示文字-规则提示执行弹窗文字
  63. };
  64. },
  65. components: {
  66. applyRulesDialog,
  67. equipRules,
  68. partsRules
  69. },
  70. created() {
  71. let typeName = this.$route.query.typeName;
  72. if (typeName) {
  73. this.curType = typeName
  74. }
  75. this.init();
  76. },
  77. mounted() { },
  78. methods: {
  79. //获取查询条件-提示信息
  80. init() {
  81. let param = { Related: true };
  82. //对象类型
  83. this.getTypeNames();
  84. //获取提示信息
  85. this.getPrompt();
  86. },
  87. //获取提示消息
  88. getPrompt() {
  89. dynamicPromptmessage({}, res => {
  90. if (res.Result == "success") {
  91. if (res.Content.length) {
  92. for (let i = 0; i < res.Content.length; i++) {
  93. if (res.Content[i].Type == "最后一次执行时间") {
  94. this.lastUpdateTime = res.Content[i].Content.substr(0,res.Content[i].Content.lastIndexOf('.'));
  95. this.tipsType = 1;
  96. }
  97. if (res.Content[i].Type == "原始点位增删") {
  98. this.tipsType = 2;
  99. this.tipCon = "原始点位变化,部分标识受到影响,请重新执行对应规则";
  100. this.ruleDialogShow = true;
  101. }
  102. if (res.Content[i].Type == "未执行对应规则") {
  103. this.tipsType = 3;
  104. this.tipCon = "对应规则更新,是否现在执行?";
  105. this.ruleDialogShow = true;
  106. }
  107. }
  108. }
  109. }
  110. });
  111. },
  112. //获取tab页
  113. getTypeNames() {
  114. let param = { Related: true };
  115. //对象类型
  116. dynamicPointTypeList(param, res => {
  117. if (res.Result == "success") {
  118. this.typeList = res.Content;
  119. if (this.typeList.length) {
  120. //记录上次操作的tab页
  121. this.curType =
  122. this.curType != 0 ? this.curType : this.typeList[0].Name;
  123. } else {
  124. this.tableData = [];
  125. }
  126. }
  127. });
  128. },
  129. //执行对应结果
  130. apply() {
  131. this.ruleDialogShow = false;
  132. this.$refs.apply.showDialog();
  133. },
  134. //规则执行弹窗
  135. rulesClose() {
  136. this.ruleDialogShow = false;
  137. },
  138. //刷新设备类表
  139. equipRefresh(val) {
  140. this.curType = val;
  141. this.getTypeNames()
  142. }
  143. },
  144. watch: {
  145. projectId() {
  146. this.init();
  147. }
  148. }
  149. };
  150. </script>
  151. <style lang="scss" scoped>
  152. #dynamicdata {
  153. overflow: hidden;
  154. height: 100%;
  155. background-color: #fff;
  156. padding: 10px;
  157. position: relative;
  158. .top-tab {
  159. position: relative;
  160. .pos-right {
  161. position: absolute;
  162. right: 0;
  163. top: 0;
  164. .tips {
  165. color: red;
  166. position: absolute;
  167. right: 73px;
  168. width: 390px;
  169. text-align: right;
  170. padding-right: 10px;
  171. background-color: #fff;
  172. }
  173. }
  174. }
  175. }
  176. </style>