|
|
|
<template>
|
|
|
|
<el-dialog
|
|
|
|
title="出库单编辑"
|
|
|
|
append-to-body
|
|
|
|
fullscreen
|
|
|
|
:before-close="crud.cancelCU"
|
|
|
|
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
|
|
|
@open="open"
|
|
|
|
@close="close"
|
|
|
|
>
|
|
|
|
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
|
|
|
<el-col :span="20" style="border: 1px solid white">
|
|
|
|
<span />
|
|
|
|
</el-col>
|
|
|
|
<el-col :span="4">
|
|
|
|
<span>
|
|
|
|
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
|
|
|
|
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
|
|
|
</span>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
|
|
|
|
<el-input v-show="false" v-model="form.stor_code" placeholder="仓库编码" />
|
|
|
|
<el-input v-show="false" v-model="form.stor_name" placeholder="仓库名称" />
|
|
|
|
<el-form-item label="单据号" prop="bill_code">
|
|
|
|
<label slot="label">单 据 号:</label>
|
|
|
|
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="仓库" prop="stor_id">
|
|
|
|
<label slot="label">仓 库:</label>
|
|
|
|
<el-select
|
|
|
|
v-model="form.stor_id"
|
|
|
|
clearable
|
|
|
|
placeholder="仓库"
|
|
|
|
class="filter-item"
|
|
|
|
style="width: 210px"
|
|
|
|
:disabled="crud.status.view > 0"
|
|
|
|
@change="storChange"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="item in storlist"
|
|
|
|
:key="item.stor_id"
|
|
|
|
:label="item.stor_name"
|
|
|
|
:value="item.stor_id"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="业务类型" prop="bill_type">
|
|
|
|
<el-select
|
|
|
|
v-model="form.bill_type"
|
|
|
|
clearable
|
|
|
|
filterable
|
|
|
|
size="mini"
|
|
|
|
placeholder="业务类型"
|
|
|
|
class="filter-item"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="item in dict.ST_INV_OUT_TYPE"
|
|
|
|
:key="item.value"
|
|
|
|
:disabled="item.value === '1099'"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="单据状态" prop="bill_status">
|
|
|
|
<el-select
|
|
|
|
v-model="form.bill_status"
|
|
|
|
clearable
|
|
|
|
style="width: 210px"
|
|
|
|
placeholder="单据状态"
|
|
|
|
class="filter-item"
|
|
|
|
disabled
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="item in dict.io_bill_status"
|
|
|
|
:key="item.id"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="明细数" prop="detail_count">
|
|
|
|
<label slot="label">明 细 数:</label>
|
|
|
|
<el-input v-model="form.detail_count" size="mini" disabled style="width: 210px" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="总重量" prop="total_qty">
|
|
|
|
<label slot="label">总 重 量:</label>
|
|
|
|
<el-input-number
|
|
|
|
v-model="form.total_qty"
|
|
|
|
:controls="false"
|
|
|
|
:precision="3"
|
|
|
|
:min="0"
|
|
|
|
disabled
|
|
|
|
style="width: 210px"
|
|
|
|
/>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="业务日期" prop="biz_date">
|
|
|
|
<el-date-picker v-model="form.biz_date" type="date" placeholder="选择日期" style="width: 210px" value-format="yyyy-MM-dd" :disabled="crud.status.view > 0" />
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item v-if="form.bill_type === '1004'" label="移入仓库" prop="out_stor_id" required="true">
|
|
|
|
<label slot="label">移入仓库:</label>
|
|
|
|
<el-select
|
|
|
|
v-model="form.out_stor_id"
|
|
|
|
clearable
|
|
|
|
placeholder="仓库"
|
|
|
|
class="filter-item"
|
|
|
|
style="width: 210px"
|
|
|
|
:disabled="crud.status.view > 0"
|
|
|
|
@change="storChange"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="item in inStorList"
|
|
|
|
:key="item.stor_id"
|
|
|
|
:label="item.stor_name"
|
|
|
|
:value="item.stor_id"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
<label slot="label">备 注:</label>
|
|
|
|
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
|
|
|
|
<div class="crud-opts2">
|
|
|
|
<span class="role-span">出库明细</span>
|
|
|
|
<span v-if="crud.status.cu > 0" class="crud-opts-right2">
|
|
|
|
|
|
|
|
<!--左侧插槽-->
|
|
|
|
<slot name="left" />
|
|
|
|
<el-button
|
|
|
|
slot="left"
|
|
|
|
class="filter-item"
|
|
|
|
type="primary"
|
|
|
|
icon="el-icon-plus"
|
|
|
|
size="mini"
|
|
|
|
@click="queryDtl()"
|
|
|
|
>
|
|
|
|
添加物料
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
|
|
|
slot="left"
|
|
|
|
class="filter-item"
|
|
|
|
type="primary"
|
|
|
|
icon="el-icon-plus"
|
|
|
|
size="mini"
|
|
|
|
@click="insertdtl()"
|
|
|
|
>
|
|
|
|
新增一行
|
|
|
|
</el-button>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<!--表格渲染-->
|
|
|
|
<el-table
|
|
|
|
ref="table"
|
|
|
|
:data="form.tableData"
|
|
|
|
style="width: 100%;"
|
|
|
|
border
|
|
|
|
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
|
|
|
>
|
|
|
|
<el-table-column type="index" label="序号" width="50" align="center" />
|
|
|
|
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" width="190" align="center">
|
|
|
|
<template scope="scope">
|
|
|
|
<el-input v-show="!scope.row.edit" v-model="scope.row.material_code" disabled class="input-with-select">
|
|
|
|
<el-button slot="append" icon="el-icon-search" @click="queryMater(scope.$index, scope.row)" />
|
|
|
|
</el-input>
|
|
|
|
<span v-show="scope.row.edit">{{ scope.row.material_code }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="material_name" label="物料名称" align="center" min-width="150px" show-overflow-tooltip />
|
|
|
|
<el-table-column prop="box_no" label="箱号" align="center" min-width="250px" show-overflow-tooltip />
|
|
|
|
<el-table-column show-overflow-tooltip prop="pcsn" label="子卷号" width="150px" align="center">
|
|
|
|
<template scope="scope">
|
|
|
|
<el-input v-show="!scope.row.edit" v-model="scope.row.pcsn" size="mini" />
|
|
|
|
<span v-show="scope.row.edit">{{ scope.row.pcsn }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column show-overflow-tooltip prop="sap_pcsn" label="sap批次号" width="140px" align="center" />
|
|
|
|
<el-table-column prop="plan_qty" label="出库重量" width="150" align="center">
|
|
|
|
<template scope="scope">
|
|
|
|
<el-input-number v-show="!scope.row.edit" v-model="scope.row.plan_qty" :precision="3" :controls="false" :min="1" style="width: 120px" />
|
|
|
|
<span v-show="scope.row.edit">{{ scope.row.plan_qty }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="qty_unit_name" label="单位" align="center" />
|
|
|
|
<!-- <el-table-column prop="quality_scode" label="品质类型" align="center" width="110px">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-select
|
|
|
|
v-model="scope.row.quality_scode"
|
|
|
|
class="filter-item"
|
|
|
|
:disabled="scope.row.edit"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="item in dict.ST_QUALITY_SCODE"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="ivt_level" label="库存等级" align="center" width="100px">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-select
|
|
|
|
v-model="scope.row.ivt_level"
|
|
|
|
class="filter-item"
|
|
|
|
:disabled="scope.row.edit"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="item in dict.ST_IVT_LEVEL"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column prop="is_active" label="是否可用" align="center" width="110px">
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-select
|
|
|
|
v-model="scope.row.is_active"
|
|
|
|
class="filter-item"
|
|
|
|
:disabled="scope.row.edit"
|
|
|
|
>
|
|
|
|
<el-option
|
|
|
|
v-for="item in dict.is_used"
|
|
|
|
:key="item.value"
|
|
|
|
:label="item.label"
|
|
|
|
:value="item.value"
|
|
|
|
/>
|
|
|
|
</el-select>
|
|
|
|
</template>
|
|
|
|
</el-table-column>-->
|
|
|
|
|
|
|
|
<!-- <el-table-column prop="source_bill_type" label="源单类型" align="center" width="130px" :formatter="invtypeFormat" show-overflow-tooltip />-->
|
|
|
|
<el-table-column prop="source_bill_code" label="源单号" align="center" width="130px" show-overflow-tooltip />
|
|
|
|
<el-table-column show-overflow-tooltip prop="remark" label="明细备注" align="center">
|
|
|
|
<template scope="scope">
|
|
|
|
<el-input v-model="scope.row.remark" size="mini" />
|
|
|
|
<span>{{ scope.row.remark }}</span>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="120" fixed="right">
|
|
|
|
<template scope="scope">
|
|
|
|
<el-button type="danger" class="filter-item" size="mini" icon="el-icon-delete" @click.native.prevent="deleteRow(scope.$index, form.tableData)" />
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<AddDtl :dialog-show.sync="dtlShow" :stor-id="storId" @tableChanged="tableChanged5" />
|
|
|
|
<MaterDialog :dialog-show.sync="materShow" :mater-opt-code.sync="materType" @setMaterValue="setMaterValue" />
|
|
|
|
</el-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import CRUD, { crud, form } from '@crud/crud'
|
|
|
|
import AddDtl from '@/views/wms/st/outbill/AddDtl'
|
|
|
|
import MaterDialog from '@/views/wms/pub/MaterDialog'
|
|
|
|
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
|
|
|
|
import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
|
|
|
|
import crudRawAssist from '@/views/wms/st/inbill/rawassist'
|
|
|
|
import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
|
|
|
|
|
|
|
|
const defaultForm = {
|
|
|
|
bill_code: '',
|
|
|
|
stor_id: '',
|
|
|
|
stor_code: '',
|
|
|
|
stor_name: '',
|
|
|
|
bill_status: '10',
|
|
|
|
total_qty: '0',
|
|
|
|
detail_count: '0',
|
|
|
|
bill_type: '',
|
|
|
|
remark: '',
|
|
|
|
biz_date: new Date(),
|
|
|
|
out_stor_id: '',
|
|
|
|
create_mode: '',
|
|
|
|
tableData: []
|
|
|
|
}
|
|
|
|
export default {
|
|
|
|
name: 'AddDialog',
|
|
|
|
components: { AddDtl, MaterDialog },
|
|
|
|
mixins: [crud(), form(defaultForm)],
|
|
|
|
props: {
|
|
|
|
dialogShow: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'ST_INV_OUT_TYPE'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogVisible: false,
|
|
|
|
dtlShow: false,
|
|
|
|
materType: '',
|
|
|
|
materShow: false,
|
|
|
|
flagnow: false,
|
|
|
|
nowrow: {},
|
|
|
|
nowindex: '',
|
|
|
|
storlist: [],
|
|
|
|
inStorList: [],
|
|
|
|
invtypelist: [],
|
|
|
|
storId: null,
|
|
|
|
rules: {
|
|
|
|
stor_id: [
|
|
|
|
{ required: true, message: '仓库不能为空', trigger: 'blur' }
|
|
|
|
],
|
|
|
|
bill_type: [
|
|
|
|
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
|
|
|
|
],
|
|
|
|
biz_date: [
|
|
|
|
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
dialogShow: {
|
|
|
|
handler(newValue) {
|
|
|
|
this.dialogVisible = newValue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
open() {
|
|
|
|
crudUserStor.getUserStor().then(res => {
|
|
|
|
this.storlist = res
|
|
|
|
})
|
|
|
|
crudUserStor.queryStor({}).then(res => {
|
|
|
|
this.inStorList = res
|
|
|
|
})
|
|
|
|
},
|
|
|
|
close() {
|
|
|
|
this.$emit('AddChanged')
|
|
|
|
},
|
|
|
|
[CRUD.HOOK.beforeSubmit]() {
|
|
|
|
if (this.form.tableData.length === 0) {
|
|
|
|
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (this.form.bill_type !== '1004') {
|
|
|
|
this.form.out_stor_id = ''
|
|
|
|
}
|
|
|
|
if (this.form.bill_type === '1004') {
|
|
|
|
if (!this.form.out_stor_id) {
|
|
|
|
this.crud.notify('移入仓库不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
/* if (this.form.out_stor_id === this.form.stor_id) {
|
|
|
|
this.crud.notify('移出仓库和移入仓库不能一致!', CRUD.NOTIFICATION_TYPE.INFO)
|
|
|
|
return false
|
|
|
|
}*/
|
|
|
|
}
|
|
|
|
},
|
|
|
|
[CRUD.HOOK.afterToEdit]() {
|
|
|
|
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
|
|
|
|
this.form.tableData = res
|
|
|
|
// 将明细变成不可编辑
|
|
|
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
|
|
|
const row = this.form.tableData[i]
|
|
|
|
row.edit = false
|
|
|
|
this.form.tableData.splice(i, 1, row)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
[CRUD.HOOK.afterToView]() {
|
|
|
|
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
|
|
|
|
this.form.tableData = res
|
|
|
|
// 将明细变成不可编辑
|
|
|
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
|
|
|
const row = this.form.tableData[i]
|
|
|
|
row.edit = true
|
|
|
|
this.form.tableData.splice(i, 1, row)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
invtypeFormat(row, column) {
|
|
|
|
return this.dict.label.ST_INV_OUT_TYPE[row.source_bill_type]
|
|
|
|
},
|
|
|
|
storChange(row) {
|
|
|
|
this.storlist.forEach((item) => {
|
|
|
|
if (item.stor_id === row) {
|
|
|
|
this.form.stor_code = item.stor_code
|
|
|
|
this.form.stor_name = item.stor_name
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
async queryMater(index, row) {
|
|
|
|
if (this.form.bill_type === '') {
|
|
|
|
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
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) {
|
|
|
|
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.dtlShow = true
|
|
|
|
/* checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type }).then(res => {
|
|
|
|
this.materType = res.materType
|
|
|
|
})*/
|
|
|
|
},
|
|
|
|
tableChanged(rows) {
|
|
|
|
rows.forEach((item) => {
|
|
|
|
if (this.form.tableData.length !== 0) {
|
|
|
|
this.flagnow = false
|
|
|
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
|
|
|
if (this.form.tableData[i].box_no === item.box_no && this.form.tableData[i].pcsn === item.pcsn) {
|
|
|
|
this.flagnow = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!this.flagnow) {
|
|
|
|
item.edit = true
|
|
|
|
this.form.tableData.splice(-1, 0, item)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
item.edit = true
|
|
|
|
this.form.tableData.splice(-1, 0, item)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.form.detail_count = this.form.tableData.length
|
|
|
|
},
|
|
|
|
tableChanged5(rows) {
|
|
|
|
console.log(rows)
|
|
|
|
const data = {
|
|
|
|
'data': rows
|
|
|
|
}
|
|
|
|
if (this.form.bill_type === '1011') {
|
|
|
|
rows.forEach((item) => {
|
|
|
|
if (this.form.tableData.length !== 0) {
|
|
|
|
this.flagnow = false
|
|
|
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
|
|
|
if (this.form.tableData[i].box_no === item.box_no && this.form.tableData[i].pcsn === item.pcsn) {
|
|
|
|
this.flagnow = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!this.flagnow) {
|
|
|
|
item.edit = false
|
|
|
|
this.form.tableData.splice(-1, 0, item)
|
|
|
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
item.edit = false
|
|
|
|
this.form.tableData.splice(-1, 0, item)
|
|
|
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.form.detail_count = this.form.tableData.length
|
|
|
|
} else {
|
|
|
|
// 为了整箱出库
|
|
|
|
checkoutbill.queryBox(data).then(res => {
|
|
|
|
res.forEach((item) => {
|
|
|
|
// debugger
|
|
|
|
if (this.form.tableData.length !== 0) {
|
|
|
|
this.flagnow = false
|
|
|
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
|
|
|
if (this.form.tableData[i].box_no === item.box_no && this.form.tableData[i].pcsn === item.pcsn) {
|
|
|
|
this.flagnow = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!this.flagnow) {
|
|
|
|
item.edit = true
|
|
|
|
this.form.tableData.splice(-1, 0, item)
|
|
|
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
item.edit = true
|
|
|
|
this.form.tableData.splice(-1, 0, item)
|
|
|
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.form.detail_count = this.form.tableData.length
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setMaterValue(row) {
|
|
|
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
|
|
|
if (this.form.tableData[i].material_id === row.material_id) {
|
|
|
|
this.crud.notify('不允许添加相同物料!')
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.nowrow.material_id = row.material_id
|
|
|
|
this.nowrow.material_code = row.material_code
|
|
|
|
this.nowrow.material_name = row.material_name
|
|
|
|
this.nowrow.qty_unit_id = row.base_unit_id
|
|
|
|
this.nowrow.qty_unit_name = row.unit_name
|
|
|
|
this.nowrow.plan_qty = '1'
|
|
|
|
this.nowrow.edit = false
|
|
|
|
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
|
|
|
|
},
|
|
|
|
async insertdtl() {
|
|
|
|
if (this.form.bill_type === '') {
|
|
|
|
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
this.form.tableData.push({ material_id: '', material_code: '', material_name: '', pcsn: '', quality_scode: '00', plan_qty: '1', qty_unit_name: '', qty_unit_id: '', remark: '', edit: false })
|
|
|
|
this.form.detail_count = this.form.tableData.length
|
|
|
|
},
|
|
|
|
deleteRow(index, rows) {
|
|
|
|
/* this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
|
|
|
|
rows.splice(index, 1)
|
|
|
|
this.nowindex = ''
|
|
|
|
this.nowrow = {}
|
|
|
|
this.form.detail_count = this.form.tableData.length*/
|
|
|
|
const box_no = rows[index].box_no
|
|
|
|
let len = rows.length
|
|
|
|
while (len--) {
|
|
|
|
const obj = rows[len]
|
|
|
|
if (box_no === obj.box_no) {
|
|
|
|
const index = rows.indexOf(obj)
|
|
|
|
if (index > -1) { // 移除找到的指定元素
|
|
|
|
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
|
|
|
|
rows.splice(index, 1)
|
|
|
|
this.form.detail_count = this.form.tableData.length
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.crud-opts2 {
|
|
|
|
padding: 0 0;
|
|
|
|
display: -webkit-flex;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
.crud-opts2 .crud-opts-right2 {
|
|
|
|
margin-left: auto;
|
|
|
|
padding: 4px 4px;
|
|
|
|
}
|
|
|
|
.input-with-select {
|
|
|
|
background-color: #fff;
|
|
|
|
}
|
|
|
|
</style>
|