fix:修复apiKey保存传时间值未转utc问题

This commit is contained in:
wangwenrui
2021-05-12 17:15:23 +08:00
parent d8c07bca23
commit ba5dae7172
4 changed files with 20 additions and 6 deletions

View File

@@ -244,13 +244,23 @@
.table-operation-items { .table-operation-items {
display: flex; display: flex;
justify-content: center; justify-content: center;
.table-operation-item { .table-operation-item {
display: flex; display: flex;
height: 22px; height: 22px;
border-radius: $--button-border-radius; border-radius: $--button-border-radius;
outline: none; outline: none;
} }
.table-operation-item.table-operation-item-disable{
border: 1px solid $--primary-border-color;
outline: none;
background-color: $--button-gray-background-color;
transition: background-color linear .1s;
i {
font-size: 14px;
color: $--button-gray-color;
}
}
>.table-operation-item { >.table-operation-item {
justify-content: center; justify-content: center;
align-items: center; align-items: center;

View File

@@ -11,7 +11,7 @@
</template> </template>
<template v-slot:top-tool-right> <template v-slot:top-tool-right>
<button id="api-key-add" v-has="'snmp_mibFile_add'" :title="$t('config.system.notification.create')" class="top-tool-btn margin-r-10" type="button" @click="addApiKey"> <button id="api-key-add" v-has="'system_apiKey_add'" :title="$t('config.system.notification.create')" class="top-tool-btn margin-r-10" type="button" @click="addApiKey">
<i class="nz-icon-create-square nz-icon"></i> <i class="nz-icon-create-square nz-icon"></i>
</button> </button>
</template> </template>

View File

@@ -72,7 +72,10 @@
{{scope.row[item.prop]?scope.row[item.prop].name:'-'}} {{scope.row[item.prop]?scope.row[item.prop].name:'-'}}
</template> </template>
<template v-else-if="item.prop == 'expireAt'"> <template v-else-if="item.prop == 'expireAt'">
{{scope.row[item.prop]?scope.row[item.prop]:$t('config.system.apiKey.noExpire')}} {{scope.row[item.prop]?utcTimeToTimezoneStr(scope.row[item.prop]):$t('config.system.apiKey.noExpire')}}
</template>
<template v-else-if="item.prop == 'createAt'">
{{scope.row[item.prop]?utcTimeToTimezoneStr(scope.row[item.prop]):$t('config.system.apiKey.noExpire')}}
</template> </template>
<template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template> <template v-else-if="scope.row[item.prop]">{{scope.row[item.prop]}}</template>
<template v-else>-</template> <template v-else>-</template>
@@ -86,11 +89,11 @@
<div slot="header" class="table-operation-title">{{$t('overall.option')}}</div> <div slot="header" class="table-operation-title">{{$t('overall.option')}}</div>
<div slot-scope="scope" class="table-operation-items"> <div slot-scope="scope" class="table-operation-items">
<template v-if="scope.row.edit"> <template v-if="scope.row.edit">
<button type="button" class="nz-btn nz-btn-size-mini-new nz-btn-style-normal-new" :disabled="prevent_opt.save" @click="save(scope.row)" style="margin-right: 10px"><span>{{$t('overall.save')}}</span></button> <button type="button" class="nz-btn nz-btn-size-mini-new nz-btn-style-normal-new" v-has="'system_apiKey_edit'" :disabled="prevent_opt.save" @click="save(scope.row)" style="margin-right: 10px"><span>{{$t('overall.save')}}</span></button>
<button type="button" class="nz-btn nz-btn-size-mini-new nz-btn-style-light-new" @click="cancel(scope.row)" :disabled="prevent_opt.save"><span>{{$t('overall.cancel')}}</span></button> <button type="button" class="nz-btn nz-btn-size-mini-new nz-btn-style-light-new" @click="cancel(scope.row)" :disabled="prevent_opt.save"><span>{{$t('overall.cancel')}}</span></button>
</template> </template>
<template v-else> <template v-else>
<button class="table-operation-item" @click="$emit('del',scope.row)" :disabled="isBuiltIn(scope.row)"><i class="nz-icon nz-icon-delete"></i></button> <button class="table-operation-item" @click="$emit('del',scope.row)" v-has="'system_apiKey_delete'" :disabled="isBuiltIn(scope.row)"><i class="nz-icon nz-icon-delete"></i></button>
</template> </template>
</div> </div>
</el-table-column> </el-table-column>
@@ -177,6 +180,7 @@ export default {
}, },
save: function (obj) { save: function (obj) {
const copy = JSON.parse(JSON.stringify(obj)) const copy = JSON.parse(JSON.stringify(obj))
copy.expireAt = this.timezoneToUtcTimeStr(copy.expireAt);
if (copy.role) { if (copy.role) {
copy.roleId = copy.role.id copy.roleId = copy.role.id
} }

View File

@@ -75,7 +75,7 @@
<button type="button" class="nz-btn nz-btn-size-mini-new nz-btn-style-light-new" @click="cancel(scope.row)" :disabled="prevent_opt.save"><span>{{$t('overall.cancel')}}</span></button> <button type="button" class="nz-btn nz-btn-size-mini-new nz-btn-style-light-new" @click="cancel(scope.row)" :disabled="prevent_opt.save"><span>{{$t('overall.cancel')}}</span></button>
</template> </template>
<template v-else> <template v-else>
<button class="table-operation-item" @click="toEdit(scope.row)"><i class="nz-icon nz-icon-edit"></i></button> <button class="table-operation-item" :class="{'table-operation-item-disable':isBuiltIn(scope.row)}" :disabled="isBuiltIn(scope.row)" @click="toEdit(scope.row)"><i class="nz-icon nz-icon-edit"></i></button>
<el-dropdown size="medium" trigger="hover" @command="tableOperation"> <el-dropdown size="medium" trigger="hover" @command="tableOperation">
<div class="table-operation-item table-operation-item--more"> <div class="table-operation-item table-operation-item--more">
<span></span><i class="nz-icon nz-icon-arrow-down"></i> <span></span><i class="nz-icon nz-icon-arrow-down"></i>