buildRules.vue 10.0 KB

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