代码更新
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
size="mini"
|
||||
@click="queryDtl()"
|
||||
>
|
||||
添加质检物料
|
||||
添加物料
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
@@ -142,7 +142,6 @@
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
>
|
||||
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||
<el-table-column prop="bill_status" label="订单状态" align="center" :formatter="bill_statusFormat" />
|
||||
<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">
|
||||
@@ -152,19 +151,20 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="material_name" label="物料名称" align="center" min-width="150px" show-overflow-tooltip />
|
||||
<el-table-column show-overflow-tooltip prop="pcsn" label="批次号" align="center">
|
||||
<el-table-column show-overflow-tooltip prop="pcsn" label="子卷号" 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">
|
||||
<el-table-column prop="plan_qty" label="出库重量" width="150" align="center">
|
||||
<template scope="scope">
|
||||
<el-input-number v-model="scope.row.plan_qty" :disabled="scope.row.edit" :precision="3" :controls="false" :min="0" style="width: 120px" />
|
||||
<el-input-number v-model="scope.row.plan_qty" v-show="!scope.row.edit" :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">
|
||||
<!-- <el-table-column prop="quality_scode" label="品质类型" align="center" width="110px">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.quality_scode"
|
||||
@@ -212,27 +212,25 @@
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</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-show="!scope.row.edit" v-model="scope.row.remark" size="mini" />
|
||||
<span v-show="scope.row.edit">{{ scope.row.remark }}</span>
|
||||
<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="160" 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)" />
|
||||
<el-button v-show="!scope.row.edit" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
|
||||
<el-button v-show="scope.row.edit" type="success" class="filter-item" size="mini" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">完成</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<AddDtl :dialog-show.sync="dtlShow" :open-param="materType" @tableChanged="tableChanged" />
|
||||
<MaterDialog :dialog-show.sync="materShow" :mater-opt-code.sync="materType" @tableChanged2="tableChanged2" />
|
||||
<MaterDialog :dialog-show.sync="materShow" :mater-opt-code.sync="materType" @setMaterValue="setMaterValue" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -279,7 +277,9 @@ export default {
|
||||
nowrow: {},
|
||||
nowindex: '',
|
||||
storlist: [],
|
||||
billtypelist: [],
|
||||
billtypelist: [
|
||||
{ 'name': '发货出库', 'code': '111111' }
|
||||
],
|
||||
invtypelist: [],
|
||||
rules: {
|
||||
stor_id: [
|
||||
@@ -304,19 +304,25 @@ export default {
|
||||
methods: {
|
||||
open() {
|
||||
// 查询原材料库的仓库
|
||||
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
|
||||
crudStorattr.getStor({ 'is_productstore': '1' }).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
crudRawAssist.getType({ 'io_code': '0101', 'io_flag': '01' }).then(res => {
|
||||
/* crudRawAssist.getType({ 'io_code': '0101', 'io_flag': '01' }).then(res => {
|
||||
this.billtypelist = res
|
||||
})
|
||||
checkoutbill.getInvTypes().then(res => {
|
||||
this.invtypelist = res
|
||||
})
|
||||
})*/
|
||||
},
|
||||
close() {
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
if (this.form.tableData.length === 0) {
|
||||
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
|
||||
@@ -346,9 +352,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
bill_statusFormat(row, column) {
|
||||
return this.dict.label.io_bill_status[row.bill_status]
|
||||
},
|
||||
storChange(row) {
|
||||
this.storlist.forEach((item) => {
|
||||
if (item.stor_id === row) {
|
||||
@@ -362,22 +365,22 @@ export default {
|
||||
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type }).then(res => {
|
||||
this.materType = res.materType
|
||||
this.materShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
})
|
||||
this.materShow = true
|
||||
/* checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type }).then(res => {
|
||||
this.materType = res.materType
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
})*/
|
||||
},
|
||||
async queryDtl(index, row) {
|
||||
if (this.form.bill_type === '') {
|
||||
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type }).then(res => {
|
||||
this.materType = res.materType
|
||||
this.dtlShow = true
|
||||
})
|
||||
this.dtlShow = true
|
||||
/* checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type }).then(res => {
|
||||
this.materType = res.materType
|
||||
})*/
|
||||
},
|
||||
tableChanged(rows) {
|
||||
const tablemap = new Map()
|
||||
@@ -392,17 +395,11 @@ export default {
|
||||
if (!this.flagnow) {
|
||||
item.edit = true
|
||||
item.quality_scode = '00'
|
||||
item.ivt_level = '01'
|
||||
item.is_active = '1'
|
||||
item.bill_status = '10'
|
||||
tablemap.set(item.material_id, item)
|
||||
}
|
||||
} else {
|
||||
item.edit = true
|
||||
item.quality_scode = '00'
|
||||
item.ivt_level = '01'
|
||||
item.is_active = '1'
|
||||
item.bill_status = '10'
|
||||
tablemap.set(item.material_id, item)
|
||||
}
|
||||
})
|
||||
@@ -411,7 +408,7 @@ export default {
|
||||
}
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
tableChanged2(row) {
|
||||
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('不允许添加相同物料!')
|
||||
@@ -423,6 +420,8 @@ export default {
|
||||
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() {
|
||||
@@ -430,56 +429,15 @@ export default {
|
||||
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
this.form.tableData.push({ material_id: '', material_code: '', bill_status: '10', material_name: '', pcsn: '', quality_scode: '00', ivt_level: '01', is_active: '1', plan_qty: '2', qty_unit_name: '', qty_unit_id: '', remark: '', edit: false })
|
||||
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
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
// 判断是否可以关闭编辑状态
|
||||
if (!row.edit) {
|
||||
if (!row.material_id || !row.plan_qty || parseFloat(row.plan_qty) <= 0) {
|
||||
this.crud.notify('物料、数量不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (row.quality_scode !== '00') {
|
||||
this.crud.notify('请校验物料' + row.material_code + ',品质类型是否正确', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (row.ivt_level !== '01') {
|
||||
this.crud.notify('请校验物料' + row.material_code + ',库存等级是否正确', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (row.is_active !== '1') {
|
||||
this.crud.notify('请校验物料' + row.material_code + ',是否可用是否正确', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
row.edit = !row.edit
|
||||
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
|
||||
if (row.edit) {
|
||||
this.form.total_qty = 0
|
||||
this.form.tableData.forEach((item) => {
|
||||
this.form.total_qty = this.form.total_qty + item.plan_qty
|
||||
})
|
||||
}
|
||||
},
|
||||
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
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
if (this.form.tableData.length === 0) {
|
||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
if (!this.form.tableData[i].edit) {
|
||||
this.crud.notify('尚有未完成编辑的物料明细序号' + (i + 1) + ',请检查!')
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user