|
@@ -0,0 +1,451 @@
|
|
|
+<template>
|
|
|
+ <div class="space-index">
|
|
|
+ <div class="space-null" v-if="list.length ==0">
|
|
|
+ <img :src="nullImage" alt="" />
|
|
|
+ <div class="space-null-text">您还未添加楼宇信息,可新增楼宇,开启您的空间设置吧!</div>
|
|
|
+ <div class="flow-button">
|
|
|
+ <el-button size="medium" type="primary" @click="insert('projectItem')">
|
|
|
+ <i class="iconfont huifont-xinzeng"></i>新增楼宇
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="space-content">
|
|
|
+ <div class="space-content-item">
|
|
|
+ <div class="space-title">
|
|
|
+ <div class="space-title-label">楼宇</div>
|
|
|
+ <el-button size="medium" type="primary" @click="insert('projectItem')">
|
|
|
+ <i class="iconfont huifont-xinzeng"></i>新增
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div class="space-content-box">
|
|
|
+ <div class="space-project-item" v-for="(item,index) in list" :key="item.id">
|
|
|
+ <div class="project-item-title">
|
|
|
+ <div class="project-item--label">{{item.name}}</div>
|
|
|
+ <el-dropdown trigger="click" @command="command=>commandFunc(command,item,'projectItem')">
|
|
|
+ <div class="target-item-icon">
|
|
|
+ <i class="iconfont huifont-jinhangzhong"></i>
|
|
|
+ </div>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="update">编辑</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="delete">删除</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </div>
|
|
|
+ <el-row class="project-item-traget" :gutter="10">
|
|
|
+ <el-col :span="8" v-for="(target,index) in item.projectItemTargetList" :key="target.id">
|
|
|
+ <div :class="targetData.id === target.id?'target-item active' : 'target-item'"
|
|
|
+ @click="selectTarget(item,target)">
|
|
|
+ <div class="target-item-num">{{target.elevation}}</div>
|
|
|
+ <div class="target-item-label">{{target.name}}</div>
|
|
|
+ <el-dropdown trigger="click"
|
|
|
+ @command="command=>commandFunc(command,target,'projectItemTarget')">
|
|
|
+ <div class="target-item-icon">
|
|
|
+ <i class="iconfont huifont-jinhangzhong"></i>
|
|
|
+ </div>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="update">编辑</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="delete">删除</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <div class="target-item-insert" @click="insert('projectItemTarget',item.id)">
|
|
|
+ <i class="iconfont huifont-xinzeng"></i>新增
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="space-line"></div>
|
|
|
+ <div class="space-content-item">
|
|
|
+ <div class="space-title">
|
|
|
+ <div class="space-title-label">{{projectItem.name}} / {{targetData.name}}</div>
|
|
|
+ <el-button size="medium" type="primary" @click="insert('room')">
|
|
|
+ <i class="iconfont huifont-xinzeng"></i>新增
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div class="space-content-box">
|
|
|
+ <div class="space-undefined" v-if="roomList.length === 0">
|
|
|
+ <img :src="undefinedImage" alt="" />
|
|
|
+ <div class="space-undefined-text">暂无数据</div>
|
|
|
+ </div>
|
|
|
+ <div class="space-room-list">
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="12" v-for="item in roomList" :key="roomList.id">
|
|
|
+ <div class="space-room-item">
|
|
|
+ <div class="space-room-num">{{targetData.elevation}}</div>
|
|
|
+ <div class="space-room-text">
|
|
|
+ <div class="space-room-label">{{item.name}}</div>
|
|
|
+ <div class="space-room-sub">{{item.remark}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="space-room-icon">
|
|
|
+ <el-dropdown trigger="click"
|
|
|
+ @command="command=>commandFunc(command,item,'room')">
|
|
|
+ <div class="target-item-icon">
|
|
|
+ <i class="iconfont huifont-jinhangzhong"></i>
|
|
|
+ </div>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="update">编辑</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="delete">删除</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-dialog :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="900px" :append-to-body="true">
|
|
|
+ <project-item-form v-if="visible && type === 'projectItem'" @callback="callback" :isUpdate="isUpdate"
|
|
|
+ :detailId="itemId"></project-item-form>
|
|
|
+ <project-item-target-form v-if="visible && type === 'projectItemTarget'" @callback="callback"
|
|
|
+ :isUpdate="isUpdate" :detailId="itemId" :projectItemId="projectItemId"></project-item-target-form>
|
|
|
+ <room-form v-if="visible && type === 'room'" @callback="callback" :isUpdate="isUpdate" :roomId="itemId"
|
|
|
+ :projectItemId="projectItem.id" :targetId="targetData.id">
|
|
|
+ </room-form>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ getProjectTreeList,
|
|
|
+ deleteProjectItemById,
|
|
|
+ deleteProjectItemTarget,
|
|
|
+ deleteRoom
|
|
|
+ } from '@/httpApi/work';
|
|
|
+ import projectItemForm from '@/components/work/space/set/projectItemForm'
|
|
|
+ // import projectItemTargetForm from '@/components/work/project/projectItemTargetForm'
|
|
|
+ // import roomForm from '@/components/work/space/roomForm'
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ nullImage: require('../../../../assets/image/common/dataNull.png'),
|
|
|
+ undefinedImage: require('../../../../assets/image/common/dataUndefined.png'),
|
|
|
+ list: [],
|
|
|
+ roomList: [],
|
|
|
+ visible: false,
|
|
|
+ itemId: '',
|
|
|
+ projectItemId: '',
|
|
|
+ isUpdate: false,
|
|
|
+ targetData: {},
|
|
|
+ projectItem: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getProjectItemList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getProjectItemList() {
|
|
|
+ getProjectTreeList(this.$store.getters.project.id).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ this.list = res.data.projectItemList || [];
|
|
|
+ if (this.targetData.id) {
|
|
|
+ let item = this.list.filter(node => node.id === this.projectItem.id);
|
|
|
+ if (item.length > 0) {
|
|
|
+ let traget = item[0].projectItemTargetList.filter(node => node.id === this
|
|
|
+ .targetData.id);
|
|
|
+ if (traget.length > 0) {
|
|
|
+ this.selectTarget(item[0], traget[0]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let data = this.list.filter(node => node.projectItemTargetList && node
|
|
|
+ .projectItemTargetList.length > 0);
|
|
|
+ if (data.length > 0) this.selectTarget(data[0], data[0].projectItemTargetList[0]);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ insert(type, projectItemId) {
|
|
|
+ this.type = type;
|
|
|
+ this.isUpdate = false;
|
|
|
+ this.visible = true;
|
|
|
+ if (projectItemId) this.projectItemId = projectItemId;
|
|
|
+ },
|
|
|
+ selectTarget(item, target) {
|
|
|
+ this.targetData = target;
|
|
|
+ this.projectItem = item;
|
|
|
+ this.roomList = target.projectItemTargetRoomList;
|
|
|
+ },
|
|
|
+ commandFunc(operationType, item, type) {
|
|
|
+ this.type = type;
|
|
|
+ this.itemId = item.id;
|
|
|
+ this[operationType]();
|
|
|
+ },
|
|
|
+ update() {
|
|
|
+ this.isUpdate = true;
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
+ delete() {
|
|
|
+ if (this.type === 'projectItem') {
|
|
|
+ this.$confirm('确定要删除该楼宇?', () => {
|
|
|
+ deleteProjectItemById(this.itemId).then(this.successFunc);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.type === 'projectItemTarget') {
|
|
|
+ this.$confirm('确定要删除该楼层?', () => {
|
|
|
+ deleteProjectItemTarget(this.itemId).then(this.successFunc);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this.type === 'room') {
|
|
|
+ this.$confirm('确定要删除该房间?', () => {
|
|
|
+ deleteRoom(this.itemId).then(this.successFunc);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ successFunc(res) {
|
|
|
+ if (res.state) {
|
|
|
+ this.getProjectItemList();
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ callback(type) {
|
|
|
+ this.visible = false;
|
|
|
+ if (type === 'init') this.getProjectItemList();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ projectItemForm,
|
|
|
+ // projectItemTargetForm,
|
|
|
+ // roomForm
|
|
|
+ },
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .space-index {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .space-null {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ img {
|
|
|
+ width: 420px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-null-text {
|
|
|
+ padding: 30px 0 20px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-button {
|
|
|
+ padding-left: 12px;
|
|
|
+
|
|
|
+ span {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .huifont-xinzeng {
|
|
|
+ padding-right: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-undefined {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ img {
|
|
|
+ width: 160px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-undefined-text {
|
|
|
+ margin-top: 20px;
|
|
|
+ opacity: 0.6;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-content {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+
|
|
|
+ .space-title {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 15px 20px;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .space-title-label {
|
|
|
+ font-size: 16px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-button {
|
|
|
+ padding: 8px 16px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-line {
|
|
|
+ background: $--background;
|
|
|
+ width: 12px;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-content-box {
|
|
|
+ flex: 1;
|
|
|
+ padding: 0 20px 15px 20px;
|
|
|
+ height: 0;
|
|
|
+ overflow-y: auto;
|
|
|
+
|
|
|
+ .space-project-item {
|
|
|
+ background: #242a36;
|
|
|
+ margin-bottom: 20px;
|
|
|
+ border-radius: 2px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-content-item {
|
|
|
+ flex: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+
|
|
|
+ .project-item-title {
|
|
|
+ height: 56px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ padding: 0 20px;
|
|
|
+ align-items: center;
|
|
|
+ border-bottom: 1px solid $--color-border;
|
|
|
+ }
|
|
|
+
|
|
|
+ .project-item-traget {
|
|
|
+ padding: 15px 20px;
|
|
|
+
|
|
|
+ .target-item {
|
|
|
+ width: 100%;
|
|
|
+ background: #1f242f;
|
|
|
+ padding: 15px;
|
|
|
+ border-radius: 8px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+ cursor: pointer;
|
|
|
+ box-sizing: border-box;
|
|
|
+ border: 1px solid #1f242f;
|
|
|
+ }
|
|
|
+
|
|
|
+ .target-item-insert {
|
|
|
+ width: 100%;
|
|
|
+ height: 70px;
|
|
|
+ border: 1px dashed $--color-border;
|
|
|
+ border-radius: 8px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ .huifont-xinzeng {
|
|
|
+ margin-right: 5px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .target-item-insert:hover {
|
|
|
+ border-color: $--color-primary;
|
|
|
+ color: $--color-primary;
|
|
|
+
|
|
|
+ .huifont-xinzeng {
|
|
|
+ color: $--color-primary;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .target-item.active,
|
|
|
+ .target-item:hover {
|
|
|
+ border-color: $--color-primary;
|
|
|
+ box-shadow: -1px -1px 10px 1px rgba(51, 133, 255, 0.2) inset;
|
|
|
+ }
|
|
|
+
|
|
|
+ .target-item-num {
|
|
|
+ width: 38px;
|
|
|
+ height: 38px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 38px;
|
|
|
+ background: #31353f;
|
|
|
+ border-radius: 10px;
|
|
|
+ margin-right: 10px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .target-item-label {
|
|
|
+ flex: 1;
|
|
|
+ width: 0;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .target-item-icon {
|
|
|
+ transform: rotate(90deg);
|
|
|
+ cursor: pointer;
|
|
|
+
|
|
|
+ .huifont-jinhangzhong {
|
|
|
+ font-size: 20px;
|
|
|
+ color: $--color-common;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-col {
|
|
|
+ padding-top: 5px;
|
|
|
+ padding-bottom: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-room-list {
|
|
|
+ .space-room-item {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 20px;
|
|
|
+ height: 110px;
|
|
|
+ background: #232A37;
|
|
|
+ border-radius: 8px;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .space-room-icon {
|
|
|
+ position: absolute;
|
|
|
+ top: 12px;
|
|
|
+ right: 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-room-num {
|
|
|
+ width: 48px;
|
|
|
+ height: 48px;
|
|
|
+ background: rgba(255, 255, 255, 0.08);
|
|
|
+ border-radius: 10px;
|
|
|
+ margin-right: 12px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 48px;
|
|
|
+ font-size: 18px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-room-text {
|
|
|
+ flex: 1;
|
|
|
+ width: 0;
|
|
|
+
|
|
|
+ .space-room-label {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: 500;
|
|
|
+ margin-bottom: 4px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .space-room-sub {
|
|
|
+ font-size: 12px;
|
|
|
+ opacity: 0.6;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|