Browse Source

信件大分类统计

master
laishajiang 2 years ago
parent
commit
2cc326cf2c
  1. 4
      src/api/data.ts
  2. 207
      src/views/data/category.vue
  3. 5
      src/views/data/data.vue

4
src/api/data.ts

@ -2,4 +2,8 @@ import request from '@/utils/request'
export function getlist(query: any) {
return request.get({ url: '/data/list',query })
}
export function getCategorylist(query: any) {
return request.get({ url: '/data/listForCategory',query })
}

207
src/views/data/category.vue

@ -0,0 +1,207 @@
<template>
<div class="container">
<header>
<el-form :label-width="120">
<el-row>
<el-col :span="6">
<el-form-item label="统计层级">
<el-select v-model="query.easydept" placeholder="请选择层级" clearable filterable>
<el-option v-for="item in optionsData.dept" :key="item.id" :label="item.labelName"
:value="item.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="时间范围">
<el-date-picker v-model="query.searchTime" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" format="YYYY-MM-DD HH:mm:ss" range-separator="~"
start-placeholder="开始日期" end-placeholder="结束日期" @change="handleMailTimeQuery" />
</el-form-item>
</el-col>
</el-row>
<el-row v-if="query.easydept==2">
<el-col :span="6">
<el-form-item label="二级机构">
<el-select v-model="query.sdept" placeholder="请选择机构" clearable filterable>
<el-option v-for="item in optionsData.seconddept" :key="item.id" :label="item.name"
:value="item.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<div class="flex end mb-20">
<el-button type="primary" @click="getList">查询</el-button>
<el-button @click="reset">重置</el-button>
</div>
</el-form>
</header>
<main>
<div class="table-container">
<el-table :data="statistics" style="width: 100%" :default-sort="{prop: 'allcount1', order: 'descending'}" >
<el-table-column prop="second_dept_name1" label="单位名称" align="center" width="200" />
<el-table-column key="allcount1" sortable prop="allcount1" label="信件总量" align="center" />
<el-table-column label="投诉类" align="center" >
<el-table-column prop="sumcount1" sortable label="数量" align="center" />
<el-table-column prop="countrate1" sortable label="占比" align="center" />
</el-table-column>
<el-table-column label="举报类" align="center" >
<el-table-column prop="sumcount2" sortable label="数量" align="center" />
<el-table-column prop="countrate2" sortable label="占比" align="center" />
</el-table-column>
<el-table-column label="咨询求助类" align="center" >
<el-table-column prop="sumcount3" sortable label="数量" align="center" />
<el-table-column prop="countrate3" sortable label="占比" align="center" />
</el-table-column>
<el-table-column label="工作建议类" align="center" >
<el-table-column prop="sumcount4" sortable label="数量" align="center" />
<el-table-column prop="countrate4" sortable label="占比" align="center" />
</el-table-column>
<el-table-column label="涉众金融平台类" align="center" >
<el-table-column prop="sumcount5" sortable label="数量" align="center" />
<el-table-column prop="countrate5" sortable label="占比" align="center" />
</el-table-column>
<el-table-column label="无效类" align="center" >
<el-table-column prop="sumcount6" sortable label="数量" align="center" />
<el-table-column prop="countrate6" sortable label="占比" align="center" />
</el-table-column>
<el-table-column label="终止类" align="center" >
<el-table-column prop="sumcount7" sortable label="数量" align="center" />
<el-table-column prop="countrate7" sortable label="占比" align="center" />
</el-table-column>
<el-table-column label="感谢信类" align="center" >
<el-table-column prop="sumcount8" sortable label="数量" align="center" />
<el-table-column prop="countrate8" sortable label="占比" align="center" />
</el-table-column>
</el-table>
</div>
<div class="flex mt-4 end">
<el-pagination @size-change="getList" @current-change="getList" :current-page="query.current"
:page-sizes="[10, 20, 50]" v-model:page-size="query.size" v-model:current-page="query.current"
layout="total,sizes, prev, pager, next, jumper" :total="totalSize.total">
</el-pagination>
</div>
</main>
</div>
</template>
<script lang="ts" setup>
import { useDictData } from "@/hooks/useDictOptions";
import useMailStore from "@/stores/modules/mail";
import { ref, reactive, watchEffect } from "vue";
import { getlist ,getCategorylist} from '@/api/data'
import { useDictOptions } from '@/hooks/useDictOptions'
import { deptEasyLists,listSecond } from '@/api/org/department'
const { optionsData } = useDictOptions<{
dept: any[]
seconddept:any[]
}>({
dept: {
api: deptEasyLists
},
seconddept: {
api: listSecond
},
})
const modifiedCategoryHeaders = computed(() => {
const headers = [...categoryHeaders.value];
const complaintIndex = headers.findIndex(h => h.label === '投诉类');
if (complaintIndex !== -1) {
const complaintHeader = headers.splice(complaintIndex, 1);
headers.splice(complaintIndex, 0, ...complaintHeader, { label: '数量', width: 120 }, { label: '占比', width: 120 });
}
return headers;
});
const categoryHeaders = ref([
{ label: '投诉类' },
{ label: '举报类' },
{ label: '咨询求助类' },
{ label: '工作建议类' },
{ label: '涉众金融平台类' },
{ label: '无效类' },
{ label: '终止类' },
{ label: '感谢信类' },
]) ;
const subHeaders = ref([
{ label: '数量' },
{ label: '占比' },
]);
const mailStore = useMailStore();
mailStore.getMailCategorys();
const { dictData } = useDictData(["mail_source", "mail_level", "mail_state"]);
const query = ref({
size: 10,
current: 1
});
const totalSize = reactive({
total: 0,
pages: 0
})
const statistics = ref([]);
const handleMailTimeQuery = (val: any) => {
if (val) {
query.value.searchStartTime = val[0];
query.value.searchEndTime = val[1];
} else {
delete query.value.searchStartTime
delete query.value.searchEndTime
}
}
function getList() {
getCategorylist(query.value).then((data) => {
statistics.value = data.records;
totalSize.total = data.total;
totalSize.pages = data.pages;
});
}
function reset() {
query.value = {}
getList()
}
getList()
</script>
<style lang="scss" scoped>
.success {
padding: 0 8px;
height: 24px;
line-height: 24px;
text-align: center;
.text {
color: #128009;
}
}
.error {
background-color: #ff0000;
color: #fff;
padding: 0 8px;
height: 24px;
line-height: 24px;
border-radius: 20px;
text-align: center;
}
</style>

5
src/views/data/data.vue

@ -13,8 +13,9 @@
</el-col>
<el-col :span="6">
<el-form-item label="时间范围">
<el-date-picker v-model="query.searchTime" type="daterange" range-separator="" start-placeholder="开始日期"
end-placeholder="结束日期" value-format="YYYY-MM-DD" @change="handleMailTimeQuery" />
<el-date-picker v-model="query.searchTime" value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange" format="YYYY-MM-DD HH:mm:ss" range-separator="~"
start-placeholder="开始日期" end-placeholder="结束日期" @change="handleMailTimeQuery" />
</el-form-item>
</el-col>
</el-row>

Loading…
Cancel
Save