Commit 338a5dff authored by 王礼鸿 Baimax Wang's avatar 王礼鸿 Baimax Wang

饼图和占比定时刷新

parent 46ede36b
......@@ -11,6 +11,7 @@ export const getHeadData = async (aux,callback) => {
let resList = new Array();
await getOrderFinishDataByCondition(aux).then(function (res) {
resList = dataFormatter(aux,res.data);
console.log(resList)
});
callback(resList);
return resList
......@@ -20,17 +21,22 @@ export const getHeadData = async (aux,callback) => {
function dataFormatter(aux,data){
let res = new Array();
let otherBaseItem;
if (aux.group_type === '01'){
formatType01Data(aux,res, data);
otherBaseItem = formatType01Data(aux,res, data);
}else {
formatNotType01Data(aux,res, data);
otherBaseItem = formatNotType01Data(aux,res, data);
}
if (otherBaseItem){
res.push(otherBaseItem)
}
return res;
}
function formatNotType01Data(aux,res, data){
let otherBaseItem;
let sum = {
title: "当日",
title: aux.time_type ==='day'?'当日':'截至当日',
data: [
{
title: '订单量',
......@@ -86,12 +92,18 @@ function formatNotType01Data(aux,res, data){
sum.data[i].today += item.data[i].today;
sum.data[i].yesterday += item.data[i].yesterday;
}
if (key === '其他基地'){
otherBaseItem = item;
}else {
res.push(item);
}
}
return otherBaseItem;
}
//转换领域细分数据
function formatType01Data(aux,res, data) {
let otherBaseItem;
let sum = {
title: "当日订单量(不含仓库)",
amount: 0,
......@@ -119,11 +131,16 @@ function formatType01Data(aux,res, data) {
};
sum.amount += data[key].cur_unit_weight;
sum.hb[0].amount += data[key].pre_unit_weight;
if (key === '其他基地'){
otherBaseItem = item;
}else {
res.push(item);
}
}
calcProportion(res);
sum.amount = conver_amont(sum.amount);
sum.hb[0].amount = conver_amont(sum.hb[0].amount);
return otherBaseItem;
}
function calcProportion(list) {
......
......@@ -17,14 +17,15 @@
<div style="width: 60%; height: 100%; float:left; padding: 2% 2% 0 8%; line-height: 40px; display: flex; align-items: center;font-size: 16px;">
<table-column style="float: left;width: 25%;" :data="data.hb" name="title"/>
<table-column style="float: left;width: 40%;" :data="data.hb" name="amount"/>
<table-column style="float: left;width: 35%;" :data="data.hb" name="rate" cell-style-js="var res = {color: 'rgb(255, 51, 0)'}; if(data.indexOf('+') !== -1){res.color = 'rgb(51, 255, 102)'} res;"/>
<table-column style="float: left;width: 35%;" :data="data.hb" name="rate" cell-style-js="var res = {color: 'rgb(51, 255, 102)'}; if(data.indexOf('+') !== -1){res.color = 'rgb(255, 51, 0)'} res;"/>
</div>
</contrast-card>
</div>
<div class="card-board" v-if="currentBtn.subdivide !== '01'">
<contrast-card v-for="data in currentHeadData" style="height: 100%;width: 18%;" :class="{'selectCard': currentCard === data.key}" @click.native="selectCard(data)" :style="listCardStyle">
<!-- 标题-->
<div style="width: 100%; height: 20%; float:left; padding: 2%; line-height: 28px; display: flex; align-items: center; font-size: 14px;">
<table-column style="float: left;width: 80%;" :data="[]" name="title" :title="data.title" :title-formatter="value=> value+'(万元)'" show-head :title-style="{'font-size': '18px','padding-left':'3%','white-space': 'nowrap',}"/>
<table-column style="float: left;width: 80%;" :data="[]" name="title" :title="data.title" :title-formatter="value=> value+'(万元)'" show-head :title-style="{'font-size': '18px','padding-left':'3%','white-space': 'nowrap','font-weight': 'bold',}"/>
<table-column style="float: left;width: 0;font-size: 24px;font-weight: bold;color: #5eeef4;text-align: center;" :data="[]" name="today"/>
<table-column style="float: left;width: 20%;" :data="[]" name="yesterday" :title="dateTimeChoice[currentBtn.date]" show-head/>
</div>
......@@ -48,7 +49,6 @@
import TitleContentMark from "../components/layout/title-content-mark.vue";
import TableColumn from "../components/table/table-column.vue";
import ContrastCard from "../components/card/contrast-card.vue";
import * as echarts from "echarts";
import DisplayBoard from "../components/container/display-board.vue";
import WinnersList from "../components/card/winners-list.vue";
import LineBarChart from "../components/chart/line-bar-chart.vue";
......@@ -62,7 +62,7 @@ export default {
components: {LineBarChart, WinnersList, DisplayBoard, ContrastCard, TableColumn, TitleContentMark},
data() {
return {
today: moment().format("yyyy-MM-DD"),
today: '2022-06-26',
currentHeadData:[],
currentDetailData:[],
chart: null,
......@@ -96,10 +96,10 @@ export default {
getHeadData({cur_day: this.today,time_type:this.currentBtn.date,group_type:this.currentBtn.subdivide},
(res) => {
this.currentHeadData = res;
if (type && type !== "date"){
// if (type && type !== "date"){
this.currentCard = res[0]?res[0].key:null;
this.chartTitle = res[0]?(res[0].title + '委托单位占比'):null;
}
// }
this.calcCardWidth();
this.getDetailData();
}
......
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