From 798dcfbbc3ab2a81d1e873b25e00bf5e4ed03aa7 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期一, 02 十二月 2024 18:11:54 +0800
Subject: [PATCH] ll

---
 admin/src/views/project/components/OperaYwRoomWindow.vue |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/admin/src/views/project/components/OperaYwRoomWindow.vue b/admin/src/views/project/components/OperaYwRoomWindow.vue
index e810e56..cdfdf2d 100644
--- a/admin/src/views/project/components/OperaYwRoomWindow.vue
+++ b/admin/src/views/project/components/OperaYwRoomWindow.vue
@@ -1,5 +1,5 @@
 <template>
-  <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
+  <GlobalWindow width="720px" :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
     <el-form :model="form" ref="form" :rules="rules">
       <el-form-item label="鎵�灞為」鐩�" prop="projectId">
         <el-select v-model="form.projectId" @change="changeProject" placeholder="璇烽�夋嫨椤圭洰" clearable>
@@ -45,6 +45,7 @@
 import { getProjectList } from '@/api/project/ywProject'
 import { getBuildList } from '@/api/project/ywBuilding'
 import { getFloorList } from '@/api/project/yeFloor'
+import { detailById } from '@/api/project/ywRoom'
 export default {
   name: 'OperaYwRoomWindow',
   extends: BaseOpera,
@@ -96,6 +97,39 @@
     })
   },
   methods: {
+    open(title, target, type) {
+      this.title = title
+      this.visible = true
+      this.getProject()
+      // 鏂板缓缁勭粐
+      if (target == null) {
+        this.$nextTick(() => {
+          this.$refs.form.resetFields()
+          this.form[this.configData['field.id']] = null
+          this.form.type = type
+        })
+        return
+      }
+      // 缂栬緫
+      this.$nextTick(() => {
+        this.getDetail(target.id)
+      })
+    },
+    getDetail(id) {
+      detailById(id).then(res => {
+        this.form = res || {}
+        if (res.projectId) {
+          getBuildList({ projectId: res.projectId }).then(res => {
+            this.buildList = res || []
+          })
+        }
+        if (res.buildingId) {
+          getFloorList({ buildingId: res.buildingId }).then(res => {
+            this.floorList = res || []
+          })
+        }
+      })
+    },
     getProject() {
       getProjectList({}).then(res => {
         this.projectList = res || []
@@ -104,13 +138,13 @@
     },
     changeProject(e) {
       this.form.buildingId = ''
-      getBuildList({projectId: e}).then(res => {
+      getBuildList({ projectId: e }).then(res => {
         this.buildList = res || []
       })
     },
     changeBuild(e) {
       this.form.floor = ''
-      getFloorList({buildingId: e}).then(res => {
+      getFloorList({ buildingId: e }).then(res => {
         this.floorList = res || []
       })
     },

--
Gitblit v1.9.3