### HTTP Request Utilities with Axios Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Demonstrates various HTTP request methods (GET, POST, POST form, custom requests) and file download using the configured Axios instance. Includes examples of basic usage and advanced configurations. The module automatically injects authorization tokens and handles common server responses like session expiry and access denied errors. ```javascript import request, { get, post, postForm, downFile } from '@/utils/request' // Basic GET request const result = await get('/api/endpoint', { param1: 'value1' }) // Basic POST request const postResult = await post('/api/endpoint', { data: 'value' }) // Form submission const formResult = await postForm('/api/form', formData, { headers: { 'Content-Type': 'multipart/form-data' } }) // Custom request with full options const customResult = await request({ url: '/api/custom', method: 'PUT', data: { field: 'value' }, params: { query: 'param' }, headers: { 'Custom-Header': 'value' }, timeout: 60000 }) // File download with automatic filename extraction await downFile('/api/export', { filters: 'value' }) // Automatically saves file with Content-Disposition filename // Request interceptor automatically adds: // - Authorization: Bearer // - userid: // - userName: // Response codes handled automatically: // - 200: Success, returns data // - 401: Session expired, prompts re-login // - 403: Access denied, redirects to 401 page // - 500: Server error, shows error message // - 429: Rate limited, shows rate limit message ``` -------------------------------- ### HTTP Request Utilities Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt This section details the usage of the configured Axios instance for making various types of HTTP requests, including GET, POST, form submissions, custom requests, and file downloads. It also outlines the automatic request interceptors and response code handling. ```APIDOC ## HTTP Request Utilities The request module provides a configured Axios instance with automatic token injection, error handling, and file download utilities. ### Basic GET Request ```javascript import { get } from '@/utils/request'; const result = await get('/api/endpoint', { param1: 'value1' }); ``` ### Basic POST Request ```javascript import { post } from '@/utils/request'; const postResult = await post('/api/endpoint', { data: 'value' }); ``` ### Form Submission ```javascript import { postForm } from '@/utils/request'; const formResult = await postForm('/api/form', formData, { headers: { 'Content-Type': 'multipart/form-data' } }); ``` ### Custom Request ```javascript import request from '@/utils/request'; const customResult = await request({ url: '/api/custom', method: 'PUT', data: { field: 'value' }, params: { query: 'param' }, headers: { 'Custom-Header': 'value' }, timeout: 60000 }); ``` ### File Download ```javascript import { downFile } from '@/utils/request'; await downFile('/api/export', { filters: 'value' }); // Automatically saves file with Content-Disposition filename ``` ### Request Interceptors Request interceptors automatically add the following headers: - `Authorization`: `Bearer ` - `userid`: `` - `userName`: `` ### Response Code Handling The following response codes are handled automatically: - `200`: Success, returns data. - `401`: Session expired, prompts re-login. - `403`: Access denied, redirects to 401 page. - `500`: Server error, shows error message. - `429`: Rate limited, shows rate limit message. ``` -------------------------------- ### Scheduled Tasks API (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Manages background jobs using Quartz.NET integration. It supports querying, retrieving, creating, updating, deleting, starting, stopping, running, and exporting scheduled tasks. Requires the '@/api/monitor/job' module. ```javascript import { queryTasks, getTasks, getAllTasks, createTasks, updateTasks, deleteTasks, startTasks, stopTasks, runTasks, exportTasks } from '@/api/monitor/job' // Query tasks with pagination const tasks = await queryTasks({ pageNum: 1, pageSize: 10, name: '', jobGroup: 'DEFAULT' }) // Get all tasks const allTasks = await getAllTasks() // Get task details const task = await getTasks('task-id-123') // Response: { code: 200, data: { id: 'xxx', name: 'CleanupTask', jobGroup: 'DEFAULT', cron: '0 0 2 * * ?', ... } } // Create new scheduled task await createTasks({ name: 'DailyReport', jobGroup: 'REPORT', assemblyName: 'ZR.Tasks', className: 'DailyReportTask', cron: '0 0 8 * * ?', // Run at 8:00 AM daily triggerType: 1, // 1: cron, 2: simple beginTime: '2024-01-01', endTime: '2024-12-31', remark: 'Generate daily report' }) // Update task await updateTasks({ id: 'task-id-123', name: 'DailyReport', cron: '0 30 8 * * ?', // Change to 8:30 AM remark: 'Updated schedule' }) // Start task await startTasks('task-id-123') // Stop task await stopTasks('task-id-123') // Run task once immediately await runTasks('task-id-123') // Delete task await deleteTasks('task-id-123') // Export tasks await exportTasks() ``` -------------------------------- ### System Configuration API Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Manages system parameters that control application behavior across the platform. ```APIDOC ## Query Configuration List API ### Description Retrieves a paginated list of system configurations with filtering options. ### Method GET ### Endpoint /system/config ### Parameters #### Query Parameters - **pageNum** (integer) - Required - The page number for pagination. - **pageSize** (integer) - Required - The number of items per page. - **configName** (string) - Optional - Filter by configuration name. - **configKey** (string) - Optional - Filter by configuration key. - **configType** (string) - Optional - Filter by configuration type ('Y': system built-in, 'N': custom). ### Request Example ```json { "pageNum": 1, "pageSize": 10, "configName": "", "configKey": "", "configType": "Y" } ``` --- ## Get Configuration by ID API ### Description Retrieves a specific system configuration by its ID. ### Method GET ### Endpoint /system/config/{configId} ### Parameters #### Path Parameters - **configId** (integer) - Required - The ID of the configuration to retrieve. ### Response #### Success Response (200) - **code** (integer) - The status code, 200 for success. - **data** (object) - The configuration details. - **configId** (integer) - The ID of the configuration. - **configName** (string) - The name of the configuration. - **configKey** (string) - The key of the configuration. - **configValue** (string) - The value of the configuration. #### Response Example ```json { "code": 200, "data": { "configId": 1, "configName": "Captcha Switch", "configKey": "sys.account.captchaOnOff", "configValue": "true" } } ``` --- ## Get Configuration Value by Key API ### Description Retrieves the value of a system configuration using its key. This is a common way to access configuration settings. ### Method GET ### Endpoint /system/config/configKey/{configKey} ### Parameters #### Path Parameters - **configKey** (string) - Required - The key of the configuration to retrieve. ### Response #### Success Response (200) - **code** (integer) - The status code, 200 for success. - **data** (string) - The value of the configuration. #### Response Example ```json { "code": 200, "data": "true" } ``` ### Common Config Keys: - **sys.account.captchaOnOff**: Enable/disable login captcha. - **sys.account.registerUser**: Allow user registration. - **sys.index.skinName**: Default theme skin. - **sys.index.sideTheme**: Sidebar theme (theme-dark, theme-light). --- ## Add Configuration API ### Description Adds a new system configuration parameter. ### Method POST ### Endpoint /system/config ### Parameters #### Request Body - **configName** (string) - Required - The name of the configuration. - **configKey** (string) - Required - The unique key for the configuration. - **configValue** (string) - Required - The value of the configuration. - **configType** (string) - Required - The type of configuration ('Y': system, 'N': custom). - **remark** (string) - Optional - A description or remark for the configuration. ### Request Example ```json { "configName": "Custom Setting", "configKey": "custom.setting.key", "configValue": "value", "configType": "N", "remark": "Custom configuration" } ``` --- ## Update Configuration API ### Description Updates an existing system configuration parameter. ### Method PUT ### Endpoint /system/config ### Parameters #### Request Body - **configId** (integer) - Required - The ID of the configuration to update. - **configValue** (string) - Optional - The new value for the configuration. - **remark** (string) - Optional - An updated description or remark. ### Request Example ```json { "configId": 100, "configValue": "new_value", "remark": "Updated setting" } ``` --- ## Delete Configuration API ### Description Deletes a system configuration parameter. ### Method DELETE ### Endpoint /system/config/{configId} ### Parameters #### Path Parameters - **configId** (integer) - Required - The ID of the configuration to delete. --- ## Refresh Configuration Cache API ### Description Refreshes the system's configuration cache to apply any recent changes. ### Method DELETE ### Endpoint /system/config/refreshCache ``` -------------------------------- ### Manage System Menus and Routes (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt APIs for managing system menus, including hierarchical structure, permission buttons, and route configuration. Supports CRUD operations and retrieving menu trees for selection and user routing. ```javascript import { listMenu, getMenu, addMenu, updateMenu, delMenu, treeselect, roleMenuTreeselect, getRouters, changeMenuSort } from '@/api/system/menu' // Get menu tree list const menus = await listMenu({ menuName: '', status: '0' }) // Response: { code: 200, data: [{ menuId: 1, menuName: 'System', children: [...] }] } // Get menu dropdown tree for selection const menuTree = await treeselect() // Response: { code: 200, data: [{ id: 1, label: 'System Management', children: [...] }] } // Get role's menu tree with checked status const roleMenus = await roleMenuTreeselect(1) // Response: { code: 200, data: { menus: [...], checkedKeys: [100, 101, 102] } } // Get dynamic routes for current user const routes = await getRouters() // Response: { code: 200, data: [{ path: '/system', component: 'Layout', children: [...] }] } // Get menu details const menu = await getMenu(100) // Create menu item await addMenu({ parentId: 0, menuName: 'Dashboard', menuType: 'M', // M: directory, C: menu, F: button orderNum: 1, path: 'dashboard', component: 'dashboard/index', perms: 'dashboard:view', // Permission identifier icon: 'dashboard', visible: '0', // 0: show, 1: hide status: '0', isFrame: '1', // 0: external link, 1: internal isCache: '0' // 0: cache, 1: no cache }) // Update menu await updateMenu({ menuId: 100, menuName: 'Dashboard Updated', orderNum: 2 }) // Change menu sort order await changeMenuSort({ menuId: 100, orderNum: 1, type: 'UP' }) // Delete menu await delMenu(100) ``` -------------------------------- ### Manage System Configurations (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Manages system parameters that control application behavior. This module allows listing configurations, retrieving by ID or key, adding, updating, deleting configurations, and refreshing the configuration cache. It relies on APIs from '@/api/system/config'. ```javascript import { listConfig, getConfig, getConfigKey, addConfig, updateConfig, delConfig, refreshCache } from '@/api/system/config' // Query config list const configs = await listConfig({ pageNum: 1, pageSize: 10, configName: '', configKey: '', configType: 'Y' // Y: system built-in, N: custom }) // Get config by ID const config = await getConfig(1) // Response: { code: 200, data: { configId: 1, configName: 'Captcha Switch', configKey: 'sys.account.captchaOnOff', configValue: 'true', ... } } // Get config value by key (most common usage) const captchaEnabled = await getConfigKey('sys.account.captchaOnOff') // Response: { code: 200, data: 'true' } // Common config keys: // - sys.account.captchaOnOff: Enable/disable login captcha // - sys.account.registerUser: Allow user registration // - sys.index.skinName: Default theme skin // - sys.index.sideTheme: Sidebar theme (theme-dark, theme-light) // Add configuration await addConfig({ configName: 'Custom Setting', configKey: 'custom.setting.key', configValue: 'value', configType: 'N', remark: 'Custom configuration' }) // Update configuration await updateConfig({ configId: 100, configValue: 'new_value', remark: 'Updated setting' }) // Delete configuration await delConfig(100) // Refresh config cache await refreshCache() ``` -------------------------------- ### Manage Notices and Announcements (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Handles system announcements and notifications, supporting real-time delivery. Functions include querying notices for navigation, listing notices with pagination, retrieving details, creating, updating, deleting, and sending notices. Dependencies are from the '@/api/system/notice' module. ```javascript import { queryNotice, listNotice, getNotice, addNotice, updateNotice, delNotice, sendNotice } from '@/api/system/notice' // Query notices for navigation bar const navNotices = await queryNotice({ status: '0', noticeType: '1' }) // Query notice list with pagination const notices = await listNotice({ pageNum: 1, pageSize: 10, noticeTitle: '', noticeType: '', // 1: notification, 2: announcement createBy: '', status: '0' }) // Get notice details const notice = await getNotice(1) // Response: { code: 200, data: { noticeId: 1, noticeTitle: 'System Update', noticeType: '1', noticeContent: '...', ... } } // Create notice await addNotice({ noticeTitle: 'System Maintenance Notice', noticeType: '2', // Announcement noticeContent: '

