index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. <template>
  2. <div id="bd-fl-manage">
  3. <el-row>
  4. <div class="l-list">
  5. <div class="action-box">
  6. <div>
  7. <el-button @click="addBuild" icon="el-icon-plus" size="small" type="default" />
  8. <el-button @click="delBuild" icon="el-icon-minus" size="small" type="default" :disabled="!buildList.length" />
  9. <el-button @click="editBuild" icon="el-icon-edit-outline" size="small" type="default" :disabled="!buildList.length" />
  10. </div>
  11. </div>
  12. <h4>建筑</h4>
  13. <div class="build-list">
  14. <div
  15. :class="{ 'floor-item': true, active: item.active }"
  16. :key="item.id"
  17. @click="changeBuild(index)"
  18. style="cursor: pointer"
  19. v-for="(item, index) in buildList"
  20. >
  21. <span>
  22. {{ item.localName || item.name }}
  23. <el-badge :value="item.count" class="mark" v-if="item.count > 0" />
  24. </span>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="r-table" v-if="buildList.length > 0">
  29. <div class="action-box">
  30. <el-button @click="addFloor" size="small" type="default">添加楼层 </el-button>
  31. </div>
  32. <div class="table-box">
  33. <el-table :data="tableData" :header-cell-style="headerStyle" height="100%" style="width: 100%" v-loading="loading">
  34. <el-table-column label="楼层本地名">
  35. <template slot-scope="scope">{{ scope.row.localName }}</template>
  36. </el-table-column>
  37. <el-table-column label="楼层顺序号">
  38. <template slot-scope="scope">{{ scope.row.floorSequenceID }}</template>
  39. </el-table-column>
  40. <el-table-column label="楼层信息">
  41. <template slot-scope="scope">
  42. <el-button @click="editFloorData(scope.row)" icon="el-icon-edit-outline" plain size="mini"></el-button>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="平面图" prop="dataSource">
  46. <template slot-scope="scope">
  47. <p @click="checkDrawImg(scope.row, 2)" v-if="scope.row.sign > 0">
  48. <el-badge is-dot>
  49. <i class="iconfont icon-floorplan" />
  50. </el-badge>
  51. 平面图重复
  52. </p>
  53. <p @click="checkDrawImg(scope.row, 1)" v-else-if="scope.row.infos ? scope.row.infos.floorMap : false">
  54. <i class="iconfont icon-floorplan" />
  55. 查看平面图
  56. </p>
  57. <p @click="checkDrawImg(scope.row, 3)" v-else>
  58. <i class="iconfont icon-nopicture" />
  59. 暂无平面图
  60. </p>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="楼层贯通关系" prop="SubTypeName">
  64. <template slot-scope="scope">
  65. <span style="margin-right: 20px">{{ scope.row.floorThroughList ? scope.row.floorThroughList.length : 0 }}</span>
  66. <el-button @click="changeConnection(scope.row)" icon="el-icon-edit-outline" plain size="mini" />
  67. </template>
  68. </el-table-column>
  69. <el-table-column label="操作" prop="action">
  70. <template slot-scope="scope">
  71. <el-button @click="handleDelete(scope.row)" icon="el-icon-delete" plain size="mini" type="danger" />
  72. </template>
  73. </el-table-column>
  74. </el-table>
  75. </div>
  76. </div>
  77. <div v-else class="r-table">
  78. <div class="center" style="margin-top: 300px"><i class="icon-wushuju iconfont"></i> 请先在左侧创建建筑</div>
  79. </div>
  80. </el-row>
  81. <!-- 添加-修改楼层 -->
  82. <addFloor :curBuildId="curBuildId" :curFloorId="curFloorId" :title="floorTitle" @refresh="refresh" ref="addFloorDialog" />
  83. <!-- 添加-修改建筑 :currentType="currentType"-->
  84. <addBuild :buildTitle="buildTitle" ref="addBuildDialog" :buildMessage="buildMessage" @handleBuild="handleBuild" />
  85. <!-- 删除建筑-删除楼层 -->
  86. <el-dialog :visible.sync="delDialogVis" @close="handleClose" id="messageDialog" title="提示" width="20%">
  87. <div>确定要删除该{{ delText }}?</div>
  88. <span class="dialog-footer" slot="footer">
  89. <el-button @click="delDialogVis = false" size="small">取消</el-button>
  90. <el-button @click="confirmDel" size="small" type="primary">确认</el-button>
  91. </span>
  92. </el-dialog>
  93. <!-- 添加贯通关系弹窗 -->
  94. <addConnectivity @refresh="refresh" ref="addConnectivity" />
  95. </div>
  96. </template>
  97. <script>
  98. import addFloor from "@/components/old-adm/ready/buildfloor/addFloor/index";
  99. import addBuild from "@/components/old-adm/ready/components/addBuild";
  100. import { mapGetters } from "vuex";
  101. import addConnectivity from "@/components/old-adm/ready/components/addConnectivity";
  102. import tools from "@/utils/old-adm/buildfloor/tools";
  103. import DicController from "@/controller/old-adm/dicController";
  104. import ScanController from "@/controller/old-adm/ScanController";
  105. export default {
  106. components: {
  107. addFloor,
  108. addBuild,
  109. addConnectivity,
  110. },
  111. data() {
  112. return {
  113. repetitionGraphyVisible: false, // 替换平面图弹窗
  114. floorTitle: "添加楼层",
  115. buildTitle: "添加建筑",
  116. delDialogVis: false,
  117. delText: "建筑",
  118. headerStyle: {
  119. backgroundColor: "#d9d9d9",
  120. color: "#2b2b2b",
  121. lineHeight: "30px",
  122. },
  123. buildList: [],
  124. tableData: [],
  125. page: {
  126. pageSize: 500,
  127. pageSizes: [10, 20, 50, 100],
  128. pageNumber: 1,
  129. total: 0,
  130. },
  131. loading: false, //列表loading
  132. curBuildId: "", //当前选中的建筑id
  133. curBuildName: "", //当前选中建筑的名称
  134. curFloorId: "", //当前选中的楼层id
  135. modelId: "",
  136. buildMessage: {},
  137. selectedBuildIndex: 0,
  138. };
  139. },
  140. computed: {
  141. ...mapGetters("layout", ["projectId"]),
  142. },
  143. mounted() {},
  144. created() {
  145. this.init();
  146. this.handleBuildQuery();
  147. this.handleSearchBuildKey();
  148. },
  149. methods: {
  150. init() {
  151. let bdParam = {
  152. orders: "localName asc",
  153. pageNumber: 1,
  154. pageSize: 500,
  155. };
  156. ScanController.buildingQueryAndCount(bdParam).then((res) => {
  157. this.buildList = res.content;
  158. if (this.buildList.length) {
  159. // 如果存在建筑id,则将当前选择建筑置为该建筑
  160. if (this.$route.query.buildingId) {
  161. this.selectedBuildIndex = this.buildList.findIndex((item) => item.id === this.$route.query.buildingId);
  162. }
  163. this.changeBuild(this.selectedBuildIndex > this.buildList.length - 1 ? 0 : this.selectedBuildIndex);
  164. }
  165. });
  166. },
  167. //change build
  168. changeBuild(index) {
  169. this.selectedBuildIndex = index;
  170. this.buildList.map((item) => {
  171. item.active = false;
  172. return item;
  173. });
  174. this.buildList[index].active = true;
  175. this.curBuildId = this.buildList[index].id;
  176. this.curBuildName = this.buildList[index].localName || this.buildList[index].name;
  177. this.getFloorTableData();
  178. this.$forceUpdate();
  179. },
  180. //add build
  181. addBuild() {
  182. // this.$message.warning("开发中...");
  183. // return;
  184. this.buildTitle = "添加建筑";
  185. this.$refs.addBuildDialog.showDialog();
  186. this.handleSearchBuildKey();
  187. },
  188. handleSearchBuildKey() {
  189. let params = {
  190. type: "building",
  191. pageNumber: 1,
  192. pageSize: 1000,
  193. orders: "sort asc, name desc",
  194. };
  195. DicController.getDataDictionary(params).then((res) => {
  196. let first = {};
  197. //一级循环出来一级标签
  198. let list = res.content.filter((i) => i.firstName !== "工作历" && i.firstName !== "能耗信息" && i.firstName !== "人员信息");
  199. list.map((item) => {
  200. // console.table(item.category, item.dataType)
  201. const category = ["ENUM", "MENUM", "BOOLEAN"];
  202. if (item.category == "STATIC" && item.dataType.includes(category) && item.dataSource) {
  203. item.options = item.dataSource;
  204. item.props = {
  205. value: "code",
  206. label: "name",
  207. children: "content",
  208. checkStrictly: true,
  209. };
  210. }
  211. if (first[item.firstName] && first[item.firstName].length) {
  212. } else {
  213. first[item.firstName] = [];
  214. }
  215. if (item.path !== "infos.areaTree") {
  216. //DefaultQRCode,BuildQRCode 不再维护
  217. first[item.firstName].push({
  218. InfoPointName: item.name,
  219. InfoPointCode: item.code,
  220. Visible: item.visible,
  221. UnDisabled: item.unDisabled,
  222. SecondName: item.secondName ? item.secondName : "",
  223. options: item.dataSource,
  224. props: item.props,
  225. Unit: item.unit,
  226. Path: item.path,
  227. dataType: item.dataType,
  228. category: item.category,
  229. editable: item.editable,
  230. });
  231. }
  232. });
  233. this.buildMessage = first;
  234. });
  235. },
  236. //delete build ,根据id删除建筑信息
  237. delBuild() {
  238. this.delText = "建筑";
  239. this.delDialogVis = true;
  240. },
  241. //edit build
  242. editBuild() {
  243. this.buildTitle = "编辑建筑";
  244. this.handleSearchBuildKey();
  245. let list = this.currentBuildList.filter((i) => i.id === this.curBuildId);
  246. let obj = {};
  247. for (let i = 0; i < list.length; i++) {
  248. obj = list[i];
  249. }
  250. this.$refs.addBuildDialog.showDialog(obj);
  251. },
  252. handleFile(val, name) {},
  253. // handleBuild 获取建筑信息
  254. handleBuild(val) {
  255. let newform = tools.formatData(val);
  256. let Param = {
  257. content: [newform],
  258. };
  259. if (newform.id) {
  260. ScanController.objectUpdateBuild(Param).then((res) => {
  261. this.$message.success("更新成功");
  262. this.$refs.addBuildDialog.closeDialog();
  263. });
  264. } else {
  265. ScanController.objectCreateBuild(Param).then((res) => {
  266. this.$message.success("创建成功");
  267. this.$refs.addBuildDialog.closeDialog();
  268. });
  269. }
  270. setTimeout(() => {
  271. this.handleBuildQuery();
  272. this.init();
  273. }, 500);
  274. },
  275. //delete floor
  276. handleDelete(floor) {
  277. this.delText = "楼层";
  278. this.delDialogVis = true;
  279. this.curFloorId = floor.id;
  280. },
  281. //确认删除弹窗关闭
  282. handleClose() {},
  283. addFloor() {
  284. this.curFloorId = "";
  285. this.floorTitle = "添加楼层";
  286. this.$refs.addFloorDialog.showDialog();
  287. },
  288. // 获取列表
  289. getFloorTableData() {
  290. let floorParam = {
  291. cascade: [{ name: "floorThroughList" }],
  292. orders: "floorSequenceID desc",
  293. pageNumber: this.page.pageNumber,
  294. pageSize: this.page.pageSize,
  295. filters: `buildingId='${this.curBuildId}'`,
  296. };
  297. ScanController.floorQueryAndSign(floorParam).then((res) => {
  298. this.tableData = res.content;
  299. this.page.total = res.total;
  300. });
  301. },
  302. // 创建楼层成功-修改关系成功
  303. refresh() {
  304. this.getFloorTableData();
  305. },
  306. // 确认删除(删除建筑-楼层公用)
  307. confirmDel() {
  308. if (this.delText == "楼层") {
  309. let delParam = [{ id: this.curFloorId }];
  310. this.delDialogVis = false;
  311. ScanController.deleteFloorInfo(delParam).then((res) => {
  312. this.$message.success("删除成功");
  313. this.init();
  314. });
  315. } else {
  316. // 删除建筑
  317. if (this.tableData && this.tableData.length) {
  318. this.$message.error("当前建筑中包含楼层,不可删除");
  319. this.delDialogVis = false;
  320. } else {
  321. let param = [{ id: this.curBuildId }];
  322. this.delDialogVis = false;
  323. ScanController.deleteBuildInfo(param).then((res) => {
  324. this.$message.success("删除成功");
  325. this.handleBuildQuery();
  326. this.init();
  327. });
  328. }
  329. }
  330. },
  331. // 修改楼层信息
  332. editFloorData(floor) {
  333. this.floorTitle = "编辑楼层信息";
  334. this.curFloorId = floor.id;
  335. this.$refs.addFloorDialog.showDialog(floor);
  336. },
  337. // 修改楼层贯通关系
  338. changeConnection(row) {
  339. this.$refs.addConnectivity.showDialog();
  340. this.$refs.addConnectivity.floor = row;
  341. },
  342. // 查看平面图
  343. checkDrawImg(row, index) {
  344. if (3 == index) {
  345. this.modelId = "";
  346. } else if (index == 1) {
  347. this.modelId = row.infos.floorMap;
  348. } else {
  349. this.modelId = row.modelId;
  350. }
  351. const pa = { modelId: this.modelId, FloorID: row.id, BuildID: row.buildingId, BuildName: this.curBuildName, FloorName: row.localName };
  352. this.$router.push({ name: "repetitionGraphy", query: pa });
  353. },
  354. // 查询建筑信息
  355. handleBuildQuery() {
  356. let param = {
  357. projectId: this.projectId,
  358. orders: "localName asc",
  359. pageNumber: 1,
  360. pageSize: 500,
  361. };
  362. ScanController.objectQueryBuild(param).then((res) => {
  363. this.currentBuildList = res.content;
  364. });
  365. },
  366. },
  367. watch: {
  368. projectId() {
  369. this.init();
  370. },
  371. },
  372. };
  373. </script>
  374. <style lang="less" scoped>
  375. #bd-fl-manage {
  376. overflow: hidden;
  377. height: 100%;
  378. position: relative;
  379. .el-row {
  380. height: 100%;
  381. .el-col-4 {
  382. width: 17%;
  383. }
  384. .el-col-20 {
  385. width: 82%;
  386. }
  387. & > div {
  388. float: left;
  389. height: 100%;
  390. overflow: hidden;
  391. background-color: #fff;
  392. box-sizing: border-box;
  393. border: 1px solid #dfe6ec;
  394. .action-box {
  395. padding: 10px;
  396. .el-button--small {
  397. padding: 10px 11px;
  398. }
  399. }
  400. }
  401. .l-list {
  402. width: 17%;
  403. overflow-y: auto;
  404. h4 {
  405. padding-left: 10px;
  406. border-top: 1px solid #d9d9d9;
  407. border-bottom: 1px solid #d9d9d9;
  408. background: #d9d9d9;
  409. color: #2b2b2b;
  410. line-height: 44px;
  411. }
  412. .build-list {
  413. line-height: 48px;
  414. .floor-item {
  415. white-space: nowrap;
  416. overflow: hidden;
  417. text-overflow: ellipsis;
  418. span {
  419. margin-left: 10px;
  420. }
  421. }
  422. .floor-item.active,
  423. .floor-item:hover {
  424. background-color: #f5f7fa;
  425. color: #000;
  426. }
  427. }
  428. }
  429. .r-table {
  430. width: 82%;
  431. margin-left: 1%;
  432. .table-box {
  433. height: calc(100% - 54px);
  434. margin-bottom: 8px;
  435. .iconfont {
  436. vertical-align: middle;
  437. }
  438. /deep/ .el-badge__content.is-fixed {
  439. transform: translateY(-6%) translateX(-100%);
  440. }
  441. p {
  442. cursor: pointer;
  443. }
  444. }
  445. }
  446. }
  447. }
  448. </style>