5.1日 暂定 水电表管理
This commit is contained in:
@@ -5,7 +5,7 @@ import { useUserStore } from '@/store/modules/user';
|
||||
* @param {Array} value 校验值
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
export const checkPermi = (value: any) => {
|
||||
export const checkPermi = (value: string[]) => {
|
||||
if (value && value instanceof Array && value.length > 0) {
|
||||
const permissions = useUserStore().permissions;
|
||||
const permissionDatas = value;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user