htui-yllkbz 1.5.34 → 1.5.36
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/lib/htui.common.js +35 -33
- package/lib/htui.common.js.gz +0 -0
- package/lib/htui.umd.js +35 -33
- package/lib/htui.umd.js.gz +0 -0
- package/lib/htui.umd.min.js +1 -1
- package/lib/htui.umd.min.js.gz +0 -0
- package/package.json +1 -1
- package/src/packages/HtExport/index.vue +27 -25
- package/src/packages/HtTable/index.vue +2 -2
- package/src/views/About.vue +3 -3
package/lib/htui.umd.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* @Author: hutao
|
|
5
5
|
* @Date: 2021-09-02 09:03:43
|
|
6
6
|
* @LastEditors: hutao
|
|
7
|
-
* @LastEditTime:
|
|
7
|
+
* @LastEditTime: 2024-11-13 14:29:20
|
|
8
8
|
-->
|
|
9
9
|
<template>
|
|
10
|
-
<span @click="exportExcel"
|
|
10
|
+
<span @click="exportExcel"
|
|
11
|
+
v-loading="state.loading">
|
|
11
12
|
<slot :loading="state.loading">
|
|
12
13
|
<el-button type="primary">
|
|
13
14
|
导出Excel
|
|
@@ -16,9 +17,10 @@
|
|
|
16
17
|
</span>
|
|
17
18
|
</template>
|
|
18
19
|
<script lang="ts">
|
|
19
|
-
import { Component, Prop, Vue, Watch } from
|
|
20
|
-
import { AxiosRequestConfig, Method } from
|
|
21
|
-
import { _axios } from
|
|
20
|
+
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
21
|
+
import { AxiosRequestConfig, Method } from "axios";
|
|
22
|
+
import { _axios } from "vue-kst-auth";
|
|
23
|
+
_axios.defaults.timeout = 0;
|
|
22
24
|
/** 设置axios返回类型 */
|
|
23
25
|
Vue.config.productionTip = false;
|
|
24
26
|
interface State {
|
|
@@ -27,7 +29,7 @@ interface State {
|
|
|
27
29
|
canExport?: boolean;
|
|
28
30
|
}
|
|
29
31
|
@Component({
|
|
30
|
-
name:
|
|
32
|
+
name: "HtExport",
|
|
31
33
|
})
|
|
32
34
|
export default class HtExport extends Vue {
|
|
33
35
|
/** 请求方式 */
|
|
@@ -50,9 +52,9 @@ export default class HtExport extends Vue {
|
|
|
50
52
|
/** 方法 */
|
|
51
53
|
/** 手动导出 */
|
|
52
54
|
handelExport(params?: object) {
|
|
53
|
-
let fileName = this.fileName ||
|
|
55
|
+
let fileName = this.fileName || "未知文件名.xlsx";
|
|
54
56
|
let config: AxiosRequestConfig = {
|
|
55
|
-
responseType:
|
|
57
|
+
responseType: "blob",
|
|
56
58
|
params: {},
|
|
57
59
|
};
|
|
58
60
|
if (this.params) {
|
|
@@ -63,28 +65,28 @@ export default class HtExport extends Vue {
|
|
|
63
65
|
config = params;
|
|
64
66
|
}
|
|
65
67
|
if (this.url) {
|
|
66
|
-
if (this.method ===
|
|
68
|
+
if (this.method === "post") {
|
|
67
69
|
this.state.loading = true;
|
|
68
70
|
_axios
|
|
69
|
-
.post(this.url, config, { responseType:
|
|
71
|
+
.post(this.url, config, { responseType: "blob" })
|
|
70
72
|
.then((res) => {
|
|
71
73
|
const content = res.data;
|
|
72
74
|
if (!this.fileName) {
|
|
73
|
-
const headers = res.headers[
|
|
75
|
+
const headers = res.headers["content-disposition"];
|
|
74
76
|
if (!headers) {
|
|
75
|
-
this.$notify.warning(
|
|
77
|
+
this.$notify.warning("暂无数据导出");
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
80
|
fileName = decodeURIComponent(
|
|
79
|
-
headers.split(
|
|
80
|
-
).replace("''",
|
|
81
|
+
headers.split("filename*=UTF-8")[1]
|
|
82
|
+
).replace("''", "");
|
|
81
83
|
}
|
|
82
84
|
const blob = new Blob([content as any]);
|
|
83
|
-
if (
|
|
85
|
+
if ("download" in document.createElement("a")) {
|
|
84
86
|
// 非IE下载
|
|
85
|
-
const elink = document.createElement(
|
|
87
|
+
const elink = document.createElement("a");
|
|
86
88
|
elink.download = fileName;
|
|
87
|
-
elink.style.display =
|
|
89
|
+
elink.style.display = "none";
|
|
88
90
|
elink.href = URL.createObjectURL(blob);
|
|
89
91
|
document.body.appendChild(elink);
|
|
90
92
|
elink.click();
|
|
@@ -101,21 +103,21 @@ export default class HtExport extends Vue {
|
|
|
101
103
|
} else {
|
|
102
104
|
this.state.loading = true;
|
|
103
105
|
_axios
|
|
104
|
-
.get(this.url, { responseType:
|
|
106
|
+
.get(this.url, { responseType: "blob", params: config })
|
|
105
107
|
.then((res) => {
|
|
106
108
|
const content = res.data;
|
|
107
109
|
if (!this.fileName) {
|
|
108
|
-
const headers = res.headers[
|
|
110
|
+
const headers = res.headers["content-disposition"];
|
|
109
111
|
fileName = decodeURIComponent(
|
|
110
|
-
headers.split(
|
|
111
|
-
).replace("''",
|
|
112
|
+
headers.split("filename*=UTF-8")[1]
|
|
113
|
+
).replace("''", "");
|
|
112
114
|
}
|
|
113
115
|
const blob = new Blob([content as any]);
|
|
114
|
-
if (
|
|
116
|
+
if ("download" in document.createElement("a")) {
|
|
115
117
|
// 非IE下载
|
|
116
|
-
const elink = document.createElement(
|
|
118
|
+
const elink = document.createElement("a");
|
|
117
119
|
elink.download = fileName;
|
|
118
|
-
elink.style.display =
|
|
120
|
+
elink.style.display = "none";
|
|
119
121
|
elink.href = URL.createObjectURL(blob);
|
|
120
122
|
document.body.appendChild(elink);
|
|
121
123
|
elink.click();
|
|
@@ -141,7 +143,7 @@ export default class HtExport extends Vue {
|
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
/** 监听 */
|
|
144
|
-
@Watch(
|
|
146
|
+
@Watch("exportBefore", { immediate: true })
|
|
145
147
|
getExportBefore(canExport?: boolean) {
|
|
146
148
|
this.state.canExport = canExport;
|
|
147
149
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @Author: hutao
|
|
5
5
|
* @Date: 2021-11-11 11:23:24
|
|
6
6
|
* @LastEditors: hutao
|
|
7
|
-
* @LastEditTime: 2024-
|
|
7
|
+
* @LastEditTime: 2024-10-22 11:28:41
|
|
8
8
|
-->
|
|
9
9
|
<template>
|
|
10
10
|
<div v-loading="state.loading"
|
|
@@ -701,7 +701,7 @@ export default class HtTable extends Vue {
|
|
|
701
701
|
const allColumns: string | null = window.localStorage.getItem(
|
|
702
702
|
"table_" + this.uuId
|
|
703
703
|
);
|
|
704
|
-
if (allColumns) {
|
|
704
|
+
if (allColumns && JSON.parse(allColumns)?.length) {
|
|
705
705
|
this.state.allColumns = JSON.parse(allColumns);
|
|
706
706
|
this.state.showColumns = JSON.parse(allColumns);
|
|
707
707
|
this.getShowKeys(this.state.allColumns);
|
package/src/views/About.vue
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @Author: hutao
|
|
5
5
|
* @Date: 2021-11-15 14:41:40
|
|
6
6
|
* @LastEditors: hutao
|
|
7
|
-
* @LastEditTime: 2024-
|
|
7
|
+
* @LastEditTime: 2024-10-22 17:11:12
|
|
8
8
|
-->
|
|
9
9
|
<template>
|
|
10
10
|
<div>
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
<div ref="ht-pdf">
|
|
40
40
|
<HtTable :data="state.data"
|
|
41
41
|
:showFilter="true"
|
|
42
|
-
:uuId="'
|
|
42
|
+
:uuId="'dhjsgdshg8989353334'"
|
|
43
43
|
:configShow="true"
|
|
44
|
-
:checked="
|
|
44
|
+
:checked="true"
|
|
45
45
|
:isExpand="false"
|
|
46
46
|
:height="500"
|
|
47
47
|
:columns="state.columns">
|