From 4d27014330edac0f7de36c2a8fbf60b4496a86f1 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 2 Jun 2022 08:48:53 +0800 Subject: [PATCH 1/8] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=B7=A5?= =?UTF-8?q?=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ListTable/TableAction/LeftSide.vue | 2 +- src/i18n/langs/zh.json | 6 +- .../GenericCreateUpdateForm/index.vue | 7 +- src/router/tickets/index.js | 36 +++++++---- src/views/tickets/AssignedTicketList.vue | 6 +- ...TicketListTable.vue => BaseTicketList.vue} | 64 +++++++++++++------ src/views/tickets/MyTicketList.vue | 7 +- 7 files changed, 82 insertions(+), 46 deletions(-) rename src/views/tickets/{TicketListTable.vue => BaseTicketList.vue} (70%) diff --git a/src/components/ListTable/TableAction/LeftSide.vue b/src/components/ListTable/TableAction/LeftSide.vue index 3bbf4317e..bc3b7abba 100644 --- a/src/components/ListTable/TableAction/LeftSide.vue +++ b/src/components/ListTable/TableAction/LeftSide.vue @@ -27,7 +27,7 @@ export default { createRoute: { type: [String, Object, Function], default: function() { - return this.$route.name.replace('List', 'Create') + return this.$route.name?.replace('List', 'Create') } }, createInNewPage: { diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json index 3d4049742..7c40e22d8 100644 --- a/src/i18n/langs/zh.json +++ b/src/i18n/langs/zh.json @@ -690,6 +690,8 @@ "AssetAccount": "资产账号", "ApplicationAccount": "应用账号", "Ticket":"工单", + "MyTickets": "我的申请", + "AssignedTicketList": "待我审批", "SessionDetail": "会话详情", "CommandConfirm": "命令复核", "AdminUserCreate": "创建管理用户", @@ -1132,8 +1134,8 @@ "Assignee": "处理人", "Assignees": "待处理人", "Close": "关闭", - "OpenStatus":"开启", - "CloseStatus":"关闭", + "OpenStatus":"审批中", + "CloseStatus":"已完成", "Comment": "备注", "MyTickets": "我发起的", "RequestPerm":"授权申请", diff --git a/src/layout/components/GenericCreateUpdateForm/index.vue b/src/layout/components/GenericCreateUpdateForm/index.vue index de54df533..4003751f4 100644 --- a/src/layout/components/GenericCreateUpdateForm/index.vue +++ b/src/layout/components/GenericCreateUpdateForm/index.vue @@ -89,7 +89,7 @@ export default { createSuccessNextRoute: { type: Object, default: function() { - const routeName = this.$route.name.replace('Create', 'List') + const routeName = this.$route.name?.replace('Create', 'List') return { name: routeName } } }, @@ -97,15 +97,14 @@ export default { updateSuccessNextRoute: { type: Object, default: function() { - const routeName = this.$route.name.replace('Update', 'List') + const routeName = this.$route.name?.replace('Update', 'List') return { name: routeName } } }, objectDetailRoute: { type: Object, default: function() { - const routeName = this.$route.name - .replace('Update', 'Detail') + const routeName = this.$route.name?.replace('Update', 'Detail') .replace('Create', 'Detail') return { name: routeName } } diff --git a/src/router/tickets/index.js b/src/router/tickets/index.js index f304c7fc9..512faed25 100644 --- a/src/router/tickets/index.js +++ b/src/router/tickets/index.js @@ -4,7 +4,7 @@ import i18n from '@/i18n/i18n' export default { path: '/tickets', - redirect: '/tickets/tickets', + redirect: '/tickets/my-tickets', component: Layout, meta: { title: i18n.t('route.Tickets'), @@ -17,26 +17,40 @@ export default { permissions: ['tickets.view_ticket'] }, children: [ + { + path: '/tickets/my-tickets', + name: 'MyTicketList', + component: () => import('@/views/tickets/MyTicketList'), + meta: { + title: i18n.t('route.MyTickets'), + icon: 'file-text-o', + showOrganization: false, + permissions: [] + } + }, + { + + path: '/tickets/assigned-tickets', + name: 'AssignedTicketList', + component: () => import('@/views/tickets/AssignedTicketList'), + meta: { + title: i18n.t('route.AssignedTicketList'), + icon: 'check-square-o', + showOrganization: false, + permissions: [] + } + }, { path: '/tickets/tickets', redirect: '', component: empty, + hidden: true, meta: { title: i18n.t('route.Tickets'), icon: 'file-text-o', showOrganization: false }, children: [ - { - path: '', - name: 'TicketList', - component: () => import('@/views/tickets'), - meta: { - title: i18n.t('route.Tickets'), - icon: 'file-text-o', - permissions: ['tickets.view_ticket'] - } - }, { path: 'request-asset-perm/create', name: 'RequestAssetPermTicketCreateUpdate', diff --git a/src/views/tickets/AssignedTicketList.vue b/src/views/tickets/AssignedTicketList.vue index 2312fbf35..b862879fe 100644 --- a/src/views/tickets/AssignedTicketList.vue +++ b/src/views/tickets/AssignedTicketList.vue @@ -1,14 +1,14 @@ + + diff --git a/src/views/tickets/LoginConfirm/Detail/index.vue b/src/views/tickets/LoginConfirm/Detail/index.vue new file mode 100644 index 000000000..30dd26b45 --- /dev/null +++ b/src/views/tickets/LoginConfirm/Detail/index.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/views/tickets/RequestAssetPerm/CreateUpdate.vue b/src/views/tickets/RequestAssetPerm/CreateUpdate.vue index 360cda80f..8b67e1334 100644 --- a/src/views/tickets/RequestAssetPerm/CreateUpdate.vue +++ b/src/views/tickets/RequestAssetPerm/CreateUpdate.vue @@ -78,6 +78,9 @@ export default { apply_system_users: { type: 'systemUserSelect', component: Select2, + rules: [ + { required: true } + ], label: this.$t('assets.SystemUser'), el: { value: [], diff --git a/src/views/tickets/components/Comments.vue b/src/views/tickets/components/Comments.vue index 6ef09476c..32d933979 100644 --- a/src/views/tickets/components/Comments.vue +++ b/src/views/tickets/components/Comments.vue @@ -111,7 +111,6 @@ export default { } }, mounted() { - console.log('this.object.type', this.object.type) switch (this.object.type) { case 'login_confirm': this.type_api = 'apply-login-tickets' From 57e54522202d06c3a1230394a9c530c6a1623d35 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Sun, 19 Jun 2022 19:48:28 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E6=B3=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/tickets/BaseTicketList.vue | 7 +++- .../CommandConfirm/Detail/TicketDetail.vue | 41 ++++++++++--------- .../LoginAssetConfirm/Detail/TicketDetail.vue | 21 +++++----- .../LoginConfirm/Detail/TicketDetail.vue | 21 +++++----- .../Detail/TicketDetail.vue | 37 +++++++++-------- .../RequestAssetPerm/Detail/TicketDetail.vue | 41 ++++++++++--------- .../tickets/TicketDetail/TicketDetail.vue | 13 +++--- 7 files changed, 93 insertions(+), 88 deletions(-) diff --git a/src/views/tickets/BaseTicketList.vue b/src/views/tickets/BaseTicketList.vue index e48956dbf..7770f619f 100644 --- a/src/views/tickets/BaseTicketList.vue +++ b/src/views/tickets/BaseTicketList.vue @@ -61,9 +61,12 @@ export default { } }, { - prop: 'applicant_display', + prop: 'applicant', label: this.$t('tickets.user'), - sortable: 'custom' + sortable: 'custom', + formatter: row => { + return row.rel_snapshot.applicant + } }, { prop: 'type_display', diff --git a/src/views/tickets/CommandConfirm/Detail/TicketDetail.vue b/src/views/tickets/CommandConfirm/Detail/TicketDetail.vue index 7efca2040..9c9f36fc0 100644 --- a/src/views/tickets/CommandConfirm/Detail/TicketDetail.vue +++ b/src/views/tickets/CommandConfirm/Detail/TicketDetail.vue @@ -30,74 +30,75 @@ export default { }, computed: { detailCardItems() { + const { object } = this return [ { key: this.$t('tickets.Applicant'), - value: this.object.rel_snapshot.applicant + value: object.rel_snapshot.applicant }, { key: this.$t('tickets.type'), - value: this.object.type_display + value: object.type_display }, { key: this.$t('tickets.status'), - value: this.object.status, + value: object.status, formatter: (item, val) => { return { this.statusMap.title } } }, { key: this.$t('common.dateCreated'), - value: toSafeLocalDateStr(this.object.date_created) + value: toSafeLocalDateStr(object.date_created) } ] }, specialCardItems() { - const vm = this + const { object } = this return [ { key: this.$t('tickets.ApplyRunUser'), - value: this.object.rel_snapshot.apply_run_user + value: object.rel_snapshot.apply_run_user }, { key: this.$t('tickets.ApplyRunAsset'), - value: this.object.rel_snapshot.apply_run_asset + value: object.rel_snapshot.apply_run_asset }, { key: this.$t('tickets.ApplyRunSystemUser'), - value: this.object.rel_snapshot.apply_run_system_user + value: object.rel_snapshot.apply_run_system_user }, { key: this.$t('tickets.ApplyRunCommand'), - value: this.object.apply_run_command + value: object.apply_run_command }, { key: this.$t('tickets.ApplyFromSession'), - value: this.object.apply_from_session, + value: object.apply_from_session, formatter: function(item, value) { - const to = { name: 'SessionDetail', params: { id: value }, query: { oid: vm.object.org_id }} - if (!vm.$hasPerm('terminal.view_session')) { - return {vm.$t('sessions.session')} + const to = { name: 'SessionDetail', params: { id: value }, query: { oid: object.org_id }} + if (!this.$hasPerm('terminal.view_session')) { + return {this.$t('sessions.session')} } - return {vm.$t('sessions.session')} + return {this.$t('sessions.session')} } }, { key: this.$t('tickets.ApplyFromCMDFilterRule'), value: { - cmdFilterRuleId: this.object.apply_from_cmd_filter_rule, - cmdFilterId: this.object.apply_from_cmd_filter + cmdFilterRuleId: object.apply_from_cmd_filter_rule, + cmdFilterId: object.apply_from_cmd_filter }, formatter: function(item, value) { const to = { name: 'CommandFilterRulesUpdate', params: { id: value.cmdFilterRuleId }, - query: { filter: value.cmdFilterId, oid: vm.object.org_id } + query: { filter: value.cmdFilterId, oid: object.org_id } } - if (!vm.$hasPerm('assets.change_commandfilterrule')) { - return {vm.$t('assets.CommandFilterRules')} + if (!this.$hasPerm('assets.change_commandfilterrule')) { + return {this.$t('assets.CommandFilterRules')} } - return {vm.$t('assets.CommandFilterRules')} + return {this.$t('assets.CommandFilterRules')} } } ] diff --git a/src/views/tickets/LoginAssetConfirm/Detail/TicketDetail.vue b/src/views/tickets/LoginAssetConfirm/Detail/TicketDetail.vue index 2c605d1e0..f18b3d40b 100644 --- a/src/views/tickets/LoginAssetConfirm/Detail/TicketDetail.vue +++ b/src/views/tickets/LoginAssetConfirm/Detail/TicketDetail.vue @@ -30,44 +30,43 @@ export default { }, computed: { detailCardItems() { + const { object } = this return [ { key: this.$t('tickets.Applicant'), - value: this.object.rel_snapshot.applicant + value: object.rel_snapshot.applicant }, { key: this.$t('tickets.type'), - value: this.object.type_display + value: object.type_display }, { key: this.$t('tickets.status'), - value: this.object.status, + value: object.status, formatter: (item, val) => { return { this.statusMap.title } } }, { key: this.$t('common.dateCreated'), - value: toSafeLocalDateStr(this.object.date_created) + value: toSafeLocalDateStr(object.date_created) } ] }, specialCardItems() { - return this.object.type === 'login_confirm' ? [] : [ - // apply_login_asset: "114.118.2.76(114.118.2.76)" - // apply_login_system_user: "root()" - // apply_login_user: "Administrator(admin)" + const { object } = this + return object.type === 'login_confirm' ? [] : [ { key: this.$t('acl.apply_login_asset'), - value: this.object.rel_snapshot.apply_login_asset + value: object.rel_snapshot.apply_login_asset }, { key: this.$t('acl.apply_login_system_user'), - value: this.object.rel_snapshot.apply_login_system_user + value: object.rel_snapshot.apply_login_system_user }, { key: this.$t('acl.apply_login_user'), - value: this.object.rel_snapshot.apply_login_user + value: object.rel_snapshot.apply_login_user } ] } diff --git a/src/views/tickets/LoginConfirm/Detail/TicketDetail.vue b/src/views/tickets/LoginConfirm/Detail/TicketDetail.vue index 2c605d1e0..f18b3d40b 100644 --- a/src/views/tickets/LoginConfirm/Detail/TicketDetail.vue +++ b/src/views/tickets/LoginConfirm/Detail/TicketDetail.vue @@ -30,44 +30,43 @@ export default { }, computed: { detailCardItems() { + const { object } = this return [ { key: this.$t('tickets.Applicant'), - value: this.object.rel_snapshot.applicant + value: object.rel_snapshot.applicant }, { key: this.$t('tickets.type'), - value: this.object.type_display + value: object.type_display }, { key: this.$t('tickets.status'), - value: this.object.status, + value: object.status, formatter: (item, val) => { return { this.statusMap.title } } }, { key: this.$t('common.dateCreated'), - value: toSafeLocalDateStr(this.object.date_created) + value: toSafeLocalDateStr(object.date_created) } ] }, specialCardItems() { - return this.object.type === 'login_confirm' ? [] : [ - // apply_login_asset: "114.118.2.76(114.118.2.76)" - // apply_login_system_user: "root()" - // apply_login_user: "Administrator(admin)" + const { object } = this + return object.type === 'login_confirm' ? [] : [ { key: this.$t('acl.apply_login_asset'), - value: this.object.rel_snapshot.apply_login_asset + value: object.rel_snapshot.apply_login_asset }, { key: this.$t('acl.apply_login_system_user'), - value: this.object.rel_snapshot.apply_login_system_user + value: object.rel_snapshot.apply_login_system_user }, { key: this.$t('acl.apply_login_user'), - value: this.object.rel_snapshot.apply_login_user + value: object.rel_snapshot.apply_login_user } ] } diff --git a/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue b/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue index c4893f048..e5b12540c 100644 --- a/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue +++ b/src/views/tickets/RequestApplicationPerm/Detail/TicketDetail.vue @@ -39,48 +39,48 @@ export default { }, computed: { detailCardItems() { - const obj = this.object || {} + const { object } = this return [ { key: this.$t('common.Number'), - value: obj.serial_num + value: object.serial_num }, { key: this.$t('tickets.status'), - value: obj.status, + value: object.status, formatter: (item, val) => { return { this.statusMap.title } } }, { key: this.$t('tickets.type'), - value: obj.type_display + value: object.type_display }, { key: this.$t('tickets.user'), - value: obj.rel_snapshot.applicant + value: object.rel_snapshot.applicant }, { key: this.$t('tickets.OrgName'), - value: obj.org_name + value: object.org_name }, { key: this.$t('common.dateCreated'), - value: toSafeLocalDateStr(obj.date_created) + value: toSafeLocalDateStr(object.date_created) }, { key: this.$t('common.Comment'), - value: obj.comment + value: object.comment } ] }, specialCardItems() { - const vm = this - const rel_snapshot = this.object.rel_snapshot + const { object } = this + const rel_snapshot = object.rel_snapshot return [ { key: this.$t('applications.appType'), - value: `${vm.object.apply_category} / ${vm.object.apply_type} ` + value: `${object.apply_category} / ${object.apply_type} ` }, { key: this.$t('applications.appName'), @@ -92,24 +92,25 @@ export default { }, { key: this.$t('common.dateStart'), - value: toSafeLocalDateStr(vm.object.apply_date_start) + value: toSafeLocalDateStr(object.apply_date_start) }, { key: this.$t('common.dateExpired'), - value: toSafeLocalDateStr(vm.object.apply_date_expired) + value: toSafeLocalDateStr(object.apply_date_expired) } ] }, assignedCardItems() { const vm = this - const rel_snapshot = this.object.rel_snapshot + const { object } = this + const rel_snapshot = object.rel_snapshot return [ { key: this.$t('tickets.PermissionName'), value: vm.object.apply_permission_name, formatter: function(item, value) { - const to = { name: 'ApplicationPermissionDetail', params: { id: vm.object.id }, query: { oid: vm.object.org_id }} - if (vm.$hasPerm('perms.view_applicationpermission') && vm.object.status === 'closed' && vm.object.state === 'approved') { + const to = { name: 'ApplicationPermissionDetail', params: { id: object.id }, query: { oid: object.org_id }} + if (vm.$hasPerm('perms.view_applicationpermission') && object.status === 'closed' && object.state === 'approved') { return { value } } else { return { value } @@ -126,11 +127,11 @@ export default { }, { key: this.$t('common.dateStart'), - value: toSafeLocalDateStr(vm.object.apply_date_start) + value: toSafeLocalDateStr(object.apply_date_start) }, { key: this.$t('common.dateExpired'), - value: toSafeLocalDateStr(vm.object.apply_date_expired) + value: toSafeLocalDateStr(object.apply_date_expired) } ] }, diff --git a/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue b/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue index f28287916..ca1e1c76e 100644 --- a/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue +++ b/src/views/tickets/RequestAssetPerm/Detail/TicketDetail.vue @@ -40,44 +40,44 @@ export default { }, computed: { detailCardItems() { - const obj = this.object || {} + const { object } = this return [ { key: this.$t('common.Number'), - value: obj.serial_num + value: object.serial_num }, { key: this.$t('tickets.status'), - value: obj.state, + value: object.state, formatter: (item, val) => { return { this.statusMap.title } } }, { key: this.$t('tickets.type'), - value: obj.type_display + value: object.type_display }, { key: this.$t('tickets.user'), - value: obj.rel_snapshot.applicant + value: object.rel_snapshot.applicant }, { key: this.$t('tickets.OrgName'), - value: obj.org_name + value: object.org_name }, { key: this.$t('common.dateCreated'), - value: toSafeLocalDateStr(obj.date_created) + value: toSafeLocalDateStr(object.date_created) }, { key: this.$t('common.Comment'), - value: obj.comment + value: object.comment } ] }, specialCardItems() { - const vm = this - const rel_snapshot = this.object.rel_snapshot + const { object } = this + const rel_snapshot = object.rel_snapshot return [ { key: this.$t('perms.Node'), @@ -93,28 +93,29 @@ export default { }, { key: this.$t('assets.Action'), - value: forMatAction(this, vm.object.apply_actions_display) + value: forMatAction(this, object.apply_actions_display) }, { key: this.$t('common.dateStart'), - value: toSafeLocalDateStr(vm.object.apply_date_start) + value: toSafeLocalDateStr(object.apply_date_start) }, { key: this.$t('common.dateExpired'), - value: toSafeLocalDateStr(vm.object.apply_date_expired) + value: toSafeLocalDateStr(object.apply_date_expired) } ] }, assignedCardItems() { const vm = this - const rel_snapshot = this.object.rel_snapshot + const { object } = this + const rel_snapshot = object.rel_snapshot return [ { key: this.$t('tickets.PermissionName'), - value: this.object.apply_permission_name, + value: object.apply_permission_name, formatter: function(item, value) { - const to = { name: 'AssetPermissionDetail', params: { id: vm.object.id }, query: { oid: vm.object.org_id }} - if (vm.$hasPerm('perms.view_assetpermission') && vm.object.status === 'closed' && vm.object.state === 'approved') { + const to = { name: 'AssetPermissionDetail', params: { id: object.id }, query: { oid: object.org_id }} + if (vm.$hasPerm('perms.view_assetpermission') && object.status === 'closed' && object.state === 'approved') { return { value } } else { return { value } @@ -135,15 +136,15 @@ export default { }, { key: this.$t('assets.Action'), - value: forMatAction(this, vm.object.apply_actions_display) + value: forMatAction(this, object.apply_actions_display) }, { key: this.$t('common.dateStart'), - value: toSafeLocalDateStr(vm.object.apply_date_start) + value: toSafeLocalDateStr(object.apply_date_start) }, { key: this.$t('common.dateExpired'), - value: toSafeLocalDateStr(vm.object.apply_date_expired) + value: toSafeLocalDateStr(object.apply_date_expired) } ] } diff --git a/src/views/tickets/TicketDetail/TicketDetail.vue b/src/views/tickets/TicketDetail/TicketDetail.vue index 207eb53a7..fc415bda2 100644 --- a/src/views/tickets/TicketDetail/TicketDetail.vue +++ b/src/views/tickets/TicketDetail/TicketDetail.vue @@ -30,33 +30,34 @@ export default { }, computed: { detailCardItems() { + const { object } = this return [ { key: this.$t('tickets.Applicant'), - value: this.object.rel_snapshot.applicant + value: object.rel_snapshot.applicant }, { key: this.$t('tickets.type'), - value: this.object.type_display + value: object.type_display }, { key: this.$t('tickets.status'), - value: this.object.status, + value: object.status, formatter: (item, val) => { return { this.statusMap.title } } }, { key: this.$t('tickets.Assignees'), - value: this.object.process_map[this.object.approval_step - 1].assignees_display.join(',') + value: object.process_map[object.approval_step - 1].assignees_display.join(',') }, { key: this.$t('tickets.Assignee'), - value: this.object.process_map[this.object.approval_step - 1].processor_display + value: object.process_map[object.approval_step - 1].processor_display }, { key: this.$t('common.dateCreated'), - value: toSafeLocalDateStr(this.object.date_created) + value: toSafeLocalDateStr(object.date_created) } ] }