更新代码
This commit is contained in:
parent
bf30559510
commit
2a45029c77
|
@ -17,6 +17,16 @@ export default function IncomeQuerry({ children }) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData();
|
getData();
|
||||||
}, []);
|
}, []);
|
||||||
|
useEffect(() => {
|
||||||
|
if(databoard.current&&data.week_dashboard){
|
||||||
|
createDataBoard(data.week_dashboard);
|
||||||
|
}
|
||||||
|
}, [databoard.current]);
|
||||||
|
useEffect(() => {
|
||||||
|
if(incomeOrgin.current && data.income_from_dashboard){
|
||||||
|
createIncomeOrgin(data.income_from_dashboard);
|
||||||
|
}
|
||||||
|
}, [incomeOrgin.current]);
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
const base = webviewBaseRequest();
|
const base = webviewBaseRequest();
|
||||||
const signature = generateSignature({
|
const signature = generateSignature({
|
||||||
|
@ -40,12 +50,11 @@ export default function IncomeQuerry({ children }) {
|
||||||
return total + item.income;
|
return total + item.income;
|
||||||
}, 0);
|
}, 0);
|
||||||
data && setData({ ...data, weekIncom });
|
data && setData({ ...data, weekIncom });
|
||||||
createDataBoard(data.week_dashboard);
|
|
||||||
createIncomeOrgin(data.income_from_dashboard);
|
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
const createDataBoard = (data) => {
|
const createDataBoard = (data) => {
|
||||||
if (databoard.current) {
|
|
||||||
var myChart = echarts.init(databoard.current, "dark");
|
var myChart = echarts.init(databoard.current, "dark");
|
||||||
var option;
|
var option;
|
||||||
option = {
|
option = {
|
||||||
|
@ -114,10 +123,8 @@ export default function IncomeQuerry({ children }) {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
option && myChart.setOption(option);
|
option && myChart.setOption(option);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
const createIncomeOrgin = (data) => {
|
const createIncomeOrgin = (data) => {
|
||||||
if (incomeOrgin.current) {
|
|
||||||
var myChart = echarts.init(incomeOrgin.current, "dark");
|
var myChart = echarts.init(incomeOrgin.current, "dark");
|
||||||
var option;
|
var option;
|
||||||
option = {
|
option = {
|
||||||
|
@ -179,7 +186,6 @@ export default function IncomeQuerry({ children }) {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
option && myChart.setOption(option);
|
option && myChart.setOption(option);
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDateStr = (data) => {
|
const getDateStr = (data) => {
|
||||||
|
|
Loading…
Reference in New Issue