feat: 统计完成

This commit is contained in:
wanglei
2024-06-27 10:47:18 +08:00
parent 00105f6a7d
commit c707186f48
2 changed files with 172 additions and 55 deletions

View File

@@ -11,22 +11,25 @@
</div> </div>
<div class="flex-row"> <div class="flex-row">
<div class="left-row flex-col"> <div class="left-row flex-col">
<ai-title title="6月五星门店(排名不分先后)"> <ai-title :title="`${new Date().getMonth()}月五星门店(排名不分先后)`">
<template #rightBtn> <template #rightBtn>
<label class="tooltip">默认选择一个网格</label> <ai-select
<el-select placeholder="请选择网格" v-model="form.data" size="small"> v-model="search.girdCode"
<el-option @change="(search.current = 1), getList()"
v-for="item in []" placeholder="请选择网格"
:key="item.value" size="small"
:label="item.label" :selectList="gridList">
:value="item.value"> </ai-select>
</el-option>
</el-select>
</template> </template>
</ai-title> </ai-title>
<ai-table :is-show-pagination="false" <div class="table-wrap">
:tableData="tableData" <ai-table :is-show-pagination="false"
:col-configs="colConfigs"></ai-table> :tableData="tableData"
style="height: 100%"
height="100%"
:col-configs="colConfigs"></ai-table>
</div>
</div> </div>
<div class="right-row flex-col"> <div class="right-row flex-col">
<ai-title title="网格五星门店数量排名"></ai-title> <ai-title title="网格五星门店数量排名"></ai-title>
@@ -37,26 +40,26 @@
<ai-search-bar> <ai-search-bar>
<template #left> <template #left>
<ai-select <ai-select
v-model="search.applyItemId" v-model="form.operatorType"
@change="(search.current = 1), getList()" @change="(form.current = 1), getList1()"
placeholder="经营类型" placeholder="经营类型"
:selectList="[]"> :selectList="$dict.getDict('operatorType')">
</ai-select> </ai-select>
<ai-select <ai-select
v-model="search.applyItemId" v-model="form.girdCode"
@change="(search.current = 1), getList()" @change="(form.current = 1), getList1()"
placeholder="所属网格" placeholder="所属网格"
:selectList="[]"> :selectList="gridList">
</ai-select> </ai-select>
</template> </template>
<template #right> <template #right>
<el-input <el-input
v-model="search.createUserName" v-model="form.shopName"
size="small" size="small"
v-throttle="() => {search.current = 1, getList()}" v-throttle="() => {form.current = 1, getList1()}"
placeholder="请输入门店名称" placeholder="请输入门店名称"
clearable clearable
@clear="search.current = 1, search.createUserName = '', getList()" @clear="form.current = 1, form.shopName = '', getList1()"
suffix-icon="iconfont iconSearch"> suffix-icon="iconfont iconSearch">
</el-input> </el-input>
</template> </template>
@@ -73,13 +76,13 @@
slot="pic" slot="pic"
align="left"> align="left">
<template v-slot="{ row }"> <template v-slot="{ row }">
<img :src="row.picUrl" alt="" v-viewer> <img :src="row.fileUrl" alt="" v-viewer>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="门店评分" slot="mark" align="center"> <el-table-column label="门店评分" slot="mark" align="center">
<template v-slot="{row}"> <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> </template>
</el-table-column> </el-table-column>
@@ -94,56 +97,163 @@ let chartInstance = null;
export default { export default {
name: "AppMarkStatic", name: "AppMarkStatic",
label: '门店统计', label: '门店统计',
props: {
instance: Function,
dict: Object
},
data() { data() {
return { return {
data: {}, data: {},
form: {}, form: {
search:{}, current:1,
pages:10,
operatorType:'',
girdCode:'',
shopName:'',
},
search: {
girdCode:'',
fiveStartTime:new Date().getMonth().toString(),
storeLevel:'5',
pages:1000
},
cardList: [ cardList: [
{ {
label: '门店总数量', label: '门店总数量',
value: 122 value: 0
}, },
{ {
label: '总网格数', label: '总网格数',
value: 122 value: 0
}, },
{ {
label: '总网格员', label: '总网格员',
value: 122 value: 0
}, },
{ {
label: '五星门店', label: '五星门店',
value: 122 value: 0
} }
], ],
gridList:[],
tableData: [], tableData: [],
colConfigs: [ colConfigs: [
{prop: '1', label: '门店名称', align: 'center'}, {prop: 'shopName', label: '门店名称', align: 'center'},
{prop: '2', label: '经营类型', align: 'center'}, {prop: 'operatorType', label: '经营类型', align: 'center',render:(h,{row})=>{
{prop: '3', label: '经营者名称', align: 'center'}, return h('span',null,this.dict.getLabel('operatorType',row.operatorType))
}},
{prop: 'name', label: '经营者名称', align: 'center'},
], ],
total: 10, total: 10,
colConfigs1: [ colConfigs1: [
{type: "selection"}, {type: "selection"},
{ slot: 'pic', align: 'center' }, {slot: 'pic', align: 'center'},
{ prop: 'integralUserName', label: '门店名称', align: 'center' }, {prop: 'shopName', label: '门店名称', align: 'center'},
{ prop: 'areaName', label: '经营者姓名', align: 'center' }, {prop: 'name', label: '经营者姓名', align: 'center'},
{ prop: 'girdName', label: '联系电话', align: 'center' }, {prop: 'phone', label: '联系电话', align: 'center'},
{ prop: 'createTime', label: '录入时间', align: 'center' }, {prop: 'createTime', label: '录入时间', align: 'center'},
{ prop: 'createTime', label: '所属网格', align: 'center' }, {prop: 'girdName', label: '所属网格', align: 'center'},
{ prop: 'status', label: '门店地址', align: 'center'}, {prop: 'address', label: '门店地址', align: 'center'},
{ prop: 'auditUserName', label: '经营类型', align: 'center' }, {prop: 'operatorType', label: '经营类型', align: 'center',render:(h,{row})=>{
{slot:'mark',align: 'center'} return h('span',null,this.dict.getLabel('operatorType',row.operatorType))
}},
{slot: 'mark', align: 'center'}
], ],
tableData1: [], tableData1: [],
chartList:[]
} }
}, },
methods: { mounted() {
getList(){ this.$dict.load('operatorType').then(()=>{
this.girdList()
this.queryShopDetail()
this.getList()
this.countByFiveStars()
})
},
methods: {
async countByFiveStars(){
try {
const {code, data:{records}} = await this.instance.post('/app/appShopStatistics/countByFiveStars',null,{
pages:1000
})
if (code === 0) {
this.chartList = records?.reverse() || []
this.initChart()
}
} catch (e) {
console.log(e)
}
}, },
async girdList() {
try {
const {code, data:{records}} = await this.instance.post('/app/appShopStatistics/girdList',null,{
pages:1000
})
if (code === 0) {
this.gridList = records?.map(item=>{
return {
dictName:item.girdName,
dictValue:item.girdCode
}
})
}
} catch (e) {
console.log(e)
}
},
async queryShopDetail() {
try {
const {code, data} = await this.instance.post('/app/appShopStatistics/queryShopDetail')
if (code === 0) {
const list = ['shopCounts','girdCounts','girdPersons','fiveStarsShops']
list.forEach((item,index)=>{
this.cardList[index].value = data[item]
})
}
} catch (e) {
console.log(e)
}
},
// 五星门店列表查询
async getList() {
try {
const {code, data:{records}} = await this.instance.post('/app/appshoparchives/list',null,{
params:{
...this.search,
}
})
if (code === 0) {
this.tableData = records
}
} catch (e) {
console.log(e)
}
},
// 列表查询
async getList2() {
try {
const {code, data:{records,total}} = await this.instance.post('/app/appShopStatistics/list',null,{
params:{
...this.form,
}
})
if (code === 0) {
this.total = total
this.tableData1 = records
}
} catch (e) {
console.log(e)
}
},
resize() { resize() {
if (chartInstance) { if (chartInstance) {
chartInstance.resize() chartInstance.resize()
@@ -174,16 +284,16 @@ export default {
}, },
yAxis: { yAxis: {
type: 'category', type: 'category',
data: ['Brazil', 'Indonesia', 'USA', 'India', 'China', 'World'] data: this.chartList?.map(item=>item.girdName)
}, },
series: [ series: [
{ {
name: '2012',
type: 'bar', type: 'bar',
itemStyle:{ barWidth:'20%',
color:'#389FFF' itemStyle: {
color: '#389FFF',
}, },
data: [19325, 23438, 31000, 121594, 134141, 681807] data: this.chartList?.map(item=>item.fiveStarsCount)
} }
] ]
}) })
@@ -192,10 +302,6 @@ export default {
} }
}, },
mounted() {
this.initChart()
},
beforeDestroy() { beforeDestroy() {
if (chartInstance) { if (chartInstance) {
chartInstance.dispose() chartInstance.dispose()
@@ -263,6 +369,7 @@ export default {
.left-row { .left-row {
height: 100%; height: 100%;
width: 50%; width: 50%;
display: flex;
} }
.right-row { .right-row {
@@ -274,6 +381,11 @@ export default {
.flex-col { .flex-col {
flex-direction: column; flex-direction: column;
} }
.table-wrap{
flex: 1;
overflow: hidden;
}
} }
.mt-10 { .mt-10 {

View File

@@ -124,7 +124,10 @@ export default {
], ],
tableData: [], tableData: [],
dialog:false, dialog:false,
form:{}, form:{
startTime:'',
endTime:''
},
rules:{ rules:{
taskName:[ { required: true, message: '请输入任务名称', trigger: 'blur' }], taskName:[ { required: true, message: '请输入任务名称', trigger: 'blur' }],
startTime:[ { required: true, message: '请选择开始时间', trigger: 'change' }], startTime:[ { required: true, message: '请选择开始时间', trigger: 'change' }],
@@ -148,7 +151,9 @@ export default {
if(valid){ if(valid){
try { try {
const {code} = await this.instance.post('/app/apptaskmanage/addOrUpdate',{ const {code} = await this.instance.post('/app/apptaskmanage/addOrUpdate',{
...this.form ...this.form,
startTime:`${this.form.startTime} 00:00:00`,
endTime:`${this.form.startTime} 23:59:59`,
}) })
if(code===0){ if(code===0){
this.$message.success('保存成功') this.$message.success('保存成功')