初始化询价智能体新仓:同步本地工程并排除密钥与 .env。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
|
||||
enum Api {
|
||||
list = '/sys/online/list',
|
||||
forceLogout = '/sys/online/forceLogout'
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
*/
|
||||
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||
|
||||
/**
|
||||
* 批量删除角色
|
||||
* @param params
|
||||
*/
|
||||
export const forceLogout = (params) => {
|
||||
return defHttp.post({url:Api.forceLogout,params},{isTransformResponse:false})
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
import { FormSchema } from '/@/components/Table';
|
||||
import { render } from "/@/utils/common/renderUtils";
|
||||
import { getToken } from '/@/utils/auth';
|
||||
|
||||
//列表
|
||||
export const columns = [
|
||||
{
|
||||
title:'用户账号',
|
||||
align:"center",
|
||||
dataIndex: 'username',
|
||||
customRender: ( {text,record} ) => {
|
||||
let token = getToken();
|
||||
if(record.token === token) {
|
||||
return text + '(我)'
|
||||
}
|
||||
return text
|
||||
},
|
||||
},{
|
||||
title:'用户姓名',
|
||||
align:"center",
|
||||
dataIndex: 'realname'
|
||||
},{
|
||||
title: '头像',
|
||||
align: "center",
|
||||
width: 120,
|
||||
dataIndex: 'avatar',
|
||||
customRender: render.renderAvatar,
|
||||
},{
|
||||
title:'生日',
|
||||
align:"center",
|
||||
dataIndex: 'birthday'
|
||||
},{
|
||||
title: '性别',
|
||||
align: "center",
|
||||
dataIndex: 'sex',
|
||||
customRender: ({text}) => {
|
||||
return render.renderDict(text, 'sex');
|
||||
}
|
||||
},{
|
||||
title:'手机号',
|
||||
align:"center",
|
||||
dataIndex: 'phone'
|
||||
}
|
||||
];
|
||||
|
||||
//查询区域
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'username',
|
||||
label: '用户账号',
|
||||
component: 'Input',
|
||||
colProps: { span: 6 },
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,65 @@
|
||||
<template>
|
||||
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
</template>
|
||||
</BasicTable>
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="online-user" setup>
|
||||
import { BasicTable, TableAction } from '/@/components/Table';
|
||||
import { columns, searchFormSchema } from './OnlineUser.data';
|
||||
import { list, forceLogout } from './OnlineUser.api';
|
||||
import { useListPage } from '/@/hooks/system/useListPage';
|
||||
import { useMessage } from "/@/hooks/web/useMessage";
|
||||
// 列表页面公共参数、方法
|
||||
const { prefixCls, tableContext, onImportXls, onExportXls } = useListPage({
|
||||
designScope: 'online-user',
|
||||
tableProps: {
|
||||
title: '在线用户',
|
||||
api: list,
|
||||
columns: columns,
|
||||
formConfig: {
|
||||
schemas: searchFormSchema,
|
||||
},
|
||||
actionColumn: {
|
||||
width: 120,
|
||||
},
|
||||
rowSelection: null,
|
||||
},
|
||||
});
|
||||
const [registerTable, { reload }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||
const $message = useMessage();
|
||||
|
||||
//操作栏
|
||||
function getTableAction(record) {
|
||||
return [
|
||||
{
|
||||
label: '强退',
|
||||
popConfirm: {
|
||||
title: '强制退出用户?',
|
||||
confirm: handleForce.bind(null, record),
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退
|
||||
* @param record
|
||||
*/
|
||||
function handleForce(record) {
|
||||
forceLogout({ token: record.token }).then((res)=>{
|
||||
if(res.success){
|
||||
reload();
|
||||
$message.createMessage.success('强制退出用户”'+record.realname+'“成功!');
|
||||
}else{
|
||||
$message.createMessage.warn(res.message);
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user