feat: 门店档案接口
This commit is contained in:
@@ -247,7 +247,6 @@ export default {
|
||||
|
||||
getCheckedTree() {
|
||||
const nodes = this.$refs.treeRef.getCheckedNodes()
|
||||
console.log(nodes)
|
||||
if (!nodes.length) {
|
||||
return this.$message.error('请选择网格')
|
||||
}
|
||||
@@ -282,14 +281,14 @@ export default {
|
||||
|
||||
async addOrUpdate() {
|
||||
try {
|
||||
const {code, data} = await this.instance.post(`/app/appshoparchives/addOrUpdate`,{
|
||||
const {code} = await this.instance.post(`/app/appshoparchives/addOrUpdate`,{
|
||||
...this.form,
|
||||
fileId:this.form.fileUrl[0]?.id,
|
||||
fileUrl:this.form.fileUrl[0]?.path,
|
||||
})
|
||||
if (code === 0) {
|
||||
this.$message.success('保存成功');
|
||||
this.form = {...data}
|
||||
this.cancel()
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
<div>
|
||||
<ai-list class="app-archives-list">
|
||||
<template slot="title">
|
||||
<ai-title title="门店档案" isShowBottomBorder v-model="search.girdCode" isShowArea :hideLevel="hideLevel - 1"
|
||||
@change="search.current = 1, getList()"></ai-title>
|
||||
<ai-title title="门店档案" isShowBottomBorder></ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<ai-search-bar class="search-bar">
|
||||
@@ -45,6 +44,11 @@
|
||||
placeholder="经营类型"
|
||||
:selectList="$dict.getDict('operatorType')">
|
||||
</ai-select>
|
||||
<el-input disabled v-model="search.girdName" size="small" placeholder="请选择片区">
|
||||
<template slot="append">
|
||||
<el-button size="small" @click="district=true">选择片区</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</template>
|
||||
<template #right>
|
||||
<el-input
|
||||
@@ -89,13 +93,13 @@
|
||||
slot="pic"
|
||||
align="left">
|
||||
<template v-slot="{ row }">
|
||||
<img :src="row.picUrl" alt="" v-viewer>
|
||||
<img class="preview-img" v-if="row.fileUrl" :src="row.fileUrl" alt="" v-viewer>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="门店评分" slot="mark" align="center">
|
||||
<template v-slot="{row}">
|
||||
<el-rate :value="4" show-score text-color="#ff9900" disabled></el-rate>
|
||||
<el-rate :value="row.storeScore" show-score text-color="#ff9900" disabled></el-rate>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -118,12 +122,30 @@
|
||||
width="720px">
|
||||
<img :src="qrSrc" class="qr-img" alt="">
|
||||
</ai-dialog>
|
||||
|
||||
<ai-dialog title="选择片区" :visible.sync="district" :customFooter="true" border width="720px">
|
||||
<div class="grid">
|
||||
<el-tree
|
||||
:data="treeList"
|
||||
:props="defaultProps"
|
||||
node-key="id"
|
||||
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="district=false">取消</el-button>
|
||||
<el-button type="primary" size="medium" @click="getCheckedTree">确认</el-button>
|
||||
</div>
|
||||
</ai-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {MessageBox} from 'element-ui'
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'List',
|
||||
@@ -138,6 +160,9 @@ export default {
|
||||
girdCode: '',
|
||||
current: 1,
|
||||
size: 10,
|
||||
girdCode:'',
|
||||
girdName:'',
|
||||
girdInfoList:[]
|
||||
},
|
||||
ids: [],
|
||||
userList: [],
|
||||
@@ -157,31 +182,77 @@ export default {
|
||||
tableData: [],
|
||||
dateList: [],
|
||||
dialog: false,
|
||||
qrSrc: ''
|
||||
district: false,
|
||||
qrSrc: '',
|
||||
currCheckedKeys: [],
|
||||
treeList: [],
|
||||
treeObj: {
|
||||
checkedKeys: [],
|
||||
},
|
||||
defaultExpandedKeys: [],
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "girdName",
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
|
||||
hideLevel() {
|
||||
return this.user.info.areaList.length || 0
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
this.search.areaId = this.user.info.areaId
|
||||
this.$dict.load('yesOrNo', 'storeLevel', 'operatorType').then(() => {
|
||||
this.getList()
|
||||
this.beforeSelectTree()
|
||||
})
|
||||
},
|
||||
|
||||
methods: {
|
||||
onCheckChange(){
|
||||
|
||||
},
|
||||
|
||||
beforeSelectTree() {
|
||||
this.treeObj.checkedKeys = [];
|
||||
this.instance.post(`/app/appgirdinfo/listAll3`, null, null).then((res) => {
|
||||
if (res.code == 0) {
|
||||
this.search.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'
|
||||
}))
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleSelectionChange(e) {
|
||||
this.ids = e.map(v=>v.id)
|
||||
},
|
||||
|
||||
getCheckedTree() {
|
||||
const nodes = this.$refs.treeRef.getCheckedNodes()
|
||||
|
||||
if (nodes.length > 1) {
|
||||
return this.$message.error('不支持多选')
|
||||
}
|
||||
|
||||
this.currCheckedKeys = [nodes[0]?.id]
|
||||
this.search.girdCode = nodes[0]?.girdCode
|
||||
this.search.girdName = nodes[0]?.girdName
|
||||
this.district = false;
|
||||
this.getList()
|
||||
},
|
||||
|
||||
handleAdd() {
|
||||
this.$emit('change', {
|
||||
type: 'Add',
|
||||
@@ -190,19 +261,21 @@ export default {
|
||||
},
|
||||
|
||||
async handleDelBatch() {
|
||||
try {
|
||||
const {code} = await this.instance.post('/app/appshoparchives/delete', null, {
|
||||
params: {
|
||||
ids: this.ids.join(',')
|
||||
this.$confirm('确定删除该数据?').then(async ()=>{
|
||||
try {
|
||||
const {code} = await this.instance.post('/app/appshoparchives/delete', null, {
|
||||
params: {
|
||||
ids: this.ids.join(',')
|
||||
}
|
||||
})
|
||||
if (code === 0) {
|
||||
this.$message.success('删除成功')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
if (code === 0) {
|
||||
this.$message.success('删除成功')
|
||||
this.getList()
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onGridChange(e) {
|
||||
@@ -257,7 +330,7 @@ export default {
|
||||
this.$confirm('确定删除该数据?').then(async () => {
|
||||
try {
|
||||
const {code} = await this.instance.post('/app/appshoparchives/delete', null, {
|
||||
params: {id}
|
||||
params: {ids:id}
|
||||
})
|
||||
if (code === 0) {
|
||||
this.$message.success("删除成功")
|
||||
@@ -304,5 +377,11 @@ export default {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.preview-img{
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user