Commit 5eb4ab13 authored by 潘自豪's avatar 潘自豪

Merge remote-tracking branch 'origin/ld_databoard_fix' into ld_databoard_fix

parents 4594dc67 f1529c01
......@@ -101,6 +101,9 @@ export const getAllTypeBusinessConditionDetailByYear = (cur_day) => fetch('/api/
export const transportTypeOrderFinishPie = (date) => fetch("/api/query/dash_board/action/get_order_finish_data_by_transport_type_day", {aux: {"cur_day": date}}, "POST")
export const customerOrderFinishPie = (date) => fetch("/api/query/dash_board/action/get_order_finish_data_by_customer_day", {aux: {"cur_day": date}}, "POST")
export const getOrderFinishDataByCondition = (aux) => fetch("/api/query/*/action/get_order_finish_data_by_condition", {aux: aux}, "POST")
export const getOrderWeightAndProportionList = (aux) => fetch("/api/query/dash_board/action/get_order_weight_and_proportion_list", {aux: aux}, "POST")
//流失客户 & 新增客户
export const getOrderLoseAddCustomer = (cur_day) => fetch('/api/query/*/action/get_order_loss_add_customer', {
aux: {
......
......@@ -7,7 +7,7 @@
<td class="winner_span" :style="columnsStyle['title']">{{ row.title }}</td>
<td v-for="(col, idz) in row.column" :key="idz" :style="columnsStyle[col.key]">
<p class="key_span">{{ col.key }}</p>
<p class="value_span" :style="col.valStyle">{{ col.value }}</p>
<p class="value_span" :style="col.valStyle">{{colFormatter[''+idz]?colFormatter[''+idz](col.value):col.value }}</p>
</td>
</tr>
</tbody>
......@@ -38,6 +38,12 @@ export default {
{title: '标题列', column: [{key: '字段', value: '0'}]}
];
}
},
colFormatter:{
type: Object,
default: function(){
return {};
}
}
},
data() {
......@@ -52,6 +58,8 @@ export default {
}
.winner_list::-webkit-scrollbar { width: 0 !important }
table {
height: 100%;
font-size: 12px;
......
......@@ -176,7 +176,7 @@ export default {
type: 'line',
color: 'red',
lineStyle:{
width: 6,
width: 3,
},
label: {
show: true,
......@@ -189,13 +189,13 @@ export default {
}
},
formatter:{
type: Function
type: [Function,String]
},
barFormatter:{
type: Function
type: [Function,String]
},
lineFormatter:{
type: Function
type: [Function,String]
}
},
};
......
<template>
<table>
<thead v-if="showHead">
<tr><th :style="eval('title',title)">{{title}}&nbsp;</th></tr>
<tr><th :style="eval('title',title)">{{titleFormatter?titleFormatter(title):title}}&nbsp;</th></tr>
</thead>
<tbody>
<tr v-for="row in data"><td :style="eval('cell',(row[name]?row[name]:''))">{{row[name]?row[name]:''}}</td></tr>
<tr v-for="row in data"><td :style="eval('cell',(row[name]?row[name]:''))">{{valueFormatter?valueFormatter(row[name]?row[name]:''):row[name]?row[name]:''}}</td></tr>
</tbody>
</table>
</template>
......@@ -65,6 +65,12 @@ export default {
titleStyleFunction:{
type: Function
},
titleFormatter:{
type: Function
},
valueFormatter:{
type: Function
}
}
}
......
import { getOrderWeightAndProportionList} from '../../../api/apiList';
import {calc_hb_str, calc_zb_str, conver_amont} from "../../../utils/numUtil";
let choice = {
"01": "transport_type",
"02": "area_name",
"03": "base_name",
"04": "department",
}
export const getDetailData = async (aux,callback) => {
let resList = new Array();
aux[choice[aux.type]] = aux.key;
await getOrderWeightAndProportionList(aux).then(function (res) {
resList = res.data;
});
callback(resList);
return resList
}
import { getOrderFinishDataByCondition} from '../../../api/apiList';
import {calc_hb_str, calc_zb_str, conver_amont} from "../../../utils/numUtil";
let choice = {
day: '昨日',
month: "上月",
year: "去年",
}
export const getHeadData = async (aux,callback) => {
let resList = new Array();
await getOrderFinishDataByCondition(aux).then(function (res) {
resList = dataFormatter(aux,res.data);
});
callback(resList);
return resList
}
function dataFormatter(aux,data){
let res = new Array();
if (aux.group_type === '01'){
formatType01Data(aux,res, data);
}else {
formatNotType01Data(aux,res, data);
}
return res;
}
function formatNotType01Data(aux,res, data){
let sum = {
title: "当日",
data: [
{
title: '订单量',
today: 0,
yesterday: 0,
},
{
title: '营业额',
today: 0,
yesterday: 0,
},
{
title: '成本',
today: 0,
yesterday: 0,
},
{
title: '毛利',
today: 0,
yesterday: 0,
},
]
};
res.push(sum);
for (let key in data) {
let item = {
title: data[key].name?data[key].name:"空",
key: key,
data: [
{
title: "订单量",
today: data[key].cur_unit_weight,
yesterday: data[key].pre_unit_weight
},
{
title: "营业额",
today: data[key].cur_sell_settle_amount,
yesterday: data[key].pre_sell_settle_amount
},
{
title: "成本",
today: data[key].cur_buy_settle_amount,
yesterday: data[key].pre_buy_settle_amount
},
{
title: "毛利",
today: data[key].cur_gross_profit_amount,
yesterday: data[key].pre_gross_profit_amount
},
]
};
for (let i = 0; i < sum.data.length; i++) {
sum.data[i].today += item.data[i].today;
sum.data[i].yesterday += item.data[i].yesterday;
}
res.push(item);
}
}
//转换领域细分数据
function formatType01Data(aux,res, data) {
let sum = {
title: "当日订单量(不含仓库)",
amount: 0,
hb: [
{
title: choice[aux.time_type],
amount: 0,
rate: "0.00%"
}
]
};
res.push(sum);
for (let key in data) {
let item = {
title: data[key].name?data[key].name:"空",
amount: data[key].cur_unit_weight,
key: key,
hb: [
{
title: choice[aux.time_type],
amount: conver_amont(data[key].pre_unit_weight),
rate: calc_hb_str(data[key].cur_unit_weight, data[key].pre_unit_weight)
}
]
};
sum.amount += data[key].cur_unit_weight;
sum.hb[0].amount += data[key].pre_unit_weight;
res.push(item);
}
calcProportion(res);
sum.amount = conver_amont(sum.amount);
sum.hb[0].amount = conver_amont(sum.hb[0].amount);
}
function calcProportion(list) {
let sum = list[0];
for (let i = 1; i < list.length; i++) {
list[i].hb.push({
title: "占比",
amount: calc_zb_str(list[i].amount,sum.amount)
})
list[i].amount = conver_amont(list[i].amount);
}
}
{
"domain":{
"01":{
"day": {
"head": [
{
......@@ -1021,7 +1021,7 @@
}
}
},
"area":{
"02":{
"day": {
"head": [
{
......@@ -2205,7 +2205,7 @@
}
}
},
"base": {
"03": {
"day": {
"head": [
{
......@@ -3857,7 +3857,7 @@
}
}
},
"business": {
"04": {
"day": {
"head": [
{
......
......@@ -256,7 +256,6 @@ export default {
}
},
selectLegend(title) {
console.log(title)
let name;
this.chart.dispatchAction({
type: 'legendAllSelect'
......@@ -295,7 +294,6 @@ export default {
default:
break;
}
console.log(name)
if (name) {
this.chart.dispatchAction({
type: 'legendInverseSelect'
......
//环比值=(当日营业额-昨日营业额)/昨日营业额*100%计算
export const calc_hb_str = function (cur, pre) {
if (cur == 0 || pre == 0){
return '0.00%'
}
return conver_num_rate(formater((cur - pre) / pre * 100));
};
......@@ -8,6 +11,15 @@ export const calc_tb_str = function (cur, pre) {
return conver_num_rate(formater(cur / pre * 100));
};
//计算占比
export const calc_zb_str = function (item, total) {
if (item == 0 || total == 0){
return '0.00%'
}
return formater(item / total * 100) + '%';
};
//conver amont
export const conver_amont = function (amont) {
return formater(amont / 10000);
......
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