You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

173 lines
6.6 KiB

<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="8">
<a-form-model-item label="出库时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="deliveryTime">
<j-date placeholder="请选择出库时间" v-model="model.deliveryTime" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="火工品编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pyrotechnics">
<a-input v-model="model.pyrotechnics" placeholder="请输入火工品编号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="名称及规格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pyrotechnicsName">
<a-input v-model="model.pyrotechnicsName" placeholder="请输入火工品名称及规格" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="火工品类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="category">
<a-input v-model="model.category" placeholder="请输入火工品类型" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="unit">
<a-input v-model="model.unit" placeholder="请输入单位" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="生产厂家" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="manufacturer">
<a-input v-model="model.manufacturer" placeholder="请输入生产厂家" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="支出数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="disburseNum">
<a-input-number v-model="model.disburseNum" placeholder="请输入支出数量" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="用料单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit">
<a-input v-model="model.materialUnit" placeholder="请输入用料单位" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="用料班组" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialTeam">
<a-input v-model="model.materialTeam" placeholder="请输入用料班组" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="领料人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialHandler">
<a-input v-model="model.materialHandler" placeholder="请输入领料人" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="井号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="wellNumber">
<a-input v-model="model.wellNumber" placeholder="请输入井号" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="库房" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="kube">
<a-input v-model="model.kube" placeholder="请输入库房" ></a-input>
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="单价" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price">
<a-input-number v-model="model.price" placeholder="请输入单价" style="width: 100%" />
</a-form-model-item>
</a-col>
<a-col :span="8">
<a-form-model-item label="主货位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="goodsAllocation">
<a-input v-model="model.goodsAllocation" placeholder="请输入主货位" ></a-input>
</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: 'ProcessIndustrialScrapForm',
components: {
},
props: {
//表单禁用
disabled: {
type: Boolean,
default: false,
required: false
}
},
data () {
return {
model:{
},
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
disburseNum: [
{ required: true, message: '请输入支出数量!'},
{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
],
},
url: {
add: "/gunpowder/processIndustrialScrap/add",
edit: "/gunpowder/processIndustrialScrap/edit",
queryById: "/gunpowder/processIndustrialScrap/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>