编辑计划详情
This commit is contained in:
@@ -2,20 +2,20 @@
|
||||
<div class="delay-task-editor">
|
||||
<el-form-item
|
||||
label="延时时间(秒)"
|
||||
:prop="propPrefix + 'parameters.delay_seconds'"
|
||||
:prop="propPath"
|
||||
:rules="isEditing ? {
|
||||
required: true,
|
||||
message: '请输入延时时间',
|
||||
trigger: 'blur'
|
||||
} : null"
|
||||
class="delay-time-form-item"
|
||||
>
|
||||
<el-input-number
|
||||
:model-value="delaySeconds"
|
||||
@update:model-value="updateDelaySeconds"
|
||||
:model-value="delayDuration"
|
||||
@update:model-value="updateDelayDuration"
|
||||
:min="1"
|
||||
placeholder="请输入延时时间"
|
||||
style="width: 100%;"
|
||||
:disabled="!isEditing"
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
</div>
|
||||
@@ -30,10 +30,10 @@ export default {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
// A prefix for the form item prop to ensure unique validation
|
||||
propPrefix: {
|
||||
// The full prop path for validation, e.g., 'parameters.delay_duration'
|
||||
propPath: {
|
||||
type: String,
|
||||
default: "",
|
||||
default: "parameters.delay_duration", // Updated default prop path
|
||||
},
|
||||
// New prop to control editability
|
||||
isEditing: {
|
||||
@@ -43,15 +43,15 @@ export default {
|
||||
},
|
||||
emits: ["update:parameters"],
|
||||
computed: {
|
||||
delaySeconds() {
|
||||
return this.parameters?.delay_seconds || 1;
|
||||
delayDuration() { // Renamed from delaySeconds
|
||||
return this.parameters?.delay_duration || 1;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
updateDelaySeconds(value) {
|
||||
updateDelayDuration(value) { // Renamed from updateDelaySeconds
|
||||
this.$emit("update:parameters", {
|
||||
...this.parameters,
|
||||
delay_seconds: value,
|
||||
delay_duration: value,
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -62,4 +62,7 @@ export default {
|
||||
.delay-task-editor {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
.delay-time-form-item :deep(.el-form-item__label) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user