|
@@ -0,0 +1,464 @@
|
|
|
+<template>
|
|
|
+ <div class="bim-attribute color-font" v-show="show">
|
|
|
+ <div class="bim-attribute-box">
|
|
|
+ <div class="bim-attribute-view hui-flex">
|
|
|
+ <div class="bim-attribute-title">
|
|
|
+ <div class="hui-title-label">模型属性</div>
|
|
|
+ <div class="hui-title-right">
|
|
|
+ <el-button size="medium" type="primary" v-if="!isUpdate" @click="isUpdate = true">编辑</el-button>
|
|
|
+ <el-button size="medium" type="primary" v-else @click="cancelUpdate">取消编辑</el-button>
|
|
|
+ <i class="iconfont huifont-guanbi" title="关闭" @click="show = false"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="hui-flex-box">
|
|
|
+ <div class="bim-attribute-content" v-if="nowItem.group">
|
|
|
+ <div class="bim-attribute-tab">
|
|
|
+ <div :class="nowItem.group === node.group ? 'attribute-tab-title active':'attribute-tab-title'"
|
|
|
+ v-for="(node,i) in dataList" :key="i" @click="changeItem(node)">
|
|
|
+ {{node.group}}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="bim-attribute-tab-content-box">
|
|
|
+ <div class="bim-attribute-tab-contents" v-if="nowItem.group === '运营属性'">
|
|
|
+ <operational-attributes></operational-attributes>
|
|
|
+ </div>
|
|
|
+ <div class="bim-attribute-tab-content" v-else>
|
|
|
+ <div class="property-item" v-for="(item,indexs) in nowItem.node" :key="indexs">
|
|
|
+ <div class="property-item-title">
|
|
|
+ <div class="property-item-title-label">
|
|
|
+ {{item.group}}
|
|
|
+ <span class="color-primary" v-if="isUpdate"
|
|
|
+ @click="updateGroup(item.group,indexs)">
|
|
|
+ 编辑
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="property-item-title-delete" v-if="isUpdate"
|
|
|
+ @click="deleteGroup(nowItem.node,indexs)">
|
|
|
+ <i class="iconfont huifont-shanchu"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <table border="1" cellspacing="0" cellpadding="0">
|
|
|
+ <tr class="th-title">
|
|
|
+ <th style="width: 400px;">属性名称</th>
|
|
|
+ <th>属性值</th>
|
|
|
+ </tr>
|
|
|
+ <tr v-for="(items,index) in item.items" :key="index">
|
|
|
+ <td>
|
|
|
+ <div class="td-value" v-if="!isUpdate">{{items.key}}</div>
|
|
|
+ <div v-else>
|
|
|
+ <el-input v-model="items.key"></el-input>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <div class="td-value" v-if="!isUpdate">{{items.value}}</div>
|
|
|
+ <div class="td-input" v-else>
|
|
|
+ <el-input v-model="items.value"></el-input>
|
|
|
+ <div class="td-icon" @click="deleteRow(item,index)">
|
|
|
+ <i class="iconfont huifont-guanbi"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr v-if="isUpdate">
|
|
|
+ <td colspan="2">
|
|
|
+ <div class="insert-icon color-primary" @click="insertRow(item)">
|
|
|
+ <i class="iconfont huifont-xinzeng"></i>
|
|
|
+ 新增
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="no-data" v-if="nowItem.node.length === 0 && !isUpdate">
|
|
|
+ <empty description="暂无数据"></empty>
|
|
|
+ </div>
|
|
|
+ <div style="padding: 10px 0;text-align: center;" v-if="isUpdate">
|
|
|
+ <el-button type="primary" size="medium"
|
|
|
+ @click="insertList(nowItem)">+新增属性标题</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="no-data" v-else>
|
|
|
+ <empty description="暂无数据"></empty>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="hui-drawer-submit">
|
|
|
+ <el-button size="medium" @click="close">取 消</el-button>
|
|
|
+ <el-button size="medium" type="primary" @click="submit">保 存</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ getElementByIntegrate,
|
|
|
+ insertBimAttribute,
|
|
|
+ putBimAttribute
|
|
|
+ } from '@/httpApi/bim'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ bimintegrateid: '',
|
|
|
+ fileid: '',
|
|
|
+ objectid: '',
|
|
|
+ show: true,
|
|
|
+ dataList: [],
|
|
|
+ isUpdate: false,
|
|
|
+ oldForm: [],
|
|
|
+ item: {},
|
|
|
+ nowItem: {},
|
|
|
+ projectId: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.projectId = localStorage.getItem('projectId');
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ init() {
|
|
|
+ getElementByIntegrate(this.bimintegrateid, {
|
|
|
+ "filter": [],
|
|
|
+ "ids": [{
|
|
|
+ "fileIdHash": this.fileid,
|
|
|
+ "elementIds": [this.objectid]
|
|
|
+ }]
|
|
|
+ }).then(res => {
|
|
|
+ if (res.state) {
|
|
|
+ if (res.data.code == 'success') {
|
|
|
+ if (res.data.data.length == 0) {
|
|
|
+ this.dataList = [];
|
|
|
+ this.oldForm = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.dataList = [{
|
|
|
+ group: '基本属性',
|
|
|
+ node: res.data.data[0].properties
|
|
|
+ }];
|
|
|
+ this.nowItem = this.dataList[0];
|
|
|
+ this.oldForm = JSON.parse(JSON.stringify(this.dataList));
|
|
|
+ } else {
|
|
|
+ this.item = res.data[0];
|
|
|
+ this.dataList = JSON.parse(res.data[0].elementAttribute);
|
|
|
+ this.nowItem = this.dataList[0];
|
|
|
+ this.oldForm = JSON.parse(JSON.stringify(this.dataList));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ cancelUpdate() {
|
|
|
+ this.dataList = JSON.parse(JSON.stringify(this.oldForm));
|
|
|
+ this.nowItem = this.dataList[0];
|
|
|
+ this.isUpdate = false;
|
|
|
+ },
|
|
|
+ insertList(node) {
|
|
|
+ node.node.push({
|
|
|
+ group: '标题',
|
|
|
+ items: []
|
|
|
+ })
|
|
|
+ },
|
|
|
+ insertRow(item) {
|
|
|
+ item.items.push({
|
|
|
+ key: '',
|
|
|
+ value: ''
|
|
|
+ });
|
|
|
+ },
|
|
|
+ updateGroup(val, indexs) {
|
|
|
+ this.$prompt('请输入标题名称', '系统提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ inputValue: val
|
|
|
+ }).then(({
|
|
|
+ value
|
|
|
+ }) => {
|
|
|
+ this.nowItem.node[indexs].group = value;
|
|
|
+ }).catch();
|
|
|
+ },
|
|
|
+ deleteRow(item, index) {
|
|
|
+ item.items.splice(index, 1);
|
|
|
+ },
|
|
|
+ deleteGroup(item, index) {
|
|
|
+ item.splice(index, 1);
|
|
|
+ },
|
|
|
+ changeItem(item) {
|
|
|
+ this.nowItem = item;
|
|
|
+ },
|
|
|
+ submit() {
|
|
|
+ this.item.id ? putBimAttribute({
|
|
|
+ id: this.item.id,
|
|
|
+ elementAttribute: JSON.stringify(this.dataList)
|
|
|
+ }).then(this.successFunc) : insertBimAttribute({
|
|
|
+ integrateId: this.bimintegrateid,
|
|
|
+ fileId: this.fileid,
|
|
|
+ elementId: this.objectid,
|
|
|
+ elementAttribute: JSON.stringify(this.dataList)
|
|
|
+ }).then(this.successFunc);
|
|
|
+ },
|
|
|
+ successFunc(res) {
|
|
|
+ if (res.state) {
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.isUpdate = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ close() {
|
|
|
+ if (!this.isUpdate) this.show = false;
|
|
|
+ let obj = JSON.parse(JSON.stringify(this.oldForm));
|
|
|
+ this.dataList = Object.assign({}, obj);
|
|
|
+ this.isUpdate = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ show(value) {
|
|
|
+ this.show = value;
|
|
|
+ if (!this.show) this.close();
|
|
|
+ if (this.show) this.init();
|
|
|
+ },
|
|
|
+ objectid(value) {
|
|
|
+ if (this.show) this.init();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+ .bim-attribute {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background: rgba(0, 0, 0, 0.4);
|
|
|
+ z-index: 2000;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ .bim-attribute-title {
|
|
|
+ display: flex;
|
|
|
+ height: 55px;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0 24px;
|
|
|
+ border-bottom: 1px solid $--color-border;
|
|
|
+ font-size: 16px;
|
|
|
+ justify-content: space-between;
|
|
|
+
|
|
|
+ .hui-title-right {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .iconfont {
|
|
|
+ margin-left: 30px;
|
|
|
+ margin-right: 6px;
|
|
|
+ font-size: 18px;
|
|
|
+ cursor: pointer;
|
|
|
+ color: #5F7285;
|
|
|
+ }
|
|
|
+
|
|
|
+ .iconfont:hover {
|
|
|
+ color: $--color-primary;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .insert-icon {
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ border-radius: 2px;
|
|
|
+ border: 1px dashed #2B3852;
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .hui-drawer-submit {
|
|
|
+ padding: 10px;
|
|
|
+ text-align: right;
|
|
|
+ border-color: $--color-border;
|
|
|
+ }
|
|
|
+
|
|
|
+ .td-input {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .el-input {
|
|
|
+ flex: 1;
|
|
|
+ width: 0;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .td-icon {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ background: #171F2D;
|
|
|
+ border-radius: 10px;
|
|
|
+ border: 1px solid #8596B0;
|
|
|
+ opacity: 0.6;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 16px;
|
|
|
+ margin-left: 12px;
|
|
|
+ color: #8596B0;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .td-icon:hover {
|
|
|
+ color: $--color-red;
|
|
|
+ border-color: $--color-red;
|
|
|
+ }
|
|
|
+
|
|
|
+ .iconfont {
|
|
|
+ font-size: 10px;
|
|
|
+ margin-left: 1px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .bim-attribute-box {
|
|
|
+ width: 80%;
|
|
|
+ height: 90%;
|
|
|
+ background: #141A24;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ .no-data {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bim-attribute-view {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+
|
|
|
+ .bim-attribute-content {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bim-attribute-tab {
|
|
|
+ position: absolute;
|
|
|
+ width: 140px;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ bottom: 0;
|
|
|
+ border-right: 1px solid $--color-border;
|
|
|
+ padding-top: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attribute-tab-title {
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ padding-left: 30px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attribute-tab-title.active,
|
|
|
+ .attribute-tab-title.active:hover {
|
|
|
+ color: #F2F3F5;
|
|
|
+ background: $--color-primary;
|
|
|
+ }
|
|
|
+
|
|
|
+ .attribute-tab-title:hover {
|
|
|
+ color: $--color-primary;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bim-attribute-tab-contents {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ padding-left: 140px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bim-attribute-tab-content-box {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+
|
|
|
+ .bim-attribute-tab-content {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ padding: 0 30px;
|
|
|
+ padding-left: 170px;
|
|
|
+ overflow-y: auto;
|
|
|
+
|
|
|
+ .el-input__inner {
|
|
|
+ background: #171F2D;
|
|
|
+ border-radius: 2px;
|
|
|
+ border-color: #2B3852;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-input__inner:focus,
|
|
|
+ .el-input__inner:hover,
|
|
|
+ .el-textarea__inner:focus,
|
|
|
+ .el-textarea__inner:hover,
|
|
|
+ .el-select:hover .el-input__inner,
|
|
|
+ .el-cascader:hover .el-input__inner {
|
|
|
+ border-color: $--color-primary;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ table {
|
|
|
+ width: 100%;
|
|
|
+ border: 1px solid #1F2A3F;
|
|
|
+ border-collapse: collapse;
|
|
|
+ table-layout: fixed;
|
|
|
+ }
|
|
|
+
|
|
|
+ table th {
|
|
|
+ padding: 10px 0;
|
|
|
+ border: 1px solid #1F2A3F;
|
|
|
+ font-weight: 500;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ table td {
|
|
|
+ border: 1px solid #1F2A3F;
|
|
|
+ padding: 11px 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ .property-item {
|
|
|
+ margin-bottom: 10px;
|
|
|
+
|
|
|
+ .td-value {
|
|
|
+ padding-left: 20px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .property-item-title {
|
|
|
+ margin-top: 20px;
|
|
|
+ font-weight: 600;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
+
|
|
|
+ .property-item-title-label {
|
|
|
+ span {
|
|
|
+ margin-left: 8px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .property-item-title-delete {
|
|
|
+ width: 24px;
|
|
|
+ height: 24px;
|
|
|
+ background: #1E293B;
|
|
|
+ border-radius: 2px;
|
|
|
+ line-height: 24px;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .th-title {
|
|
|
+ background: rgba(97, 133, 214, 0.05);
|
|
|
+ }
|
|
|
+
|
|
|
+ .property-box-document {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|