inventoryoutDialog.vue
2.81 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
<template>
<el-dialog
title="库存出库"
:visible.sync="visible"
:showinventoryout="showinventoryout"
width="500px"
append-to-body
@close="$emit('update:showinventoryout', false)"
@open="diaOpen"
>
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
<el-form-item label="库存明细id">
<el-input v-model="ruleForm.inventoryDetailId" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="数量" prop="qty">
<el-input v-model="ruleForm.qty"></el-input>
</el-form-item>
<el-form-item label="站台">
<el-select v-model="ruleForm.station" placeholder="请选择" style="width:100%">
<el-option
v-for="item in stationOptions"
:key="item.id"
:label="item.name"
:value="item.code"
></el-option>
</el-select>
</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 { detailOutShipment } from "@/api/inventory/inventoryHeader/detail";
import { queryList } from "@/api/config/InventoryInfo/station";
export default {
props: {
showinventoryout: {
type: Boolean,
default: false,
},
detailId: {
type: Array,
default: () => []
}
},
data() {
return {
visible: this.showinventoryout,
stationOptions: [],
ruleForm: {
inventoryDetailId: this.detailId,
qty: null,
station: "",
},
rules: {
qty: [
{
required: true,
message: "数量不能为空",
trigger: ["blur", "change"],
},
{
type: 'number',
message: "只能数字",
trigger: ["blur", "change"],
},
],
},
};
},
watch: {
showinventoryout() {
this.visible = this.showinventoryout;
},
},
created() {
queryList().then((response) => {
this.stationOptions = response.rows
})
},
methods: {
diaOpen() {
this.resetForm("ruleForm");
},
submitForm() {
this.$refs["ruleForm"].validate((valid) => {
if (valid) {
detailOutShipment(this.ruleForm).then((response) => {
if (response.code == 200) {
this.msgSuccess(response.msg);
this.visible = false;
} else {
this.msgError(response.msg);
}
});
} else {
return false;
}
});
},
cancel() {
this.resetForm("ruleForm");
this.visible = false;
},
},
};
</script>