Commit f845245c by chenwq

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

修复选择商品时因ID字段不一致导致的禁用状态判断错误,将比较字段从upgradeGoodsId统一为goodsId。
添加表格加载完成事件setTableFinishFun,确保数据一致性。
修正表单引用名称从allocationForm改为allocationFormRef,并修复表单验证调用链。
优化取消分配时的过滤条件逻辑。
1 parent 15f8a3b0
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</el-form> </el-form>
</div> </div>
</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"> <div slot="auth-button" slot-scope="scope">
<el-button type="text" @click="allocation(scope.scope)" :disabled="setDisabled(scope.scope)">选择</el-button> <el-button type="text" @click="allocation(scope.scope)" :disabled="setDisabled(scope.scope)">选择</el-button>
</div> </div>
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</div> </div>
<div class="addRefundForm"> <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" @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>
<div style="margin-top: 40px;text-align: center;"> <div style="margin-top: 40px;text-align: center;">
<el-button class="btn" @click="handleAddClose"> <el-button class="btn" @click="handleAddClose">
...@@ -440,6 +440,11 @@ export default { ...@@ -440,6 +440,11 @@ export default {
resolve() resolve()
}) })
}, },
setTableFinishFun() {
this.$refs.allocationTable?.data.forEach(val => {
val.goodsId = val.upgradeGoodsId
})
},
handleSearch() { handleSearch() {
this.getListApi = this.$apis.stockManage.stockRemainPage this.getListApi = this.$apis.stockManage.stockRemainPage
this.$refs.allocationTable.refreshTable() this.$refs.allocationTable.refreshTable()
...@@ -528,7 +533,7 @@ export default { ...@@ -528,7 +533,7 @@ export default {
//设置禁选 //设置禁选
setDisabled(row) { 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) { if (index == -1) {
return false return false
} else { } else {
...@@ -582,8 +587,7 @@ export default { ...@@ -582,8 +587,7 @@ export default {
// 取消 // 取消
cancelAllocation(row, index) { cancelAllocation(row, index) {
console.log(row, index) this.chooseDataList = this.chooseDataList.filter(item => !(item.goodsId == row.goodsId && item.filmRollNo === row.filmRollNo))
this.chooseDataList = this.chooseDataList.filter(item => item.goodsId != row.upgradeGoodsId && item.filmRollNo !== row.filmRollNo)
}, },
/** 保存/作废/提交申请之前,表单校验等 /** 保存/作废/提交申请之前,表单校验等
...@@ -602,7 +606,9 @@ export default { ...@@ -602,7 +606,9 @@ export default {
}) })
return return
} }
const data = this.$refs.allocationForm.formData this.$refs.allocationFormRef.$refs.inveFormRefd2FormRuleForm.validate(valid2 => {
if (valid2) {
const data = this.$refs.allocationFormRef.formData
var params = {} var params = {}
params = { params = {
...params, ...params,
...@@ -616,6 +622,8 @@ export default { ...@@ -616,6 +622,8 @@ 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!