equipRules.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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="`请输入${typeName}标识关键字`" 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="`填充${typeName}标识与实例对应规则`" 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;">点位表中出现的所有{{typeName}}</el-col>
  37. <el-col :span="12" style="padding-left:10px;font-size:13px;border-left:2px solid #000;">对应物理世界中的{{typeName}}实例</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="headerStyle">
  42. <el-table-column prop="EquipmentMark" :label="`${typeName}标识`" 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="`数字字典${typeName}类型`" show-overflow-tooltip min-width="100"></el-table-column>
  52. <el-table-column prop="ObjectLocalName" :label="`对应的${typeName}实例`" 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:scope.row.BuildLocalName:''"
  56. placement="top">
  57. <div class="tool-tip">{{scope.row.BuildLocalName?scope.row.FloorLocalName?scope.row.BuildLocalName+'-'+scope.row.FloorLocalName:scope.row.BuildLocalName:''}}
  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. headerStyle: {
  104. backgroundColor: '#e1e4e5',
  105. color: '#2b2b2b',
  106. lineHeight: '30px'
  107. },
  108. sourceList: [], //数据源
  109. DynEquipList: [], //数据字典设备类型
  110. LocFlagList: [], //位置标签
  111. tableData: [], //列表数据
  112. page: {
  113. pageSize: 50,
  114. pageSizes: [10, 20, 50, 100],
  115. pageNumber: 1,
  116. total: 0
  117. },
  118. form: {
  119. EquipmentMark: "", //设备标识关键字
  120. SubTypeName: [], //数据字典设备类型
  121. LocationFlag: [], //位置标签
  122. Datasource: [] //数据源
  123. }, //查询条件
  124. loading: false, //列表loading
  125. };
  126. },
  127. components: {
  128. applyRulesDialog,
  129. delRelationDialog,
  130. dictionaryDevice,
  131. dataSource,
  132. locationFlag
  133. },
  134. props: {
  135. typeName: {},
  136. isPending: {
  137. default: false
  138. }
  139. },
  140. created() {
  141. this.init();
  142. },
  143. mounted() { },
  144. methods: {
  145. //获取查询条件-提示信息
  146. init() {
  147. this.getTableData()
  148. },
  149. //清除对应关系
  150. handleDelete(index, row) {
  151. this.$refs.del.showDialog(row);
  152. },
  153. //改变pagesize
  154. handleSizeChange(pageSize) {
  155. this.page.pageSize = pageSize;
  156. this.getTableData();
  157. },
  158. //改变pageno
  159. handleCurrentChange(pageNo) {
  160. this.page.pageNumber = pageNo;
  161. this.getTableData();
  162. },
  163. //跳转至填充对应规则
  164. toAddRelation() {
  165. this.$router.push({ path: "equipRela", query: { typeName: this.typeName } });
  166. },
  167. //获取表格数据
  168. getTableData() {
  169. let param = {
  170. PageNumber: this.page.pageNumber,
  171. PageSize: this.page.pageSize,
  172. TypeNameList: [this.typeName]
  173. };
  174. //处理查询条件
  175. if (this.form.EquipmentMark && this.form.EquipmentMark.length) {
  176. param.EquipmentMark = this.form.EquipmentMark;
  177. }
  178. if (this.form.SubTypeName.length) {
  179. param.SubTypeNameList = this.form.SubTypeName;
  180. }
  181. if (this.form.LocationFlag.length) {
  182. param.LocationFlagList = this.form.LocationFlag;
  183. }
  184. if (this.form.Datasource.length) {
  185. param.DatasourceList = this.form.Datasource;
  186. }
  187. this.loading = true;
  188. // 查询对应关系(P1)
  189. dynamicQuery(param, res => {
  190. this.loading = false;
  191. this.tableData = res.Content;
  192. this.page.total = res.PageSize < 50 ? res.PageSize : res.Total;
  193. });
  194. },
  195. //刷新列表
  196. refresh() {
  197. this.page.pageNumber = 1;
  198. this.$emit('refresh', this.typeName);
  199. this.getTableData();
  200. },
  201. //数据字典设备类型修改
  202. changeDictionary(val) {
  203. this.page.pageNumber = 1;
  204. this.form.SubTypeName = val;
  205. this.getTableData();
  206. },
  207. //数据源修改
  208. changeDataSource(val) {
  209. this.page.pageNumber = 1;
  210. this.form.Datasource = val;
  211. this.getTableData();
  212. },
  213. //修改位置标签
  214. changeLocationFlag(val) {
  215. this.page.pageNumber = 1;
  216. this.form.LocationFlag = val;
  217. this.getTableData();
  218. },
  219. //查询列表
  220. queryTableData() {
  221. this.page.pageNumber = 1;
  222. this.getTableData();
  223. }
  224. },
  225. watch: {
  226. projectId() {
  227. this.init();
  228. }
  229. }
  230. };
  231. </script>
  232. <style lang="scss" scoped>
  233. #equipRules {
  234. height: calc(100% - 54px);
  235. /deep/ .text-right {
  236. text-align: right;
  237. }
  238. .query-item {
  239. float: left;
  240. & + .query-item {
  241. margin-left: 10px;
  242. }
  243. }
  244. /deep/ .special .el-input__inner {
  245. width: 220px;
  246. }
  247. /deep/ .table-area {
  248. width: 100%;
  249. height: calc(100% - 125px);
  250. margin-bottom: 10px;
  251. td div {
  252. white-space: nowrap;
  253. text-overflow: ellipsis;
  254. overflow: hidden;
  255. }
  256. .td-bl {
  257. border-left: 1px solid #ebeef5;
  258. }
  259. .tool-tip {
  260. white-space: nowrap;
  261. overflow: hidden;
  262. text-overflow: ellipsis;
  263. }
  264. }
  265. }
  266. </style>