style(api): 统一代码格式化规范
- 调整 import 语句格式,统一空格和引号风格 - 修复函数参数跨行时的格式对齐问题 - 清理多余空行和注释中的空白字符 - 统一对象属性结尾逗号的使用规范 - 规范化字符串拼接和模板语法的格式 - 优化长参数列表的换行和缩进格式
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
<div class="page">
|
||||
<a-page-header :ghost="false" title="秘钥管理">
|
||||
<div class="ele-text-secondary">
|
||||
API key 是您访WebSoft-API
|
||||
的密钥,具有该账户完全的权限,请您妥善保管。
|
||||
API key 是您访WebSoft-API 的密钥,具有该账户完全的权限,请您妥善保管。
|
||||
</div>
|
||||
</a-page-header>
|
||||
<div class="ele-body">
|
||||
@@ -26,9 +25,7 @@
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'accessSecret'">
|
||||
<span>
|
||||
sk-******************
|
||||
</span>
|
||||
<span> sk-****************** </span>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
@@ -46,110 +43,107 @@
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<AccessKeyEdit v-model:visible="showEdit" :data="current" @done="reload"/>
|
||||
<AccessKeyEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {ref, reactive} from 'vue';
|
||||
import {message} from 'ant-design-vue/es';
|
||||
import type {EleProTable} from 'ele-admin-pro/es';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import AccessKeyEdit from './components/accesskey-edit.vue';
|
||||
import {toDateString} from 'ele-admin-pro/es';
|
||||
import {pageAccessKey, removeAccessKey} from '@/api/system/access-key';
|
||||
import {AccessKey, AccessKeyParam} from '@/api/system/access-key/model';
|
||||
import {messageLoading} from 'ele-admin-pro/es';
|
||||
import { ref, reactive } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import type { EleProTable } from 'ele-admin-pro/es';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import AccessKeyEdit from './components/accesskey-edit.vue';
|
||||
import { toDateString } from 'ele-admin-pro/es';
|
||||
import { pageAccessKey, removeAccessKey } from '@/api/system/access-key';
|
||||
import { AccessKey, AccessKeyParam } from '@/api/system/access-key/model';
|
||||
import { messageLoading } from 'ele-admin-pro/es';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '名称',
|
||||
key: 'accessKey',
|
||||
dataIndex: 'accessKey',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: 'Key',
|
||||
key: 'accessSecret',
|
||||
dataIndex: 'accessSecret',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
align: 'center',
|
||||
customRender: ({text}) => toDateString(text, 'yyyy-MM-dd HH:mm:ss'),
|
||||
width: 180,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '名称',
|
||||
key: 'accessKey',
|
||||
dataIndex: 'accessKey',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: 'Key',
|
||||
key: 'accessSecret',
|
||||
dataIndex: 'accessSecret',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
align: 'center',
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd HH:mm:ss'),
|
||||
width: 180
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<AccessKey[]>([]);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<any>(null);
|
||||
// 表格选中数据
|
||||
const selection = ref<AccessKey[]>([]);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<any>(null);
|
||||
|
||||
// 默认搜索条件
|
||||
const defaultWhere = reactive({
|
||||
code: '',
|
||||
phone: '',
|
||||
username: '',
|
||||
nickname: '',
|
||||
userId: undefined
|
||||
});
|
||||
// 默认搜索条件
|
||||
const defaultWhere = reactive({
|
||||
code: '',
|
||||
phone: '',
|
||||
username: '',
|
||||
nickname: '',
|
||||
userId: undefined
|
||||
});
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ where }) => {
|
||||
return pageAccessKey({ ...where });
|
||||
};
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({where}) => {
|
||||
return pageAccessKey({...where});
|
||||
};
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: any) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: any) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: AccessKey) => {
|
||||
const hide = messageLoading('请求中..', 0);
|
||||
removeAccessKey(row.id)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: AccessKeyParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({page: 1, where});
|
||||
};
|
||||
/* 删除单个 */
|
||||
const remove = (row: AccessKey) => {
|
||||
const hide = messageLoading('请求中..', 0);
|
||||
removeAccessKey(row.id)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: AccessKeyParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ page: 1, where });
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'AccessKeyIndex'
|
||||
};
|
||||
export default {
|
||||
name: 'AccessKeyIndex'
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user