@@ -138,7 +113,8 @@ export default {
AddVersionDialog: () => import('./module/add-version-dialog.vue'),
TsFormItem: () => import('@/resources/plugins/TsForm/TsFormItem'),
TsFormSwitch: () => import('@/resources/plugins/TsForm/TsFormSwitch'),
- ModuleEdit: () => import('@/views/pages/deploy/application-config/config/module/module-edit')
+ ModuleEdit: () => import('@/views/pages/deploy/application-config/config/module/module-edit'),
+ InstanceSetting: () => import('./module/instance-setting.vue')
},
props: {
appSystemId: Number,
@@ -230,53 +206,10 @@ export default {
//筛选实例
if (item.isSelectInstance) {
this.$set(item, 'loadingShow', true);
- this.getInstanceList(item);
- }
- },
- getInstanceList(module) {
- //获取实例列表
- let data = {
- needPage: false,
- appSystemId: this.appSystemId,
- envId: this.envId,
- appModuleId: module.id
- };
- this.$api.deploy.env
- .getInstanceList(data)
- .then(res => {
- if (res.Status == 'OK') {
- if (res.Return && res.Return.tbodyList && res.Return.tbodyList.length) {
- let instanceList = res.Return.tbodyList;
- instanceList.forEach(i => {
- //处理回显数据
- if (module.instanceList) {
- if (module.instanceList.find(ins => ins.id === i.id)) {
- this.$set(i, 'isChecked', true);
- }
- } else {
- this.$set(i, 'isChecked', true);
- }
- });
- this.$set(module, 'instanceList', instanceList);
- } else {
- this.$set(module, 'instanceList', []);
- }
- }
- })
- .finally(() => {
- this.$set(module, 'loadingShow', false);
- });
- },
- checkAllInstance(module, isChecked) {
- if (module.instanceList && module.instanceList.length) {
- module.instanceList.forEach(i => {
- this.$set(i, 'isChecked', isChecked);
- });
+ } else {
+ this.$set(item, 'instanceList', []);
}
},
- checkInstance() {
- this.$emit('updateSelectModuleList', this.appModuleListLocal);
- },
getData() {
//向外提供的取数接口
let moduleList = [];
@@ -328,10 +261,10 @@ export default {
});
}
if (m.isSelectInstance) {
- let selectNodeList = m.instanceList.filter(i => {
+ let selectNodeList = m.instanceList && m.instanceList.filter(i => {
return i.isChecked;
});
- if (!selectNodeList.length) {
+ if (this.$utils.isEmpty(selectNodeList)) {
validList.push({
text: this.$t('term.deploy.moduleconfigatleastselectainstance', {target: m.name}),
type: 'error',
@@ -357,6 +290,9 @@ export default {
}
}
this.isShowModuleInfoEdit = false;
+ },
+ updateInstanceList(module, val) {
+ this.$set(module, 'instanceList', val);
}
},
filter: {},
@@ -387,30 +323,6 @@ export default {
}
}
return false;
- },
- allInstanceCheck() {
- return module => {
- if (module.instanceList && module.instanceList.length > 0) {
- const uncheckItem = module.instanceList.find(element => !element.isChecked);
- const checkedItem = module.instanceList.find(element => element.isChecked);
- if (!uncheckItem && checkedItem) {
- return true;
- }
- }
- return false;
- };
- },
- allInstanceIndeterminate() {
- return module => {
- if (module.instanceList && module.instanceList.length > 0) {
- const uncheckItem = module.instanceList.find(element => !element.isChecked);
- const checkedItem = module.instanceList.find(element => element.isChecked);
- if (uncheckItem && checkedItem) {
- return true;
- }
- }
- return false;
- };
}
},
watch: {
diff --git a/src/views/pages/deploy/job/publishing/module/instance-setting.vue b/src/views/pages/deploy/job/publishing/module/instance-setting.vue
new file mode 100644
index 0000000000000000000000000000000000000000..d53ca8dbb9b46b04aab6306844472e57d54da71c
--- /dev/null
+++ b/src/views/pages/deploy/job/publishing/module/instance-setting.vue
@@ -0,0 +1,300 @@
+
+
+
+
+
+
+
+
+ {{ showLabel(item) }}
+
+
+
+
+
+
+
+
+ 查看所有实例
+
+
+ {{ $t('page.clear') }}
+
+
+
+
+
+
{
+ checkAllInstance(val);
+ }
+ "
+ >
+ {{ $t('page.selectall') }}
+
+
+ 仅选中当前页实例
+
+
+
+
+
+
+
+ {
+ checkInstance(val, row);
+ }"
+ >
+ {{ showLabel(row) }}
+
+
+
+
+
+
+
{{ $t('term.deploy.moduleenvnotinstance', {modulename: module.name, envname: envName}) }}
+
+
+
+
+
diff --git a/src/views/pages/deploy/job/publishing/module/more-instance-dialog.vue b/src/views/pages/deploy/job/publishing/module/more-instance-dialog.vue
new file mode 100644
index 0000000000000000000000000000000000000000..46af74229688702caed68dae9def6d7adbf45fd0
--- /dev/null
+++ b/src/views/pages/deploy/job/publishing/module/more-instance-dialog.vue
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+ {{ showLabel(data) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue b/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue
index 77261769a175bc454daedc87e8782057aa05ad05..6e86889c5a57dd8b4165eeba2c3b0574e6dd0baa 100644
--- a/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue
+++ b/src/views/pages/deploy/pipeline/edit-jobtemplate-dialog.vue
@@ -141,7 +141,11 @@ export default {
id: { type: Number },
job: {type: Object},
appSystemId: {type: Number},
- type: {type: String}
+ type: {type: String},
+ isUpdateJobTemplate: {
+ type: Boolean,
+ default: false
+ }
},
data() {
return {
@@ -185,20 +189,21 @@ export default {
transfer: true,
desc: this.$t('term.autoexec.roundcountdescrition'),
validateList: ['required', 'maxNum']
- }
+ },
+ moduleEnvInstanceMap: {}
};
},
beforeCreate() {},
- created() {
+ async created() {
+ if (this.id && !this.isUpdateJobTemplate) {
+ await this.getJobTemplateById();
+ } else if (this.job) {
+ this.jobTemplateData = this.job;
+ }
if (this.appSystemId) {
this.$set(this.jobTemplateData, 'appSystemId', this.appSystemId);
this.$set(this.appSystemConfig, 'disabled', true);
}
- if (this.id) {
- this.getJobTemplateById();
- } else if (this.job) {
- this.jobTemplateData = this.job;
- }
},
beforeMount() {},
mounted() {},
@@ -209,10 +214,9 @@ export default {
beforeDestroy() {},
destroyed() {},
methods: {
- toggleCheckAllModule(val) {},
getJobTemplateById() {
if (this.id) {
- this.$api.deploy.pipeline.getJobTemplateById(this.id).then(res => {
+ return this.$api.deploy.pipeline.getJobTemplateById(this.id).then(res => {
this.jobTemplateData = res.Return;
});
}
@@ -305,7 +309,7 @@ export default {
const selectedModule = this.appModuleList.find(d => d.id === this.jobTemplateData.appModuleId);
if (selectedModule) {
this.$set(selectedModule, 'isChecked', true);
- if (this.jobTemplateData.config.selectNodeList && this.jobTemplateData.config.selectNodeList.length > 0) {
+ if (this.jobTemplateData.config && this.jobTemplateData.config.selectNodeList && this.jobTemplateData.config.selectNodeList.length > 0) {
this.$set(selectedModule, 'isSelectInstance', true);
const instanceList = this.$utils.deepClone(this.jobTemplateData.config.selectNodeList);
instanceList.forEach(ins => {
@@ -332,11 +336,13 @@ export default {
this.$set(this.jobTemplateData, 'scenarioName', scenario.scenarioName);
},
selectEnv(env) {
+ if (this.jobTemplateData && this.jobTemplateData.envId) {
+ this.getModuleEnvInstanceMap(this.jobTemplateData.envId);
+ }
+
this.$set(this.jobTemplateData, 'envId', env.id);
this.$set(this.jobTemplateData, 'envName', env.name);
- },
- checkAppModule(val) {
- console.log(val);
+ this.updateInstanceList(env.id);
},
save() {
if (!this.jobTemplateData.id && !this.jobTemplateData.uuid) {
@@ -365,6 +371,9 @@ export default {
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);
} else {
@@ -384,6 +393,36 @@ export default {
];
list.push(...this.$utils.getRoundCountList());
return list;
+ },
+ getModuleEnvInstanceMap(envId) {
+ if (!envId) {
+ return;
+ }
+ this.appModuleList.forEach(item => {
+ const key = 'app_' + item.id + '_' + envId;
+ if (item.isSelectInstance) {
+ this.$set(this.moduleEnvInstanceMap, key, item.instanceList || []);
+ } else {
+ this.$set(this.moduleEnvInstanceMap, key, []);
+ }
+ });
+ },
+ updateInstanceList(envId) {
+ this.appModuleList.forEach(item => {
+ this.$set(item, 'isSelectInstance', false);
+ const key = 'app_' + item.id + '_' + envId;
+ if (this.moduleEnvInstanceMap[key] && !this.$utils.isEmpty(this.moduleEnvInstanceMap[key])) {
+ this.$set(item, 'isSelectInstance', false);
+ this.$set(item, 'loadingShow', true);
+ this.$set(item, 'instanceList', this.moduleEnvInstanceMap[key]);
+ this.$nextTick(() => {
+ this.$set(item, 'isSelectInstance', true);
+ });
+ } else {
+ this.$set(item, 'isSelectInstance', false);
+ this.$set(item, 'instanceList', []);
+ }
+ });
}
},
filter: {},
diff --git a/src/views/pages/deploy/pipeline/pipeline-edit.vue b/src/views/pages/deploy/pipeline/pipeline-edit.vue
index 56b4a77be04bc770c457daba69c856ace5b2fb7b..fec61dac8d1c652da107dacbb1572f3145e55e23 100644
--- a/src/views/pages/deploy/pipeline/pipeline-edit.vue
+++ b/src/views/pages/deploy/pipeline/pipeline-edit.vue
@@ -20,7 +20,7 @@
{{ $t('page.authority') }}
{{ $t('page.delete') }}
-
+
@@ -95,6 +95,7 @@
:job="currentJob"
:type="pipelineData.type"
:appSystemId="pipelineData.appSystemId"
+ :isUpdateJobTemplate="isUpdateJobTemplate"
@close="closeJobTemplateDialog"
@insert="addJobTemplate"
@update="updateJobTemplate"
@@ -160,7 +161,10 @@ export default {
this.$set(this.pipelineData, 'planStartTime', val);
}
}
- }
+ },
+ isSaving: false,
+ isUpdateJobTemplate: false, //true是从前端获取jobTemplate
+ jobTemplateMap: {} //编辑job时如果不存在则通过接口获取
};
},
beforeCreate() {},
@@ -188,6 +192,11 @@ export default {
editJob(job, group) {
this.currentJob = job;
this.currentGroup = group;
+ if (this.jobTemplateMap[job.uuid]) {
+ this.isUpdateJobTemplate = true;
+ } else {
+ this.isUpdateJobTemplate = false;
+ }
this.isJobTemplateDialogShow = true;
},
editAuth() {
@@ -294,6 +303,7 @@ export default {
if (index > -1) {
this.$set(this.currentGroup.jobTemplateList, index, jobTemplateData);
}
+ this.jobTemplateMap[jobTemplateData.uuid] = jobTemplateData;
}
this.closeJobTemplateDialog();
},
@@ -301,10 +311,14 @@ export default {
if (jobTemplateList) {
console.log(JSON.stringify(jobTemplateList, null, 2));
this.addJob(this.currentLane, this.currentGroup, jobTemplateList);
+ jobTemplateList.forEach(item => {
+ this.jobTemplateMap[item.uuid] = item;
+ });
}
this.closeJobTemplateDialog();
},
closeJobTemplateDialog() {
+ this.isUpdateJobTemplate = false;
this.isJobTemplateDialogShow = false;
},
closeAuthDialog(authList) {
@@ -342,8 +356,9 @@ export default {
if (inputName && inputName.valid()) {
if (this.jobIdList.length == 0) {
this.$Message.info(this.$t('term.deploy.atleastaddajob'));
- return fales;
+ return false;
}
+ this.isSaving = true;
this.$api.deploy.pipeline.savePipeline(this.pipelineData).then(res => {
if (res.Status == 'OK') {
this.pipelineData = res.Return;
@@ -352,7 +367,10 @@ export default {
this.pipelineData.laneList.forEach(lane => {
lane.groupList.push({ jobTemplateList: [] });
});
+ this.jobTemplateMap = {};
}
+ }).finally(() => {
+ this.isSaving = false;
});
}
}
diff --git a/src/views/pages/deploy/schedule/components/params/general.vue b/src/views/pages/deploy/schedule/components/params/general.vue
index baac617ccc4de22fddeb2ef6f0fec82c6deb7710..1eb818ac946b2de5ad569e18e30b0438598443ae 100644
--- a/src/views/pages/deploy/schedule/components/params/general.vue
+++ b/src/views/pages/deploy/schedule/components/params/general.vue
@@ -171,7 +171,8 @@ export default {
runtimeParamList: [], //作业参数
combopPhaseList: [],
param: {},
- defaultModuleList: [] //模块默认值
+ defaultModuleList: [], //模块默认值
+ moduleEnvInstanceMap: {}
};
},
beforeCreate() {},
@@ -236,7 +237,7 @@ export default {
}
});
},
- getJobModuleList() {
+ getJobModuleList(type) {
let data = {
appSystemId: this.searchParams.appSystemId,
envId: this.envId,
@@ -269,7 +270,7 @@ export default {
}
});
//编辑定时作业
- if (this.defaultModuleList.length > 0) {
+ if (!type && this.defaultModuleList.length > 0) {
this.appModuleList.forEach(item => {
let findItem = this.defaultModuleList.find(m => m.id == item.id);
if (findItem) {
@@ -283,6 +284,22 @@ export default {
}
});
}
+ if (type === 'env') { //环境改变时,实例改变
+ this.appModuleList.forEach(item => {
+ const key = 'app_' + item.id + '_' + this.envId;
+ this.$set(item, 'isSelectInstance', false);
+ if (this.moduleEnvInstanceMap[key] && !this.$utils.isEmpty(this.moduleEnvInstanceMap[key])) {
+ this.$set(item, 'loadingShow', true);
+ this.$set(item, 'instanceList', this.moduleEnvInstanceMap[key]);
+ this.$nextTick(() => {
+ this.$set(item, 'isSelectInstance', true);
+ });
+ } else {
+ this.$set(item, 'instanceList', []);
+ }
+ });
+ }
+
//编辑定时作业end
this.updateSelectModuleList(this.appModuleList);
}
@@ -303,10 +320,23 @@ export default {
this.scenarioId = item.scenarioId;
this.combopPhaseNameList = item.combopPhaseNameList;
} else if (type == 'env') {
+ this.getModuleEnvInstanceMap(this.envId);
this.envId = item.id;
this.envName = item.name;
}
- this.getJobModuleList();
+ this.getJobModuleList(type);
+ },
+ getModuleEnvInstanceMap(envId) {
+ this.appModuleList.forEach(item => {
+ this.appModuleList.forEach(item => {
+ const key = 'app_' + item.id + '_' + envId;
+ if (item.isSelectInstance) {
+ this.$set(this.moduleEnvInstanceMap, key, item.instanceList || []);
+ } else {
+ this.$set(this.moduleEnvInstanceMap, key, []);
+ }
+ });
+ });
},
valid() {
let validList = [];