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