waveDialog.vue
2.67 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
<template>
<el-dialog
title="加入波次"
:visible.sync="visible"
:showaddwave="showaddwave"
width="500px"
append-to-body
@close="$emit('update:showaddwave', false)"
@open="diaOpen"
>
<el-form ref="waveForm" :model="waveForm" :rules="waverules" label-width="100px">
<el-form-item label="波次主表:" prop="code">
<el-select v-model="waveForm.code" placeholder="请选择" :style="{width: '100%'}">
<el-option
v-for="attr in waveOptions"
:key="attr.code"
:value="attr.code"
:label="attr.name"
/>
</el-select>
</el-form-item>
<el-form-item label="波次名称:" prop="name">
<el-input v-model="waveForm.name" placeholder="请输入波次名称" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确定</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { getWaveselect,addwavesure} from "@/api/shipment/shipmentHeader/header";
export default {
props: {
showaddwave: {
type: Boolean,
default: false
},
id:{
type: String
}
},
data() {
return {
visible: this.showaddwave,
waveOptions: [],
waveForm: {
code:'',
ids:''
},
waverules: {
code:[{ required: true, message: '请选择波次主表', trigger: ['blur','change'] }],
name:[{ required: true, message: '请输入波次名称', trigger: ['blur','change'] }],
},
}
},
watch: {
showaddwave() {
this.visible = this.showaddwave
}
},
created() {
//波次select下拉接口获取
getWaveselect().then(response => {
this.waveOptions = response.rows
});
},
methods: {
diaOpen() {
this.resetForm('waveForm')
},
submitForm() {
let thisInfo=this;
this.$refs["waveForm"].validate((valid) => {
if (valid) {
this.waveForm.ids=thisInfo.$props.id
addwavesure(this.waveForm).then(response=>{
if(response.code == 200) {
this.msgSuccess(response.msg)
this.visible = false
this.$parent.getHeaderList()
}else {
this.msgError(response.msg)
}
})
} else {
return false;
}
});
},
cancel() {
this.resetForm('waveForm')
this.visible = false
}
}
}
</script>
<style lang="scss" scoped>
</style>