floorRules.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. floorQuery, //数据中心查询楼层
  114. } from "@/api/scan/request";
  115. export default {
  116. computed: {
  117. ...mapGetters("layout", ["projectId"])
  118. },
  119. data() {
  120. return {
  121. headerStyle: {
  122. backgroundColor: '#e1e4e5',
  123. color: '#2b2b2b',
  124. lineHeight: '30px'
  125. },
  126. sourceList: [], //数据源
  127. DynEquipList: [], //数据字典部件类型
  128. LocFlagList: [], //位置标签
  129. tableData: [], //列表数据
  130. page: {
  131. pageSize: 50,
  132. pageSizes: [10, 20, 50, 100],
  133. pageNumber: 1,
  134. total: 0
  135. },
  136. form: {
  137. EquipmentMark: "", //部件标识关键字
  138. SubTypeName: [], //数据字典部件类型
  139. LocationFlag: [], //位置标签
  140. Datasource: [] //数据源
  141. }, //查询条件
  142. loading: false, //列表loading
  143. autoLoading: false, //自动对应实例
  144. };
  145. },
  146. components: {
  147. applyRulesDialog,
  148. delRelationDialog,
  149. dictionaryDevice,
  150. dataSource,
  151. locationFlag
  152. },
  153. props: {
  154. typeName: {},
  155. isPending: {
  156. default: false
  157. }
  158. },
  159. created() {
  160. this.init();
  161. },
  162. mounted() { },
  163. methods: {
  164. //获取查询条件-提示信息
  165. init() {
  166. this.getTableData()
  167. },
  168. //清除对应关系
  169. handleDelete(index, row) {
  170. this.$refs.del.showDialog(row);
  171. },
  172. //改变pagesize
  173. handleSizeChange(pageSize) {
  174. this.page.pageSize = pageSize;
  175. this.getTableData();
  176. },
  177. //改变pageno
  178. handleCurrentChange(pageNo) {
  179. this.page.pageNumber = pageNo;
  180. this.getTableData();
  181. },
  182. //跳转至填充对应规则
  183. toAddRelation() {
  184. this.$router.push({ path: "floorRela", query: { typeName: this.typeName } });
  185. },
  186. //获取表格数据
  187. getTableData() {
  188. let param = {
  189. PageNumber: this.page.pageNumber,
  190. PageSize: this.page.pageSize,
  191. TypeNameList: [this.typeName]
  192. };
  193. //处理查询条件
  194. if (this.form.EquipmentMark && this.form.EquipmentMark.length) {
  195. param.EquipmentMark = this.form.EquipmentMark;
  196. }
  197. if (this.form.SubTypeName.length) {
  198. param.SubTypeNameList = this.form.SubTypeName;
  199. }
  200. if (this.form.LocationFlag.length) {
  201. param.LocationFlagList = this.form.LocationFlag;
  202. }
  203. if (this.form.Datasource.length) {
  204. param.DatasourceList = this.form.Datasource;
  205. }
  206. this.loading = true;
  207. // 查询对应关系(P1)
  208. dynamicQuery(param, res => {
  209. let dyData = res.Content;
  210. let tempArr = dyData.map(t => {
  211. if (t.Related == 'True') {
  212. t.FloorID = t.TypeCode + t.ProjectId + t.ObjectID;
  213. return t.FloorID;
  214. }
  215. return undefined;
  216. }).filter(item => item);
  217. if (tempArr.length) {
  218. floorQuery({
  219. PageSize: this.page.pageSize,
  220. Cascade: [{ Name: 'building' }],
  221. Filters: `FloorID in ${JSON.stringify(tempArr)}`
  222. }, response => {
  223. let Data = response.Content;
  224. dyData.forEach(item => {
  225. Data.forEach(t => {
  226. if (t.FloorID == item.FloorID) {
  227. item.ObjectLocalName = t.FloorLocalName;
  228. item.ObjectSequenceID = t.FloorSequenceID;
  229. item.BuildLocalName = t.Building ? t.Building.BuildLocalName : '';
  230. }
  231. })
  232. })
  233. this.loading = false;
  234. this.tableData = dyData;
  235. })
  236. } else {
  237. this.loading = false;
  238. this.tableData = dyData;
  239. }
  240. this.page.total = res.PageSize < 50 ? res.PageSize : res.Total;
  241. });
  242. },
  243. //刷新列表
  244. refresh() {
  245. this.page.pageNumber = 1;
  246. this.$emit('refresh', this.typeName);
  247. this.getTableData();
  248. },
  249. //数据字典部件类型修改
  250. changeDictionary(val) {
  251. this.page.pageNumber = 1;
  252. this.form.SubTypeName = val;
  253. this.getTableData();
  254. },
  255. //数据源修改
  256. changeDataSource(val) {
  257. this.page.pageNumber = 1;
  258. this.form.Datasource = val;
  259. this.getTableData();
  260. },
  261. //修改位置标签
  262. changeLocationFlag(val) {
  263. this.page.pageNumber = 1;
  264. this.form.LocationFlag = val;
  265. this.getTableData();
  266. },
  267. //查询列表
  268. queryTableData() {
  269. this.page.pageNumber = 1;
  270. this.getTableData();
  271. },
  272. //自动对应实例
  273. autoGroupRela() {
  274. this.$emit('autoGroupRela', 'floor');
  275. }
  276. },
  277. watch: {
  278. projectId() {
  279. this.init();
  280. }
  281. }
  282. };
  283. </script>
  284. <style lang="scss" scoped>
  285. #equipRules {
  286. height: calc(100% - 54px);
  287. /deep/ .text-right {
  288. text-align: right;
  289. }
  290. .query-item {
  291. float: left;
  292. & + .query-item {
  293. margin-left: 10px;
  294. }
  295. }
  296. /deep/ .special .el-input__inner {
  297. width: 220px;
  298. }
  299. /deep/ .table-area {
  300. width: 100%;
  301. height: calc(100% - 71px);
  302. margin-bottom: 10px;
  303. td div {
  304. white-space: nowrap;
  305. text-overflow: ellipsis;
  306. overflow: hidden;
  307. }
  308. .td-bl {
  309. border-left: 1px solid #ebeef5;
  310. }
  311. .tool-tip {
  312. white-space: nowrap;
  313. overflow: hidden;
  314. text-overflow: ellipsis;
  315. }
  316. }
  317. }
  318. </style>