From 0df15fb4eafccde45b09caa213dd12d449397298 Mon Sep 17 00:00:00 2001
From: Lou <luzhiping@qqyjz.com>
Date: Sat, 16 Mar 2024 18:42:00 +0800
Subject: [PATCH] 更新
---
subPackage/house/roomControl/index.vue | 101 +++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 86 insertions(+), 15 deletions(-)
diff --git a/subPackage/house/roomControl/index.vue b/subPackage/house/roomControl/index.vue
index dc17363..fe62d02 100644
--- a/subPackage/house/roomControl/index.vue
+++ b/subPackage/house/roomControl/index.vue
@@ -53,11 +53,16 @@
<view class=" flex label-btn-box b-c-w" v-if="roleType == 2">
<newBoxTitle title="房屋标签"></newBoxTitle>
<view class="list">
- <view v-for="(item, index) in labelBtnList" :key="index">
- <u-button size="mini" type="primary" :color="$setLabelColor(item.color)"
+ <block v-for="(item, index) in labelBtnList" :key="index">
+ <view @click="handleLabel(index,item)" class="label-item"
+ :class="index == labelIndex?'c-ff':'c-66'"
+ :style="{backgroundColor:(index == labelIndex?item.showColor:'#F5F5F5')}">
+ {{item.name}}
+ <!-- <u-button size="mini" type="primary" :color="$setLabelColor(item.color)"
:style="{color: $setLabelColor(item.color) && '#fff'}" :text="item.name"
- @click="showLabelPopup(item)"></u-button>
- </view>
+ @click="showLabelPopup(item)"></u-button> -->
+ </view>
+ </block>
</view>
</view>
</u-form>
@@ -108,7 +113,8 @@
} from "@/api/label/label.js";
import {
saveOrUpdateHouseholdLabel,
- removeHouseholdLabel
+ removeHouseholdLabel,
+ setHouseLabel
} from "@/api/house/householdLabel.js";
import {
getHouseDetail,
@@ -212,6 +218,26 @@
roleType: 1,
showSelectDate: false,
serveTime: Number(new Date()),
+ labelIndex: null,
+ labelItemList: [{
+ name: "闲置",
+ showColor: '#30D17C',
+ color: "green"
+ },
+
+ {
+
+
+ name: "出租",
+ showColor: '#FFCC00',
+ color: "yellow"
+ },
+ {
+ name: "自住",
+ showColor: '#0099FF',
+ color: "blue"
+ },
+ ]
}
},
created() {
@@ -268,7 +294,16 @@
parentId: 1001
}
const resLabel = await getLabelListByParentId(paramLabel)
- this.labelBtnList = resLabel.data
+ let labelItem = resLabel.data;
+ for (let i = 0, ii = labelItem.length; i < ii; i++) {
+ for (let k = 0, kk = this.labelItemList.length; k < kk; k++) {
+ if (labelItem[i].name == this.labelItemList[k].name) {
+ labelItem[i].showColor = this.labelItemList[k].showColor;
+ labelItem[i].color = this.labelItemList[k].color;
+ }
+ }
+ }
+ this.labelBtnList = labelItem;
if (null != res.data) {
const images = []
const {
@@ -295,16 +330,22 @@
- if (userHouseLabelVOList.length > 0) {
- that.labelBtnList.forEach(e => {
- userHouseLabelVOList.forEach(f => {
- if (Number(e.id) == f.labelId) {
- e['color'] = f.color
- e['remark'] = f.remark
- }
- })
- })
+ // if (userHouseLabelVOList.length > 0) {
+ // that.labelBtnList.forEach(e => {
+ // userHouseLabelVOList.forEach(f => {
+ // if (Number(e.id) == f.labelId) {
+ // e['color'] = f.color
+ // e['remark'] = f.remark
+ // }
+ // })
+ // })
+ // }
+
+ if (userHouseLabelVOList.length) {
+ this.labelIndex = this.labelBtnList.findIndex(item => item.id == userHouseLabelVOList[0]
+ .labelId)
}
+
this.form = {
phone,
address,
@@ -445,6 +486,27 @@
this.popupShow = false
},
+ //选择标签
+ handleLabel(index, item) {
+ this.labelIndex = index;
+ let data = {
+ labelId: item.id,
+ color: item.color,
+ lableType: 2,
+ houseCode: this.houseCode
+ }
+ this.setLabelRequest(data)
+ },
+
+ setLabelRequest(data) {
+ setHouseLabel(data).then(res => {
+ if (res.code == 200) {
+ this.$showTips("操作成功", "success")
+ }
+ })
+ }
+
+
}
}
</script>
@@ -555,4 +617,13 @@
}
}
}
+
+
+ .label-item {
+ padding: 12rpx;
+ border-radius: 8rpx;
+ font-size: 26rpx;
+ margin-right: 30rpx;
+ text-align: center;
+ }
</style>
\ No newline at end of file
--
Gitblit v1.9.3