Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ticket): 优化工单详情 #261

Merged
merged 2 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/i18n/langs/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,12 +686,12 @@
},
"tickets": {
"Accept": "接受",
"AssignedMe": "待处理",
"AssignedMe": "待我审批",
"Assignee": "处理人",
"Assignees": "待处理人",
"Close": "关闭",
"Comment": "备注",
"MyTickets": "我的工单",
"MyTickets": "我发起的",
"Reject": "拒绝",
"date": "日期",
"reply": "回复",
Expand All @@ -700,7 +700,12 @@
"type": "类型",
"user": "用户",
"Status": "状态",
"Open": "打开"
"Open": "打开",
"Applicant": "申请人",
"Pending": "未处理",
"Approved": "已同意",
"Rejected": "已拒绝",
"Closed": "已关闭"
},
"tree": {
"AddAssetToNode": "添加资产到节点",
Expand Down
8 changes: 7 additions & 1 deletion src/i18n/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 7 additions & 11 deletions src/views/tickets/TicketDetail/TicketDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
<el-form-item style="float: right">
<template v-if="hasActionPerm">
<el-button :disabled="object.status === 'closed'" type="primary" size="small" @click="handleApprove"><i class="fa fa-check" />{{ $t('tickets.Accept') }}</el-button>
<el-button :disabled="object.status === 'closed'" type="warning" size="small" @click="handleReject"><i class="fa fa-ban" />{{ $t('tickets.Reject') }}</el-button>
<el-button :disabled="object.status === 'closed'" type="danger" size="small" @click="handleReject"><i class="fa fa-ban" />{{ $t('tickets.Reject') }}</el-button>
</template>
<el-button :disabled="object.status === 'closed'" type="danger" size="small" @click="handleClosed"><i class="fa fa-times" />{{ $t('tickets.Close') }}</el-button>
<el-button :disabled="object.status === 'closed'" type="warning" size="small" @click="handleClosed"><i class="fa fa-times" />{{ $t('tickets.Close') }}</el-button>
<el-button :disabled="object.status === 'closed'" type="info" size="small" @click="handleComment"><i class="fa fa-pencil" />{{ $t('tickets.Comment') }}</el-button>
</el-form-item>
</el-form>
Expand All @@ -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',
Expand All @@ -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: ''
Expand All @@ -80,10 +82,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
},
{
Expand All @@ -93,13 +94,8 @@ 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 <el-button type='primary' size='mini'>{open}</el-button>
}
return <el-button type='danger' size='mini'>{close}</el-button>
formatter: (item, val) => {
return <el-tag type={this.statusMap.type}> { this.statusMap.title }</el-tag>
}
},
{
Expand Down
21 changes: 21 additions & 0 deletions src/views/tickets/const.js
Original file line number Diff line number Diff line change
@@ -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')
}
}