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

营业额明细

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