From a51dd3a32ded45c01e15ee4befe1a9d769e834c1 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Sat, 04 Nov 2023 15:48:46 +0800
Subject: [PATCH] 房屋管理完善
---
subPackage/house/roomControl/index.vue | 157 +++++++++++++++++++++++++++++++++++-----------------
api/house/houseLabel.js | 8 +-
2 files changed, 108 insertions(+), 57 deletions(-)
diff --git a/api/house/houseLabel.js b/api/house/houseLabel.js
index 7875b97..b3fd26e 100644
--- a/api/house/houseLabel.js
+++ b/api/house/houseLabel.js
@@ -21,12 +21,10 @@
}
// 房屋标签撤销
-export const removeHouseLabel = (ids) => {
+export const removeHouseLabel = (data) => {
return http.request({
- url: 'blade-houseLabel/houseLabel/remove',
+ url: 'blade-houseLabel/houseLabel/removeHouseLabel',
method: 'POST',
- params: {
- ids
- }
+ data
})
}
\ No newline at end of file
diff --git a/subPackage/house/roomControl/index.vue b/subPackage/house/roomControl/index.vue
index b357724..669e675 100644
--- a/subPackage/house/roomControl/index.vue
+++ b/subPackage/house/roomControl/index.vue
@@ -38,7 +38,9 @@
<box-title title="房屋标签"></box-title>
<view class="mt-20 flex label-btn-box b-c-w">
<view v-for="(item, index) in labelBtnList" :key="index">
- <u-button color="#000" size="mini" type="primary" :plain="true" :text="item.name"
+ <u-button color="#000" size="mini" type="primary"
+ :style="{background: item.color}"
+ :plain="true" :text="item.name"
@click="showLabelPopup(item)"></u-button>
</view>
</view>
@@ -63,7 +65,7 @@
</u-radio>
</u-radio-group>
- <u--textarea class="mt-40" v-model="value1" placeholder="请输入内容"></u--textarea>
+ <u--textarea class="mt-40" v-model="remark" placeholder="请输入内容"></u--textarea>
</view>
</u-modal>
@@ -86,13 +88,14 @@
import {
updateHouseLabel,
removeHouseLabel
- } from "@/api/houseRental/houseRental.js";
+ } from "@/api/house/houseLabel.js";
import {
getHouseDetail,saveOrUpdateHouse
} from "@/api/house/house.js";
import {
minioBaseUrl
} from '@/common/setting'
+import { number } from "echarts";
export default {
mixins: [uploadMixin],
data() {
@@ -146,8 +149,10 @@
title: '',
selectedColor: ''
},
- labelValue: '苹果',
- value1: ''
+ labelValue: '',
+ remark: '',
+ // 标记
+ number:0
}
},
created() {
@@ -163,10 +168,71 @@
this.houseCode = code
},
onShow() {
- this.getLabelList()
+ // this.getLabelList()
this.getHouseDetailInfo()
},
methods: {
+ // 获取房屋详情
+ async getHouseDetailInfo() {
+ var that = this;
+ const param = {
+ houseCode : this.houseCode
+ }
+ const res = await getHouseDetail(param)
+ if(null != res.data){
+ const images = []
+ const {
+ phone,
+ address,
+ propertyPrice,
+ serviceDue,
+ imageUrls,
+ houseLabelVOList
+ } = res.data
+ if(imageUrls.length>0){
+ const urls = imageUrls.split(',')
+ // 遍历
+ urls.forEach(e=>{
+ images.push({
+ url:minioBaseUrl + e,
+ name: e
+ })
+ })
+ }
+ // 房屋标签处理
+ if(houseLabelVOList.length>0){
+ const param = {
+ parentId:1001
+ }
+ const res = await getLabelListByParentId(param)
+ this.labelBtnList = res.data
+ that.labelBtnList.forEach(e=>{
+ houseLabelVOList.forEach(f=>{
+ if(Number(e.id) == f.labelId){
+ e['color'] = f.color
+ e['remark'] = f.remark
+ }
+ })
+ })
+ }
+ this.form = {
+ phone,
+ address,
+ propertyPrice,
+ serviceDue,
+ imageUrls,
+ images
+ }
+ }
+ },
+ // 获取房屋标签信息
+ async getLabelList() {
+ const param = {
+ parentId:1001
+ }
+ const res = await getLabelListByParentId(param)
+ this.labelBtnList = res.data
+ },
// 更新房屋数据
async updateHouseInfo(){
this.form['houseCode'] = this.houseCode
@@ -195,15 +261,28 @@
duration: 1500,
success: () => {
setTimeout(() => {
- uni.navigateBack()
+ // uni.navigateBack()
}, 1500)
}
})
},
+ // 房屋弹窗
showLabelPopup(item) {
+ // 先清空
+ this.number = 0
+ this.labelValue = ""
+ this.remark = ""
this.popupShow = true
this.labelModelInfo.title = item.name
this.currentLabelInfo = item
+ // 遍历标签集合
+ this.labelList.forEach(e=>{
+ if(e.color == item.color){
+ this.labelValue = e.name
+ this.remark = item.remark
+ this.number = 1
+ }
+ })
},
popupConfirm() {
@@ -213,6 +292,7 @@
radioChange(item) {
this.currentColorInfo = item
},
+ // 更新房屋标签
async popupConfirm() {
const {
id
@@ -223,11 +303,25 @@
} = this.currentColorInfo
let res = null
if (name === '撤销') {
- res = await removeHouseLabel(id)
+ if(this.number==1){
+ const data = {
+ labelId:id,
+ houseCode: this.houseCode
+ }
+ res = await removeHouseLabel(data)
+ }else{
+ uni.showToast({
+ title: "无可撤销项",
+ icon: "error",
+ duration: 1500
+ })
+ return
+ }
} else {
res = await updateHouseLabel({
houseCode: this.houseCode,
labelId: id,
+ remark:this.remark,
color
})
}
@@ -239,52 +333,11 @@
})
return
}
- this.getLabelList()
+ // 刷新页面
+ this.getHouseDetailInfo()
this.popupShow = false
},
- // 获取房屋详情
- async getHouseDetailInfo() {
- const param = {
- houseCode : this.houseCode
- }
- const res = await getHouseDetail(param)
- if(null != res.data){
- const images = []
- const {
- phone,
- address,
- propertyPrice,
- serviceDue,
- imageUrls
- } = res.data
- if(imageUrls.length>0){
- const urls = imageUrls.split(',')
- // 遍历
- urls.forEach(e=>{
- images.push({
- url:minioBaseUrl + e,
- name: e
- })
- })
- }
- this.form = {
- phone,
- address,
- propertyPrice,
- serviceDue,
- imageUrls,
- images
- }
- }
- },
- // 获取房屋标签信息
- async getLabelList() {
- const param = {
- parentId:1001
- }
- const res = await getLabelListByParentId(param)
- this.labelBtnList = res.data
- },
+
}
}
</script>
--
Gitblit v1.9.3