This commit is contained in:
zds
2022-10-13 15:22:04 +08:00
parent d438cd1453
commit f938c89fc9
11 changed files with 1513 additions and 540 deletions

View File

@@ -1,20 +1,22 @@
<template>
<el-dialog
style="padding-top: 0px;"
:title="crud.status.title"
title="小线试验维护"
v-loading.fullscreen.lock="fullscreenLoading"
:visible.sync="dialogVisible"
append-to-body
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
@close="close"
@open="open"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-row :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>
<el-button icon="el-icon-check" size="mini" type="primary" @click="mysubmitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="dialogVisible = false">关闭</el-button>
</span>
</el-col>
</el-row>
@@ -29,7 +31,6 @@
placeholder="物料"
style="width: 210px"
class="filter-item"
:disabled="crud.status.view > 0"
@change="storChange"
>
<el-option
@@ -43,7 +44,7 @@
<el-form-item label="批号" prop="inspection_id">
<el-select
v-model="form.inspection_id"
clearable
style="width: 210px"
size="mini"
placeholder="批号"
class="filter-item"
@@ -138,8 +139,7 @@
style="width: 210px"
/>
</el-form-item>
</el-form>
<el-form ref="form2" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="150px" label-suffix=":">
<el-divider></el-divider>
<el-form-item label="验收牌号" prop="mark_id">
<el-select
v-model="form.mark_id"
@@ -231,10 +231,10 @@
/>
</el-form-item>
<el-form-item label="开单人" align="center">
<el-input v-model="form.create_name" placeholder="开单人" style="width: 210px" disabled />
<el-input v-model="form.create_name" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="开单日期" align="center">
<el-input v-model="form.create_time" placeholder="开单人" style="width: 210px" disabled />
<el-input v-model="form.create_time" style="width: 210px" disabled />
</el-form-item>
</el-form>
<div class="crud-opts2" style="margin-bottom: 5px;">
@@ -247,7 +247,7 @@
type="primary"
icon="el-icon-plus"
size="mini"
@click="insertdtl"
@click="autoCalculation"
>
开单计算
</el-button>
@@ -255,7 +255,7 @@
</div>
<el-table
ref="table"
:data="form.tableData"
:data="tableData"
style="width: 100%;"
size="mini"
border
@@ -271,15 +271,14 @@
size="mini"
:controls="false"
:precision="4"
:max="100"
:min="0"
:disabled="scope.row.edit"
:disabled="scope.row.is_thw"
/>
</template>
</el-table-column>
<el-table-column prop="dtl_pcsn" label="批次" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.dtl_pcsn" placeholder="批次" />
<el-input v-model="scope.row.dtl_pcsn" placeholder="批次" :disabled="scope.row.is_thw" />
</template>
</el-table-column>
</el-table>
@@ -293,6 +292,7 @@ import Date from '@/utils/datetime'
const defaultForm = {
formula_code: '',
material_id: '',
manufactor: '',
inspection_id: '',
CJZB00001: 0,
CJZB00002: 0,
@@ -318,6 +318,7 @@ const defaultForm = {
import crudacceptformula from '@/api/wms/pf/acceptformula'
import CRUD, { form, crud } from '@crud/crud'
import { mapGetters } from 'vuex'
export default {
name: 'AddDialog',
@@ -327,6 +328,9 @@ export default {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
}
},
data() {
@@ -338,6 +342,8 @@ export default {
boms: [],
THWs: [],
PCSNs: [],
tableData: [],
fullscreenLoading: false,
rules: {
material_id: [
{ required: true, message: '物料不能为空', trigger: 'blur' }
@@ -362,8 +368,18 @@ export default {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
rowmst: {
handler(newValue) {
this.form = newValue
}
}
},
computed: {
...mapGetters({
user: 'user'
})
},
created() {
crudacceptformula.getBoms().then(res => {
this.boms = res
@@ -371,9 +387,18 @@ export default {
crudacceptformula.getTHWs().then(res => {
this.THWs = res
})
this.tableData = []
},
methods: {
[CRUD.HOOK.beforeSubmit]() {
mysubmitCU() {
if (!this.form.material_id) {
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!this.form.inspection_id) {
this.crud.notify('批号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!this.form.mark_id) {
this.crud.notify('验收牌号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
@@ -383,19 +408,71 @@ export default {
return false
}
if (this.form.accept_qty <= 0) {
this.crud.notify('试验重量不能为0', CRUD.NOTIFICATION_TYPE.INFO)
this.crud.notify('试验重量不能为0或空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.tableData.length === 0) {
if (this.tableData.length === 0) {
this.crud.notify('开单明细不能为空', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
for (let i = 0; i < this.tableData.length; i++) {
if (!this.tableData[i].dtl_pcsn) {
this.crud.notify('批次不能为空,明细序号为' + (i + 1) + '请检查!')
return false
}
if (this.tableData[i].formula_qty <= 0) {
this.crud.notify('明细重量不能为0或空明细序号为' + (i + 1) + '请检查!')
return false
}
}
this.form.tableData = this.tableData
if (!this.form.formula_id) {
crudacceptformula.create(this.form).then(res => {
this.$refs['form'].resetFields()
this.tableData = []
this.$emit('AddChanged')
this.$emit('update:dialogShow', false)
})
} else {
crudacceptformula.update(this.form).then(res => {
this.$refs['form'].resetFields()
this.tableData = []
this.$emit('AddChanged')
this.$emit('update:dialogShow', false)
})
}
},
[CRUD.HOOK.afterToEdit]() {
// 编辑之后获取明细
crudacceptformula.getDtl({ 'mark_id': this.form.mark_id }).then(res => {
this.form.tableData = res
})
open() {
if (this.form.formula_id) {
// 编辑之后获取明细
crudacceptformula.getDtl({ 'formula_id': this.form.formula_id }).then(res => {
this.tableData = res
})
crudacceptformula.getPCSNs({ 'material_id': this.form.material_id }).then(res => {
this.PCSNs = res
})
crudacceptformula.getPCSNid(this.form).then(res => {
this.form.inspection_id = res.inspection_id
this.form.CJZB00007 = res.CJZB00007
this.form.CJZB00001 = res.CJZB00001
this.form.CJZB00002 = res.CJZB00002
this.form.CJZB00006 = res.CJZB00006
this.form.CJZB00021 = res.CJZB00021
this.form.CJZB00020 = res.CJZB00020
this.form.CJZB00004 = res.CJZB00004
this.form.manufactor = res.manufactor
})
crudacceptformula.getBom({ 'mark_id': this.form.mark_id }).then(res => {
this.form.c_balance = res.c_balance
this.form.ball_rate = res.ball_rate
this.form.liquid_rate = res.liquid_rate
this.form.ball_time = res.ball_time
this.form.ball_speed = res.ball_speed
this.form.ball_qty = this.form.ball_rate * this.form.accept_qty / 100.0
this.form.liquid_qty = this.form.liquid_rate * this.form.accept_qty / 100.0
})
}
},
storChange(row) {
crudacceptformula.getPCSNs({ 'material_id': row }).then(res => {
@@ -419,6 +496,7 @@ export default {
this.form.CJZB00021 = res.CJZB00021
this.form.CJZB00020 = res.CJZB00020
this.form.CJZB00004 = res.CJZB00004
this.form.manufactor = res.manufactor
})
},
storChange3(row) {
@@ -445,30 +523,25 @@ export default {
})
},
close() {
this.$refs['form'].resetFields()
this.tableData = []
this.$emit('AddChanged')
this.$emit('update:dialogShow', false)
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (!row.edit) {
if (parseFloat(row.standard_rate) <= 0) {
this.crud.notify('标准值必须大于0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.material_code) {
this.crud.notify('物料不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
},
insertdtl() {
this.form.tableData.push({ material_id: '', material_code: '', material_name: '', standard_rate: '0', seqno: '', edit: false })
},
createPcsn() {
crudacceptformula.createPcsn().then(res => {
this.form.accept_pcsn = res.accept_pcsn
})
},
autoCalculation() {
this.fullscreenLoading = true
crudacceptformula.autoCalculation(this.form).then(res => {
this.crud.notify('自动计算成功!')
this.tableData = res
this.fullscreenLoading = false
}).catch(() => {
this.fullscreenLoading = false
})
}
}
}