index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <!--
  2. revit业务空间
  3. -->
  4. <template>
  5. <div id="businessSpace">
  6. <!------------------------ 头部弹窗,选择楼层信息 -------------->
  7. <influence-dialog ref="influence" :param="param" :tabsList="tabsList" title="受元空间变化影响的业务空间" :isShow="floor"></influence-dialog>
  8. <details-dialog ref="details" @del="delSuccess" :param="param" :tabsList="tabsList" title="业务空间详情" :isShow="floor" :activeTabType="activeTabType">
  9. </details-dialog>
  10. <not-related ref="notRelated" @createSuccess="createSuccess" :isShow="floor"></not-related>
  11. <facility-dialog ref="facility" :activeTabType="activeTabType" :isShow="floor"></facility-dialog>
  12. <!--------- 页面头部 -------------->
  13. <div class="saga-title">
  14. <div class="saga-build-mess">
  15. <span style="padding-right:12px;color:#999999;">建筑楼层</span>
  16. <el-cascader :options="options" v-model="buildFloorSelectd" :props="props" @change="changeCascader"></el-cascader>
  17. </div>
  18. <div class="saga-build-tab">
  19. <el-radio-group v-model="isMyTab" @change="changeRadio" style="width: 136px;">
  20. <el-radio-button label="1">平面图</el-radio-button>
  21. <el-radio-button label="2" class="space-own-radio" style="width: 68px;">列表</el-radio-button>
  22. </el-radio-group>
  23. </div>
  24. </div>
  25. <div class="saga-business-sapce-main">
  26. <el-row class="spaceTypes">
  27. <div class="types">
  28. <el-tabs v-model="activeName" type='card' @tab-click="tabClick">
  29. <template v-for="(item,index) in tabsList">
  30. <el-tab-pane :name="item.Code" :key="index" :label="item.Name"></el-tab-pane>
  31. </template>
  32. </el-tabs>
  33. </div>
  34. <div class="groupAdd">
  35. <el-button size="small" @click="groupCreateBSpace">批量创建业务空间</el-button>
  36. </div>
  37. </el-row>
  38. <div v-show="isMyTab == 1" style="width:100%;height:100%">
  39. <graphy @getSp="checkSpace" @dimension="checkSpace" @businessDetails="getBuinessDetails" ref="graphy"></graphy>
  40. </div>
  41. <div v-show="isMyTab == 2">
  42. <handsontable-main @lookEqu="lookEqu" ref="handsontable" :zoneCode="activeName" :id="`handsontable${activeName}`"></handsontable-main>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. <script>
  48. import noModelDialog from "@/components/business_space/dialogs/noModelDialog";
  49. import influenceDialog from "@/components/business_space/dialogs/influenceDialog";
  50. import detailsDialog from "@/components/business_space/dialogs/detailsDialog";
  51. import notRelated from "@/components/business_space/dialogs/notRelated";
  52. import facilityDialog from "@/components/business_space/dialogs/facilityDialog";
  53. // import graphy from "@/components/business_space/graphy/business";
  54. import graphy from "@/components/business_space/newGraphy/graphy";
  55. import handsontableMain from "@/components/business_space/business/handsontable";
  56. import {
  57. getDataDictionary,
  58. getAllbusiness,
  59. getSpaceFloor,
  60. buildingQuery, //数据中心-建筑查询
  61. queryDictionaryHead, //数据中心-字典头部信息查询接口
  62. } from "@/api/scan/request";
  63. import tools from '@/utils/scan/tools'
  64. import { mapGetters, mapActions } from "vuex";
  65. export default {
  66. components: {
  67. noModelDialog,
  68. influenceDialog,
  69. detailsDialog,
  70. notRelated,
  71. graphy,
  72. handsontableMain,
  73. facilityDialog
  74. },
  75. computed: {
  76. ...mapGetters('layout', ['projectId', 'userId', 'secret'])
  77. },
  78. data() {
  79. return {
  80. floor: {
  81. influence: false, //受影响的业务空间弹窗
  82. details: false, //详情弹窗
  83. notRelated: false,
  84. facility: false
  85. },
  86. param: {
  87. ProjId: this.projectId, //项目id
  88. UserId: this.userId, //用户id
  89. secret: this.secret
  90. },
  91. buildMess: {
  92. name: "--",
  93. code: "",
  94. selectd: [],
  95. map: "",
  96. isChild: true,
  97. buildName: "--",
  98. buildCode: ""
  99. },
  100. isMyTab: 1,
  101. activeName: "0",
  102. tabsList: [],
  103. activeTabType: {
  104. "code": "GeneralZone",
  105. "name": "默认分区",
  106. "rel_type": "99"
  107. },
  108. options: [], //建筑楼层级联下拉
  109. props: { //自定义字段
  110. value: "BuildID",
  111. label: "BuildLocalName",
  112. children: "Floor"
  113. },
  114. floorToMap: {}, //楼层及其对应的模型图
  115. FloorMap: "", //当前选中的楼层平面图
  116. buildFloorSelectd: [], //当前所选的建筑楼层
  117. childBackParam: {}
  118. };
  119. },
  120. created() {
  121. this.init();
  122. this.childBackParam = this.$route.params;
  123. },
  124. mounted() { },
  125. methods: {
  126. // 初始化
  127. init() {
  128. this.getTypes()
  129. this.getBuilding()
  130. },
  131. // 获取项目下建筑
  132. getBuilding() {
  133. let pa = {
  134. Cascade: [{ name: 'floor', Orders: 'SequenceId desc' }],
  135. Orders: "BuildLocalName asc",
  136. }
  137. buildingQuery(pa, res => {
  138. this.options = res.Content.map(t => {
  139. if (t.Floor) {
  140. t.Floor = t.Floor.map(item => {
  141. item.BuildID = item.FloorID;
  142. item.BuildLocalName = item.FloorLocalName;
  143. this.floorToMap[item.FloorID] = item.StructureInfo ? item.StructureInfo.FloorMap : '';
  144. return item;
  145. })
  146. } else {
  147. t.Floor = []
  148. }
  149. return t;
  150. })
  151. if (this.childBackParam.zone) {
  152. this.changeCascader(this.buildFloorSelectd)
  153. }
  154. })
  155. },
  156. // 切换平面图和列表
  157. changeRadio(val) {
  158. this.changeGraphyOrTable(val)
  159. },
  160. // 获取tabs的列表
  161. getTypes() {
  162. let pa = {
  163. Filters: `parentId = 'Space'`
  164. }
  165. queryDictionaryHead(pa, res => {
  166. this.tabsList = res.Content;
  167. if (this.childBackParam.zone) {
  168. this.activeName = this.childBackParam.zone;
  169. this.buildFloorSelectd = [this.childBackParam.BuildingId, this.childBackParam.FloorId];
  170. this.isMyTab = this.childBackParam.isMyTab;
  171. } else {
  172. this.activeName = 'GeneralZone';
  173. }
  174. })
  175. },
  176. // 通过选中的tab-Code 获取选中的tab的所有数据
  177. getItemForType() {
  178. let data = {}
  179. this.tabsList.map(item => {
  180. if (item.Code == this.activeName) {
  181. data.code = item.Code;
  182. data.name = item.Name;
  183. }
  184. })
  185. return data
  186. },
  187. // 点击tab
  188. tabClick(val) {
  189. this.changeGraphyOrTable(this.isMyTab)
  190. },
  191. //修改所选建筑楼层
  192. changeCascader(val) {
  193. // val[0]->建筑 val[1]->楼层
  194. if (!this.floorToMap[val[1]]) {
  195. this.isMyTab = 2;
  196. }
  197. this.FloorMap = this.floorToMap[val[1]];
  198. this.changeGraphyOrTable(this.isMyTab)
  199. },
  200. // 判断切换至图还是表
  201. changeGraphyOrTable(num) {
  202. if (!this.buildFloorSelectd.length) {
  203. this.$message("请选择楼层")
  204. return false
  205. }
  206. this.activeTabType = this.getItemForType()
  207. if (num == 2) {
  208. this.initMessage();
  209. } else {
  210. this.$refs.graphy.getData(this.buildFloorSelectd, this.FloorMap, this.activeTabType);
  211. }
  212. },
  213. // 触发获取表头-获取初始化信息点
  214. initMessage() {
  215. let params = {
  216. data: {
  217. Orders: "sort asc",
  218. PageNumber: 1,
  219. PageSize: 500
  220. },
  221. type: this.activeName
  222. }
  223. getDataDictionary(params, res => {
  224. this.$refs.handsontable.getHeader(res.Content, this.buildFloorSelectd);
  225. })
  226. },
  227. // 批量创建业务空间
  228. groupCreateBSpace() {
  229. this.$refs.graphy.groupCreateBSpace()
  230. },
  231. checkSpace(list, build, graphyId) {
  232. this.floor.notRelated = true;
  233. this.$refs.notRelated.getIdList(list, build, graphyId, this.activeTabType);
  234. this.$refs["graphy"].getHasSpace();
  235. },
  236. changeShow() {
  237. this.floor.dialogVisible = true;
  238. console.log(this.buildMess, 'buildMess')
  239. },
  240. //成功关联平面图
  241. createSuccess() {
  242. this.$refs["graphy"].getHasSpace();
  243. this.$refs["graphy"].clearDimension();
  244. this.floor.notRelated = false;
  245. },
  246. //成功删除业务空间
  247. delSuccess() {
  248. this.floor.details = false;
  249. this.$refs["graphy"].getHasSpace();
  250. this.$refs["graphy"].clearDimension();
  251. },
  252. //查看业务空间详情
  253. getBuinessDetails(list) {
  254. this.floor.details = true;
  255. this.$refs.details.getData(list, this.buildMess);
  256. },
  257. lookEqu(infos) {
  258. infos.id = infos.RoomID
  259. infos.name = infos.RoomLocalName
  260. this.floor.facility = true
  261. this.$refs.facility.getData(infos, this.buildMess)
  262. },
  263. },
  264. watch: {
  265. floor: {
  266. deep: true,
  267. handler: function () {
  268. if (this.floor.notRelated) {
  269. this.$refs["graphy"].clearDimension();
  270. }
  271. }
  272. },
  273. projectId() {
  274. this.init()
  275. }
  276. }
  277. };
  278. </script>
  279. <style lang="less">
  280. #businessSpace {
  281. position: relative;
  282. display: flex;
  283. flex-direction: column;
  284. .space-own-radio {
  285. .el-radio-button__inner {
  286. padding: 9px 21px;
  287. }
  288. }
  289. .el-dialog__body {
  290. max-height: 600px;
  291. overflow-y: auto;
  292. }
  293. .saga-title {
  294. height: 54px;
  295. background-color: #fff;
  296. font-size: 14px;
  297. position: relative;
  298. line-height: 54px;
  299. width: 99.5%;
  300. margin-bottom: 10px;
  301. border: 1px solid #dfe6ec;
  302. .saga-build-mess {
  303. position: absolute;
  304. left: 10px;
  305. width: 500px;
  306. margin-left: 10px;
  307. i {
  308. padding-right: 5px;
  309. }
  310. p {
  311. float: left;
  312. }
  313. .saga-btn {
  314. float: left;
  315. height: 40px;
  316. line-height: 40px;
  317. padding: 0 10px;
  318. }
  319. }
  320. .saga-build-tab {
  321. position: absolute;
  322. left: 50%;
  323. transform: translateX(-50%);
  324. .tab-main {
  325. float: left;
  326. width: 120px;
  327. padding: 0 5px;
  328. margin: 5px 0;
  329. border: 1px solid #ccc;
  330. background-color: #fff;
  331. height: 30px;
  332. box-sizing: border-box;
  333. text-align: center;
  334. cursor: pointer;
  335. overflow: hidden;
  336. i {
  337. font-size: 18px;
  338. padding-right: 10px;
  339. float: left;
  340. line-height: 30px;
  341. margin-left: 10px;
  342. }
  343. span {
  344. line-height: 30px;
  345. float: left;
  346. }
  347. }
  348. .tab-active {
  349. background-color: #409eff;
  350. color: #fff;
  351. }
  352. }
  353. }
  354. .saga-business-sapce-main {
  355. overflow: hidden;
  356. height: 100%;
  357. background: #fff;
  358. padding: 10px;
  359. /deep/ .el-tabs__item.is-top {
  360. border-top: 2px solid transparent;
  361. &.is-active {
  362. border-top: 2px solid #409eff;
  363. }
  364. }
  365. }
  366. .spaceTypes {
  367. .types {
  368. float: left;
  369. width: calc(100% - 200px);
  370. }
  371. .groupAdd {
  372. float: left;
  373. width: 200px;
  374. text-align: right;
  375. height: 40px;
  376. border-bottom: 1px solid #e4e7ed;
  377. }
  378. }
  379. }
  380. </style>