feat: 片区选择
This commit is contained in:
@@ -68,7 +68,7 @@
|
||||
<el-form-item label="所属片区:" style="width: 100%;" prop="girdCode">
|
||||
<el-input disabled v-model="form.girdName" size="small" placeholder="请选择片区">
|
||||
<template slot="append">
|
||||
<el-button size="small" @click="handleSelectGrid">选择片区</el-button>
|
||||
<el-button size="small" @click="dialog=true">选择片区</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@@ -94,7 +94,7 @@
|
||||
<el-form-item label="门店住址:" style="width: 100%;" prop="addressCode">
|
||||
<ai-area-select :instance="instance" clearable always-show
|
||||
:disabled-level="$store.state.user.info.areaList.length"
|
||||
@name="v=>form.areaName=v" v-model="form.areaId"/>
|
||||
@name="v=>form.areaName=v" v-model="form.addressCode"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="" style="width:100%" prop="address">
|
||||
<el-input
|
||||
@@ -127,12 +127,14 @@
|
||||
ref="treeRef"
|
||||
:check-strictly="true"
|
||||
show-checkbox
|
||||
:default-expanded-keys="currCheckedKeys"
|
||||
:default-checked-keys="currCheckedKeys"
|
||||
@check="onCheckChange">
|
||||
</el-tree>
|
||||
</div>
|
||||
<div class="dialog-footer" slot="footer">
|
||||
<el-button size="medium" @click="dialog=false">取消</el-button>
|
||||
<el-button type="primary" size="medium" @click="getCheckedTree()">确认</el-button>
|
||||
<el-button type="primary" size="medium" @click="getCheckedTree">确认</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
@@ -161,9 +163,15 @@ export default {
|
||||
phone: '',
|
||||
birthday: '',
|
||||
age: '',
|
||||
girdInfoList:[]
|
||||
},
|
||||
currCheckedKeys:[],
|
||||
dialog: false,
|
||||
treeList: [],
|
||||
treeObj: {
|
||||
checkedKeys: [],
|
||||
},
|
||||
defaultExpandedKeys: [],
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "girdName",
|
||||
@@ -183,6 +191,7 @@ export default {
|
||||
},
|
||||
|
||||
created() {
|
||||
this.beforeSelectTree()
|
||||
this.form.areaId = this.$store.state.user.info.areaId
|
||||
this.$dict.load('sex', 'operatorType')
|
||||
|
||||
@@ -191,7 +200,33 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
beforeSelectTree() {
|
||||
this.treeObj.checkedKeys = [];
|
||||
this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.form.girdInfoList.map((e) => {
|
||||
this.treeObj.checkedKeys.push(e.id);
|
||||
});
|
||||
|
||||
this.treeList = res.data.filter(e => !e.parentGirdId)
|
||||
const parentGirdId = this.treeList[0].id
|
||||
|
||||
this.treeList.map(p => this.addChild(p, res.data.map(v => {
|
||||
if (v.id === parentGirdId) {
|
||||
this.defaultExpandedKeys.push(v.id)
|
||||
}
|
||||
|
||||
return {
|
||||
...v
|
||||
}
|
||||
}), {
|
||||
parent: 'parentGirdId'
|
||||
}))
|
||||
}
|
||||
});
|
||||
},
|
||||
async getDetail({id}){
|
||||
try {
|
||||
const {code,data} = await this.instance.post('/app/appshoparchives/queryDetailById',null,{
|
||||
@@ -206,21 +241,21 @@ export default {
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
async handleSelectGrid() {
|
||||
try {
|
||||
this.dialog = true
|
||||
const {code, data} = await this.instance.post('/app/appgirdinfo/listAll3')
|
||||
if (code === 0) {
|
||||
console.log('data--->', data)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
},
|
||||
|
||||
getCheckedTree() {
|
||||
const nodes = this.$refs.treeRef.getCheckedNodes()
|
||||
if (!nodes.length) {
|
||||
return this.$message.error('请选择网格')
|
||||
}
|
||||
|
||||
if (nodes.length > 1) {
|
||||
return this.$message.error('不支持多选')
|
||||
}
|
||||
|
||||
this.currCheckedKeys = [nodes[0]?.id]
|
||||
this.dialog = false;
|
||||
},
|
||||
|
||||
onCheckChange(e) {
|
||||
|
||||
},
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<ai-list class="app-archives-list">
|
||||
<template slot="title">
|
||||
<ai-title title="门店档案" isShowBottomBorder v-model="search.areaId" isShowArea :hideLevel="hideLevel - 1"
|
||||
<ai-title title="门店档案" isShowBottomBorder v-model="search.girdCode" isShowArea :hideLevel="hideLevel - 1"
|
||||
@change="search.current = 1, getList()"></ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
@@ -10,7 +10,7 @@
|
||||
<template #left>
|
||||
<el-input placeholder="请输入门店名称" v-model="search.shopName" size="small" clearable></el-input>
|
||||
<ai-select
|
||||
v-model="search.shopName"
|
||||
v-model="search.isOrNotMan"
|
||||
@change="(search.current = 1), getList()"
|
||||
placeholder="是否户主"
|
||||
:selectList="$dict.getDict('yesOrNo')">
|
||||
@@ -135,14 +135,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
search: {
|
||||
areaId: '',
|
||||
girdCode: '',
|
||||
current: 1,
|
||||
size: 10,
|
||||
applyItemId: '',
|
||||
girdId: '',
|
||||
createTimeStart: '',
|
||||
createTimeEnd: '',
|
||||
girdName: ''
|
||||
},
|
||||
ids: [],
|
||||
userList: [],
|
||||
|
||||
Reference in New Issue
Block a user