|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<template>
<j-modal
:title="title"
:width="width"
:visible="visible"
:confirmLoading="confirmLoading"
switchFullscreen
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-row>
<a-col :span="24">
|
|
15
|
<a-form-item label="图号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
16
|
<a-input v-decorator="['drawingNo', { rules: [{ required: true, message: '请输入图号' }] }]" placeholder="请输入图号" ></a-input>
|
|
17
18
19
|
</a-form-item>
</a-col>
<a-col :span="24">
|
|
20
21
|
<a-form-item label="父图号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['parentDrawingNo']" placeholder="请输入父图号" ></a-input>
|
|
22
23
24
25
|
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
26
27
28
29
30
31
|
<a-input v-decorator="['name', { rules: [{ required: true, message: '请输入名称' }] }]" placeholder="请输入名称" ></a-input>
</a-form-item>
</a-col>\
<a-col :span="24">
<a-form-item label="型号规格" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['spec']" placeholder="请输入型号规格" ></a-input>
|
|
32
33
34
|
</a-form-item>
</a-col>
<a-col :span="24">
|
|
35
36
37
38
39
40
41
42
43
44
|
<a-form-item label="准备工时" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['readyTime']" placeholder="请输入准备工时" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="操作工时" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['technologyTime']" placeholder="请输入操作工时" ></a-input>
</a-form-item>
</a-col>
<a-col :span="24">
|
|
45
|
<a-form-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
46
|
<a-input-number v-decorator="['qty', { rules: [{ required: true, message: '请输入数量' }] }]" placeholder="请输入数量" style="width: 100%" />
|
|
47
48
49
|
</a-form-item>
</a-col>
<a-col :span="24">
|
|
50
51
52
53
54
55
56
57
58
59
|
<a-form-item label="长度" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number v-decorator="['length']" placeholder="请输入长度" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="重量" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input-number v-decorator="['weight']" placeholder="请输入重量" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :span="24">
|
|
60
61
|
<a-form-item label="工艺" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['technology', { rules: [{ required: true, message: '请输入工艺' }] }]" placeholder="请输入工艺" style="width: 100%" />
|
|
62
63
|
</a-form-item>
</a-col>
|
|
64
|
|
|
65
66
67
68
69
|
<!-- <a-col :span="24">-->
<!-- <a-form-item label="下图日期/预期完成日期" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!-- <j-date placeholder="请选择下图日期/预期完成日期" v-decorator="['preDate']" :trigger-change="true" style="width: 100%" />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
|
|
70
71
72
73
74
75
76
77
78
|
</a-row>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import { httpAction } from '@/api/manage'
|
|
79
|
import {getTechnologyType, getTechnology} from '@/api/api'
|
|
80
|
import pick from 'lodash.pick'
|
|
81
|
import {addDetail, editDetail, addFromDetail} from '@/api/schedulerApi'
|
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
import { validateDuplicateValue } from '@/utils/util'
export default {
name: "SchedulerDetailModal",
components: {
},
props:{
mainId:{
type:String,
required:false,
default:''
}
},
data () {
|
|
96
97
98
99
|
let technologyTypeList
let technologyList
let technologyTypeModal
let technologyModal
|
|
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
return {
form: this.$form.createForm(this),
title:"操作",
width:800,
visible: false,
model: {},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
validatorRules: {
},
url: {
add: "/scheduler/schedulerHeader/addSchedulerDetail",
edit: "/scheduler/schedulerHeader/editSchedulerDetail",
|
|
121
122
123
124
125
|
},
technologyTypeList,
technologyList,
technologyTypeModal,
technologyModal
|
|
126
127
128
|
}
},
created () {
|
|
129
|
this.getTechnologyType()
|
|
130
|
this.getTechnologyList()
|
|
131
132
|
},
methods: {
|
|
133
134
135
|
handleProvinceChange(value) {
this.getTechnologyList(value)
},
|
|
136
137
138
|
add () {
this.edit({});
},
|
|
139
140
141
142
|
addForm (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.model.id = null;
|
|
143
|
this.model.userDef3 = 1;
|
|
144
145
146
147
148
|
this.visible = true;
this.technologyModal = record.technology;
this.technologyTypeModal = record.technologyType;
this.getTechnologyList(record.technologyType)
this.$nextTick(() => {
|
|
149
|
this.form.setFieldsValue(pick(this.model, 'id', 'drawingNo', 'parentDrawingNo', 'name', 'spec', 'qty','length','weight','readyTime','technologyTime','technology', 'preDate','sequence','completeDate','delayReason', 'completeBy'))
|
|
150
151
|
})
},
|
|
152
153
154
155
|
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
|
|
156
157
|
this.technologyModal = record.technology;
this.technologyTypeModal = record.technologyType;
|
|
158
|
this.getTechnologyList(record.technologyType)
|
|
159
|
this.$nextTick(() => {
|
|
160
|
this.form.setFieldsValue(pick(this.model, 'drawingNo', 'parentDrawingNo', 'name', 'spec', 'qty','length','weight','readyTime','technologyTime','technology', 'preDate','sequence','completeDate','delayReason', 'completeBy'))
|
|
161
162
163
164
165
166
167
168
169
170
171
172
|
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
|
|
173
174
175
176
177
|
values.drawingNo = (values.drawingNo || '').trim()
values.name = (values.name || '').trim()
values.parentDrawingNo = (values.parentDrawingNo || '').trim()
let formData = Object.assign(this.model, values);
formData['headerId'] = this.mainId
|
|
178
179
|
// formData['technology'] = this.technologyModal
// formData['technologyType'] = this.technologyTypeModal
|
|
180
|
let obj
|
|
181
182
183
184
185
186
|
if(!this.model.id) {
if (this.model.userDef3 == 1) {
obj = addFromDetail(formData)
} else {
obj = addDetail(formData)
}
|
|
187
|
}else{
|
|
188
|
obj = editDetail(formData)
|
|
189
|
}
|
|
190
191
192
193
194
195
|
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
|
|
196
197
|
}
}).finally(() => {
|
|
198
199
|
that.confirmLoading = false
that.close()
|
|
200
201
202
203
204
205
206
207
|
})
}
})
},
handleCancel () {
this.close()
},
popupCallback(row){
|
|
208
|
this.form.setFieldsValue(pick(row,'headerId','drawingNo','name','qty','length','weight','readyTime','technologyTime','technology','preDate','weldTechnology','weldBy','weldDate','machiningTechnology','machiningBy','machiningDate','paintTechnology','paintBy','paintDate','completedDate','delayReason'))
|
|
209
|
},
|
|
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
getTechnologyType() {
const that = this;
let obj = getTechnologyType();
obj.then((res) => {
if (res.success) {
that.technologyTypeList = res.result;
} else {
that.$message.warning(res.message);
}
})
},
getTechnologyList(val) {
const that = this;
let obj = getTechnology({val});
obj.then((res) => {
if (res.success) {
that.technologyList = res.result;
} else {
that.$message.warning(res.message);
}
})
}
|
|
232
233
234
|
}
}
</script>
|