|
@@ -1,218 +1,231 @@
|
|
|
<template>
|
|
|
- <div class="statistics-order-souce-container layout-pd">
|
|
|
- <!-- 搜索 -->
|
|
|
- <el-card shadow="never">
|
|
|
- <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
|
|
|
- <el-form-item label="来电人身份" prop="IdentityType">
|
|
|
- <el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电人身份" clearable @change="handleQuery">
|
|
|
- <el-option v-for="item in identityTypeOptions" :value="item.value" :key="item.value" :label="item.key" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="时间段" prop="crTime">
|
|
|
- <el-date-picker
|
|
|
- v-model="state.queryParams.crTime"
|
|
|
- type="daterange"
|
|
|
- unlink-panels
|
|
|
- range-separator="至"
|
|
|
- start-placeholder="开始时间"
|
|
|
- end-placeholder="结束时间"
|
|
|
- :shortcuts="shortcuts"
|
|
|
- @change="handleQuery"
|
|
|
- value-format="YYYY-MM-DD"
|
|
|
- :clearable="false"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label-width="0">
|
|
|
- <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
|
|
|
- <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
|
|
|
- <SvgIcon name="ele-Refresh" class="mr5" />重置
|
|
|
- </el-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- </el-card>
|
|
|
- <el-card shadow="never">
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col :xs="24" :sm="12" :md="18" :lg="18" :xl="18">
|
|
|
- <v-chart class="chart" :option="option" :loading="state.loading" autoresize />
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
|
|
|
- <ProTable
|
|
|
- ref="proTableRef"
|
|
|
- :columns="columns"
|
|
|
- :data="state.tableData"
|
|
|
- @updateTable="queryList"
|
|
|
- :loading="state.loading"
|
|
|
- :pagination="false"
|
|
|
- border
|
|
|
- :tool-button="false"
|
|
|
- max-height="60vh"
|
|
|
- :toolButton="['refresh', 'setting', 'exportAll']"
|
|
|
- @export-all="exportTable($event, true)"
|
|
|
- >
|
|
|
- </ProTable>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-card>
|
|
|
- </div>
|
|
|
+ <div class="statistics-order-souce-container layout-pd">
|
|
|
+ <!-- 搜索 -->
|
|
|
+ <el-card shadow="never">
|
|
|
+ <el-form :model="state.queryParams" ref="ruleFormRef" @submit.native.prevent inline>
|
|
|
+ <el-form-item label="来电人身份" prop="IdentityType">
|
|
|
+ <el-select v-model="state.queryParams.IdentityType" placeholder="请选择来电人身份" clearable @change="handleQuery">
|
|
|
+ <el-option v-for="item in identityTypeOptions" :value="item.value" :key="item.value" :label="item.key" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="时间段" prop="crTime">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="state.queryParams.crTime"
|
|
|
+ type="daterange"
|
|
|
+ unlink-panels
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始时间"
|
|
|
+ end-placeholder="结束时间"
|
|
|
+ :shortcuts="shortcuts"
|
|
|
+ @change="handleQuery"
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
+ :clearable="false"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label-width="0">
|
|
|
+ <el-button type="primary" @click="handleQuery" :loading="state.loading"> <SvgIcon name="ele-Search" class="mr5" />查询 </el-button>
|
|
|
+ <el-button @click="resetQuery(ruleFormRef)" class="default-button" :loading="state.loading">
|
|
|
+ <SvgIcon name="ele-Refresh" class="mr5" />重置
|
|
|
+ </el-button>
|
|
|
+ <el-button type="info" @click="onDetail" :loading="state.loading"> <SvgIcon name="ele-List" class="mr5" /> 列表明细 </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-card>
|
|
|
+ <el-card shadow="never">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :xs="24" :sm="12" :md="18" :lg="18" :xl="18">
|
|
|
+ <v-chart class="chart" :option="option" :loading="state.loading" autoresize />
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :md="6" :lg="6" :xl="6">
|
|
|
+ <ProTable
|
|
|
+ ref="proTableRef"
|
|
|
+ :columns="columns"
|
|
|
+ :data="state.tableData"
|
|
|
+ @updateTable="queryList"
|
|
|
+ :loading="state.loading"
|
|
|
+ :pagination="false"
|
|
|
+ border
|
|
|
+ :tool-button="false"
|
|
|
+ max-height="60vh"
|
|
|
+ :toolButton="['refresh', 'setting', 'exportAll']"
|
|
|
+ @export-all="exportTable($event, true)"
|
|
|
+ >
|
|
|
+ </ProTable>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script setup lang="tsx" name="statisticsOrderSource">
|
|
|
import { onMounted, reactive, ref } from 'vue';
|
|
|
import { FormInstance } from 'element-plus';
|
|
|
import { callList, callPeriodBase } from '@/api/statistics/call';
|
|
|
import { defaultDate, shortcuts } from '@/utils/constants';
|
|
|
-import Other from "@/utils/other";
|
|
|
-import { orderSource, orderSourceExport } from "@/api/statistics/order";
|
|
|
-import { downloadFileByStream } from "@/utils/tools";
|
|
|
+import Other from '@/utils/other';
|
|
|
+import { orderSource, orderSourceExport } from '@/api/statistics/order';
|
|
|
+import { downloadFileByStream } from '@/utils/tools';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
|
|
|
const proTableRef = ref<RefType>(); // 表格ref
|
|
|
// 表格配置项
|
|
|
const columns = ref<any[]>([
|
|
|
- { prop: 'source', label: '信件来源', align: 'center' },
|
|
|
- { prop: 'num', label: '数量', align: 'center' },
|
|
|
- { prop: 'rateText', label: '占比', align: 'center' },
|
|
|
+ { prop: 'source', label: '信件来源', align: 'center' },
|
|
|
+ { prop: 'num', label: '数量', align: 'center' },
|
|
|
+ { prop: 'rateText', label: '占比', align: 'center' },
|
|
|
]);
|
|
|
// 定义变量内容
|
|
|
const ruleFormRef = ref<RefType>(); // 表单ref
|
|
|
const state = reactive<any>({
|
|
|
- queryParams: {
|
|
|
- // 查询条件
|
|
|
- IdentityType: null, // 关键词
|
|
|
- crTime: defaultDate, //
|
|
|
- StartTime: null,
|
|
|
- EndTime: null,
|
|
|
- },
|
|
|
- tableData: [], //表单
|
|
|
- loading: false, // 加载
|
|
|
- total: 0, // 总数
|
|
|
- callForwardingSource: [],
|
|
|
+ queryParams: {
|
|
|
+ // 查询条件
|
|
|
+ IdentityType: null, // 关键词
|
|
|
+ crTime: defaultDate, //
|
|
|
+ StartTime: null,
|
|
|
+ EndTime: null,
|
|
|
+ },
|
|
|
+ tableData: [], //表单
|
|
|
+ loading: false, // 加载
|
|
|
+ total: 0, // 总数
|
|
|
+ callForwardingSource: [],
|
|
|
});
|
|
|
const identityTypeOptions = [
|
|
|
- { key: '市民', value: 1 },
|
|
|
- { key: '企业', value: 2 }
|
|
|
-]
|
|
|
+ { key: '市民', value: 1 },
|
|
|
+ { key: '企业', value: 2 },
|
|
|
+];
|
|
|
/** 搜索按钮操作 */
|
|
|
const handleQuery = () => {
|
|
|
- // state.queryParams.PageIndex = 1;
|
|
|
- queryList();
|
|
|
+ // state.queryParams.PageIndex = 1;
|
|
|
+ queryList();
|
|
|
};
|
|
|
/** 获取列表 */
|
|
|
const queryList = () => {
|
|
|
- state.loading = true;
|
|
|
- let request = Other.deepClone(state.queryParams);
|
|
|
- request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
- request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
- Reflect.deleteProperty(request, 'crTime');
|
|
|
- orderSource(request)
|
|
|
- .then((res: any) => {
|
|
|
- state.tableData = res.result;
|
|
|
- const legendData = state.tableData.map((item: any) => {
|
|
|
- return item.source;
|
|
|
- }).filter((item: any) => item !== '合计');
|
|
|
- const dataTable = state.tableData.map((item: any) => {
|
|
|
- return {
|
|
|
- name: item.source,
|
|
|
- value: item.num,
|
|
|
- ...item
|
|
|
- };
|
|
|
- }).filter((item: any) => item.name !== '合计')
|
|
|
- setOption(legendData,dataTable);
|
|
|
- state.loading = false;
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- state.loading = false;
|
|
|
- });
|
|
|
+ state.loading = true;
|
|
|
+ let request = Other.deepClone(state.queryParams);
|
|
|
+ request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
+ request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
+ Reflect.deleteProperty(request, 'crTime');
|
|
|
+ orderSource(request)
|
|
|
+ .then((res: any) => {
|
|
|
+ state.tableData = res.result;
|
|
|
+ const legendData = state.tableData
|
|
|
+ .map((item: any) => {
|
|
|
+ return item.source;
|
|
|
+ })
|
|
|
+ .filter((item: any) => item !== '合计');
|
|
|
+ const dataTable = state.tableData
|
|
|
+ .map((item: any) => {
|
|
|
+ return {
|
|
|
+ name: item.source,
|
|
|
+ value: item.num,
|
|
|
+ ...item,
|
|
|
+ };
|
|
|
+ })
|
|
|
+ .filter((item: any) => item.name !== '合计');
|
|
|
+ setOption(legendData, dataTable);
|
|
|
+ state.loading = false;
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
};
|
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = (formEl: FormInstance | undefined) => {
|
|
|
- if (!formEl) return;
|
|
|
- formEl.resetFields();
|
|
|
- queryList();
|
|
|
+ if (!formEl) return;
|
|
|
+ formEl.resetFields();
|
|
|
+ queryList();
|
|
|
};
|
|
|
const option = ref<any>({});
|
|
|
// 信件来源统计
|
|
|
-const setOption = (legendData:string[],data: any) => {
|
|
|
- option.value = {
|
|
|
- title: {
|
|
|
- text: '信件来源统计',
|
|
|
- left: 'center',
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- formatter: '{b}:{d}%',
|
|
|
- },
|
|
|
- legend: [
|
|
|
- {
|
|
|
- left: 'left',
|
|
|
- top: '40',
|
|
|
- orient: 'vertical',
|
|
|
- data:legendData,
|
|
|
- },
|
|
|
- ],
|
|
|
- grid: {
|
|
|
- containLabel: true,
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- type: 'pie',
|
|
|
- radius: ['0%', '80%'],
|
|
|
- label: {
|
|
|
- show: true,
|
|
|
- overflow: 'none',
|
|
|
- formatter: function (params) {
|
|
|
- if (params.name !== '') {
|
|
|
- return `${params.name}:${params.data.value}(${params.percent}%)`;
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- data: data,
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
+const setOption = (legendData: string[], data: any) => {
|
|
|
+ option.value = {
|
|
|
+ title: {
|
|
|
+ text: '信件来源统计',
|
|
|
+ left: 'center',
|
|
|
+ },
|
|
|
+ tooltip: {
|
|
|
+ formatter: '{b}:{d}%',
|
|
|
+ },
|
|
|
+ legend: [
|
|
|
+ {
|
|
|
+ left: 'left',
|
|
|
+ top: '40',
|
|
|
+ orient: 'vertical',
|
|
|
+ data: legendData,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ grid: {
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ type: 'pie',
|
|
|
+ radius: ['0%', '80%'],
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ overflow: 'none',
|
|
|
+ formatter: function (params) {
|
|
|
+ if (params.name !== '') {
|
|
|
+ return `${params.name}:${params.data.value}(${params.percent}%)`;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ data: data,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ };
|
|
|
};
|
|
|
// 获取基础信息
|
|
|
const getBaseInfo = async () => {
|
|
|
- try {
|
|
|
- const { result } = await callPeriodBase();
|
|
|
- state.callForwardingSource = result.callForwardingSource ?? [];
|
|
|
- } catch (e) {
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
+ try {
|
|
|
+ const { result } = await callPeriodBase();
|
|
|
+ state.callForwardingSource = result.callForwardingSource ?? [];
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
};
|
|
|
// 表格导出
|
|
|
const exportTable = (val: any, isExportAll = false) => {
|
|
|
- let request = Other.deepClone(state.queryParams);
|
|
|
- request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
- request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
- Reflect.deleteProperty(request, 'crTime');
|
|
|
- const columnInfos = val.map((item: any) => {
|
|
|
- return {
|
|
|
- prop: item.prop,
|
|
|
- name: item.label,
|
|
|
- };
|
|
|
- });
|
|
|
- const req = {
|
|
|
- queryDto: request,
|
|
|
- columnInfos,
|
|
|
- isExportAll,
|
|
|
- };
|
|
|
- state.loading = true;
|
|
|
- orderSourceExport(req)
|
|
|
- .then((res: any) => {
|
|
|
- state.loading = false;
|
|
|
- downloadFileByStream(res);
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- state.loading = false;
|
|
|
- });
|
|
|
+ let request = Other.deepClone(state.queryParams);
|
|
|
+ request.StartTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[0];
|
|
|
+ request.EndTime = state.queryParams.crTime === null ? null : state.queryParams.crTime[1];
|
|
|
+ Reflect.deleteProperty(request, 'crTime');
|
|
|
+ const columnInfos = val.map((item: any) => {
|
|
|
+ return {
|
|
|
+ prop: item.prop,
|
|
|
+ name: item.label,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ const req = {
|
|
|
+ queryDto: request,
|
|
|
+ columnInfos,
|
|
|
+ isExportAll,
|
|
|
+ };
|
|
|
+ state.loading = true;
|
|
|
+ orderSourceExport(req)
|
|
|
+ .then((res: any) => {
|
|
|
+ state.loading = false;
|
|
|
+ downloadFileByStream(res);
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ state.loading = false;
|
|
|
+ });
|
|
|
+};
|
|
|
+// 查看列表明细
|
|
|
+const router = useRouter();
|
|
|
+const onDetail = () => {
|
|
|
+ router.push({
|
|
|
+ name: 'statisticsOrderDetailSource',
|
|
|
+ });
|
|
|
};
|
|
|
onMounted(() => {
|
|
|
- getBaseInfo();
|
|
|
- queryList();
|
|
|
+ getBaseInfo();
|
|
|
+ queryList();
|
|
|
});
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.chart,
|
|
|
.chart1 {
|
|
|
- height: 60vh;
|
|
|
- margin-top: 10px;
|
|
|
+ height: 60vh;
|
|
|
+ margin-top: 10px;
|
|
|
}
|
|
|
</style>
|