This commit is contained in:
aihe 2024-06-13 00:26:31 +08:00
parent c5f3c11343
commit 46df49c082
3 changed files with 36 additions and 15 deletions

View File

@ -4,7 +4,7 @@ const checkParams = (param, validConfig)=> {
let errMsg = ''
Object.keys(validConfig).map(key=> {
const itemConf = validConfig[key]
if(!errMsg && itemConf.required && !param[key]) {
if(!errMsg && itemConf.required && (!param[key] || param[key]?.length == 0)) {
errMsg = itemConf.requiredMsg || `${itemConf.label}不能为空`
}
let customerValidMsg = itemConf?.validMsgFun?.({ val: param })

View File

@ -52,6 +52,7 @@
import { debounce } from "@/common/util"
import * as apiService from "@/common/api"
import BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp"
import { checkParams } from "@/common/validate"
export default {
components:{ BpeGoodphotoTmp },
@ -69,7 +70,14 @@
problemType: '', // 问题类型
problemCause: "", // 问题件原因
sendSiteCode: "", // 通知网点代码
filePath: "", // 图片路径
filePath: [], // 图片路径
},
submitValidConfig: {
billCode: { required: true, requiredMsg: '运单号不能为空' },
problemType: { required: true, requiredMsg: '问题类型不能为空' },
problemCause: { required: true, requiredMsg: '问题描述不能为空' },
sendSiteCode: { required: true, requiredMsg: '网点不能为空' },
filePath: { required: true, requiredMsg: '图片不能为空' },
},
}
},
@ -100,9 +108,10 @@
]
},
async handleSubmit() {
let params = JSON.parse(JSON.stringify(this.submitParam));
params.filePath = params.filePath?.join?.(",") || ''
await apiService.registerProblemInfo({ ...params, _loading: true })
await checkParams(this.submitParam, this.submitValidConfig)
let extParams = {}
extParams.filePath = this.submitParam.filePath?.join?.(",") || ''
await apiService.registerProblemInfo({ ...this.submitParam, ...extParams, _loading: true })
this.showToast('操作成功')
this.resetForm()
// this.goBack()
@ -110,7 +119,7 @@
resetForm() {
this.submitParam.billCode = ''
this.submitParam.sendSiteCode = ''
this.submitParam.filePath = ''
this.submitParam.filePath = []
},
}
}

View File

@ -10,6 +10,10 @@
iconPos="left"></tpx-scan-input>
</view>
</u-row>
<view class="mt-20">
<tpx-select v-model:value="submitParam.keepType" :list="dicData.emis_keep_warehouse" mode="drop" placeholder="请选择留仓类型"
></tpx-select>
</view>
<view class="mt-20">
<bpe-goodphoto-tmp title="留仓拍照" :value="submitParam" filedName="picUrl"></bpe-goodphoto-tmp>
</view>
@ -36,25 +40,31 @@
import * as apiService from "@/common/api"
import BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp"
import { scanTypeEnum, getScanParams, ansScanResponse } from "@/common/scanUtil"
import { checkParams } from "@/common/validate"
import {
goto
} from "@/common/untool"
export default {
components:{ BpeGoodphotoTmp },
props: {
},
computed: {
dicData() {
return this.$store.getters.dicData
},
},
data() {
return {
submitParam: {
billCode: '',
picUrl: '',
remark: ''
keepType: '',
picUrl: [],
remark: '',
},
submitValidConfig: {
billCode: { required: true, requiredMsg: '运单号不能为空' },
keepType: { required: true, requiredMsg: '留仓类型不能为空' },
// picUrl: { required: true, requiredMsg: '图片不能为空' },
// remark: { required: true, requiredMsg: '备注不能为空' },
},
}
},
onShareAppMessage() {
@ -73,8 +83,10 @@
},
async handleSubmit() {
this.submitParam.picUrl = this.submitParam.picUrl?.join?.(",") || ''
let scnParam = getScanParams(scanTypeEnum.liuCang, { ...this.submitParam })
await checkParams(this.submitParam, this.submitValidConfig)
let extParams = {}
extParams.picUrl = this.submitParam.picUrl?.join?.(",") || ''
let scnParam = getScanParams(scanTypeEnum.liuCang, { ...this.submitParam, ...extParams })
let res = await apiService.scanRecord({...scnParam, _loading: true})
let { bl, resItem } = ansScanResponse({ res, title: "留仓" })
if(bl) {