buildRules.vue 11 KB

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