floorRules.vue 10 KB

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