index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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 size="small" type="default" icon="el-icon-plus" @click="addBuild"></el-button>
  8. <el-button size="small" type="default" icon="el-icon-minus" @click="delBuild"></el-button>
  9. <el-button size="small" type="default" icon="el-icon-edit-outline" @click="editBuild"></el-button>
  10. </div>
  11. </div>
  12. <h4>建筑</h4>
  13. <div class="build-list">
  14. <div v-for="(item,index) in buildList" :key="item.BuildID" :class="{'floor-item':true,active:item.active}" @click="changeBuild(index)">
  15. <span>
  16. {{item.BuildLocalName || item.BuildName}}
  17. <el-badge class="mark" :is-dot="false" />
  18. </span>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="r-table">
  23. <div class="action-box">
  24. <el-button size="small" type="default" @click="addFloor">添加楼层</el-button>
  25. </div>
  26. <div class="table-box">
  27. <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
  28. <el-table-column label="楼层本地名">
  29. <template slot-scope="scope">{{scope.row.FloorLocalName||scope.row.FloorName}}</template>
  30. </el-table-column>
  31. <el-table-column label="楼层信息">
  32. <template slot-scope="scope">
  33. <el-button size="mini" @click="editFloorData(scope.row)" plain icon="el-icon-edit-outline"></el-button>
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="Datasource" label="平面图">
  37. <template slot-scope="scope">
  38. <p v-if="scope.row.StructureInfo&&scope.row.StructureInfo.FloorMap" @click="checfDrawImg(scope.row,1)">
  39. <i class="iconfont icon-floorplan"></i>
  40. 查看平面图
  41. </p>
  42. <p v-else-if="scope.row.type==2" @click="checfDrawImg(scope.row,2)">
  43. <el-badge is-dot>
  44. <i class="iconfont icon-floorplan"></i>
  45. </el-badge>平面图重复
  46. </p>
  47. <p v-else @click="checfDrawImg(scope.row,3)">
  48. <i class="iconfont icon-nopicture"></i>
  49. 暂无平面图
  50. </p>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="SubTypeName" label="楼层贯通关系">
  54. <template slot-scope="scope">
  55. <span style="margin-right:20px">{{scope.row.FloorThroughList?scope.row.FloorThroughList.length:0}}</span>
  56. <el-button size="mini" @click="changeConnection(scope.row)" plain icon="el-icon-edit-outline"></el-button>
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="action" label="操作">
  60. <template slot-scope="scope">
  61. <el-button size="mini" @click="handleDelete(scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. </div>
  66. <!-- 分页 -->
  67. <el-pagination class="fr" v-show="tableData && tableData.length" @size-change="handleSizeChange" @current-change="handleCurrentChange"
  68. :current-page="page.pageNumber" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout="total, sizes, prev, pager, next, jumper"
  69. :total="page.total"></el-pagination>
  70. </div>
  71. </el-row>
  72. <!-- 添加-修改楼层 -->
  73. <addFloor :title="floorTitle" ref="addFloorDialog" :curBuildId="curBuildId" :curFloorId="curFloorId" @refresh="refresh"></addFloor>
  74. <!-- 添加-修改建筑 -->
  75. <addBuild :title="buildTitle" ref="addBuildDialog"></addBuild>
  76. <!-- 删除建筑-删除楼层 -->
  77. <el-dialog title="提示" :visible.sync="delDialogVis" width="20%" @close="handleClose" id="messageDialog">
  78. <div>确定要删除该{{delText}}?</div>
  79. <span slot="footer" class="dialog-footer">
  80. <el-button size="small" @click="delDialogVis=false">取消</el-button>
  81. <el-button size="small" type="primary" @click="confirmDel">确认</el-button>
  82. </span>
  83. </el-dialog>
  84. <!-- 添加贯通关系弹窗 -->
  85. <addConnectivity ref="addConnectivity" @refresh="refresh"></addConnectivity>
  86. <!-- 查看图片弹窗 -->
  87. <checkGraphy ref="checkGraphy" @refresh="refresh"></checkGraphy>
  88. </div>
  89. </template>
  90. <script>
  91. import addFloor from "@/views/ready/buildfloor/addFloor/index";
  92. import addBuild from "@/components/ready/buildfloor/addBuild";
  93. import { mapGetters, mapActions } from "vuex";
  94. import addConnectivity from "@/components/ready/buildfloor/addConnectivity";
  95. import checkGraphy from "./drawGraphy/checkGraphy"; //查看图片
  96. import { buildingQuery, floorQuery, manageDeleteFloor } from "@/api/scan/request";
  97. export default {
  98. components: {
  99. addFloor,
  100. addBuild,
  101. addConnectivity,
  102. checkGraphy
  103. },
  104. data() {
  105. return {
  106. repetitionGraphyVisible: false, // 替换平面图弹窗
  107. floorTitle: "添加楼层",
  108. buildTitle: "添加建筑",
  109. delDialogVis: false,
  110. delText: "建筑",
  111. headerStyle: {
  112. backgroundColor: "#d9d9d9",
  113. color: "#2b2b2b",
  114. lineHeight: "30px"
  115. },
  116. buildList: [],
  117. tableData: [
  118. {
  119. EquipmentMark: 1
  120. }
  121. ],
  122. page: {
  123. pageSize: 50,
  124. pageSizes: [10, 20, 50, 100],
  125. pageNumber: 1,
  126. total: 0
  127. },
  128. loading: false, //列表loading
  129. curBuildId: "", //当前选中的建筑id
  130. curFloorId: "", //当前选中的楼层id
  131. jsonKey: "",
  132. };
  133. },
  134. computed: {
  135. ...mapGetters("layout", ["projectId"])
  136. },
  137. mounted() { },
  138. created() {
  139. this.init();
  140. },
  141. methods: {
  142. init() {
  143. let bdParam = {
  144. PageNumber: 1,
  145. PageSize: 500
  146. };
  147. buildingQuery(bdParam, res => {
  148. this.buildList = res.Content;
  149. if (this.buildList.length) {
  150. this.changeBuild(0);
  151. }
  152. });
  153. },
  154. //change build
  155. changeBuild(index) {
  156. this.buildList.map(item => {
  157. item.active = false;
  158. return item;
  159. });
  160. this.buildList[index].active = true;
  161. this.curBuildId = this.buildList[index].BuildID;
  162. this.getFloorTableData();
  163. this.$forceUpdate();
  164. },
  165. //add build
  166. addBuild() {
  167. this.$message.warning("开发中...");
  168. return;
  169. this.$refs.addBuildDialog.showDialog();
  170. },
  171. //delete build
  172. delBuild() {
  173. this.$message.warning("开发中...");
  174. return;
  175. this.delText = "建筑";
  176. this.delDialogVis = true;
  177. },
  178. //edit build
  179. editBuild() {
  180. this.$message.warning("开发中...");
  181. return;
  182. },
  183. //delete floor
  184. handleDelete(floor) {
  185. this.delText = "楼层";
  186. this.delDialogVis = true;
  187. this.curFloorId = floor.FloorID;
  188. },
  189. //确认删除弹窗关闭
  190. handleClose() { },
  191. handleSizeChange(pageSize) { },
  192. handleCurrentChange(pageNumber) { },
  193. addFloor() {
  194. this.curFloorId = "";
  195. this.$refs.addFloorDialog.showDialog();
  196. },
  197. // 获取列表
  198. getFloorTableData() {
  199. let floorParam = {
  200. Cascade: [{ Name: "floorThroughList" }],
  201. Orders: "FloorSequenceID desc",
  202. PageNumber: this.page.pageNumber,
  203. PageSize: this.page.pageSize,
  204. Filters: `BuildID='${this.curBuildId}'`
  205. };
  206. floorQuery(floorParam, res => {
  207. this.tableData = res.Content;
  208. this.page.total = res.Total;
  209. });
  210. },
  211. // 创建楼层成功-修改关系成功
  212. refresh() {
  213. this.getFloorTableData();
  214. },
  215. // 确认删除(删除建筑-楼层公用)
  216. confirmDel() {
  217. if (this.delText == "楼层") {
  218. let delParam = [{ FloorID: this.curFloorId }];
  219. manageDeleteFloor(delParam, res => {
  220. this.$message.success("删除成功");
  221. this.delDialogVis = false;
  222. this.getFloorTableData();
  223. });
  224. } else {
  225. //todo
  226. }
  227. },
  228. // 修改楼层信息
  229. editFloorData(floor) {
  230. this.floorTitle = "编辑楼层信息";
  231. this.curFloorId = floor.FloorID;
  232. this.$refs.addFloorDialog.showDialog(floor);
  233. },
  234. // 修改楼层贯通关系
  235. changeConnection(row) {
  236. this.$refs.addConnectivity.showDialog();
  237. this.$refs.addConnectivity.floor = row;
  238. },
  239. // 查看平面图
  240. checfDrawImg(row, index) {
  241. if (3 == index) {
  242. this.$refs.checkGraphy.showDialog(row)
  243. this.jsonKey = "";
  244. } else {
  245. this.jsonKey = row.StructureInfo.FloorMap;
  246. this.$router.push({ name: "repetitionGraphy", query: { jsonKey: this.jsonKey } });
  247. }
  248. }
  249. },
  250. watch: {
  251. projectId() {
  252. this.init();
  253. }
  254. }
  255. };
  256. </script>
  257. <style lang="less" scoped>
  258. #bd-fl-manage {
  259. overflow: hidden;
  260. height: 100%;
  261. position: relative;
  262. .el-row {
  263. height: 100%;
  264. & > div {
  265. float: left;
  266. height: 100%;
  267. overflow: hidden;
  268. background-color: #fff;
  269. box-sizing: border-box;
  270. border: 1px solid #dfe6ec;
  271. .action-box {
  272. padding: 10px;
  273. .el-button--small {
  274. padding: 10px 11px;
  275. }
  276. }
  277. }
  278. .l-list {
  279. width: 17%;
  280. overflow-y: auto;
  281. h4 {
  282. padding-left: 10px;
  283. border-top: 1px solid #d9d9d9;
  284. border-bottom: 1px solid #d9d9d9;
  285. background: #d9d9d9;
  286. color: #2b2b2b;
  287. line-height: 44px;
  288. }
  289. .build-list {
  290. line-height: 48px;
  291. .floor-item {
  292. white-space: nowrap;
  293. overflow: hidden;
  294. text-overflow: ellipsis;
  295. span {
  296. margin-left: 10px;
  297. }
  298. }
  299. .floor-item.active,
  300. .floor-item:hover {
  301. background-color: #f5f7fa;
  302. color: #000;
  303. }
  304. }
  305. }
  306. .r-table {
  307. width: 82%;
  308. margin-left: 1%;
  309. .table-box {
  310. height: calc(100% - 106px);
  311. margin-bottom: 8px;
  312. .iconfont {
  313. vertical-align: middle;
  314. }
  315. /deep/ .el-badge__content.is-fixed {
  316. transform: translateY(-6%) translateX(-100%);
  317. }
  318. p {
  319. cursor: pointer;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. </style>