列表页设计

云控专属可视化开发工具

  • 全网独家定制
  • 数据私有化部署
  • 支持多级菜单管理
  • 多用户分级管理
  • 二次开发成本直降80%

列表 opt 配置

opt = {
  columns: [...],       // 列配置
  tableProps: {...},    // 表格属性
  config: {...},        // 列表核心配置
  controlBtn: [...],    // 列表顶部按钮
  operateBtn: [...],    // 行操作按钮
  treeData: {...},      // 左侧树配置
  events: {...},        // 请求生命周期事件
  notice: {...}         // 顶部提示信息
}

列配置 columns

每个列对象包含以下属性:

属性名说明类型是否必填默认值
prop字段名,对应数据中的 keystring
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是否可排序booleanfalse
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 下的 editUrlstring

渲染类型 (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.fieldconfig.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是否显示边框booleanfalse

支持所有 el-table 原生属性,如 stripeheightmaxHeight 等。

示例
tableProps: {
  border: true,
  stripe: true,
  height: 500
}

列表核心配置 config

属性名说明类型默认值
getUrl列表数据接口地址string
deleteUrl删除数据接口地址string
editUrl编辑/更新接口地址string
addUrl新增接口地址string
pageSize每页数据条数number20
sortField默认排序字段(如 "id desc"string
openType新增/编辑打开方式(dialog / drawer)string"dialog"
dialogWidthdialog 弹窗宽度string"500"
widthdrawer 抽屉宽度string"50%"
operateDropdown操作按钮折叠阈值(超过此数量以下拉显示)string"5"
expand是否显示折叠查询表单booleanfalse
searchJump查询参数是否同步到 URLbooleanfalse
columnsSetting是否显示列设置(显示/隐藏列)booleanfalse
fixedBottomScroll横向滚动条是否固定在底部booleantrue
autoLoad是否自动加载数据booleantrue
示例
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是否朴素按钮booleanfalse
circle是否圆形按钮booleanfalse
link是否链接按钮booleanfalse
config按钮扩展配置object{}
events按钮事件object{}

内置 key 行为说明:

key说明
add(支持加数字后缀:addadd1add2……)打开新增弹窗/抽屉,支持多个新增按钮分别关联不同表单
edit(支持加数字后缀:editedit1edit2……)批量编辑(需选中数据),支持多个批量编辑按钮
del批量删除(需选中数据)
import导入数据(Excel / TXT)
export导出数据(Excel / TXT)
url(支持加数字后缀:urlurl1url2……)页面跳转,支持多个跳转链接按钮
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关联表单/页面 IDnumberadd / edit / none
openType打开方式(dialog / drawer / newTab)stringadd / edit / none
width弹窗/抽屉宽度stringadd / edit / none
url跳转链接stringurl
type导入/导出类型(excel / txt)stringimport / export
fileName导出文件名stringimport / export
sheetNameExcel 工作表名stringimport / export
separator文本分隔符(txt 导出时)stringexport
template导入模板数据arrayimport
addUrl批量导入接口地址stringimport
示例
// 导入 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 事件参数说明:

参数类型说明
tableDataArray当前表格全部数据
selectedArray当前选中行数据
refreshFunction刷新列表方法
envObject运行环境(含 runtimeElMessage 等)
示例
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是否朴素按钮booleanfalse
config行按钮扩展配置object{}
events行按钮事件object{}

内置 key 行为说明:

key说明
edit(支持加数字后缀:editedit1edit2……)编辑当前行,支持多个编辑按钮分别关联不同表单
del删除当前行
detail查看详情
list(支持加数字后缀:listlist1list2……)打开关联列表/子表,支持多个关联列表按钮
screen(支持加数字后缀:screenscreen1screen2……)打开大屏页面,支持多个大屏按钮
menu(支持加数字后缀:menumenu1menu2……)跳转菜单页,支持多个菜单跳转按钮
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关联表单/页面 IDnumber
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是否显示左侧树booleanfalse
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 参数说明:

参数类型说明
typestring请求类型:get / delete
urlstring请求接口地址
methodstring请求方法(post / get
headersObject请求头(可修改)
dataObject请求体数据(可修改)
envObject运行环境(包含 userruntimerouter 等)
timeoutnumber超时时间

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 参数说明:

参数类型说明
typestring请求类型:get / delete
successboolean请求是否成功(true / false
responseObject接口原始返回(axios response),response.data 为后端返回体
envObject运行环境(同上)

核心职责:

  • 数据结构标准化:将不同后端接口的返回结构统一转换为 { 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"
      }
    }
  }
}