5.1日 暂定 水电表管理

This commit is contained in:
Zy
2026-05-01 18:36:37 +08:00
parent 7b89144dd4
commit a8bb4e66ad
103 changed files with 1071 additions and 533 deletions

View File

@@ -40,7 +40,9 @@ const whiteVillageId = [
'/village',
'/village/*',
'/waterDevice/generateBarCode', // 水表 条码
'/electricityDevice/generateBarCodee' // 电表 条码
'/electricityDevice/generateBarCodee', // 电表 条码
'/payRecordList/payRecordList/list'
// 以后直接在这里加新地址,支持 /xxx/*、/xxx/xxx 写法
];
@@ -83,18 +85,17 @@ service.interceptors.request.use(
if (getToken() && !isToken) {
config.headers['Authorization'] = 'Bearer ' + getToken(); // 让每个请求携带自定义token 请根据实际情况自行修改
}
console.log(needVillageId(config.url), config.url);
// get请求映射params参数
const villageid = localStorage.getItem('villageid');
if (config.method === 'get' && config.params) {
let url = '';
if (villageid != 'null' && !Number.isNaN(Number(villageid)) && needVillageId(config.url)) {
if (villageid != 'null' && needVillageId(config.url)) {
url =
config.url +
'?' +
tansParams({
...config.params,
villageId: Number(villageid)
villageId: villageid
});
} else {
url = config.url + '?' + tansParams(config.params);
@@ -106,10 +107,10 @@ service.interceptors.request.use(
if (!isRepeatSubmit && (config.method === 'post' || config.method === 'put')) {
let obj = null;
if (villageid != 'null' && !Number.isNaN(Number(villageid)) && needVillageId(config.url)) {
if (villageid != 'null' && needVillageId(config.url)) {
obj = {
...config.data,
villageId: Number(villageid)
villageId: villageid
};
} else {
obj = config.data;
@@ -130,7 +131,7 @@ service.interceptors.request.use(
const s_url = sessionObj.url; // 请求地址
const s_data = sessionObj.data; // 请求数据
const s_time = sessionObj.time; // 请求时间
const interval = 500; // 间隔时间(ms),小于此时间视为重复提交
const interval = 200; // 间隔时间(ms),小于此时间视为重复提交
if (s_data === requestObj.data && requestObj.time - s_time < interval && s_url === requestObj.url) {
const message = '数据正在处理,请勿重复提交';
console.warn(`[${s_url}]: ` + message);
@@ -154,7 +155,6 @@ service.interceptors.request.use(
delete config.headers['Content-Type'];
}
console.log(config, config.data);
return config;
},
(error: any) => {
@@ -215,9 +215,6 @@ service.interceptors.response.use(
return Promise.reject('无效的会话,或者会话已过期,请重新登录。');
} else if (code === HttpStatus.SERVER_ERROR) {
// 500
console.log(res);
console.log(res.config.url.split('?')[0]);
ElMessage({ message: msg, type: 'error' });
return Promise.reject(res.data);
} else if (code === HttpStatus.WARN) {