diff --git a/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue b/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue
index 8609ee52bfea0eb6ef89a0feaab565f6730a1e3e..c271f06ecb29f963fdcd098453d505176b17b637 100644
--- a/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue
+++ b/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue
@@ -20,17 +20,13 @@
+ {{ moduleListValidTip }}
@@ -225,7 +222,8 @@ export default {
text: this.$t('page.autoexecbatchround'),
value: 'roundCount'
}
- ]
+ ],
+ moduleListValidTip: ''
};
},
beforeCreate() {},
@@ -380,14 +378,16 @@ export default {
this.updateInstanceList(env.id);
},
save() {
+ let isValid = this.valid();
+ this.moduleListValidTip = '';
+ const moduleList = this.$refs?.moduleList.getData() || [];
+ if (!this.jobTemplateData.config) {
+ this.$set(this.jobTemplateData, 'config', {});
+ }
+ if (this.$refs.param) {
+ this.$set(this.jobTemplateData.config, 'param', this.$refs.param.getValue());
+ }
if (!this.jobTemplateData.id && !this.jobTemplateData.uuid) {
- if (!this.jobTemplateData.config) {
- this.$set(this.jobTemplateData, 'config', {});
- }
- if (this.$refs.param) {
- this.$set(this.jobTemplateData.config, 'param', this.$refs.param.getValue());
- }
- const moduleList = this.$refs?.moduleList.getData() || [];
if (moduleList && moduleList.length > 0) {
const jobTemplateList = [];
moduleList.forEach(module => {
@@ -398,21 +398,21 @@ export default {
data.uuid = this.$utils.setUuid();
jobTemplateList.push(data);
});
- this.$emit('insert', jobTemplateList);
+ if (isValid) {
+ this.$emit('insert', jobTemplateList);
+ }
} else {
- this.$Message.info(this.$t('form.placeholder.pleaseselect', {target: this.$t('page.module')}));
+ this.moduleListValidTip = this.$t('form.placeholder.pleaseselect', {target: this.$t('page.module')});
}
} else {
- const moduleList = this.$refs?.moduleList.getData() || [];
if (moduleList && moduleList.length == 1) {
const module = moduleList[0];
- if (!this.jobTemplateData.config) {
- this.jobTemplateData.config = {};
- }
this.jobTemplateData.config.selectNodeList = module.selectNodeList;
- this.$emit('update', this.jobTemplateData);
+ if (isValid) {
+ this.$emit('update', this.jobTemplateData);
+ }
} else {
- this.$Message.info(this.$t('form.placeholder.pleaseselect', {target: this.$t('page.module')}));
+ this.moduleListValidTip = this.$t('form.placeholder.pleaseselect', {target: this.$t('page.module')});
}
}
},
@@ -469,6 +469,13 @@ export default {
this.jobTemplateData.parallelCount = 2;
}
}
+ },
+ valid() {
+ let isValid = true;
+ if (this.$refs.param && !this.$refs.param.valid()) {
+ isValid = false;
+ }
+ return isValid;
}
},
filter: {},