PurchaseInModal.vue
7.54 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<template>
<a-modal
:title="title"
:width="800"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭"
wrapClassName="ant-modal-cust-warp"
style="top:5%;height: 85%;overflow-y: hidden">
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="物料编码">
<a-input placeholder="请输入物料编码" disabled="false" v-decorator="['materialCode']" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="名称">
<a-input placeholder="请输入名称" disabled="false" v-decorator="[ 'materialName' ]" />
</a-form-item>
<!--
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="规格">
<a-input placeholder="请输入规格" v-decorator="[ 'spec' ]" />
</a-form-item>
-->
<!-- <a-form-item-->
<!-- :labelCol="labelCol"-->
<!-- :wrapperCol="wrapperCol"-->
<!-- label="单位">-->
<!-- <a-input placeholder="请输入单位" disabled="false" v-decorator="[ 'unit' ]" />-->
<!-- </a-form-item>-->
<!-- <a-form-item-->
<!-- :labelCol="labelCol"-->
<!-- :wrapperCol="wrapperCol"-->
<!-- label="数量">-->
<!-- <a-input placeholder="请输入数量" disabled="false" v-decorator="[ 'qty' ]" />-->
<!-- </a-form-item>-->
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="采购单号">
<a-input placeholder="请输入采购单号" disabled="false" v-decorator="['code']" />
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="状态">
<a-select
v-model="status" disabled="false" >
<a-select-option v-for="item in statusList" :key="item.value" :value="item.value">{{ item.text }}</a-select-option>
</a-select>
</a-form-item>
<!-- <a-form-item-->
<!-- :labelCol="labelCol"-->
<!-- :wrapperCol="wrapperCol"-->
<!-- label="供应商">-->
<!-- <a-input placeholder="请输入供应商" disabled="false" ref="" v-decorator="['supplier']" />-->
<!-- </a-form-item>-->
<!-- <a-form-item-->
<!-- :labelCol="labelCol"-->
<!-- :wrapperCol="wrapperCol"-->
<!-- label="联系人">-->
<!-- <a-input placeholder="请输入联系人" disabled="false" v-decorator="['contact']" />-->
<!-- </a-form-item>-->
<!-- <a-form-item-->
<!-- :labelCol="labelCol"-->
<!-- :wrapperCol="wrapperCol"-->
<!-- label="联系方式">-->
<!-- <a-input placeholder="请输入联系方式" disabled="false" v-decorator="['phone']" />-->
<!-- </a-form-item>-->
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="初次计划完成时间">
<a-date-picker disabled="false"
v-decorator="['planEndTime']"
type="date"
/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="变更计划完成时间">
<a-date-picker
v-decorator="['changePlanEndTime']"
type="date"
/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="实际结束时间">
<a-date-picker disabled="false"
v-decorator="['actualEndTime']"
type="date"
/>
</a-form-item>
<a-form-item
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="备注">
<a-input v-decorator="['remark']" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { editPurchase, ajaxGetDictItems } from '../../../api/api'
export default {
name: 'PurchaseInModal',
data () {
return {
title:"操作",
visible: false,
bomDisabled: false,
model: {},
designType: '',
wipType: '',
method: '',
categories: '',
remark: '',
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
confirmLoading: false,
form: this.$form.createForm(this),
methodList: {},
wipTypeList: {},
designTypeList: {},
categoryList: {},
statusList:[],
status:''
}
},
computed() {
},
created() {
this.loadBaseData();
},
methods: {
loadBaseData() {
ajaxGetDictItems('purchased_status').then((res)=> {
if (res.success) {
this.statusList = res.result
}
})
},
add () {
this.edit({});
},
edit (record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
//编辑页面禁止修改角色编码
if(this.model.id){
this.bomDisabled = true;
}else{
this.bomDisabled = false;
}
this.$nextTick(() => {
this.form.setFieldsValue({
materialCode: this.model.materialCode,
materialName: this.model.materialName,
qty: this.model.qty,
unit: this.model.unit,
method: this.model.method,
planStartTime: this.model.planStartTime,
planEndTime: this.model.planEndTime,
actualStartTime: this.model.actualStartTime,
actualEndTime: this.model.actualEndTime,
contact: this.model.contact,
status: this.model.status,
changePlanEndTime:this.model.changePlanEndTime,
code: this.model.code
})
});
this.method = this.model.method
this.designType=this.model.designType
this.wipType =this.model.wipType
this.drawingNo=this.model.drawingNo
this.categories=this.model.categories
this.remark = this.model.remark
this.status = this.model.status
this.supplier = this.model.supplier
},
close () {
this.$emit('close');
this.visible = false;
},
handleOk () {
const that = this;
// 触发表单验证
this.form.validateFields((err, values) => {
// alert('ddd')
if (!err) {
that.confirmLoading = true;
let formData = Object.assign(this.model, values);
editPurchase(formData).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
// alert('23343')
that.confirmLoading = false;
that.close();
})
}
})
},
handleCancel () {
this.close()
},
validateRoleCode(rule, value, callback){
if(/[\u4E00-\u9FA5]/g.test(value)){
callback("角色编码不可输入汉字!");
}else{
var params = {
tableName: "sys_role",
fieldName: "role_code",
fieldVal: value,
dataId: this.model.id,
};
duplicateCheck(params).then((res)=>{
if(res.success){
callback();
}else{
callback(res.message);
}
});
}
}
}
}
</script>
<style scoped>
</style>