3939 <template #default =" { row } " >
4040 <div v-if =" row.is_active" class =" flex align-center" >
4141 <el-icon class =" color-success mr-8" style =" font-size : 16px " >
42- <SuccessFilled />
42+ <SuccessFilled />
4343 </el-icon >
4444 <span class =" color-text-primary" >
4545 {{ $t('common.status.enabled') }}
8989 <el-table-column :label =" $t('common.operation')" align =" left" width =" 130" >
9090 <template #default =" { row } " >
9191 <span @click.stop >
92- <el-switch size =" small" v-model =" row.is_active" @change =" changeState(row)" />
92+ <el-switch size =" small" v-model =" row.is_active" @change =" changeState($event, row)" />
9393 </span >
94- <el-divider direction =" vertical" />
94+ <el-divider direction =" vertical" />
9595 <span class =" mr-4" >
9696 <el-tooltip effect =" dark" :content =" $t('common.setting')" placement =" top" >
9797 <el-button type =" primary" text @click.stop =" settingApiKey(row)" >
107107 </template >
108108 </el-table-column >
109109 </app-table >
110- <SettingAPIKeyDialog ref =" SettingAPIKeyDialogRef" @refresh =" refresh" />
110+ <SettingAPIKeyDialog ref =" SettingAPIKeyDialogRef" @refresh =" refresh" />
111111 </el-dialog >
112112</template >
113113<script setup lang="ts">
114- import { ref , watch , computed , reactive } from ' vue'
115- import { useRoute } from ' vue-router'
116- import { copyClick } from ' @/utils/clipboard'
114+ import {ref , watch , computed , reactive } from ' vue'
115+ import {useRoute } from ' vue-router'
116+ import {copyClick } from ' @/utils/clipboard'
117117import SettingAPIKeyDialog from ' ./SettingAPIKeyDrawer.vue'
118- import { datetimeFormat , fromNowDate } from ' @/utils/time'
119- import { MsgSuccess , MsgConfirm } from ' @/utils/message'
120- import { t } from ' @/locales'
121- import { loadSharedApi } from ' @/utils/dynamics-api/shared-api'
118+ import {datetimeFormat , fromNowDate } from ' @/utils/time'
119+ import {MsgSuccess , MsgConfirm } from ' @/utils/message'
120+ import {t } from ' @/locales'
121+ import {loadSharedApi } from ' @/utils/dynamics-api/shared-api'
122122
123123const orderBy = ref <string >(' ' )
124124const route = useRoute ()
125125const {
126- params : { id },
126+ params : {id },
127127} = route
128128
129129const apiType = computed (() => {
@@ -173,22 +173,23 @@ function deleteApiKey(row: any) {
173173 },
174174 )
175175 .then (() => {
176- loadSharedApi ({ type: ' applicationKey' , systemType: apiType .value })
176+ loadSharedApi ({type: ' applicationKey' , systemType: apiType .value })
177177 .delAPIKey (id as string , row .id , loading )
178178 .then (() => {
179179 MsgSuccess (t (' common.deleteSuccess' ))
180180 getApiKeyList ()
181181 })
182182 })
183- .catch (() => {})
183+ .catch (() => {
184+ })
184185}
185186
186- async function changeState(row : any ) {
187+ async function changeState(bool : boolean , row : any ) {
187188 const obj = {
188- is_active: ! row . is_active ,
189+ is_active: bool ,
189190 }
190191 const str = obj .is_active ? t (' common.status.enabled' ) : t (' common.status.disabled' )
191- await loadSharedApi ({ type: ' applicationKey' , systemType: apiType .value })
192+ await loadSharedApi ({type: ' applicationKey' , systemType: apiType .value })
192193 .putAPIKey (id as string , row .id , obj , loading )
193194 .then (() => {
194195 MsgSuccess (str )
@@ -201,7 +202,7 @@ async function changeState(row: any) {
201202}
202203
203204function createApiKey() {
204- loadSharedApi ({ type: ' applicationKey' , systemType: apiType .value })
205+ loadSharedApi ({type: ' applicationKey' , systemType: apiType .value })
205206 .postAPIKey (id as string , loading )
206207 .then (() => {
207208 getApiKeyList ()
@@ -217,7 +218,7 @@ function getApiKeyList() {
217218 const param = {
218219 order_by: orderBy .value ,
219220 }
220- loadSharedApi ({ type: ' applicationKey' , systemType: apiType .value })
221+ loadSharedApi ({type: ' applicationKey' , systemType: apiType .value })
221222 .getAPIKey (
222223 id as string ,
223224 paginationConfig .current_page ,
@@ -231,7 +232,7 @@ function getApiKeyList() {
231232 })
232233}
233234
234- function handleSortChange({ prop , order }: { prop: string ; order: string }) {
235+ function handleSortChange({prop , order }: { prop: string ; order: string }) {
235236 orderBy .value = order === ' ascending' ? prop : ` -${prop } `
236237 getApiKeyList ()
237238}
@@ -249,7 +250,7 @@ function refresh() {
249250 getApiKeyList ()
250251}
251252
252- defineExpose ({ open })
253+ defineExpose ({open })
253254 </script >
254255<style lang="scss" scoped>
255256.api-key-container {
0 commit comments