列表页设计
云控专属可视化开发工具
- 全网独家定制
- 数据私有化部署
- 支持多级菜单管理
- 多用户分级管理
- 二次开发成本直降80%
列表 opt 配置
opt = {
columns: [...], // 列配置
tableProps: {...}, // 表格属性
config: {...}, // 列表核心配置
controlBtn: [...], // 列表顶部按钮
operateBtn: [...], // 行操作按钮
treeData: {...}, // 左侧树配置
events: {...}, // 请求生命周期事件
notice: {...} // 顶部提示信息
}
列配置 columns
每个列对象包含以下属性:
| 属性名 | 说明 | 类型 | 是否必填 | 默认值 |
|---|---|---|---|---|
prop | 字段名,对应数据中的 key | string | 否 | — |
label | 列标题显示文字 | string | 是 | — |
type | 列类型(selection / index / __control) | string | 否 | — |
width | 列宽度,如 "150px" | string | 否 | — |
minWidth | 列最小宽度 | string | 否 | — |
fixed | 固定列位置(left / right) | string | 否 | — |
align | 内容对齐方式(left / center / right) | string | 否 | "left" |
headerAlign | 表头对齐方式(left / center / right) | string | 否 | "left" |
sortable | 是否可排序 | boolean | 否 | false |
help | 表头帮助提示文字(tooltip) | string | 否 | — |
config | 列扩展配置 | object | 否 | {} |
示例
{
prop: "label",
label: "标题",
help: "这是标题列的帮助信息",
width: "150px",
headerAlign: "center",
align: "center",
sortable: true,
config: {
type: "copy"
}
}
列类型 (type)
| 值 | 说明 | 示例 |
|---|---|---|
selection | 多选列(复选框) | { type: "selection", fixed: "left" } |
index | 序号列(自动编号) | { type: "index", width: "70px" } |
__control | 操作列(内置操作按钮占位) | { prop: "__control", label: "操作", width: "200px" } |
说明:
__control为特殊列名,用于放置行操作按钮(operateBtn),系统会自动渲染。
列扩展配置 (config)
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
type | 渲染类型 | string | — |
dictKey | 数据字典标识(用于字典映射) | string | — |
field | 行编辑字段类型(input / select / switch 等) | string | — |
control | 行编辑/渲染的组件属性配置 | object | {} |
tagList | 标签状态映射(type=tagList 时使用) | object | {} |
formatter | 日期格式化模板(type=formatter 时使用) | string | — |
editUrl | 行内编辑独立接口地址(未设置时使用列表 config 下的 editUrl) | string | — |
渲染类型 (type)
用于控制列数据的展示方式:
| 值 | 说明 | 适用场景 |
|---|---|---|
dictKey | 字典映射(通过 dictKey 转换) | 状态、分类等需要字典翻译的字段 |
tagList | 标签渲染(可配置颜色) | 状态标签(成功/失败/进行中) |
image | 图片预览 | 图片 URL 展示 |
video | 视频播放 | 视频 URL 展示 |
play | 音频播放链接 | 音频文件播放 |
download | 下载链接 | 文件下载 |
copy | 可复制文本 | UID、链接等需要复制的字段 |
link | 超链接跳转 | 外部链接 |
formatter | 日期格式化 | 时间戳/日期字符串格式化 |
field | 行内编辑字段 | 表格内直接编辑 |
示例
// 字典映射(自动翻译)
{
prop: "status",
label: "状态",
config: {
dictKey: "order_status", // 字典标识
type: "dictKey"
}
}
// 标签渲染
{
prop: "status",
label: "状态",
config: {
type: "tagList",
tagList: {
0: "danger", // 值为0显示红色
1: "success" // 值为1显示绿色
}
}
}
// 图片预览
{
prop: "avatar",
label: "头像",
config: {
type: "image",
control: {
style: { width: "80px" },
previewTeleported: true
}
}
}
// 可复制文本
{
prop: "uid",
label: "UID",
config: {
type: "copy",
control: {
style: { color: "#007bff" }
}
}
}
// 日期格式化
{
prop: "created_at",
label: "创建日期",
config: {
type: "formatter",
formatter: "{y}-{m}-{d} {h}:{i}:{s}"
}
}
tagList 颜色映射表:
| 值 | 颜色 |
|---|---|
success | 绿色 |
danger | 红色 |
warning | 橙色 |
info | 蓝色 |
primary | 靛蓝 |
行内编辑 (field)
通过 config.field 和 config.control 配置行内编辑字段:
示例
// 行内下拉选择
{
prop: "category_id",
label: "分类",
config: {
type: "field",
field: "treeSelect", // 字段类型:treeSelect / select / input / textarea / switch / datePicker / timePicker / colorPicker / slider / rate / inputNumber
control: {
style: { width: "150px" }
}
}
}
// 行内开关
{
prop: "status",
label: "状态",
config: {
type: "field",
field: "switch",
editUrl: "http://47.94.105.29:66/api/editDataListCase", // 独立接口,未设置时使用列表 config.editUrl
control: {
activeValue: 1,
inactiveValue: 0,
activeText: "开启",
inactiveText: "关闭"
}
}
}
表格属性 tableProps
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
border | 是否显示边框 | boolean | false |
支持所有
el-table原生属性,如stripe、height、maxHeight等。
示例
tableProps: {
border: true,
stripe: true,
height: 500
}
列表核心配置 config
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
getUrl | 列表数据接口地址 | string | — |
deleteUrl | 删除数据接口地址 | string | — |
editUrl | 编辑/更新接口地址 | string | — |
addUrl | 新增接口地址 | string | — |
pageSize | 每页数据条数 | number | 20 |
sortField | 默认排序字段(如 "id desc") | string | — |
openType | 新增/编辑打开方式(dialog / drawer) | string | "dialog" |
dialogWidth | dialog 弹窗宽度 | string | "500" |
width | drawer 抽屉宽度 | string | "50%" |
operateDropdown | 操作按钮折叠阈值(超过此数量以下拉显示) | string | "5" |
expand | 是否显示折叠查询表单 | boolean | false |
searchJump | 查询参数是否同步到 URL | boolean | false |
columnsSetting | 是否显示列设置(显示/隐藏列) | boolean | false |
fixedBottomScroll | 横向滚动条是否固定在底部 | boolean | true |
autoLoad | 是否自动加载数据 | boolean | true |
示例
config: {
getUrl: "https://api.example.com/v1/list",
deleteUrl: "https://api.example.com/v1/delete",
editUrl: "https://api.example.com/v1/edit",
pageSize: 30,
sortField: "id desc",
openType: "drawer",
width: "80%",
operateDropdown: "4",
expand: true,
searchJump: false,
columnsSetting: true
}
列表顶部按钮 controlBtn
位于列表左上方的操作按钮组:
| 属性名 | 说明 | 类型 | 是否必填 | 默认值 |
|---|---|---|---|---|
label | 按钮显示文字 | string | 是 | — |
key | 按钮标识(基础 key:add / edit / del / import / export / url / none,支持加数字序号扩展,如 add1、edit1、url1 等) | string | 是 | — |
type | 按钮类型(primary / success / warning / danger / info) | string | 否 | "default" |
size | 按钮尺寸(small / default / large) | string | 否 | "small" |
icon | 图标名称 | string | 否 | — |
plain | 是否朴素按钮 | boolean | 否 | false |
circle | 是否圆形按钮 | boolean | 否 | false |
link | 是否链接按钮 | boolean | 否 | false |
config | 按钮扩展配置 | object | 否 | {} |
events | 按钮事件 | object | 否 | {} |
内置 key 行为说明:
| key | 说明 |
|---|---|
add(支持加数字后缀:add、add1、add2……) | 打开新增弹窗/抽屉,支持多个新增按钮分别关联不同表单 |
edit(支持加数字后缀:edit、edit1、edit2……) | 批量编辑(需选中数据),支持多个批量编辑按钮 |
del | 批量删除(需选中数据) |
import | 导入数据(Excel / TXT) |
export | 导出数据(Excel / TXT) |
url(支持加数字后缀:url、url1、url2……) | 页面跳转,支持多个跳转链接按钮 |
none | 自定义事件(通过 events.click 处理) |
示例
controlBtn: [
{
label: "新增",
key: "add",
type: "primary",
size: "small",
icon: "CirclePlus",
plain: false
},
{
label: "批量删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true
},
{
label: "跳转链接",
key: "url",
type: "primary",
size: "small",
icon: "ChromeFilled",
config: {
url: "https://www.baidu.com/"
}
}
]
按钮扩展配置 (config)
| 属性名 | 说明 | 类型 | 适用 key |
|---|---|---|---|
source | 关联表单/页面 ID | number | add / edit / none |
openType | 打开方式(dialog / drawer / newTab) | string | add / edit / none |
width | 弹窗/抽屉宽度 | string | add / edit / none |
url | 跳转链接 | string | url |
type | 导入/导出类型(excel / txt) | string | import / export |
fileName | 导出文件名 | string | import / export |
sheetName | Excel 工作表名 | string | import / export |
separator | 文本分隔符(txt 导出时) | string | export |
template | 导入模板数据 | array | import |
addUrl | 批量导入接口地址 | string | import |
示例
// 导入 Excel
{
label: "导入Excel",
key: "import",
type: "primary",
icon: "Upload",
plain: true,
config: {
type: "excel",
fileName: "数据表",
sheetName: "Sheet1",
template: [
{ label: "标题", uid: "UID", link: "链接" }
],
addUrl: "https://api.example.com/v1/batchAdd"
}
}
// 导出文本
{
label: "导出文本",
key: "export",
type: "primary",
icon: "Download",
plain: true,
config: {
type: "txt",
fileName: "数据表",
separator: " | "
}
}
// 打开子表单(嵌套)
{
label: "批量AI生成",
key: "none",
type: "success",
icon: "Edit",
plain: true,
config: {
source: 495, // 子表单 ID
openType: "drawer",
width: "50%"
}
}
按钮事件 (events)
| 事件名 | 说明 | 参数 |
|---|---|---|
click | 自定义点击事件(key=none 时使用) | instance:组件上下文 |
click 事件参数说明:
| 参数 | 类型 | 说明 |
|---|---|---|
tableData | Array | 当前表格全部数据 |
selected | Array | 当前选中行数据 |
refresh | Function | 刷新列表方法 |
env | Object | 运行环境(含 runtime、ElMessage 等) |
示例
events: {
click: (instance) => {
const { tableData, selected, refresh, env } = instance;
console.log("全部表格数据:", tableData);
console.log("选中行数据:", selected);
// 自定义业务逻辑...
// 刷新表格
refresh();
}
}
行操作按钮 operateBtn
位于表格每行右侧的操作按钮组:
| 属性名 | 说明 | 类型 | 是否必填 | 默认值 |
|---|---|---|---|---|
label | 按钮显示文字 | string | 是 | — |
key | 按钮标识(基础 key:edit / del / detail / list / screen / menu / none,支持加数字序号扩展,如 edit1、list1、screen1、menu1 等) | string | 是 | — |
type | 按钮类型 | string | 否 | "default" |
size | 按钮尺寸 | string | 否 | "small" |
icon | 图标名称 | string | 否 | — |
plain | 是否朴素按钮 | boolean | 否 | false |
config | 行按钮扩展配置 | object | 否 | {} |
events | 行按钮事件 | object | 否 | {} |
内置 key 行为说明:
| key | 说明 |
|---|---|
edit(支持加数字后缀:edit、edit1、edit2……) | 编辑当前行,支持多个编辑按钮分别关联不同表单 |
del | 删除当前行 |
detail | 查看详情 |
list(支持加数字后缀:list、list1、list2……) | 打开关联列表/子表,支持多个关联列表按钮 |
screen(支持加数字后缀:screen、screen1、screen2……) | 打开大屏页面,支持多个大屏按钮 |
menu(支持加数字后缀:menu、menu1、menu2……) | 跳转菜单页,支持多个菜单跳转按钮 |
none | 自定义事件 |
示例
operateBtn: [
{
label: "编辑",
key: "edit",
type: "primary",
size: "small",
icon: "Edit",
plain: true
},
{
label: "删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true
}
]
行按钮扩展配置 (config)
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
source | 关联表单/页面 ID | number | — |
openType | 打开方式(dialog / drawer / newTab) | string | — |
key | 关联字段名(如 "id") | string | "id" |
width | 弹窗/抽屉宽度 | string | "70%" |
title | 弹窗标题 | string | — |
示例
{
label: "列表",
key: "list",
type: "primary",
icon: "Memo",
plain: true,
config: {
source: 475, // 子列表 ID
openType: "dialog",
key: "data_list_case_id", // 关联字段
width: "100%",
title: "记录"
}
},
{
label: "菜单页",
key: "menu",
type: "primary",
icon: "Tickets",
plain: true,
config: {
source: 358,
openType: "newTab", // 新标签页打开
key: "id"
}
}
行按钮事件 (events)
| 事件名 | 说明 | 参数 |
|---|---|---|
click | 自定义点击事件(key=none 时使用) | instance:组件上下文 |
click 事件参数说明: 同 controlBtn 的 click 事件。
示例
{
label: "其他操作",
key: "none",
type: "warning",
size: "small",
plain: true,
events: {
click: (instance) => {
const { tableData, selected, refresh, env } = instance;
// 自定义逻辑...
}
},
icon: "Coin"
}
左侧树配置 treeData
用于列表左侧显示树形分类筛选:
| 属性名 | 说明 | 类型 | 是否必填 | 默认值 |
|---|---|---|---|---|
show | 是否显示左侧树 | boolean | 否 | false |
nodeKey | 节点唯一标识字段 | string | 否 | "id" |
name | 查询参数名(点击节点时传给列表) | string | 否 | — |
getUrl | 树数据接口地址 | string | 是 | — |
method | 请求方法(post / get) | string | 否 | "post" |
treeProps | 树组件属性映射 | object | 否 | — |
events | 树请求事件 | object | 否 | {} |
示例
treeData: {
show: true,
nodeKey: "id",
name: "category_id",
method: "post",
getUrl: "https://api.example.com/v1/categoryTree",
treeProps: {
label: "label",
value: "id",
children: "children"
},
events: {
before: (instance) => { /* ... */ },
after: (instance) => { /* ... */ }
}
}
树请求事件 (events)
与表单的 before / after 事件结构一致:
| 事件名 | 说明 | 是否必须 return |
|---|---|---|
before | 请求发送前拦截,修改请求参数 | ✅ 必须 |
after | 请求响应后处理,标准化数据格式 | ✅ 必须 |
详细参数说明请参考下方 事件 events 章节。
示例
events: {
before: (instance) => {
const { headers, data, env } = instance;
return {
url: instance.url,
method: instance.method || "post",
headers: {
...headers,
Authorization: "Bearer " + (env?.user?.token || "")
},
data: { ...data }
};
},
after: (instance) => {
const { response } = instance;
return {
code: 200,
data: response?.data?.data,
msg: response?.data?.msg
};
}
}
事件 events
用于控制列表在 请求生命周期 中的行为。
| 事件名 | 作用 | 是否必须 return | 说明 |
|---|---|---|---|
before | 请求发送前拦截 | ✅ 必须 | 统一修改请求参数、注入 token、按 type 分支处理 |
after | 请求响应后处理 | ✅ 必须 | 统一标准化数据结构为 { code, data, msg } 格式 |
请求类型 (type):
| type | 说明 |
|---|---|
get | 获取表格列表数据(主列表数据) |
delete | 删除单条数据(行级操作) |
before(instance)
请求发送前的统一拦截入口,所有列表请求都会经过这里。
instance 参数说明:
| 参数 | 类型 | 说明 |
|---|---|---|
type | string | 请求类型:get / delete |
url | string | 请求接口地址 |
method | string | 请求方法(post / get) |
headers | Object | 请求头(可修改) |
data | Object | 请求体数据(可修改) |
env | Object | 运行环境(包含 user、runtime、router 等) |
timeout | number | 超时时间 |
env 运行环境详解:
| 属性 | 说明 |
|---|---|
env.runtime.request | 网络请求方法(基于 axios 封装) |
env.runtime.ElMessage | 消息提示组件 |
env.runtime.ElNotification | 通知提示组件 |
env.runtime.ElMessageBox | 弹窗组件 |
env.user.id | 当前用户 ID |
env.user.uname | 当前用户名 |
env.user.token | 当前用户 token |
env.router | 路由实例(用于页面跳转) |
常见业务场景:
- 注入
token到请求头 - 修改请求参数格式(过滤、加密、签名)
- 按
type分支处理不同请求类型 - 统一显示 loading 或提示信息
⚠️ 注意:
- 必须
return完整的请求配置对象 - 不
return或返回undefined→ 请求不会发送
after(instance)
请求完成后统一处理响应数据,所有接口返回都会经过这里。
instance 参数说明:
| 参数 | 类型 | 说明 |
|---|---|---|
type | string | 请求类型:get / delete |
success | boolean | 请求是否成功(true / false) |
response | Object | 接口原始返回(axios response),response.data 为后端返回体 |
env | Object | 运行环境(同上) |
核心职责:
- 数据结构标准化:将不同后端接口的返回结构统一转换为
{ code, data, msg }格式 - 统一提示处理(成功/失败消息)
- 按
type分支处理不同请求类型的后续逻辑
标准返回格式:
{
code: number, // 200 成功,400 业务失败,401 未授权
data: any, // 业务数据(列表页通常为数组)
msg: string // 提示信息
}
⚠️ 注意:
- 一般无需处理
success = false,推荐仅在success = true时编写逻辑 - 无论后端返回什么结构,最终都必须转换为标准格式,否则前端无法统一处理数据结构
示例
events: {
// ================= before:请求发送前拦截 =================
before: (instance) =>
{
const { type, headers, data, env } = instance;
// ================= 调试日志 =================
console.groupCollapsed("🚀 [before] " + type);
console.log("instance:", instance);
console.groupEnd();
// ================= 请求头重构 =================
const newHeaders = {
...headers,
Authorization: "Bearer " + (env?.user?.token || ""),
"Content-Type": "application/json"
};
let newData = { ...data };
// ================= 请求前处理(按 type 分发) =================
switch (type)
{
case "get":
{
env?.runtime?.ElMessage?.info("加载列表数据中(可在此处修改请求参数格式)");
newData = { ...data };
break;
}
case "delete":
{
env?.runtime?.ElMessage?.info("正在删除数据(可在此处修改请求参数格式)");
newData = { ...data };
break;
}
default:
{
newData = { ...data };
break;
}
}
// ================= 返回 axios 配置 =================
return {
url: instance.url,
method: instance.method || "post",
headers: newHeaders,
timeout: instance.timeout || 30000,
data: newData
};
},
// ================= after:请求响应后处理 =================
after: (instance) =>
{
const { type, success, response, env } = instance;
// ================= 调试日志 =================
console.groupCollapsed("📦 [after] " + type);
console.log("instance:", instance);
console.groupEnd();
// ================= 默认提示(演示用) =================
if (success)
{
switch (type)
{
// ================= 列表数据处理 =================
case "get":
{
env?.runtime?.ElMessage?.info(
"get 数据处理区:可在此处统一处理列表结构 / 字段映射 / 分页格式"
);
break;
}
// ================= 删除结果处理 =================
case "delete":
{
env?.runtime?.ElMessage?.info(
"delete 数据处理区:可在此处统一删除后的返回结构"
);
break;
}
default:
{
env?.runtime?.ElMessage?.info(
"未知 type:" + type + ",可在 default 中扩展处理逻辑"
);
break;
}
}
}
/**
* =========================================================
* 📦 统一返回数据格式(核心规范)
* =========================================================
*
* 👉 所有请求最终都会被转换为:
*
* {
* code: number,
* data: any,
* msg: string
* }
*
* ---------------------------------------------------------
* 🔢 code:状态码
* ---------------------------------------------------------
* 200 -> 请求成功
* 400 -> 业务失败(如参数错误)
* 401 -> 用户异常(登录失效,自动处理)
*
* ---------------------------------------------------------
* 📄 data:业务数据
* ---------------------------------------------------------
* - 接口核心数据
* - 类型:对象 或 数组
*
* ---------------------------------------------------------
* 💬 msg:提示信息
* ---------------------------------------------------------
* - 用于 UI 提示
* - 一般来自后端
*
* =========================================================
* 📌 示例1:字段结构不一致(基础映射)
* =========================================================
*
* 后端返回:
* {
* code: 0,
* result: {...},
* message: "success"
* }
*
* 👉 转换:
* return {
* code: response.data.code,
* data: response.data.result,
* msg: response.data.message
* }
*
* =========================================================
* 📌 示例2:data 是 JSON 字符串(常见)
* =========================================================
*
* 后端返回:
* {
* code: 200,
* result: "{"id":1,"name":"张三"}",
* message: "ok"
* }
*
* 👉 转换:
* return {
* code: response.data.code,
* data: JSON.parse(response.data.result),
* msg: response.data.message
* }
*
* =========================================================
* 📌 示例3:数组字符串
* =========================================================
*
* 后端返回:
* {
* code: 200,
* result: "[{"id":1},{"id":2}]",
* message: "ok"
* }
*
* 👉 转换:
* return {
* code: response.data.code,
* data: JSON.parse(response.data.result),
* msg: response.data.message
* }
*
* =========================================================
* 📌 示例4:复杂字符串解析
* =========================================================
*
* 后端返回:
* {
* code: 200,
* result: "id=1,name=张三,age=18"
* }
*
* 👉 转换:
* const obj = Object.fromEntries(
* response.data.result.split(",").map(item => item.split("="))
* );
*
* return {
* code: response.data.code,
* data: obj,
* msg: response.data.message
* }
*
* =========================================================
* ⚠️ 核心原则(非常重要)
* =========================================================
* 无论后端返回:
* - 对象
* - 数组
* - JSON字符串
* - 普通字符串
* - 拼接字符串
*
* 👉 最终都必须转换为:
* {
* code,
* data,
* msg
* }
*
* ❗否则前端无法统一处理数据结构
*/
return {
code: 200,
data: response?.data?.data,
msg: response?.data?.msg
};
}
}
顶部提示 notice
用于在列表页顶部显示提示信息。提示栏位于表格顶部操作按钮上方,以横向从右向左滚动(跑马灯效果) 的方式展示,适用于发布公告、系统通知、操作引导等场景。
| 属性名 | 说明 | 类型 | 默认值 |
|---|---|---|---|
content | 提示内容(支持纯文本,自动滚动播放) | string | — |
control | 样式控制 | object | {} |
示例
notice: {
content: "这是一个功能强大的页面管理系统,支持表单、列表和数据大屏页面...",
control: {
style: {
color: "#ff0000"
}
}
}
示例
基础列表(含搜索、新增、编辑、删除)
opt = {
columns: [
{
label: "多选",
fixed: "left",
type: "selection"
},
{
prop: "label",
label: "标题",
help: "",
width: "150px",
headerAlign: "center",
align: "center",
config: {
type: "copy"
}
},
{
prop: "category_id",
label: "分类",
help: "",
config: {
dictKey: "category_id",
type: "dictKey"
},
width: "120px",
sortable: true,
headerAlign: "center",
align: "center"
},
{
prop: "task_type_id",
label: "任务类型",
help: "我是帮助信息",
config: {
dictKey: "task_type_id",
type: "dictKey"
},
width: "135",
sortable: true,
align: "center",
headerAlign: "center"
},
{
prop: "user_id",
label: "用户",
help: "",
config: {
dictKey: "user_id",
type: "dictKey"
},
width: "120",
sortable: true,
align: "center",
headerAlign: "center"
},
{
prop: "device_id",
label: "设备",
help: "",
config: {
dictKey: "device_id",
type: "dictKey"
},
width: "120",
align: "center",
headerAlign: "center"
},
{
prop: "status",
label: "状态",
help: "",
minWidth: "80",
config: {
type: "tagList",
control: {
style: {
color: "blue"
}
},
tagList: {
0: "danger",
1: "success"
}
},
align: "center",
headerAlign: "center"
},
{
prop: "uid",
label: "UID",
help: "",
minWidth: "180",
align: "center",
headerAlign: "center",
sortable: true
},
{
prop: "created_at",
label: "创建日期",
help: "",
width: "180",
align: "center",
headerAlign: "center",
config: {
type: "formatter",
formatter: "{y}-{m}-{d} {h}:{i}:{s}"
}
},
{
label: "操作",
prop: "__control",
width: "400px",
fixed: "right",
align: "center",
headerAlign: "center"
}
],
tableProps: {
border: true
},
config: {
operateDropdown: "4",
openType: "dialog",
pageSize: 10,
getUrl: "http://47.94.105.29:66/api/DataListCaseList",
deleteUrl: "http://47.94.105.29:66/api/deleteDataListCase",
editUrl: "http://47.94.105.29:66/api/editDataListCase",
sortField: "id desc",
expand: true,
searchJump: false,
columnsSetting: true,
width: "80%"
},
controlBtn: [
{
label: "新增",
key: "add",
type: "primary",
size: "small",
icon: "CirclePlus",
plain: false,
circle: false,
link: false
},
{
label: "批量新增",
key: "add1",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: 485,
openType: "drawer",
width: "50%"
}
},
{
label: "导入Excel",
key: "import",
type: "primary",
size: "small",
icon: "Upload",
plain: true,
circle: false,
link: false,
config: {
type: "excel",
fileName: "云控数据表",
sheetName: "Sheet1",
template: [
{
label: "我是标题1",
uid: "我是UID",
link: "我是链接",
name: "我是多余的"
}
],
addUrl: "http://47.94.105.29:66/api/addBatchDataListCase"
}
},
{
label: "导入文本",
key: "import",
type: "primary",
size: "small",
icon: "Upload",
plain: true,
circle: false,
link: false,
config: {
type: "txt",
fileName: "云控文本",
template: ["我是标题1 | 我是UID | 我是链接 | 我是多余的"],
addUrl: "http://47.94.105.29:66/api/addBatchDataListCase"
}
},
{
label: "导出Excel",
key: "export",
type: "primary",
size: "small",
icon: "Download",
plain: true,
circle: false,
link: false,
config: {
type: "excel",
fileName: "云控数据表",
date: false,
sheetName: "Sheet1"
}
},
{
label: "导出文本",
key: "export",
type: "primary",
size: "small",
icon: "Download",
plain: true,
circle: false,
link: false,
config: {
type: "txt",
fileName: "云控文本",
date: false,
separator: " | "
}
},
{
label: "批量编辑",
key: "edit",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: 491
}
},
{
label: "批量编辑1",
key: "edit1",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: 492,
openType: "drawer",
width: "50%"
}
},
{
label: "其他批量操作",
key: "none",
type: "warning",
size: "small",
plain: true,
circle: false,
link: false,
events: {
click: (instance) => {
const { tableData, selected, refresh, env } = instance;
console.log("全部表格数据:", tableData);
console.log("选中行数据:", selected);
console.log("刷新函数:", refresh);
console.log("运行环境:", env);
// 如果你需要刷新表格
// refresh();
}
},
icon: "Postcard"
},
{
label: "批量AI生成文章",
key: "edit1",
type: "success",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: 495,
openType: "drawer",
width: "50%"
}
},
{
label: "跳转链接",
key: "url",
type: "primary",
size: "small",
icon: "ChromeFilled",
plain: true,
circle: false,
link: false,
config: {
url: "https://www.baidu.com/"
}
},
{
label: "跳转链接1",
key: "url1",
type: "primary",
size: "small",
icon: "ChromeFilled",
plain: true,
circle: false,
link: false,
config: {
url: "https://cn.bing.com/"
}
},
{
label: "批量删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true,
circle: false,
link: false
}
],
operateBtn: [
{
label: "编辑",
key: "edit",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false
},
{
label: "编辑1",
key: "edit1",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: null,
openType: "dialog"
}
},
{
label: "列表",
key: "list",
type: "primary",
size: "small",
icon: "Memo",
plain: true,
circle: false,
link: false,
config: {
source: 475,
openType: "dialog",
key: "data_list_case_id",
width: "100%",
title: "记录"
}
},
{
label: "列表1",
key: "list1",
type: "primary",
size: "small",
icon: "Memo",
plain: true,
circle: false,
link: false,
config: {
source: null,
openType: null,
key: "id",
width: "70%"
}
},
{
label: "大屏",
key: "screen",
type: "primary",
size: "small",
icon: "Memo",
plain: true,
circle: false,
link: false,
config: {
source: 59,
openType: "dialog",
key: "id",
width: "100%"
}
},
{
label: "大屏1",
key: "screen1",
type: "primary",
size: "small",
icon: "Memo",
plain: true,
circle: false,
link: false,
config: {
source: null,
openType: null,
key: "id"
}
},
{
label: "菜单页",
key: "menu",
type: "primary",
size: "small",
icon: "Tickets",
plain: true,
circle: false,
link: false,
config: {
source: 358,
openType: "newTab",
key: "id"
}
},
{
label: "菜单页1",
key: "menu1",
type: "primary",
size: "small",
icon: "Tickets",
plain: true,
circle: false,
link: false,
config: {
source: null,
openType: null,
key: "id"
}
},
{
label: "其他行操作",
key: "none",
type: "warning",
size: "small",
plain: true,
circle: false,
link: false,
events: {
click: (instance) => {
const { tableData, selected, refresh, env } = instance;
console.log("全部表格数据:", tableData);
console.log("选中行数据:", selected);
console.log("刷新函数:", refresh);
console.log("运行环境:", env);
// 如果你需要刷新表格
// refresh();
}
},
icon: "Coin"
},
{
label: "删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true,
circle: false,
link: false
}
],
treeData: {
show: true,
nodeKey: "id",
treeProps: {
label: "label",
value: "id",
children: "children"
},
name: "category_id",
method: "post",
getUrl: "http://47.94.105.29:66/api/DataListCaseCategoryTree",
events: {
before: (instance) => {
const { type, headers, data, env } = instance;
console.groupCollapsed("🚀 [before] " + type);
console.log("instance:", instance);
console.groupEnd();
const newHeaders = {
...headers,
Authorization: "Bearer " + (env?.user?.token || ""),
"Content-Type": "application/json"
};
let newData = { ...data };
return {
url: instance.url,
method: instance.method || "post",
headers: newHeaders,
timeout: instance.timeout || 30000,
data: newData
};
},
after: (instance) => {
const { type, success, response, env } = instance;
console.groupCollapsed("📦 [after] " + type);
console.log("instance:", instance);
console.groupEnd();
if (success) {
env?.runtime?.ElMessage?.info(
"get 数据处理区:可在此处处理树结构 / children 格式 / 层级整理"
);
}
return {
code: 200,
data: response?.data?.data,
msg: response?.data?.msg
};
}
}
},
events: {
before: (instance) => {
const { type, headers, data, env } = instance;
console.groupCollapsed("🚀 [before] " + type);
console.log("instance:", instance);
console.groupEnd();
const newHeaders = {
...headers,
Authorization: "Bearer " + (env?.user?.token || ""),
"Content-Type": "application/json"
};
let newData = {};
switch (type) {
case "get": {
env?.runtime?.ElMessage?.info("加载列表数据中(可在此处修改请求参数格式)");
newData = { ...data };
break;
}
case "delete": {
env?.runtime?.ElMessage?.info("正在删除数据(可在此处修改请求参数格式)");
newData = { ...data };
break;
}
default: {
newData = { ...data };
break;
}
}
return {
url: instance.url,
method: instance.method || "post",
headers: newHeaders,
timeout: instance.timeout || 30000,
data: newData
};
},
after: (instance) => {
const { type, success, response, env } = instance;
console.groupCollapsed("📦 [after] " + type);
console.log("instance:", instance);
console.groupEnd();
if (success) {
switch (type) {
case "get": {
env?.runtime?.ElMessage?.info(
"get 数据处理区:可在此处统一处理列表结构 / 字段映射 / 分页格式"
);
break;
}
case "delete": {
env?.runtime?.ElMessage?.info(
"delete 数据处理区:可在此处统一删除后的返回结构"
);
break;
}
default: {
env?.runtime?.ElMessage?.info(
"未知 type:" + type + ",可在 default 中扩展处理逻辑"
);
break;
}
}
}
return {
code: 200,
data: response?.data?.data,
msg: response?.data?.msg
};
}
},
notice: {
content: "一个功能强大的页面管理系统,支持表单、列表和数据大屏页面,并具有自定义菜单路由功能。用户可以创建任意数量的菜单页面,并从各种组件中选择所需的功能。还支持批量导入、编辑、上传、删除、页面关联等操作,无需用户进行前端开发,只需提供后端接口即可实现可视化操作。所有数据将安全存储在用户自己的数据库中,并能解析云控用户的相关信息,如用户ID、用户名、密码版本和设备ID等。此外,用户可以共享创建的页面菜单给下级用户使用,并通过推广代理角色权限设置进行管理。",
control: {
style: {
color: "#ff0000"
}
}
}
};
行内编辑列表
opt = {
columns: [
{
label: "多选",
fixed: "left",
type: "selection"
},
{
prop: "label",
label: "标题",
help: "",
headerAlign: "center",
align: "center",
config: {},
minWidth: "180"
},
{
prop: "category_id",
label: "分类",
help: "我是帮助信息,树状选择器",
config: {
dictKey: "category_id",
type: "field",
field: "treeSelect",
control: {
style: {
width: "150px"
}
}
},
width: "180px",
sortable: true,
headerAlign: "center",
align: "center"
},
{
prop: "task_type_id",
label: "任务类型",
help: "我是帮助信息,选择器",
config: {
dictKey: "task_type_id",
type: "field",
field: "select",
control: {
style: {
width: "150px"
}
}
},
width: "180",
sortable: true,
align: "center",
headerAlign: "center"
},
{
prop: "input",
label: "输入框",
help: "",
width: "120",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "input",
control: {
clearable: true
}
}
},
{
prop: "textarea",
label: "多行文本",
help: "",
width: "180",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "textarea"
}
},
{
prop: "inputNumber",
label: "计数器",
help: "",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "inputNumber"
},
width: "180"
},
{
prop: "switch",
label: "开关",
help: "",
width: "160",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "switch",
editUrl: "http://47.94.105.29:66/api/editDataListCase",
control: {
activeValue: 1,
inactiveValue: 0,
activeText: "开启",
inactiveText: "关闭"
}
}
},
{
prop: "timePicker",
label: "时间选择器",
help: "",
width: "160",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "timePicker",
control: {
style: {
width: "120px"
}
}
}
},
{
prop: "datePicker",
label: "日期选择器",
help: "",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "datePicker",
control: {
style: {
width: "180px"
}
}
},
width: "210"
},
{
prop: "colorPicker",
label: "取色器",
help: "",
width: "80",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "colorPicker"
}
},
{
prop: "slider",
label: "滑块",
help: "",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "slider"
},
width: "150"
},
{
prop: "rate",
label: "评分",
help: "",
headerAlign: "center",
align: "center",
config: {
type: "field",
field: "rate"
},
width: "180"
},
{
label: "操作",
prop: "__control",
width: "200px",
fixed: "right",
align: "center",
headerAlign: "center"
}
],
tableProps: {
border: true
},
config: {
operateDropdown: "4",
openType: "drawer",
pageSize: 30,
getUrl: "http://47.94.105.29:66/api/DataListCaseList",
editUrl: "http://47.94.105.29:66/api/editDataListCase",
deleteUrl: "http://47.94.105.29:66/api/deleteDataListCase",
sortField: "id desc",
expand: true,
searchJump: false,
dialogWidth: "500"
},
controlBtn: [
{
label: "新增",
key: "add",
type: "primary",
size: "small",
icon: "CirclePlus",
plain: false,
circle: false,
link: false
},
{
label: "批量新增",
key: "add1",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: 485,
openType: "drawer",
width: "50%"
}
},
{
label: "导入Excel",
key: "import",
type: "primary",
size: "small",
icon: "Upload",
plain: true,
circle: false,
link: false,
config: {
type: "excel",
fileName: "云控数据表",
sheetName: "Sheet1",
template: [
{
label: "我是标题1",
uid: "我是UID",
link: "我是链接",
name: "我是多余的"
}
],
addUrl: "http://47.94.105.29:66/api/addBatchDataListCase"
}
},
{
label: "导出Excel",
key: "export",
type: "primary",
size: "small",
icon: "Download",
plain: true,
circle: false,
link: false,
config: {
type: "excel",
fileName: "云控数据表",
date: false,
sheetName: "Sheet1"
}
},
{
label: "批量编辑",
key: "edit",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: 491
}
},
{
label: "跳转链接",
key: "url",
type: "primary",
size: "small",
icon: "ChromeFilled",
plain: true,
circle: false,
link: false,
config: {
url: "https://www.baidu.com/"
}
},
{
label: "批量删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true,
circle: false,
link: false
}
],
operateBtn: [
{
label: "编辑",
key: "edit",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false
},
{
label: "编辑1",
key: "edit1",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false,
config: {
source: null,
openType: "dialog"
}
},
{
label: "列表",
key: "list",
type: "primary",
size: "small",
icon: "Memo",
plain: true,
circle: false,
link: false,
config: {
source: 475,
openType: "dialog",
key: "data_list_case_id",
width: "100%",
title: "记录"
}
},
{
label: "大屏",
key: "screen",
type: "primary",
size: "small",
icon: "Memo",
plain: true,
circle: false,
link: false,
config: {
source: 59,
openType: "dialog",
key: "id",
width: "100%"
}
},
{
label: "菜单页",
key: "menu",
type: "primary",
size: "small",
icon: "Tickets",
plain: true,
circle: false,
link: false,
config: {
source: 358,
openType: "newTab",
key: "id"
}
},
{
label: "删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true,
circle: false,
link: false
}
],
treeData: {},
notice: {
content: "一个功能强大的页面管理系统,支持表单、列表和数据大屏页面,并具有自定义菜单路由功能。用户可以创建任意数量的菜单页面,并从各种组件中选择所需的功能。还支持批量导入、编辑、上传、删除、页面关联等操作,无需用户进行前端开发,只需提供后端接口即可实现可视化操作。所有数据将安全存储在用户自己的数据库中,并能解析云控用户的相关信息,如用户ID、用户名、密码版本和设备ID等。此外,用户可以共享创建的页面菜单给下级用户使用,并通过推广代理角色权限设置进行管理。",
control: {
style: {
color: "#ff0000"
}
}
}
};
媒体展示列表(图片/视频/链接/复制)
opt = {
columns: [
{
label: "多选",
fixed: "left",
type: "selection"
},
{
prop: "label",
label: "标题",
help: "",
headerAlign: "center",
align: "center",
config:
{},
minWidth: "180"
},
{
prop: "image",
label: "图片/文件",
help: "",
config:
{
type: "image",
control:
{
previewTeleported: true,
closeOnPressEscape: true,
lazy: true,
hideOnClickModal: true,
zoomRate: 1.2,
maxScale: 7,
minScale: 0.2,
style:
{
width: "80px"
}
}
},
width: "200",
align: "center",
headerAlign: "center"
},
{
prop: "video",
label: "视频",
help: "",
minWidth: "500",
align: "center",
headerAlign: "center",
sortable: true,
config:
{
type: "video",
control:
{
style:
{
maxWidth: "31%",
margin: "2px",
height: "auto"
}
}
}
},
{
prop: "play",
label: "播放",
help: "",
config:
{
type: "play",
control:
{
style:
{
overflow: "hidden",
color: "#007bff",
textDecoration: "underline",
textOverflow: "ellipsis",
whiteSpace: "nowrap"
}
}
},
headerAlign: "center",
align: "center",
minWidth: "180"
},
{
prop: "download",
label: "下载链接",
help: "",
config:
{
type: "download",
control:
{
style:
{
color: "#007bff",
textDecoration: "underline"
}
}
},
width: "120",
align: "center",
headerAlign: "center"
},
{
prop: "copy",
label: "复制文本",
help: "",
width: "120",
headerAlign: "center",
align: "center",
config:
{
type: "copy",
control:
{
style:
{
color: "#007bff"
}
}
}
},
{
prop: "link",
label: "超链接",
help: "",
minWidth: "120",
config:
{
type: "link",
control:
{
style:
{
overflow: "hidden",
color: "#007bff",
textDecoration: "underline",
textOverflow: "ellipsis",
whiteSpace: "nowrap"
}
}
},
align: "center",
headerAlign: "center"
},
{
label: "操作",
prop: "__control",
width: "180px",
fixed: "right",
align: "center",
headerAlign: "center"
}],
tableProps:
{
border: true
},
config:
{
operateDropdown: "4",
openType: "drawer",
pageSize: 10,
getUrl: "http://47.94.105.29:66/api/DataListCaseList",
deleteUrl: "http://47.94.105.29:66/api/deleteDataListCase",
sortField: "id desc",
expand: true,
searchJump: false,
width: "60%"
},
controlBtn: [
{
label: "新增",
key: "add",
type: "primary",
size: "small",
icon: "CirclePlus",
plain: false,
circle: false,
link: false
},
{
label: "导入Excel",
key: "import",
type: "primary",
size: "small",
icon: "Upload",
plain: true,
circle: false,
link: false,
config:
{
type: "excel",
fileName: "云控数据表",
sheetName: "Sheet1",
template: [
{
label: "我是标题1",
uid: "我是UID",
link: "我是链接",
name: "我是多余的"
}],
addUrl: "http://47.94.105.29:66/api/addBatchDataListCase"
}
},
{
label: "导出Excel",
key: "export",
type: "primary",
size: "small",
icon: "Download",
plain: true,
circle: false,
link: false,
config:
{
type: "excel",
fileName: "云控数据表",
date: false,
sheetName: "Sheet1"
}
},
{
label: "批量删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true,
circle: false,
link: false
}],
operateBtn: [
{
label: "编辑",
key: "edit",
type: "primary",
size: "small",
icon: "Edit",
plain: true,
circle: false,
link: false
},
{
label: "删除",
key: "del",
type: "danger",
size: "small",
icon: "Delete",
plain: true,
circle: false,
link: false
}],
treeData:
{},
notice:
{
content: "一个功能强大的页面管理系统,支持表单、列表和数据大屏页面,并具有自定义菜单路由功能。用户可以创建任意数量的菜单页面,并从各种组件中选择所需的功能。还支持批量导入、编辑、上传、删除、页面关联等操作,无需用户进行前端开发,只需提供后端接口即可实现可视化操作。所有数据将安全存储在用户自己的数据库中,并能解析云控用户的相关信息,如用户ID、用户名、密码版本和设备ID等。此外,用户可以共享创建的页面菜单给下级用户使用,并通过推广代理角色权限设置进行管理。",
control:
{
style:
{
color: "#ff0000"
}
}
}
}