add. composer package list query
This commit is contained in:
parent
6c3f542956
commit
7c5ce71322
@ -9,6 +9,8 @@ use app\controller\admin\{auth,
|
||||
system\CacheController,
|
||||
system\CacheDataController,
|
||||
system\ConfigController,
|
||||
system\dev\CommandController,
|
||||
system\dev\ComposerController,
|
||||
system\DictionaryController,
|
||||
system\DictionaryDataController,
|
||||
system\FileController,
|
||||
@ -17,8 +19,7 @@ use app\controller\admin\{auth,
|
||||
system\OperateRecordController,
|
||||
system\RequestRecordController,
|
||||
system\RoleController,
|
||||
system\UserController
|
||||
};
|
||||
system\UserController};
|
||||
use app\http\middleware\AuthMiddleware;
|
||||
use think\facade\Route;
|
||||
use think\middleware\AllowCrossDomain;
|
||||
@ -70,6 +71,11 @@ Route::group("adminapi", function () {
|
||||
|
||||
|
||||
Route::group("system", function () {
|
||||
Route::get('composer/package', [ComposerController::class, "list"])->name("system.composerPackageList");
|
||||
Route::get('command', [CommandController::class, "list"])->name("system.commandList");
|
||||
|
||||
|
||||
|
||||
Route::get('login-record/page', [LoginRecordController::class, "page"])->name("system.pageLoginRecords");
|
||||
Route::get('operate-record/page', [OperateRecordController::class, "page"])->name("system.pageOperateRecords");
|
||||
Route::get('request-record/page', [RequestRecordController::class, "page"])->name("system.pageRequestRecords");
|
||||
|
||||
19
z_ele/src/api/system/composer/index.ts
Normal file
19
z_ele/src/api/system/composer/index.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { Package, PackageParam } from './model';
|
||||
|
||||
/**
|
||||
* 查询引入的包列表
|
||||
*/
|
||||
export async function listPackage(params?: PackageParam) {
|
||||
const res = await request.get<ApiResult<Package[]>>(
|
||||
'/system/composer/package',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
5
z_ele/src/api/system/composer/model/index.ts
Normal file
5
z_ele/src/api/system/composer/model/index.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
export interface Package {}
|
||||
|
||||
export interface PackageParam extends PageParam {}
|
||||
@ -52,6 +52,9 @@ export function createWsInstance(config: WsConfig): WsInstance {
|
||||
* 解析后数据格式应该统一为 @{type: "system", event: "事件名称", data: {}}
|
||||
*/
|
||||
switch (jsonData.type) {
|
||||
case WsMessageType.PING:
|
||||
sendMessage(JSON.stringify({ type: 'pong' }));
|
||||
break;
|
||||
case WsMessageType.SCRIPT:
|
||||
scriptEvent.trigger(jsonData.event, jsonData.data);
|
||||
break;
|
||||
@ -123,28 +126,29 @@ export function createWsInstance(config: WsConfig): WsInstance {
|
||||
addSystemMessage('Connection closed');
|
||||
};
|
||||
|
||||
const sendMessage = (event: WsSendEventType, data: any) => {
|
||||
if (!socket.value || !isConnected.value || !data) return;
|
||||
|
||||
const payload = JSON.stringify({event, data});
|
||||
socket.value.send(payload);
|
||||
addMessage(payload, WsMessageType.OUTGOING);
|
||||
};
|
||||
/**
|
||||
* 推送系统消息
|
||||
* Ws.推送消息
|
||||
* @param payload
|
||||
*/
|
||||
const sendMessage = (payload: string): boolean => {
|
||||
if (!socket.value || !isConnected.value || !payload) return false;
|
||||
socket.value.send(payload);
|
||||
// addMessage(payload, WsMessageType.OUTGOING);
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Ws.推送系统消息
|
||||
* @param event
|
||||
* @param data
|
||||
*/
|
||||
const sendSystemMessage = (event: WsSendEventType, data: any) => {
|
||||
if (!socket.value || !isConnected.value || !data) return;
|
||||
const payload = JSON.stringify({type: 'system', event, data});
|
||||
socket.value.send(payload);
|
||||
const sendSystemMessage = (event: WsSendEventType, data: any): boolean => {
|
||||
return sendMessage(JSON.stringify({ type: 'system', event, data }));
|
||||
};
|
||||
|
||||
const clearMessages = () => (messages.value = []);
|
||||
|
||||
// 自动连接
|
||||
console.log('autoConnect->');
|
||||
config.autoConnect && connectSocket();
|
||||
|
||||
return {
|
||||
|
||||
@ -10,10 +10,9 @@ export enum WsSystemEvent {
|
||||
LOCK_CLIENT = 'lockClient'
|
||||
}
|
||||
|
||||
|
||||
export enum WsSendEventType {
|
||||
BIND_CONNECT_ID = 'bind_connect_id',
|
||||
LOCK_CLIENT_SCREEN = 'lock_client_screen',
|
||||
LOCK_CLIENT_SCREEN = 'lock_client_screen'
|
||||
}
|
||||
|
||||
export enum WsConnectionStatus {
|
||||
@ -27,7 +26,8 @@ export enum WsMessageType {
|
||||
INCOMING = 'incoming',
|
||||
OUTGOING = 'outgoing',
|
||||
SYSTEM = 'system',
|
||||
SCRIPT = 'script'
|
||||
SCRIPT = 'script',
|
||||
PING = 'ping'
|
||||
}
|
||||
|
||||
export interface WsMessage {
|
||||
@ -68,7 +68,7 @@ export interface WsInstance {
|
||||
connectSocket: () => void;
|
||||
disconnectSocket: () => void;
|
||||
/** 发送系统消息(跟踪系统事件) **/
|
||||
sendSystemMessage: (event: WsSystemEvent, data: any) => void;
|
||||
sendSystemMessage: (event: WsSendEventType, data: any) => boolean;
|
||||
|
||||
sendMessage: (event: WsSendEventType, data: any) => void;
|
||||
clearMessages: () => void;
|
||||
|
||||
87
z_ele/src/views/system/composer/package/index.vue
Normal file
87
z_ele/src/views/system/composer/package/index.vue
Normal file
@ -0,0 +1,87 @@
|
||||
<template>
|
||||
<ele-page>
|
||||
<ele-card :body-style="{ paddingTop: '8px' }">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="roleId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:show-overflow-tooltip="true"
|
||||
:highlight-current-row="true"
|
||||
cache-key="systemRoleTable"
|
||||
/>
|
||||
</ele-card>
|
||||
</ele-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import type { EleProTable } from 'ele-admin-plus';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
Columns
|
||||
} from 'ele-admin-plus/es/ele-pro-table/types';
|
||||
import { listPackage } from '@/api/system/composer';
|
||||
|
||||
defineOptions({ name: 'SystemComposerPackage' });
|
||||
|
||||
/** 表格实例 */
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
/** 表格列配置 */
|
||||
const columns = ref<Columns>([
|
||||
{
|
||||
type: 'selection',
|
||||
columnKey: 'selection',
|
||||
width: 50,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
type: 'index',
|
||||
columnKey: 'index',
|
||||
width: 50,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'roleName',
|
||||
label: '角色名称',
|
||||
sortable: 'custom',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
prop: 'roleCode',
|
||||
label: '角色标识',
|
||||
sortable: 'custom',
|
||||
minWidth: 120
|
||||
},
|
||||
{
|
||||
prop: 'comments',
|
||||
label: '备注',
|
||||
sortable: 'custom',
|
||||
minWidth: 140
|
||||
},
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '创建时间',
|
||||
sortable: 'custom',
|
||||
width: 180,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
columnKey: 'action',
|
||||
label: '操作',
|
||||
width: 200,
|
||||
align: 'center' /* ,
|
||||
fixed: 'right' */,
|
||||
slot: 'action',
|
||||
hideInPrint: true,
|
||||
hideInExport: true
|
||||
}
|
||||
]);
|
||||
|
||||
/** 表格数据源 */
|
||||
const datasource: DatasourceFunction = ({ pages, where, orders }) => {
|
||||
return listPackage({ ...where, ...orders, ...pages });
|
||||
};
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user