|
@@ -55,13 +55,13 @@
|
|
|
{{ objStatusMapping[scope.row.status] }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="区块标签" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-for="tag in (scope.row.tagNames && scope.row.tagNames.split(',')) || []" :key="tag" :style="getTagStyle(tag.trim())" class="tag-label">
|
|
|
- {{ tag.trim() }}
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
+ <el-table-column label="区块标签" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-for="tag in (scope.row.tagNames && scope.row.tagNames.split(',')) || []" :key="tag" :style="getTagStyle(tag.trim())" class="tag-label">
|
|
|
+ {{ tag.trim() }}
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
@@ -150,12 +150,12 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="所有单位" prop="areaAttr.attrOrg">
|
|
|
- <el-input v-model="form.areaAttr.attrOrg" placeholder="请输入属性组织" />
|
|
|
+ <el-input v-model="form.areaAttr.attrOrg" placeholder="请输入所有单位" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="管理单位" prop="areaAttr.mgrOrg">
|
|
|
- <el-input v-model="form.areaAttr.mgrOrg" placeholder="请输入管理组织" />
|
|
|
+ <el-input v-model="form.areaAttr.mgrOrg" placeholder="请输入管理单位" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -167,7 +167,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="联系电话" prop="areaAttr.phone">
|
|
|
- <el-input v-model="form.areaAttr.phone" placeholder="请输入电话" />
|
|
|
+ <el-input v-model="form.areaAttr.phone" placeholder="请输入联系电话" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -179,14 +179,14 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="建筑面积" prop="areaAttr.floorArea">
|
|
|
- <el-input v-model="form.areaAttr.floorArea" placeholder="请输入楼层面积" />
|
|
|
+ <el-input v-model="form.areaAttr.floorArea" placeholder="请输入建筑面积" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="使用面积" prop="areaAttr.usableArea">
|
|
|
- <el-input v-model="form.areaAttr.usableArea" placeholder="请输入可用面积" />
|
|
|
+ <el-input v-model="form.areaAttr.usableArea" placeholder="请输入使用面积" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
@@ -206,7 +206,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listArea, getArea, delArea, addArea, updateArea } from "@/api/basecfg/area";
|
|
|
+import { getArea, delArea, addArea, updateArea, listDetailArea } from '@/api/basecfg/area'
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
import SubTitle from '@/components/SubTitle/index.vue'
|
|
@@ -238,7 +238,7 @@ export default {
|
|
|
refreshTable: true,
|
|
|
// 标签选项
|
|
|
emsTagOptions: [],
|
|
|
- // emsTagLoaded: false, // 添加一个标志位
|
|
|
+ tagCodeToColorMap:{},
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
areaCode: null,
|
|
@@ -290,16 +290,25 @@ export default {
|
|
|
created() {
|
|
|
this.getList();
|
|
|
this.getEmsTag('Area');
|
|
|
+ // 初始化 form.areaAttr 为一个空对象
|
|
|
+ this.form.areaAttr = {};
|
|
|
},
|
|
|
methods: {
|
|
|
- getTagStyle(tag) {
|
|
|
- const styleMap = {
|
|
|
- '公共区域': 'background-color: rgb(255,255,125); color: rgb(109,109,150); padding: 4px 8px; border-radius: 4px; width: 80px; height: 30px; margin: 4px 8px 4px 0; display: block; vertical-align: top;',
|
|
|
- '商户区域': 'background-color: rgb(206,206,255); color: rgb(109,109,150); padding: 4px 8px; border-radius: 4px; width: 80px; height: 30px; margin: 4px 8px 4px 0; display: block; vertical-align: top;',
|
|
|
- '充电车位区': 'background-color: rgb(203,255,99); color: rgb(109,109,150); padding: 4px 8px; border-radius: 4px; width: 88px; height: 30px; margin: 4px 8px 4px 0; display: block; vertical-align: top;',
|
|
|
- '房建区': 'background-color: #e8f4ff; color: rgb(109,109,150); padding: 4px 8px; border-radius: 4px; width: 80px; height: 30px; margin: 4px 8px 4px 0; display: block; vertical-align: top;'
|
|
|
+ getTagStyle(tagName) {
|
|
|
+ // 从tagName找到对应的tagCode
|
|
|
+ const tagCode = this.emsTagOptions.find(tag => tag.label === tagName)?.value;
|
|
|
+ const color = this.tagCodeToColorMap[tagCode] || '#FFFFFF'; // 默认白色
|
|
|
+ return {
|
|
|
+ backgroundColor: color,
|
|
|
+ color:'#808080',
|
|
|
+ padding: '4px 8px',
|
|
|
+ borderRadius: '4px',
|
|
|
+ width: '80px',
|
|
|
+ height: '30px',
|
|
|
+ margin: '4px 8px 4px 0',
|
|
|
+ display: 'inline-block',
|
|
|
+ verticalAlign: 'top'
|
|
|
};
|
|
|
- return styleMap[tag] || 'background-color: #FFFFFF; color: #000000; padding: 4px 8px; border-radius: 4px; width: 80px; height: 30px; margin: 4px 8px 4px 0; display: block; vertical-align: top;';
|
|
|
},
|
|
|
/** 查询区域对象列表 */
|
|
|
// getList() {
|
|
@@ -312,8 +321,9 @@ export default {
|
|
|
// },
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
- listArea(this.queryParams).then(response => {
|
|
|
+ listDetailArea(this.queryParams).then(response => {
|
|
|
this.areaList = this.handleTree(response.data, "areaCode", "parentCode");
|
|
|
+ console.log("areaList",this.areaList)
|
|
|
// 递归处理 tagNames
|
|
|
this.areaList = this.extractTagNames(this.areaList);
|
|
|
console.log("查询", this.areaList);
|
|
@@ -349,7 +359,7 @@ export default {
|
|
|
},
|
|
|
/** 查询区域对象下拉树结构 */
|
|
|
getTreeselect() {
|
|
|
- listArea().then(response => {
|
|
|
+ listDetailArea().then(response => {
|
|
|
this.areaOptions = [];
|
|
|
const data = { areaCode: 0, areaName: '顶级节点', children: [] };
|
|
|
data.children = this.handleTree(response.data, "areaCode", "parentCode");
|
|
@@ -372,10 +382,9 @@ export default {
|
|
|
shortName: null,
|
|
|
desc: null,
|
|
|
orderNum: null,
|
|
|
- status: null
|
|
|
- };
|
|
|
- this.form.areaAttr={
|
|
|
- areaCode:null,
|
|
|
+ status: null,
|
|
|
+ areaAttr: {
|
|
|
+ areaCode: null,
|
|
|
attrOrg: null,
|
|
|
mgrOrg: null,
|
|
|
leader: null,
|
|
@@ -384,10 +393,25 @@ export default {
|
|
|
floorArea: null,
|
|
|
usableArea: null,
|
|
|
floor: null,
|
|
|
- tagCodes:null,
|
|
|
- tagNames:null,
|
|
|
- tagCodeList:null
|
|
|
- }
|
|
|
+ tagCodes: null,
|
|
|
+ tagNames: null,
|
|
|
+ tagCodeList: []
|
|
|
+ }// 确保 areaAttr 始终为一个空对象
|
|
|
+ };
|
|
|
+ // this.form.areaAttr={
|
|
|
+ // areaCode:null,
|
|
|
+ // attrOrg: null,
|
|
|
+ // mgrOrg: null,
|
|
|
+ // leader: null,
|
|
|
+ // phone: null,
|
|
|
+ // openDate: null,
|
|
|
+ // floorArea: null,
|
|
|
+ // usableArea: null,
|
|
|
+ // floor: null,
|
|
|
+ // tagCodes:null,
|
|
|
+ // tagNames:null,
|
|
|
+ // tagCodeList:null
|
|
|
+ // }
|
|
|
this.resetForm("form");
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
@@ -411,7 +435,9 @@ export default {
|
|
|
}
|
|
|
// 确保 areaAttr 和 tagCodeList 是对象和数组
|
|
|
this.form.areaAttr = this.form.areaAttr || {};
|
|
|
+ console.log("this.form.areaAttr",this.form.areaAttr)
|
|
|
this.form.areaAttr.tagCodeList = this.form.areaAttr.tagCodeList || [];
|
|
|
+ console.log("this.form.areaAttr.tagCodeList",this.form.areaAttr.tagCodeList)
|
|
|
this.open = true;
|
|
|
this.title = "添加区域对象";
|
|
|
},
|
|
@@ -447,7 +473,6 @@ export default {
|
|
|
this.$refs["form"].validate(valid => {
|
|
|
if (valid) {
|
|
|
if (this.form.id != null) {
|
|
|
- console.log("修改",this.form)
|
|
|
updateArea(this.form).then(response => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
@@ -479,9 +504,15 @@ export default {
|
|
|
if (response && response.data) {
|
|
|
this.emsTagOptions = response.data.map(item => ({
|
|
|
label: item.tagName,
|
|
|
- value: item.tagCode
|
|
|
+ value: item.tagCode,
|
|
|
+ color: item.tagColor
|
|
|
}));
|
|
|
- console.log("分区标签", this.emsTagOptions)
|
|
|
+ //颜色映射
|
|
|
+ this.tagCodeToColorMap = {};
|
|
|
+ this.emsTagOptions.forEach(item => {
|
|
|
+ this.tagCodeToColorMap[item.value] = item.color;
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
}
|