77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||
|
||
import { getOaRobotList } from '#/views/system/oa-robot/api';
|
||
|
||
interface RowType {
|
||
id: number;
|
||
platform_code: string;
|
||
name: string;
|
||
webhook_url: string;
|
||
secret: string;
|
||
status: number;
|
||
remark: string;
|
||
chat_ids: number[];
|
||
chat_names: string;
|
||
created_at: string;
|
||
}
|
||
|
||
/**
|
||
* 机器人列表表格配置
|
||
* 列表中的 webhook_url 和 secret 字段由后端做了 mask('****' 或 ''),不会泄露明文
|
||
* chat_names:后端按「、」拼接的群聊名称串(展示用),详情接口才返回 chat_ids 数组(编辑回显用)
|
||
*/
|
||
export const gridOptions: VxeGridProps<RowType> = {
|
||
checkboxConfig: {
|
||
highlight: true,
|
||
labelField: '',
|
||
},
|
||
columnConfig: {
|
||
useKey: true,
|
||
},
|
||
rowConfig: {
|
||
useKey: true,
|
||
},
|
||
columns: [
|
||
{ type: 'checkbox', width: 60 },
|
||
{ field: 'id', align: 'left', title: 'ID', width: 80 },
|
||
{ field: 'platform_code', align: 'left', title: '平台', width: 120, slots: { default: 'platform_code' } },
|
||
{ field: 'name', align: 'left', title: '机器人名称' },
|
||
{ field: 'chat_names', align: 'left', title: '绑定群聊/群ID', slots: { default: 'chat_names' } },
|
||
{ field: 'webhook_url', align: 'left', title: '凭证', width: 130, slots: { default: 'webhook_status' } },
|
||
{ field: 'secret', align: 'left', title: '密钥', width: 100, slots: { default: 'secret_status' } },
|
||
{ field: 'status', align: 'left', title: '状态', width: 100, slots: { default: 'status' } },
|
||
{ field: 'remark', align: 'left', title: '备注' },
|
||
{ field: 'created_at', align: 'left', title: '创建时间', width: 180 },
|
||
{ type: 'html', title: '操作', slots: { default: 'action' }, width: 320, fixed: 'right' },
|
||
],
|
||
keepSource: true,
|
||
pagerConfig: {},
|
||
proxyConfig: {
|
||
ajax: {
|
||
query: async ({ page }, formValues) => {
|
||
return await getOaRobotList({
|
||
page: page.currentPage,
|
||
pageSize: page.pageSize,
|
||
...formValues,
|
||
});
|
||
},
|
||
},
|
||
},
|
||
height: 'auto',
|
||
border: false,
|
||
toolbarConfig: {
|
||
search: true,
|
||
refresh: true,
|
||
print: false,
|
||
export: false,
|
||
zoom: true,
|
||
slots: {
|
||
buttons: 'toolbar-actions',
|
||
},
|
||
custom: {
|
||
icon: 'vxe-icon-menu',
|
||
},
|
||
},
|
||
showOverflow: false,
|
||
};
|