mirror of
https://gitee.com/bootx/dax-pay-ui.git
synced 2026-01-13 06:03:51 +08:00
feat 同步脚手架代码
This commit is contained in:
@@ -44,6 +44,7 @@ import {
|
||||
Space,
|
||||
Statistic,
|
||||
Cascader,
|
||||
Transfer,
|
||||
} from 'ant-design-vue'
|
||||
|
||||
export function registerGlobComp(app: App) {
|
||||
@@ -90,6 +91,7 @@ export function registerGlobComp(app: App) {
|
||||
app.use(Form)
|
||||
app.use(Spin)
|
||||
app.use(Dropdown)
|
||||
app.use(Transfer)
|
||||
app.use(Input)
|
||||
app.use(Statistic)
|
||||
}
|
||||
|
||||
16
src/views/baseapi/cache/CacheClear.api.ts
vendored
Normal file
16
src/views/baseapi/cache/CacheClear.api.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { defHttp } from '@/utils/http/axios'
|
||||
import { Result } from '#/axios'
|
||||
|
||||
/**
|
||||
* 查询所有缓存前缀
|
||||
*/
|
||||
export function getCachePrefix() {
|
||||
return defHttp.get<Result<string[]>>({ url: '/cache/clear/getCachePrefix' })
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除指定前缀的缓存
|
||||
*/
|
||||
export function clearCacheByPrefix(params) {
|
||||
return defHttp.post<Result<void>>({ url: '/cache/clear/prefix', data: params })
|
||||
}
|
||||
71
src/views/baseapi/cache/CacheClear.vue
vendored
Normal file
71
src/views/baseapi/cache/CacheClear.vue
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="m-3 p-3 bg-white">
|
||||
<a-transfer
|
||||
show-search
|
||||
v-model:target-keys="targetKeys"
|
||||
:data-source="list"
|
||||
:filter-option="filterOption"
|
||||
:render="(item) => item.title"
|
||||
/>
|
||||
<a-button class="mt-5" type="primary" :disabled="!targetKeys.length" @click="submit"
|
||||
>删除</a-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue'
|
||||
import { getCachePrefix, clearCacheByPrefix } from './CacheClear.api'
|
||||
import { useMessage } from '@/hooks/web/useMessage'
|
||||
|
||||
const { createMessage, createConfirm } = useMessage()
|
||||
|
||||
interface Data {
|
||||
key: string
|
||||
title: string
|
||||
description: string
|
||||
chosen: boolean
|
||||
}
|
||||
const list = ref<Data[]>([])
|
||||
|
||||
const targetKeys = ref<string[]>([])
|
||||
onMounted(() => {
|
||||
initData()
|
||||
})
|
||||
function initData() {
|
||||
getCachePrefix().then(({ data }) => {
|
||||
list.value = data.map((item) => {
|
||||
return {
|
||||
key: item,
|
||||
title: item,
|
||||
description: item,
|
||||
chosen: false,
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交
|
||||
*/
|
||||
function submit() {
|
||||
createConfirm({
|
||||
iconType: 'warning',
|
||||
title: '警告',
|
||||
content: '是否删除选中的缓存前缀对应的数据',
|
||||
onOk: () => {
|
||||
clearCacheByPrefix(targetKeys.value).then(() => {
|
||||
createMessage.success('缓存清除成功')
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function filterOption(inputValue: string, option: Data) {
|
||||
return option.description.toLowerCase().indexOf(inputValue.toLowerCase()) > -1
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user