{
showSearch
onSelect={onSelect}
/>,
+ ] : [
+
+ }
+ />
+ ,
]
}
header={{
@@ -144,6 +226,7 @@ const Log = () => {
>
{
onBeforeChange={(editor, data, value) => {
setValue(value);
}}
- onChange={(editor, data, value) => {}}
+ onChange={(editor, data, value) => { }}
/>
)}
diff --git a/src/pages/script/index.tsx b/src/pages/script/index.tsx
index 430c6d08..799b1b24 100644
--- a/src/pages/script/index.tsx
+++ b/src/pages/script/index.tsx
@@ -283,17 +283,7 @@ const Script = () => {
message.success(`删除成功`);
let newData = [...data];
if (currentNode.parent) {
- const parentNodeIndex = newData.findIndex(
- (x) => x.key === currentNode.parent,
- );
- const parentNode = newData[parentNodeIndex];
- const index = parentNode.children.findIndex(
- (y) => y.key === currentNode.key,
- );
- if (index !== -1 && parentNodeIndex !== -1) {
- parentNode.children.splice(index, 1);
- newData.splice(parentNodeIndex, 1, { ...parentNode });
- }
+ newData = depthFirstSearch(newData, (c) => c.key === currentNode.key);
} else {
const index = newData.findIndex(
(x) => x.key === currentNode.key,
diff --git a/src/utils/config.ts b/src/utils/config.ts
index 1e8e43f5..9e2d8e85 100644
--- a/src/utils/config.ts
+++ b/src/utils/config.ts
@@ -56,7 +56,7 @@ export default {
value: 'scripts',
},
{
- name: '任务日志',
+ name: '日志管理',
value: 'logs',
},
{
@@ -74,7 +74,7 @@ export default {
subscriptions: '订阅管理',
configs: '配置文件',
scripts: '脚本管理',
- logs: '任务日志',
+ logs: '日志管理',
dependencies: '依赖管理',
system: '系统信息',
},
@@ -263,7 +263,7 @@ export default {
'/config': '配置文件',
'/script': '脚本管理',
'/diff': '对比工具',
- '/log': '任务日志',
+ '/log': '日志管理',
'/setting': '系统设置',
'/error': '错误日志',
},
diff --git a/src/utils/index.ts b/src/utils/index.ts
index 9fa2a510..e7f73fdb 100644
--- a/src/utils/index.ts
+++ b/src/utils/index.ts
@@ -244,7 +244,7 @@ export function exportJson(name: string, data: string) {
export function depthFirstSearch<
T extends Record & { children?: T[] },
->(children: T[], condition: (column: T) => boolean, item: T) {
+>(children: T[], condition: (column: T) => boolean, item?: T) {
const c = [...children];
const keys = [];
@@ -252,6 +252,11 @@ export function depthFirstSearch<
if (!cls) return;
for (let i = 0; i < cls?.length; i++) {
if (condition(cls[i])) {
+ if (!item) {
+ cls.splice(i, 1);
+ return;
+ }
+
if (cls[i].children) {
cls[i].children!.unshift(item);
} else {