index.vue 16 KB

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