From 53f5dd1e7fd9bbc46736fe68095b40e56a01f497 Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Mon, 20 Jul 2020 17:00:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(ticket):=20=E4=BC=98=E5=8C=96=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.json | 11 +++++--- src/i18n/langs/en.json | 8 +++++- .../tickets/TicketDetail/TicketDetail.vue | 26 ++++++++++++------- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index eb7dc2080..6f87e8fac 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -686,12 +686,12 @@ }, "tickets": { "Accept": "接受", - "AssignedMe": "待处理", + "AssignedMe": "待我审批", "Assignee": "处理人", "Assignees": "待处理人", "Close": "关闭", "Comment": "备注", - "MyTickets": "我的工单", + "MyTickets": "我发起的", "Reject": "拒绝", "date": "日期", "reply": "回复", @@ -700,7 +700,12 @@ "type": "类型", "user": "用户", "Status": "状态", - "Open": "打开" + "Open": "打开", + "Applicant": "申请人", + "Pending": "未处理", + "Approved": "已同意", + "Rejected": "已拒绝", + "Closed": "已关闭" }, "tree": { "AddAssetToNode": "添加资产到节点", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index d6c5a8390..e9d19d947 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -699,7 +699,13 @@ "type": "Type", "user": "User", "Status": "Status", - "Open": "Open" + "Open": "Open", + "Applicant": "Applicant", + "Pending": "Pending", + "Approved": "Approved", + "Rejected": "Rejected", + "Closed": "Closed" + }, "tree": { "AddAssetToNode": "Add asset to node", diff --git a/src/views/tickets/TicketDetail/TicketDetail.vue b/src/views/tickets/TicketDetail/TicketDetail.vue index c37d978d7..7689cdbdc 100644 --- a/src/views/tickets/TicketDetail/TicketDetail.vue +++ b/src/views/tickets/TicketDetail/TicketDetail.vue @@ -39,9 +39,9 @@ - {{ $t('tickets.Close') }} + {{ $t('tickets.Close') }} {{ $t('tickets.Comment') }} @@ -80,10 +80,9 @@ export default { return this.object.title }, detailCardItems() { - const vm = this return [ { - key: this.$t('tickets.user'), + key: this.$t('tickets.Applicant'), value: this.object.user_display }, { @@ -93,13 +92,20 @@ export default { { key: this.$t('tickets.status'), value: this.object.status, - callback: function(row, data) { - const open = vm.$t('common.Open') - const close = vm.$t('common.Close') - if (data === 'open') { - return {open} + formatter: (item, val) => { + if (this.object.status === 'open') { + return {this.$t('tickets.Pending')} + } else { + if (this.object.action === 'approve') { + return {this.$t('tickets.Approved')} + } + if (this.object.action === 'reject') { + return {this.$t('tickets.Rejected')} + } + if (this.object.action === '') { + return {this.$t('tickets.Closed')} + } } - return {close} } }, { From 014e53a712bd241f59296126c3745d39aea83ce0 Mon Sep 17 00:00:00 2001 From: jym503558564 <503558564@qq.com> Date: Fri, 24 Jul 2020 13:52:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(ticket):=20=E4=BC=98=E5=8C=96=E5=B7=A5?= =?UTF-8?q?=E5=8D=95=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/TicketDetail/TicketDetail.vue | 16 +++----------- src/views/tickets/const.js | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 13 deletions(-) create mode 100644 src/views/tickets/const.js diff --git a/src/views/tickets/TicketDetail/TicketDetail.vue b/src/views/tickets/TicketDetail/TicketDetail.vue index 7689cdbdc..6338c7a83 100644 --- a/src/views/tickets/TicketDetail/TicketDetail.vue +++ b/src/views/tickets/TicketDetail/TicketDetail.vue @@ -54,6 +54,7 @@ import DetailCard from '@/components/DetailCard' import { formatTime, getDateTimeStamp } from '@/utils/index' import { toSafeLocalDateStr } from '@/utils/common' +import { STATUS_MAP } from '../const' export default { name: 'TicketDetail', @@ -68,6 +69,7 @@ export default { }, data() { return { + statusMap: this.object.status === 'open' ? STATUS_MAP[this.object.status] : STATUS_MAP[this.object.action], imageUrl: require('@/assets/img/admin.png'), form: { comments: '' @@ -93,19 +95,7 @@ export default { key: this.$t('tickets.status'), value: this.object.status, formatter: (item, val) => { - if (this.object.status === 'open') { - return {this.$t('tickets.Pending')} - } else { - if (this.object.action === 'approve') { - return {this.$t('tickets.Approved')} - } - if (this.object.action === 'reject') { - return {this.$t('tickets.Rejected')} - } - if (this.object.action === '') { - return {this.$t('tickets.Closed')} - } - } + return { this.statusMap.title } } }, { diff --git a/src/views/tickets/const.js b/src/views/tickets/const.js new file mode 100644 index 000000000..25de3b107 --- /dev/null +++ b/src/views/tickets/const.js @@ -0,0 +1,21 @@ +import i18n from '@/i18n/i18n' + +export const OPEN = 'open' +export const APPROVE = 'approve' +export const REJECT = 'reject' +export const OTHER = '' + +export const STATUS_MAP = { + [OPEN]: { + type: 'success', title: i18n.t('tickets.Pending') + }, + [APPROVE]: { + type: 'primary', title: i18n.t('tickets.Approved') + }, + [REJECT]: { + type: 'danger', title: i18n.t('tickets.Rejected') + }, + [OTHER]: { + type: 'info', title: i18n.t('tickets.Closed') + } +}