<template>
|
<j-modal
|
:title="title"
|
:width="width"
|
:visible="visible"
|
switchFullscreen
|
@ok="handleOk"
|
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
@cancel="handleCancel"
|
cancelText="关闭">
|
|
<a-spin :spinning="confirmLoading">
|
<j-form-container :disabled="formDisabled">
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
<a-row :gutter="24">
|
<a-col :span="12">
|
<a-form-model-item label="报工订单" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderId">
|
<a-select
|
v-model="model.orderId"
|
:options="workOrderOptions"
|
placeholder="请选择报工订单">
|
</a-select>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="报工工单" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="workOrderCode">
|
<a-input
|
v-model="model.workOrderCode"
|
:disabled="true"
|
placeholder="请选择报工工单">
|
</a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="12">
|
<a-form-model-item label="产线" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="factoryId_dictText">
|
<a-input
|
v-model="model.factoryId_dictText"
|
:disabled="true"
|
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%"
|
:min="0">
|
</a-input-number>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</j-form-container>
|
</a-spin>
|
</j-modal>
|
</template>
|
|
<script>
|
import { postAction, getAction } from '@api/manage'
|
|
export default {
|
name: 'MesProductionWorkOrderRepublishModal',
|
data () {
|
return {
|
title: '报工',
|
width: 800,
|
visible: false,
|
disableSubmit: false,
|
confirmLoading: false,
|
model: {},
|
validatorRules: {
|
},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 6 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 18 },
|
},
|
url: {
|
republish: '/mesproductionworkorder/mesProductionWorkOrder/republish',
|
selectReportWorkOrderList: '/mes/productionOrder/selectReportWorkOrderList'
|
},
|
workOrderOptions: []
|
}
|
},
|
computed: {
|
formDisabled(){
|
return this.disabled
|
},
|
},
|
methods: {
|
add (record) {
|
// 重置表单
|
this.$refs.form && this.$refs.form.resetFields()
|
// 设置初始值
|
this.model = Object.assign({}, record);
|
getAction(this.url.selectReportWorkOrderList, {materialNumber: record.materialNumber}).then(res => {
|
if (res.success) {
|
this.workOrderOptions = res.result
|
}
|
})
|
this.visible = true
|
},
|
close () {
|
this.$emit('close');
|
this.visible = false;
|
},
|
handleOk () {
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
this.confirmLoading = true
|
let formData = {
|
id: this.model.id,
|
planQuantity: this.model.planQuantity,
|
republishReason: this.model.republishReason
|
}
|
postAction(this.url.republish, formData).then(res => {
|
if (res.success) {
|
this.$message.success(res.message)
|
this.submitCallback()
|
} else {
|
this.$message.warning(res.message)
|
}
|
}).finally(() => {
|
this.confirmLoading = false
|
})
|
}
|
})
|
},
|
submitCallback(){
|
this.$emit('ok');
|
this.visible = false;
|
},
|
handleCancel () {
|
this.close()
|
}
|
}
|
}
|
</script>
|