From ae70ced521728ebd32ba41ff2d21a88b7dbc8bd1 Mon Sep 17 00:00:00 2001 From: dengbf Date: Thu, 3 Jul 2025 18:45:03 +0800 Subject: [PATCH] =?UTF-8?q?-=20[=E5=85=B3=E8=81=94]#[1457317420171264]?= =?UTF-8?q?=E4=B8=80=E9=94=AE=E5=8F=91=E5=B8=83=E5=8F=91-=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E4=BD=9C=E4=B8=9A=E7=9A=84=E4=BA=A4=E4=BA=92=E9=9C=80?= =?UTF-8?q?=E6=94=B9=E6=88=90=E5=92=8C=E5=AE=9A=E6=97=B6=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E9=87=8C=E4=B8=80=E8=87=B4=20http://192.168.0.96:8090/demo/rdm?= =?UTF-8?q?.html#/story-detail/939050947543040/939050947543042/14573174201?= =?UTF-8?q?71264?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/app/app-pipeline.vue | 2 +- .../pages/deploy/job/add-batch-job-dialog.vue | 145 ++++++++++++++++-- .../deploy/pipeline/add-deployjob-form.vue | 3 + .../pages/deploy/pipeline/pipeline-manage.vue | 2 +- 4 files changed, 136 insertions(+), 16 deletions(-) diff --git a/src/views/pages/deploy/application-config/config/app/app-pipeline.vue b/src/views/pages/deploy/application-config/config/app/app-pipeline.vue index 3db4d443..82ec711b 100644 --- a/src/views/pages/deploy/application-config/config/app/app-pipeline.vue +++ b/src/views/pages/deploy/application-config/config/app/app-pipeline.vue @@ -24,7 +24,7 @@
diff --git a/src/views/pages/deploy/job/add-batch-job-dialog.vue b/src/views/pages/deploy/job/add-batch-job-dialog.vue index 11d7cabb..ede76ae3 100644 --- a/src/views/pages/deploy/job/add-batch-job-dialog.vue +++ b/src/views/pages/deploy/job/add-batch-job-dialog.vue @@ -8,8 +8,14 @@ :item-list="formConfig" :labelWidth="90" > + - { + this.handlePipelineId(val); + } + }, + appSystemId: { type: 'select', - label: this.$t('term.deploy.superpipeline'), + label: this.$t('page.apply'), value: null, + dynamicUrl: '/api/rest/deploy/app/config/appsystem/search', + dealDataByUrl: (nodeList) => { return this.dealDataByUrl(nodeList, 'app'); }, + params: {authorityActionList: ['view']}, + rootName: 'tbodyList', + border: 'border', transfer: true, - isHidden: true, + validateList: ['required'], + onChange: (val) => { + this.changeAppSystemId(val); + } + }, + pipelineId: { + type: 'select', + label: this.$t('term.autoexec.pipeline'), + value: null, dynamicUrl: '/api/rest/deploy/pipeline/search', + params: {type: 'appsystem', needVerifyAuth: 1}, rootName: 'tbodyList', - textName: 'name', - valueName: 'id', - multiple: false, - validateList: [ - 'required' - ], + dealDataByUrl: this.dealPipelineData, + validateList: ['required'], + transfer: true, onChange: val => { this.pipelineId = val; } } - }, - saveLoading: false + } }; }, beforeCreate() {}, @@ -122,18 +158,99 @@ export default { save() { const dialogForm = this.$refs['dialogForm']; const pipelineForm = this.$refs['pipelineForm']; - if ((dialogForm && !dialogForm.valid()) || (pipelineForm && !pipelineForm.validateForm())) { + const pipelineFormConfig = this.$refs['pipelineFormConfig']; + if ((dialogForm && !dialogForm.valid()) || (pipelineForm && !pipelineForm.validateForm() && (pipelineFormConfig && !pipelineFormConfig.valid()))) { return false; } + let data = { + ...pipelineForm.save() + }; + if (this.$refs.pipelineFormConfig) { + Object.assign(data, this.$refs.pipelineFormConfig.getFormValue()); + } this.saveLoading = true; - pipelineForm.submitForm().then(() => { - this.close(true); + + this.$api.deploy.pipeline.addBatchJob(data).then(res => { + if (res.Status == 'OK') { + this.$Message.success(this.$t('message.savesuccess')); + this.close(true); + } }).finally(() => { this.saveLoading = false; }); }, close(needRefresh = false) { this.$emit('close', needRefresh); + }, + dealDataByUrl(nodeList, type) { + let dataList = []; + if (nodeList) { + nodeList.forEach(item => { + dataList.push({ + value: item.id, + text: item.abbrName + (item.name ? '(' + item.name + ')' : ''), + _disabled: this.getDisabledText(item, type) + }); + }); + } + return dataList; + }, + getDisabledText(item, type) { + let text = false; + if (!item.isHasAllAuthority && type == 'app') { + if (item.authActionSet && item.authActionSet.length) { + if (!item.authActionSet.includes('operation#execute') && !item.authActionSet.includes('operation#all')) { + text = this.$t('term.deploy.notapplyallexecuteauth'); + } else if (!item.authActionSet.find((item) => item.includes('scenario#')) && !item.authActionSet.includes('scenario#all')) { + text = this.$t('term.deploy.notapplyallsceneexecuteauth'); + } else if (!item.authActionSet.find((item) => item.includes('env#')) && !item.authActionSet.includes('env#all')) { + text = this.$t('term.deploy.notapplyallenvexecuteauth'); + } + } else { + text = this.$t('term.deploy.notapplyallexecuteauth'); + } + } else if (!item.isConfig) { + text = this.$t('term.deploy.applynotconfigpipeline'); + } else if (type == 'app' && !item.isHasModule) { + text = this.$t('term.deploy.applynotconfigmodule'); + } else if (!item.isHasEnv) { + type == 'app' && (text = this.$t('term.deploy.applynotconfigenv')); + type == 'module' && (text = this.$t('term.deploy.modulenotconfigenv')); + } + return text; + }, + dealPipelineData(nodeList) { + let dataList = []; + if (nodeList) { + nodeList.forEach(item => { + dataList.push({ + value: item.id, + text: item.name + (item.appSystemAbbrName ? '/' + item.appSystemAbbrName : '') + }); + }); + } + return dataList; + }, + changeAppSystemId(val) { //应用流水线切换 + this.$set(this.pipelineFormConfig.pipelineId, 'value', null); + this.$set(this.pipelineFormConfig.pipelineId.params, 'appSystemId', val); + if (val) { + this.$set(this.pipelineFormConfig.pipelineId, 'disabled', false); + } else { + this.$set(this.pipelineFormConfig.pipelineId, 'disabled', true); + } + }, + handlePipelineId(val) { + this.$set(this.pipelineFormConfig.pipelineId, 'value', null); + this.$set(this.pipelineFormConfig.pipelineId.params, 'type', val); + this.$set(this.pipelineFormConfig.pipelineId.params, 'appSystemId', null); + if (val == 'appsystem') { + this.$set(this.pipelineFormConfig.pipelineId, 'disabled', true); + } else if (val == 'global') { + this.$set(this.pipelineFormConfig.pipelineId, 'disabled', false); + } + this.$set(this.pipelineFormConfig.appSystemId, 'value', null); + this.$set(this.pipelineFormConfig.appSystemId, 'isHidden', val !== 'appsystem'); } }, filter: {}, diff --git a/src/views/pages/deploy/pipeline/add-deployjob-form.vue b/src/views/pages/deploy/pipeline/add-deployjob-form.vue index f4a00fef..b6c16b89 100644 --- a/src/views/pages/deploy/pipeline/add-deployjob-form.vue +++ b/src/views/pages/deploy/pipeline/add-deployjob-form.vue @@ -234,6 +234,9 @@ export default { }, getVersionValidateList(row) { return ['required']; + }, + save() { + return this.jobData; } }, filter: {}, diff --git a/src/views/pages/deploy/pipeline/pipeline-manage.vue b/src/views/pages/deploy/pipeline/pipeline-manage.vue index e6e8cc69..0a3bb6bf 100644 --- a/src/views/pages/deploy/pipeline/pipeline-manage.vue +++ b/src/views/pages/deploy/pipeline/pipeline-manage.vue @@ -38,7 +38,7 @@
  • {{ $t('term.deploy.joblist') }}
  • -
  • {{ $t('term.deploy.batchjob') }}
  • +
  • {{ $t('term.deploy.batchjob') }}
  • {{ $t('page.delete') }}
-- Gitee