|
6 | 6 | <div class="p-24"> |
7 | 7 | <div class="flex-between"> |
8 | 8 | <div> |
9 | | - <el-button type="primary" @click="openCreateTriggerDrawer" |
| 9 | + <el-button |
| 10 | + v-if="triggerPermissionMap.create()" |
| 11 | + type="primary" |
| 12 | + @click="openCreateTriggerDrawer" |
10 | 13 | >{{ $t('common.create') }} |
11 | 14 | </el-button> |
12 | | - <el-button @click="batchChangeState(true)" :disabled="multipleSelection.length === 0" |
| 15 | + <el-button |
| 16 | + v-if="triggerPermissionMap.edit()" |
| 17 | + @click="batchChangeState(true)" |
| 18 | + :disabled="multipleSelection.length === 0" |
13 | 19 | >{{ $t('common.status.enable') }} |
14 | 20 | </el-button> |
15 | | - <el-button @click="batchChangeState(false)" :disabled="multipleSelection.length === 0" |
| 21 | + <el-button |
| 22 | + v-if="triggerPermissionMap.edit()" |
| 23 | + @click="batchChangeState(false)" |
| 24 | + :disabled="multipleSelection.length === 0" |
16 | 25 | >{{ $t('common.status.disable') }} |
17 | 26 | </el-button> |
18 | | - <el-button @click="batchDelete" :disabled="multipleSelection.length === 0" |
| 27 | + <el-button |
| 28 | + v-if="triggerPermissionMap.delete()" |
| 29 | + @click="batchDelete" |
| 30 | + :disabled="multipleSelection.length === 0" |
19 | 31 | >{{ $t('common.delete') }} |
20 | 32 | </el-button> |
21 | 33 | </div> |
|
243 | 255 | </el-table-column> |
244 | 256 | <el-table-column align="left" width="160" fixed="right" :label="$t('common.operation')"> |
245 | 257 | <template #default="{ row }"> |
246 | | - <span @click.stop> |
| 258 | + <span v-if="triggerPermissionMap.edit()" @click.stop> |
247 | 259 | <el-switch |
248 | 260 | :before-change="() => changeState(row)" |
249 | 261 | :loading="loading" |
|
259 | 271 | </el-button> |
260 | 272 | </span> |
261 | 273 | </el-tooltip> |
262 | | - <el-tooltip effect="dark" :content="$t('workflow.ExecutionRecord')" placement="top"> |
| 274 | + <el-tooltip |
| 275 | + v-if="triggerPermissionMap.record()" |
| 276 | + effect="dark" |
| 277 | + :content="$t('workflow.ExecutionRecord')" |
| 278 | + placement="top" |
| 279 | + > |
263 | 280 | <span class="mr-4"> |
264 | 281 | <el-button type="primary" text @click="openExecutionRecordDrawer(row)"> |
265 | 282 | <AppIcon iconName="app-schedule-report"></AppIcon> |
266 | 283 | </el-button> |
267 | 284 | </span> |
268 | 285 | </el-tooltip> |
269 | 286 |
|
270 | | - <el-tooltip effect="dark" :content="$t('common.delete')" placement="top"> |
| 287 | + <el-tooltip |
| 288 | + v-if="triggerPermissionMap.delete()" |
| 289 | + effect="dark" |
| 290 | + :content="$t('common.delete')" |
| 291 | + placement="top" |
| 292 | + > |
271 | 293 | <span class="mr-4"> |
272 | 294 | <el-button type="primary" text @click="deleteTrigger(row)"> |
273 | 295 | <AppIcon iconName="app-delete"></AppIcon> |
@@ -301,6 +323,8 @@ import { resetUrl } from '@/utils/common' |
301 | 323 | import { loadSharedApi } from '@/utils/dynamics-api/shared-api' |
302 | 324 | import type { TriggerData } from '@/api/type/trigger' |
303 | 325 | import TriggerDrawer from '@/views/trigger/component/TriggerDrawer.vue' |
| 326 | +import { hasPermission } from '@/utils/permission' |
| 327 | +import { PermissionConst, RoleConst } from '@/utils/permission/data' |
304 | 328 |
|
305 | 329 | const { user } = useStore() |
306 | 330 |
|
@@ -407,6 +431,41 @@ function batchDelete() { |
407 | 431 | }) |
408 | 432 | } |
409 | 433 |
|
| 434 | +const triggerPermissionMap = { |
| 435 | + edit: () => |
| 436 | + hasPermission( |
| 437 | + [ |
| 438 | + RoleConst.WORKSPACE_MANAGE.getWorkspaceRole, |
| 439 | + PermissionConst.TRIGGER_EDIT.getWorkspacePermissionWorkspaceManageRole, |
| 440 | + ], |
| 441 | + 'OR', |
| 442 | + ), |
| 443 | + create: () => |
| 444 | + hasPermission( |
| 445 | + [ |
| 446 | + RoleConst.WORKSPACE_MANAGE.getWorkspaceRole, |
| 447 | + PermissionConst.TRIGGER_CREATE.getWorkspacePermissionWorkspaceManageRole, |
| 448 | + ], |
| 449 | + 'OR', |
| 450 | + ), |
| 451 | + delete: () => |
| 452 | + hasPermission( |
| 453 | + [ |
| 454 | + RoleConst.WORKSPACE_MANAGE.getWorkspaceRole, |
| 455 | + PermissionConst.TRIGGER_DELETE.getWorkspacePermissionWorkspaceManageRole, |
| 456 | + ], |
| 457 | + 'OR', |
| 458 | + ), |
| 459 | + record: () => |
| 460 | + hasPermission( |
| 461 | + [ |
| 462 | + RoleConst.WORKSPACE_MANAGE.getWorkspaceRole, |
| 463 | + PermissionConst.TRIGGER_RECORD.getWorkspacePermissionWorkspaceManageRole, |
| 464 | + ], |
| 465 | + 'OR', |
| 466 | + ), |
| 467 | +} |
| 468 | +
|
410 | 469 | async function changeState(row: any) { |
411 | 470 | const obj = { |
412 | 471 | is_active: !row.is_active, |
|
0 commit comments