@@ -33,6 +37,18 @@
+
+
@@ -57,7 +73,7 @@
const maName = ref('') // ✅ 机具类型
const maModel = ref('') // 机具规格
- const maCode = ref('') // 机具编码
+ const maCode = ref([]) // 机具编码
const supplier = ref('') // 出厂厂家
const repairMan = ref('王鹏') // 检修员
const checkMan = ref('高民') // 检验员
@@ -66,17 +82,49 @@
const maNameList = ref([]) // 机具类型下拉列表
const maModelList = ref([]) // 机具规格下拉列表
const supplierList = ref([]) // 机具规格下拉列表
+ const prefix = ref()
+ const postfix = ref()
+ const fillNum = ref(1) // 填充数量
// 清空表单
const clearForm = () => {
maName.value = ''
maModel.value = ''
- maCode.value = ''
+ maCode.value = []
supplier.value = ''
repairMan.value = ''
checkMan.value = ''
phone.value = ''
}
+ // 填充编码
+ const handleFillCode = () => {
+ if (!prefix.value || !postfix.value) {
+ uni.showToast({
+ title: '请填写编码前缀和后缀',
+ icon: 'none'
+ })
+ return
+ }
+
+ const prefixValue = prefix.value.trim()
+ const postfixValue = postfix.value.trim()
+ const fillNumValue = fillNum.value
+ const codeList = []
+ const startNum = parseInt(postfixValue, 10)
+ const padLen = postfixValue.length
+ for (let i = 0; i < fillNumValue; i++) {
+ const num = String(startNum + i).padStart(padLen, '0')
+ codeList.push(`${prefixValue}${num}`)
+ }
+ maCode.value = codeList
+ console.log('🚀 ~ handleFillCode ~ maCode.value:', maCode.value)
+ }
+
+ const handleFillNumBlur = () => {
+ // 只能是正整数
+ fillNum.value = Math.ceil(String(fillNum.value).replace(/[^\d]/g, ''))
+ }
+
const onMaNameChange = (item) => {
maName.value = item.label;
maModel.value = null; // 清空规格值
@@ -159,7 +207,7 @@
icon: 'none'
})
}
- if (!maCode.value) {
+ if (maCode.value.length === 0) {
return uni.showToast({
title: '请输入机具编码',
icon: 'none'
@@ -193,7 +241,7 @@
const postData = {
maName: maName.value,
maModel: maModel.value,
- maCode: maCode.value,
+ maCodeList: maCode.value,
supplier: supplier.value,
repairMan: repairMan.value,
checkMan: checkMan.value,
@@ -210,18 +258,9 @@
})
clearForm()
uni.navigateBack()
- } else {
- uni.showToast({
- title: res.msg || '新增失败',
- icon: 'none'
- })
}
} catch (error) {
console.error(error)
- uni.showToast({
- title: '请求失败,请稍后重试',
- icon: 'none'
- })
}
}
onLoad(() => {
diff --git a/src/services/picking/outbound.js b/src/services/picking/outbound.js
index 297e627..222a947 100644
--- a/src/services/picking/outbound.js
+++ b/src/services/picking/outbound.js
@@ -100,3 +100,30 @@ export const leaseOutBackApi = (data) => {
data,
})
}
+
+// 数量编码查询
+export const getInfoByTypeId = (data) => {
+ return http({
+ method: 'GET',
+ url: '/material/ma_machine/getInfoByTypeId',
+ data,
+ })
+}
+
+// 数量编码出库
+export const leaseOutByInfoApi = (data) => {
+ return http({
+ method: 'POST',
+ url: '/material/lease_apply_info/leaseOutByInfo',
+ data,
+ })
+}
+
+// 标准箱详情
+export const getBoxDetailsAPI = (data) => {
+ return http({
+ method: 'GET',
+ url: '/material/bm_qrcode_box/getBoxDetails',
+ data,
+ })
+}
\ No newline at end of file