partsRules.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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="100"></el-table-column>
  63. <el-table-column prop="CascadeEquipLocalName" label="所属设备实例" show-overflow-tooltip min-width="100"></el-table-column>
  64. <el-table-column prop="action" label="操作" min-width="100">
  65. <template slot-scope="scope">
  66. <el-tooltip class="item" effect="dark" content="清除对应规则" placement="left">
  67. <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain :disabled="isPending||scope.row.Related=='False'"
  68. icon="el-icon-delete"></el-button>
  69. </el-tooltip>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. </div>
  74. <!-- 分页 -->
  75. <el-pagination class="fr" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
  76. :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
  77. :total="page.total"></el-pagination>
  78. <!-- 清除对应关系弹窗 -->
  79. <del-relation-dialog ref="del" @refresh="refresh" :typeName="'parts'"></del-relation-dialog>
  80. </div>
  81. </template>
  82. <script>
  83. import tools from "@/utils/tools";
  84. import { mapGetters, mapActions } from "vuex";
  85. import applyRulesDialog from "@/components/point/dynamicdata/applyRulesDialog";
  86. import delRelationDialog from "@/components/point/dynamicdata/delRelationDialog";
  87. import dictionaryDevice from "@/components/point/dynamicdata/dictionaryDevice";
  88. import dataSource from "@/components/point/dynamicdata/dataSource";
  89. import locationFlag from "@/components/point/dynamicdata/locationFlag";
  90. import equipRules from "@/components/point/dynamicdata/equipRules";
  91. import {
  92. dynamicClashConfirm,
  93. dynamicExecute,
  94. dynamicQuery,
  95. dynamicQueryPoint,
  96. dynamicPointTypeList
  97. } from "@/api/scan/request";
  98. export default {
  99. computed: {
  100. ...mapGetters("layout", ["projectId"])
  101. },
  102. data() {
  103. return {
  104. headerStyle: {
  105. backgroundColor: '#e1e4e5',
  106. color: '#2b2b2b',
  107. lineHeight: '30px'
  108. },
  109. sourceList: [], //数据源
  110. DynEquipList: [], //数据字典部件类型
  111. LocFlagList: [], //位置标签
  112. tableData: [], //列表数据
  113. page: {
  114. pageSize: 50,
  115. pageSizes: [10, 20, 50, 100],
  116. pageNumber: 1,
  117. total: 0
  118. },
  119. form: {
  120. EquipmentMark: "", //部件标识关键字
  121. SubTypeName: [], //数据字典部件类型
  122. LocationFlag: [], //位置标签
  123. Datasource: [] //数据源
  124. }, //查询条件
  125. loading: false, //列表loading
  126. };
  127. },
  128. components: {
  129. applyRulesDialog,
  130. delRelationDialog,
  131. dictionaryDevice,
  132. dataSource,
  133. locationFlag
  134. },
  135. props: {
  136. typeName: {},
  137. isPending: {
  138. default: false
  139. }
  140. },
  141. created() {
  142. this.init();
  143. },
  144. mounted() { },
  145. methods: {
  146. //获取查询条件-提示信息
  147. init() {
  148. this.getTableData()
  149. },
  150. //清除对应关系
  151. handleDelete(index, row) {
  152. this.$refs.del.showDialog(row);
  153. },
  154. //改变pagesize
  155. handleSizeChange(pageSize) {
  156. this.page.pageSize = pageSize;
  157. this.getTableData();
  158. },
  159. //改变pageno
  160. handleCurrentChange(pageNo) {
  161. this.page.pageNumber = pageNo;
  162. this.getTableData();
  163. },
  164. //跳转至填充对应规则
  165. toAddRelation() {
  166. this.$router.push({ path: "partsRela", query: { typeName: this.typeName } });
  167. },
  168. //获取表格数据
  169. getTableData() {
  170. let param = {
  171. PageNumber: this.page.pageNumber,
  172. PageSize: this.page.pageSize,
  173. TypeNameList: [this.typeName]
  174. };
  175. //处理查询条件
  176. if (this.form.EquipmentMark && this.form.EquipmentMark.length) {
  177. param.EquipmentMark = this.form.EquipmentMark;
  178. }
  179. if (this.form.SubTypeName.length) {
  180. param.SubTypeNameList = this.form.SubTypeName;
  181. }
  182. if (this.form.LocationFlag.length) {
  183. param.LocationFlagList = this.form.LocationFlag;
  184. }
  185. if (this.form.Datasource.length) {
  186. param.DatasourceList = this.form.Datasource;
  187. }
  188. this.loading = true;
  189. // 查询对应关系(P1)
  190. dynamicQuery(param, res => {
  191. this.loading = false;
  192. this.tableData = res.Content;
  193. this.page.total = res.PageSize < 50 ? res.PageSize : res.Total;
  194. });
  195. },
  196. //刷新列表
  197. refresh() {
  198. this.page.pageNumber = 1;
  199. this.$emit('refresh', this.typeName);
  200. this.getTableData();
  201. },
  202. //数据字典部件类型修改
  203. changeDictionary(val) {
  204. this.page.pageNumber = 1;
  205. this.form.SubTypeName = val;
  206. this.getTableData();
  207. },
  208. //数据源修改
  209. changeDataSource(val) {
  210. this.page.pageNumber = 1;
  211. this.form.Datasource = val;
  212. this.getTableData();
  213. },
  214. //修改位置标签
  215. changeLocationFlag(val) {
  216. this.page.pageNumber = 1;
  217. this.form.LocationFlag = val;
  218. this.getTableData();
  219. },
  220. //查询列表
  221. queryTableData() {
  222. this.page.pageNumber = 1;
  223. this.getTableData();
  224. }
  225. },
  226. watch: {
  227. projectId() {
  228. this.init();
  229. }
  230. }
  231. };
  232. </script>
  233. <style lang="scss" scoped>
  234. #equipRules {
  235. height: calc(100% - 54px);
  236. /deep/ .text-right {
  237. text-align: right;
  238. }
  239. .query-item {
  240. float: left;
  241. & + .query-item {
  242. margin-left: 10px;
  243. }
  244. }
  245. /deep/ .special .el-input__inner {
  246. width: 220px;
  247. }
  248. /deep/ .table-area {
  249. width: 100%;
  250. height: calc(100% - 125px);
  251. margin-bottom: 10px;
  252. td div {
  253. white-space: nowrap;
  254. text-overflow: ellipsis;
  255. overflow: hidden;
  256. }
  257. .td-bl {
  258. border-left: 1px solid #ebeef5;
  259. }
  260. .tool-tip {
  261. white-space: nowrap;
  262. overflow: hidden;
  263. text-overflow: ellipsis;
  264. }
  265. }
  266. }
  267. </style>