zkqh-lagrange-utils 0.0.55 → 0.0.57
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 +74 -74
- package/src/service/export_plugin/PluginLocalExport.vue +230 -258
- package/src/service/export_plugin/api/index.js +6 -6
- package/src/service/export_plugin/api/plugin-bridge.js +154 -154
- package/src/service/export_plugin/api/plugin.js +95 -95
- package/src/service/export_plugin/hooks/use-plugin-health.js +105 -102
- package/src/service/export_plugin/index.js +16 -18
- package/src/service/export_plugin/internal/create-folder-modal.vue +105 -105
- package/src/service/export_plugin/internal/export-task-modal.vue +123 -149
- package/src/service/export_plugin/internal/plugin-dir-select.vue +315 -315
- package/src/service/export_plugin/internal/styles/base.less +11 -0
- package/src/service/export_plugin/internal/styles/export-plugin-modals.less +4 -4
- package/src/service/export_plugin/internal/styles/plugin-dir-select.less +85 -85
- package/src/service/export_plugin/internal/styles/plugin-local-export.less +68 -65
- package/src/service/export_plugin/utils/export-task.js +58 -49
- package/src/service/export_plugin/utils/plugin-dir.js +101 -101
- package/src/service/export_plugin/utils/size.js +41 -41
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "zkqh-lagrange-utils",
|
|
3
|
-
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "vite build",
|
|
9
|
-
"gen-style": "node ./scripts/generate-naiveui-common-style.mjs"
|
|
10
|
-
},
|
|
11
|
-
"main": "dist/lagrange-utils.umd.cjs",
|
|
12
|
-
"module": "dist/lagrange-utils.js",
|
|
13
|
-
"sideEffects": [
|
|
14
|
-
"*.css"
|
|
15
|
-
],
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"import": "./dist/lagrange-utils.js",
|
|
19
|
-
"require": "./dist/lagrange-utils.umd.cjs"
|
|
20
|
-
},
|
|
21
|
-
"./export_plugin": {
|
|
22
|
-
"import": "./src/service/export_plugin/index.js",
|
|
23
|
-
"default": "./src/service/export_plugin/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./export_plugin/api": {
|
|
26
|
-
"import": "./src/service/export_plugin/api/index.js",
|
|
27
|
-
"default": "./src/service/export_plugin/api/index.js"
|
|
28
|
-
},
|
|
29
|
-
"./style.css": {
|
|
30
|
-
"default": "./dist/style.css"
|
|
31
|
-
},
|
|
32
|
-
"./assets/*": "./dist/assets/*",
|
|
33
|
-
"./assets/css/*": "./dist/assets/css/*",
|
|
34
|
-
"./assets/font/*": "./dist/assets/font/*",
|
|
35
|
-
"./assets/image/*": "./dist/assets/image/*",
|
|
36
|
-
"./postcss.config.js": {
|
|
37
|
-
"import": "./postcss.config.js",
|
|
38
|
-
"require": "./postcss.config.cjs",
|
|
39
|
-
"default": "./postcss.config.js"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"files": [
|
|
43
|
-
"dist",
|
|
44
|
-
"assets",
|
|
45
|
-
"src/service",
|
|
46
|
-
"postcss.config.js",
|
|
47
|
-
"postcss.config.cjs"
|
|
48
|
-
],
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"autoprefixer": "^10.4.22",
|
|
51
|
-
"axios": "^1.18.1",
|
|
52
|
-
"postcss-pxtorem": "^6.1.0",
|
|
53
|
-
"vue": "^3.3.0"
|
|
54
|
-
},
|
|
55
|
-
"peerDependencies": {
|
|
56
|
-
"naive-ui": "^2.40.0",
|
|
57
|
-
"vue": "^3.3.0"
|
|
58
|
-
},
|
|
59
|
-
"peerDependenciesMeta": {
|
|
60
|
-
"naive-ui": {
|
|
61
|
-
"optional": true
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@vitejs/plugin-vue": "^5.0.4",
|
|
66
|
-
"@vitejs/plugin-vue-jsx": "^3.0.2",
|
|
67
|
-
"less": "^4.4.2",
|
|
68
|
-
"naive-ui": "2.43.1",
|
|
69
|
-
"vite": "^5.4.10",
|
|
70
|
-
"vite-plugin-static-copy": "^0.17.0"
|
|
71
|
-
},
|
|
72
|
-
"author": "zkqh-ddh",
|
|
73
|
-
"license": "MIT"
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "zkqh-lagrange-utils",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.57",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"gen-style": "node ./scripts/generate-naiveui-common-style.mjs"
|
|
10
|
+
},
|
|
11
|
+
"main": "dist/lagrange-utils.umd.cjs",
|
|
12
|
+
"module": "dist/lagrange-utils.js",
|
|
13
|
+
"sideEffects": [
|
|
14
|
+
"*.css"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/lagrange-utils.js",
|
|
19
|
+
"require": "./dist/lagrange-utils.umd.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./export_plugin": {
|
|
22
|
+
"import": "./src/service/export_plugin/index.js",
|
|
23
|
+
"default": "./src/service/export_plugin/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./export_plugin/api": {
|
|
26
|
+
"import": "./src/service/export_plugin/api/index.js",
|
|
27
|
+
"default": "./src/service/export_plugin/api/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./style.css": {
|
|
30
|
+
"default": "./dist/style.css"
|
|
31
|
+
},
|
|
32
|
+
"./assets/*": "./dist/assets/*",
|
|
33
|
+
"./assets/css/*": "./dist/assets/css/*",
|
|
34
|
+
"./assets/font/*": "./dist/assets/font/*",
|
|
35
|
+
"./assets/image/*": "./dist/assets/image/*",
|
|
36
|
+
"./postcss.config.js": {
|
|
37
|
+
"import": "./postcss.config.js",
|
|
38
|
+
"require": "./postcss.config.cjs",
|
|
39
|
+
"default": "./postcss.config.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist",
|
|
44
|
+
"assets",
|
|
45
|
+
"src/service",
|
|
46
|
+
"postcss.config.js",
|
|
47
|
+
"postcss.config.cjs"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"autoprefixer": "^10.4.22",
|
|
51
|
+
"axios": "^1.18.1",
|
|
52
|
+
"postcss-pxtorem": "^6.1.0",
|
|
53
|
+
"vue": "^3.3.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"naive-ui": "^2.40.0",
|
|
57
|
+
"vue": "^3.3.0"
|
|
58
|
+
},
|
|
59
|
+
"peerDependenciesMeta": {
|
|
60
|
+
"naive-ui": {
|
|
61
|
+
"optional": true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
66
|
+
"@vitejs/plugin-vue-jsx": "^3.0.2",
|
|
67
|
+
"less": "^4.4.2",
|
|
68
|
+
"naive-ui": "2.43.1",
|
|
69
|
+
"vite": "^5.4.10",
|
|
70
|
+
"vite-plugin-static-copy": "^0.17.0"
|
|
71
|
+
},
|
|
72
|
+
"author": "zkqh-ddh",
|
|
73
|
+
"license": "MIT"
|
|
74
|
+
}
|
|
@@ -1,258 +1,230 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="usePlatformExport || usePluginExport"
|
|
4
|
-
class="plugin_local_export"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class="
|
|
9
|
-
<span
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<div
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
class="
|
|
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
|
-
class="
|
|
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
|
-
import
|
|
76
|
-
import
|
|
77
|
-
import
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
const onTaskModalSuccess = () => {
|
|
232
|
-
showTaskModal.value = false
|
|
233
|
-
emit("success", { mode: "plugin", dirname: dirname.value })
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return {
|
|
237
|
-
dirname,
|
|
238
|
-
kind,
|
|
239
|
-
args,
|
|
240
|
-
getToken,
|
|
241
|
-
getUrl,
|
|
242
|
-
validateArgs,
|
|
243
|
-
showTaskModal,
|
|
244
|
-
pluginReady,
|
|
245
|
-
usePlatformExport,
|
|
246
|
-
usePluginExport,
|
|
247
|
-
diskOverflow,
|
|
248
|
-
pluginExportDisabled,
|
|
249
|
-
pluginButtonTitle,
|
|
250
|
-
onDiskInfoUpdate,
|
|
251
|
-
onInstall,
|
|
252
|
-
onPlatformExportClick,
|
|
253
|
-
onPluginExportClick,
|
|
254
|
-
onTaskModalSuccess,
|
|
255
|
-
}
|
|
256
|
-
},
|
|
257
|
-
})
|
|
258
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
v-if="usePlatformExport || usePluginExport"
|
|
4
|
+
class="plugin_local_export"
|
|
5
|
+
:class="{ _platform: usePlatformExport }">
|
|
6
|
+
<!-- 平台 / 应用小文件导出区 -->
|
|
7
|
+
<template v-if="usePlatformExport">
|
|
8
|
+
<span class="_ple_tip lc_fs_m">文件小于50MB,请直接导出!</span>
|
|
9
|
+
<span
|
|
10
|
+
class="_ple_action lc_btn_primary lc_btn_m"
|
|
11
|
+
@click="onPlatformExportClick">
|
|
12
|
+
导 出
|
|
13
|
+
</span>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<!-- 插件本地目录导出区 -->
|
|
17
|
+
<template v-if="usePluginExport">
|
|
18
|
+
<div class="_ple_label lc_fs_m">选择本地目录</div>
|
|
19
|
+
<div
|
|
20
|
+
v-if="pluginReady && diskOverflow"
|
|
21
|
+
class="_ple_warn lc_fs_s">
|
|
22
|
+
<i class="lc lc-warning-circle-outlined"></i>
|
|
23
|
+
<span>预估大小超出本地目录剩余空间,请更换目录或缩小导出范围</span>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div
|
|
27
|
+
v-if="!pluginReady"
|
|
28
|
+
class="_ple_row">
|
|
29
|
+
<n-tree-select
|
|
30
|
+
size="small"
|
|
31
|
+
disabled
|
|
32
|
+
placeholder="安装插件后可选择导出文件"
|
|
33
|
+
:options="[]" />
|
|
34
|
+
<span
|
|
35
|
+
class="lc_btn_primary lc_btn_m _ple_install"
|
|
36
|
+
@click="onInstall">
|
|
37
|
+
立即安装插件
|
|
38
|
+
</span>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div
|
|
42
|
+
v-else
|
|
43
|
+
class="_ple_row">
|
|
44
|
+
<PluginDirSelect
|
|
45
|
+
v-model="dirname"
|
|
46
|
+
@update:disk-info="onDiskInfoUpdate" />
|
|
47
|
+
<div class="_ple_action">
|
|
48
|
+
<span
|
|
49
|
+
class="lc_btn_primary lc_btn_m"
|
|
50
|
+
:class="{ _disabled: pluginExportDisabled }"
|
|
51
|
+
:title="pluginButtonTitle"
|
|
52
|
+
@click="onPluginExportClick">
|
|
53
|
+
导 出
|
|
54
|
+
</span>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<!-- 插件导出:任务名称弹窗(内置) -->
|
|
60
|
+
<ExportTaskModal
|
|
61
|
+
v-if="showTaskModal"
|
|
62
|
+
:kind="kind"
|
|
63
|
+
:args="args"
|
|
64
|
+
:dirname="dirname"
|
|
65
|
+
@success="onTaskModalSuccess"
|
|
66
|
+
@close="showTaskModal = false" />
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
/** 组件自带 token / 按钮 / 字号,不依赖宿主全局样式 */
|
|
72
|
+
import "./internal/styles/plugin-local-export.less"
|
|
73
|
+
import "zkqh-lagrange-utils/assets/font/iconfont-lc.css"
|
|
74
|
+
import { defineComponent, ref, computed, toRefs, onMounted } from "vue"
|
|
75
|
+
import PluginDirSelect from "./internal/plugin-dir-select.vue"
|
|
76
|
+
import ExportTaskModal from "./internal/export-task-modal.vue"
|
|
77
|
+
import { usePluginHealth } from "./hooks/use-plugin-health.js"
|
|
78
|
+
import { isOverSizeLimit, isPreviewOverflowDisk } from "./utils/size.js"
|
|
79
|
+
import { validateTimeRangeArgs } from "./utils/export-task.js"
|
|
80
|
+
|
|
81
|
+
const DEFAULT_PREVIEW = {
|
|
82
|
+
show: false,
|
|
83
|
+
totalSize: 0,
|
|
84
|
+
exportDisabled: false,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* 本地导出组合区:平台/应用小文件导出 + 插件目录导出 + 50MB 分流 + 任务弹窗
|
|
89
|
+
* token / url / 校验 / 安装包地址均内置,宿主无需传入
|
|
90
|
+
*/
|
|
91
|
+
export default defineComponent({
|
|
92
|
+
name: "PluginLocalExport",
|
|
93
|
+
components: { PluginDirSelect, ExportTaskModal },
|
|
94
|
+
props: {
|
|
95
|
+
/**
|
|
96
|
+
* 预览与分流控制
|
|
97
|
+
* @type {{ show?: boolean, totalSize?: number, exportDisabled?: boolean }}
|
|
98
|
+
*/
|
|
99
|
+
previewInfo: {
|
|
100
|
+
type: Object,
|
|
101
|
+
default: () => ({ ...DEFAULT_PREVIEW }),
|
|
102
|
+
},
|
|
103
|
+
/** 导出 kind(插件 createExport 用) */
|
|
104
|
+
kind: { type: String, default: "event" },
|
|
105
|
+
/** 筛选参数(插件 createExport 用) */
|
|
106
|
+
args: { type: Object, default: () => ({}) },
|
|
107
|
+
},
|
|
108
|
+
emits: ["success"],
|
|
109
|
+
setup(props, { emit }) {
|
|
110
|
+
const { previewInfo, kind, args } = toRefs(props)
|
|
111
|
+
const dirname = ref("")
|
|
112
|
+
const diskInfo = ref({ total_size: 0, used_size: 0 })
|
|
113
|
+
const showTaskModal = ref(false)
|
|
114
|
+
|
|
115
|
+
const { pluginReady, checkHealth, triggerInstall } = usePluginHealth()
|
|
116
|
+
|
|
117
|
+
onMounted(() => {
|
|
118
|
+
checkHealth()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
const preview = computed(() => ({
|
|
122
|
+
...DEFAULT_PREVIEW,
|
|
123
|
+
...(previewInfo.value || {}),
|
|
124
|
+
}))
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 是否展示平台/应用导出区(≤50MB)
|
|
128
|
+
*/
|
|
129
|
+
const usePlatformExport = computed(() => {
|
|
130
|
+
const info = preview.value
|
|
131
|
+
if (!info.show || info.exportDisabled) return false
|
|
132
|
+
const size = Number(info.totalSize) || 0
|
|
133
|
+
if (size <= 0) return false
|
|
134
|
+
return !isOverSizeLimit(size)
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 是否展示插件导出区
|
|
139
|
+
* - show=false:始终插件
|
|
140
|
+
* - show=true:已可导出且 >50MB
|
|
141
|
+
*/
|
|
142
|
+
const usePluginExport = computed(() => {
|
|
143
|
+
const info = preview.value
|
|
144
|
+
if (!info.show) return true
|
|
145
|
+
if (info.exportDisabled) return false
|
|
146
|
+
const size = Number(info.totalSize) || 0
|
|
147
|
+
if (size <= 0) return false
|
|
148
|
+
return isOverSizeLimit(size)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
/** 插件路径:预览大小是否超出当前目录剩余空间 */
|
|
152
|
+
const diskOverflow = computed(() => {
|
|
153
|
+
if (!pluginReady.value || !usePluginExport.value) return false
|
|
154
|
+
const info = preview.value
|
|
155
|
+
if (!info.show) return false
|
|
156
|
+
return isPreviewOverflowDisk(info.totalSize, diskInfo.value)
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
const pluginExportDisabled = computed(() => {
|
|
160
|
+
if (!pluginReady.value) return true
|
|
161
|
+
if (!dirname.value) return true
|
|
162
|
+
if (diskOverflow.value) return true
|
|
163
|
+
return false
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
const pluginButtonTitle = computed(() => {
|
|
167
|
+
if (!pluginReady.value) return "请先安装并启动导出插件"
|
|
168
|
+
if (!dirname.value) return "请选择本地导出目录"
|
|
169
|
+
if (diskOverflow.value) return "预估大小超出本地目录剩余空间,无法导出"
|
|
170
|
+
return ""
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
const onDiskInfoUpdate = (info) => {
|
|
174
|
+
diskInfo.value = info || { total_size: 0, used_size: 0 }
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const onInstall = () => {
|
|
178
|
+
triggerInstall()
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** 平台/应用路径:确认后回调 */
|
|
182
|
+
const onPlatformExportClick = () => {
|
|
183
|
+
const exportArgs = { ...(args.value || {}) }
|
|
184
|
+
if (!validateTimeRangeArgs(exportArgs)) return
|
|
185
|
+
|
|
186
|
+
window.$dialog?.warning?.({
|
|
187
|
+
title: "确认导出",
|
|
188
|
+
content: "确认按当前筛选条件通过平台打包下载?",
|
|
189
|
+
positiveText: "确认",
|
|
190
|
+
negativeText: "取消",
|
|
191
|
+
onPositiveClick: () => {
|
|
192
|
+
emit("success", { mode: "platform" })
|
|
193
|
+
},
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** 插件路径:打开任务名称弹窗 */
|
|
198
|
+
const onPluginExportClick = () => {
|
|
199
|
+
if (pluginExportDisabled.value) return
|
|
200
|
+
const exportArgs = { ...(args.value || {}) }
|
|
201
|
+
if (!validateTimeRangeArgs(exportArgs)) return
|
|
202
|
+
showTaskModal.value = true
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** 插件任务创建成功 */
|
|
206
|
+
const onTaskModalSuccess = () => {
|
|
207
|
+
showTaskModal.value = false
|
|
208
|
+
emit("success", { mode: "plugin", dirname: dirname.value })
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
dirname,
|
|
213
|
+
kind,
|
|
214
|
+
args,
|
|
215
|
+
showTaskModal,
|
|
216
|
+
pluginReady,
|
|
217
|
+
usePlatformExport,
|
|
218
|
+
usePluginExport,
|
|
219
|
+
diskOverflow,
|
|
220
|
+
pluginExportDisabled,
|
|
221
|
+
pluginButtonTitle,
|
|
222
|
+
onDiskInfoUpdate,
|
|
223
|
+
onInstall,
|
|
224
|
+
onPlatformExportClick,
|
|
225
|
+
onPluginExportClick,
|
|
226
|
+
onTaskModalSuccess,
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 导出插件 API 独立入口(可不挂载 UI)
|
|
3
|
-
* @example
|
|
4
|
-
* import { pluginApi } from "zkqh-lagrange-utils/export_plugin/api"
|
|
5
|
-
*/
|
|
6
|
-
export { pluginApi } from "./plugin.js"
|
|
1
|
+
/**
|
|
2
|
+
* 导出插件 API 独立入口(可不挂载 UI)
|
|
3
|
+
* @example
|
|
4
|
+
* import { pluginApi } from "zkqh-lagrange-utils/export_plugin/api"
|
|
5
|
+
*/
|
|
6
|
+
export { pluginApi } from "./plugin.js"
|