From 426393d7d72ee548af531d09bdea7748ce0ea494 Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Sat, 23 Mar 2024 23:46:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=88=BF=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home.vue | 2 -- src/views/Room.vue | 48 ++++++++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 009061f..f9b5433 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -10,7 +10,6 @@

{{ item.name }}

{{ item.description }}

-

{{ item.content }}

管理 编辑 删除 @@ -98,7 +97,6 @@ const add_project = async () => { data: add_project_info, } const res = await myApi.getProjects(param); - console.log(res); if (res.code === 0) { ElMessage({ message: "新增成功", diff --git a/src/views/Room.vue b/src/views/Room.vue index 8c87710..59e2c51 100644 --- a/src/views/Room.vue +++ b/src/views/Room.vue @@ -3,8 +3,8 @@
- 项目管理 - 项目预览 + 项目管理 + 项目预览
新建 @@ -14,7 +14,7 @@ :class="{ 'selectDiv': item.room_name === currentRoom.room_name }"> {{ item.room_name }} {{ item.room_count }} - +
@@ -39,7 +39,7 @@

{{ item.label }}

- +

@@ -164,7 +164,11 @@ const project = reactive({ const room_info = reactive({ room_name: '', room_count: 1, - lightInfo: 1, // 灯光信息 + lightNum0: 1, // 开关回路 + lightNum1: 1,//0-10V调光 + lightNum2: 1,//前沿调光 + lightNum3: 1,//后沿调光 + lightNum4:1, //DALI灯 type1: 0,// 盘管类型 type2: 0, type3: 0, @@ -196,10 +200,6 @@ const get_project = async () => { } const res = await myApi.getProjects(param); if (res.code === 0) { - ElMessage({ - message: res.message, - type: "success", - }); project.name = res.data.name; project.description = res.data.description; if (Array.isArray(res.data.content)) { @@ -216,7 +216,15 @@ const get_project = async () => { } } const delet_room = (item) => { - get_project(); + if(project.content.length === 1) { + ElMessage.warning('至少保留一个。。') + return; + } + project.content = project.content.filter(ele => { + return ele.room_name !== item.room_name; + }) + console.log(123,project); + save_room(); } onMounted(() => { get_project(); @@ -224,24 +232,21 @@ onMounted(() => { const select_room = (item) => { currentRoom.value = item; - console.log(123, currentRoom); } const add_room = () => { if (!Array.isArray(project.content)) { project.content = [] } - room_info.room_name = "房型" + (project.content.length + 1); - project.content.push(room_info); + let target=JSON.parse(JSON.stringify(room_info)); + target.room_name = "房型" + (project.content.length + 1); + project.content.push(target); console.log(1, project.content); } -const saveProject = async () => { +const save_room = async () => { const param = { - action: 102, - data: { - ...project, - new_name: project.name - }, + action: 1021, + data: project } const res = await myApi.getProjects(param); console.log(res); @@ -259,6 +264,11 @@ const saveProject = async () => { } } +const goHome = () => { + save_room(); + router.push('home'); +} + const lightArr = reactive([{ label: '开关回路',