Commit 71bde735 by chenwq

fix(调拨): 修复表单验证和商户ID类型转换问题

- 在获取商户列表时,将merchantId转换为字符串类型,避免后续比较错误
- 编辑表单时,callOutMerchantId和callInMerchantId也转换为字符串类型
- 重构beforeConfirm方法,使用Promise.all同时验证两个表单,避免嵌套回调
1 parent f845245c
...@@ -456,6 +456,9 @@ export default { ...@@ -456,6 +456,9 @@ export default {
yqMerchantId: merchantId yqMerchantId: merchantId
}) })
.then(res => { .then(res => {
res.forEach((item, idx) => {
res[idx].merchantId = item.merchantId + ''
})
if (type == 'out') { if (type == 'out') {
this.callOutMerchantList = res || [] this.callOutMerchantList = res || []
//总店 //总店
...@@ -568,6 +571,8 @@ export default { ...@@ -568,6 +571,8 @@ export default {
this.editAllocationForm = res this.editAllocationForm = res
this.editAllocationForm.callOutYqMerchantId = this.editAllocationForm.callOutYqMerchantId + '' this.editAllocationForm.callOutYqMerchantId = this.editAllocationForm.callOutYqMerchantId + ''
this.editAllocationForm.callInYqMerchantId = this.editAllocationForm.callInYqMerchantId + '' this.editAllocationForm.callInYqMerchantId = this.editAllocationForm.callInYqMerchantId + ''
this.editAllocationForm.callOutMerchantId = this.editAllocationForm.callOutMerchantId + ''
this.editAllocationForm.callInMerchantId = this.editAllocationForm.callInMerchantId + ''
this.chooseDataList = res.stockAllocateDetailList this.chooseDataList = res.stockAllocateDetailList
// this.getListApi = this.$apis.stockManage.stockRemainPage // this.getListApi = this.$apis.stockManage.stockRemainPage
this.$refs.allocationTable.refreshTable() this.$refs.allocationTable.refreshTable()
...@@ -597,8 +602,18 @@ export default { ...@@ -597,8 +602,18 @@ export default {
* 作废按钮(invalid) - 5:作废 * 作废按钮(invalid) - 5:作废
**/ **/
beforeConfirm(btnType = 'save') { beforeConfirm(btnType = 'save') {
const p1 = new Promise((resolve) => {
this.$refs.editAllocationFormRef.validate(valid => { this.$refs.editAllocationFormRef.validate(valid => {
if (valid) { resolve(valid)
})
})
const p2 = new Promise((resolve) => {
this.$refs.allocationFormRef.$refs.inveFormRefd2FormRuleForm.validate(valid => {
resolve(valid)
})
})
Promise.all([p1, p2]).then(([valid1, valid2]) => {
if (valid1 && valid2) {
if (this.chooseDataList.length == 0) { if (this.chooseDataList.length == 0) {
this.$notify({ this.$notify({
type: 'warning', type: 'warning',
...@@ -606,8 +621,6 @@ export default { ...@@ -606,8 +621,6 @@ export default {
}) })
return return
} }
this.$refs.allocationFormRef.$refs.inveFormRefd2FormRuleForm.validate(valid2 => {
if (valid2) {
const data = this.$refs.allocationFormRef.formData const data = this.$refs.allocationFormRef.formData
var params = {} var params = {}
params = { params = {
...@@ -622,8 +635,6 @@ export default { ...@@ -622,8 +635,6 @@ export default {
this.handleConfirm(params, btnType) this.handleConfirm(params, btnType)
} }
}) })
}
})
}, },
saveApi(params, btnType = 'save') { saveApi(params, btnType = 'save') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!