|
@@ -9,29 +9,30 @@ import * as echarts from "echarts";
|
|
|
import moment from "moment";
|
|
import moment from "moment";
|
|
|
|
|
|
|
|
const linechart = ref();
|
|
const linechart = ref();
|
|
|
-import { bagCount } from "@/api/data";
|
|
|
|
|
|
|
+import { bagCount1 } from "@/api/data";
|
|
|
|
|
|
|
|
const drawEchart = (arryData, total) => {
|
|
const drawEchart = (arryData, total) => {
|
|
|
let echartsObj = echarts.init(linechart.value, "macarons");
|
|
let echartsObj = echarts.init(linechart.value, "macarons");
|
|
|
- var dateArray = getRecentDays();
|
|
|
|
|
|
|
+ // var dateArray = getRecentDays();
|
|
|
var option = (option = {
|
|
var option = (option = {
|
|
|
- title: [
|
|
|
|
|
- {
|
|
|
|
|
- text: "总数",
|
|
|
|
|
- subtext: total + "",
|
|
|
|
|
- textStyle: {
|
|
|
|
|
- fontSize: 15,
|
|
|
|
|
- color: "black",
|
|
|
|
|
- },
|
|
|
|
|
- subtextStyle: {
|
|
|
|
|
- fontSize: 20,
|
|
|
|
|
- color: "black",
|
|
|
|
|
- },
|
|
|
|
|
- textAlign: "center",
|
|
|
|
|
- x: "48%",
|
|
|
|
|
- y: "35%",
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
|
|
+ // title: [
|
|
|
|
|
+ // {
|
|
|
|
|
+ // text: "总数",
|
|
|
|
|
+ // subtext: total + "",
|
|
|
|
|
+ // textStyle: {
|
|
|
|
|
+ // fontSize: 15,
|
|
|
|
|
+ // color: "black",
|
|
|
|
|
+ // },
|
|
|
|
|
+ // subtextStyle: {
|
|
|
|
|
+ // fontSize: 20,
|
|
|
|
|
+ // color: "black",
|
|
|
|
|
+ // },
|
|
|
|
|
+ // textAlign: "center",
|
|
|
|
|
+ // x: "48%",
|
|
|
|
|
+ // y: "35%",
|
|
|
|
|
+ // },
|
|
|
|
|
+ // ],
|
|
|
|
|
+ title:"",
|
|
|
series: [
|
|
series: [
|
|
|
{
|
|
{
|
|
|
name: "Access From",
|
|
name: "Access From",
|
|
@@ -79,19 +80,19 @@ const drawEchart = (arryData, total) => {
|
|
|
echartsObj.setOption(option);
|
|
echartsObj.setOption(option);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const getRecentDays = () => {
|
|
|
|
|
- const oneDay = 24 * 60 * 60 * 1000; // 这里定义一天的毫秒数
|
|
|
|
|
- const resultArray = [];
|
|
|
|
|
- for (let i = 6; i >= 0; i--) {
|
|
|
|
|
- const currentDate = new Date(Date.now() - i * oneDay); // 计算出每天的日期
|
|
|
|
|
- const year = currentDate.getFullYear();
|
|
|
|
|
- const month = String(currentDate.getMonth() + 1).padStart(2, "0"); // 月份需要补零
|
|
|
|
|
- const day = String(currentDate.getDate()).padStart(2, "0"); // 日期也需要补零
|
|
|
|
|
- const formattedDate = `${month}-${day}`; // 格式化日期为 yyyy-mm-dd 的形式
|
|
|
|
|
- resultArray.push(formattedDate);
|
|
|
|
|
- }
|
|
|
|
|
- return resultArray;
|
|
|
|
|
-};
|
|
|
|
|
|
|
+// const getRecentDays = () => {
|
|
|
|
|
+// const oneDay = 24 * 60 * 60 * 1000; // 这里定义一天的毫秒数
|
|
|
|
|
+// const resultArray = [];
|
|
|
|
|
+// for (let i = 6; i >= 0; i--) {
|
|
|
|
|
+// const currentDate = new Date(Date.now() - i * oneDay); // 计算出每天的日期
|
|
|
|
|
+// const year = currentDate.getFullYear();
|
|
|
|
|
+// const month = String(currentDate.getMonth() + 1).padStart(2, "0"); // 月份需要补零
|
|
|
|
|
+// const day = String(currentDate.getDate()).padStart(2, "0"); // 日期也需要补零
|
|
|
|
|
+// const formattedDate = `${month}-${day}`; // 格式化日期为 yyyy-mm-dd 的形式
|
|
|
|
|
+// resultArray.push(formattedDate);
|
|
|
|
|
+// }
|
|
|
|
|
+// return resultArray;
|
|
|
|
|
+// };
|
|
|
|
|
|
|
|
const isToday = (date) => {
|
|
const isToday = (date) => {
|
|
|
// console.log(date)
|
|
// console.log(date)
|
|
@@ -108,34 +109,34 @@ const getbagCountData = () => {
|
|
|
params: param,
|
|
params: param,
|
|
|
pageSize: 1000,
|
|
pageSize: 1000,
|
|
|
};
|
|
};
|
|
|
- bagCount(obj).then((res) => {
|
|
|
|
|
- var rkCount = 0;
|
|
|
|
|
- var ckCount = 0;
|
|
|
|
|
- var ycCount = 0;
|
|
|
|
|
- var clCount = 0;
|
|
|
|
|
- // var total = res.total;
|
|
|
|
|
- for (var index in res.rows) {
|
|
|
|
|
- if(isToday(new Date(res.rows[index].createdAt))){
|
|
|
|
|
- console.log(res.rows[index]);
|
|
|
|
|
- if (res.rows[index].bagStatus == 0) {
|
|
|
|
|
- rkCount++;
|
|
|
|
|
- } else if (res.rows[index].bagStatus == 1) {
|
|
|
|
|
- ckCount++;
|
|
|
|
|
- } else if (res.rows[index].bagStatus == 2) {
|
|
|
|
|
- ycCount++;
|
|
|
|
|
- } else if (res.rows[index].bagStatus == 3) {
|
|
|
|
|
- clCount++;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- var total = rkCount+ckCount+ycCount+clCount
|
|
|
|
|
|
|
+ bagCount1(obj).then((res) => {
|
|
|
|
|
+ // var rkCount = 0;
|
|
|
|
|
+ // var ckCount = 0;
|
|
|
|
|
+ // var ycCount = 0;
|
|
|
|
|
+ // var clCount = 0;
|
|
|
|
|
+ // // var total = res.total;
|
|
|
|
|
+ // for (var index in res.rows) {
|
|
|
|
|
+ // if(isToday(new Date(res.rows[index].createdAt))){
|
|
|
|
|
+ // console.log(res.rows[index]);
|
|
|
|
|
+ // if (res.rows[index].bagStatus == 0) {
|
|
|
|
|
+ // rkCount++;
|
|
|
|
|
+ // } else if (res.rows[index].bagStatus == 1) {
|
|
|
|
|
+ // ckCount++;
|
|
|
|
|
+ // } else if (res.rows[index].bagStatus == 2) {
|
|
|
|
|
+ // ycCount++;
|
|
|
|
|
+ // } else if (res.rows[index].bagStatus == 3) {
|
|
|
|
|
+ // clCount++;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // var total = rkCount+ckCount+ycCount+clCount
|
|
|
var arryData = [
|
|
var arryData = [
|
|
|
- { value: rkCount, name: "入库" },
|
|
|
|
|
- { value: ckCount, name: "出库" },
|
|
|
|
|
- { value: ycCount, name: "异常" },
|
|
|
|
|
- { value: clCount, name: "已处理" },
|
|
|
|
|
|
|
+ { value: res.data.TodayInbound, name: "今日入库" },
|
|
|
|
|
+ { value: res.data.TodayOutbound, name: "今日出库" },
|
|
|
|
|
+ { value: res.data.LastMonthTodayInbound, name: "上月今日入库" },
|
|
|
|
|
+ { value: res.data.LastMonthTodayOutbound, name: "上月今日出库" },
|
|
|
];
|
|
];
|
|
|
- drawEchart(arryData, total);
|
|
|
|
|
|
|
+ drawEchart(arryData, 0);
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|