applyRulesDialog.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <el-dialog title="提示" :visible.sync="dialogVisible" width="60%" @close="handleClose" id="applyRules">
  3. <span>对应规则有冲突,请处理</span>
  4. <el-tabs v-model="activeName" @tab-click="handleClick">
  5. <el-tab-pane label="人工填写过表号功能号" name="first"></el-tab-pane>
  6. <!-- <el-tab-pane label="多个标识对应同一个信息点" name="second"></el-tab-pane> -->
  7. </el-tabs>
  8. <el-table :data="tableData" style="width: 100%;max-height:400px;min-height:200px;" height="calc(100% - 160px)" @expand-change="expandRow" ref="expandTable">
  9. <el-table-column type="expand" class-name="bgf5">
  10. <template slot-scope="scope">
  11. <el-row>
  12. <el-col :span="12">
  13. <p>{{scope.row.BuildLocalName}}-{{scope.row.FloorLocalName}}</p>
  14. <p>{{scope.row.RoomLocalName}}</p>
  15. <p>{{scope.row.SubTypeName}}</p>
  16. </el-col>
  17. <el-col :span="6">
  18. <p>{{scope.row.OldMsg.Description}}</p>
  19. <p>
  20. {{scope.row.OldMsg.EquipmentMark}}
  21. {{scope.row.OldMsg.KeyEquipmentType}}
  22. {{scope.row.OldMsg.KeyEquipmentParameter}}
  23. </p>
  24. <p>{{scope.row.OldMsg.LocationFlag&&scope.row.OldMsg.LocationFlag.toString()}}</p>
  25. </el-col>
  26. <el-col :span="6">
  27. <p>{{scope.row.NewMsg.Description}}</p>
  28. <p>
  29. {{scope.row.NewMsg.EquipmentMark}}
  30. {{scope.row.NewMsg.KeyEquipmentType}}
  31. {{scope.row.NewMsg.KeyEquipmentParameter}}
  32. </p>
  33. <p>{{scope.row.NewMsg.LocationFlag&&scope.row.NewMsg.LocationFlag.toString()}}</p>
  34. </el-col>
  35. </el-row>
  36. </template>
  37. </el-table-column>
  38. <el-table-column label="设备实例本地名(本地编码)" class-name="bgf5" align="center">
  39. <template slot-scope="scope">
  40. {{scope.row.EquipLocalName}}({{scope.row.ObjectID}})
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="信息点" prop="InfomationPoint" align="center"></el-table-column>
  44. <el-table-column label="原值" prop="Old" align="center">
  45. <template slot-scope="scope">
  46. <el-radio v-model="scope.row.checked" label="Old">{{scope.row.Old}}</el-radio>
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="新值" prop="New" align="center">
  50. <template slot-scope="scope">
  51. <el-radio v-model="scope.row.checked" label="New">{{scope.row.New}}</el-radio>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <span slot="footer" class="dialog-footer">
  56. <span style="font-size:12px;color:red;" v-show="finished">请处理所有冲突</span>
  57. <el-button size="small">取消</el-button>
  58. <el-button size="small" type="primary" @click="userSelected">使用选择的表号功能号</el-button>
  59. </span>
  60. </el-dialog>
  61. </template>
  62. <script>
  63. import {
  64. dynamicPromptobjs, //提示冲突
  65. dynamicClashConfirm, //冲突选择确认
  66. dynamicQueryPoint, //查点位
  67. dynamicExecute, //执行规则
  68. } from "@/api/scan/request";
  69. import Vue from 'vue'
  70. export default {
  71. data() {
  72. return {
  73. dialogVisible: false, //弹窗显示与隐藏
  74. tableData: [],
  75. activeName: "first", //当前所在tab页
  76. finished: false, //未处理所有冲突提示文字
  77. };
  78. },
  79. methods: {
  80. showDialog() {
  81. if (this.tableData.length) {
  82. this.dialogVisible = true;
  83. } else {
  84. this.rulesConfirm()
  85. }
  86. },
  87. handleClick() { },
  88. handleClose(done) { },
  89. //检查是否处理完所有冲突
  90. userSelected() {
  91. let flag = true;
  92. this.tableData.map(t => {
  93. if (!t.checked) {
  94. flag = false;
  95. }
  96. })
  97. this.finished = !flag;
  98. flag && this.confirmClash()
  99. },
  100. //查询是否有冲突
  101. getPromptobjs() {
  102. dynamicPromptobjs('', res => {
  103. this.tableData = res.Content.map((item) => {
  104. item.OldMsg = {}
  105. item.NewMsg = {}
  106. return item
  107. });
  108. })
  109. },
  110. //展开行
  111. expandRow(row) {
  112. let index = this.tableData.indexOf(row);
  113. if (row.OldMsg.TypeCode || row.NewMsg.TypeCode) return;
  114. let param1 = {
  115. Filters: `MeterFuncid='${row.Old}'`,
  116. PageNumber: 1,
  117. PageSize: 50
  118. }
  119. let param2 = {
  120. Filters: `MeterFuncid='${row.New}'`,
  121. PageNumber: 1,
  122. PageSize: 50
  123. }
  124. dynamicQueryPoint(param1, res => {
  125. row.OldMsg = res.Content[0]
  126. this.tableData[index] = row
  127. })
  128. dynamicQueryPoint(param2, res => {
  129. row.NewMsg = res.Content[0]
  130. this.tableData[index] = row
  131. })
  132. },
  133. //确认冲突
  134. confirmClash(){
  135. // let selectedRows = this.tableData.filter(item => {
  136. // return item.checked == 'Old'
  137. // })
  138. let selectedRows = this.tableData;
  139. let param = [];
  140. selectedRows.map(t => {
  141. let tempObj = {
  142. Objs:[t],
  143. Points:[t]
  144. }
  145. param.push(tempObj)
  146. })
  147. dynamicClashConfirm(param, res => {
  148. this.rulesConfirm();
  149. })
  150. },
  151. //执行规则
  152. rulesConfirm(){
  153. dynamicExecute('', res => {
  154. this.$message.success('执行成功');
  155. this.dialogVisible = false;
  156. this.tableData = []
  157. this.$emit('refresh')
  158. })
  159. }
  160. },
  161. mounted() { },
  162. created() {
  163. this.getPromptobjs()
  164. }
  165. };
  166. </script>
  167. <style lang="scss" scoped>
  168. #applyRules {
  169. /deep/ td.bgf5 {
  170. background-color: #f5f7fa;
  171. }
  172. td p {
  173. text-align: center;
  174. }
  175. }
  176. </style>