qy-renren-qt/src/views/modules/work/mtwarehouspositionrelatlog-add-or-update.vue
2022-08-19 15:01:12 +08:00

162 lines
6.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="库位状态" prop="status">
<el-input v-model="dataForm.status" placeholder="表示库位状态 -1:不可用0:空库位, 1:空货架, 2:货物正常, 3:货物预入库, 4:货物预出库" clearable />
</el-form-item>
<el-form-item label="是否为空" prop="isEmpty">
<el-input v-model="dataForm.isEmpty" placeholder="是否为空0表示空1表示有货" clearable />
</el-form-item>
<el-form-item label="产品id" prop="productId">
<el-input v-model="dataForm.productId" placeholder="产品id关联产品表mt_product" clearable />
</el-form-item>
<el-form-item label="详细规格" prop="specModel">
<el-input v-model="dataForm.specModel" placeholder="详细规格" clearable />
</el-form-item>
<el-form-item label="产品编码" prop="productCode">
<el-input v-model="dataForm.productCode" placeholder="产品编码" clearable />
</el-form-item>
<el-form-item label="板材名称" prop="productName">
<el-input v-model="dataForm.productName" placeholder="板材名称" clearable />
</el-form-item>
<el-form-item label="货物数量" prop="quantity">
<el-input v-model="dataForm.quantity" placeholder="货物数量, 货物总的数量" clearable />
</el-form-item>
<el-form-item label="库位id" prop="warehousPositionId">
<el-input v-model="dataForm.warehousPositionId" placeholder="库位id关联表mt_warehous_rank" clearable />
</el-form-item>
<el-form-item label="库位名称" prop="warehousPositionName">
<el-input v-model="dataForm.warehousPositionName" placeholder="库位名称" clearable />
</el-form-item>
<el-form-item label="批次号" prop="dateNum">
<el-input v-model="dataForm.dateNum" placeholder="批次号" clearable />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="备注" clearable />
</el-form-item>
</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>
export default {
data () {
return {
visible: false,
dataForm: {
id: 0,
status: '',
isEmpty: '',
productId: '',
specModel: '',
productCode: '',
productName: '',
quantity: '',
warehousPositionId: '',
warehousPositionName: '',
dateNum: '',
remark: ''
},
dataRule: {
status: [
{ required: true, message: '表示库位状态 -1:不可用0:空库位, 1:空货架, 2:货物正常, 3:货物预入库, 4:货物预出库不能为空', trigger: 'blur' }
],
isEmpty: [
{ required: true, message: '是否为空0表示空1表示有货不能为空', trigger: 'blur' }
],
productId: [
{ required: true, message: '产品id关联产品表mt_product不能为空', trigger: 'blur' }
],
specModel: [
{ required: true, message: '详细规格不能为空', trigger: 'blur' }
],
productCode: [
{ required: true, message: '产品编码不能为空', trigger: 'blur' }
],
productName: [
{ required: true, message: '板材名称不能为空', trigger: 'blur' }
],
quantity: [
{ required: true, message: '货物数量, 货物总的数量不能为空', trigger: 'blur' }
],
warehousPositionId: [
{ required: true, message: '库位id关联表mt_warehous_rank不能为空', trigger: 'blur' }
],
warehousPositionName: [
{ required: true, message: '库位名称不能为空', trigger: 'blur' }
],
dateNum: [
{ required: true, message: '批次号不能为空', trigger: 'blur' }
]
}
}
},
methods: {
init (id) {
this.dataForm.id = id || ''
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/work/mtwarehouspositionrelatlog/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 0) {
this.dataForm = data.mtWarehousPositionRelatLog
}
})
}
})
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/work/mtwarehouspositionrelatlog/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'id': this.dataForm.id || undefined,
'status': this.dataForm.status,
'isEmpty': this.dataForm.isEmpty,
'productId': this.dataForm.productId,
'specModel': this.dataForm.specModel,
'productCode': this.dataForm.productCode,
'productName': this.dataForm.productName,
'quantity': this.dataForm.quantity,
'warehousPositionId': this.dataForm.warehousPositionId,
'warehousPositionName': this.dataForm.warehousPositionName,
'dateNum': this.dataForm.dateNum,
'remark': this.dataForm.remark
})
}).then(({data}) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
})
}
}
}
</script>