|
|
@@ -193,7 +193,6 @@ const emit = defineEmits([ |
|
|
|
"refreshDataList" |
|
|
|
]) |
|
|
|
const handleChange = (value) => { |
|
|
|
console.log(value) |
|
|
|
} |
|
|
|
|
|
|
|
const uploadUrl = "/minIo/upload" |
|
|
@@ -292,7 +291,7 @@ const rules = reactive({ |
|
|
|
brand: [{required: true, message: "请选择设备厂商", trigger: "blur"}], |
|
|
|
}) |
|
|
|
const props2 = { |
|
|
|
value: "id", |
|
|
|
value: "code", |
|
|
|
label: "name", |
|
|
|
children: "subordinateModel", |
|
|
|
// multiple: true, |
|
|
@@ -314,7 +313,6 @@ function changeDeviceType() { |
|
|
|
|
|
|
|
// 初始化 |
|
|
|
function init(row: any) { |
|
|
|
console.log("测试:",row) |
|
|
|
getLowerList(); |
|
|
|
// getAgency(); |
|
|
|
clearData(); |
|
|
@@ -353,7 +351,6 @@ function getInfo(id: string) { |
|
|
|
if (res && res.code === 0) { |
|
|
|
let bizContent = res.data |
|
|
|
let data = bizContent.enterApply || {}; |
|
|
|
console.log("===data", data); |
|
|
|
let detailList = bizContent.applyDetailsList || []; |
|
|
|
let list: any = []; |
|
|
|
detailList.map((item) => { |
|
|
@@ -389,7 +386,7 @@ function onSuccess(response: any) { |
|
|
|
BaseService.postN('/invw/api/enterApply/parseExcel', {excelUrl: response.data.ossFilePath}).then((res: any) => { |
|
|
|
if (res && res.code === 0) { |
|
|
|
let bizContent = res.data; |
|
|
|
console.log(bizContent) |
|
|
|
// console.log(bizContent) |
|
|
|
let info = bizContent.modelList || ""; |
|
|
|
let data = bizContent.modelList |
|
|
|
let newarr: any = [] |
|
|
@@ -405,14 +402,25 @@ function onSuccess(response: any) { |
|
|
|
); |
|
|
|
}) |
|
|
|
addForm.value.detailList = newarr; |
|
|
|
ElMessage.success(info) |
|
|
|
|
|
|
|
//进行排序 |
|
|
|
startIdSort(); |
|
|
|
ElMessage.success(res.message) |
|
|
|
} else { |
|
|
|
ElMessage.error(res.message) |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
//号段排序,空格排到最后 |
|
|
|
function startIdSort() { |
|
|
|
addForm.value.detailList = addForm.value.detailList.sort((a, b) => { |
|
|
|
const isAEmpty = a.startId === "" || a.startId === undefined || a.startId === null; |
|
|
|
const isBEmpty = b.startId === "" || b.startId === undefined || b.startId === null; |
|
|
|
if (isAEmpty && !isBEmpty) return 1; // a是空,b不是,a排在后面 |
|
|
|
if (!isAEmpty && isBEmpty) return -1; // a不是空,b是空,a排在前面 |
|
|
|
return a.startId - b.startId; // 正常比较startId |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 初始化还原数据 |
|
|
@@ -521,9 +529,12 @@ function addMoreHandle(row: IObject) { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 校验结束编号 |
|
|
|
//编号规则。设备类型是卡的话,位数是20位 设备类型是OBU的话,位数的16位 |
|
|
|
function validateEndId(rule: any, value: string, callback: (e?: Error) => any) { |
|
|
|
// 校验起始编号 |
|
|
|
function validateStartId( |
|
|
|
rule: any, |
|
|
|
value: string, |
|
|
|
callback: (e?: Error) => any |
|
|
|
) { |
|
|
|
let inventoryType = addForm.value.inventoryType; |
|
|
|
let indexArr = rule.field.split("-"); |
|
|
|
let index = indexArr[1]; |
|
|
@@ -532,40 +543,35 @@ function validateEndId(rule: any, value: string, callback: (e?: Error) => any) { |
|
|
|
return callback(new Error("必须是数字!")); |
|
|
|
} |
|
|
|
let length = val.length; |
|
|
|
//长度校验 |
|
|
|
if (inventoryType === "CARD" && length !== 20) { |
|
|
|
return callback(new Error("卡编号位数是20!")); |
|
|
|
} else if (inventoryType === "OBU" && length !== 16) { |
|
|
|
return callback(new Error("OBU编号位数是16!")); |
|
|
|
} |
|
|
|
|
|
|
|
//进行排序 |
|
|
|
startIdSort(); |
|
|
|
// 开始编号不能大于结束编号校验 |
|
|
|
if ( |
|
|
|
val && |
|
|
|
addForm.value.detailList[index].startId && |
|
|
|
val < addForm.value.detailList[index].startId |
|
|
|
addForm.value.detailList[index].endId && |
|
|
|
BigInt(val) > BigInt(addForm.value.detailList[index].endId) |
|
|
|
) { |
|
|
|
return callback(new Error("结束编号不能小于开始编号")); |
|
|
|
return callback(new Error("开始编号不能大于结束编号")); |
|
|
|
} |
|
|
|
if ( |
|
|
|
val && addForm.value.detailList.length < index && |
|
|
|
addForm.value.detailList[index + 1].startId && |
|
|
|
val >= addForm.value.detailList[index + 1].startId |
|
|
|
val && index>0 && |
|
|
|
addForm.value.detailList[index-1].endId && |
|
|
|
BigInt(val) <= BigInt(addForm.value.detailList[index-1].endId) |
|
|
|
) { |
|
|
|
return callback(new Error("结束编号要小于下一段的开始编号")); |
|
|
|
} |
|
|
|
// 列表中不能重复校验 |
|
|
|
let endIds = addForm.value.detailList.filter((item) => item.endId === val); |
|
|
|
if (endIds.length > 1) { |
|
|
|
callback(new Error("请检查,结束编号有重复")); |
|
|
|
return callback(new Error("开始编号要大于上一段的结束编号")); |
|
|
|
} |
|
|
|
callback(); |
|
|
|
} |
|
|
|
|
|
|
|
// 校验开始编号 |
|
|
|
function validateStartId( |
|
|
|
rule: any, |
|
|
|
value: string, |
|
|
|
callback: (e?: Error) => any |
|
|
|
) { |
|
|
|
// 校验结束编号 |
|
|
|
//编号规则。设备类型是卡的话,位数是20位 设备类型是OBU的话,位数的16位 |
|
|
|
function validateEndId(rule: any, value: string, callback: (e?: Error) => any) { |
|
|
|
let inventoryType = addForm.value.inventoryType; |
|
|
|
let indexArr = rule.field.split("-"); |
|
|
|
let index = indexArr[1]; |
|
|
@@ -574,31 +580,18 @@ function validateStartId( |
|
|
|
return callback(new Error("必须是数字!")); |
|
|
|
} |
|
|
|
let length = val.length; |
|
|
|
//长度校验 |
|
|
|
if (inventoryType === "CARD" && length !== 20) { |
|
|
|
return callback(new Error("卡编号位数是20!")); |
|
|
|
} else if (inventoryType === "OBU" && length !== 16) { |
|
|
|
return callback(new Error("OBU编号位数是16!")); |
|
|
|
} |
|
|
|
// 开始编号不能大于结束编号校验 |
|
|
|
|
|
|
|
if ( |
|
|
|
val && |
|
|
|
addForm.value.detailList[index].endId && |
|
|
|
val > addForm.value.detailList[index].endId |
|
|
|
) { |
|
|
|
return callback(new Error("开始编号不能大于结束编号")); |
|
|
|
} |
|
|
|
if ( |
|
|
|
val && index > 0 && |
|
|
|
addForm.value.detailList[index - 1].endId && |
|
|
|
val <= addForm.value.detailList[index - 1].endId |
|
|
|
addForm.value.detailList[index].startId && |
|
|
|
BigInt(val) < (addForm.value.detailList[index].startId) |
|
|
|
) { |
|
|
|
return callback(new Error("开始编号要大于上一段的结束编号")); |
|
|
|
} |
|
|
|
// 列表中不能重复校验 |
|
|
|
let startIds = addForm.value.detailList.filter((item) => item.startId === val); |
|
|
|
if (startIds.length > 1) { |
|
|
|
callback(new Error("请检查,起始编号有重复")); |
|
|
|
return callback(new Error("结束编号不能小于开始编号")); |
|
|
|
} |
|
|
|
callback(); |
|
|
|
} |
|
|
@@ -674,7 +667,6 @@ function saveHandle() { |
|
|
|
} |
|
|
|
list.push(tem); |
|
|
|
}) |
|
|
|
console.log(params); |
|
|
|
|
|
|
|
let params2 = {} |
|
|
|
params2.enterApplyDetailModels = list; |
|
|
@@ -682,13 +674,12 @@ function saveHandle() { |
|
|
|
params2.inventoryType = params.inventoryType; |
|
|
|
params2.ownType = params.ownType; |
|
|
|
params2.storeCode = params.storeCode; |
|
|
|
params2.agencyId = interfaceLowerListArr.value.find(item => item.id === params.storeCode).agencyId; |
|
|
|
params2.agencyId = interfaceLowerListArr.value.find(item => item.code === params.storeCode).agencyId; |
|
|
|
params2.version = params.version; |
|
|
|
params2.cardType = params.cardType; |
|
|
|
params2.obuType = params.obuType; |
|
|
|
// let api = '/invw/inventory/addinventoryapply'; |
|
|
|
let api = '/invw/api/enterApply/apply'; |
|
|
|
console.log("typeOption.value", typeOption.value) |
|
|
|
if (typeOption.value === 'add') { |
|
|
|
delete params2.id |
|
|
|
} |
|
|
@@ -828,7 +819,6 @@ function getSummaries(param) { |
|
|
|
|
|
|
|
// 获取仓库状态 |
|
|
|
function getLowerList() { |
|
|
|
// console.log("获取仓库列表") |
|
|
|
let params = { |
|
|
|
allType: 0 |
|
|
|
} |
|
|
@@ -847,7 +837,6 @@ function getLowerList() { |
|
|
|
|
|
|
|
// 获取仓库状态 |
|
|
|
function getAgency() { |
|
|
|
// console.log("获取产权列表") |
|
|
|
BaseService.postN('/invw/agency/list').then((res: any) => { |
|
|
|
if (res && res.code === 0) { |
|
|
|
let bizContent = res.data |