569 lines
17 KiB
Vue
569 lines
17 KiB
Vue
<template>
|
||
<el-dialog
|
||
style="padding-top: 0px;"
|
||
title="小线试验维护"
|
||
v-loading.fullscreen.lock="fullscreenLoading"
|
||
:visible.sync="dialogVisible"
|
||
append-to-body
|
||
fullscreen
|
||
@close="close"
|
||
@open="open"
|
||
>
|
||
<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" 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>
|
||
|
||
<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="150px" label-suffix=":">
|
||
<el-form-item label="实验序号" prop="formula_code">
|
||
<el-input v-model="form.formula_code" placeholder="系统生成" style="width: 210px" disabled />
|
||
</el-form-item>
|
||
<el-form-item label="物料" prop="material_id">
|
||
<el-select
|
||
v-model="form.material_id"
|
||
placeholder="物料"
|
||
style="width: 210px"
|
||
class="filter-item"
|
||
@change="storChange"
|
||
>
|
||
<el-option
|
||
v-for="item in THWs"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="批号" prop="inspection_id">
|
||
<el-select
|
||
v-model="form.inspection_id"
|
||
style="width: 210px"
|
||
size="mini"
|
||
placeholder="批号"
|
||
class="filter-item"
|
||
@change="storChange2"
|
||
>
|
||
<el-option
|
||
v-for="item in PCSNs"
|
||
:key="item.id"
|
||
:label="item.code"
|
||
:value="item.id"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="生产厂家" prop="manufactor">
|
||
<el-input v-model="form.manufactor" placeholder="生产厂家" style="width: 210px" disabled />
|
||
</el-form-item>
|
||
<el-form-item label="CT(%)" prop="CJZB00004">
|
||
<label slot="label">CT(%):</label>
|
||
<el-input-number
|
||
v-model="form.CJZB00004"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="Cr3C2" prop="CJZB00021">
|
||
<label slot="label">Cr3C2:</label>
|
||
<el-input-number
|
||
v-model="form.CJZB00021"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="氧含量" prop="CJZB00007">
|
||
<label slot="label">氧含量:</label>
|
||
<el-input-number
|
||
v-model="form.CJZB00007"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="VC(%)" prop="CJZB00020">
|
||
<label slot="label">VC(%):</label>
|
||
<el-input-number
|
||
v-model="form.CJZB00020"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="CF(%)" prop="CJZB00006">
|
||
<label slot="label">CF(%):</label>
|
||
<el-input-number
|
||
v-model="form.CJZB00006"
|
||
:controls="false"
|
||
:precision="0"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="FSSS(μm)" prop="CJZB00001">
|
||
<label slot="label">FSSS(μm):</label>
|
||
<el-input-number
|
||
v-model="form.CJZB00001"
|
||
:controls="false"
|
||
:precision="4"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="BET(㎡/g)" prop="CJZB00002">
|
||
<label slot="label">BET(㎡/g):</label>
|
||
<el-input-number
|
||
v-model="form.CJZB00002"
|
||
:controls="false"
|
||
:precision="4"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-divider></el-divider>
|
||
<el-form-item label="验收牌号" prop="mark_id">
|
||
<el-select
|
||
v-model="form.mark_id"
|
||
placeholder="验收牌号"
|
||
style="width: 210px"
|
||
class="filter-item"
|
||
:disabled="crud.status.view > 0"
|
||
@change="storChange3"
|
||
>
|
||
<el-option
|
||
v-for="item in boms"
|
||
:key="item.id"
|
||
:label="item.code"
|
||
:value="item.id"
|
||
/>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="试验批号" prop="accept_pcsn">
|
||
<label slot="label">试验批号:</label>
|
||
<el-input v-model="form.accept_pcsn" style="width: 210px" disabled class="input-with-select">
|
||
<el-button slot="append" @click="createPcsn">生成</el-button>
|
||
</el-input>
|
||
</el-form-item>
|
||
<el-form-item label="试验重量(g)" prop="accept_qty">
|
||
<label slot="label">试验重量(g):</label>
|
||
<el-input-number
|
||
v-model="form.accept_qty"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
style="width: 210px"
|
||
@change="storChange4"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="碳平衡" prop="c_balance">
|
||
<label slot="label">碳平衡:</label>
|
||
<el-input-number
|
||
v-model="form.c_balance"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="溶剂量(ml)" prop="liquid_qty">
|
||
<label slot="label">溶剂量(ml):</label>
|
||
<el-input-number
|
||
v-model="form.liquid_qty"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="合金球(KG)" prop="ball_qty">
|
||
<label slot="label">合金球(KG):</label>
|
||
<el-input-number
|
||
v-model="form.ball_qty"
|
||
:controls="false"
|
||
:precision="3"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="球磨转速(RPM)" prop="ball_speed">
|
||
<label slot="label">球磨转速(RPM):</label>
|
||
<el-input-number
|
||
v-model="form.ball_speed"
|
||
:controls="false"
|
||
:precision="0"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="研磨时间(H)" prop="ball_time">
|
||
<label slot="label">研磨时间(H):</label>
|
||
<el-input-number
|
||
v-model="form.ball_time"
|
||
:controls="false"
|
||
:precision="4"
|
||
:min="0"
|
||
disabled
|
||
style="width: 210px"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item label="开单人" align="center">
|
||
<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" style="width: 210px" disabled />
|
||
</el-form-item>
|
||
</el-form>
|
||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||
<span class="crud-opts-right2">
|
||
<!--左侧插槽-->
|
||
<slot name="left" />
|
||
<el-button
|
||
slot="left"
|
||
class="filter-item"
|
||
type="primary"
|
||
icon="el-icon-plus"
|
||
size="mini"
|
||
@click="autoCalculation"
|
||
>
|
||
开单计算
|
||
</el-button>
|
||
</span>
|
||
</div>
|
||
<el-table
|
||
ref="table"
|
||
:data="tableData"
|
||
style="width: 100%;"
|
||
size="mini"
|
||
border
|
||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||
>
|
||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||
<el-table-column prop="material_code" label="物料编码" align="center" />
|
||
<el-table-column prop="material_name" label="物料名称" align="center" />
|
||
<el-table-column prop="formula_qty" label="重量" align="center">
|
||
<template slot-scope="scope">
|
||
<el-input-number
|
||
v-model="scope.row.formula_qty"
|
||
size="mini"
|
||
:controls="false"
|
||
:precision="4"
|
||
:min="0"
|
||
: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="批次" :disabled="scope.row.is_thw" />
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</el-dialog>
|
||
</template>
|
||
|
||
<script>
|
||
|
||
import Date from '@/utils/datetime'
|
||
|
||
const defaultForm = {
|
||
formula_code: '',
|
||
material_id: '',
|
||
manufactor: '',
|
||
inspection_id: '',
|
||
CJZB00001: 0,
|
||
CJZB00002: 0,
|
||
CJZB00006: 0,
|
||
CJZB00020: 0,
|
||
CJZB00021: 0,
|
||
CJZB00004: 0,
|
||
CJZB00007: 0,
|
||
mark_id: '',
|
||
create_name: '',
|
||
create_time: (new Date()).strftime('%F', 'zh'),
|
||
accept_pcsn: '',
|
||
accept_qty: 1000,
|
||
c_balance: 0,
|
||
ball_rate: 0,
|
||
liquid_rate: 0,
|
||
ball_qty: 0,
|
||
liquid_qty: 0,
|
||
ball_time: 0,
|
||
ball_speed: 0,
|
||
tableData: []
|
||
}
|
||
|
||
import crudacceptformula from '@/api/wms/pf/acceptformula'
|
||
import CRUD, { form, crud } from '@crud/crud'
|
||
import { mapGetters } from 'vuex'
|
||
|
||
export default {
|
||
name: 'AddDialog',
|
||
components: {},
|
||
mixins: [crud(), form(defaultForm)],
|
||
props: {
|
||
dialogShow: {
|
||
type: Boolean,
|
||
default: false
|
||
},
|
||
rowmst: {
|
||
type: Object
|
||
}
|
||
},
|
||
data() {
|
||
return {
|
||
dialogVisible: false,
|
||
dtlMaterShow: false,
|
||
nowrow: {},
|
||
nowindex: '',
|
||
boms: [],
|
||
THWs: [],
|
||
PCSNs: [],
|
||
tableData: [],
|
||
fullscreenLoading: false,
|
||
rules: {
|
||
material_id: [
|
||
{ required: true, message: '物料不能为空', trigger: 'blur' }
|
||
],
|
||
inspection_id: [
|
||
{ required: true, message: '批号不能为空', trigger: 'blur' }
|
||
],
|
||
mark_id: [
|
||
{ required: true, message: '验收牌号不能为空', trigger: 'blur' }
|
||
],
|
||
accept_pcsn: [
|
||
{ required: true, message: '试验批号不能为空', trigger: 'blur' }
|
||
],
|
||
accept_qty: [
|
||
{ required: true, message: '试验重量不能为空', trigger: 'blur' }
|
||
]
|
||
}
|
||
}
|
||
},
|
||
watch: {
|
||
dialogShow: {
|
||
handler(newValue, oldValue) {
|
||
this.dialogVisible = newValue
|
||
}
|
||
},
|
||
rowmst: {
|
||
handler(newValue) {
|
||
this.form = newValue
|
||
}
|
||
}
|
||
},
|
||
computed: {
|
||
...mapGetters({
|
||
user: 'user'
|
||
})
|
||
},
|
||
created() {
|
||
crudacceptformula.getBoms().then(res => {
|
||
this.boms = res
|
||
})
|
||
crudacceptformula.getTHWs().then(res => {
|
||
this.THWs = res
|
||
})
|
||
this.tableData = []
|
||
},
|
||
methods: {
|
||
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
|
||
}
|
||
if (!this.form.accept_pcsn) {
|
||
this.crud.notify('试验批号不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||
return false
|
||
}
|
||
if (this.form.accept_qty <= 0) {
|
||
this.crud.notify('试验重量不能为0或空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||
return false
|
||
}
|
||
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)
|
||
})
|
||
}
|
||
},
|
||
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 => {
|
||
this.PCSNs = res
|
||
this.form.inspection_id = ''
|
||
this.form.CJZB00007 = '0'
|
||
this.form.CJZB00001 = '0'
|
||
this.form.CJZB00002 = '0'
|
||
this.form.CJZB00006 = '0'
|
||
this.form.CJZB00021 = '0'
|
||
this.form.CJZB00020 = '0'
|
||
this.form.CJZB00004 = '0'
|
||
})
|
||
},
|
||
storChange2(row) {
|
||
crudacceptformula.getPCSN({ 'inspection_id': row }).then(res => {
|
||
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
|
||
})
|
||
},
|
||
storChange3(row) {
|
||
crudacceptformula.getBom({ 'mark_id': row }).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
|
||
})
|
||
},
|
||
storChange4(row) {
|
||
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
|
||
},
|
||
handleClose(done) {
|
||
this.$confirm('确认关闭?')
|
||
.then(_ => {
|
||
done()
|
||
})
|
||
.catch(_ => {
|
||
})
|
||
},
|
||
close() {
|
||
this.$refs['form'].resetFields()
|
||
this.tableData = []
|
||
this.$emit('AddChanged')
|
||
this.$emit('update:dialogShow', 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
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
.crud-opts2 {
|
||
padding: 4px 0;
|
||
display: -webkit-flex;
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.crud-opts2 .crud-opts-right2 {
|
||
margin-left: auto;
|
||
}
|
||
|
||
</style>
|
||
|
||
<style rel="stylesheet/scss" lang="scss" scoped>
|
||
::v-deep .el-dialog__body {
|
||
padding-top: 0px;
|
||
}
|
||
</style>
|