<template>
|
<el-dialog
|
:title="!dataForm.id ? '新增' : '修改'"
|
:close-on-click-modal="false"
|
:visible.sync="visible"
|
>
|
<el-form
|
:model="dataForm"
|
:rules="dataRule"
|
ref="dataForm"
|
label-width="80px"
|
class="l-mes"
|
>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="预留数量" prop="reservedQuantity">
|
<el-input
|
v-model="dataForm.reservedQuantity"
|
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" @click="dataFormSubmit()">确定</el-button>
|
</span>
|
</el-dialog>
|
</template>
|
|
<script>
|
import { putObj } from '@/api/warehouse/joinstockorder'
|
import { validateSixDecimalNotNull } from '@/util/validate'
|
|
export default {
|
data() {
|
return {
|
visible: false,
|
dataForm: {
|
id: 0,
|
reservedQuantity: null
|
},
|
dataRule: {
|
reservedQuantity: [
|
{ required: true, message: '预留数量不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalNotNull, trigger: 'blur' }
|
]
|
},
|
parentData: null
|
}
|
},
|
methods: {
|
init(row) {
|
this.parentData = row
|
this.dataForm = JSON.parse(JSON.stringify(row))
|
this.visible = true
|
},
|
// 表单提交
|
dataFormSubmit() {
|
this.$refs.dataForm.validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
putObj(this.dataForm).then((data) => {
|
this.$message.success('预留数量修改成功')
|
this.visible = false
|
this.$set(
|
this.parentData,
|
'reservedQuantity',
|
this.dataForm.reservedQuantity
|
)
|
})
|
}
|
}
|
})
|
}
|
}
|
}
|
</script>
|