add:出库增加按单据选择

This commit is contained in:
zhangzq
2025-07-15 14:57:45 +08:00
parent 0ff0f0cd42
commit f49b9213d3
2 changed files with 60 additions and 136 deletions

View File

@@ -116,7 +116,17 @@
type="primary"
icon="el-icon-plus"
size="mini"
@click="queryDtl()"
@click="addFormDtl()"
>
添加单据
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="addMaterDtl()"
>
添加物料
</el-button>
@@ -169,6 +179,7 @@
<AddDtl :dialog-show.sync="dtlShow" :stor-id="storId" @tableChanged="tableChanged" />
<MaterDialog :dialog-show.sync="materShow" :mater-opt-code.sync="materType" @setMaterValue="setMaterValue" />
<FormDialog :dialog-show.sync="formShow" @setFormValue="setFormValue" />
</el-dialog>
</template>
@@ -176,6 +187,7 @@
import CRUD, { crud, form } from '@crud/crud'
import AddDtl from '@/views/wms/st/outbill/AddDtl'
import MaterDialog from '@/views/wms/pub/MaterDialog'
import FormDialog from '@/views/wms/pm_manage/form_data/FormDialog'
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
import crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
@@ -196,7 +208,7 @@ const defaultForm = {
}
export default {
name: 'AddDialog',
components: { AddDtl, MaterDialog },
components: { AddDtl, MaterDialog, FormDialog },
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
@@ -211,6 +223,7 @@ export default {
dtlShow: false,
materType: '',
materShow: false,
formShow: false,
flagnow: false,
nowrow: {},
nowindex: '',
@@ -302,13 +315,8 @@ export default {
this.materShow = true
this.nowindex = index
this.nowrow = row
/* checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type }).then(res => {
this.materType = res.materType
this.nowindex = index
this.nowrow = row
})*/
},
queryDtl(index, row) {
addMaterDtl(index, row) {
if (this.form.bill_type === '') {
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
return
@@ -320,6 +328,18 @@ export default {
this.storId = this.form.stor_id
this.dtlShow = true
},
addFormDtl(index, row) {
if (this.form.bill_type === '') {
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.form.stor_id === '') {
this.crud.notify('请选择仓库!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.storId = this.form.stor_id
this.formShow = true
},
tableChanged(rows) {
rows.forEach((item) => {
// 添加plan_qty
@@ -360,6 +380,21 @@ export default {
this.nowrow.edit = false
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
setFormValue(data) {
this.nowrow.material_id = data.material_id
this.nowrow.material_code = data.material_code
this.nowrow.material_name = data.material_name
this.nowrow.qty_unit_id = data.unit_id
this.nowrow.qty_unit_name = data.unit_name
this.nowrow.pcsn = data.pcsn
this.nowrow.plan_qty = data.qty
this.nowrow.qty = data.qty
this.nowrow.source_bill_code = data.code
this.nowrow.source_bill_id = data.id
this.nowrow.source_bill_type = data.form_type
this.nowrow.edit = false
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
deleteRow(index, rows) {
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
rows.splice(index, 1)