From 0db06c83c71b6266dacd6af3fc52d7a95e1857ea Mon Sep 17 00:00:00 2001 From: v_xugzhou <941071842@qq.com> Date: Fri, 3 Jan 2025 16:16:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=AC=E5=85=B1=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=91=A8=E6=9C=9F=E4=BB=BB=E5=8A=A1=E9=87=87?= =?UTF-8?q?=E7=94=A8allow=E6=8E=A5=E5=8F=A3=E9=89=B4=E6=9D=83=20=20--story?= =?UTF-8?q?=3D136521403=20#=20Reviewed,=20transaction=20id:=2028400?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PeriodicList/ModifyPeriodicDialog.vue | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/frontend/desktop/src/pages/task/PeriodicList/ModifyPeriodicDialog.vue b/frontend/desktop/src/pages/task/PeriodicList/ModifyPeriodicDialog.vue index 726d401a9..400652815 100644 --- a/frontend/desktop/src/pages/task/PeriodicList/ModifyPeriodicDialog.vue +++ b/frontend/desktop/src/pages/task/PeriodicList/ModifyPeriodicDialog.vue @@ -308,6 +308,7 @@ selectedNodes: [], notifyType: [[]], receiverGroup: [], + hasNoCreatePerm: true, saveLoading: false, periodicRule: { required: true, @@ -367,6 +368,9 @@ } }, computed: { + ...mapState({ + 'permissionMeta': state => state.permissionMeta + }), ...mapState('project', { 'projectName': state => state.projectName }), @@ -411,14 +415,6 @@ const nodes = Object.values(activities).map(item => item.name) return nodes.join(',') }, - hasNoCreatePerm () { - const { id, auth_actions } = this.templateData - - if (this.isEdit || !id) { - return false - } - return !auth_actions.includes(this.flowPermission.create) - }, schemeSelectPlaceholder () { return this.formData.template_id && !this.schemeList.length ? i18n.t('此流程无执行方案,无需选择') : i18n.t('请选择') }, @@ -434,6 +430,7 @@ this.initFormData = tools.deepClone(this.formData) if (this.isEdit) { + this.hasNoCreatePerm = false this.periodicConstants = tools.deepClone(this.constants) const id = this.curRow.template_id this.getTemplateDate(id) @@ -444,6 +441,9 @@ this.onTplSearch = tools.debounce(this.handleTplSearch, 500) }, methods: { + ...mapActions([ + 'queryUserPermission' + ]), ...mapActions('templateList', [ 'loadTemplateList' ]), @@ -589,6 +589,7 @@ this.formData.name = templateInfo ? templateInfo.name + '_' + i18n.t('周期执行') : '' this.formData.schemeId = [] this.getTemplateDate(id) + this.queryCreatePeriodicTaskPerm(id) }, async getTemplateScheme () { this.schemeLoading = true @@ -786,6 +787,37 @@ this.updateLoading = false } }, + async queryCreatePeriodicTaskPerm (templateId) { + try { + if (!this.isCommon) { + const { auth_actions } = this.templateData + this.hasNoCreatePerm = !auth_actions.includes(this.flowPermission.create) + return + } + const bkSops = this.permissionMeta.system.find(item => item.id === 'bk_sops') + const data = { + action: this.flowPermission.create, + resources: [ + { + system: bkSops.id, + type: 'project', + id: this.project_id, + attributes: {} + }, + { + system: bkSops.id, + type: 'common_flow', + id: templateId, + attributes: {} + } + ] + } + const res = await this.queryUserPermission(data) + this.hasNoCreatePerm = !res.data.is_allow + } catch (e) { + console.log(e) + } + }, onCancelSave () { this.$emit('onCancelSave') },