data-preview.vue
2.97 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<template>
<el-dialog
class="entryDialog classCUploadDialog"
:title="dataPreviewTitle"
:visible.sync="batchModifyVisible"
:show-close="false"
width="700px"
:close-on-click-modal="false"
>
<div style="margin-bottom: 10px">
<span>
提运单号 数量:<strong>{{ tableData.length }}</strong>
</span>
<span style="margin-left: 20px">
物流运单编号 数量:<strong>{{ selectedDatas.length }}</strong>
</span>
</div>
<Table
class="fedexDetialTable fedexSreachTable"
ref="entryTable"
:data="tableData"
:headerData="headerData"
:border="true"
:pagination="false"
:order="false"
>
</Table>
<div class="dialogOption entrySave revokeOperation">
<el-button
class="entrySaveButton entrySaveButton-background revokeSubmitBtn"
type="primary"
@click="formSubmit"
>
确定
</el-button>
<el-button class="entrySaveButton" @click="cancelModify">关闭</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
props: {
showDialog: {
type: Boolean,
default: false,
},
dataPreviewTitle: {
type: String,
default: "预览",
},
selectedDatas: {
type: Array,
default: () => [],
},
},
data() {
return {
headerData: [
{
name: "提运单号",
value: "billNo",
width: "180px",
align: "left",
},
{
name: "物流运单编号",
value: "logisticsWaybillNumber",
width: "",
align: "left",
},
],
tableData: [],
batchModifyVisible: false,
};
},
watch: {
showDialog(val) {
if (val) {
this.batchModifyVisible = val;
this.tableData = this.processWaybills(this.selectedDatas);
}
},
},
created() {},
methods: {
processWaybills(data) {
if (!Array.isArray(data)) {
throw new Error("输入参数必须是数组");
}
return Array.from(
data.reduce((map, item) => {
const key = item.billNo;
if (!map.has(key)) {
map.set(key, {
billNo: key,
logisticsWaybillNumber: [],
});
}
if (item.logisticsWaybillNumber) {
map
.get(key)
.logisticsWaybillNumber.push(item.logisticsWaybillNumber);
}
return map;
}, new Map()),
([_, value]) => ({
...value,
logisticsWaybillNumber: value.logisticsWaybillNumber.join(","),
})
);
},
formSubmit() {
this.cancelModify(1);
},
cancelModify(val) {
this.batchModifyVisible = false;
this.$emit("cancelDataPreview", val);
},
},
};
</script>
<style lang="scss" scoped>
@import "@/assets/styles/variables.scss";
.revokeOperation {
margin-bottom: 25px;
.revokeSubmitBtn {
margin-right: 30px;
}
}
</style>