cloud-web-corejs 1.0.54-dev.352 → 1.0.54-dev.353
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
<template>
|
2
|
-
<el-tabs
|
2
|
+
<el-tabs
|
3
|
+
v-model="activeName"
|
4
|
+
class="tab-box tab-morenav"
|
5
|
+
@tab-remove="removeTab"
|
6
|
+
@tab-click="tabClick"
|
7
|
+
ref="tabs"
|
8
|
+
>
|
3
9
|
<slot name="default"></slot>
|
4
|
-
<template v-for="(tab,index) in tabs">
|
5
|
-
<slot name="editTab" v-bind="{tab,index,tabs,reloadTabContent}"></slot>
|
10
|
+
<template v-for="(tab, index) in tabs">
|
11
|
+
<slot name="editTab" v-bind="{ tab, index, tabs, reloadTabContent }"></slot>
|
6
12
|
</template>
|
7
13
|
</el-tabs>
|
8
14
|
</template>
|
@@ -13,14 +19,14 @@ export default {
|
|
13
19
|
value: String,
|
14
20
|
paneKeyName: {
|
15
21
|
type: String,
|
16
|
-
default: () => "id"
|
17
|
-
}
|
22
|
+
default: () => "id",
|
23
|
+
},
|
18
24
|
},
|
19
25
|
data() {
|
20
26
|
return {
|
21
27
|
activeName: "0",
|
22
|
-
tabs: []
|
23
|
-
}
|
28
|
+
tabs: [],
|
29
|
+
};
|
24
30
|
},
|
25
31
|
watch: {
|
26
32
|
value(val) {
|
@@ -28,7 +34,7 @@ export default {
|
|
28
34
|
},
|
29
35
|
activeName(val) {
|
30
36
|
this.$emit("input", val);
|
31
|
-
}
|
37
|
+
},
|
32
38
|
},
|
33
39
|
created() {
|
34
40
|
if (this.value) {
|
@@ -36,16 +42,18 @@ export default {
|
|
36
42
|
}
|
37
43
|
},
|
38
44
|
methods: {
|
39
|
-
openEditTab(row,param) {
|
45
|
+
openEditTab(row, param, option) {
|
40
46
|
let paneKeyName = this.paneKeyName;
|
41
|
-
let tab = this.tabs.find(tab => tab.data[paneKeyName] === row[paneKeyName])
|
47
|
+
let tab = this.tabs.find((tab) => tab.data[paneKeyName] === row[paneKeyName]);
|
42
48
|
if (!tab) {
|
49
|
+
let tabParam = option?.tabParam || {};
|
43
50
|
tab = {
|
44
51
|
data: row,
|
45
52
|
showContent: false,
|
46
53
|
dataId: row[paneKeyName],
|
47
|
-
param
|
48
|
-
|
54
|
+
param,
|
55
|
+
...tabParam,
|
56
|
+
};
|
49
57
|
if (this.tabs.length >= 30) {
|
50
58
|
this.tabs.splice(0, 1, tab);
|
51
59
|
} else {
|
@@ -53,10 +61,10 @@ export default {
|
|
53
61
|
}
|
54
62
|
this.$nextTick(() => {
|
55
63
|
let paneName = this.getCurrentPaneName();
|
56
|
-
tab.paneName = paneName
|
57
|
-
})
|
64
|
+
tab.paneName = paneName;
|
65
|
+
});
|
58
66
|
}
|
59
|
-
this.activeName = row[paneKeyName] +
|
67
|
+
this.activeName = row[paneKeyName] + "";
|
60
68
|
tab.showContent = false;
|
61
69
|
setTimeout(() => {
|
62
70
|
tab.showContent = true;
|
@@ -64,12 +72,14 @@ export default {
|
|
64
72
|
},
|
65
73
|
removeTab(targetName) {
|
66
74
|
let paneKeyName = this.paneKeyName;
|
67
|
-
let tabIndex = this.tabs.findIndex(
|
75
|
+
let tabIndex = this.tabs.findIndex(
|
76
|
+
(tab) => tab.data[paneKeyName] + "" === targetName
|
77
|
+
);
|
68
78
|
if (this.activeName === targetName) {
|
69
79
|
if (tabIndex > 0) {
|
70
|
-
this.activeName = this.tabs[tabIndex - 1].data[paneKeyName] +
|
80
|
+
this.activeName = this.tabs[tabIndex - 1].data[paneKeyName] + "";
|
71
81
|
} else {
|
72
|
-
this.activeName =
|
82
|
+
this.activeName = "second";
|
73
83
|
}
|
74
84
|
}
|
75
85
|
if (tabIndex !== -1) {
|
@@ -82,18 +92,19 @@ export default {
|
|
82
92
|
},
|
83
93
|
getCurrntPaneTarget() {
|
84
94
|
let panes = this.$refs.tabs.panes;
|
85
|
-
let target = panes.find(pane => pane.active)
|
95
|
+
let target = panes.find((pane) => pane.active);
|
86
96
|
return target;
|
87
97
|
},
|
88
98
|
reloadTabContent(target, param, tab) {
|
89
|
-
let updateParam =
|
99
|
+
let updateParam =
|
100
|
+
param != null && param.updateParam != null ? param.updateParam : {};
|
90
101
|
for (let key in updateParam) {
|
91
102
|
target.$emit("update:" + key, updateParam[key]);
|
92
103
|
}
|
93
104
|
|
94
105
|
if (!tab) {
|
95
106
|
let activeName = this.activeName;
|
96
|
-
tab = this.tabs.find(item => item.paneName == activeName)
|
107
|
+
tab = this.tabs.find((item) => item.paneName == activeName);
|
97
108
|
}
|
98
109
|
if (tab) {
|
99
110
|
tab.showContent = false;
|
@@ -104,10 +115,8 @@ export default {
|
|
104
115
|
},
|
105
116
|
tabClick(targetName) {
|
106
117
|
this.$emit("tabClick", targetName);
|
107
|
-
}
|
108
|
-
}
|
109
|
-
}
|
118
|
+
},
|
119
|
+
},
|
120
|
+
};
|
110
121
|
</script>
|
111
|
-
<style scoped>
|
112
|
-
|
113
|
-
</style>
|
122
|
+
<style scoped></style>
|