修改执行参数.

This commit is contained in:
lijiahang
2024-07-10 11:46:07 +08:00
parent 873e910eb1
commit 04bae45955
6 changed files with 30 additions and 27 deletions

View File

@@ -20,16 +20,13 @@ import lombok.NoArgsConstructor;
@Schema(name = "ExecParameterSchemaDTO", description = "命令执行参数 schema 对象") @Schema(name = "ExecParameterSchemaDTO", description = "命令执行参数 schema 对象")
public class ExecParameterSchemaDTO { public class ExecParameterSchemaDTO {
@Schema(description = "参数名") @Schema(description = "参数名")
private String name; private String name;
@Schema(description = "参数描述") @Schema(description = "参数描述")
private String desc; private String desc;
@Schema(description = "默认") @Schema(description = "参数")
private Object defaultValue;
@Schema(description = "")
private Object value; private Object value;
} }

View File

@@ -335,9 +335,6 @@ public class ExecCommandServiceImpl implements ExecCommandService {
.collect(Collectors.toMap(ExecParameterSchemaDTO::getName, .collect(Collectors.toMap(ExecParameterSchemaDTO::getName,
s -> { s -> {
Object value = s.getValue(); Object value = s.getValue();
if (value == null) {
value = s.getDefaultValue();
}
if (value == null) { if (value == null) {
value = Const.EMPTY; value = Const.EMPTY;
} }

View File

@@ -11,7 +11,6 @@ export const templateSuffix = ' }}';
export interface TemplateParam { export interface TemplateParam {
name?: string; name?: string;
desc?: string; desc?: string;
defaultValue?: any;
value?: any; value?: any;
} }

View File

@@ -180,7 +180,7 @@
parameterSchema.value = JSON.parse(record.parameterSchema); parameterSchema.value = JSON.parse(record.parameterSchema);
const params = {} as any; const params = {} as any;
for (let param of parameterSchema.value) { for (let param of parameterSchema.value) {
params[param.name as keyof any] = param.defaultValue; params[param.name as keyof any] = param.value;
} }
parameterFormModel.value = params; parameterFormModel.value = params;
} else { } else {

View File

@@ -9,7 +9,7 @@
:cancel-button-props="{ disabled: loading }" :cancel-button-props="{ disabled: loading }"
:on-before-ok="handlerOk" :on-before-ok="handlerOk"
@cancel="handleClose"> @cancel="handleClose">
<a-spin class="full drawer-form-small" :loading="loading"> <a-spin class="form-container drawer-form-small" :loading="loading">
<a-form :model="formModel" <a-form :model="formModel"
ref="formRef" ref="formRef"
label-align="right" label-align="right"
@@ -113,13 +113,13 @@
<span>参数名</span> <span>参数名</span>
</template> </template>
</a-input> </a-input>
<!-- 默认 --> <!-- 参数 -->
<a-input class="parameter-item-default" <a-input class="parameter-item-value"
v-model="item.defaultValue" v-model="item.value"
placeholder="非必填" placeholder="非必填"
allow-clear> allow-clear>
<template #prepend> <template #prepend>
<span>默认</span> <span>参数</span>
</template> </template>
</a-input> </a-input>
<!-- 描述 --> <!-- 描述 -->
@@ -329,6 +329,11 @@
} }
} }
.form-container {
width: 100%;
min-height: 100%;
}
.parameter-form-item { .parameter-form-item {
user-select: none; user-select: none;
margin-top: 4px; margin-top: 4px;
@@ -353,15 +358,15 @@
} }
&-name { &-name {
width: 29%; width: 30%;
} }
&-default { &-value {
width: 29%; width: 40%;
} }
&-description { &-description {
width: calc(39% - 44px); width: calc(30% - 44px);
} }
&-close { &-close {

View File

@@ -9,7 +9,7 @@
:cancel-button-props="{ disabled: loading }" :cancel-button-props="{ disabled: loading }"
:on-before-ok="handlerOk" :on-before-ok="handlerOk"
@cancel="handleClose"> @cancel="handleClose">
<a-spin class="full drawer-form-small" :loading="loading"> <a-spin class="form-container drawer-form-small" :loading="loading">
<a-form :model="formModel" <a-form :model="formModel"
ref="formRef" ref="formRef"
label-align="right" label-align="right"
@@ -146,8 +146,8 @@
</template> </template>
</a-input> </a-input>
<!-- 参数值 --> <!-- 参数值 -->
<a-input class="parameter-item-default" <a-input class="parameter-item-value"
v-model="item.defaultValue" v-model="item.value"
placeholder="必填" placeholder="必填"
allow-clear> allow-clear>
<template #prepend> <template #prepend>
@@ -340,7 +340,7 @@
} }
// 验证并设置命令参数 // 验证并设置命令参数
for (const p of parameter.value) { for (const p of parameter.value) {
if (!p.name || !p.defaultValue) { if (!p.name || !p.value) {
Message.warning('请补全命令参数'); Message.warning('请补全命令参数');
return false; return false;
} }
@@ -406,6 +406,11 @@
} }
} }
.form-container {
width: 100%;
min-height: 100%;
}
.command-item { .command-item {
:deep(.arco-form-item-extra) { :deep(.arco-form-item-extra) {
margin-top: -18px; margin-top: -18px;
@@ -465,15 +470,15 @@
} }
&-name { &-name {
width: 29%; width: 30%;
} }
&-default { &-value {
width: 29%; width: 40%;
} }
&-description { &-description {
width: calc(39% - 44px); width: calc(30% - 44px);
} }
&-close { &-close {