diff --git a/gold-system/src/views/workspace/index.vue b/gold-system/src/views/workspace/index.vue index 02b0634..544fa5e 100644 --- a/gold-system/src/views/workspace/index.vue +++ b/gold-system/src/views/workspace/index.vue @@ -6,7 +6,7 @@ import * as bs from "vue-icons-plus/bs"; import axios, { all } from "axios"; import API from "../../api/index"; import moment from "moment"; -import * as math from 'mathjs'; +import * as math from "mathjs"; import { getTime } from "element-plus/es/components/countdown/src/utils.mjs"; // 变量 @@ -89,22 +89,10 @@ const get = async function () { getAreaRank(); getMiddleBar(); // 发送POST请求 - const result1 = await API.post( - "/hwjb/statistics/getSumCoin", - {} - ); - const result2 = await API.post( - "/hwjb/statistics/a", - {} - ); - const result3 = await API.post( - "/hwjb/statistics/getYearConsumeCoin", - {} - ); - const result4 = await API.post( - "/hwjb/statistics/getDayConsumeCoin", - {} - ); + const result1 = await API.post("/hwjb/statistics/getSumCoin", {}); + const result2 = await API.post("/hwjb/statistics/a", {}); + const result3 = await API.post("/hwjb/statistics/getYearConsumeCoin", {}); + const result4 = await API.post("/hwjb/statistics/getDayConsumeCoin", {}); // const result5 = await API.post( // "/hwjb/statistics/getMediumAreaPay", // {} @@ -122,10 +110,7 @@ const get = async function () { // "/hwjb/statistics/getMediuConsumeCoin", // {} // ); - const result9 = await API.post( - "/hwjb/statistics/b", - {} - ); + const result9 = await API.post("/hwjb/statistics/b", {}); // 将响应结果存储到响应式数据中 getSumCoin.value = result1.data; @@ -214,13 +199,13 @@ const get = async function () { ERPData.value.forEach((item, index) => item == "" ? (ERPData.value[index] = { - value: 0, - name: "第" + (index + 1) + "学科" + 0, - }) + value: 0, + name: "第" + (index + 1) + "学科" + 0, + }) : (ERPData.value[index] = { - value: item[0], - name: "第" + (index + 1) + "学科" + item[0], - }) + value: item[0], + name: "第" + (index + 1) + "学科" + item[0], + }) ); console.log("ERPData", ERPData.value); HCData.value = [ @@ -240,13 +225,13 @@ const get = async function () { HCData.value.forEach((item, index) => item == "" ? (HCData.value[index] = { - value: 0, - name: "第" + (index + 1) + "学科" + 0, - }) + value: 0, + name: "第" + (index + 1) + "学科" + 0, + }) : (HCData.value[index] = { - value: item[0], - name: "第" + (index + 1) + "学科" + item[0], - }) + value: item[0], + name: "第" + (index + 1) + "学科" + item[0], + }) ); console.log("HCData", HCData.value); LinkData.value = [ @@ -266,13 +251,13 @@ const get = async function () { LinkData.value.forEach((item, index) => item == "" ? (LinkData.value[index] = { - value: 0, - name: "第" + (index + 1) + "学科" + 0, - }) + value: 0, + name: "第" + (index + 1) + "学科" + 0, + }) : (LinkData.value[index] = { - value: item[0], - name: "第" + (index + 1) + "学科" + item[0], - }) + value: item[0], + name: "第" + (index + 1) + "学科" + item[0], + }) ); console.log("LinkData", LinkData.value); goldData.value = [ @@ -292,13 +277,13 @@ const get = async function () { goldData.value.forEach((item, index) => item == "" ? (goldData.value[index] = { - value: 0, - name: "第" + (index + 1) + "学科" + 0, - }) + value: 0, + name: "第" + (index + 1) + "学科" + 0, + }) : (goldData.value[index] = { - value: item[0], - name: "第" + (index + 1) + "学科" + item[0], - }) + value: item[0], + name: "第" + (index + 1) + "学科" + item[0], + }) ); console.log("goldData", goldData.value); allData.value = [ @@ -368,7 +353,7 @@ const get = async function () { // 获取中间柱状图数据 const getMiddleBar = async function () { const result = await API.post( - "/hwjb/statistics/getCoinTime", + "hwjb/statistics/getCoinTime", getMiddleBarObj.value ); @@ -393,13 +378,22 @@ const getMiddleBar = async function () { middleTotalFree.value = 0; middleTotalTask.value = 0; middleRecharge.value.forEach((number) => { - middleTotalRecharge.value = math.add(math.bignumber(middleTotalRecharge.value), math.bignumber(number)); + middleTotalRecharge.value = math.add( + math.bignumber(middleTotalRecharge.value), + math.bignumber(number) + ); }); middleFree.value.forEach((number) => { - middleTotalFree.value = math.add(math.bignumber(middleTotalFree.value), math.bignumber(number)); + middleTotalFree.value = math.add( + math.bignumber(middleTotalFree.value), + math.bignumber(number) + ); }); middleTask.value.forEach((number) => { - middleTotalTask.value = math.add(math.bignumber(middleTotalTask.value), math.bignumber(number)); + middleTotalTask.value = math.add( + math.bignumber(middleTotalTask.value), + math.bignumber(number) + ); }); console.log("middleCategory", middleCategory.value); @@ -696,7 +690,8 @@ const thisYear = function () { const current = new Date(); const startDate = new Date(current.getFullYear(), 0, 1); const endDate = new Date(current.getFullYear(), current.getMonth() + 1, 0); - searchTime.value = [startDate, endDate]; + const year = 1; + searchTime.value = [startDate, endDate, year]; search(); // console.log("searchTime", moment(searchTime.value[0]).format("YYYY-MM-DD") + "至" + moment(searchTime.value[1]).format("YYYY-MM-DD")) }; @@ -726,8 +721,8 @@ const search = function () { console.log( "searchTime", moment(searchTime.value[0]).format("YYYY-MM-DD") + - "至" + - moment(searchTime.value[1]).format("YYYY-MM-DD") + "至" + + moment(searchTime.value[1]).format("YYYY-MM-DD") ); getMiddleBarObj.value.searchStartTime = moment(searchTime.value[0]).format( @@ -758,6 +753,11 @@ const search = function () { } console.log("getAreaRankObj", getAreaRankObj.value); + if (searchTime.value[2] == 1) { + getMiddleBarObj.value.year = searchTime.value[2]; + } else { + delete getMiddleBarObj.value.year; + } getMiddleBar(); areaRankLoading.value = true; getAreaRank(); @@ -956,8 +956,8 @@ onMounted(async function () { trigger: "item", position: ["15%", "-3%"], formatter: function (params) { - return params.seriesName + '
' + params.name; - } + return params.seriesName + "
" + params.name; + }, }, legend: { bottom: "-1%", @@ -995,8 +995,8 @@ onMounted(async function () { trigger: "item", position: ["15%", "-3%"], formatter: function (params) { - return params.seriesName + '
' + params.name; - } + return params.seriesName + "
" + params.name; + }, }, legend: { bottom: "-1%", @@ -1039,8 +1039,18 @@ onMounted(async function () { trigger: "item", position: ["15%", "-3%"], formatter: function (params) { - return params.seriesName + '
' + params.name + (params.value == getSumCoin.value.todayFree ? '
6月到期 | ' + statistics.value.free6SumCoin + ' ; 12月到期 | ' + statistics.value.free12SumCoin : ''); - } + return ( + params.seriesName + + "
" + + params.name + + (params.value == getSumCoin.value.todayFree + ? "
6月到期 | " + + statistics.value.free6SumCoin + + " ; 12月到期 | " + + statistics.value.free12SumCoin + : "") + ); + }, }, legend: { bottom: "-1%", @@ -1099,7 +1109,7 @@ onMounted(async function () {
- +

当前金币余量

{{ formatNum(getSumCoin.todayTotalCoin) }} @@ -1108,33 +1118,47 @@ onMounted(async function () {

较前一天 {{ formatNum(getSumCoin.coinDifference) }} - +
较前一天 {{ formatNum(getSumCoin.coinDifference) }} - +
较前一天 {{ formatNum(getSumCoin.coinDifference) }} - +

- +

全年累计金币数

{{ formatNum(Math.abs(statistics.totalSumCoin)) }} @@ -1143,7 +1167,8 @@ onMounted(async function () { 折合新币累计金额 {{ formatNum(Math.abs(statistics.rechargeSumCoin)) }}

-