feat: 🚀 增加验证接口
This commit is contained in:
@@ -116,17 +116,28 @@ class RequestHttp {
|
||||
location.href = usePathUrl();
|
||||
return Promise.reject(data);
|
||||
}
|
||||
|
||||
console.log("1232323");
|
||||
let statusStr = data.status + "";
|
||||
const STATUS_STRS = ["600006", "600002", "600003", "600001", "600004", "600005", "3433535", "40005"];
|
||||
const STATUS_STRS = [
|
||||
"600006",
|
||||
"600002",
|
||||
"600003",
|
||||
"600001",
|
||||
"600004",
|
||||
"600005",
|
||||
"3433535",
|
||||
"40005"
|
||||
// "70003",
|
||||
// "70001"
|
||||
];
|
||||
if (statusStr.length > 3 && !STATUS_STRS.includes(statusStr)) {
|
||||
console.log("32121");
|
||||
ElMessage.error(data.msg || data.message);
|
||||
return Promise.reject(data);
|
||||
}
|
||||
if (data.status === 504) {
|
||||
ElMessage.error("请求超时!请您稍后重试");
|
||||
}
|
||||
|
||||
// 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
|
||||
if (data.code && data.code !== ResultEnum.SUCCESS) {
|
||||
ElMessage.error(data.msg);
|
||||
@@ -144,7 +155,7 @@ class RequestHttp {
|
||||
const { response } = error;
|
||||
|
||||
tryHideFullScreenLoading();
|
||||
|
||||
console.log("12323232323s ss");
|
||||
// 请求超时 && 网络错误单独判断,没有 response
|
||||
if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
|
||||
if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
|
||||
|
||||
@@ -100,6 +100,10 @@ export const getUpdateMaterialApi = (params: Record<string, any>) => {
|
||||
export const getTransferSnApi = (params: Record<string, any>) => {
|
||||
return http.post<any>(`SerialNumber/TransferSn`, params);
|
||||
};
|
||||
//2件装检测
|
||||
export const getTransferSnJCApi = (params: Record<string, any>) => {
|
||||
return http.post<any>(`SerialNumber/VerifSn`, params);
|
||||
};
|
||||
//产品条码列表下载
|
||||
export const getSerialNumberDownLoadApi = (params: Record<string, any>) => {
|
||||
return http.post<ResPage<any>>(`SerialNumber/Export`, params);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ElMessageBox } from "element-plus";
|
||||
import { useMsg } from "@/hooks/useMsg";
|
||||
import { getTransferSnApi } from "@/api/modules/barCode";
|
||||
import { getTransferSnApi, getTransferSnJCApi } from "@/api/modules/barCode";
|
||||
// const $router = useRouter();
|
||||
|
||||
const props: any = defineProps<{
|
||||
@@ -19,67 +19,7 @@ const emits = defineEmits<{
|
||||
(e: "handleChildBtnCallback", result: Record<string, any>): void;
|
||||
}>();
|
||||
|
||||
// 提交事件
|
||||
const handleBtnClick = () => {
|
||||
if (!props.selectionList.length) {
|
||||
useMsg("warning", `请选择需要转换的数据 !`);
|
||||
return;
|
||||
}
|
||||
let isSome = props.selectionList.filter((item: any) => {
|
||||
return item.useNumber;
|
||||
});
|
||||
let isNumber = props.selectionList.filter((item: any) => {
|
||||
return item.number % 2 === 1;
|
||||
});
|
||||
let specificationsArr: any = [];
|
||||
let specificationsArr1: any = [];
|
||||
//多种条件
|
||||
if (isSome.length && isNumber.length) {
|
||||
//单个
|
||||
isSome.forEach((item: any) => {
|
||||
specificationsArr.push(item.specifications);
|
||||
});
|
||||
specificationsArr = [...new Set(specificationsArr)];
|
||||
let specifications = specificationsArr.join(",");
|
||||
useMsg("warning", `${specifications}序列码存在已使用, 请选择未使用序列码的数据 !`);
|
||||
//单数
|
||||
isNumber.forEach((item: any) => {
|
||||
specificationsArr1.push(item.specifications);
|
||||
});
|
||||
specificationsArr = [...new Set(specificationsArr1)];
|
||||
let specifications1 = specificationsArr1.join(",");
|
||||
useMsg("warning", `${specifications1}条码个数为单数, 不支持转两件装 !`);
|
||||
|
||||
return;
|
||||
}
|
||||
//单个使用
|
||||
if (isSome.length) {
|
||||
isSome.forEach((item: any) => {
|
||||
specificationsArr.push(item.specifications);
|
||||
});
|
||||
specificationsArr = [...new Set(specificationsArr)];
|
||||
let specifications = specificationsArr.join(",");
|
||||
useMsg("warning", `${specifications}序列码存在已使用, 请选择未使用序列码的数据 !`);
|
||||
return;
|
||||
}
|
||||
//单数转换
|
||||
if (isNumber.length) {
|
||||
isNumber.forEach((item: any) => {
|
||||
specificationsArr1.push(item.specifications);
|
||||
});
|
||||
specificationsArr = [...new Set(specificationsArr1)];
|
||||
let specifications1 = specificationsArr1.join(",");
|
||||
useMsg("warning", `${specifications1}条码个数为单数, 不支持转两件装 !`);
|
||||
return;
|
||||
}
|
||||
|
||||
let ids: number[] = [];
|
||||
props.selectionList.forEach((item: any) => {
|
||||
//只传一件装数量不为0的
|
||||
if (item.isTwo === 1 && item.number) {
|
||||
ids.push(item.id);
|
||||
}
|
||||
});
|
||||
const getTransferSn = (ids: any) => {
|
||||
ElMessageBox.confirm("确定数据转换为两件装, 一旦转换不可回退!", "温馨提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
@@ -98,6 +38,85 @@ const handleBtnClick = () => {
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// 提交事件
|
||||
const handleBtnClick = async () => {
|
||||
if (!props.selectionList.length) {
|
||||
useMsg("warning", `请选择需要转换的数据 !`);
|
||||
return;
|
||||
}
|
||||
if (props.selectionList.length > 50) {
|
||||
useMsg("warning", `请选择50条以内的数据进行转换 !`);
|
||||
return;
|
||||
}
|
||||
// let isSome = props.selectionList.filter((item: any) => {
|
||||
// return item.useNumber;
|
||||
// });
|
||||
// let isNumber = props.selectionList.filter((item: any) => {
|
||||
// return item.number % 2 === 1;
|
||||
// });
|
||||
// let specificationsArr: any = [];
|
||||
// let specificationsArr1: any = [];
|
||||
// //多种条件
|
||||
// if (isSome.length && isNumber.length) {
|
||||
// //单个
|
||||
// isSome.forEach((item: any) => {
|
||||
// specificationsArr.push(item.specifications);
|
||||
// });
|
||||
// specificationsArr = [...new Set(specificationsArr)];
|
||||
// let specifications = specificationsArr.join(",");
|
||||
|
||||
// //单数
|
||||
// isNumber.forEach((item: any) => {
|
||||
// specificationsArr1.push(item.specifications);
|
||||
// });
|
||||
// specificationsArr = [...new Set(specificationsArr1)];
|
||||
// let specifications1 = specificationsArr1.join(",");
|
||||
// // useMsg("warning", `${specifications1}条码个数为单数, 不支持转两件装 !`);
|
||||
// useMsg(
|
||||
// "warning",
|
||||
// `${specifications}序列码存在已使用, 请选择未使用序列码的数据; ${specifications1}条码个数为单数, 不支持转两件装 !`
|
||||
// );
|
||||
// return;
|
||||
// }
|
||||
// //单个使用
|
||||
// if (isSome.length) {
|
||||
// isSome.forEach((item: any) => {
|
||||
// specificationsArr.push(item.specifications);
|
||||
// });
|
||||
// specificationsArr = [...new Set(specificationsArr)];
|
||||
// let specifications = specificationsArr.join(",");
|
||||
// useMsg("warning", `${specifications}序列码存在已使用, 请选择未使用序列码的数据 !`);
|
||||
// return;
|
||||
// }
|
||||
// //单数转换
|
||||
// if (isNumber.length) {
|
||||
// isNumber.forEach((item: any) => {
|
||||
// specificationsArr1.push(item.specifications);
|
||||
// });
|
||||
// specificationsArr1 = [...new Set(specificationsArr1)];
|
||||
// let specifications1 = specificationsArr1.join(",");
|
||||
// useMsg("warning", `${specifications1}条码个数为单数, 不支持转两件装 !`);
|
||||
// // return;
|
||||
// }
|
||||
|
||||
let ids: any[] = [];
|
||||
props.selectionList.forEach((item: any) => {
|
||||
//只传一件装数量不为0的
|
||||
if (item.isTwo === 1 && item.number) {
|
||||
ids.push({
|
||||
id: item.id,
|
||||
specifications: item.specifications
|
||||
});
|
||||
}
|
||||
});
|
||||
const result: any = await getTransferSnJCApi({ ids: ids });
|
||||
if (result.status === 200) {
|
||||
getTransferSn(ids);
|
||||
} else {
|
||||
useMsg("error", result.message);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user