Commit 24aba5b6 authored by 潘自豪's avatar 潘自豪

营业额明细

parent 4169eb02
......@@ -21,7 +21,7 @@ export const userLogin = (username, pass, captchaSign, verificationcode, captcha
}, 'POST');
//首页营业额率值 -汇总
export const getBusinessConditionDatas = (cur_day) => fetch('/api/query/*/action/get_business_condition_datas', {
export const getBusinessConditionDatas = (cur_day) => fetch('/api/query/*/action/get_business_condition_datas', {
aux: {
cur_day: cur_day
}
......@@ -38,7 +38,7 @@ export const getBusinessConditionDataByMonth = (cur_day) => fetch('/api/query/*/
//明细页营业额汇年 -汇总
export const getBusinessConditionDatasByYear = (cur_day) => fetch('/api/query/*/action/get_business_condition_datas_by_year', {
aux: {
cur_day: cur_dayS
cur_day: cur_day
}
}, 'POST');
// 应收账款汇总
......@@ -68,3 +68,31 @@ export const getAllTypeBusinessConditionDetailByDay = (cur_day) => fetch('/api/q
}
}, 'POST');
//明细页各种运输类型营业额汇总-月维度
export const getAllTypeBusinessConditionDatasByMonth = (cur_day) => fetch('/api/query/*/action/get_all_type_business_condition_datas_by_month', {
aux: {
cur_day: cur_day
}
}, 'POST');
//明细页各种运输类型营业额汇总-年维度
export const getAllTypeBusinessConditionDatasByYear = (cur_day) => fetch('/api/query/*/action/get_all_type_business_condition_datas_by_year', {
aux: {
cur_day: cur_day
}
}, 'POST');
//明细页各种运输类型营业额明细-月维度
export const getAllTypeBusinessConditionDetailByMonth = (cur_day) => fetch('/api/query/*/action/get_all_type_business_condition_detail_by_month', {
aux: {
cur_day: cur_day
}
}, 'POST');
//明细页各种运输类型营业额明细-年维度
export const getAllTypeBusinessConditionDetailByYear = (cur_day) => fetch('/api/query/*/action/get_all_type_business_condition_detail_by_year', {
aux: {
cur_day: cur_day
}
}, 'POST');
import {
getBusinessConditionDatas,
getAllTypeBusinessConditionDatas,
getAllTypeBusinessConditionDetailByDay
getAllTypeBusinessConditionDetailByDay,
getBusinessConditionDataByMonth,
getAllTypeBusinessConditionDatasByMonth,
getAllTypeBusinessConditionDetailByMonth,
getBusinessConditionDatasByYear,
getAllTypeBusinessConditionDatasByYear,
getAllTypeBusinessConditionDetailByYear
} from "../../api/apiList";
import {calc_hb_str, calc_tb_str, conver_amont} from "../../utils/numUtil";
import moment from 'moment'
//天维度数据转换
export const getTrunOverDayDetail = async function (type, cur_day) {
export const getTrunOver = async function (dimension, type, cur_day) {
let pageData = new Object();
pageData.head = await getHeadDay(type, cur_day)
pageData.detail = await getDetailDay(type, cur_day)
console.log("pageData:" + JSON.stringify(pageData))
pageData.head = await getHead(dimension, type, cur_day)
pageData.detail = await getDetail(dimension, type, cur_day)
return pageData;
};
/**
* @param cur_day
*/
export const getHeadDay = async function (type, cur_day) {
export const getHead = async function (dimension, type, cur_day) {
let typeName = new Object({"yye": "营业额", "cb": "成本", "ml": "毛利"});
let pageName = typeName[type]
let truck = "汽运" + pageName;
let ship = "水运" + pageName;
let tran = "铁运" + pageName;
let headData = new Object();
let res = await reqSumData(cur_day);
headData.营业额 = adapterSumDataDay(type, res);
let transportData = await reqTransportData(cur_day)
headData.汽运营业额 = initSumDataDay();
headData.水运营业额 = initSumDataDay();
headData.铁运营业额 = initSumDataDay();
let transportData;
let res = await reqDaySumData(dimension, cur_day);
headData[pageName] = adapterSumData(dimension, type, res);
transportData = await reqDayTransportData(dimension, cur_day)
headData[truck] = initSumDataDay();
headData[ship] = initSumDataDay();
headData[tran] = initSumDataDay();
if (transportData[10]) {
headData.汽运营业额 = adapterSumDataDay(type, transportData[10]);
headData[truck] = adapterSumData(dimension, type, transportData[10]);
}
if (transportData[30]) {
headData.水运营业额 = adapterSumDataDay(type, transportData[30]);
headData[ship] = adapterSumData(dimension, type, transportData[30]);
}
if (transportData[20]) {
headData.铁运营业额 = adapterSumDataDay(type, transportData[20]);
headData[tran] = adapterSumData(dimension, type, transportData[20]);
}
return headData;
};
//获取折线图明细
export const getDetailDay = async function (type, cur_day) {
let transportDetail = await reqTransportDetailDayData(cur_day)
return adapterDetailDataDay(type, transportDetail)
export const getDetail = async function (dimension, type, cur_day) {
let res;
if (dimension == 'day') {
res = await getAllTypeBusinessConditionDetailByDay(moment(cur_day).format('YYYY-MM'));
}
if (dimension == 'month') {
res = await getAllTypeBusinessConditionDetailByMonth(cur_day)
}
if (dimension == 'year') {
res = await getAllTypeBusinessConditionDetailByYear(cur_day)
}
let data = res.data
return adapterDetailData(dimension, type, data)
};
//获取汇总数据
export const reqSumData = async function (cur_day) {
let res = await getBusinessConditionDatas(cur_day);
//获取全部汇总数据
export const reqDaySumData = async function (dimension, cur_day) {
let res;
if (dimension == 'day') {
res = await getBusinessConditionDatas(cur_day);
}
if (dimension == 'month') {
res = await getBusinessConditionDataByMonth(cur_day);
}
if (dimension == 'year') {
res = await getBusinessConditionDatasByYear(cur_day);
}
let data = res.data
return data;
}
//获取汇总数据
export const reqTransportData = async function (cur_day) {
let res = await getAllTypeBusinessConditionDatas(cur_day);
//获取每个运输方式汇总数据
export const reqDayTransportData = async function (dimension, cur_day) {
let res;
if (dimension == 'day') {
res = await getAllTypeBusinessConditionDatas(cur_day);
}
if (dimension == 'month') {
res = await getAllTypeBusinessConditionDatasByMonth(cur_day);
}
if (dimension == 'year') {
res = await getAllTypeBusinessConditionDatasByYear(cur_day);
}
let data = res.data
return data;
}
//获取明细数据数据
export const reqTransportDetailDayData = async function (cur_day) {
let res = await getAllTypeBusinessConditionDetailByDay(moment(cur_day).format('YYYY-MM'));
......@@ -64,6 +104,26 @@ export const reqTransportDetailDayData = async function (cur_day) {
}
/**
* 数据匹配
* @param type
* @param data
*/
export const adapterSumData = function (dimension, type, data) {
let res;
if (dimension == 'day') {
res = adapterSumDataDay(type, data);
}
if (dimension == 'month') {
res = adapterSumDataMonth(type, data);
}
if (dimension == 'year') {
res = adapterSumDataYear(type, data);
}
return res;
}
/**
*日维度汇总
* @param type yye:营业额、cb:成本、ml:毛利
......@@ -167,7 +227,7 @@ export const initSumDataDay = function () {
* @param type
* @param data
*/
export const adapterSumDatamonth = function (type, data) {
export const adapterSumDataMonth = function (type, data) {
let turnOver = new Object()
let hb = new Array()
if (type == 'yye') {
......@@ -233,6 +293,7 @@ export const adapterSumDatamonth = function (type, data) {
}
turnOver.hb = hb;
}
return turnOver;
}
/**
......@@ -282,6 +343,7 @@ export const adapterSumDataYear = function (type, data) {
}
turnOver.hb = hb;
}
return turnOver;
}
......@@ -291,12 +353,22 @@ export const adapterSumDataYear = function (type, data) {
* @param data
* @returns {any[]}
*/
export const adapterDetailDataDay = function (type, data) {
export const adapterDetailData = function (dimension, type, data) {
let list = new Array()
let detail = null
for (let key in data) {
detail = detailConver(type, data[key])
detail.date = moment(key).format('MM月DD日');
let date;
if (dimension == 'day') {
date = moment(key).format('MM月DD日')
}
if (dimension == 'month') {
date = moment(key).format('MM月')
}
if (dimension == 'year') {
date = moment(key).format('YYYY年')
}
detail.date = date;
list.push(detail);
}
return list;
......@@ -310,7 +382,6 @@ export const adapterDetailDataDay = function (type, data) {
*/
export const detailConver = function (type, detailList) {
let detail = initDetail();
console.log(typeof detailList)
for (let det in detailList) {
let data = detailList[det]
//初始化
......
......@@ -170,7 +170,7 @@ export default {
},
data() {
return {
today: '2023-06-19',
today: '2023-05-19',
yyqk: {
yye: {
title: "营业额",
......@@ -233,59 +233,6 @@ export default {
{title: "XX有限公司", column: [{key: "未收款(万元)", value: 0}]},
],
mockData: {
yyqk: {
yye: {
title: "营业额",
amount: "20,303",
unit: "万元",
hb: [
{
title: "昨天",
amount: "21,000",
rate: "-3.32%",
},
{
title: "上月",
amount: "20,000",
rate: "+4.92%",
},
],
},
cb: {
title: "成本",
amount: "10,303",
unit: "万元",
hb: [
{
title: "昨日",
amount: "11,000",
rate: "-2.68%",
},
{
title: "上月",
amount: "10,000",
rate: "+5.71%",
},
],
},
ml: {
title: "毛利",
amount: "10,000",
unit: "万元",
hb: [
{
title: "昨日",
amount: "10,000",
rate: "0.00%",
},
{
title: "上月",
amount: "10,000",
rate: "0.00%",
},
],
},
},
zqk: {
yszk: {
title: "应收账款",
......@@ -460,9 +407,9 @@ export default {
},
},
paths: {
"营业额": "/turnover-detail",
"成本": "/turnover-detail",
"毛利": "/turnover-detail",
"营业额": "yye",
"成本": "cb",
"毛利": "ml",
},
charts: {}
}
......@@ -470,7 +417,6 @@ export default {
methods: {
cellStyleFunction(data) {
let res = {color: '#33ff66'};
console.log(data + ":" + data.indexOf('+'))
if (data.indexOf('-') !== -1) {
res.color = '#ff3300'
}
......@@ -481,9 +427,8 @@ export default {
this.charts[chartsKey].resize();
}
},
routerTo(path) {
console.log(path)
this.$router.push({path: path});
routerTo(code) {
this.$router.push({path: "/turnover-detail", query: {code: code}});
},
//营业情况
showBusinessConditionDatas() {
......
......@@ -23,7 +23,7 @@ export default {
name: 'app',
data() {
return {
countDown: 10,
countDown: 10000,
isRouterAlive: true,
countDownTimer: null,
}
......
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