水电表基本搭建完成

This commit is contained in:
Zy
2026-04-27 08:08:30 +08:00
parent ab736fa15f
commit 826b22e206
26 changed files with 2208 additions and 393 deletions

View File

@@ -15,6 +15,27 @@ export const formatDate = (cellValue: string) => {
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
};
/**
* 表格时间格式化(修复时区问题,固定 00:00:00
*/
export const formatDate2 = (cellValue: string) => {
if (!cellValue) return '';
const date = new Date(cellValue);
// 无效日期直接返回空
if (isNaN(date.getTime())) return '';
// 统一使用本地时间,强制 0 点
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
// 补零工具
const pad = (num: number) => num.toString().padStart(2, '0');
return `${year}-${pad(month)}-${pad(day)} 00:00:00`;
};
/**
* @param {number} time
* @param {string} option

View File

@@ -38,7 +38,9 @@ const service = axios.create({
// 不需要小区 ID 的接口白名单(支持 * 通配符)
const whiteVillageId = [
'/village',
'/village/*'
'/village/*',
'/waterDevice/generateBarCode', // 水表 条码
'/electricityDevice/generateBarCodee' // 电表 条码
// 以后直接在这里加新地址,支持 /xxx/*、/xxx/xxx 写法
];
@@ -151,6 +153,8 @@ service.interceptors.request.use(
if (config.data instanceof FormData) {
delete config.headers['Content-Type'];
}
console.log(config, config.data);
return config;
},
(error: any) => {