|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <GlobalWindow | 
|---|
|  |  |  | :title="title" | 
|---|
|  |  |  | :visible.sync="visible" | 
|---|
|  |  |  | :confirm-working="isWorking" | 
|---|
|  |  |  | @confirm="confirm" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <GlobalWindow width="600px" :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm"> | 
|---|
|  |  |  | <el-form :model="form" ref="form" :rules="rules"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <el-form-item label="项目名称" prop="name"> | 
|---|
|  |  |  | <el-input v-model="form.name" placeholder="请输入名称" v-trim/> | 
|---|
|  |  |  | <el-input v-model="form.name" placeholder="请输入名称" v-trim /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="所属地址" prop="addr"> | 
|---|
|  |  |  | <el-input v-model="form.addr" placeholder="请输入详细地址"/> | 
|---|
|  |  |  | <el-form-item label="所属地区" prop="areaId"> | 
|---|
|  |  |  | <el-cascader v-model="form.areaIdT" :props="{ | 
|---|
|  |  |  | label: 'name', | 
|---|
|  |  |  | value: 'id', | 
|---|
|  |  |  | children: 'childList' | 
|---|
|  |  |  | }" :options="treeList" @change="handleChange"></el-cascader> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="详细地址" prop="addr"> | 
|---|
|  |  |  | <el-input v-model="form.addr" placeholder="请输入详细地址"/> | 
|---|
|  |  |  | <el-input v-model="form.addr" placeholder="请输入详细地址" /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="项目简介" prop="desc"> | 
|---|
|  |  |  | <el-input type="textarea" :rows="4" v-model="form.desc" placeholder="请输入"/> | 
|---|
|  |  |  | <el-form-item label="项目简介" prop="remark"> | 
|---|
|  |  |  | <el-input type="textarea" :rows="4" v-model="form.remark" placeholder="请输入" /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | </el-form> | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | 
|---|
|  |  |  | <script> | 
|---|
|  |  |  | import BaseOpera from '@/components/base/BaseOpera' | 
|---|
|  |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
|---|
|  |  |  | import { getCityTree } from '@/api/system/common' | 
|---|
|  |  |  | import { detailById } from '@/api/project/ywProject' | 
|---|
|  |  |  | export default { | 
|---|
|  |  |  | name: 'OperaYwProjectWindow', | 
|---|
|  |  |  | extends: BaseOpera, | 
|---|
|  |  |  | components: { GlobalWindow }, | 
|---|
|  |  |  | data () { | 
|---|
|  |  |  | data() { | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | // 表单数据 | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | id: null, | 
|---|
|  |  |  | id: '', | 
|---|
|  |  |  | creator: '', | 
|---|
|  |  |  | createDate: '', | 
|---|
|  |  |  | editor: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | status: '', | 
|---|
|  |  |  | sortnum: '', | 
|---|
|  |  |  | imgurl: '', | 
|---|
|  |  |  | areaIdT: '', | 
|---|
|  |  |  | cityId: '', | 
|---|
|  |  |  | areaId: '', | 
|---|
|  |  |  | provinceId: '', | 
|---|
|  |  |  | addr: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // 验证规则 | 
|---|
|  |  |  | rules: { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | name: [{ required: true, message: '请输入项目名称', trigger: 'blur' }] | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | projectList: [], | 
|---|
|  |  |  | treeList: [] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | created () { | 
|---|
|  |  |  | created() { | 
|---|
|  |  |  | this.config({ | 
|---|
|  |  |  | api: '/project/ywProject', | 
|---|
|  |  |  | 'field.id': 'id' | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | methods: { | 
|---|
|  |  |  | open(title, target) { | 
|---|
|  |  |  | this.title = title | 
|---|
|  |  |  | this.visible = true | 
|---|
|  |  |  | this.initData() | 
|---|
|  |  |  | if (target == null) { | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | this.form = { | 
|---|
|  |  |  | id: '', | 
|---|
|  |  |  | creator: '', | 
|---|
|  |  |  | createDate: '', | 
|---|
|  |  |  | editor: '', | 
|---|
|  |  |  | editDate: '', | 
|---|
|  |  |  | isdeleted: '', | 
|---|
|  |  |  | name: '', | 
|---|
|  |  |  | remark: '', | 
|---|
|  |  |  | status: '', | 
|---|
|  |  |  | sortnum: '', | 
|---|
|  |  |  | imgurl: '', | 
|---|
|  |  |  | areaIdT: '', | 
|---|
|  |  |  | cityId: '', | 
|---|
|  |  |  | areaId: '', | 
|---|
|  |  |  | provinceId: '', | 
|---|
|  |  |  | addr: '' | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$refs.form.resetFields() | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$nextTick(() => { | 
|---|
|  |  |  | for (const key in this.form) { | 
|---|
|  |  |  | this.form[key] = target[key] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.$set(this.form, 'areaIdT', [target.provinceId, target.cityId, target.areaId,]) | 
|---|
|  |  |  | // console.log(this.form) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | handleChange(e) { | 
|---|
|  |  |  | if (e && e.length > 0) { | 
|---|
|  |  |  | if (e.length == 3) { | 
|---|
|  |  |  | this.$set(this.form, 'areaId', e[2]) | 
|---|
|  |  |  | } else if (e.length == 2) { | 
|---|
|  |  |  | this.$set(this.form, 'areaId', e[1]) | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.$set(this.form, 'areaId', e[0]) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getDetail(id) { | 
|---|
|  |  |  | detailById(id).then(res => { | 
|---|
|  |  |  | this.form = res | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | initData() { | 
|---|
|  |  |  | getCityTree({ | 
|---|
|  |  |  | "type": 0 | 
|---|
|  |  |  | }).then(res => { | 
|---|
|  |  |  | this.treeList = res | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|