Skip to content

Commit

Permalink
fix: 公共流程创建周期任务-权限校验优化 --story=121334648
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 27700
  • Loading branch information
ywywZhou authored and luofann committed Dec 25, 2024
1 parent 2ce044b commit c0518a2
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@
<bk-option
v-for="option in templateList"
:key="option.id"
:disabled="!hasPermission([flowPermission.view], option.auth_actions)"
:disabled="hasNoPermission.view"
:id="option.id"
:name="option.name">
<p
:title="option.name"
v-cursor="{ active: !hasPermission([flowPermission.view], option.auth_actions) }"
v-cursor="{ active: hasNoPermission.view }"
@click="onTempSelect([flowPermission.view], option)">
{{ option.name }}
</p>
Expand Down Expand Up @@ -219,8 +219,8 @@
:loading="saveLoading"
:disabled="isLoading || previewDataLoading"
data-test-id="periodicEdit_form_saveBtn"
:class="{ 'btn-permission-disable': hasNoCreatePerm }"
v-cursor="{ active: hasNoCreatePerm }"
:class="{ 'btn-permission-disable': hasNoPermission.create }"
v-cursor="{ active: hasNoPermission.create }"
@click="onPeriodicConfirm">
{{ isEdit ? $t('保存') : $t('提交') }}
</bk-button>
Expand Down Expand Up @@ -411,12 +411,17 @@
const nodes = Object.values(activities).map(item => item.name)
return nodes.join(',')
},
hasNoCreatePerm () {
hasNoPermission () {
const { id, auth_actions } = this.templateData
if (this.isEdit || !id) {
return false
return { view: false, create: false }
}
return {
view: !auth_actions.includes(this.flowPermission.view),
create: !auth_actions.includes(this.flowPermission.create)
}
return !auth_actions.includes(this.flowPermission.create)
},
schemeSelectPlaceholder () {
return this.formData.template_id && !this.schemeList.length ? i18n.t('此流程无执行方案,无需选择') : i18n.t('请选择')
Expand Down Expand Up @@ -492,7 +497,7 @@
}
},
onTempSelect (applyPerm = [], selectInfo) {
if (!this.hasPermission(applyPerm, selectInfo.auth_actions)) {
if (this.hasNoPermission.view) {
const permissionData = {
project: [{
id: this.project_id,
Expand Down Expand Up @@ -785,7 +790,7 @@
},
// 周期任务保存
onPeriodicConfirm () {
if (this.hasNoCreatePerm) {
if (this.hasNoPermission.create) {
const { id, name, auth_actions } = this.templateData
const resourceData = {
[this.isCommon ? 'common_flow' : 'flow']: [{ id, name }],
Expand Down

0 comments on commit c0518a2

Please sign in to comment.