opt:优化
This commit is contained in:
@@ -110,6 +110,16 @@
|
||||
|
||||
<!--左侧插槽-->
|
||||
<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"
|
||||
@@ -118,7 +128,7 @@
|
||||
size="mini"
|
||||
@click="queryDtl()"
|
||||
>
|
||||
添加物料
|
||||
手工添加物料
|
||||
</el-button>
|
||||
</span>
|
||||
|
||||
@@ -132,50 +142,25 @@
|
||||
: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">
|
||||
<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 show-overflow-tooltip prop="material_code" label="物料编码" width="190" align="center" />
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" min-width="150px" 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 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 show-overflow-tooltip prop="pcsn" label="批次号" width="150px" align="center" />
|
||||
<el-table-column prop="plan_qty" label="出库重量" width="150" align="center" />
|
||||
<el-table-column prop="qty_unit_name" label="单位" align="center" />
|
||||
<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 show-overflow-tooltip prop="remark" label="明细备注" align="center" />
|
||||
<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="tableChanged" />
|
||||
<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 crudBsrealstorattr from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
|
||||
|
||||
@@ -196,7 +181,7 @@ const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { AddDtl, MaterDialog },
|
||||
components: { AddDtl },
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
props: {
|
||||
dialogShow: {
|
||||
@@ -204,7 +189,7 @@ export default {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'ST_INV_OUT_TYPE'],
|
||||
dicts: ['io_bill_status', 'ST_INV_OUT_TYPE'],
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
@@ -251,41 +236,12 @@ export default {
|
||||
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
|
||||
}
|
||||
}
|
||||
},
|
||||
[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) {
|
||||
@@ -294,20 +250,6 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
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)
|
||||
@@ -327,7 +269,7 @@ export default {
|
||||
if (this.form.tableData.length !== 0) {
|
||||
this.flagnow = false
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
if (this.form.tableData[i].storagevehicle_code === item.storagevehicle_code && this.form.tableData[i].pcsn === item.pcsn) {
|
||||
if (this.form.tableData[i].storagevehicle_code === item.storagevehicle_code || this.form.tableData[i].source_bill_code === item.source_bill_code) {
|
||||
this.flagnow = true
|
||||
}
|
||||
}
|
||||
@@ -337,29 +279,12 @@ export default {
|
||||
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 替换数据 触发视图更新
|
||||
},
|
||||
deleteRow(index, rows) {
|
||||
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
|
||||
rows.splice(index, 1)
|
||||
|
||||
Reference in New Issue
Block a user