|
@@ -1,6 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<div class="space-index">
|
|
<div class="space-index">
|
|
- <div class="space-null" v-if="list.length ==0">
|
|
|
|
|
|
+ <div class="space-null" v-if="projectItemList.length ==0">
|
|
<img :src="nullImage" alt="" />
|
|
<img :src="nullImage" alt="" />
|
|
<div class="space-null-text">您还未添加楼宇信息,可新增楼宇,开启您的空间设置吧!</div>
|
|
<div class="space-null-text">您还未添加楼宇信息,可新增楼宇,开启您的空间设置吧!</div>
|
|
<div class="flow-button">
|
|
<div class="flow-button">
|
|
@@ -9,7 +9,7 @@
|
|
</el-button>
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div class="space-content">
|
|
|
|
|
|
+ <div class="space-content" v-else>
|
|
<div class="space-content-item">
|
|
<div class="space-content-item">
|
|
<div class="space-title">
|
|
<div class="space-title">
|
|
<div class="space-title-label">楼宇</div>
|
|
<div class="space-title-label">楼宇</div>
|
|
@@ -18,75 +18,26 @@
|
|
</el-button>
|
|
</el-button>
|
|
</div>
|
|
</div>
|
|
<div class="space-content-box">
|
|
<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">
|
|
<div class="space-room-list">
|
|
<el-row :gutter="10">
|
|
<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>
|
|
|
|
|
|
+ <el-col :span="12" v-for="item in projectItemList" :key="item.id">
|
|
|
|
+ <div :class="projectItem.id === item.id?'space-room-item active' : 'space-room-item'"
|
|
|
|
+ @click="selectTarget(item)">
|
|
|
|
+ <div class="space-room-image">
|
|
|
|
+ <img :src="returnImage(item)" alt="" />
|
|
|
|
+ </div>
|
|
<div class="space-room-text">
|
|
<div class="space-room-text">
|
|
<div class="space-room-label">{{item.name}}</div>
|
|
<div class="space-room-label">{{item.name}}</div>
|
|
<div class="space-room-sub">{{item.remark}}</div>
|
|
<div class="space-room-sub">{{item.remark}}</div>
|
|
</div>
|
|
</div>
|
|
<div class="space-room-icon">
|
|
<div class="space-room-icon">
|
|
<el-dropdown trigger="click"
|
|
<el-dropdown trigger="click"
|
|
- @command="command=>commandFunc(command,item,'room')">
|
|
|
|
|
|
+ @command="command=>commandFunc(command,item,'projectItem')">
|
|
<div class="target-item-icon">
|
|
<div class="target-item-icon">
|
|
<i class="iconfont huifont-jinhangzhong"></i>
|
|
<i class="iconfont huifont-jinhangzhong"></i>
|
|
</div>
|
|
</div>
|
|
<el-dropdown-menu slot="dropdown">
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
+ <el-dropdown-item command="detail">详情</el-dropdown-item>
|
|
<el-dropdown-item command="update">编辑</el-dropdown-item>
|
|
<el-dropdown-item command="update">编辑</el-dropdown-item>
|
|
<el-dropdown-item command="delete">删除</el-dropdown-item>
|
|
<el-dropdown-item command="delete">删除</el-dropdown-item>
|
|
</el-dropdown-menu>
|
|
</el-dropdown-menu>
|
|
@@ -98,42 +49,80 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="space-line"></div>
|
|
|
|
+ <div class="space-content-item">
|
|
|
|
+ <div class="space-title">
|
|
|
|
+ <div class="space-title-label">楼层</div>
|
|
|
|
+ <el-button size="medium" type="primary" @click="insert('projectItemTarget')">
|
|
|
|
+ <i class="iconfont huifont-xinzeng"></i>新增
|
|
|
|
+ </el-button>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="space-content-box">
|
|
|
|
+ <div class="space-undefined" v-if="projectItemTargetList.length === 0">
|
|
|
|
+ <img :src="undefinedImage" alt="" />
|
|
|
|
+ <div class="space-undefined-text">暂无数据</div>
|
|
|
|
+ </div>
|
|
|
|
+ <el-row class="project-item-traget" :gutter="10" v-else>
|
|
|
|
+ <el-col :span="8" v-for="(target,index) in projectItemTargetList" :key="target.id">
|
|
|
|
+ <div class="target-item">
|
|
|
|
+ <div class="target-item-num">
|
|
|
|
+ <i class="iconfont huifont-louceng"></i>
|
|
|
|
+ </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-row>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<el-dialog :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="900px" :append-to-body="true">
|
|
<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"
|
|
<project-item-form v-if="visible && type === 'projectItem'" @callback="callback" :isUpdate="isUpdate"
|
|
- :detailId="itemId"></project-item-form>
|
|
|
|
|
|
+ :detailId="itemId">
|
|
|
|
+ </project-item-form>
|
|
<project-item-target-form v-if="visible && type === 'projectItemTarget'" @callback="callback"
|
|
<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>
|
|
|
|
|
|
+ :isUpdate="isUpdate" :detailId="itemId" :projectItemId="projectItem.id">
|
|
|
|
+ </project-item-target-form>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
+ <el-drawer title="楼宇详情" :visible.sync="drawer" :size="400" :append-to-body="true">
|
|
|
|
+ <project-item-detail v-if="drawer" :detailId="itemId"></project-item-detail>
|
|
|
|
+ </el-drawer>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import {
|
|
import {
|
|
getProjectTreeList,
|
|
getProjectTreeList,
|
|
|
|
+ getProjectItemList,
|
|
deleteProjectItemById,
|
|
deleteProjectItemById,
|
|
deleteProjectItemTarget,
|
|
deleteProjectItemTarget,
|
|
deleteRoom
|
|
deleteRoom
|
|
} from '@/httpApi/work';
|
|
} from '@/httpApi/work';
|
|
import projectItemForm from '@/components/work/space/set/projectItemForm'
|
|
import projectItemForm from '@/components/work/space/set/projectItemForm'
|
|
- // import projectItemTargetForm from '@/components/work/project/projectItemTargetForm'
|
|
|
|
- // import roomForm from '@/components/work/space/roomForm'
|
|
|
|
|
|
+ import projectItemDetail from '@/components/work/space/set/projectItemDetail'
|
|
|
|
+ import projectItemTargetForm from '@/components/work/space/set/projectItemTargetForm'
|
|
export default {
|
|
export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
nullImage: require('../../../../assets/image/common/dataNull.png'),
|
|
nullImage: require('../../../../assets/image/common/dataNull.png'),
|
|
undefinedImage: require('../../../../assets/image/common/dataUndefined.png'),
|
|
undefinedImage: require('../../../../assets/image/common/dataUndefined.png'),
|
|
- list: [],
|
|
|
|
- roomList: [],
|
|
|
|
|
|
+ projectItemList: [],
|
|
|
|
+ projectItemTargetList: [],
|
|
visible: false,
|
|
visible: false,
|
|
itemId: '',
|
|
itemId: '',
|
|
- projectItemId: '',
|
|
|
|
isUpdate: false,
|
|
isUpdate: false,
|
|
- targetData: {},
|
|
|
|
- projectItem: {}
|
|
|
|
|
|
+ projectItem: {},
|
|
|
|
+ projectItemTarget: {},
|
|
|
|
+ drawer: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
@@ -143,21 +132,15 @@
|
|
getProjectItemList() {
|
|
getProjectItemList() {
|
|
getProjectTreeList(this.$store.getters.project.id).then(res => {
|
|
getProjectTreeList(this.$store.getters.project.id).then(res => {
|
|
if (res.state) {
|
|
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;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ this.projectItemList = res.data.projectItemList || [];
|
|
|
|
+ if (this.projectItemList.length === 0) return;
|
|
|
|
+ if (this.projectItem.id) {
|
|
|
|
+ let item = this.projectItemList.filter(node => node.id === this.projectItem.id);
|
|
|
|
+ if (item.length === 0) return this.selectTarget(this.projectItemList[0]);
|
|
|
|
+ this.selectTarget(item[0]);
|
|
|
|
+ } else {
|
|
|
|
+ this.selectTarget(this.projectItemList[0]);
|
|
}
|
|
}
|
|
- let data = this.list.filter(node => node.projectItemTargetList && node
|
|
|
|
- .projectItemTargetList.length > 0);
|
|
|
|
- if (data.length > 0) this.selectTarget(data[0], data[0].projectItemTargetList[0]);
|
|
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -165,12 +148,10 @@
|
|
this.type = type;
|
|
this.type = type;
|
|
this.isUpdate = false;
|
|
this.isUpdate = false;
|
|
this.visible = true;
|
|
this.visible = true;
|
|
- if (projectItemId) this.projectItemId = projectItemId;
|
|
|
|
},
|
|
},
|
|
- selectTarget(item, target) {
|
|
|
|
- this.targetData = target;
|
|
|
|
|
|
+ selectTarget(item) {
|
|
this.projectItem = item;
|
|
this.projectItem = item;
|
|
- this.roomList = target.projectItemTargetRoomList;
|
|
|
|
|
|
+ this.projectItemTargetList = item.projectItemTargetList;
|
|
},
|
|
},
|
|
commandFunc(operationType, item, type) {
|
|
commandFunc(operationType, item, type) {
|
|
this.type = type;
|
|
this.type = type;
|
|
@@ -181,6 +162,9 @@
|
|
this.isUpdate = true;
|
|
this.isUpdate = true;
|
|
this.visible = true;
|
|
this.visible = true;
|
|
},
|
|
},
|
|
|
|
+ detail() {
|
|
|
|
+ this.drawer = true;
|
|
|
|
+ },
|
|
delete() {
|
|
delete() {
|
|
if (this.type === 'projectItem') {
|
|
if (this.type === 'projectItem') {
|
|
this.$confirm('确定要删除该楼宇?', () => {
|
|
this.$confirm('确定要删除该楼宇?', () => {
|
|
@@ -192,11 +176,6 @@
|
|
deleteProjectItemTarget(this.itemId).then(this.successFunc);
|
|
deleteProjectItemTarget(this.itemId).then(this.successFunc);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (this.type === 'room') {
|
|
|
|
- this.$confirm('确定要删除该房间?', () => {
|
|
|
|
- deleteRoom(this.itemId).then(this.successFunc);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
successFunc(res) {
|
|
successFunc(res) {
|
|
if (res.state) {
|
|
if (res.state) {
|
|
@@ -204,6 +183,14 @@
|
|
this.$message.success('操作成功');
|
|
this.$message.success('操作成功');
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ returnImage(item) {
|
|
|
|
+ let imgUrl = 'https://file-node.oss-cn-shanghai.aliyuncs.com/youji/1da893e7d4264dc68ef43e00d5a708e9'
|
|
|
|
+ if (item.picture) {
|
|
|
|
+ let picture = JSON.parse(item.picture);
|
|
|
|
+ if (picture.length > 0) imgUrl = picture[0].url;
|
|
|
|
+ }
|
|
|
|
+ return imgUrl;
|
|
|
|
+ },
|
|
callback(type) {
|
|
callback(type) {
|
|
this.visible = false;
|
|
this.visible = false;
|
|
if (type === 'init') this.getProjectItemList();
|
|
if (type === 'init') this.getProjectItemList();
|
|
@@ -211,8 +198,8 @@
|
|
},
|
|
},
|
|
components: {
|
|
components: {
|
|
projectItemForm,
|
|
projectItemForm,
|
|
- // projectItemTargetForm,
|
|
|
|
- // roomForm
|
|
|
|
|
|
+ projectItemDetail,
|
|
|
|
+ projectItemTargetForm,
|
|
},
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
@@ -325,17 +312,14 @@
|
|
}
|
|
}
|
|
|
|
|
|
.project-item-traget {
|
|
.project-item-traget {
|
|
- padding: 15px 20px;
|
|
|
|
-
|
|
|
|
.target-item {
|
|
.target-item {
|
|
width: 100%;
|
|
width: 100%;
|
|
- background: #1f242f;
|
|
|
|
|
|
+ background: #232A37;
|
|
padding: 15px;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
- cursor: pointer;
|
|
|
|
box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
border: 1px solid #1f242f;
|
|
border: 1px solid #1f242f;
|
|
}
|
|
}
|
|
@@ -364,12 +348,6 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- .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 {
|
|
.target-item-num {
|
|
width: 38px;
|
|
width: 38px;
|
|
height: 38px;
|
|
height: 38px;
|
|
@@ -378,6 +356,10 @@
|
|
background: #31353f;
|
|
background: #31353f;
|
|
border-radius: 10px;
|
|
border-radius: 10px;
|
|
margin-right: 10px;
|
|
margin-right: 10px;
|
|
|
|
+
|
|
|
|
+ .iconfont {
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
.target-item-label {
|
|
.target-item-label {
|
|
@@ -403,14 +385,27 @@
|
|
}
|
|
}
|
|
|
|
|
|
.space-room-list {
|
|
.space-room-list {
|
|
|
|
+ .space-room-image {
|
|
|
|
+ img {
|
|
|
|
+ width: 80px;
|
|
|
|
+ height: 80px;
|
|
|
|
+ object-fit: fill;
|
|
|
|
+ border-radius: 8px;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ margin-right: 10px;
|
|
|
|
+ }
|
|
|
|
+
|
|
.space-room-item {
|
|
.space-room-item {
|
|
display: flex;
|
|
display: flex;
|
|
align-items: center;
|
|
align-items: center;
|
|
- padding: 0 20px;
|
|
|
|
|
|
+ padding: 0 15px;
|
|
height: 110px;
|
|
height: 110px;
|
|
background: #232A37;
|
|
background: #232A37;
|
|
border-radius: 8px;
|
|
border-radius: 8px;
|
|
position: relative;
|
|
position: relative;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ border: 1px solid #1f242f;
|
|
|
|
|
|
.space-room-icon {
|
|
.space-room-icon {
|
|
position: absolute;
|
|
position: absolute;
|
|
@@ -445,6 +440,12 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .space-room-item.active,
|
|
|
|
+ .space-room-item:hover {
|
|
|
|
+ border-color: $--color-primary;
|
|
|
|
+ box-shadow: -1px -1px 10px 1px rgba(51, 133, 255, 0.2) inset;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|