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
<template>
<el-dialog :visible.sync="showFlag" width="800px" center title="按期数导出收货信息">
<el-form label-width="150px">
<el-form-item label="期数">
<el-cascader
:options="goodsList"
:props="{value:'id',label:'name'}"
@active-item-change="handleItemChange"
@change="changePeriods"
v-model="selectedGoods"
></el-cascader>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelClick">取 消</el-button>
<el-button type="primary" @click="onAdd">确 定</el-button>
</span>
</el-dialog>
</template>
<script>
import { getPeriodsApi, exportReceiveInfoApi } from "../../service/api";
export default {
name: "receiveInfoDialog",
props: ["showFlag", "goodsList", "cancelEvent", "sureEvent"],
data() {
return {
selectedGoods: []
};
},
methods: {
cancelClick() {
this.cancelEvent();
},
onAdd() {
if (this.periods && this.periods.id) {
this.exportReceiveInfo().then(() => {
this.sureEvent();
});
} else {
Vue.prototype.$msgbox({
message: "请选择期数",
type: "warning"
});
}
},
exportReceiveInfo() {
return exportReceiveInfoApi(this.periods.id);
},
changePeriods(data) {
if (data.length > 1) {
this.goods_id = data[0];
let nowGoods = this.goodsList.find(i => {
return i.id === data[0];
});
this.periods = nowGoods.children.find(i => {
return i.id === data[1];
});
}
},
handleItemChange(val) {
getPeriodsApi({ goods_id: val[0], limit: 100 }).then(res => {
res.list.forEach(i => {
i.name = i.title;
});
this.goodsList.find(i => {
return i.id === val[0];
}).children = res.list;
});
}
}
};
</script>