systemRules.vue 9.9 KB

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