index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <!--
  2. revit业务空间
  3. -->
  4. <template>
  5. <div id="businessSpace">
  6. <!-- 空间属于多个建筑楼层 -->
  7. <roomInFloorDialog ref="roomInFloorDialog" @relaSuc="relaSuc"></roomInFloorDialog>
  8. <!--------- 页面头部 -------------->
  9. <div class="saga-title" v-show="!needCalculate">
  10. <div class="saga-build-mess">
  11. <div style="margin-left: 10px;float: left;">
  12. <span style="color: #999999;font-size: 14px;margin-right: 12px;">建筑楼层</span>
  13. <el-cascader :options="options" @change="changeCascader" placeholder="请选择建筑楼层" ref="cascaderAddr"
  14. v-model="buildFloorSelectd">
  15. <template slot-scope="{ node, data }">
  16. <span>{{ data.label }}</span>
  17. <i class="el-icon-warning-outline" v-if="data.Count" style="color:red;margin-right:10px;"></i>
  18. </template>
  19. </el-cascader>
  20. </div>
  21. <input type="hidden" v-model="zoneItemID">
  22. </div>
  23. <div class="saga-build-tab">
  24. <el-radio-group v-model="isMyTab" @change="changeRadio" style="width: 136px;">
  25. <el-radio-button label="1">平面图</el-radio-button>
  26. <el-radio-button label="2" class="space-own-radio" style="width: 68px;">列表</el-radio-button>
  27. </el-radio-group>
  28. </div>
  29. <div class="saga-build-tips" v-if="mutiCount>0" @click="getTips">有{{ mutiCount }}个空间同时属于多个建筑楼层,点击处理</div>
  30. </div>
  31. <div class="saga-business-sapce-main" v-show="!needCalculate">
  32. <el-row class="spaceTypes">
  33. <div class="types">
  34. <el-tabs v-model="activeName" type='card' @tab-click="tabClick">
  35. <template v-for="(item,index) in tabsList">
  36. <el-tab-pane :name="item.Code" :key="index">
  37. <span slot="label"><i class="el-icon-warning-outline" v-if="item.Count>0"
  38. style="color:red;margin-right:10px;"></i>{{ item.Name }}</span>
  39. </el-tab-pane>
  40. </template>
  41. </el-tabs>
  42. </div>
  43. </el-row>
  44. <div v-show="isMyTab == 1" style="width:100%;height:100%">
  45. <graphy @getSp="checkSpace" @dimension="checkSpace" @businessDetails="getBuinessDetails" ref="graphy"
  46. @copyID="copyID"
  47. @updateState="updateStateSuc"></graphy>
  48. </div>
  49. <div v-show="isMyTab == 2">
  50. <handsontable-main @lookEqu="lookEqu" ref="handsontable" :zoneCode="activeName" :otherType="otherType"
  51. :id="`handsontable${activeName}`">
  52. </handsontable-main>
  53. </div>
  54. <div class="infectedTips" v-show="isMyTab==1&&infectedTotal>0">
  55. <p>因底图变化而受影响的业务空间{{ infectedTotal.toString() }}个<span
  56. v-show="buildFloorSelectd.length>1">,本层受影响的业务空间{{ infectedCurfloor.toString() }}个</span></p>
  57. </div>
  58. </div>
  59. <div v-show="needCalculate"
  60. style="display:flex;align-items:center;justify-content:center;height:100%;background-color:#fff;">
  61. <div class="center" style="flex:1">
  62. <i class="iconfont icon-jianzhu" style="font-size:50px;"></i>
  63. <p style="margin:10px 0;">空间关系已发生变化,请更新关系后再使用业务空间台账</p>
  64. <p style="margin:10px 0;">前往【全部关系总览】中重新计算“建筑下的空间”“楼层下的空间”关系</p>
  65. <el-button @click="jumpToAllRelation">立即跳转</el-button>
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. // import noModelDialog from "@/components/business_space/dialogs/noModelDialog";
  72. // import influenceDialog from "@/components/business_space/dialogs/influenceDialog";
  73. // import detailsDialog from "@/components/business_space/dialogs/detailsDialog";
  74. // import notRelated from "@/components/business_space/dialogs/notRelated";
  75. // import facilityDialog from "@/components/business_space/dialogs/facilityDialog";
  76. // import graphy from "@/components/business_space/graphy/business";
  77. import graphy from "@/components/business_space/newGraphy/graphy";
  78. import roomInFloorDialog from "@/components/business_space/newAddDialogs/roomInFloorDialog";
  79. import handsontableMain from "@/components/business_space/business/handsontable";
  80. import {
  81. // getDataDictionary,
  82. getrelationTypeProject,
  83. getSpaceBdFlCount,
  84. queryAllZoneType,
  85. queryBFloorWithState,
  86. zoneCount
  87. } from "@/api/scan/request";
  88. import { getDataDictionary } from "@/api/dict";
  89. import floorCascader from "@/components/ledger/lib/floorCascader";
  90. import { mapGetters } from "vuex";
  91. export default {
  92. components: {
  93. graphy,
  94. handsontableMain,
  95. roomInFloorDialog,
  96. floorCascader,
  97. },
  98. computed: {
  99. ...mapGetters('layout', ['projectId', 'userId', 'secret'])
  100. },
  101. data() {
  102. return {
  103. floor: {
  104. influence: false, //受影响的业务空间弹窗
  105. details: false, //详情弹窗
  106. notRelated: false,
  107. facility: false
  108. },
  109. param: {
  110. ProjId: this.projectId, //项目id
  111. UserId: this.userId, //用户id
  112. secret: this.secret
  113. },
  114. buildMess: {
  115. name: "--",
  116. code: "",
  117. selectd: [],
  118. map: "",
  119. isChild: true,
  120. buildName: "--",
  121. buildCode: ""
  122. },
  123. isMyTab: 1,
  124. activeName: "0",
  125. tabsList: [],
  126. activeTabType: {
  127. "code": "GeneralZone",
  128. "name": "默认分区",
  129. "rel_type": "99"
  130. },
  131. options: [], //建筑楼层级联下拉
  132. floorToMap: {}, //楼层及其对应的模型图
  133. FloorMap: "", //当前选中的楼层对象
  134. zoneItemID: '',
  135. buildFloorSelectd: [''], //当前所选的建筑楼层
  136. childBackParam: {},
  137. needCalculate: false, // 关系是否需要计算
  138. mutiCount: 0,
  139. infectedTotal: 0,
  140. infectedCurfloor: 0,
  141. otherType: ''
  142. };
  143. },
  144. created() {
  145. // this.init();
  146. this.getRelations()
  147. this.childBackParam = this.$route.params;
  148. },
  149. mounted() {
  150. },
  151. methods: {
  152. // 初始化
  153. init() {
  154. this.getTypes()
  155. this.getBuilding()
  156. this.getMutiCount()
  157. this.getInfected();
  158. },
  159. // 获取项目下建筑
  160. getBuilding() {
  161. queryBFloorWithState({}, res => {
  162. this.options = res.Content.map(t => {
  163. t.value = t.BuildID;
  164. t.label = t.BuildLocalName || t.BuildName;
  165. t.Count = 0;
  166. if (t.Floor) {
  167. t.children = t.Floor.map(item => {
  168. item.value = item.FloorID;
  169. item.label = item.FloorLocalName || item.FloorName;
  170. item.buildName = t.BuildLocalName || t.BuildName;
  171. this.floorToMap[item.FloorID] = item;
  172. if (item.Count > 0) {
  173. t.Count++;
  174. }
  175. return item;
  176. })
  177. t.children.unshift({ value: "all", label: "全部" }, { value: 'noKnow', label: "未明确楼层" })
  178. } else {
  179. t.children = []
  180. }
  181. return t;
  182. })
  183. this.options.unshift({ value: "all", label: "全部" }, { value: "noKnow", label: "未明确建筑" })
  184. if (this.childBackParam.buildFloorSelectd) {
  185. this.buildFloorSelectd = this.childBackParam.buildFloorSelectd;
  186. }
  187. if (this.childBackParam.zone) {
  188. this.changeCascader(this.buildFloorSelectd);
  189. }
  190. })
  191. },
  192. // 获取受影响统计
  193. getInfected(floor) {
  194. let pa = {
  195. Filters: `State=1`
  196. }
  197. if (floor) {
  198. pa.Filters += `;FloorId="${floor}"`
  199. }
  200. zoneCount(pa, res => {
  201. if (floor) {
  202. this.infectedCurfloor = res.Count
  203. } else {
  204. this.infectedTotal = res.Count
  205. }
  206. })
  207. },
  208. // 切换平面图和列表
  209. changeRadio(val) {
  210. this.changeGraphyOrTable(val)
  211. },
  212. // 获取tabs的列表
  213. getTypes(floorid) {
  214. let pa = {
  215. Cascade: [{ Name: 'zoneType' }]
  216. }
  217. if (floorid) {
  218. pa.FloorId = floorid
  219. }
  220. queryAllZoneType(pa, res => {
  221. this.tabsList = res.Content.map(t => {
  222. if (t.Name == "元空间") {
  223. return undefined;
  224. }
  225. return t;
  226. }).filter(item => item);
  227. if (this.childBackParam.zone) {
  228. this.activeName = this.childBackParam.zone;
  229. this.buildFloorSelectd = this.childBackParam.buildFloorSelectd;
  230. this.isMyTab = this.childBackParam.isMyTab;
  231. this.otherType = this.childBackParam.otherType;
  232. } else if (this.activeName == '0') {
  233. this.activeName = 'GeneralZone';
  234. }
  235. })
  236. },
  237. // 获取多建筑楼层统计
  238. getMutiCount() {
  239. getSpaceBdFlCount({}, res => {
  240. this.mutiCount = res.Count;
  241. if (this.mutiCount > 0) {
  242. this.getTips();
  243. }
  244. })
  245. },
  246. // 获取关系是否需要计算
  247. getRelations() {
  248. let pa = {
  249. Filters: `RelationType in ["bd2sp","fl2sp"];ComputationalState>1`
  250. }
  251. getrelationTypeProject(pa, res => {
  252. if (res.Content.length) {
  253. this.needCalculate = true;
  254. } else {
  255. this.needCalculate = false;
  256. this.init()
  257. }
  258. })
  259. },
  260. // 通过选中的tab-Code 获取选中的tab的所有数据
  261. getItemForType() {
  262. let data = {}
  263. this.tabsList.map(item => {
  264. if (item.Code == this.activeName) {
  265. data.code = item.Code;
  266. data.name = item.Name;
  267. }
  268. })
  269. return data
  270. },
  271. // 点击tab
  272. tabClick(val) {
  273. this.changeGraphyOrTable(this.isMyTab)
  274. },
  275. //修改所选建筑楼层
  276. changeCascader(val) {
  277. this.buildFloorSelectd = val;
  278. this.$nextTick(() => {
  279. let node = this.$refs['cascaderAddr'].getCheckedNodes()
  280. let name = node[0].pathLabels
  281. name = name.join(' ')
  282. localStorage.setItem('buildingFloor', name)
  283. })
  284. // 如果选择的是全部或者未明确
  285. if (val.indexOf('noKnow') > -1 || val.indexOf('all') > -1) {
  286. this.getTypes()
  287. this.isMyTab = 2;
  288. this.FloorMap = {}
  289. } else {
  290. // 选择的是具体某个楼层
  291. if (!this.floorToMap[val[1]].StructureInfo || !this.floorToMap[val[1]].StructureInfo.FloorMap) {
  292. this.isMyTab = 2;
  293. }
  294. this.getTypes(val[1]);
  295. this.FloorMap = this.floorToMap[val[1]];
  296. }
  297. this.changeGraphyOrTable(this.isMyTab)
  298. },
  299. // 判断切换至图还是表
  300. changeGraphyOrTable(num) {
  301. this.activeTabType = this.getItemForType()
  302. if (!this.buildFloorSelectd[0]) {
  303. this.$message.warning('请选择建筑楼层')
  304. return
  305. }
  306. if (num == 2) {
  307. this.initMessage();
  308. } else {
  309. this.getInfected(this.buildFloorSelectd[1]);
  310. this.$refs.graphy.getData(this.buildFloorSelectd, this.FloorMap, this.activeTabType);
  311. this.childBackParam = {}
  312. }
  313. },
  314. // 触发获取表头-获取初始化信息点
  315. initMessage() {
  316. let params = {
  317. orders: "sort asc, name desc",
  318. pageNumber: 1,
  319. pageSize: 1000,
  320. type: this.activeName
  321. }
  322. getDataDictionary(params, res => {
  323. this.$refs.handsontable.getHeader(res.content, this.buildFloorSelectd);
  324. })
  325. },
  326. checkSpace(list, build, graphyId) {
  327. this.floor.notRelated = true;
  328. this.$refs.notRelated.getIdList(list, build, graphyId, this.activeTabType);
  329. this.$refs["graphy"].getHasSpace();
  330. },
  331. changeShow() {
  332. this.floor.dialogVisible = true;
  333. console.log(this.buildMess, 'buildMess')
  334. },
  335. //成功关联平面图
  336. createSuccess() {
  337. this.$refs["graphy"].getHasSpace();
  338. this.$refs["graphy"].clearDimension();
  339. this.floor.notRelated = false;
  340. },
  341. //成功删除业务空间
  342. delSuccess() {
  343. this.floor.details = false;
  344. this.$refs["graphy"].getHasSpace();
  345. this.$refs["graphy"].clearDimension();
  346. },
  347. //查看业务空间详情
  348. getBuinessDetails(list) {
  349. this.floor.details = true;
  350. this.$refs.details.getData(list, this.buildMess);
  351. },
  352. lookEqu(infos) {
  353. infos.id = infos.RoomID
  354. infos.name = infos.RoomLocalName
  355. this.floor.facility = true
  356. this.$refs.facility.getData(infos, this.buildMess)
  357. },
  358. copyID(val) {
  359. this.$refs.handsontable.zoneItemID = val;
  360. },
  361. // 空间属于多个建筑楼层
  362. getTips() {
  363. this.$refs.roomInFloorDialog.showDialog();
  364. },
  365. // 跳转至关系总览
  366. jumpToAllRelation() {
  367. this.$router.push({ name: 'overView' })
  368. },
  369. relaSuc() {
  370. this.init();
  371. },
  372. // 受影响业务空间确认成功回调
  373. updateStateSuc() {
  374. this.getBuilding()
  375. this.getTypes(this.buildFloorSelectd[1]);
  376. this.infectedTotal--;
  377. this.infectedCurfloor--;
  378. }
  379. },
  380. watch: {
  381. floor: {
  382. deep: true,
  383. handler: function () {
  384. if (this.floor.notRelated) {
  385. this.$refs["graphy"].clearDimension();
  386. }
  387. }
  388. },
  389. projectId() {
  390. this.init()
  391. }
  392. }
  393. };
  394. </script>
  395. <style lang="less">
  396. #businessSpace {
  397. position: relative;
  398. display: flex;
  399. flex-direction: column;
  400. .space-own-radio {
  401. .el-radio-button__inner {
  402. padding: 9px 21px;
  403. }
  404. }
  405. .el-dialog__body {
  406. max-height: 600px;
  407. overflow-y: auto;
  408. }
  409. .saga-title {
  410. height: 54px;
  411. background-color: #fff;
  412. font-size: 14px;
  413. position: relative;
  414. line-height: 54px;
  415. margin-bottom: 10px;
  416. border: 1px solid #dfe6ec;
  417. .saga-build-mess {
  418. // position: absolute;
  419. // left: 10px;
  420. width: 500px;
  421. margin-left: 10px;
  422. i {
  423. padding-right: 5px;
  424. }
  425. p {
  426. float: left;
  427. }
  428. .saga-btn {
  429. float: left;
  430. height: 40px;
  431. line-height: 40px;
  432. padding: 0 10px;
  433. }
  434. }
  435. .saga-build-tab {
  436. position: absolute;
  437. left: 50%;
  438. transform: translateX(-50%);
  439. .tab-main {
  440. float: left;
  441. width: 120px;
  442. padding: 0 5px;
  443. margin: 5px 0;
  444. border: 1px solid #ccc;
  445. background-color: #fff;
  446. height: 30px;
  447. box-sizing: border-box;
  448. text-align: center;
  449. cursor: pointer;
  450. overflow: hidden;
  451. i {
  452. font-size: 18px;
  453. padding-right: 10px;
  454. float: left;
  455. line-height: 30px;
  456. margin-left: 10px;
  457. }
  458. span {
  459. line-height: 30px;
  460. float: left;
  461. }
  462. }
  463. .tab-active {
  464. background-color: #409eff;
  465. color: #fff;
  466. }
  467. }
  468. .saga-build-tips {
  469. float: right;
  470. margin-right: 10px;
  471. font-size: 12px;
  472. color: #409eff;
  473. cursor: pointer;
  474. }
  475. }
  476. .saga-business-sapce-main {
  477. overflow: hidden;
  478. height: 100%;
  479. background: #fff;
  480. // padding: 10px;
  481. /deep/ .el-tabs__item.is-top {
  482. border-top: 2px solid transparent;
  483. &.is-active {
  484. border-top: 2px solid #409eff;
  485. }
  486. }
  487. .infectedTips {
  488. position: absolute;
  489. bottom: 0px;
  490. box-sizing: border-box;
  491. width: 100%;
  492. padding: 0 20px;
  493. line-height: 40px;
  494. background: #ec808d;
  495. color: #fff;
  496. z-index: 9;
  497. }
  498. }
  499. .spaceTypes {
  500. padding: 10px 10px 0;
  501. .types {
  502. float: left;
  503. width: 100%;
  504. // width: calc(100% - 200px);
  505. }
  506. .groupAdd {
  507. float: left;
  508. width: 200px;
  509. text-align: right;
  510. height: 40px;
  511. border-bottom: 1px solid #e4e7ed;
  512. }
  513. }
  514. }
  515. </style>