日期写成了 固定的 2025.5.7
This commit is contained in:
@@ -163,11 +163,13 @@ export default {
|
||||
|
||||
httpRequest("POST", requestUrl, {}, {}).then((res) => {
|
||||
if (res.success && res.result) {
|
||||
_this.dataConfig.doingDay = res.result.doingDay ? res.result.doingDay : "-";
|
||||
_this.dataConfig.startDay = res.result.startDay ? res.result.startDay : "-";
|
||||
// _this.dataConfig.doingDay = res.result.doingDay ? res.result.doingDay : "-";
|
||||
// _this.dataConfig.startDay = res.result.monitorDate ? _this.formatDateString(res.result.monitorDate) : "-";
|
||||
_this.dataConfig.doingDay = _this.daysSinceDate("2025-05-07");
|
||||
_this.dataConfig.startDay = "2025年5月7日";
|
||||
|
||||
_this.dataConfig.personnelType = _this.rankingConfig.personnelType;
|
||||
let list = res.result.list;
|
||||
let list = res.result.rankList;
|
||||
|
||||
if (list && list.length) {
|
||||
_this.dataConfig.list = list;
|
||||
@@ -193,6 +195,25 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
daysSinceDate(targetDateString) {
|
||||
const targetDate = new Date(targetDateString);
|
||||
const currentDate = new Date(); // 当前日期
|
||||
|
||||
// 将日期部分归零,只比较天数差,避免时区和时间的影响
|
||||
targetDate.setHours(0, 0, 0, 0);
|
||||
currentDate.setHours(0, 0, 0, 0);
|
||||
|
||||
const differenceInTime = currentDate.getTime() - targetDate.getTime();
|
||||
const differenceInDays = differenceInTime / (1000 * 3600 * 24);
|
||||
|
||||
return Math.floor(differenceInDays); // 返回整数天数
|
||||
},
|
||||
|
||||
// formatDateString(dateString) {
|
||||
// const [year, month, day] = dateString.split('-');
|
||||
// return `${year}年${Number(month)}月${Number(day)}日`;
|
||||
// },
|
||||
|
||||
startOneTimeScroll() {
|
||||
const container = this.$refs.scrollContentBody;
|
||||
if (!container) return;
|
||||
|
||||
@@ -176,14 +176,21 @@ export default {
|
||||
if (res.success && res.result) {
|
||||
_this.dataConfig.dinnerType = res.result.dinnerType ? res.result.dinnerType : "-";
|
||||
_this.dataConfig.userNum = res.result.userNum ? res.result.userNum : "-";
|
||||
_this.dataConfig.startDay = res.result.startDay ? res.result.startDay : "-";
|
||||
// _this.dataConfig.startDay = res.result.startDay ? _this.formatDateString(res.result.startDay) : "-";
|
||||
_this.dataConfig.startDay = "2025年5月7日";
|
||||
|
||||
_this.dataConfig.personnelType = _this.rankingConfig.personnelType;
|
||||
let dataKey = _this.dataConfig.personnelType === "staff" ? 'nutritionRankingsVos' : 'departRankingsVos';
|
||||
let list = res.result[dataKey];
|
||||
|
||||
if (list && list.length) {
|
||||
list.map(item => {
|
||||
if(item.departName === "行政事务管理处") {
|
||||
item.departName = "公共事务中心";
|
||||
}
|
||||
})
|
||||
_this.dataConfig.list = list;
|
||||
|
||||
_this.$nextTick(() => {
|
||||
_this.startOneTimeScroll();
|
||||
});
|
||||
@@ -206,6 +213,19 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
// formatDateString(dateString) {
|
||||
// const regex = /(\d{4})年0?(\d{1,2})月0?(\d{1,2})日/;
|
||||
// const match = dateString.match(regex);
|
||||
// if (match) {
|
||||
// const year = match[1];
|
||||
// const month = Number(match[2]);
|
||||
// const day = Number(match[3]);
|
||||
// return `${year}年${month}月${day}日`;
|
||||
// } else {
|
||||
// return dateString;
|
||||
// }
|
||||
// },
|
||||
|
||||
startOneTimeScroll() {
|
||||
const container = this.$refs.scrollContentBody;
|
||||
if (!container) return;
|
||||
|
||||
Reference in New Issue
Block a user