修改执行参数.

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 对象")
public class ExecParameterSchemaDTO {
@Schema(description = "参数名")
@Schema(description = "参数名")
private String name;
@Schema(description = "参数描述")
private String desc;
@Schema(description = "默认")
private Object defaultValue;
@Schema(description = "")
@Schema(description = "参数")
private Object value;
}

View File

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

View File

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

View File

@@ -180,7 +180,7 @@
parameterSchema.value = JSON.parse(record.parameterSchema);
const params = {} as any;
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;
} else {

View File

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

View File

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