index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div style="overflow-x: hidden" v-loading="loading">
  3. <cardList
  4. :content="content"
  5. :source="source"
  6. :TableVisibleMoreLoading="TableVisibleMoreLoading"
  7. @calcSpecial="calcSpecial"
  8. @openComputed="openComputed"
  9. @RelationType="RelationType"
  10. />
  11. </div>
  12. </template>
  13. <script>
  14. import CardList from "@/components/relation/Overview/CardList";
  15. import {
  16. blockQuery,
  17. blockSource,
  18. businessSpaceAll,
  19. calcSpecial,
  20. graphic,
  21. graphicNumber,
  22. sysDirection
  23. } from "../../../api/relation/api";
  24. import { mapGetters } from "vuex";
  25. export default {
  26. data() {
  27. return {
  28. content: [
  29. // {
  30. // GraphTypeId: '3535436',//大分类id
  31. // graphTypeName: '架构从属关系',//大分类名称
  32. // GraphTypeCode: '',//大分类编码
  33. // Note: '',//说明
  34. // ParentId: '',//父id
  35. // childGraphicTypeList: [
  36. // {
  37. // GraphTypeId: '234534543',//图类型id
  38. // graphTypeName: '建筑从属关系',//图类型名称
  39. // GraphTypeCode: 'ksaajdk',//图类型编码
  40. // Note: '显示数字字典excel中的xxx',//说明
  41. // ParentId: '3535436',//父id,GraphTypeId
  42. // relationTypeProjectList: [
  43. // {
  44. // Id: '23445433534',
  45. // RelationTypeName: '项目下的建筑体',//关系类型名称
  46. // RelationTypeCode: 'Pj2Bd',//关系类型编码
  47. // GraphicId: 'ksaajdk',//图类型编码
  48. // Note: '边类型说明(待补充)',//说明
  49. // ConneObject: '项目→建筑体',//连接对象
  50. // source: true,//是否需要配置源末端
  51. // automatic: true,//是否自动计算类型
  52. // Manual: 2,//123选一个手动计算类型1禁用2提示引导3手动维护
  53. // Prompting: '【设备台账】,【系统台账】',//提示信息
  54. // ProjectId: 'Pj1245',//项目id
  55. // ComputingTime: '2019.12.12 12:00',//null不显示,最后一次自动计算时间
  56. // ComputationalState: 1,//计算状态
  57. // },
  58. // ]
  59. // },
  60. // ]
  61. // },
  62. ],
  63. countNumber: [
  64. // {
  65. // "GraphTypeId": "3243215",
  66. // "graphTypeName": "从属关系",
  67. // "GraphTypeCode": "ksaajdk",
  68. // "relationTypeProjectList": [
  69. // {
  70. // "Id": "f3bed766a5ba45868d3a744fb8aaa0c8",
  71. // "RelationTypeName": "项目下的建筑体",
  72. // "RelationTypeCode": "关系类型编码",
  73. // "GraphicCode": "图类型code",
  74. // "ProjectId": "Pj5432532",
  75. // "count": "123"
  76. // },
  77. // ]
  78. // }
  79. ],
  80. loading: false,
  81. source: [], //源端数据
  82. currentRelationTypeName: "", //当前点击卡片的RelationTypeName
  83. TableVisibleMoreLoading: false
  84. };
  85. },
  86. created() {
  87. this.init();
  88. },
  89. watch: {
  90. projectId() {
  91. this.init();
  92. }
  93. },
  94. computed: {
  95. ...mapGetters("layout", ["projectId"])
  96. },
  97. mounted() {
  98. },
  99. components: { CardList },
  100. methods: {
  101. init() {
  102. this.loading = true;
  103. // let data = {
  104. // "Cascade": [{
  105. // "Cascade": [{
  106. // "Filters": `projectId = '${this.projectId}'`,
  107. // "Name": "relationTypeProjectList"
  108. // }],
  109. // "Filters": " not parentId isnull",
  110. // "Name": "childGraphicTypeList"
  111. // }],
  112. // "Filters": " parentId isnull ",
  113. // "PageNumber": 1,
  114. // "PageSize": 1000
  115. // }
  116. let dataNumber = {
  117. projectId: this.projectId
  118. };
  119. graphic(dataNumber, res => {
  120. graphicNumber(dataNumber, resCount => {
  121. this.countNumber = resCount.content;
  122. this.loading = false;
  123. this.transform(res.content, this.countNumber);
  124. this.content = res.content;
  125. });
  126. });
  127. },
  128. transform(list1, list2) {
  129. let countInfo = {}; // { graphTypeName: { Id: count } }
  130. list2.forEach(item => {
  131. countInfo[item.graphTypeName] = countInfo[item.graphTypeName] || {};
  132. let rList = item.relationTypeProjectList;
  133. rList.forEach(r => {
  134. countInfo[item.graphTypeName][r.id] = r.count;
  135. });
  136. });
  137. let changeList = [];
  138. list1.forEach(item => {
  139. // 这里保存的是引用
  140. if (item.childGraphicTypeList) {
  141. changeList.push(...item.childGraphicTypeList);
  142. }
  143. });
  144. changeList.length &&
  145. changeList.forEach(item => {
  146. let name = item.graphTypeName;
  147. let rList = item.relationTypeProjectList;
  148. rList.forEach(r => {
  149. r.count = countInfo[name][r.id];
  150. // this.$set(r, 'cardDisabled', false)
  151. });
  152. });
  153. },
  154. RelationType(relation_type, zone_type) {
  155. let param = {
  156. relation_type,
  157. zone_type,
  158. proId: {
  159. projectId: this.projectId
  160. }
  161. };
  162. businessSpaceAll(param).then(res => {
  163. if (res.data.result === "failure") {
  164. this.$message({
  165. message: "计算失败",
  166. type: "error"
  167. });
  168. }
  169. this.init();
  170. });
  171. this.init();
  172. },
  173. calcSpecial(relation) {
  174. this.currentRelationTypeName = relation.RelationTypeName;
  175. if (relation.source) {
  176. //配置云末端
  177. // this.TableVisibleMoreLoading = true//会很慢,加loading
  178. // let param = {
  179. // BuildingId: '',
  180. // Domain: 'DomainPiping',
  181. // ProjectId: this.projectId,
  182. // SystemName: relation.RelationTypeName
  183. // }
  184. // calcSpecial(param, res => {
  185. // let data = {
  186. // projectId: this.projectId,
  187. // }
  188. // blockQuery(data, res => {
  189. // // 获取源端数据
  190. // this.TableVisibleMoreLoading = false
  191. // this.source = res.content
  192. // })
  193. // })
  194. }
  195. },
  196. openComputed(result) {
  197. let param = {
  198. // BuildingId: '',
  199. domain: "DomainPiping",
  200. mepSystemType: "冷冻水供水管",
  201. projectId: this.projectId,
  202. sourceList: result
  203. };
  204. blockSource(param, res => {
  205. //覆盖源端数据
  206. //确定流向
  207. result.forEach(i => {
  208. let { blockId, buildingId, domain, source } = i;
  209. this.DataSorting(blockId, buildingId, domain, source);
  210. });
  211. });
  212. },
  213. DataSorting(BlockId, BuildingId, Domain, source) {
  214. let param = {
  215. blockId: BlockId,
  216. domain: Domain,
  217. source,
  218. buildingId: BuildingId,
  219. systemName: this.currentRelationTypeName
  220. };
  221. sysDirection(param, res => {
  222. this.init();
  223. });
  224. }
  225. }
  226. };
  227. </script>
  228. <style lang="less" scoped>
  229. </style>