waveDialog.vue
1.87 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
<template>
<el-dialog
title="加入波次"
:visible.sync="visible"
:showaddwave="showaddwave"
width="500px"
append-to-body
@close="$emit('update:showaddwave', false)"
>
<el-form ref="waveForm" :model="waveForm" :rules="waverules" label-width="80px">
<el-form-item label="请选择:" prop="code">
<el-select v-model="waveForm.code" placeholder="请选择" :style="{width: '100%'}">
<el-option
v-for="dict in materialOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm('waveForm')">确定</el-button>
<el-button @click="resetForm('waveForm')">取消</el-button>
</div>
</el-dialog>
</template>
<script>
// import { importTemplate } from ''@/api/shipment/shipmentHeader'
export default {
props: {
showaddwave: {
type: Boolean,
default: false
}
},
data() {
return {
visible: this.showaddwave,
waveForm: {
code:'',
},
waverules: {
code:[{ required: true, message: '请选择', trigger: ['blur','change'] }],
}
}
},
watch: {
showaddwave() {
this.visible = this.showaddwave
}
},
methods: {
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
alert('submit!');
this.visible = false
} else {
console.log('error submit!!');
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.visible = false
}
}
}
</script>
<style lang="scss" scoped>
</style>