Skip to content

Commit ed635ea

Browse files
committed
fix: 插件列表勾选项 字段修改
1 parent 5a9614c commit ed635ea

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

src/pages/TaskScript/compoment/AddPlugins.tsx

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,32 @@ import { match, P } from 'ts-pattern';
1414
type TAddPlugins = Partial<{
1515
nodeCardValue: string[];
1616
execution_node: string;
17-
value?: Record<string, Array<string>>;
18-
onChange?: (value: Record<string, Array<string>>) => void;
17+
value?: Record<
18+
string,
19+
{
20+
ids: Array<any>;
21+
isAll: boolean;
22+
}
23+
>;
24+
onChange?: (value: TAddPlugins['value']) => void;
1925
}>;
2026

2127
const AddPlugins: FC<TAddPlugins> = memo(
2228
({ nodeCardValue, execution_node, value, onChange }) => {
29+
const [page] = WizardTable.usePage();
30+
2331
const [open, setOpen] = useSafeState(false);
32+
const [tableHeaderCount, setTableHeaderCount] = useSafeState({
33+
total: 0,
34+
checkRow: 0,
35+
});
36+
2437
const groupsList = useRef<
2538
{
2639
label: string | number;
2740
value: string | number;
2841
}[]
2942
>([]);
30-
const [tableHeaderCount, setTableHeaderCount] = useSafeState({
31-
total: 0,
32-
checkRow: 0,
33-
});
34-
35-
const [page] = WizardTable.usePage();
3643

3744
// 判断 设置插件 禁用状态
3845
const isDisabled = match([execution_node, nodeCardValue])
@@ -136,7 +143,8 @@ const AddPlugins: FC<TAddPlugins> = memo(
136143
<div className="color-[#B4BBCA] text-xs font-normal flex items-center gap-2">
137144
<div>Total</div>
138145
<div className="color-[#4A94F8]">
139-
{value?.ScriptName.length ?? 0}
146+
{value?.ScriptName?.ids
147+
.length ?? 0}
140148
</div>
141149
|<div>Selected</div>
142150
<div className="color-[#4A94F8]">
@@ -176,8 +184,8 @@ const AddPlugins: FC<TAddPlugins> = memo(
176184
disabled={isDisabled}
177185
>
178186
<PlusOutlined />{' '}
179-
{value?.ScriptName && value?.ScriptName.length > 0
180-
? `已添加${value.ScriptName.length}个插件`
187+
{value?.ScriptName && value?.ScriptName?.ids.length > 0
188+
? `已添加${value.ScriptName?.ids.length}个插件`
181189
: '添加插件'}
182190
</Button>
183191
</Popover>

src/pages/TaskScript/compoment/StartUpScriptModal.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,12 @@ const StartUpScriptModal = forwardRef<
160160
...items.params,
161161
plugins: items.params?.plugins
162162
? {
163-
ScriptName:
164-
items.params?.plugins?.split(','),
163+
ScriptName: {
164+
ids: items.params?.plugins?.split(
165+
',',
166+
),
167+
isAll: false,
168+
},
165169
}
166170
: undefined,
167171
},

src/pages/TaskScript/data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const transformFormData = (values: any): TPostTaskStartRequest => {
5050
...values,
5151
params: {
5252
...values.params,
53-
plugins: values.params?.plugins?.ScriptName?.join(','),
53+
plugins: values.params?.plugins?.ScriptName?.ids?.join(','),
5454
'enable-brute': `${values?.params?.['enable-brute']}`,
5555
'enbale-cve-baseline': `${values?.params?.['enbale-cve-baseline']}`,
5656
'preset-protes': values?.params?.['preset-protes']

0 commit comments

Comments
 (0)