MrShi
2025-01-02 77d8f6ccb72cb64c29e77c39fcc8298781d008bb
admin/src/views/project/components/OperaYwBuildingWindow.vue
@@ -1,5 +1,5 @@
<template>
  <GlobalWindow width="900px" :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" clearable placeholder="请选择项目">
        <el-select v-model="form.projectId" filterable clearable>
@@ -19,7 +19,7 @@
        <el-input type="textarea" :rows="4" v-model="form.remark" placeholder="请输入" />
      </el-form-item>
      <el-form-item label="建筑面积(m²)" prop="area">
        <el-input v-model="form.area" placeholder="请输入简直面积(m²)" v-trim />
        <el-input v-model="form.area" placeholder="请输入建筑面积(m²)" v-trim />
      </el-form-item>
      <el-form-item label="产权面积(m²)" prop="cqArea">
        <el-input v-model="form.cqArea" placeholder="请输入产权面积(m²)" v-trim />
@@ -41,6 +41,7 @@
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { getProjectList } from '@/api/project/ywProject'
import { detailById } from '@/api/project/ywBuilding'
export default {
  name: 'OperaYwBuildingWindow',
  extends: BaseOpera,
@@ -88,9 +89,38 @@
    })
  },
  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(() => {
        console.log('----')
        this.getDetail(target.id)
      })
    },
    getDetail(id) {
      detailById(id).then(res => {
        this.form = res
      })
    },
    getProject() {
      getProjectList({}).then(res => {
        this.projectList = res || []
        if (this.projectList.length > 0) {
          this.$set(this.form, 'projectId', this.projectList[0].id)
          // this.changeProject(this.projectList[0].id)
        }
      })
    }
  }