Commit f845245c by chenwq

fix(allocation): 修复库存分配选择与表单验证逻辑

修复选择商品时因ID字段不一致导致的禁用状态判断错误,将比较字段从upgradeGoodsId统一为goodsId。
添加表格加载完成事件setTableFinishFun,确保数据一致性。
修正表单引用名称从allocationForm改为allocationFormRef,并修复表单验证调用链。
优化取消分配时的过滤条件逻辑。
1 parent 15f8a3b0
......@@ -39,7 +39,7 @@
</el-form>
</div>
</div>
<GLTable ref="allocationTable" :getListApi="getListApi" :pageConf="pageConf" :searchForm="searchFormSearch" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn">
<GLTable ref="allocationTable" :getListApi="getListApi" :pageConf="pageConf" :searchForm="searchFormSearch" :tableParams="tableParams" :beforeSearchFn="beforeSearchFn" @setTableFinishFun="setTableFinishFun">
<div slot="auth-button" slot-scope="scope">
<el-button type="text" @click="allocation(scope.scope)" :disabled="setDisabled(scope.scope)">选择</el-button>
</div>
......@@ -55,7 +55,7 @@
</div>
<div class="addRefundForm">
<!-- <glsx-form ref="allocationForm" :rules="allocationFormRules" :origin-data="editData" :form-list="editForm" form-ref="inveFormRef" @handleAddConfirm="handleAddConfirm" @handleClose="handleAddClose"></glsx-form> -->
<glsx-form ref="allocationForm" :rules="allocationFormRules" :origin-data="editData" :form-list="editForm" form-ref="inveFormRef" :isShowBtn="false"></glsx-form>
<glsx-form ref="allocationFormRef" :rules="allocationFormRules" :origin-data="editData" :form-list="editForm" form-ref="inveFormRef" :isShowBtn="false"></glsx-form>
</div>
<div style="margin-top: 40px;text-align: center;">
<el-button class="btn" @click="handleAddClose">
......@@ -440,6 +440,11 @@ export default {
resolve()
})
},
setTableFinishFun() {
this.$refs.allocationTable?.data.forEach(val => {
val.goodsId = val.upgradeGoodsId
})
},
handleSearch() {
this.getListApi = this.$apis.stockManage.stockRemainPage
this.$refs.allocationTable.refreshTable()
......@@ -528,7 +533,7 @@ export default {
//设置禁选
setDisabled(row) {
const index = this.chooseDataList.findIndex(item => item.goodsId == row.upgradeGoodsId && item.filmRollNo === row.filmRollNo)
const index = this.chooseDataList.findIndex(item => item.goodsId == row.goodsId && item.filmRollNo === row.filmRollNo)
if (index == -1) {
return false
} else {
......@@ -582,8 +587,7 @@ export default {
// 取消
cancelAllocation(row, index) {
console.log(row, index)
this.chooseDataList = this.chooseDataList.filter(item => item.goodsId != row.upgradeGoodsId && item.filmRollNo !== row.filmRollNo)
this.chooseDataList = this.chooseDataList.filter(item => !(item.goodsId == row.goodsId && item.filmRollNo === row.filmRollNo))
},
/** 保存/作废/提交申请之前,表单校验等
......@@ -602,18 +606,22 @@ export default {
})
return
}
const data = this.$refs.allocationForm.formData
var params = {}
params = {
...params,
...data,
...this.editAllocationForm
}
params.stockCheckDetailList = this.chooseDataList
params.remark = data.remark || ''
console.log(params, 'params')
// 调不同按钮的方法
this.handleConfirm(params, btnType)
this.$refs.allocationFormRef.$refs.inveFormRefd2FormRuleForm.validate(valid2 => {
if (valid2) {
const data = this.$refs.allocationFormRef.formData
var params = {}
params = {
...params,
...data,
...this.editAllocationForm
}
params.stockCheckDetailList = this.chooseDataList
params.remark = data.remark || ''
console.log(params, 'params')
// 调不同按钮的方法
this.handleConfirm(params, btnType)
}
})
}
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!