index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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.tipsType = this.tipsType > 1 ? this.tipsType : 1;
  95. this.lastUpdateTime = res.Content[i].Content.substr(0, res.Content[i].Content.lastIndexOf('.'));
  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. } else {
  109. this.tipsType = 1;
  110. this.tipCon = '';
  111. this.lastUpdateTime = ''
  112. }
  113. }
  114. });
  115. },
  116. //获取tab页
  117. getTypeNames() {
  118. let param = { Related: true };
  119. //对象类型
  120. dynamicPointTypeList(param, res => {
  121. if (res.Result == "success") {
  122. this.typeList = res.Content;
  123. if (this.typeList.length) {
  124. //记录上次操作的tab页
  125. this.curType =
  126. this.curType != 0 ? this.curType : this.typeList[0].Name;
  127. } else {
  128. this.tableData = [];
  129. }
  130. }
  131. });
  132. },
  133. //执行对应结果
  134. apply() {
  135. this.ruleDialogShow = false;
  136. this.tipsType = 1;
  137. this.$refs.apply.showDialog();
  138. },
  139. //规则执行弹窗
  140. rulesClose() {
  141. this.ruleDialogShow = false;
  142. },
  143. //刷新设备类表
  144. equipRefresh(val) {
  145. this.curType = val;
  146. this.getTypeNames()
  147. }
  148. },
  149. watch: {
  150. projectId() {
  151. this.init();
  152. }
  153. }
  154. };
  155. </script>
  156. <style lang="scss" scoped>
  157. #dynamicdata {
  158. overflow: hidden;
  159. height: 100%;
  160. background-color: #fff;
  161. padding: 10px;
  162. position: relative;
  163. .top-tab {
  164. position: relative;
  165. height: 54px;
  166. .pos-right {
  167. position: absolute;
  168. right: 0;
  169. top: 0;
  170. .tips {
  171. color: red;
  172. position: absolute;
  173. right: 73px;
  174. width: 390px;
  175. text-align: right;
  176. padding-right: 10px;
  177. background-color: #fff;
  178. }
  179. }
  180. }
  181. }
  182. </style>