SchedulerDetailModal.vue
8.49 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<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">-->
<!-- <a-form-item label="图号" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!-- <a-input v-decorator="['drawingNo', { 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="['parentDrawingNo']" placeholder="请输入父图号" ></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :span="24">-->
<!-- <a-form-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!-- <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>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :span="24">-->
<!-- <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">-->
<!-- <a-form-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
<!-- <a-input-number v-decorator="['qty', { rules: [{ required: true, message: '请输入数量' }] }]" 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="['length']" placeholder="请输入长度" style="width: 100%" />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<a-col :span="24">
<a-form-model-item label="工艺" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
<j-search-select-tag
placeholder="请选择工艺"
v-decorator="['technology']"
dict="technology,name,code,type='ljgy'"
:pageSize="30"
:async="true">
</j-search-select-tag>
</a-form-model-item>
</a-col>
<!-- <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>-->
</a-row>
</a-form>
</a-spin>
</j-modal>
</template>
<script>
import {getTechnologyType, getTechnology} from '@/api/api'
import pick from 'lodash.pick'
import {addDetail, editDetail, addFromDetail} from '@/api/schedulerApi'
// import { validateDuplicateValue } from '@/utils/util'
export default {
name: "SchedulerDetailModal",
components: {
},
props:{
mainId:{
type:String,
required:false,
default:''
}
},
data () {
let technologyTypeList
let technologyList
let technologyTypeModal
let technologyModal
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",
},
technologyTypeList,
technologyList,
technologyTypeModal,
technologyModal
}
},
created () {
this.getTechnologyType()
this.getTechnologyList()
},
methods: {
handleProvinceChange(value) {
this.getTechnologyList(value)
},
add () {
this.edit({});
},
addForm (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.model.id = null;
this.model.userDef3 = 1;
this.visible = true;
this.technologyModal = record.technology;
this.technologyTypeModal = record.technologyType;
this.getTechnologyList(record.technologyType)
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'id', 'drawingNo', 'parentDrawingNo', 'name', 'spec', 'qty','length','weight','readyTime','technologyTime','technology', 'preDate','sequence','completeDate','delayReason', 'completeBy'))
})
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
this.technologyModal = record.technology;
this.technologyTypeModal = record.technologyType;
this.getTechnologyList(record.technologyType)
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'technology'))
})
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true;
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
// formData['technology'] = this.technologyModal
// formData['technologyType'] = this.technologyTypeModal
let obj
if(!this.model.id) {
if (this.model.userDef3 == 1) {
obj = addFromDetail(formData)
} else {
obj = addDetail(formData)
}
}else{
obj = editDetail(formData)
}
obj.then((res) => {
if (res.success) {
that.$message.success(res.message)
that.$emit('ok')
} else {
that.$message.warning(res.message)
}
}).finally(() => {
that.confirmLoading = false
that.close()
})
}
})
},
handleCancel () {
this.close()
},
popupCallback(row){
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'))
},
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);
}
})
}
}
}
</script>