1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
| <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>
| <a-col :span="24">
| <a-form-model-item label="计划生产数量" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="planQuantity">
| <a-input-number
| v-model="model.planQuantity"
| placeholder="请输入计划生产数量"
| style="width: 100%"
| :min="0">
| </a-input-number>
| </a-form-model-item>
| </a-col>
| <a-col :span="24">
| <a-form-model-item label="重发布原因" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="republishReason">
| <a-textarea
| v-model="model.republishReason"
| placeholder="请填写重发布原因"
| :rows="4">
| </a-textarea>
| </a-form-model-item>
| </a-col>
| </a-row>
| </a-form-model>
| </j-form-container>
| </a-spin>
| </j-modal>
| </template>
|
| <script>
| import { postAction } from '@api/manage'
|
| export default {
| name: 'MesProductionWorkOrderRepublishModal',
| data () {
| return {
| title: '重发布工单',
| width: 600,
| visible: false,
| disableSubmit: false,
| confirmLoading: false,
| model: {
| id: '',
| planQuantity: null,
| republishReason: ''
| },
| validatorRules: {
| planQuantity: [
| { required: true, message: '请输入计划生产数量!' }
| ],
| republishReason: [
| { required: true, message: '请填写重发布原因!' }
| ]
| },
| labelCol: {
| xs: { span: 24 },
| sm: { span: 6 },
| },
| wrapperCol: {
| xs: { span: 24 },
| sm: { span: 18 },
| },
| url: {
| republish: '/mesproductionworkorder/mesProductionWorkOrder/republish'
| }
| }
| },
| computed: {
| formDisabled(){
| return this.disabled
| },
| },
| methods: {
| add (record) {
| // 重置表单
| this.$refs.form && this.$refs.form.resetFields()
| // 设置初始值
| if (record) {
| this.model.id = record.id
| this.model.planQuantity = record.planQuantity
| this.model.republishReason = ''
| }
| 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>
|
|