<template>
|
<a-spin :spinning="confirmLoading">
|
<j-form-container :disabled="formDisabled">
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
<a-row>
|
<a-col :span="12">
|
<a-form-model-item label="删除标记" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="delFlag">
|
<a-input-number v-model="model.delFlag" placeholder="请输入删除标记" style="width: 100%" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="订单ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderId">
|
<a-input v-model="model.orderId" placeholder="请输入订单ID" ></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="工单ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workOrderId">
|
<a-input v-model="model.workOrderId" placeholder="请输入工单ID" ></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="产线ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryId">
|
<a-input v-model="model.factoryId" placeholder="请输入产线ID" ></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="批次号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batchNumber">
|
<a-input v-model="model.batchNumber" placeholder="请输入批次号" ></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="托号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="palletNumber">
|
<a-input v-model="model.palletNumber" placeholder="请输入托号" ></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="quantity">
|
<a-input-number v-model="model.quantity" placeholder="请输入数量" style="width: 100%" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="报工人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reporter">
|
<a-input v-model="model.reporter" placeholder="请输入报工人" ></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="报工时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reportTime">
|
<j-date placeholder="请选择报工时间" v-model="model.reportTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="线边仓ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehouseId">
|
<a-input v-model="model.warehouseId" placeholder="请输入线边仓ID" ></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="成品下线打印状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="printStatus">
|
<j-dict-select-tag type="list" v-model="model.printStatus" dictCode="print_status" placeholder="请选择成品下线打印状态" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</j-form-container>
|
</a-spin>
|
</template>
|
|
<script>
|
|
import { httpAction, getAction } from '@/api/manage'
|
import { validateDuplicateValue } from '@/utils/util'
|
|
export default {
|
name: 'MesWorkReportingForm',
|
components: {
|
},
|
props: {
|
//表单禁用
|
disabled: {
|
type: Boolean,
|
default: false,
|
required: false
|
}
|
},
|
data () {
|
return {
|
model:{
|
},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 },
|
},
|
confirmLoading: false,
|
validatorRules: {
|
},
|
url: {
|
add: "/mesworkreporting/mesWorkReporting/add",
|
edit: "/mesworkreporting/mesWorkReporting/edit",
|
queryById: "/mesworkreporting/mesWorkReporting/queryById"
|
}
|
}
|
},
|
computed: {
|
formDisabled(){
|
return this.disabled
|
},
|
},
|
created () {
|
//备份model原始值
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
},
|
methods: {
|
add () {
|
this.edit(this.modelDefault);
|
},
|
edit (record) {
|
this.model = Object.assign({}, record);
|
this.visible = true;
|
},
|
submitForm () {
|
const that = this;
|
// 触发表单验证
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.confirmLoading = true;
|
let httpurl = '';
|
let method = '';
|
if(!this.model.id){
|
httpurl+=this.url.add;
|
method = 'post';
|
}else{
|
httpurl+=this.url.edit;
|
method = 'put';
|
}
|
httpAction(httpurl,this.model,method).then((res)=>{
|
if(res.success){
|
that.$message.success(res.message);
|
that.$emit('ok');
|
}else{
|
that.$message.warning(res.message);
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
})
|
}
|
|
})
|
},
|
}
|
}
|
</script>
|