index.vue
3.64 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
137
138
139
140
141
142
143
144
145
146
147
<template>
<el-popover
:popper-class="`popper${dataKey}${rowData.declareId} portLogPopper`"
placement="left"
:visible-arrow="false"
title=""
width="750"
trigger="manual"
v-model="rowData[`${dataKey}PopoverType`]"
>
<div style="text-align: right">
<i
class="el-icon-close"
style="cursor: pointer; font-size: 20px; font-weight: 700"
@click.stop="popoverClose"
></i>
</div>
<div v-loading="rowData.popoverLoading">
<slot name="title"></slot>
<Table
class="fedexDetialTable mt20"
:data="rowData[`${dataKey}PopoverData`]"
:headerData="receiptDataHead"
:selection="false"
:selectFixed="false"
:order="false"
:border="true"
:rowSelectDataType="false"
:pagination="false"
:page="1"
:pageSizes="[20, 30, 50, 100]"
:totalCount="0"
:emptyText="$t('portEntry.emptyText')"
height="350px"
maxHeight="500px"
rowKey="id"
>
</Table>
</div>
<el-button
slot="reference"
type="text"
@click.stop="popoverChange(rowData, dataKey)"
>
<slot name="buttonLabel"></slot>
</el-button>
</el-popover>
</template>
<script>
export default {
props: {
dataKey: {
type: String,
default: "",
},
rowData: {
tpye: Object,
default: null,
},
tableData: {
type: Array,
default() {
return [];
},
},
receiptDataHead: {
type: Array,
default() {
return [];
},
},
parentDom: {
type: Object,
default: null,
},
},
data() {
return {};
},
methods: {
//弹框关闭
popoverClose() {
this.$emit("popoverClose");
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY = "auto";
},
//弹框状态改版
popoverChange(data, type) {
this.popoverClose();
let arr = JSON.parse(JSON.stringify(this.tableData));
arr.forEach((item) => {
item[`${type}PopoverData`] = [];
if (data.declareId != item.declareId) {
// item[`${type}PopoverLoading`] = false;
item[`${type}PopoverType`] = false;
} else {
// item[`${type}PopoverLoading`] = true;
item[`${type}PopoverType`] = !JSON.parse(
JSON.stringify(item[`${type}PopoverType`])
);
}
});
if (!data[`${type}PopoverType`]) {
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY =
"hidden";
} else {
this.parentDom.$refs.tables.$refs.bodyWrapper.style.overflowY = "auto";
}
this.$emit("popoverChange", {
tableData: arr,
data: data,
type: !data[`${type}PopoverType`],
status: type,
});
this.$nextTick(() => {
document.getElementsByClassName("el-table__row").forEach((dom1, i) => {
if (i == data.index) {
dom1.classList.add("activeRow");
} else {
dom1.classList.remove("hover-row");
dom1.classList.remove("activeRow");
}
});
let interval = setInterval(() => {
if (
document.getElementsByClassName(`popper${type}${data.declareId}`)
.length == 1
) {
clearInterval(interval);
}
document
.getElementsByClassName(`popper${type}${data.declareId}`)
.forEach((dom, index) => {
if (index > 0) {
dom.style.display = "none";
dom.remove();
}
});
}, 100);
});
},
},
};
</script>
<style></style>