System will be under maintenance on...

', status: '0' }) // Update notice await updateNotice({ noticeId: 1, noticeTitle: 'Updated Notice Title', noticeContent: 'Updated content...' }) // Send notice to users (real-time via SignalR) await sendNotice(1) // Delete notice await delNotice(1) ``` -------------------------------- ### Notice & Announcement API Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Manages system announcements and notifications with real-time delivery support. ```APIDOC ## Query Notices for Navigation Bar API ### Description Queries notices suitable for display in a navigation bar, typically active and of a specific type. ### Method GET ### Endpoint /system/notice/query ### Parameters #### Query Parameters - **status** (string) - Required - The status of the notice (e.g., '0' for active). - **noticeType** (string) - Required - The type of notice (e.g., '1' for notification). ### Request Example ```json { "status": "0", "noticeType": "1" } ``` --- ## Query Notice List API ### Description Retrieves a paginated list of notices with filtering options. ### Method GET ### Endpoint /system/notice ### Parameters #### Query Parameters - **pageNum** (integer) - Required - The page number for pagination. - **pageSize** (integer) - Required - The number of items per page. - **noticeTitle** (string) - Optional - Filter by notice title. - **noticeType** (string) - Optional - Filter by notice type (1: notification, 2: announcement). - **createBy** (string) - Optional - Filter by the creator's username. - **status** (string) - Optional - Filter by notice status (e.g., '0'). ### Request Example ```json { "pageNum": 1, "pageSize": 10, "noticeTitle": "", "noticeType": "", "createBy": "", "status": "0" } ``` --- ## Get Notice Details API ### Description Retrieves the details of a specific notice by its ID. ### Method GET ### Endpoint /system/notice/{noticeId} ### Parameters #### Path Parameters - **noticeId** (integer) - Required - The ID of the notice to retrieve. ### Response #### Success Response (200) - **code** (integer) - The status code, 200 for success. - **data** (object) - The notice details. - **noticeId** (integer) - The ID of the notice. - **noticeTitle** (string) - The title of the notice. - **noticeType** (string) - The type of the notice (1: notification, 2: announcement). - **noticeContent** (string) - The content of the notice. #### Response Example ```json { "code": 200, "data": { "noticeId": 1, "noticeTitle": "System Update", "noticeType": "1", "noticeContent": "..." } } ``` --- ## Create Notice API ### Description Creates a new system notice or announcement. ### Method POST ### Endpoint /system/notice ### Parameters #### Request Body - **noticeTitle** (string) - Required - The title of the notice. - **noticeType** (string) - Required - The type of notice (e.g., '2' for announcement). - **noticeContent** (string) - Required - The content of the notice. - **status** (string) - Required - The status of the notice (e.g., '0' for active). ### Request Example ```json { "noticeTitle": "System Maintenance Notice", "noticeType": "2", "noticeContent": "

