floorRules.vue 12 KB

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