BUG 27051
This commit is contained in:
@@ -1,46 +1,53 @@
|
||||
<template>
|
||||
<ai-detail showFooter class="add-detail">
|
||||
<template slot="title">
|
||||
<ai-title :title="isEdit ? '编辑小区信息' : '添加小区'" :isShowBack="true" @onBackClick="cancel()" :isShowBottomBorder="true"></ai-title>
|
||||
<ai-title :title="isEdit ? '编辑小区信息' : '添加小区'" :isShowBack="true" @onBackClick="cancel()"
|
||||
:isShowBottomBorder="true"></ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<div class="add-form">
|
||||
<ai-bar title="基础信息"></ai-bar>
|
||||
<el-form label-width="110px" style="padding-bottom: 80px;" :model="form" ref="form">
|
||||
<el-form-item label="小区名称" prop="communityName" :rules="[{ required: true, message: '请输入小区名称', trigger: 'blur' }]">
|
||||
<el-form-item label="小区名称" prop="communityName"
|
||||
:rules="[{ required: true, message: '请输入小区名称', trigger: 'blur' }]">
|
||||
<el-input size="small" v-model="form.communityName" :maxlength="50" placeholder="请输入小区名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="行政归属" prop="areaId" :rules="[{ required: true, message: '请选择行政归属', trigger: 'blur' }]">
|
||||
<ai-area-get :instance="instance" v-model="form.areaId" :root="user.info.areaId" @select="handleAreaSelect" />
|
||||
<el-form-item label="行政归属" prop="areaId" :rules="[
|
||||
{ required: true, message: '请选择行政归属', trigger: 'blur' },
|
||||
{ pattern:/[^0]0{0,2}$/g, message: '请选择到村/社区' }]">
|
||||
<ai-area-get :instance="instance" v-model="form.areaId" :root="user.info.areaId"
|
||||
@select="handleAreaSelect"/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="小区地址" prop="address" :rules="[{ required: true, message: '请输入小区地址', trigger: 'blur' }]">
|
||||
<el-input size="small" v-model="form.address" placeholder="请输入小区地址" clearable=""></el-input>
|
||||
<el-input size="small" v-model="form.address" placeholder="请输入小区地址" clearable/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="所属网格" prop="girdInfoList" style="margin-top: 8px;" :rules="[{ required: true, message: '请选择所属网格', trigger: 'blur' }]">
|
||||
<el-form-item label="所属网格" prop="girdInfoList" style="margin-top: 8px;"
|
||||
:rules="[{ required: true, message: '请选择所属网格', trigger: 'blur' }]">
|
||||
<el-tag
|
||||
:key="index"
|
||||
v-for="(tag,index) in form.girdInfoList"
|
||||
closable
|
||||
style="margin-right: 16px;"
|
||||
:disable-transitions="false"
|
||||
@close="handleClose(tag)">
|
||||
{{tag.girdName}}
|
||||
</el-tag>
|
||||
<el-button size="small" @click="showGrid=true">选择网格</el-button>
|
||||
:key="index"
|
||||
v-for="(tag,index) in form.girdInfoList"
|
||||
closable
|
||||
style="margin-right: 16px;"
|
||||
:disable-transitions="false"
|
||||
@close="handleClose(tag)">
|
||||
{{ tag.girdName }}
|
||||
</el-tag>
|
||||
<el-button size="small" @click="showGrid=true">选择网格</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<ai-dialog title="选择网格" :visible.sync="showGrid" :customFooter="true" :destroyOnClose="true" @opened="beforeSelectTree" border width="720px">
|
||||
<ai-dialog title="选择网格" :visible.sync="showGrid" :customFooter="true" :destroyOnClose="true"
|
||||
@opened="beforeSelectTree" border width="720px">
|
||||
<div class="grid">
|
||||
<el-tree :data="treeObj.treeList" :props="treeObj.defaultProps" node-key="id" ref="tree" :check-strictly="true" show-checkbox
|
||||
:default-checked-keys="treeObj.checkedKeys" default-expand-all highlight-current>
|
||||
</el-tree>
|
||||
<el-tree :data="treeObj.treeList" :props="treeObj.defaultProps" node-key="id" ref="tree"
|
||||
:check-strictly="true" show-checkbox
|
||||
:default-checked-keys="treeObj.checkedKeys" default-expand-all highlight-current>
|
||||
</el-tree>
|
||||
</div>
|
||||
<div class="dialog-footer" slot="footer" >
|
||||
<el-button size="medium" @click="showGrid=false">取消</el-button>
|
||||
<el-button type="primary" size="medium" @click="getCheckedTree()">确认</el-button>
|
||||
<div class="dialog-footer" slot="footer">
|
||||
<el-button size="medium" @click="showGrid=false">取消</el-button>
|
||||
<el-button type="primary" size="medium" @click="getCheckedTree()">确认</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
</template>
|
||||
@@ -52,7 +59,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
import {mapState} from 'vuex'
|
||||
|
||||
export default {
|
||||
name: 'Add',
|
||||
@@ -114,7 +121,7 @@ export default {
|
||||
this.instance.post(`/app/appgirdinfo/listAll`, null, null).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.treeObj.treeList = res.data;
|
||||
if(this.form.girdInfoList.length) {
|
||||
if (this.form.girdInfoList.length) {
|
||||
this.form.girdInfoList.map((e) => {
|
||||
this.treeObj.checkedKeys.push(e.id);
|
||||
});
|
||||
@@ -141,7 +148,7 @@ export default {
|
||||
this.form.areaName = res.data.areaName
|
||||
this.form.girdId = res.data.girdId
|
||||
this.form.girdName = res.data.girdName
|
||||
this.form.girdInfoList = [{id:res.data.girdId, girdName: res.data.girdName}]
|
||||
this.form.girdInfoList = [{id: res.data.girdId, girdName: res.data.girdName}]
|
||||
this.$set(this.form, 'areaId', res.data.areaId)
|
||||
}
|
||||
})
|
||||
@@ -157,18 +164,18 @@ export default {
|
||||
this.form.girdName = this.form.girdInfoList[0].girdName
|
||||
this.form.girdId = this.form.girdInfoList[0].id
|
||||
this.instance
|
||||
.post(`/app/appcommunityinfo/addOrUpdate`, {
|
||||
...this.form,
|
||||
id: this.params ? this.params.id : '',
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success('提交成功')
|
||||
setTimeout(() => {
|
||||
this.cancel(true)
|
||||
}, 800)
|
||||
}
|
||||
})
|
||||
.post(`/app/appcommunityinfo/addOrUpdate`, {
|
||||
...this.form,
|
||||
id: this.params ? this.params.id : '',
|
||||
})
|
||||
.then((res) => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success('提交成功')
|
||||
setTimeout(() => {
|
||||
this.cancel(true)
|
||||
}, 800)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user