equipRules.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <div id="equipRules">
  3. <!-- 查询条件 -->
  4. <div class="query-area">
  5. <el-row>
  6. <el-col :span="23">
  7. <el-form ref="form" :model="form" :inline="true">
  8. <el-row>
  9. <div class="query-item special">
  10. <el-input placeholder="请输入设备标识关键字" v-model="form.EquipmentMark" @keyup.enter.native="queryTableData">
  11. <i slot="suffix" class="el-input__icon el-icon-search" @click="queryTableData"></i>
  12. </el-input>
  13. </div>
  14. <div class="query-item">
  15. <label style="padding-right:9px">数据源</label>
  16. <dataSource :Related="null" @change="changeDataSource" :typeName="typeName"></dataSource>
  17. </div>
  18. <div class="query-item">
  19. <dictionary-device @change="changeDictionary" :Related="null" :typeName="typeName"></dictionary-device>
  20. </div>
  21. <div class="query-item">
  22. <label style="padding-right:9px">位置标签</label>
  23. <locationFlag :Related="null" @change="changeLocationFlag" :typeName="typeName"></locationFlag>
  24. </div>
  25. </el-row>
  26. </el-form>
  27. </el-col>
  28. <el-col :span="1">
  29. <el-tooltip class="item" effect="dark" content="填充设备标识与实例对应规则" placement="left">
  30. <el-button size="small" type="primary" @click="toAddRelation" icon="el-icon-edit-outline" style="float:right;" :disabled="isPending"></el-button>
  31. </el-tooltip>
  32. </el-col>
  33. </el-row>
  34. </div>
  35. <el-row>
  36. <el-col :span="12" style="padding-left:10px;font-size:13px;border-left:2px solid #000;">点位表中出现的所有设备</el-col>
  37. <el-col :span="12" style="padding-left:10px;font-size:13px;border-left:2px solid #000;">对应物理世界中的设备实例</el-col>
  38. </el-row>
  39. <!-- 列表区域 -->
  40. <div class="table-area">
  41. <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="{background:'#f7f9fb'}">
  42. <el-table-column prop="EquipmentMark" label="设备标识" show-overflow-tooltip min-width="100"></el-table-column>
  43. <el-table-column prop="LocationFlag" label="位置标签" min-width="200">
  44. <template slot-scope="scope">
  45. <el-tooltip :content="scope.row.LocationFlag.toString()" placement="top">
  46. <div class="tool-tip">{{scope.row.LocationFlag.toString()}}</div>
  47. </el-tooltip>
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="Datasource" label="数据源" show-overflow-tooltip min-width="100"></el-table-column>
  51. <el-table-column prop="SubTypeName" label="数字字典设备类型" show-overflow-tooltip min-width="100"></el-table-column>
  52. <el-table-column prop="EquipLocalName" label="对应的设备实例" show-overflow-tooltip min-width="100" class-name="td-bl"></el-table-column>
  53. <el-table-column label="实例所在建筑楼层" min-width="100">
  54. <template slot-scope="scope">
  55. <el-tooltip :content="scope.row.BuildLocalName&&scope.row.FloorLocalName?scope.row.BuildLocalName+'-'+scope.row.FloorLocalName:''"
  56. placement="top">
  57. <div class="tool-tip">{{scope.row.BuildLocalName&&scope.row.FloorLocalName?scope.row.BuildLocalName+'-'+scope.row.FloorLocalName:''}}
  58. </div>
  59. </el-tooltip>
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="RoomLocalName" label="实例所在业务空间" show-overflow-tooltip min-width="200"></el-table-column>
  63. <el-table-column prop="action" label="操作" min-width="100">
  64. <template slot-scope="scope">
  65. <el-tooltip class="item" effect="dark" content="清除对应规则" placement="left">
  66. <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain :disabled="isPending||scope.row.Related=='False'"
  67. icon="el-icon-delete"></el-button>
  68. </el-tooltip>
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. </div>
  73. <!-- 分页 -->
  74. <el-pagination class="fr" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
  75. :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
  76. :total="page.total"></el-pagination>
  77. <!-- 清除对应关系弹窗 -->
  78. <del-relation-dialog ref="del" @refresh="refresh"></del-relation-dialog>
  79. </div>
  80. </template>
  81. <script>
  82. import tools from "@/utils/tools";
  83. import { mapGetters, mapActions } from "vuex";
  84. import applyRulesDialog from "@/components/point/dynamicdata/applyRulesDialog";
  85. import delRelationDialog from "@/components/point/dynamicdata/delRelationDialog";
  86. import dictionaryDevice from "@/components/point/dynamicdata/dictionaryDevice";
  87. import dataSource from "@/components/point/dynamicdata/dataSource";
  88. import locationFlag from "@/components/point/dynamicdata/locationFlag";
  89. import equipRules from "@/components/point/dynamicdata/equipRules";
  90. import {
  91. dynamicClashConfirm,
  92. dynamicExecute,
  93. dynamicQuery,
  94. dynamicQueryPoint,
  95. dynamicPointTypeList
  96. } from "@/api/scan/request";
  97. export default {
  98. computed: {
  99. ...mapGetters("layout", ["projectId"])
  100. },
  101. data() {
  102. return {
  103. sourceList: [], //数据源
  104. DynEquipList: [], //数据字典设备类型
  105. LocFlagList: [], //位置标签
  106. tableData: [], //列表数据
  107. page: {
  108. pageSize: 50,
  109. pageSizes: [10, 20, 50, 100],
  110. pageNumber: 1,
  111. total: 0
  112. },
  113. form: {
  114. EquipmentMark: "", //设备标识关键字
  115. SubTypeName: [], //数据字典设备类型
  116. LocationFlag: [], //位置标签
  117. Datasource: [] //数据源
  118. }, //查询条件
  119. loading: false, //列表loading
  120. };
  121. },
  122. components: {
  123. applyRulesDialog,
  124. delRelationDialog,
  125. dictionaryDevice,
  126. dataSource,
  127. locationFlag
  128. },
  129. props: {
  130. typeName: {},
  131. isPending: {
  132. default: false
  133. }
  134. },
  135. created() {
  136. this.init();
  137. },
  138. mounted() { },
  139. methods: {
  140. //获取查询条件-提示信息
  141. init() {
  142. this.getTableData()
  143. },
  144. //清除对应关系
  145. handleDelete(index, row) {
  146. this.$refs.del.showDialog(row);
  147. },
  148. //改变pagesize
  149. handleSizeChange(pageSize) {
  150. this.page.pageSize = pageSize;
  151. this.getTableData();
  152. },
  153. //改变pageno
  154. handleCurrentChange(pageNo) {
  155. this.page.pageNumber = pageNo;
  156. this.getTableData();
  157. },
  158. //跳转至填充对应规则
  159. toAddRelation() {
  160. this.$router.push({ path: "equipRela", query: { typeName: this.typeName } });
  161. },
  162. //获取表格数据
  163. getTableData() {
  164. let param = {
  165. PageNumber: this.page.pageNumber,
  166. PageSize: this.page.pageSize,
  167. TypeNameList: [this.typeName]
  168. };
  169. //处理查询条件
  170. if (this.form.EquipmentMark && this.form.EquipmentMark.length) {
  171. param.EquipmentMark = this.form.EquipmentMark;
  172. }
  173. if (this.form.SubTypeName.length) {
  174. param.SubTypeNameList = this.form.SubTypeName;
  175. }
  176. if (this.form.LocationFlag.length) {
  177. param.LocationFlagList = this.form.LocationFlag;
  178. }
  179. if (this.form.Datasource.length) {
  180. param.DatasourceList = this.form.Datasource;
  181. }
  182. this.loading = true;
  183. // 查询对应关系(P1)
  184. dynamicQuery(param, res => {
  185. this.loading = false;
  186. this.tableData = res.Content;
  187. this.page.total = res.PageSize < 50 ? res.PageSize : res.Total;
  188. });
  189. },
  190. //刷新列表
  191. refresh() {
  192. this.page.pageNumber = 1;
  193. this.$emit('refresh', this.typeName);
  194. this.getTableData();
  195. },
  196. //数据字典设备类型修改
  197. changeDictionary(val) {
  198. this.page.pageNumber = 1;
  199. this.form.SubTypeName = val;
  200. this.getTableData();
  201. },
  202. //数据源修改
  203. changeDataSource(val) {
  204. this.page.pageNumber = 1;
  205. this.form.Datasource = val;
  206. this.getTableData();
  207. },
  208. //修改位置标签
  209. changeLocationFlag(val) {
  210. this.page.pageNumber = 1;
  211. this.form.LocationFlag = val;
  212. this.getTableData();
  213. },
  214. //查询列表
  215. queryTableData() {
  216. this.page.pageNumber = 1;
  217. this.getTableData();
  218. }
  219. },
  220. watch: {
  221. projectId() {
  222. this.init();
  223. }
  224. }
  225. };
  226. </script>
  227. <style lang="scss" scoped>
  228. #equipRules {
  229. height: calc(100% - 54px);
  230. /deep/ .text-right {
  231. text-align: right;
  232. }
  233. .query-item {
  234. float: left;
  235. & + .query-item {
  236. margin-left: 10px;
  237. }
  238. }
  239. /deep/ .special .el-input__inner {
  240. width: 220px;
  241. }
  242. /deep/ .table-area {
  243. width: 100%;
  244. height: calc(100% - 125px);
  245. td div {
  246. white-space: nowrap;
  247. text-overflow: ellipsis;
  248. overflow: hidden;
  249. }
  250. .td-bl {
  251. border-left: 1px solid #ebeef5;
  252. }
  253. .tool-tip {
  254. white-space: nowrap;
  255. overflow: hidden;
  256. text-overflow: ellipsis;
  257. }
  258. }
  259. .fr {
  260. padding-top: 10px;
  261. float: right;
  262. }
  263. }
  264. </style>