style: 移除多余空行并统一代码格式

修复代码中的多余空行问题,统一字符串引号使用双引号,调整对象和数组的格式,优化代码缩进和换行,提升代码可读性和一致性
This commit is contained in:
zhangtao
2025-11-14 01:45:22 +08:00
parent 66c345d590
commit d588abb386
100 changed files with 9192 additions and 5181 deletions
+13 -30
View File
@@ -1,5 +1,5 @@
// 问候语:根据当前小时返回不同问候语
export function greetings () {
export function greetings() {
// 当前时间(用于计算问候语)
const currentDate = new Date();
const hours = currentDate.getHours();
@@ -16,7 +16,7 @@ export function greetings () {
} else {
return "偷偷向银河要了一把碎星,只等你闭上眼睛撒入你的梦中,晚安🌛!";
}
};
}
export function getRangeDate(startDate: string | number | Date, endDate: string | number | Date) {
const targetArr = [];
@@ -37,27 +37,19 @@ export function getRangeDate(startDate: string | number | Date, endDate: string
if (startDateInfo.month !== endDateInfo.month) {
//同年,不同月份
//获取开始时间所在月的月底日期
const startMax = new Date(
startDateInfo.year,
startDateInfo.month,
0
).getDate();
const startMax = new Date(startDateInfo.year, startDateInfo.month, 0).getDate();
const endNum = startMax - startDateInfo.day + endDateInfo.day;
for (let i = startDateInfo.day; i <= startDateInfo.day + endNum; i++) {
if (i > startMax) {
targetArr.push(
`${endDateInfo.year}-${
endDateInfo.month < 10
? "0" + endDateInfo.month
: endDateInfo.month
endDateInfo.month < 10 ? "0" + endDateInfo.month : endDateInfo.month
}-${i - startMax < 10 ? "0" + (i - startMax) : i - startMax}`
);
} else {
targetArr.push(
`${startDateInfo.year}-${
startDateInfo.month < 10
? "0" + startDateInfo.month
: startDateInfo.month
startDateInfo.month < 10 ? "0" + startDateInfo.month : startDateInfo.month
}-${i < 10 ? "0" + i : i}`
);
}
@@ -67,20 +59,14 @@ export function getRangeDate(startDate: string | number | Date, endDate: string
for (let i = startDateInfo.day; i <= endDateInfo.day; i++) {
targetArr.push(
`${startDateInfo.year}-${
startDateInfo.month < 10
? "0" + startDateInfo.month
: startDateInfo.month
startDateInfo.month < 10 ? "0" + startDateInfo.month : startDateInfo.month
}-${i < 10 ? "0" + i : i}`
);
}
}
} else {
//不同年 【既然不同年那肯定也不同月】
const startMax = new Date(
startDateInfo.year,
startDateInfo.month,
0
).getDate();
const startMax = new Date(startDateInfo.year, startDateInfo.month, 0).getDate();
const endNum = startMax - startDateInfo.day + endDateInfo.day;
for (let i = startDateInfo.day; i <= startDateInfo.day + endNum; i++) {
if (i > startMax) {
@@ -92,9 +78,7 @@ export function getRangeDate(startDate: string | number | Date, endDate: string
} else {
targetArr.push(
`${startDateInfo.year}-${
startDateInfo.month < 10
? "0" + startDateInfo.month
: startDateInfo.month
startDateInfo.month < 10 ? "0" + startDateInfo.month : startDateInfo.month
}-${i < 10 ? "0" + i : i}`
);
}
@@ -131,17 +115,17 @@ export function listToTree(list: any[]) {
// 加载部门选项
export function formatTree(nodes: any[]): any[] {
return nodes.map(node => {
return nodes.map((node) => {
const formattedNode = {
value: node.id,
label: node.name,
disabled: node.status === false || String(node.status) === 'false'
disabled: node.status === false || String(node.status) === "false",
};
if (node.children && node.children.length > 0) {
Object.assign(formattedNode, { children: formatTree(node.children) });
}
return formattedNode;
});
}
@@ -160,6 +144,5 @@ export function isEmpty(obj: string | null | undefined) {
// 验证是否为blob格式
export function blobValidate(data: Blob): boolean {
return data.type !== 'application/json'
return data.type !== "application/json";
}