<template>
|
<el-dialog title="编辑" :close-on-click-modal="false" :visible.sync="visible">
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
class="l-mes"
|
label-width="120px"
|
>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="起始米标" prop="startMetre">
|
<el-input
|
v-model="dataForm.startMetre"
|
placeholder="起始米标"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="结束米标" prop="endMetre">
|
<el-input
|
v-model="dataForm.endMetre"
|
placeholder="结束米标"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="产品标准" prop="productStandard">
|
<el-select
|
v-model="dataForm.productStandard"
|
filterable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in productStandardOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="包装检查" prop="packingInspection">
|
<el-select
|
v-model="dataForm.packingInspection"
|
filterable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in inspectionOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="包装人" prop="staffIds">
|
<el-select
|
v-model="dataForm.staffIds"
|
placeholder="包装人"
|
filterable
|
multiple
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in staffOption"
|
:key="item.id"
|
:label="item.staffName"
|
:value="item.id"
|
>
|
<span style="float: left">{{ item.staffName }}</span>
|
<span style="float: right; color: #8492a6; font-size: 13px">{{
|
item.staffNo
|
}}</span>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="盘具类型" prop="reelType">
|
<el-select
|
v-model="dataForm.reelType"
|
filterable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in reelWeightOptions"
|
:key="item.id"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option> </el-select
|
></el-form-item>
|
<el-form-item label="盘重" prop="reelWeight">
|
<el-input
|
v-model="dataForm.reelWeight"
|
placeholder="盘重"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="封帽的完整性" prop="capIntegrityInspection">
|
<el-select
|
v-model="dataForm.capIntegrityInspection"
|
filterable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in capIntegrityOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="包装方式" prop="packingManner">
|
<el-select
|
v-model="dataForm.packingManner"
|
filterable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in packingMannerOptions"
|
:key="item"
|
:label="item"
|
:value="item"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="打圈个数" prop="cylinderNumber">
|
<el-input
|
v-model="dataForm.cylinderNumber"
|
placeholder="打圈个数"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="印字" prop="lettering">
|
<el-input
|
v-model="dataForm.lettering"
|
placeholder="印字"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="认证标志类型" prop="certificationMarkType">
|
<el-select
|
v-model="dataForm.certificationMarkType"
|
filterable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="item in certificationOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="认证标志数量" prop="certificationMarkNumber">
|
<el-input
|
v-model="dataForm.certificationMarkNumber"
|
placeholder="认证标志数量"
|
></el-input>
|
</el-form-item>
|
|
<el-form-item label="毛重" prop="grossWeight">
|
<el-input
|
v-model="dataForm.grossWeight"
|
placeholder="毛重"
|
></el-input>
|
</el-form-item>
|
<el-form-item label="净重" prop="netWeight">
|
<el-input
|
v-model="dataForm.netWeight"
|
placeholder="净重"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button
|
type="primary"
|
:disabled="isSubmit"
|
v-thinclick="`dataFormSubmit`"
|
>确定</el-button
|
>
|
</span>
|
</el-dialog>
|
</template>
|
|
<script>
|
import { getObj, putObj } from '@/api/warehouse/packaging'
|
import { validateSixDecimalPositives } from '../../../util/validate'
|
import { remote } from '../../../api/admin/dict'
|
import { loadStaff } from '../../../api/basic/staff'
|
|
export default {
|
data() {
|
return {
|
productStandardOptions: [],
|
reelWeightOptions: [],
|
staffOption: [],
|
capIntegrityOptions: [],
|
inspectionOptions: [],
|
certificationOptions: [],
|
packingMannerOptions: ['打圈', '不打圈'],
|
visible: false,
|
dataForm: {
|
id: 0,
|
createTime: '',
|
updateTime: '',
|
createUser: '',
|
updateUser: '',
|
number: '',
|
differenceWeight: '',
|
realWeight: '',
|
stockOrderId: null,
|
startMetre: '',
|
endMetre: '',
|
productStandard: '',
|
reelNumber: '',
|
packingInspection: '',
|
capIntegrityInspection: '',
|
packingManner: '',
|
cylinderNumber: '',
|
routineReelNumber: '',
|
lettering: '',
|
certificationMarkType: '',
|
certificationMarkNumber: '',
|
staffIds: [],
|
reelWeight: '',
|
reelType: '',
|
metre: '',
|
grossWeight: '', // 毛重
|
netWeight: '', // 净重
|
partId: null,
|
outLocationId: null,
|
inLocationId: null,
|
partBatchNo: null,
|
workstationId: null,
|
status: null
|
},
|
dataRule: {
|
netWeight: [
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
grossWeight: [
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
realWeight: [
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
reelWeight: [
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
startMetre: [
|
{ required: true, message: '起始米标不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
endMetre: [
|
{ required: true, message: '结束米标不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
]
|
},
|
isSubmit: false
|
}
|
},
|
created() {
|
this.getCertificationDict()
|
this.getInspectionDict()
|
this.getCapIntegrityDict()
|
this.selectStaff()
|
this.getReelWeightDict()
|
this.getProductStandardDict()
|
},
|
watch: {
|
'dataForm.grossWeight': {
|
// 毛重
|
handler(newValue, oldValue) {
|
if (!newValue) {
|
return
|
}
|
if (
|
this.dataForm.reelWeight &&
|
this.dataForm.reelWeight != null &&
|
this.dataForm.reelWeight !== ''
|
) {
|
this.dataForm.netWeight =
|
Number(newValue) - Number(this.dataForm.reelWeight)
|
} else {
|
this.$message.error('请填写正确的盘重!')
|
}
|
}
|
// immediate: true,
|
// deep: true
|
},
|
'dataForm.netWeight': {
|
// 净重
|
handler(newValue, oldValue) {
|
if (!newValue) {
|
return
|
}
|
if (
|
this.dataForm.reelWeight &&
|
this.dataForm.reelWeight != null &&
|
this.dataForm.reelWeight !== ''
|
) {
|
this.dataForm.grossWeight =
|
Number(newValue) + Number(this.dataForm.reelWeight)
|
} else {
|
this.$message.error('请填写正确的盘重!')
|
}
|
}
|
// immediate: true,
|
// deep: true
|
}
|
},
|
methods: {
|
init(id) {
|
this.dataForm.id = id || 0
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs.dataForm.resetFields()
|
if (this.dataForm.id) {
|
getObj(this.dataForm.id).then((response) => {
|
this.dataForm = response.data.data
|
})
|
}
|
})
|
},
|
selectStaff() {
|
loadStaff(Object.assign({})).then((res) => {
|
this.staffOption = res.data.data
|
})
|
},
|
// 获取产品类型的字典
|
getCertificationDict() {
|
remote('certification_mark_type').then((response) => {
|
if (response.data.code === 0) {
|
this.certificationOptions = response.data.data
|
}
|
})
|
},
|
// 获取产品标准的字典
|
getProductStandardDict() {
|
remote('product_inspect').then((response) => {
|
if (response.data.code === 0) {
|
this.productStandardOptions = response.data.data
|
}
|
})
|
},
|
// 获取盘重类型的字典
|
getReelWeightDict() {
|
remote('reel_type').then((response) => {
|
if (response.data.code === 0) {
|
this.reelWeightOptions = response.data.data
|
}
|
})
|
},
|
// 获取包装检查的字典
|
getInspectionDict() {
|
remote('inspection_result').then((response) => {
|
if (response.data.code === 0) {
|
this.inspectionOptions = response.data.data
|
}
|
})
|
},
|
// 获取封帽的完整性检查的字典
|
getCapIntegrityDict() {
|
remote('capIntegrity_inspection').then((response) => {
|
if (response.data.code === 0) {
|
this.capIntegrityOptions = response.data.data
|
}
|
})
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.isSubmit = true
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
let flag = true
|
if (this.dataForm.packingManner === '打圈') {
|
// 此时打圈个数必填
|
if (
|
this.dataForm.cylinderNumber == null ||
|
this.dataForm.cylinderNumber === '' ||
|
this.dataForm.cylinderNumber.trim() === ''
|
) {
|
flag = false
|
}
|
}
|
if (flag) {
|
putObj(this.dataForm).then((data) => {
|
this.$message.success('编辑成功')
|
this.visible = false
|
this.isSubmit = false
|
this.$emit('refreshDataList')
|
})
|
} else {
|
this.$message.warning('请填写打圈个数!')
|
}
|
}
|
} else {
|
this.isSubmit = false
|
}
|
})
|
}
|
}
|
}
|
</script>
|