From a952477c3b4c8cc9877b185f433af5ed0c58cc4e Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Wed, 10 Aug 2022 19:36:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=B7=A5=E5=8D=95action=20(#1971)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复创建应用工单action * 调整结构 Co-authored-by: feng626 <1304903146@qq.com> --- .../components/PermissionFormActionField.vue | 7 +++++++ .../RequestApplicationPerm/CreateUpdate.vue | 16 ++++++++++------ .../Detail/TicketDetail.vue | 18 +++++++++++++++++- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/views/perms/components/PermissionFormActionField.vue b/src/views/perms/components/PermissionFormActionField.vue index 06217a4aa..c6b299106 100644 --- a/src/views/perms/components/PermissionFormActionField.vue +++ b/src/views/perms/components/PermissionFormActionField.vue @@ -22,6 +22,10 @@ export default { choices: { type: Array, default: () => [] + }, + actions: { + type: Array, + default: () => [] } }, data() { @@ -74,6 +78,9 @@ export default { }, computed: { choicesIDs() { + if (this.actions) { + return this.actions + } if (this.choices.length === 0) { return [ 'all', 'connect', 'upload_file', 'download_file', 'updownload', diff --git a/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue b/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue index 5491a83ce..b53cbbe2a 100644 --- a/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue +++ b/src/views/tickets/RequestApplicationPerm/CreateUpdate.vue @@ -38,11 +38,7 @@ export default { apply_date_expired: date_expired, apply_date_start: date_start, org_id: '', - type: 'apply_application', - apply_actions: [ - 'all', 'connect', 'updownload', 'upload_file', 'download_file', - 'clipboard_copy_paste', 'clipboard_copy', 'clipboard_paste' - ] + type: 'apply_application' }, fields: [ [this.$t('common.Basic'), ['title', 'type', 'org_id', 'comment']], @@ -66,7 +62,10 @@ export default { apply_actions: { label: this.$t('perms.Actions'), component: PermissionFormActionField, - helpText: this.$t('common.actionsTips') + helpText: this.$t('common.actionsTips'), + el: { + actions: [] + } }, apply_applications: { type: 'assetSelect', @@ -115,6 +114,11 @@ export default { apply_applications: [], apply_system_users: [] }) + this.$axios.get( + `/api/v1/perms/application-permissions/applications/actions/?category=${event[0]}`, + ).then(res => { + this.fieldsMeta.apply_actions.el.actions = res + }) this.fieldsMeta.apply_applications.el.ajax.url = `/api/v1/applications/applications/suggestion/?oid=${vm.org_id}&category=${event[0]}&type=${event[1]}` this.fieldsMeta.apply_system_users.el.ajax.url = event[0] === 'remote_app' ? `/api/v1/assets/system-users/suggestion/?oid=${vm.org_id}&protocol=rdp` : `/api/v1/assets/system-users/suggestion/?oid=${vm.org_id}&protocol=${event[1]}` } diff --git a/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue b/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue index 689432ca6..c710e7625 100644 --- a/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue +++ b/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue @@ -33,7 +33,12 @@ /> - + @@ -61,6 +66,7 @@ export default { data() { return { statusMap: this.object.status === 'open' ? STATUS_MAP['pending'] : STATUS_MAP[this.object.state], + actions: this.dynamicActions(), requestForm: { applications: this.object.apply_applications, systemusers: this.object.apply_system_users, @@ -213,6 +219,16 @@ export default { } }, methods: { + dynamicActions() { + const category = this.object.apply_category + const actions = [] + this.$axios.get( + `/api/v1/perms/application-permissions/applications/actions/?category=${category}`, + ).then(res => { + actions.push(...res) + }) + return actions + }, formatTime(dateStr) { return formatTime(getDateTimeStamp(dateStr)) },