System will be under maintenance on...

", "status": "0" } ``` --- ## Update Notice API ### Description Updates an existing system notice. ### Method PUT ### Endpoint /system/notice ### Parameters #### Request Body - **noticeId** (integer) - Required - The ID of the notice to update. - **noticeTitle** (string) - Optional - The updated title of the notice. - **noticeContent** (string) - Optional - The updated content of the notice. ### Request Example ```json { "noticeId": 1, "noticeTitle": "Updated Notice Title", "noticeContent": "Updated content..." } ``` --- ## Send Notice API ### Description Sends a notice to users, potentially in real-time via SignalR. ### Method POST ### Endpoint /system/notice/send/{noticeId} ### Parameters #### Path Parameters - **noticeId** (integer) - Required - The ID of the notice to send. --- ## Delete Notice API ### Description Deletes a specific system notice. ### Method DELETE ### Endpoint /system/notice/{noticeId} ### Parameters #### Path Parameters - **noticeId** (integer) - Required - The ID of the notice to delete. ``` -------------------------------- ### Online Users & Monitoring API Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Provides system monitoring capabilities including online user management, operation logs, and cache information. ```APIDOC ## Online Users & Monitoring API ### Description Provides system monitoring capabilities including online user management, operation logs, and cache information. ### Method GET ### Endpoint /monitor/online ### Parameters #### Query Parameters - **pageNum** (integer) - Required - The page number for pagination. - **pageSize** (integer) - Required - The number of items per page. - **userName** (string) - Optional - Filter by username. - **ipaddr** (string) - Optional - Filter by IP address. ### Request Example ```json { "pageNum": 1, "pageSize": 10, "userName": "", "ipaddr": "" } ``` ### Response #### Success Response (200) - **code** (integer) - The status code, 200 for success. - **data** (object) - The response data. - **result** (array) - An array of online user objects. - **tokenId** (string) - The unique token ID of the user. - **userName** (string) - The username of the online user. - **ipaddr** (string) - The IP address of the user. - **browser** (string) - The browser used by the user. #### Response Example ```json { "code": 200, "data": { "result": [ { "tokenId": "xxx", "userName": "admin", "ipaddr": "192.168.1.1", "browser": "Chrome" } ] } } ``` --- ## Force Logout Single User API ### Description Forces a single online user to log out. ### Method POST ### Endpoint /monitor/online/forceLogout ### Parameters #### Request Body - **tokenId** (string) - Required - The token ID of the user to log out. ### Request Example ```json { "tokenId": "user-token-id" } ``` --- ## Force Logout Multiple Users API ### Description Forces multiple online users to log out. ### Method POST ### Endpoint /monitor/online/forceLogoutAll ### Parameters #### Request Body - **tokenIds** (array of strings) - Required - An array of token IDs of the users to log out. ### Request Example ```json { "tokenIds": ["token1", "token2", "token3"] } ``` --- ## Query Operation Logs API ### Description Queries system operation logs with various filtering options. ### Method GET ### Endpoint /monitor/operlog ### Parameters #### Query Parameters - **pageNum** (integer) - Required - The page number for pagination. - **pageSize** (integer) - Required - The number of items per page. - **operName** (string) - Optional - Filter by operator name. - **title** (string) - Optional - Filter by log title. - **businessType** (array of integers) - Optional - Filter by business type (e.g., 1: insert, 2: update, 3: delete). - **status** (integer) - Optional - Filter by status (0: success, 1: failed). - **beginTime** (string) - Optional - Filter by start date (YYYY-MM-DD). - **endTime** (string) - Optional - Filter by end date (YYYY-MM-DD). ### Request Example ```json { "pageNum": 1, "pageSize": 10, "operName": "", "title": "", "businessType": [1, 2], "status": 0, "beginTime": "2024-01-01", "endTime": "2024-12-31" } ``` ### Response #### Success Response (200) - **code** (integer) - The status code, 200 for success. - **data** (object) - The response data. - **result** (array) - An array of operation log objects. - **operId** (integer) - The ID of the operation. - **title** (string) - The title of the operation. - **operName** (string) - The name of the operator. #### Response Example ```json { "code": 200, "data": { "result": [ { "operId": 1, "title": "User Management", "operName": "admin" } ] } } ``` --- ## Delete Operation Log API ### Description Deletes a specific operation log entry. ### Method DELETE ### Endpoint /monitor/operlog/{operId} ### Parameters #### Path Parameters - **operId** (integer) - Required - The ID of the operation log to delete. --- ## Clear All Operation Logs API ### Description Clears all operation log entries from the system. ### Method DELETE ### Endpoint /monitor/operlog/clean --- ## Export Operation Logs API ### Description Exports operation logs based on specified criteria. ### Method GET ### Endpoint /monitor/operlog/export ### Parameters #### Query Parameters - **status** (integer) - Optional - Filter by status (0: success, 1: failed). ### Request Example ```json { "status": 0 } ``` --- ## Get Cache Information API ### Description Retrieves information about the system's cache. ### Method GET ### Endpoint /monitor/cache ### Response #### Success Response (200) - **code** (integer) - The status code, 200 for success. - **data** (object) - The response data. - **info** (object) - General cache information. - **redis_version** (string) - The version of Redis. - **used_memory** (string) - The amount of memory used by Redis. - **dbSize** (integer) - The number of keys in the cache. - **commandStats** (array) - Statistics for various cache commands. #### Response Example ```json { "code": 200, "data": { "info": { "redis_version": "6.2.6", "used_memory": "1.2MB" }, "dbSize": 100, "commandStats": [] } } ``` ``` -------------------------------- ### Manage Monitoring Data (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Provides functions to manage online users, operation logs, and cache information. It allows fetching lists of online users, forcing user logouts, querying and managing operation logs, and retrieving cache details. Dependencies include API modules for monitor/online, monitor/operlog, and monitor/cache. ```javascript import { listOnline, forceLogout, forceLogoutAll } from '@/api/monitor/online' import { list as listOperLog, delOperlog, cleanOperlog, exportOperlog } from '@/api/monitor/operlog' import { getCache } from '@/api/monitor/cache' // Get online users const onlineUsers = await listOnline({ pageNum: 1, pageSize: 10, userName: '', ipaddr: '' }) // Response: { code: 200, data: { result: [{ tokenId: 'xxx', userName: 'admin', ipaddr: '192.168.1.1', browser: 'Chrome', ... }] } } // Force logout single user await forceLogout({ tokenId: 'user-token-id' }) // Force logout multiple users await forceLogoutAll({ tokenIds: ['token1', 'token2', 'token3'] }) // Query operation logs const operLogs = await listOperLog({ pageNum: 1, pageSize: 10, operName: '', title: '', businessType: [1, 2], // 1: insert, 2: update, 3: delete, etc. status: 0, // 0: success, 1: failed beginTime: '2024-01-01', endTime: '2024-12-31' }) // Response: { code: 200, data: { result: [{ operId: 1, title: 'User Management', operName: 'admin', ... }] } } // Delete operation log await delOperlog(1) // Clear all operation logs await cleanOperlog() // Export operation logs await exportOperlog({ status: 0 }) // Get cache information const cacheInfo = await getCache() // Response: { code: 200, data: { info: { redis_version: '...', used_memory: '...' }, dbSize: 100, commandStats: [...] } } ``` -------------------------------- ### Manage System Roles and Permissions (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt APIs for managing system roles, including CRUD operations, status changes, data scope configuration, and exporting role permissions. These functions interact with the backend to maintain role-based access control. ```javascript import { listRole, getRole, addRole, updateRole, delRole, changeRoleStatus, dataScope, exportRoleMenu } from '@/api/system/role' // Query role list const roles = await listRole({ pageNum: 1, pageSize: 10, roleName: 'admin', roleKey: 'admin', status: '0' }) // Get role details const role = await getRole(1) // Response: { code: 200, data: { roleId: 1, roleName: 'Administrator', roleKey: 'admin', menuIds: [1,2,3], ... } } // Create new role await addRole({ roleName: 'Editor', roleKey: 'editor', roleSort: 2, status: '0', menuIds: [100, 101, 102], // Permission menu IDs remark: 'Content editor role' }) // Update role await updateRole({ roleId: 2, roleName: 'Senior Editor', menuIds: [100, 101, 102, 103] }) // Configure data scope (data permissions) await dataScope({ roleId: 2, dataScope: '2', // 1: all, 2: custom, 3: dept, 4: dept and below, 5: self only deptIds: [100, 101, 102] // Allowed department IDs when dataScope is '2' }) // Change role status await changeRoleStatus(2, '1') // Disable role // Delete role await delRole(2) // Export role menu permissions await exportRoleMenu({ roleId: 1 }) ``` -------------------------------- ### File Management API Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt The file module handles file uploads, storage management, and file operations with support for local and cloud storage (Alibaba Cloud). ```APIDOC ## File Management API ### Description The file module handles file uploads, storage management, and file operations with support for local and cloud storage (Alibaba Cloud). ### Endpoints #### Upload file ##### Method POST ##### Endpoint `/upload` ##### Request Body - **file** (File) - Required - The file object to upload. - **fileDir** (string) - Optional - The target directory for the file (e.g., 'uploads'). ##### Response - **code** (number) - Status code, 200 for success. - **data** (object) - Uploaded file information. - **url** (string) - The URL of the uploaded file. - **fileName** (string) - The name of the uploaded file. - ... (other file details) ##### Response Example ```json { "code": 200, "data": { "url": "/uploads/2024/01/file.jpg", "fileName": "file.jpg", "..." } } ``` #### Query file list ##### Method GET ##### Endpoint `/listSysfile` ##### Query Parameters - **pageNum** (number) - Required - The current page number. - **pageSize** (number) - Required - The number of items per page. - **fileName** (string) - Optional - Filter by file name. - **fileType** (string) - Optional - Filter by file type. - **storeType** (string) - Optional - Storage type ('1': local, '2': Alibaba Cloud). #### Get file details ##### Method GET ##### Endpoint `/getSysfile/{fileId}` ##### Path Parameters - **fileId** (number) - Required - The ID of the file. ##### Response - **code** (number) - Status code, 200 for success. - **data** (object) - File details. - **id** (number) - The ID of the file. - **fileName** (string) - The name of the file. - **fileUrl** (string) - The URL of the file. - **fileSize** (number) - The size of the file in bytes. - ... (other file details) ##### Response Example ```json { "code": 200, "data": { "id": 1, "fileName": "doc.pdf", "fileUrl": "...", "fileSize": 1024, "..." } } ``` #### Add file record ##### Method POST ##### Endpoint `/addSysfile` ##### Request Body - **fileName** (string) - Required - The name of the file. - **fileUrl** (string) - Required - The URL of the file. - **fileSize** (number) - Required - The size of the file in bytes. - **fileType** (string) - Required - The type of the file. - **storeType** (string) - Required - Storage type ('1': local, '2': Alibaba Cloud). #### Update file record ##### Method PUT ##### Endpoint `/updateSysfile` ##### Request Body - **id** (number) - Required - The ID of the file to update. - **fileName** (string) - Optional - The new name for the file. - ... (other updatable fields) #### Delete file ##### Method DELETE ##### Endpoint `/delSysfile/{fileId}` ##### Path Parameters - **fileId** (number) - Required - The ID of the file to delete. #### Export file list ##### Method GET ##### Endpoint `/exportSysfile` ##### Query Parameters - **storeType** (string) - Optional - Storage type to filter by ('1': local, '2': Alibaba Cloud). #### Send email with attachment ##### Method POST ##### Endpoint `/sendEmail` ##### Request Body - **toUser** (string) - Required - The recipient's email address. - **title** (string) - Required - The subject of the email. - **content** (string) - Required - The HTML content of the email. - **fileUrl** (string) - Required - The URL of the file to attach. - **isSend** (number) - Required - Flag to indicate if the email should be sent (e.g., 1 for send, 0 for draft). ``` -------------------------------- ### Manage Files with File Management API (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt This API provides functionalities for uploading, querying, retrieving, adding, updating, and deleting file records. It supports different storage types, including local and cloud storage (Alibaba Cloud). It also includes a utility for sending emails with attachments. Dependencies include '@/api/common' and '@/api/tool/file'. ```javascript import { upload, sendEmail } from '@/api/common' import { listSysfile, getSysfile, addSysfile, updateSysfile, delSysfile, exportSysfile } from '@/api/tool/file' // Upload file const formData = new FormData() formData.append('file', fileObject) formData.append('fileDir', 'uploads') // Optional: target directory const uploadResult = await upload(formData) // Response: { code: 200, data: { url: '/uploads/2024/01/file.jpg', fileName: 'file.jpg', ... } } // Query file list const files = await listSysfile({ pageNum: 1, pageSize: 10, fileName: '', fileType: '', storeType: '1' // 1: local, 2: Alibaba Cloud }) // Get file details const file = await getSysfile(1) // Response: { code: 200, data: { id: 1, fileName: 'doc.pdf', fileUrl: '...', fileSize: 1024, ... } } // Add file record await addSysfile({ fileName: 'document.pdf', fileUrl: '/uploads/document.pdf', fileSize: 102400, fileType: 'pdf', storeType: '1' }) // Update file record await updateSysfile({ id: 1, fileName: 'renamed-document.pdf' }) // Delete file await delSysfile(1) // Export file list await exportSysfile({ storeType: '1' }) // Send email with attachment await sendEmail({ toUser: 'recipient@example.com', title: 'Document Attached', content: '

