index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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. <!-- 查看图片弹窗 -->
  124. <checkGraphy :alreadyRelatedModel='alreadyRelatedModel' @refresh="bindRefresh" ref="checkGraphy"></checkGraphy>
  125. </div>
  126. </template>
  127. <script>
  128. import addFloor from "@/views/ready/buildfloor/addFloor/index";
  129. import addBuild from "@/components/ready/buildfloor/addBuild";
  130. import {mapGetters} from "vuex";
  131. import addConnectivity from "@/components/ready/buildfloor/addConnectivity";
  132. import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
  133. import tools from "@/utils/buildfloor/tools";
  134. import {
  135. buildingQueryAndCount,
  136. floorQueryAndSign,
  137. getDataDictionary,
  138. manageDeleteFloor,
  139. objectCreateBuild,
  140. objectDeleteBuild,
  141. objectQueryBuild,
  142. objectUpdateBuild
  143. } from "@/api/scan/request";
  144. export default {
  145. components: {
  146. addFloor,
  147. addBuild,
  148. addConnectivity,
  149. checkGraphy
  150. },
  151. data() {
  152. return {
  153. repetitionGraphyVisible: false, // 替换平面图弹窗
  154. floorTitle: "添加楼层",
  155. buildTitle: "添加建筑",
  156. delDialogVis: false,
  157. buildDisabled: false,
  158. delText: "建筑",
  159. headerStyle: {
  160. backgroundColor: "#d9d9d9",
  161. color: "#2b2b2b",
  162. lineHeight: "30px"
  163. },
  164. buildList: [],
  165. tableData: [],
  166. page: {
  167. pageSize: 500,
  168. pageSizes: [10, 20, 50, 100],
  169. pageNumber: 1,
  170. total: 0
  171. },
  172. loading: false, //列表loading
  173. curBuildId: "", //当前选中的建筑id
  174. curBuildName: "", //当前选中建筑的名称
  175. curFloorId: "", //当前选中的楼层id
  176. modelId: "",
  177. alreadyRelatedModel: [],
  178. // currentType: 'add'
  179. buildMessage: {},
  180. selectedBuildIndex: 0
  181. };
  182. },
  183. computed: {
  184. ...mapGetters("layout", ["projectId"])
  185. },
  186. mounted() {
  187. },
  188. created() {
  189. this.init();
  190. this.handleBuildQuery()
  191. this.handleSearchBuildKey()
  192. },
  193. methods: {
  194. init() {
  195. let bdParam = {
  196. Orders: "BuildLocalName asc",
  197. PageNumber: 1,
  198. PageSize: 500
  199. };
  200. buildingQueryAndCount(bdParam, res => {
  201. this.buildList = res.Content;
  202. if (this.buildList.length) {
  203. this.changeBuild(this.selectedBuildIndex);
  204. }
  205. });
  206. },
  207. //change build
  208. changeBuild(index) {
  209. this.selectedBuildIndex = index;
  210. this.buildList.map(item => {
  211. item.active = false;
  212. return item;
  213. });
  214. this.buildList[index].active = true;
  215. this.curBuildId = this.buildList[index].BuildID;
  216. this.curBuildName = this.buildList[index].BuildLocalName || this.buildList[index].BuildName;
  217. this.getFloorTableData();
  218. this.$forceUpdate();
  219. },
  220. //add build
  221. addBuild() {
  222. // this.$message.warning("开发中...");
  223. // return;
  224. this.buildTitle = '添加建筑';
  225. this.$refs.addBuildDialog.showDialog();
  226. this.handleSearchBuildKey()
  227. },
  228. handleSearchBuildKey() {
  229. let params = {
  230. projectId: this.projectId,
  231. data: {
  232. Orders: "sort asc,InfoPointCode asc",
  233. PageNumber: 1,
  234. PageSize: 1000
  235. },
  236. type: 'Building'
  237. };
  238. getDataDictionary(params, res => {
  239. let first = {}
  240. //一级循环出来一级标签
  241. let list = res.Content.filter(i => (i.FirstName !== '工作历') && (i.FirstName !== '能耗信息') && (i.FirstName !== '人员信息'))
  242. list.map(item => {
  243. // console.log(item.FirstName)
  244. if ((item.InputMode === 'D1' || item.InputMode === 'D2' || item.InputMode === 'E2' || item.InputMode === 'D1L') && item.DataSource) {
  245. item.options = JSON.parse(item.DataSource)
  246. if (item.options[0] && item.options[0].Content) {
  247. item.props = {
  248. value: 'Code',
  249. label: 'Name',
  250. children: 'Content',
  251. checkStrictly: true
  252. }
  253. }
  254. }
  255. if (first[item.FirstName] && first[item.FirstName].length) {
  256. } else {
  257. first[item.FirstName] = []
  258. }
  259. if (
  260. item.Path !== 'BuildingInfo.AreaInfo.AreaTree' &&
  261. item.Path !== 'DefaultQRCode' &&
  262. item.Path !== 'BuildQRCode'
  263. ) {
  264. first[item.FirstName].push({
  265. InfoPointName: item.InfoPointName,
  266. InfoPointCode: item.InfoPointCode,
  267. Visible: item.Visible,
  268. UnDisabled: item.UnDisabled,
  269. SecondName: item.SecondName ? item.SecondName : "",
  270. InputMode: item.InputMode,
  271. options: item.options,
  272. props:item.props,
  273. Unit: item.Unit,
  274. Path: item.Path
  275. })
  276. }
  277. })
  278. this.buildMessage = first
  279. })
  280. },
  281. //delete build ,根据id删除建筑信息
  282. delBuild() {
  283. this.delText = '建筑'
  284. this.delDialogVis = true;
  285. },
  286. //edit build
  287. editBuild() {
  288. this.buildTitle = '编辑建筑';
  289. this.handleSearchBuildKey()
  290. let list = this.currentBuildList.filter(i => i.BuildID === this.curBuildId)
  291. let obj = {}
  292. for (let i = 0; i < list.length; i++) {
  293. obj = list[i]
  294. }
  295. this.$refs.addBuildDialog.showDialog(obj);
  296. },
  297. handleFile(val,name) {
  298. },
  299. // handleBuild 获取建筑信息
  300. handleBuild(val) {
  301. let newform = tools.formatData(val)
  302. let Param = {
  303. Content: [newform]
  304. }
  305. if (newform.BuildID) {
  306. objectUpdateBuild(Param, res => {
  307. this.$message.success('更新成功')
  308. this.$refs.addBuildDialog.closeDialog()
  309. })
  310. } else {
  311. objectCreateBuild(Param, res => {
  312. this.$message.success('创建成功')
  313. this.$refs.addBuildDialog.closeDialog()
  314. })
  315. }
  316. setTimeout(() => {
  317. this.handleBuildQuery()
  318. this.init()
  319. })
  320. },
  321. //delete floor
  322. handleDelete(floor) {
  323. this.delText = "楼层";
  324. this.delDialogVis = true;
  325. this.curFloorId = floor.FloorID;
  326. },
  327. //确认删除弹窗关闭
  328. handleClose() {
  329. },
  330. addFloor() {
  331. this.curFloorId = "";
  332. this.floorTitle = "添加楼层";
  333. this.$refs.addFloorDialog.showDialog();
  334. },
  335. // 获取列表
  336. getFloorTableData() {
  337. let floorParam = {
  338. Cascade: [{Name: "floorThroughList"}],
  339. Orders: "FloorSequenceID desc",
  340. PageNumber: this.page.pageNumber,
  341. PageSize: this.page.pageSize,
  342. Filters: `BuildID='${this.curBuildId}'`
  343. };
  344. floorQueryAndSign(floorParam, res => {
  345. this.tableData = res.Content;
  346. this.page.total = res.Total;
  347. this.alreadyRelatedModel = res.Content.map(t => {
  348. return t.ModelId
  349. }).filter(t => t);
  350. });
  351. },
  352. // 绑定图以后刷新
  353. bindRefresh() {
  354. this.init();
  355. },
  356. // 创建楼层成功-修改关系成功
  357. refresh() {
  358. this.getFloorTableData();
  359. },
  360. // 确认删除(删除建筑-楼层公用)
  361. confirmDel() {
  362. this.buildDisabled = true
  363. if (this.delText == "楼层") {
  364. let delParam = [{FloorID: this.curFloorId}];
  365. this.$message.success("删除成功");
  366. this.delDialogVis = false;
  367. manageDeleteFloor(delParam, res => {
  368. this.buildDisabled = false
  369. this.init();
  370. });
  371. } else {
  372. // 删除建筑
  373. if (this.tableData && this.tableData.length) {
  374. this.buildDisabled = false
  375. this.$message.error("当前建筑中包含楼层,不可删除");
  376. this.delDialogVis = false;
  377. } else {
  378. let param = [{BuildId: this.curBuildId}];
  379. this.$message.success("删除成功");
  380. this.delDialogVis = false;
  381. objectDeleteBuild(param, res => {
  382. this.buildDisabled = false
  383. this.handleBuildQuery()
  384. this.init()
  385. })
  386. }
  387. }
  388. },
  389. // 修改楼层信息
  390. editFloorData(floor) {
  391. this.floorTitle = "编辑楼层信息";
  392. this.curFloorId = floor.FloorID;
  393. this.$refs.addFloorDialog.showDialog(floor);
  394. },
  395. // 修改楼层贯通关系
  396. changeConnection(row) {
  397. this.$refs.addConnectivity.showDialog();
  398. this.$refs.addConnectivity.floor = row;
  399. },
  400. // 查看平面图
  401. checkDrawImg(row, index) {
  402. if (3 == index) {
  403. this.$refs.checkGraphy.showDialog(row);
  404. this.modelId = "";
  405. } else {
  406. this.modelId = row.ModelId;
  407. let pa = {modelId: this.modelId, FloorID: row.FloorID, BuildID: row.BuildID, BuildName: this.curBuildName};
  408. this.$router.push({name: "repetitionGraphy", query: pa});
  409. }
  410. },
  411. // 查询建筑信息
  412. handleBuildQuery() {
  413. let param = {
  414. projectId: this.projectId,
  415. Orders: "BuildLocalName asc",
  416. PageNumber: 1,
  417. PageSize: 500
  418. };
  419. objectQueryBuild(param, res => {
  420. this.currentBuildList = res.Content
  421. });
  422. },
  423. },
  424. watch: {
  425. projectId() {
  426. this.init();
  427. }
  428. }
  429. };
  430. </script>
  431. <style lang="less" scoped>
  432. #bd-fl-manage {
  433. overflow: hidden;
  434. height: 100%;
  435. position: relative;
  436. .el-row {
  437. height: 100%;
  438. .el-col-4 {
  439. width: 17%;
  440. }
  441. .el-col-20 {
  442. width: 82%;
  443. }
  444. & > div {
  445. float: left;
  446. height: 100%;
  447. overflow: hidden;
  448. background-color: #fff;
  449. box-sizing: border-box;
  450. border: 1px solid #dfe6ec;
  451. .action-box {
  452. padding: 10px;
  453. .el-button--small {
  454. padding: 10px 11px;
  455. }
  456. }
  457. }
  458. .l-list {
  459. width: 17%;
  460. overflow-y: auto;
  461. h4 {
  462. padding-left: 10px;
  463. border-top: 1px solid #d9d9d9;
  464. border-bottom: 1px solid #d9d9d9;
  465. background: #d9d9d9;
  466. color: #2b2b2b;
  467. line-height: 44px;
  468. }
  469. .build-list {
  470. line-height: 48px;
  471. .floor-item {
  472. white-space: nowrap;
  473. overflow: hidden;
  474. text-overflow: ellipsis;
  475. span {
  476. margin-left: 10px;
  477. }
  478. }
  479. .floor-item.active,
  480. .floor-item:hover {
  481. background-color: #f5f7fa;
  482. color: #000;
  483. }
  484. }
  485. }
  486. .r-table {
  487. width: 82%;
  488. margin-left: 1%;
  489. .table-box {
  490. height: calc(100% - 54px);
  491. margin-bottom: 8px;
  492. .iconfont {
  493. vertical-align: middle;
  494. }
  495. /deep/ .el-badge__content.is-fixed {
  496. transform: translateY(-6%) translateX(-100%);
  497. }
  498. p {
  499. cursor: pointer;
  500. }
  501. }
  502. }
  503. }
  504. }
  505. </style>