Update Room.vue

main
wangqiujuan0808 2024-03-26 10:41:49 +08:00
parent d0b56134f2
commit afd6c22ddc
1 changed files with 63 additions and 13 deletions

View File

@ -15,9 +15,9 @@
</div> </div>
<div class="room-list"> <div class="room-list">
<div v-for="(item, index) in project.content" :key="index" class="room-span" @click="select_room(item)" <div v-for="(item, index) in project.content" :key="index" class="room-span" @click="select_room(item)"
:class="{ 'selectDiv': item.room_name === current_room_info.room_name }"> :class="{ 'selectDiv': item.base_info.room_name === current_room_info.base_info.room_name }">
<span>{{ item.room_name }}</span> <span>{{ item.base_info.room_name }}</span>
<span>{{ item.room_count }}</span> <span>{{ item.base_info.room_count }}</span>
<el-button :icon="Delete" circle @click="delet_room(item)" /> <el-button :icon="Delete" circle @click="delet_room(item)" />
</div> </div>
</div> </div>
@ -28,11 +28,11 @@
<div class="flex-center bar"> <div class="flex-center bar">
<div class="div300"> <div class="div300">
<span>房型名称</span> <span>房型名称</span>
<el-input v-model="current_room_info.room_name" placeholder="请输入房型名称" /> <el-input v-model="current_room_info.base_info.room_name" placeholder="请输入房型名称" />
</div> </div>
<div class="div300"> <div class="div300">
<span>房型数量</span> <span>房型数量</span>
<el-input-number v-model="current_room_info.room_count" :min="1" :max="1000" <el-input-number v-model="current_room_info.base_info.room_count" :min="1" :max="1000"
label="描述文字"></el-input-number> label="描述文字"></el-input-number>
</div> </div>
</div> </div>
@ -174,7 +174,7 @@
<span class="name name7">备注</span> <span class="name name7">备注</span>
<div class="con-div100"> <div class="con-div100">
<div class="flex-center bar"> <div class="flex-center bar">
<el-input type="textarea" v-model="current_room_info.desc"></el-input> <el-input type="textarea" v-model="current_room_info.base_info.desc"></el-input>
</div> </div>
</div> </div>
</div> </div>
@ -201,9 +201,13 @@ const project = reactive({
content: [], content: [],
}); });
const current_room_info = reactive({ const addData = reactive({
room_name: '', base_info: {
room_count: 1, room_name: '',
room_count: 1,
desc: ''
},
light_info: {// light_info: {//
switching_circuit: 0, switching_circuit: 0,
dimming_10v: 0, dimming_10v: 0,
@ -236,7 +240,51 @@ const current_room_info = reactive({
doorbell: 1, doorbell: 1,
Housekeeping: ['DND', 'MUR'], Housekeeping: ['DND', 'MUR'],
}, },
desc: ''
})
const current_room_info = reactive({
base_info: {
room_name: '',
room_count: 1,
desc: ''
},
light_info: {//
switching_circuit: 0,
dimming_10v: 0,
dimming_leading_edge: 0,
dimming_trailing_edge: 0,
DALI: 0,
},
fcu_info: {//
fcu_type: 0,
pipe_type: 0,
valve_type: 0,
fcu_count: 0,
thermostat_count: 0,
},
panel_info: {//
panel_type: 0,
panel_count: 0,
panel_button_count: 0,
},
curtain_info: {//
curtain_type: 0,
curtain_count: 0,
sheer_curtain_count: 0,
},
other: {//
PIR: 1,
PIR2: 1,
Gate: 1,
Window: 1,
doorbell: 1,
Housekeeping: ['DND', 'MUR'],
},
}) })
const get_project = async () => { const get_project = async () => {
@ -269,7 +317,7 @@ const delet_room = (item) => {
return; return;
} }
project.content = project.content.filter(ele => { project.content = project.content.filter(ele => {
return ele.room_name !== item.room_name; return ele.base_info.room_name !== item.base_info.room_name;
}) })
save_room(); save_room();
} }
@ -279,15 +327,17 @@ onMounted(() => {
const select_room = (item) => { const select_room = (item) => {
for (const key in item) { for (const key in item) {
console.log(key);
current_room_info[key] = item[key]; current_room_info[key] = item[key];
} }
} }
const add_room = () => { const add_room = () => {
if (!Array.isArray(project.content)) { if (!Array.isArray(project.content)) {
project.content = [] project.content = []
} }
let target = JSON.parse(JSON.stringify(current_room_info)); let target = JSON.parse(JSON.stringify(addData));
target.room_name = "房型" + generateShortUUID(); target.base_info.room_name = "房型" + generateShortUUID();
project.content.push(target); project.content.push(target);
} }