Please find the document attached.

', fileUrl: '/uploads/document.pdf', isSend: 1 }) ``` -------------------------------- ### Scheduled Tasks API Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Integrates with Quartz.NET for managing background jobs using cron expressions. ```APIDOC ## Scheduled Tasks API ### Description Manages background jobs using Quartz.NET with cron expressions. ### Methods * **queryTasks**: Query tasks with pagination. * **getAllTasks**: Get all tasks. * **getTasks**: Get task details by ID. * **createTasks**: Create a new scheduled task. * **updateTasks**: Update an existing task. * **startTasks**: Start a task. * **stopTasks**: Stop a task. * **runTasks**: Run a task once immediately. * **deleteTasks**: Delete a task. * **exportTasks**: Export tasks. ### Request Examples #### Query tasks with pagination ```javascript await queryTasks({ pageNum: 1, pageSize: 10, name: '', jobGroup: 'DEFAULT' }) ``` #### Get all tasks ```javascript await getAllTasks() ``` #### Get task details ```javascript await getTasks('task-id-123') // Response: { code: 200, data: { id: 'xxx', name: 'CleanupTask', jobGroup: 'DEFAULT', cron: '0 0 2 * * ?', ... } } ``` #### Create new scheduled task ```javascript await createTasks({ name: 'DailyReport', jobGroup: 'REPORT', assemblyName: 'ZR.Tasks', className: 'DailyReportTask', cron: '0 0 8 * * ?', // Run at 8:00 AM daily triggerType: 1, // 1: cron, 2: simple beginTime: '2024-01-01', endTime: '2024-12-31', remark: 'Generate daily report' }) ``` #### Update task ```javascript await updateTasks({ id: 'task-id-123', name: 'DailyReport', cron: '0 30 8 * * ?', // Change to 8:30 AM remark: 'Updated schedule' }) ``` #### Start task ```javascript await startTasks('task-id-123') ``` #### Stop task ```javascript await stopTasks('task-id-123') ``` #### Run task once immediately ```javascript await runTasks('task-id-123') ``` #### Delete task ```javascript await deleteTasks('task-id-123') ``` #### Export tasks ```javascript await exportTasks() ``` ``` -------------------------------- ### Manage Departments and Organizational Structure (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt APIs for managing the organizational hierarchy, including departments, groups, and company structure. Supports CRUD operations and retrieving department trees for selection and role assignment. ```javascript import { listDept, getDept, addDept, updateDept, delDept, treeselect, roleDeptTreeselect, listDeptExcludeChild } from '@/api/system/dept' // Get department list const depts = await listDept({ deptName: '', status: '0' }) // Response: { code: 200, data: [{ deptId: 100, deptName: 'Head Office', parentId: 0, children: [...] }] } // Get department tree for dropdown const deptTree = await treeselect() // Response: { code: 200, data: [{ id: 100, label: 'Head Office', children: [...] }] } // Get role's department tree const roleDepts = await roleDeptTreeselect(1) // Response: { code: 200, data: { depts: [...], checkedKeys: [100, 101] } } // Get department (exclude specified node and children - for parent selection) const availableDepts = await listDeptExcludeChild(101) // Get department details const dept = await getDept(100) // Response: { code: 200, data: { deptId: 100, deptName: 'Head Office', parentId: 0, leader: 'John', phone: '138...', ... } } // Create department await addDept({ parentId: 100, deptName: 'Development Department', orderNum: 1, leader: 'Jane Doe', phone: '13800138000', email: 'dev@company.com', status: '0' }) // Update department await updateDept({ deptId: 101, deptName: 'R&D Department', leader: 'John Smith' }) // Delete department await delDept(101) ``` -------------------------------- ### Authenticate Users with ZRAdmin.NET Frontend API (JavaScript) Source: https://context7.com/izhaorui/zr.admin.vue3/llms.txt Handles user login, logout, registration, and third-party OAuth. Supports various login methods including username/password (with captcha), phone, and QR code. Requires specific data formats for login and returns JWT tokens or user information upon success. ```javascript import { login, logout, getInfo, register, getCodeImg, phoneLogin, oauthCallback } from '@/api/system/login' // Login with username and password (requires captcha) const loginData = { username: 'admin', password: 'encrypted_password_md5', // Password should be MD5 hashed code: '1234', // Captcha code uuid: 'captcha-uuid-from-api', // UUID from captcha image request clientId: 'web-client' } const response = await login(loginData.username, loginData.password, loginData.code, loginData.uuid, loginData.clientId) // Response: { code: 200, data: 'jwt_token_string', msg: 'success' } // Get captcha image const captcha = await getCodeImg() // Response: { code: 200, data: { uuid: 'xxx', img: 'base64_image_data' } } // Get current user info after login const userInfo = await getInfo() // Response: { code: 200, data: { user: { userId, userName, nickName, avatar }, roles: ['admin'], permissions: ['*:*:*'] } } // Phone number login const phoneLoginResponse = await phoneLogin({ phoneNumber: '13800138000', code: '123456' }) // Third-party OAuth callback const oauthResponse = await oauthCallback({ code: 'oauth_code' }, { authSource: 'gitee' }) // Logout await logout() ```