zkqh-lagrange-utils 0.0.60 → 0.0.62
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 +1 -1
- package/src/service/export_plugin/PluginLocalExport.vue +15 -5
- package/src/service/export_plugin/internal/export-task-modal.vue +2 -9
- package/src/service/export_plugin/internal/plugin-dir-select.vue +1 -7
- package/src/service/export_plugin/internal/styles/plugin-dir-select.less +0 -8
- package/src/service/export_plugin/utils/export-task.js +1 -14
package/package.json
CHANGED
|
@@ -76,7 +76,6 @@ import PluginDirSelect from "./internal/plugin-dir-select.vue"
|
|
|
76
76
|
import ExportTaskModal from "./internal/export-task-modal.vue"
|
|
77
77
|
import { usePluginHealth } from "./hooks/use-plugin-health.js"
|
|
78
78
|
import { isOverSizeLimit, isPreviewOverflowDisk } from "./utils/size.js"
|
|
79
|
-
import { validateTimeRangeArgs } from "./utils/export-task.js"
|
|
80
79
|
|
|
81
80
|
const DEFAULT_PREVIEW = {
|
|
82
81
|
show: false,
|
|
@@ -86,7 +85,7 @@ const DEFAULT_PREVIEW = {
|
|
|
86
85
|
|
|
87
86
|
/**
|
|
88
87
|
* 本地导出组合区:平台/应用小文件导出 + 插件目录导出 + 50MB 分流 + 任务弹窗
|
|
89
|
-
* token / url /
|
|
88
|
+
* token / url / 安装包地址内置;业务校验由宿主通过 validateArgs 传入
|
|
90
89
|
*/
|
|
91
90
|
export default defineComponent({
|
|
92
91
|
name: "PluginLocalExport",
|
|
@@ -104,10 +103,15 @@ export default defineComponent({
|
|
|
104
103
|
kind: { type: String, default: "event" },
|
|
105
104
|
/** 筛选参数(插件 createExport 用) */
|
|
106
105
|
args: { type: Object, default: () => ({}) },
|
|
106
|
+
/**
|
|
107
|
+
* 导出前校验(宿主实现);不传则不校验
|
|
108
|
+
* @type {(args: object) => boolean}
|
|
109
|
+
*/
|
|
110
|
+
validateArgs: { type: Function, default: null },
|
|
107
111
|
},
|
|
108
112
|
emits: ["success"],
|
|
109
113
|
setup(props, { emit }) {
|
|
110
|
-
const { previewInfo, kind, args } = toRefs(props)
|
|
114
|
+
const { previewInfo, kind, args, validateArgs } = toRefs(props)
|
|
111
115
|
const dirname = ref("")
|
|
112
116
|
const diskInfo = ref({ total_size: 0, used_size: 0 })
|
|
113
117
|
const showTaskModal = ref(false)
|
|
@@ -123,6 +127,12 @@ export default defineComponent({
|
|
|
123
127
|
...(previewInfo.value || {}),
|
|
124
128
|
}))
|
|
125
129
|
|
|
130
|
+
/** 宿主校验;未传则通过 */
|
|
131
|
+
const runValidate = (exportArgs) => {
|
|
132
|
+
if (typeof validateArgs.value !== "function") return true
|
|
133
|
+
return validateArgs.value(exportArgs) !== false
|
|
134
|
+
}
|
|
135
|
+
|
|
126
136
|
/**
|
|
127
137
|
* 是否展示平台/应用导出区(≤50MB)
|
|
128
138
|
*/
|
|
@@ -181,7 +191,7 @@ export default defineComponent({
|
|
|
181
191
|
/** 平台/应用路径:确认后回调 */
|
|
182
192
|
const onPlatformExportClick = () => {
|
|
183
193
|
const exportArgs = { ...(args.value || {}) }
|
|
184
|
-
if (!
|
|
194
|
+
if (!runValidate(exportArgs)) return
|
|
185
195
|
|
|
186
196
|
window.$dialog?.warning?.({
|
|
187
197
|
title: "确认导出",
|
|
@@ -198,7 +208,7 @@ export default defineComponent({
|
|
|
198
208
|
const onPluginExportClick = () => {
|
|
199
209
|
if (pluginExportDisabled.value) return
|
|
200
210
|
const exportArgs = { ...(args.value || {}) }
|
|
201
|
-
if (!
|
|
211
|
+
if (!runValidate(exportArgs)) return
|
|
202
212
|
showTaskModal.value = true
|
|
203
213
|
}
|
|
204
214
|
|
|
@@ -22,16 +22,11 @@
|
|
|
22
22
|
<script>
|
|
23
23
|
import { defineComponent, ref } from "vue"
|
|
24
24
|
import { pluginApi } from "../api/plugin.js"
|
|
25
|
-
import {
|
|
26
|
-
buildTaskName,
|
|
27
|
-
getDefaultToken,
|
|
28
|
-
getDefaultUrl,
|
|
29
|
-
validateTimeRangeArgs,
|
|
30
|
-
} from "../utils/export-task.js"
|
|
25
|
+
import { buildTaskName, getDefaultToken, getDefaultUrl } from "../utils/export-task.js"
|
|
31
26
|
import "./styles/export-plugin-modals.less"
|
|
32
27
|
|
|
33
28
|
/**
|
|
34
|
-
*
|
|
29
|
+
* 导出任务名称弹窗(创建插件导出作业)
|
|
35
30
|
*/
|
|
36
31
|
export default defineComponent({
|
|
37
32
|
name: "ExportTaskModal",
|
|
@@ -63,8 +58,6 @@ export default defineComponent({
|
|
|
63
58
|
*/
|
|
64
59
|
const createExport = async (name) => {
|
|
65
60
|
const exportArgs = { ...(props.args || {}) }
|
|
66
|
-
if (!validateTimeRangeArgs(exportArgs)) return false
|
|
67
|
-
|
|
68
61
|
const token = getDefaultToken()
|
|
69
62
|
const url = getDefaultUrl()
|
|
70
63
|
if (!token) {
|
|
@@ -19,13 +19,7 @@
|
|
|
19
19
|
:on-load="onLoadTreeNode"
|
|
20
20
|
@update:expanded-keys="onExpandedKeysUpdate"
|
|
21
21
|
@update:value="onDirChange" />
|
|
22
|
-
<
|
|
23
|
-
v-if="initLoading"
|
|
24
|
-
class="_pds_loading lc_fs_s">
|
|
25
|
-
<n-spin :size="14" />
|
|
26
|
-
加载目录中…
|
|
27
|
-
</span>
|
|
28
|
-
<template v-else-if="diskUsageText">
|
|
22
|
+
<template v-if="diskUsageText">
|
|
29
23
|
<span class="_pds_folder_icon">
|
|
30
24
|
<i class="lc lc-tuxing1"></i>
|
|
31
25
|
</span>
|
|
@@ -10,14 +10,6 @@
|
|
|
10
10
|
flex-shrink: 0;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
._pds_loading {
|
|
14
|
-
display: inline-flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
gap: 6px;
|
|
17
|
-
color: var(--lc_text_color_secondary);
|
|
18
|
-
flex-shrink: 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
13
|
._pds_folder_icon {
|
|
22
14
|
display: inline-flex;
|
|
23
15
|
align-items: center;
|
|
@@ -24,7 +24,7 @@ export const getDefaultUrl = () => {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* 默认插件安装包地址:当前域名端口 + /plugins.main.exe
|
|
27
|
+
* 默认插件安装包地址:当前域名端口 + /plugins/main.exe(对应前端 public/plugins/main.exe)
|
|
28
28
|
* @returns {string}
|
|
29
29
|
*/
|
|
30
30
|
export const getDefaultDownloadUrl = () => {
|
|
@@ -32,19 +32,6 @@ export const getDefaultDownloadUrl = () => {
|
|
|
32
32
|
return `${window.location.origin}/plugins/main.exe`
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* 默认校验:导出 args 需含完整时间范围
|
|
37
|
-
* @param {Record<string, any>} args
|
|
38
|
-
* @returns {boolean}
|
|
39
|
-
*/
|
|
40
|
-
export const validateTimeRangeArgs = (args = {}) => {
|
|
41
|
-
if (!(args.start_time && args.end_time)) {
|
|
42
|
-
window.$message?.warning?.("请选择发生时间")
|
|
43
|
-
return false
|
|
44
|
-
}
|
|
45
|
-
return true
|
|
46
|
-
}
|
|
47
|
-
|
|
48
35
|
/**
|
|
49
36
|
* 生成导出默认名称:导出数据_<年><月><日>
|
|
50
37
|
* @returns {string}
|