LocationBatchAreaModal.vue
2.13 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
<template>
<a-modal
:title="title"
:width="900"
:visible="visible"
:maskClosable="false"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel">
<a-spin :spinning="confirmLoading">
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model">
<!-- 主表单区域 -->
<a-row class="form-row" :gutter="0">
<a-col :span="24">
<a-form-model-item label="物料分区存放" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialAreaCode">
<a-input v-model="model.materialAreaCode" placeholder="请输入物料分区存放"></a-input>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
import {batchMaterialArea} from '@/api/api'
export default {
name: 'LocationBatchAreaModal',
components: {
},
data() {
return {
title: '',
width: 800,
visible: false,
disableSubmit: false,
confirmLoading: false,
labelCol: {
xs: {span: 24},
sm: {span: 6}
},
wrapperCol: {
xs: {span: 24},
sm: {span: 24 - 6}
},
model: {},
}
},
methods: {
edit(record) {
console.log(record);
this.visible = true
this.model.ids=record;
},
handleOk() {
this.submitForm()
},
handleCancel() {
this.close()
},
submitForm() {
// 触发表单验证
this.$refs.form.validate(valid => {
if (valid) {
this.confirmLoading = true;
let params = {
ids: this.model.ids,
materialAreaCode: this.model.materialAreaCode,
}
batchMaterialArea(params).then((res) => {
this.confirmLoading = false;
if (res.success) {
this.$emit('ok');
this.visible = false;
}else{
this.$message.error(res.message);
}
});
}
})
},
close() {
this.$emit('close')
this.visible = false
this.$refs.form.clearValidate()
},
}
}
</script>