Commit ca0cb070 authored by lanbaoming's avatar lanbaoming

2024-04-27 报表更新

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