systemRules.vue 11 KB

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