123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467 |
- <template>
- <div id="bd-fl-manage">
- <el-row>
- <div class="l-list">
- <div class="action-box">
- <div>
- <el-button @click="addBuild" icon="el-icon-plus" size="small" type="default" />
- <el-button @click="delBuild" icon="el-icon-minus" size="small" type="default" :disabled="!buildList.length" />
- <el-button @click="editBuild" icon="el-icon-edit-outline" size="small" type="default" :disabled="!buildList.length" />
- </div>
- </div>
- <h4>建筑</h4>
- <div class="build-list">
- <div
- :class="{ 'floor-item': true, active: item.active }"
- :key="item.id"
- @click="changeBuild(index)"
- style="cursor: pointer"
- v-for="(item, index) in buildList"
- >
- <span>
- {{ item.localName || item.name }}
- <el-badge :value="item.count" class="mark" v-if="item.count > 0" />
- </span>
- </div>
- </div>
- </div>
- <div class="r-table" v-if="buildList.length > 0">
- <div class="action-box">
- <el-button @click="addFloor" size="small" type="default">添加楼层 </el-button>
- </div>
- <div class="table-box">
- <el-table :data="tableData" :header-cell-style="headerStyle" height="100%" style="width: 100%" v-loading="loading">
- <el-table-column label="楼层本地名">
- <template slot-scope="scope">{{ scope.row.localName }}</template>
- </el-table-column>
- <el-table-column label="楼层顺序号">
- <template slot-scope="scope">{{ scope.row.floorSequenceID }}</template>
- </el-table-column>
- <el-table-column label="楼层信息">
- <template slot-scope="scope">
- <el-button @click="editFloorData(scope.row)" icon="el-icon-edit-outline" plain size="mini"></el-button>
- </template>
- </el-table-column>
- <el-table-column label="平面图" prop="dataSource">
- <template slot-scope="scope">
- <p @click="checkDrawImg(scope.row, 2)" v-if="scope.row.sign > 0">
- <el-badge is-dot>
- <i class="iconfont icon-floorplan" />
- </el-badge>
- 平面图重复
- </p>
- <p @click="checkDrawImg(scope.row, 1)" v-else-if="scope.row.infos ? scope.row.infos.floorMap : false">
- <i class="iconfont icon-floorplan" />
- 查看平面图
- </p>
- <p @click="checkDrawImg(scope.row, 3)" v-else>
- <i class="iconfont icon-nopicture" />
- 暂无平面图
- </p>
- </template>
- </el-table-column>
- <el-table-column label="楼层贯通关系" prop="SubTypeName">
- <template slot-scope="scope">
- <span style="margin-right: 20px">{{ scope.row.floorThroughList ? scope.row.floorThroughList.length : 0 }}</span>
- <el-button @click="changeConnection(scope.row)" icon="el-icon-edit-outline" plain size="mini" />
- </template>
- </el-table-column>
- <el-table-column label="操作" prop="action">
- <template slot-scope="scope">
- <el-button @click="handleDelete(scope.row)" icon="el-icon-delete" plain size="mini" type="danger" />
- </template>
- </el-table-column>
- </el-table>
- </div>
- </div>
- <div v-else class="r-table">
- <div class="center" style="margin-top: 300px"><i class="icon-wushuju iconfont"></i> 请先在左侧创建建筑</div>
- </div>
- </el-row>
- <!-- 添加-修改楼层 -->
- <addFloor :curBuildId="curBuildId" :curFloorId="curFloorId" :title="floorTitle" @refresh="refresh" ref="addFloorDialog" />
- <!-- 添加-修改建筑 :currentType="currentType"-->
- <addBuild :buildTitle="buildTitle" ref="addBuildDialog" :buildMessage="buildMessage" @handleBuild="handleBuild" />
- <!-- 删除建筑-删除楼层 -->
- <el-dialog :visible.sync="delDialogVis" @close="handleClose" id="messageDialog" title="提示" width="20%">
- <div>确定要删除该{{ delText }}?</div>
- <span class="dialog-footer" slot="footer">
- <el-button @click="delDialogVis = false" size="small">取消</el-button>
- <el-button @click="confirmDel" size="small" type="primary">确认</el-button>
- </span>
- </el-dialog>
- <!-- 添加贯通关系弹窗 -->
- <addConnectivity @refresh="refresh" ref="addConnectivity" />
- </div>
- </template>
- <script>
- import addFloor from "@/components/old-adm/ready/buildfloor/addFloor/index";
- import addBuild from "@/components/old-adm/ready/components/addBuild";
- import { mapGetters } from "vuex";
- import addConnectivity from "@/components/old-adm/ready/components/addConnectivity";
- import tools from "@/utils/old-adm/buildfloor/tools";
- import DicController from "@/controller/old-adm/dicController";
- import ScanController from "@/controller/old-adm/ScanController";
- export default {
- components: {
- addFloor,
- addBuild,
- addConnectivity,
- },
- data() {
- return {
- repetitionGraphyVisible: false, // 替换平面图弹窗
- floorTitle: "添加楼层",
- buildTitle: "添加建筑",
- delDialogVis: false,
- delText: "建筑",
- headerStyle: {
- backgroundColor: "#d9d9d9",
- color: "#2b2b2b",
- lineHeight: "30px",
- },
- buildList: [],
- tableData: [],
- page: {
- pageSize: 500,
- pageSizes: [10, 20, 50, 100],
- pageNumber: 1,
- total: 0,
- },
- loading: false, //列表loading
- curBuildId: "", //当前选中的建筑id
- curBuildName: "", //当前选中建筑的名称
- curFloorId: "", //当前选中的楼层id
- modelId: "",
- buildMessage: {},
- selectedBuildIndex: 0,
- };
- },
- computed: {
- ...mapGetters("layout", ["projectId"]),
- },
- mounted() {},
- created() {
- this.init();
- this.handleBuildQuery();
- this.handleSearchBuildKey();
- },
- methods: {
- init() {
- let bdParam = {
- orders: "localName asc",
- pageNumber: 1,
- pageSize: 500,
- };
- ScanController.buildingQueryAndCount(bdParam).then((res) => {
- this.buildList = res.content;
- if (this.buildList.length) {
- // 如果存在建筑id,则将当前选择建筑置为该建筑
- if (this.$route.query.buildingId) {
- this.selectedBuildIndex = this.buildList.findIndex((item) => item.id === this.$route.query.buildingId);
- }
- this.changeBuild(this.selectedBuildIndex > this.buildList.length - 1 ? 0 : this.selectedBuildIndex);
- }
- });
- },
- //change build
- changeBuild(index) {
- this.selectedBuildIndex = index;
- this.buildList.map((item) => {
- item.active = false;
- return item;
- });
- this.buildList[index].active = true;
- this.curBuildId = this.buildList[index].id;
- this.curBuildName = this.buildList[index].localName || this.buildList[index].name;
- this.getFloorTableData();
- this.$forceUpdate();
- },
- //add build
- addBuild() {
- // this.$message.warning("开发中...");
- // return;
- this.buildTitle = "添加建筑";
- this.$refs.addBuildDialog.showDialog();
- this.handleSearchBuildKey();
- },
- handleSearchBuildKey() {
- let params = {
- type: "building",
- pageNumber: 1,
- pageSize: 1000,
- orders: "sort asc, name desc",
- };
- DicController.getDataDictionary(params).then((res) => {
- let first = {};
- //一级循环出来一级标签
- let list = res.content.filter((i) => i.firstName !== "工作历" && i.firstName !== "能耗信息" && i.firstName !== "人员信息");
- list.map((item) => {
- // console.table(item.category, item.dataType)
- const category = ["ENUM", "MENUM", "BOOLEAN"];
- if (item.category == "STATIC" && item.dataType.includes(category) && item.dataSource) {
- item.options = item.dataSource;
- item.props = {
- value: "code",
- label: "name",
- children: "content",
- checkStrictly: true,
- };
- }
- if (first[item.firstName] && first[item.firstName].length) {
- } else {
- first[item.firstName] = [];
- }
- if (item.path !== "infos.areaTree") {
- //DefaultQRCode,BuildQRCode 不再维护
- first[item.firstName].push({
- InfoPointName: item.name,
- InfoPointCode: item.code,
- Visible: item.visible,
- UnDisabled: item.unDisabled,
- SecondName: item.secondName ? item.secondName : "",
- options: item.dataSource,
- props: item.props,
- Unit: item.unit,
- Path: item.path,
- dataType: item.dataType,
- category: item.category,
- editable: item.editable,
- });
- }
- });
- this.buildMessage = first;
- });
- },
- //delete build ,根据id删除建筑信息
- delBuild() {
- this.delText = "建筑";
- this.delDialogVis = true;
- },
- //edit build
- editBuild() {
- this.buildTitle = "编辑建筑";
- this.handleSearchBuildKey();
- let list = this.currentBuildList.filter((i) => i.id === this.curBuildId);
- let obj = {};
- for (let i = 0; i < list.length; i++) {
- obj = list[i];
- }
- this.$refs.addBuildDialog.showDialog(obj);
- },
- handleFile(val, name) {},
- // handleBuild 获取建筑信息
- handleBuild(val) {
- let newform = tools.formatData(val);
- let Param = {
- content: [newform],
- };
- if (newform.id) {
- ScanController.objectUpdateBuild(Param).then((res) => {
- this.$message.success("更新成功");
- this.$refs.addBuildDialog.closeDialog();
- });
- } else {
- ScanController.objectCreateBuild(Param).then((res) => {
- this.$message.success("创建成功");
- this.$refs.addBuildDialog.closeDialog();
- });
- }
- setTimeout(() => {
- this.handleBuildQuery();
- this.init();
- }, 500);
- },
- //delete floor
- handleDelete(floor) {
- this.delText = "楼层";
- this.delDialogVis = true;
- this.curFloorId = floor.id;
- },
- //确认删除弹窗关闭
- handleClose() {},
- addFloor() {
- this.curFloorId = "";
- this.floorTitle = "添加楼层";
- this.$refs.addFloorDialog.showDialog();
- },
- // 获取列表
- getFloorTableData() {
- let floorParam = {
- cascade: [{ name: "floorThroughList" }],
- orders: "floorSequenceID desc",
- pageNumber: this.page.pageNumber,
- pageSize: this.page.pageSize,
- filters: `buildingId='${this.curBuildId}'`,
- };
- ScanController.floorQueryAndSign(floorParam).then((res) => {
- this.tableData = res.content;
- this.page.total = res.total;
- });
- },
- // 创建楼层成功-修改关系成功
- refresh() {
- this.getFloorTableData();
- },
- // 确认删除(删除建筑-楼层公用)
- confirmDel() {
- if (this.delText == "楼层") {
- let delParam = [{ id: this.curFloorId }];
- this.delDialogVis = false;
- ScanController.deleteFloorInfo(delParam).then((res) => {
- this.$message.success("删除成功");
- this.init();
- });
- } else {
- // 删除建筑
- if (this.tableData && this.tableData.length) {
- this.$message.error("当前建筑中包含楼层,不可删除");
- this.delDialogVis = false;
- } else {
- let param = [{ id: this.curBuildId }];
- this.delDialogVis = false;
- ScanController.deleteBuildInfo(param).then((res) => {
- this.$message.success("删除成功");
- this.handleBuildQuery();
- this.init();
- });
- }
- }
- },
- // 修改楼层信息
- editFloorData(floor) {
- this.floorTitle = "编辑楼层信息";
- this.curFloorId = floor.id;
- this.$refs.addFloorDialog.showDialog(floor);
- },
- // 修改楼层贯通关系
- changeConnection(row) {
- this.$refs.addConnectivity.showDialog();
- this.$refs.addConnectivity.floor = row;
- },
- // 查看平面图
- checkDrawImg(row, index) {
- if (3 == index) {
- this.modelId = "";
- } else if (index == 1) {
- this.modelId = row.infos.floorMap;
- } else {
- this.modelId = row.modelId;
- }
- const pa = { modelId: this.modelId, FloorID: row.id, BuildID: row.buildingId, BuildName: this.curBuildName, FloorName: row.localName };
- this.$router.push({ name: "repetitionGraphy", query: pa });
- },
- // 查询建筑信息
- handleBuildQuery() {
- let param = {
- projectId: this.projectId,
- orders: "localName asc",
- pageNumber: 1,
- pageSize: 500,
- };
- ScanController.objectQueryBuild(param).then((res) => {
- this.currentBuildList = res.content;
- });
- },
- },
- watch: {
- projectId() {
- this.init();
- },
- },
- };
- </script>
- <style lang="less" scoped>
- #bd-fl-manage {
- overflow: hidden;
- height: 100%;
- position: relative;
- .el-row {
- height: 100%;
- .el-col-4 {
- width: 17%;
- }
- .el-col-20 {
- width: 82%;
- }
- & > div {
- float: left;
- height: 100%;
- overflow: hidden;
- background-color: #fff;
- box-sizing: border-box;
- border: 1px solid #dfe6ec;
- .action-box {
- padding: 10px;
- .el-button--small {
- padding: 10px 11px;
- }
- }
- }
- .l-list {
- width: 17%;
- overflow-y: auto;
- h4 {
- padding-left: 10px;
- border-top: 1px solid #d9d9d9;
- border-bottom: 1px solid #d9d9d9;
- background: #d9d9d9;
- color: #2b2b2b;
- line-height: 44px;
- }
- .build-list {
- line-height: 48px;
- .floor-item {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- span {
- margin-left: 10px;
- }
- }
- .floor-item.active,
- .floor-item:hover {
- background-color: #f5f7fa;
- color: #000;
- }
- }
- }
- .r-table {
- width: 82%;
- margin-left: 1%;
- .table-box {
- height: calc(100% - 54px);
- margin-bottom: 8px;
- .iconfont {
- vertical-align: middle;
- }
- /deep/ .el-badge__content.is-fixed {
- transform: translateY(-6%) translateX(-100%);
- }
- p {
- cursor: pointer;
- }
- }
- }
- }
- }
- </style>
|