Commit ca0cb070 authored by lanbaoming's avatar lanbaoming

2024-04-27 报表更新

parent 9fba23e0
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
size="small" size="small"
:inline="true" :inline="true"
v-show="showSearch" v-show="showSearch"
label-width="100px" label-width="120px"
> >
<el-form-item label="客户" prop="name"> <el-form-item label="客户" prop="name">
<el-select <el-select
...@@ -142,20 +142,31 @@ ...@@ -142,20 +142,31 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="订单业绩产生时间" prop="searchDateType"> <el-form-item label="时间筛选" prop="searchDateType4">
<!--
<el-select <el-select
v-model="queryParams.searchDateType" v-model="queryParams.searchDataType4"
clearable clearable
style="width: 150px" style="width: 200px"
> >
<el-option <el-option label="首次成交时间" value="1"></el-option>
v-for="dict in SearchDateTypeList" <el-option label="客户创建时间" value="0"></el-option>
:key="dict.value" </el-select>
:label="dict.label" <el-date-picker
:value="dict.value" v-model="queryParams.sdate4"
/> type="date"
</el-select>--> value-format="yyyy-MM-dd"
clearable
placeholder="请输入起始日期"
/>
<el-date-picker
v-model="queryParams.edate4"
type="date"
value-format="yyyy-MM-dd"
clearable
placeholder="请输截止日期"
/>
</el-form-item>
<el-form-item label="业绩产生时间" prop="searchDateType">
<el-date-picker <el-date-picker
v-model="queryParams.sdate" v-model="queryParams.sdate"
type="date" type="date"
...@@ -197,7 +208,7 @@ ...@@ -197,7 +208,7 @@
> >
{{ $t("导出") }}</el-button {{ $t("导出") }}</el-button
> >
<el-button type="primary" size="mini" @click="test" v-show="false"> <el-button type="primary" size="mini" @click="test" v-show="true">
测试 测试
</el-button> </el-button>
</el-form-item> </el-form-item>
...@@ -308,6 +319,7 @@ import { getListPage, exportExcel } from "@/api/report/customeranalysis"; ...@@ -308,6 +319,7 @@ import { getListPage, exportExcel } from "@/api/report/customeranalysis";
import { import {
getCurUserPermission, getCurUserPermission,
getDeptChild, getDeptChild,
listServiceUser,
} from "@/api/report/EcwReportPermission"; } from "@/api/report/EcwReportPermission";
import { MessageBox } from "element-ui"; import { MessageBox } from "element-ui";
...@@ -353,8 +365,18 @@ function getLastYear() { ...@@ -353,8 +365,18 @@ function getLastYear() {
return year.toString(); return year.toString();
} }
//获取月份的最后一天 lanbm 2024-04-27 add
function getLastDay(sDate) {
var date = new Date(sDate);
var year = date.getFullYear();
//月份从0开始计算,需要加1
var month = date.getMonth() + 1;
var lastDay = new Date(year, month, 0).getDate();
return lastDay;
}
export default { export default {
name: "customer_analysis", name: "ReportCustomer_analysisIndex",
components: { components: {
UserSelector, UserSelector,
Treeselect, Treeselect,
...@@ -442,10 +464,13 @@ export default { ...@@ -442,10 +464,13 @@ export default {
searchDataType1: undefined, //查询数据类型 searchDataType1: undefined, //查询数据类型
searchDataType2: undefined, searchDataType2: undefined,
searchDataType3: undefined, searchDataType3: undefined,
searchDataType4: undefined, //时间筛选
searchDateType: "createdate", //日期查询类型 searchDateType: "createdate", //日期查询类型
sdate: formatDate3(), sdate: formatDate3(), //开始日期
edate: formatDate2(), //结束日期 edate: formatDate2(), //结束日期
duibiYear: getLastYear(), //对比年份 duibiYear: getLastYear(), //对比年份
sdate4: undefined, //时间筛选开始值
edate4: undefined, //时间筛选结束值
}, },
// 表单参数 // 表单参数
form: {}, form: {},
...@@ -453,13 +478,15 @@ export default { ...@@ -453,13 +478,15 @@ export default {
rules: {}, rules: {},
//报表权限信息 //报表权限信息
objEcwReportPermission: {}, objEcwReportPermission: {},
DeptEx: { id: undefined, name: undefined, parentId: undefined },
ParentPar: {},
}; };
}, },
created() { created() {
this.getTreeselect();
getCountryListAll().then((r) => { getCountryListAll().then((r) => {
this.countryList = r.data; this.countryList = r.data;
}); });
//获取当前用户报表权限 //获取当前用户报表权限
getCurUserPermission().then((response) => { getCurUserPermission().then((response) => {
//复制对象 //复制对象
...@@ -470,6 +497,29 @@ export default { ...@@ -470,6 +497,29 @@ export default {
this.showCustomsManage = false; this.showCustomsManage = false;
this.showDept = false; this.showDept = false;
} }
//获取页面传参
let sSalesmanid = this.$route.query.salesmanid;
let sDeptid = this.$route.query.deptid;
let s = this.$route.query.sDate;
let e = this.$route.query.eDate;
let bd = this.$route.query.duibiYear;
if (sSalesmanid != undefined && sSalesmanid != null) {
this.queryParams.salesmanid = parseInt(sSalesmanid);
}
if (sDeptid != undefined && sDeptid != null) {
this.queryParams.deptid = parseInt(sDeptid);
}
if (s != undefined && s != null) {
this.queryParams.sdate = s + "-01";
}
if (e != undefined && s != null) {
let lastDay = getLastDay(e + "-01");
this.queryParams.edate = e + "-" + lastDay;
}
if (bd != undefined && bd != null) {
this.queryParams.duibiYear = bd;
}
this.getTreeselect();
this.getList(); this.getList();
}); });
}, },
...@@ -483,11 +533,11 @@ export default { ...@@ -483,11 +533,11 @@ export default {
if (this.objEcwReportPermission.permissionFw == 1) { if (this.objEcwReportPermission.permissionFw == 1) {
//只能看自己的,不能选择部门和客户经理 //只能看自己的,不能选择部门和客户经理
this.queryParams.salesmanid = this.objEcwReportPermission.userId; this.queryParams.salesmanid = this.objEcwReportPermission.userId;
} else if ( } else if (this.objEcwReportPermission.permissionFw == 2) {
this.objEcwReportPermission.permissionFw == 2 || //部门权限
this.objEcwReportPermission.permissionFw == 3 this.queryParams.deptid = parseInt(this.objEcwReportPermission.deptId);
) { } else if (this.objEcwReportPermission.permissionFw == 3) {
// //全公司权限
} }
getListPage(this.queryParams).then((response) => { getListPage(this.queryParams).then((response) => {
this.list = response.data.list; this.list = response.data.list;
...@@ -525,7 +575,7 @@ export default { ...@@ -525,7 +575,7 @@ export default {
cusYjType: undefined, //客户业绩类型,新客户还是老客户 cusYjType: undefined, //客户业绩类型,新客户还是老客户
searchDataType: undefined, //查询数据类型 searchDataType: undefined, //查询数据类型
searchDateType: undefined, //日期查询类型 searchDateType: undefined, //日期查询类型
sdate: undefined, sdate: undefined, //开始日期
edate: undefined, //结束日期 edate: undefined, //结束日期
}; };
this.resetForm("form"); this.resetForm("form");
...@@ -596,17 +646,19 @@ export default { ...@@ -596,17 +646,19 @@ export default {
/** 查询部门下拉树结构 + 岗位下拉 */ /** 查询部门下拉树结构 + 岗位下拉 */
getTreeselect() { getTreeselect() {
listSimpleDepts().then((response) => { if (this.objEcwReportPermission.permissionFw == 3) {
// 处理 deptOptions 参数 listSimpleDepts().then((response) => {
this.deptOptions = []; // 处理 deptOptions 参数
this.deptOptions.push(...this.handleTree(response.data, "id")); this.deptOptions = [];
}); this.deptOptions.push(...this.handleTree(response.data, "id"));
});
/* } else if (this.objEcwReportPermission.permissionFw == 2) {
getDeptChild().then((response) => { this.DeptEx.id = this.objEcwReportPermission.deptId;
this.deptOptions = []; getDeptChild(this.DeptEx).then((response) => {
this.deptOptions.push(...this.handleTree(response.data, "id")); this.deptOptions = [];
});*/ this.deptOptions.push(...this.handleTree(response.data, "id"));
});
}
}, },
//格式化部门的下拉框 //格式化部门的下拉框
normalizer(node) { normalizer(node) {
...@@ -625,6 +677,15 @@ export default { ...@@ -625,6 +677,15 @@ export default {
return strDate; return strDate;
}, },
test() { test() {
this.DeptEx.id = this.objEcwReportPermission.deptId;
listServiceUser(this.DeptEx).then((response) => {
let json1 = JSON.stringify(response.data);
alert(json1);
return;
});
return;
let json1 = JSON.stringify(this.deptOptions); let json1 = JSON.stringify(this.deptOptions);
alert(json1); alert(json1);
return; return;
......
...@@ -55,13 +55,14 @@ ...@@ -55,13 +55,14 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery" <el-button type="primary" icon="el-icon-search" @click="handleQuery">{{
>{{$t('搜索')}}</el-button $t("搜索")
> }}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery"> <el-button icon="el-icon-refresh" @click="resetQuery">
{{$t('重置')}}</el-button {{ $t("重置") }}</el-button
> >
</el-form-item> </el-form-item>
<el-form-item> </el-form-item>
</el-form> </el-form>
<el-row> <el-row>
<el-form size="small" :inline="true" label-width="150px"> <el-form size="small" :inline="true" label-width="150px">
...@@ -71,7 +72,7 @@ ...@@ -71,7 +72,7 @@
icon="el-icon-search" icon="el-icon-search"
@click="hhandleQueryAnalysis" @click="hhandleQueryAnalysis"
> >
{{ $t('更多') }} {{ $t("更多") }}
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -102,7 +103,10 @@ import * as echarts from "echarts"; ...@@ -102,7 +103,10 @@ import * as echarts from "echarts";
require("echarts/theme/macarons"); require("echarts/theme/macarons");
import resize from "../../dashboard/mixins/resize"; import resize from "../../dashboard/mixins/resize";
import { getReportResult } from "@/api/report/customerreport"; import { getReportResult } from "@/api/report/customerreport";
import { getCurUserPermission } from "@/api/report/EcwReportPermission"; import {
getCurUserPermission,
getDeptChild,
} from "@/api/report/EcwReportPermission";
import { MessageBox } from "element-ui"; import { MessageBox } from "element-ui";
const CurDate = new Date(); const CurDate = new Date();
...@@ -129,7 +133,7 @@ function getLastYear() { ...@@ -129,7 +133,7 @@ function getLastYear() {
} }
export default { export default {
name: "customerreport", name: "ReportCustomerreportIndex",
components: { components: {
UserSelector, UserSelector,
Treeselect, Treeselect,
...@@ -179,6 +183,7 @@ export default { ...@@ -179,6 +183,7 @@ export default {
}, },
//报表权限信息 //报表权限信息
objEcwReportPermission: {}, objEcwReportPermission: {},
DeptEx: { id: undefined, name: undefined, parentId: undefined },
}; };
}, },
watch: {}, watch: {},
...@@ -189,16 +194,24 @@ export default { ...@@ -189,16 +194,24 @@ export default {
});*/ });*/
}, },
created() { created() {
this.getTreeselect();
//获取当前用户报表权限 //获取当前用户报表权限
getCurUserPermission().then((response) => { getCurUserPermission().then((response) => {
this.objEcwReportPermission = response.data; this.objEcwReportPermission = response.data;
if (this.objEcwReportPermission.permissionFw == 1) { if (this.objEcwReportPermission.permissionFw == 1) {
//本人权限
this.showCustomsManage = false; this.showCustomsManage = false;
this.showDept = false; this.showDept = false;
this.queryParams.salesmanid = this.objEcwReportPermission.userId; this.queryParams.salesmanid = this.objEcwReportPermission.userId;
} else if (this.objEcwReportPermission.permissionFw == 2) {
this.showCustomsManage = true;
this.showDept = true;
this.queryParams.deptid = parseInt(this.objEcwReportPermission.deptId);
} else if (this.objEcwReportPermission.permissionFw == 3) {
//全公司权限
this.showCustomsManage = true;
this.showDept = true;
} }
this.getTreeselect();
//获取权限后再初始化统计图表 //获取权限后再初始化统计图表
this.initChart(); this.initChart();
}); });
...@@ -214,6 +227,15 @@ export default { ...@@ -214,6 +227,15 @@ export default {
initChart() { initChart() {
var chartDom = this.$refs["mainBar"]; var chartDom = this.$refs["mainBar"];
this.chart = echarts.init(chartDom, "macarons"); this.chart = echarts.init(chartDom, "macarons");
this.chart.on("click", () => {
if (this.isRight() == false) return;
let p = {};
Object.assign(p, this.queryParams);
this.$router.push({
path: "/report/customer_analysis",
query: p,
});
});
this.setOptions(); this.setOptions();
}, },
setOptions() { setOptions() {
...@@ -242,6 +264,7 @@ export default { ...@@ -242,6 +264,7 @@ export default {
//在数据中查询 //在数据中查询
let vR = resultList.filter((r) => r.name === item.name); let vR = resultList.filter((r) => r.name === item.name);
result += "客户:" + item.name + "<br/>"; result += "客户:" + item.name + "<br/>";
result += "客户编号:" + vR[0].number + "<br/>";
result += "客户经理部门:" + vR[0].deptname + "<br/>"; result += "客户经理部门:" + vR[0].deptname + "<br/>";
result += "总V值:" + item.value + "<br/>"; result += "总V值:" + item.value + "<br/>";
result += "海运V值:" + vR[0].sumvolume1 + "<br/>"; result += "海运V值:" + vR[0].sumvolume1 + "<br/>";
...@@ -269,33 +292,46 @@ export default { ...@@ -269,33 +292,46 @@ export default {
}); });
}); });
}, },
hhandleQueryAnalysis() { hhandleQueryAnalysis() {
this.$router.push("/member/customer_analysis"); if (this.isRight() == false) return;
let p = {};
Object.assign(p, this.queryParams);
this.$router.push({
path: "/report/customer_analysis",
query: p,
});
}, },
handleQuery() { isRight() {
//校验查询参数 lanbm 2024-04-07 add //校验查询参数 lanbm 2024-04-07 add
if (this.queryParams.sDate == undefined) { if (this.queryParams.sDate == undefined) {
MessageBox("请输入起始月份。"); MessageBox("请输入起始月份。");
return; return false;
} }
if (this.queryParams.eDate == undefined) { if (this.queryParams.eDate == undefined) {
MessageBox("请输入截止月份。"); MessageBox("请输入截止月份。");
return; return false;
} }
if (this.queryParams.duibiYear == undefined) { if (this.queryParams.duibiYear == undefined) {
MessageBox("请输入对比年份。"); MessageBox("请输入对比年份。");
return; return false;
} else { } else {
let y = parseInt(this.queryParams.duibiYear); let y = parseInt(this.queryParams.duibiYear);
if (y < 2023) { if (y < 2023) {
MessageBox("对比年份只能选2023年和2023年之后的年份。"); MessageBox("对比年份只能选2023年和2023年之后的年份。");
return false;
} }
var date = new Date(); var date = new Date();
var year = date.getFullYear(); var year = date.getFullYear();
if (y > year) { if (y > year) {
MessageBox("对比年份只能选当前年份之前的年份。"); MessageBox("对比年份只能选当前年份之前的年份。");
return false;
} }
} }
return true;
},
handleQuery() {
if (this.isRight() == false) return;
//查询统计结果 //查询统计结果
this.initChart(); this.initChart();
}, },
...@@ -317,11 +353,20 @@ export default { ...@@ -317,11 +353,20 @@ export default {
handleExport() {}, handleExport() {},
/** 查询部门下拉树结构 + 岗位下拉 */ /** 查询部门下拉树结构 + 岗位下拉 */
getTreeselect() { getTreeselect() {
listSimpleDepts().then((response) => { if (this.objEcwReportPermission.permissionFw == 3) {
// 处理deptOptions 参数 listSimpleDepts().then((response) => {
this.deptOptions = []; // 处理deptOptions 参数
this.deptOptions.push(...this.handleTree(response.data, "id")); this.deptOptions = [];
}); this.deptOptions.push(...this.handleTree(response.data, "id"));
});
} else if (this.objEcwReportPermission.permissionFw == 2) {
this.DeptEx.id = this.objEcwReportPermission.deptId;
getDeptChild(this.DeptEx).then((response) => {
// 处理deptOptions 参数
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, "id"));
});
}
}, },
//格式化部门的下拉框 //格式化部门的下拉框
normalizer(node) { normalizer(node) {
......
...@@ -22,6 +22,13 @@ ...@@ -22,6 +22,13 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item v-show="false">
<Treeselect
v-model="id"
:options="listTree"
>
</Treeselect>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery" <el-button type="primary" icon="el-icon-search" @click="handleQuery"
>搜索</el-button >搜索</el-button
...@@ -110,16 +117,24 @@ ...@@ -110,16 +117,24 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="运输方式" prop="titleZh"> <el-form-item label="运输方式" prop="titleZh">
<el-select v-model="form.titleZh" clearable style="width: 200px"> <el-select
v-model="form.titleZh"
@change="handleSelectChange"
clearable
style="width: 200px"
>
<el-option label="海运拼柜" value="海运拼柜"></el-option> <el-option label="海运拼柜" value="海运拼柜"></el-option>
<el-option label="专线空运" value="专线空运"></el-option> <el-option label="专线空运" value="专线空运"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="基础单位" prop="fuhao"> <el-form-item label="1V=" prop="vz">
<el-input v-model="form.fuhao" placeholder="基础单位" /> <el-input v-model="form.vz" placeholder="" style="width: 100px" />
</el-form-item> <el-input
<el-form-item label="V值" prop="vz"> v-model="form.fuhao"
<el-input v-model="form.vz" placeholder="V值" /> style="width: 100px"
placeholder="基础单位"
readonly="true"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -139,10 +154,15 @@ import { ...@@ -139,10 +154,15 @@ import {
getPageList, getPageList,
exportExcel, exportExcel,
} from "@/api/report/vz"; } from "@/api/report/vz";
import Treeselect from "@riophae/vue-treeselect";
import "@/assets/styles/vue-treeselect.css";
export default { export default {
name: "vz", name: "vz",
components: {}, components: {
Treeselect,
},
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -170,12 +190,57 @@ export default { ...@@ -170,12 +190,57 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: {}, rules: {},
id: 1,
listTree: [
{
//https://www.cnblogs.com/javahr/p/13607024.html
id: 1,
label: "1",
children: [
{
id: 11,
label: "11",
children: [
{
id: 111,
label: "111",
},
],
},
{
id: 12,
label: "12",
},
],
},
{
id: 2,
label: "2",
children: [
{
id: 21,
label: "21",
},
{
id: 22,
label: "22",
},
],
},
],
}; };
}, },
created() { created() {
this.getList(); this.getList();
}, },
methods: { methods: {
handleSelectChange(sValue) {
if (sValue == "海运拼柜") {
this.form.fuhao = "M3";
} else if (sValue == "专线空运") {
this.form.fuhao = "KG";
}
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -217,7 +282,7 @@ export default { ...@@ -217,7 +282,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
this.title = "添加测试"; this.title = "添加V值";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
...@@ -226,7 +291,7 @@ export default { ...@@ -226,7 +291,7 @@ export default {
getModel(id).then((response) => { getModel(id).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改测试"; this.title = "修改V值";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
...@@ -256,7 +321,7 @@ export default { ...@@ -256,7 +321,7 @@ export default {
handleDelete(row) { handleDelete(row) {
const id = row.id; const id = row.id;
this.$modal this.$modal
.confirm('是否确认删除测试编号为"' + id + '"的数据项?') .confirm("是否确认删除选中数据项?")
.then(function () { .then(function () {
return del(id); return del(id);
}) })
...@@ -285,6 +350,16 @@ export default { ...@@ -285,6 +350,16 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children,
};
},
}, },
}; };
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment