22 <el-dialog
33 :title =" $t('layout.apiKey')"
44 v-model =" dialogVisible"
5- width =" 800 "
5+ width =" 1080 "
66 :close-on-click-modal =" false"
77 :close-on-press-escape =" false"
88 align-center
2222 <el-button type =" primary" class =" mb-16" @click =" createApiKey" >
2323 {{ $t('common.create') }}
2424 </el-button >
25- <el -table
25+ <app -table
2626 :data =" apiKey"
2727 :loading =" loading"
2828 style =" min-height : 300px "
2929 :max-height =" 420"
30+ :pagination-config =" paginationConfig"
31+ @sizeChange =" handleSizeChange"
32+ @changePage =" getApiKeyList"
3033 >
3134 <el-table-column prop =" secret_key" label =" API Key" >
3235 <template #default =" { row } " >
3841 </el-button >
3942 </template >
4043 </el-table-column >
41- <el-table-column :label =" $t('common.status. label')" width =" 80 " >
44+ <el-table-column :label =" $t('views.document.enableStatus. label')" width =" 100 " >
4245 <template #default =" { row } " >
43- <div @click.stop >
44- <el-switch size =" small" v-model =" row.is_active" @change =" changeState($event, row)" />
46+ <div v-if =" row.is_active" class =" flex align-center" >
47+ <el-icon class =" color-success mr-8" style =" font-size : 16px " >
48+ <SuccessFilled />
49+ </el-icon >
50+ <span class =" color-text-primary" >
51+ {{ $t('common.status.enabled') }}
52+ </span >
53+ </div >
54+ <div v-else class =" flex align-center" >
55+ <AppIcon iconName =" app-disabled" class =" color-secondary mr-8" ></AppIcon >
56+ <span class =" color-text-primary" >
57+ {{ $t('common.status.disabled') }}
58+ </span >
4559 </div >
4660 </template >
4761 </el-table-column >
48- <el-table-column prop =" name" :label =" $t('common.createDate')" width =" 170" >
62+ <el-table-column :label =" $t('layout.crossSettings')" width =" 100" >
63+ <template #default =" { row } " >
64+ <el-tag type =" info" class =" info-tag" >
65+ {{ $t('views.system.authentication.scanTheQRCode.alreadyTurnedOn') }}
66+ </el-tag >
67+ <el-tag class =" blue-tag" >
68+ {{ $t('views.system.authentication.scanTheQRCode.notEnabled') }}
69+ </el-tag >
70+ </template >
71+ </el-table-column >
72+
73+ <el-table-column :label =" $t('layout.about.expiredTime')" width =" 170" >
74+ <template #default =" { row } " >
75+ <!-- {{ datetimeFormat(row.create_time) }} -->
76+ </template >
77+ </el-table-column >
78+ <el-table-column :label =" $t('common.createDate')" width =" 170" prop =" create_time" sortable >
4979 <template #default =" { row } " >
5080 {{ datetimeFormat(row.create_time) }}
5181 </template >
5282 </el-table-column >
53- <el-table-column :label =" $t('common.setting ')" align =" left" width =" 80 " >
83+ <el-table-column :label =" $t('common.operation ')" align =" left" width =" 130 " >
5484 <template #default =" { row } " >
85+ <span @click.stop >
86+ <el-switch size =" small" v-model =" row.is_active" @change =" changeState($event, row)" />
87+ </span >
88+ <el-divider direction =" vertical" />
5589 <span class =" mr-4" >
5690 <el-tooltip effect =" dark" :content =" $t('common.setting')" placement =" top" >
5791 <el-button type =" primary" text @click.stop =" settingApiKey(row)" >
58- <AppIcon iconName =" app-setting " ></AppIcon >
92+ <AppIcon iconName =" app-edit " ></AppIcon >
5993 </el-button >
6094 </el-tooltip >
6195 </span >
66100 </el-tooltip >
67101 </template >
68102 </el-table-column >
69- </el -table >
103+ </app -table >
70104 <SettingAPIKeyDialog ref =" SettingAPIKeyDialogRef" @refresh =" refresh" />
71105 </el-dialog >
72106</template >
73107<script setup lang="ts">
74- import { ref , watch } from ' vue'
108+ import { ref , watch , reactive } from ' vue'
75109import { useRoute } from ' vue-router'
76110import { copyClick } from ' @/utils/clipboard'
77111import systemKeyApi from ' @/api/system/api-key'
78112import { datetimeFormat } from ' @/utils/time'
79113import { MsgSuccess , MsgConfirm } from ' @/utils/message'
80114import { t } from ' @/locales'
81- import SettingAPIKeyDialog from ' @/views/application-overview/component/SettingAPIKeyDialog .vue'
115+ import SettingAPIKeyDialog from ' @/views/application-overview/component/SettingAPIKeyDrawer .vue'
82116
83117const route = useRoute ()
84118const {
@@ -91,6 +125,7 @@ const props = defineProps({
91125 default: ' ' ,
92126 },
93127})
128+
94129const emit = defineEmits ([' addData' ])
95130
96131const apiUrl = window .location .origin + ` ${window .MaxKB .prefix }/api-doc/ `
@@ -99,12 +134,23 @@ const dialogVisible = ref<boolean>(false)
99134const loading = ref (false )
100135const apiKey = ref <any >(null )
101136
137+ const paginationConfig = reactive ({
138+ current_page: 1 ,
139+ page_size: 20 ,
140+ total: 0 ,
141+ })
142+
102143watch (dialogVisible , (bool ) => {
103144 if (! bool ) {
104145 apiKey .value = null
105146 }
106147})
107148
149+ function handleSizeChange() {
150+ paginationConfig .current_page = 1
151+ getApiKeyList ()
152+ }
153+
108154function settingApiKey(row : any ) {
109155 SettingAPIKeyDialogRef .value .open (row , ' USER' )
110156}
@@ -140,9 +186,10 @@ function changeState(bool: boolean, row: any) {
140186}
141187
142188function createApiKey() {
143- systemKeyApi .postAPIKey (loading ).then ((res ) => {
144- getApiKeyList ()
145- })
189+ // systemKeyApi.postAPIKey(loading).then((res) => {
190+ // getApiKeyList()
191+ // })
192+ SettingAPIKeyDialogRef .value .open (null , ' USER' )
146193}
147194
148195const open = () => {
0 commit comments