init.json指南

12003

快速开始

jianghu-init JSON以JSON格式高效地管理页面结构和API接口,从而优化开发流程和提升工作效率。本指南主要介绍jianghu-init JSON的详细教程。

安装

在开始之前,请确保您已经安装了jianghu-init工具。可以通过以下命令进行安装:

  1. npm uninstall -g @jianghujs/jianghu-init
  2. npm install -g @jianghujs/jianghu-init@latest

👉 jianghu-init 工具安装详解👈

在江湖项目中生成参考示例

  • 首先,进入已有的江湖JS项目目录

👉 创建jianghujs项目 👈

  • 使用以下命令生成参考示例:
  1. cd my-jh-project
  2. jianghu-init json --generateType=example

执行以上命令,当前项目数据库将添加 example_class 和 example_student 数据表、并在项目目录生成以下文件:

  • app\view\init-json\component\exampleStudentOfClass.js
  • app\view\init-json\page\exampleClass.js
  • app\view\component\example\exampleStudentOfClass.html
  • app\view\page\exampleClass.html

方便参考使用

步骤一:数据表生成配置文件

当有一个新的业务数据表之后,可以使用以下命令生成数据表的配置文件,例如,现在有一个名为class的数据表:

  1. CREATE TABLE `class` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `classId` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '班级ID',
  4. `className` varchar(255) DEFAULT NULL,
  5. `operation` varchar(255) COLLATE utf8mb4_bin DEFAULT 'insert' COMMENT '操作; insert, update, jhInsert, jhUpdate, jhDelete jhRestore',
  6. `operationByUserId` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作者userId',
  7. `operationByUser` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作者用户名',
  8. `operationAt` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '操作时间; E.g: 2021-05-28T10:24:54+08:00 ',
  9. PRIMARY KEY (`id`)
  10. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

要为class数据表生成基础配置文件,可以使用以下命令:

  1. jianghu-init json --generateType=json --pageType=jh-page --table=class --pageId=classManagement

执行命令之后,会在项目的app/view/init-json/page/目录下生成一个名为classManagement.js的配置文件。

步骤二:配置文件生成页面

上一步生成的配置文件,需要通过以下命令生成页面:

  1. jianghu-init json --generateType=page --pageType=page --file=classManagement

执行以上命令,将会生成项目的app/view/page/目录下生成一个名为classManagement.html的页面文件,并自动配置页面对应的数据库表_page和_resouce的数据。

👉 开启dev模式,修改配置文件自动更新页面 👈

👉 配置字符串代码语法高亮 👈

配置协议

总览

  1. {
  2. pageType: "jh-page", // 页面类型,可选值为jh-page、jh-mobile-page、jh-component选
  3. pageId: "pageId", // 页面唯一标识
  4. table: "class", // 关联数据库表
  5. pageName: "班级页面", // 页面标题
  6. template: "jhTemplateV4", // 页面模板,默认为jhTemplateV4,手机端一般设置为jhMobileTemplateV4
  7. resourceList: [ // 页面resource { actionId, resourceType, resourceData }
  8. {
  9. actionId: "selectItemList",
  10. resourceType: "sql",
  11. resourceHook: {},
  12. desc: "✅查询列表-exampleClass",
  13. resourceData: {
  14. table: "example_class",
  15. operation: "select"
  16. }
  17. }
  18. ],
  19. headContent: [], // 页面头部,常用于配置 标题、面包屑条、服务端搜索、场景搜索等
  20. pageContent: [], // 页面内容区域
  21. actionContent: [], // 触发内容集合,一般会放新增、修改等弹框
  22. includeList: [ // 页面引入资源 { type, path }
  23. { type: 'html', path: 'component/jianghuJs/jhSceneV4.html' }
  24. ],
  25. common: { // vue 原生变量 + uiAction {data, props, watch, methods, computed}
  26. data: {},
  27. computed: {},
  28. watch: {},
  29. methods: {},
  30. doUiAction: {}, // 自定义uiAction { [key]: [method1, method2, doUiAction1]}
  31. },
  32. style: '', // 自定义样式
  33. }
属性 类型 必填 描述
pageType string 页面类型,可选值为jh-page、jh-mobile-page、jh-component、
pageId string 页面唯一标识
table string 关联数据表名

HTML标签

在 headContent、pageCotent、actionContent 中,可以使用使用指定的对象结构来配置一个标签,也支持直接使用HTML字符串。

对象结构

  1. pageContent: [
  2. {
  3. tag: 'v-row',
  4. attrs: {
  5. align: "center"
  6. "@click": "doUiAction('updateItem')"
  7. },
  8. quickAttrs: ['no-gutters'],
  9. value: [
  10. { tag: 'v-col', attrs: { cols: 12 }, value: '' },
  11. `<v-col cols="12"></v-col>`
  12. ]
  13. }
  14. ]
属性 类型 必填 描述
tag string 标签名称
attr object 标签属性,如class、@click等
quickAttrs array 标签简洁属性,如 v-else small disabled等
value object 标签内的HTML内容

HTML字符串

  1. pageContent: [
  2. '<v-row align="center"><v-col cols="12"></v-col></v-row>'
  3. ]

接口配置

配置江湖resource,定义的resouce将自动更新到数据库中,供前端调用。

  1. resourceList: [
  2. {
  3. resourceHook: { "before": [], "after": [] },
  4. actionId: 'balance-updateItem',
  5. desc: '修改班费余额',
  6. resourceType: 'sql',
  7. resourceData: { "table": "class", "operation": "update" }
  8. }
  9. ]

👉 resouce详细配置文档 👈

资源引入

当页面需要引入组件、样式、脚本等资源时,可以通过includeList配置。支持对象结构和HTML字符串。

  1. includeList: [
  2. { type: 'css', path: "/<$ ctx.app.config.appId $>/public/lib/echarts.min.css" },
  3. { type: 'script', path: "/<$ ctx.app.config.appId $>/public/lib/echarts.min.js" },
  4. { type: 'html', path: "component/exampleChart/lineChart.html" },
  5. { type: 'html', path: 'component/courseBatchDrawer.html', includeType: 'auto', attrs: { id: 'courseBatchDrawer' } },
  6. { type: 'vueComponent', name: 'v-chart', component: 'VueCharts' },
  7. `<script src="/<$ ctx.app.config.appId $>/public/lib/echarts.min.js"></script>`
  8. ]
属性 类型 必填 描述
type string 引入类型,可选 css、js、html、vueComponent
path string 引入路径,type为css、js、html时可用
includeType string 引入类型,可选 auto,当值为auto时将自动添加标签内容添加到页面末端。type为css、js、html时可用
attrs object 自定引入标签属性。type为html、includeType为auto时可用
name string 组件名,type为vueComponent时可用
component string 引入组件,type为vueComponent时可用

配置doUiAction

提供补充doUiAction方法的配置入口

  1. pageContent: [
  2. {
  3. tag: 'v-btn',
  4. value: '测试doUiAction1',
  5. attrs: { '@click': 'doUiAction("doSomething")' },
  6. quickAttrs: ['small']
  7. },
  8. `<v-btn @click="doUiAction('doSomething')">测试doUiAction2</v-btn>`
  9. ],
  10. common: {
  11. doUiAction: {
  12. startUpdataBalance: ['method1', 'method2'],
  13. doSomething: ['method1(134)', 'doUiAction.startUpdataBalance']
  14. },
  15. methods: {
  16. method1: function (id) {
  17. console.log('method1', id)
  18. },
  19. method2: function () {
  20. console.log('method2')
  21. }
  22. }
  23. }

调用链中支持配置方法名、方法名+参数、doUiAction方法名。

配置示例-PC端

基础页面

  1. const content = {
  2. pageType: "jh-page", pageId: "classManagement", pageName: "classManagement页面",
  3. resourceList: [
  4. {
  5. actionId: "selectItemList",
  6. resourceType: "sql",
  7. resourceHook: {},
  8. desc: "✅查询列表-classManagement",
  9. resourceData: {
  10. table: "class",
  11. operation: "select"
  12. }
  13. },
  14. {
  15. actionId: "insertItem",
  16. resourceType: "sql",
  17. resourceHook: {},
  18. desc: "✅添加-classManagement",
  19. resourceData: {
  20. table: "class",
  21. operation: "jhInsert"
  22. }
  23. },
  24. {
  25. actionId: "updateItem",
  26. resourceType: "sql",
  27. resourceHook: {},
  28. desc: "✅更新-classManagement",
  29. resourceData: {
  30. table: "class",
  31. operation: "jhUpdate"
  32. }
  33. },
  34. {
  35. actionId: "deleteItem",
  36. resourceType: "sql",
  37. resourceHook: {},
  38. desc: "✅删除-classManagement",
  39. resourceData: {
  40. table: "class",
  41. operation: "jhDelete"
  42. }
  43. }
  44. ], // { actionId: '', resourceType: '', resourceData: {}, resourceHook: {}, desc: '' }
  45. headContent: [
  46. { tag: 'jh-page-title', value: "classManagement", attrs: { cols: 12, sm: 6, md:4 }, helpBtn: true, slot: [] },
  47. { tag: 'v-spacer' },
  48. {
  49. tag: 'jh-search',
  50. attrs: { cols: 12, sm: 6, md:8 },
  51. value: [
  52. { tag: "v-text-field", model: "serverSearchWhereLike.className", attrs: {prefix: '前缀'} },
  53. ],
  54. searchBtn: true
  55. }
  56. ],
  57. pageContent: [
  58. {
  59. tag: 'jh-table',
  60. attrs: { },
  61. colAttrs: { clos: 12 },
  62. cardAttrs: { class: 'rounded-lg elevation-0' },
  63. headActionList: [
  64. { tag: 'v-btn', value: '新增', attrs: { color: 'success', class: 'mr-2', '@click': 'doUiAction("startCreateItem")', small: true } },
  65. { tag: 'v-spacer' },
  66. // 默认筛选
  67. {
  68. tag: 'v-col',
  69. attrs: { cols: '12', sm: '6', md: '3', xs: 8, class: 'pa-0' },
  70. value: [
  71. { tag: 'v-text-field', attrs: {prefix: '筛选', 'v-model': 'searchInput', class: 'jh-v-input', ':dense': true, ':filled': true, ':single-line': true} },
  72. ],
  73. }
  74. ],
  75. headers: [
  76. { text: "id", value: "id", width: 80, sortable: true, class: "fixed", cellClass: "fixed" },
  77. { text: "班级ID", value: "classId", width: 80, sortable: true },
  78. { text: "className", value: "className", width: 80, sortable: true },
  79. { text: "操作", value: "operation", width: 80, sortable: true },
  80. { text: "操作者userId", value: "operationByUserId", width: 80, sortable: true },
  81. { text: "操作者用户名", value: "operationByUser", width: 80, sortable: true },
  82. { text: "操作时间", value: "operationAt", width: 80, sortable: true },
  83. { text: "操作", value: "action", type: "action", width: 'window.innerWidth < 500 ? 70 : 120', align: "center", class: "fixed", cellClass: "fixed" },
  84. // width 表达式需要使用字符串包裹
  85. ],
  86. value: [
  87. // vuetify table custom slot
  88. ],
  89. rowActionList: [
  90. { text: '编辑', icon: 'mdi-note-edit-outline', color: 'success', click: 'doUiAction("startUpdateItem", item)' }, // 简写支持 pc 和 移动端折叠
  91. { text: '删除', icon: 'mdi-trash-can-outline', color: 'error', click: 'doUiAction("deleteItem", item)' } // 简写支持 pc 和 移动端折叠
  92. ],
  93. }
  94. ],
  95. actionContent: [
  96. {
  97. tag: 'jh-create-drawer',
  98. key: "create",
  99. attrs: {},
  100. title: '新增',
  101. headSlot: [
  102. { tag: 'v-spacer'}
  103. ],
  104. contentList: [
  105. {
  106. label: "新增",
  107. type: "form",
  108. formItemList: [
  109. { label: "id", model: "id", tag: "v-text-field", rules: "validationRules.requireRules", },
  110. { label: "班级ID", model: "classId", tag: "v-text-field", rules: "validationRules.requireRules", },
  111. { label: "className", model: "className", tag: "v-text-field", rules: "validationRules.requireRules", },
  112. { label: "操作", model: "operation", tag: "v-text-field", rules: "validationRules.requireRules", },
  113. { label: "操作者userId", model: "operationByUserId", tag: "v-text-field", rules: "validationRules.requireRules", },
  114. { label: "操作者用户名", model: "operationByUser", tag: "v-text-field", rules: "validationRules.requireRules", },
  115. { label: "操作时间", model: "operationAt", tag: "v-text-field", rules: "validationRules.requireRules", },
  116. ],
  117. action: [{
  118. tag: "v-btn",
  119. value: "新增",
  120. attrs: {
  121. color: "success",
  122. ':small': true,
  123. '@click': "doUiAction('createItem')"
  124. }
  125. }],
  126. },
  127. ]
  128. },
  129. {
  130. tag: 'jh-update-drawer',
  131. key: "update",
  132. attrs: {},
  133. title: '编辑',
  134. headSlot: [
  135. { tag: 'v-spacer'}
  136. ],
  137. contentList: [
  138. {
  139. label: "编辑",
  140. type: "form",
  141. formItemList: [
  142. { label: "id", model: "id", tag: "v-text-field", rules: "validationRules.requireRules", },
  143. { label: "班级ID", model: "classId", tag: "v-text-field", rules: "validationRules.requireRules", },
  144. { label: "className", model: "className", tag: "v-text-field", rules: "validationRules.requireRules", },
  145. { label: "操作", model: "operation", tag: "v-text-field", rules: "validationRules.requireRules", },
  146. { label: "操作者userId", model: "operationByUserId", tag: "v-text-field", rules: "validationRules.requireRules", },
  147. { label: "操作者用户名", model: "operationByUser", tag: "v-text-field", rules: "validationRules.requireRules", },
  148. { label: "操作时间", model: "operationAt", tag: "v-text-field", rules: "validationRules.requireRules", },
  149. ],
  150. action: [{
  151. tag: "v-btn",
  152. value: "编辑",
  153. attrs: {
  154. color: "success",
  155. ':small': true,
  156. '@click': "doUiAction('updateItem')"
  157. }
  158. }],
  159. },
  160. { label: "操作记录", type: "component", componentPath: "recordHistory", attrs: { table: 'class', pageId: 'classManagement', ':id': 'updateItem.id' } },
  161. ]
  162. },
  163. ],
  164. includeList: [], // { type: < js | css | html | vueComponent >, path: ''}
  165. common: {
  166. data: {
  167. constantObj: {},
  168. validationRules: {
  169. requireRules: [
  170. v => !!v || '必填',
  171. ],
  172. },
  173. serverSearchWhereLike: { className: '' }, // 服务端like查询
  174. serverSearchWhere: { }, // 服务端查询
  175. serverSearchWhereIn: { }, // 服务端 in 查询
  176. filterMap: {}, // 结果筛选条件
  177. },
  178. dataExpression: {
  179. isMobile: 'window.innerWidth < 500'
  180. }, // data 表达式
  181. watch: {},
  182. computed: {
  183. tableDataComputed() {
  184. if(this.filterMap) {
  185. return this.tableData.filter(row => {
  186. for (const key in this.filterMap) {
  187. if (this.filterMap[key] && row[key] !== this.filterMap[key]) {
  188. return false;
  189. }
  190. }
  191. return true;
  192. });
  193. } else {
  194. return this.tableData;
  195. }
  196. },
  197. },
  198. doUiAction: {}, // 额外uiAction { [key]: [action1, action2]}
  199. methods: {}
  200. },
  201. };
  202. module.exports = content;

标题-只有页面标题

  1. headContent: [
  2. { tag: 'jh-page-title', value: "classManagement", attrs: { cols: 12, sm: 6, md:4 }, helpBtn: true, slot: [] }
  3. ]

标题-服务端搜索

  1. headContent: [
  2. { tag: 'jh-page-title', value: "classManagement", attrs: { cols: 12, sm: 6, md:4 }, helpBtn: true, slot: [] },
  3. { tag: 'v-spacer' },
  4. {
  5. tag: 'jh-search',
  6. attrs: { cols: 12, sm: 6, md:8 },
  7. value: [
  8. { tag: "v-text-field", model: "serverSearchWhereLike.className", attrs: {prefix: '前缀'} },
  9. ],
  10. searchBtn: true
  11. }
  12. ]

标题-场景搜索

  1. headContent: [
  2. { tag: 'jh-page-title', value: "classManagement", attrs: { cols: 12, sm: 6, md:4 }, helpBtn: true, slot: [] },
  3. { tag: 'v-spacer' },
  4. {
  5. tag: 'jh-scene',
  6. attrs: {},
  7. value: [],
  8. formItemList: [
  9. { label: '年级', tag: 'v-select', model: 'form.grade', attrs: {":items": 'constantObj.grade'} },
  10. ],
  11. },
  12. ],
  13. common: {
  14. data: {
  15. constantObj: {
  16. grade: ['初中', '高中', '大学'],
  17. },
  18. defaultSceneList: [
  19. { form: { }, name: "全部", default: true, id: "scene-custom-all", 'system': true },
  20. { form: { grade: "高中" }, name: "高中", id: "scene-custom-1", 'system': true },
  21. ],
  22. serverSearchWhere: {},
  23. }
  24. }

内容-数据表格

  1. pageContent: [
  2. {
  3. tag: 'jh-table',
  4. props: {
  5. serverPagination: true // 开启服务端分页、服务端分页默认 limit 50
  6. },
  7. attrs: {},
  8. colAttrs: { clos: 12 },
  9. cardAttrs: { class: 'rounded-lg elevation-0' },
  10. headActionList: [
  11. { tag: 'v-btn', value: '新增', attrs: { color: 'success', class: 'mr-2', '@click': 'doUiAction("startCreateItem")', small: true } },
  12. { tag: 'v-spacer' },
  13. // 默认筛选
  14. {
  15. tag: 'v-col',
  16. attrs: { cols: '12', sm: '6', md: '4', class: 'pa-0' },
  17. value: [
  18. { tag: 'v-text-field', attrs: {prefix: '筛选', 'v-model': 'searchInput', class: 'jh-v-input', ':dense': true, ':filled': true, ':single-line': true} },
  19. ],
  20. }
  21. ],
  22. headers: [
  23. { text: "id", value: "id", width: 80, sortable: true, class: "fixed", cellClass: "fixed" },
  24. { text: "班级ID", value: "classId", width: 80, sortable: true },
  25. { text: "className", value: "className", width: 80, sortable: true },
  26. { text: "操作", value: "operation", width: 80, sortable: true },
  27. { text: "操作者userId", value: "operationByUserId", width: 80, sortable: true },
  28. { text: "操作者用户名", value: "operationByUser", width: 80, sortable: true },
  29. { text: "操作时间", value: "operationAt", width: 80, sortable: true },
  30. { text: "操作", value: "action", type: "action", width: 'window.innerWidth < 500 ? 70 : 120', align: "center", class: "fixed", cellClass: "fixed" },
  31. ],
  32. value: [
  33. // v-table插槽
  34. // { tag: 'template', attrs: {'slot': 'body', 'slot-scope': "item"}, value: "<div>测试插槽</div>" },
  35. // { tag: 'template', attrs: {'slot': 'item.className', 'slot-scope': "{item, index}"}, value: "<div>{{item.className}}</div>" },
  36. ],
  37. rowActionList: [
  38. { text: '编辑', icon: 'mdi-note-edit-outline', color: 'success', click: 'doUiAction("startUpdateItem", item)' }, // 简写支持 pc 和 移动端折叠
  39. { text: '删除', icon: 'mdi-trash-can-outline', color: 'error', click: 'doUiAction("deleteItem", item)' } // 简写支持 pc 和 移动端折叠
  40. ],
  41. }
  42. ]

内容-数据表格(启用列设置)

常用

  1. pageContent: [
  2. {
  3. tag: 'jh-table',
  4. attrs: {},
  5. headers: [],
  6. value: [],
  7. showTableColumnSettingBtn: true,
  8. headActionList: [],
  9. rowActionList: [],
  10. }
  11. ],

模式设定

  1. pageContent: [
  2. {
  3. tag: 'jh-table',
  4. attrs: {},
  5. value: [],
  6. showTableColumnSettingBtn: true,
  7. headActionList: [],
  8. rowActionList: [],
  9. }
  10. ],
  11. common: {
  12. data: {
  13. columnSettingGroup: {
  14. '01模式': [
  15. "netName",
  16. "stage",
  17. "followUpDate",
  18. "district",
  19. "memberId",
  20. "followUpBy",
  21. "currentResidence",
  22. "openVisitationStatus",
  23. "totalVisitationCount",
  24. "visitorAssignInfo",
  25. "operationAt",
  26. "action"
  27. ],
  28. '02模式': [
  29. "netName",
  30. "stage",
  31. "duoxingRoomName",
  32. "followUpDate",
  33. "tag",
  34. "projectList",
  35. "followUpBy",
  36. "district",
  37. "memberId",
  38. "currentResidence",
  39. "operationAt",
  40. "action"
  41. ],
  42. '03模式': [
  43. "netName",
  44. "orgId",
  45. "orgName",
  46. "roleId",
  47. "isDefaultOrg"
  48. ],
  49. },
  50. }
  51. }
属性 类型 必填 描述
showTableColumnSettingBtn boolean 是否启用列设置,默认false

弹框-新增编辑表单

  1. actionContent: [
  2. {
  3. tag: 'jh-create-drawer',
  4. key: "create",
  5. attrs: {},
  6. title: '新增',
  7. headSlot: [
  8. { tag: 'v-spacer'}
  9. ],
  10. contentList: [
  11. {
  12. label: "新增",
  13. type: "form",
  14. formItemList: [
  15. { label: "id", model: "id", tag: "v-text-field", rules: "validationRules.requireRules", },
  16. { label: "班级ID", model: "classId", tag: "v-text-field", rules: "validationRules.requireRules", },
  17. { label: "className", model: "className", tag: "v-text-field", rules: "validationRules.requireRules", },
  18. { label: "操作", model: "operation", tag: "v-text-field", rules: "validationRules.requireRules", },
  19. { label: "操作者userId", model: "operationByUserId", tag: "v-text-field", rules: "validationRules.requireRules", },
  20. { label: "操作者用户名", model: "operationByUser", tag: "v-text-field", rules: "validationRules.requireRules", },
  21. { label: "操作时间", model: "operationAt", tag: "v-text-field", rules: "validationRules.requireRules", },
  22. ],
  23. action: [{
  24. tag: "v-btn",
  25. value: "新增",
  26. attrs: {
  27. color: "success",
  28. ':small': true,
  29. '@click': "doUiAction('createItem')"
  30. }
  31. }],
  32. },
  33. ]
  34. },
  35. {
  36. tag: 'jh-update-drawer',
  37. key: "update",
  38. attrs: {},
  39. title: '编辑',
  40. headSlot: [
  41. { tag: 'v-spacer'}
  42. ],
  43. contentList: [
  44. {
  45. label: "编辑",
  46. type: "form",
  47. formItemList: [
  48. { label: "id", model: "id", tag: "v-text-field", rules: "validationRules.requireRules", },
  49. { label: "班级ID", model: "classId", tag: "v-text-field", rules: "validationRules.requireRules", },
  50. { label: "className", model: "className", tag: "v-text-field", rules: "validationRules.requireRules", },
  51. { label: "操作", model: "operation", tag: "v-text-field", rules: "validationRules.requireRules", },
  52. { label: "操作者userId", model: "operationByUserId", tag: "v-text-field", rules: "validationRules.requireRules", },
  53. { label: "操作者用户名", model: "operationByUser", tag: "v-text-field", rules: "validationRules.requireRules", },
  54. { label: "操作时间", model: "operationAt", tag: "v-text-field", rules: "validationRules.requireRules", },
  55. ],
  56. action: [{
  57. tag: "v-btn",
  58. value: "编辑",
  59. attrs: {
  60. color: "success",
  61. ':small': true,
  62. '@click': "doUiAction('updateItem')"
  63. }
  64. }],
  65. },
  66. { label: "操作记录", type: "component", componentPath: "recordHistory", attrs: { table: 'class', pageId: 'classManagement', ':id': 'updateItem.id' } },
  67. ]
  68. },
  69. ]

弹框-详情

  1. pageContent: [
  2. `<v-btn @click="openTestDetailDrawer">打开测试详情弹框</v-btn>`,
  3. ],
  4. actionContent: [
  5. {
  6. tag: 'jh-drawer',
  7. key: "testDetail",
  8. attrs: {},
  9. title: '测试详情',
  10. contentList: [
  11. {
  12. type: "form",
  13. formItemList: [
  14. { tag: 'span', value: '课程信息', md: 12, attrs: {class: 'title pl-2'}},
  15. { tag: 'div', md: 12, value: [/*html*/ `
  16. <div class="grey lighten-5">
  17. <v-row class="ma-0 pa-2">
  18. <v-col cols="12" md="3" v-for="(item, index) in courseInfoItems" :key="index">
  19. <span>{{item.title}}:{{item.value}}</span>
  20. </v-col>
  21. </v-row>
  22. </div>
  23. `]
  24. }
  25. ]
  26. }
  27. ]
  28. }
  29. ],
  30. "common": {
  31. data: {
  32. courseInfoItems: [
  33. { title: '课程名称', value: 'IT初级课程' }
  34. ]
  35. }
  36. }

弹框-自定义弹框

  1. pageContent: [
  2. `<v-btn @click="openTestCustomDrawer">打开测试自定义弹框</v-btn>`,
  3. ],
  4. actionContent: [
  5. {
  6. tag: 'jh-drawer',
  7. key: "testCustom",
  8. attrs: {},
  9. title: '测试自定义弹框',
  10. contentList: [
  11. `自定义内容`
  12. ]
  13. }
  14. ]

弹框-多标签

  1. pageContent: [
  2. `<v-btn @click="openTestMultiTabDrawer">打开测试多标签弹框</v-btn>`,
  3. ],
  4. actionContent: [
  5. {
  6. tag: 'jh-drawer',
  7. key: "testMultiTab",
  8. attrs: {},
  9. title: '测试多标签',
  10. contentList: [
  11. { label: "操作记录", type: "component", componentPath: "recordHistory" },
  12. { label: "学生列表", type: "component", componentPath: "example/studentOfClass", bind: ['classId'] },
  13. ]
  14. }
  15. ]

弹框-自定义按钮

  1. pageContent: [
  2. `<v-btn @click="viewTestCustomBtn">打开测试自定义按钮弹框</v-btn>`
  3. ],
  4. actionContent: [
  5. {
  6. tag: 'jh-create-drawer',
  7. key: "testCustomBtn",
  8. attrs: {},
  9. title: '测试自定义按钮',
  10. headSlot: [
  11. { tag: 'v-spacer' },
  12. { tag: 'v-btn', value: '自定义按钮', attrs: { color: 'success', class: 'mr-2', '@click': 'doUiAction("123")', small: true } },
  13. ],
  14. contentList: [ /* 内容列表 */ ]
  15. }
  16. ]

弹框-关闭弹框检查

  1. actionContent: [
  2. {
  3. tag: 'jh-create-drawer',
  4. key: "create",
  5. attrs: {},
  6. title: '新增',
  7. isCheckFormBeforeClose: true,
  8. onCheckFormConfirm: 'doUiAction("createItem", { notConfirmed: true })',
  9. headSlot: [
  10. { tag: 'v-spacer'}
  11. ],
  12. contentList: [
  13. {
  14. label: "新增",
  15. type: "form",
  16. formItemList: [
  17. { label: "id", model: "id", tag: "v-text-field", rules: "validationRules.requireRules", },
  18. { label: "班级ID", model: "classId", tag: "v-text-field", rules: "validationRules.requireRules", },
  19. { label: "className", model: "className", tag: "v-text-field", rules: "validationRules.requireRules", },
  20. { label: "操作", model: "operation", tag: "v-text-field", rules: "validationRules.requireRules", },
  21. { label: "操作者userId", model: "operationByUserId", tag: "v-text-field", rules: "validationRules.requireRules", },
  22. { label: "操作者用户名", model: "operationByUser", tag: "v-text-field", rules: "validationRules.requireRules", },
  23. { label: "操作时间", model: "operationAt", tag: "v-text-field", rules: "validationRules.requireRules", },
  24. ],
  25. action: [{
  26. tag: "v-btn",
  27. value: "新增",
  28. attrs: {
  29. color: "success",
  30. ':small': true,
  31. '@click': "doUiAction('createItem')"
  32. }
  33. }],
  34. },
  35. ]
  36. }
  37. ]
属性 类型 必填 描述
isCheckFormBeforeClose boolean 是否打开关闭弹框检查,默认false,注意检查的表单对象与弹框的key需要保持匹配,如 表单对象:createItem,弹框key:create
onCheckFormConfirm string 保存内容方法名称
props.mergeForm boolean 是否合并提交form

配置示例-移动端

基础页面

  1. const content = {
  2. pageType: "jh-mobile-page", pageId: "mobile/classManagement", pageName: "classManagement页面", template: "jhMobileTemplateV4",
  3. resourceList: [
  4. {
  5. actionId: "selectItemList",
  6. resourceType: "sql",
  7. resourceHook: {},
  8. desc: "✅查询列表-classManagement",
  9. resourceData: {
  10. table: "class",
  11. operation: "select"
  12. }
  13. },
  14. {
  15. actionId: "insertItem",
  16. resourceType: "sql",
  17. resourceHook: {},
  18. desc: "✅添加-classManagement",
  19. resourceData: {
  20. table: "class",
  21. operation: "jhInsert"
  22. }
  23. },
  24. {
  25. actionId: "updateItem",
  26. resourceType: "sql",
  27. resourceHook: {},
  28. desc: "✅更新-classManagement",
  29. resourceData: {
  30. table: "class",
  31. operation: "jhUpdate"
  32. }
  33. },
  34. {
  35. actionId: "deleteItem",
  36. resourceType: "sql",
  37. resourceHook: {},
  38. desc: "✅删除-classManagement",
  39. resourceData: {
  40. table: "class",
  41. operation: "jhDelete"
  42. }
  43. }
  44. ], // { actionId: '', resourceType: '', resourceData: {}, resourceHook: {}, desc: '' }
  45. headContent: [
  46. { tag: 'jh-page-title', value: "班级管理", helpBtn: true, slot: [] },
  47. { tag: 'jh-order', model: 'tableDataOrder', items: 'tableDataOrderList' },
  48. { tag: 'jh-search', searchList: [
  49. { tag: 'v-select', model: "serverSearchWhere.semester", colAttrs: { class: 'pb-0' }, attrs: { prefix: '学期:', color: 'success', ':items': 'constantObj.semester' } },
  50. { tag: 'v-select', model: "serverSearchWhere.segment", colAttrs: { class: 'pb-0' }, attrs: { prefix: '学部:', color: 'success', ':items': 'constantObj.segment' } },
  51. { tag: 'v-text-field', model: "serverSearchWhereLike.name", colAttrs: { class: 'pb-0' }, attrs: { label: '学生名字:', color: 'success' }, quickAttrs: ['clearable'] },
  52. ] },
  53. { tag: 'v-spacer'},
  54. { tag: 'jh-mode', title: '简单模式', icon: 'mdi-view-carousel-outline', model: 'viewMode', items: 'constantObj.viewModeList' },
  55. ],
  56. pageContent: [
  57. {
  58. tag: 'jh-list',
  59. props: {
  60. limit: 10,
  61. rightArrowText: '',
  62. },
  63. attrs: { cols: 12, class: 'p-0 pb-7', ':style': '`height: calc(100vh - 140px); overflow-y: auto;overscroll-behavior: contain`' },
  64. headActionList: [
  65. { tag: 'v-btn', value: '新增', attrs: { color: 'success', class: 'mr-2', '@click': 'doUiAction("startCreateItem")', small: true } },
  66. { tag: 'v-spacer' },
  67. // 默认筛选
  68. {
  69. tag: 'v-col',
  70. attrs: { cols: '12', sm: '6', md: '3', xs: 8, class: 'pa-0' },
  71. value: [
  72. { tag: 'v-text-field', attrs: {prefix: '筛选', 'v-model': 'searchInput', class: 'jh-v-input', ':dense': true, ':filled': true, ':single-line': true} },
  73. ],
  74. }
  75. ],
  76. headers: [
  77. {text: "学生Id", value: "studentId", width: 80, isSimpleMode: true},
  78. {text: "姓名", value: "name", width: 90, isTitle: true, slot: [`
  79. <div v-if="item.isMonitor" class="ml-1">
  80. <v-icon color="warning" small>mdi-shield-star</v-icon>
  81. <span>干部</span>
  82. </div>
  83. `]},
  84. {text: "性别", value: "gender", width: 60, isSimpleMode: true},
  85. {text: "学生状态", value: "studentStatus", width: 80},
  86. {text: "年级", value: "level", width: 70},
  87. {text: "入学-推荐人", value: "recommendBy", width: 100, isDetailMode: true},
  88. {text: "入学-跟进人", value: "followUpByUserName", width: 100, isDetailMode: true},
  89. {text: "跟进阶段", value: "followUpStage", width: 80},
  90. {text: "报名时间", value: "createAt", width: 150},
  91. {text: "操作者", value: "operationByUser", width: 90},
  92. {text: "操作时间", value: "operationAt", width: 150},
  93. {text: '操作', value: 'action', align: 'center', sortable: false, width: 'window.innerWidth < 500 ? 90: 180', class: 'fixed', cellClass: 'fixed'},
  94. ],
  95. value: [
  96. // vuetify table custom slot
  97. ],
  98. rowActionList: [
  99. { text: "编辑", icon: 'mdi-note-edit-outline', color: 'success', click: 'doUiAction("startUpdateItem", item)' }
  100. ],
  101. },
  102. {
  103. tag: 'jh-action',
  104. attrs: { class: 'h-16 w-16 p-2 fixed right-4 bottom-32' },
  105. actionList: [
  106. { tag: 'v-btn', value: '新增', icon: 'mdi-plus', color: 'success', click: "doUiAction('startCreateItem')" },
  107. { tag: 'v-btn', value: '随机分配跟进人', icon: 'mdi-plus', color: 'success', click: "doUiAction('randomFollowUp')", ':disabled': '!tableSelected.length' },
  108. ]
  109. }
  110. ],
  111. actionContent: [
  112. {
  113. tag: 'jh-create-drawer',
  114. key: "create",
  115. attrs: {},
  116. title: '新增',
  117. headSlot: [
  118. { tag: 'v-spacer'}
  119. ],
  120. contentList: [
  121. {
  122. label: "新增",
  123. type: "form",
  124. formItemList: [
  125. { label: "id", model: "id", tag: "v-text-field", rules: "validationRules.requireRules", },
  126. { label: "班级ID", model: "classId", tag: "v-text-field", rules: "validationRules.requireRules", },
  127. { label: "className", model: "className", tag: "v-text-field", rules: "validationRules.requireRules", },
  128. { label: "操作", model: "operation", tag: "v-text-field", rules: "validationRules.requireRules", },
  129. { label: "操作者userId", model: "operationByUserId", tag: "v-text-field", rules: "validationRules.requireRules", },
  130. { label: "操作者用户名", model: "operationByUser", tag: "v-text-field", rules: "validationRules.requireRules", },
  131. { label: "操作时间", model: "operationAt", tag: "v-text-field", rules: "validationRules.requireRules", },
  132. ],
  133. action: [{
  134. tag: "v-btn",
  135. value: "新增",
  136. attrs: {
  137. color: "success",
  138. ':small': true,
  139. '@click': "doUiAction('createItem')"
  140. }
  141. }],
  142. },
  143. ]
  144. },
  145. {
  146. tag: 'jh-update-drawer',
  147. key: "update",
  148. attrs: {},
  149. title: '编辑',
  150. headSlot: [
  151. { tag: 'v-spacer'}
  152. ],
  153. contentList: [
  154. {
  155. label: "编辑",
  156. type: "form",
  157. formItemList: [
  158. { label: "id", model: "id", tag: "v-text-field", rules: "validationRules.requireRules", },
  159. { label: "班级ID", model: "classId", tag: "v-text-field", rules: "validationRules.requireRules", },
  160. { label: "className", model: "className", tag: "v-text-field", rules: "validationRules.requireRules", },
  161. { label: "操作", model: "operation", tag: "v-text-field", rules: "validationRules.requireRules", },
  162. { label: "操作者userId", model: "operationByUserId", tag: "v-text-field", rules: "validationRules.requireRules", },
  163. { label: "操作者用户名", model: "operationByUser", tag: "v-text-field", rules: "validationRules.requireRules", },
  164. { label: "操作时间", model: "operationAt", tag: "v-text-field", rules: "validationRules.requireRules", },
  165. ],
  166. action: [{
  167. tag: "v-btn",
  168. value: "编辑",
  169. attrs: {
  170. color: "success",
  171. ':small': true,
  172. '@click': "doUiAction('updateItem')"
  173. }
  174. }],
  175. },
  176. { label: "操作记录", type: "component", componentPath: "recordHistory", attrs: { table: 'class', pageId: 'classManagement', ':id': 'updateItem.id' } },
  177. ]
  178. },
  179. {
  180. tag: 'jh-detail-drawer',
  181. key: "detail",
  182. attrs: {},
  183. title: "详情",
  184. headSlot: [
  185. ],
  186. contentList: [
  187. {
  188. type: 'preview',
  189. md: 12,
  190. formItemList: [
  191. {
  192. tag: 'div',
  193. colAttrs: { class: 'pa-0' },
  194. value: `
  195. <div class="p-3 border-b" >
  196. <div class="flex justify-between mb-2 items-center">
  197. <div>
  198. <span class="font-weight-bold text-base">{{ detailItem.name }}</span>
  199. </div>
  200. <span :class="'text-sm '">{{ detailItem.followUpStatus }}</span>
  201. </div>
  202. <div class="text-gray-500 flex justify-between">意向就读学部:{{ detailItem.segment }}</div>
  203. <div class="text-gray-500 flex justify-between">报名日期:{{ detailItem.createAt }}</div>
  204. </div>
  205. <div class="pa-0 h-2 bg-gray-100" ></div>
  206. `
  207. },
  208. { label: "性别", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.gender }}" },
  209. { label: "身份证件号", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.icNumber }}" },
  210. { label: "家庭住址", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.residentialAddress }}" },
  211. { label: "意向就读学部", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.segment }}" },
  212. { label: "意向就读年级", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.level }}" },
  213. { label: "意向就读方式", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.afterSchoolCareType }}" },
  214. { label: "原就读学校", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.schoolRoll }}" },
  215. { label: "中考分数", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.middleSchoolExamScore }}" },
  216. { label: "中考报名序号", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.middleSchoolExamSequence }}" }
  217. ],
  218. action: [
  219. {
  220. tag: 'v-btn',
  221. value: "编辑",
  222. attrs: {
  223. color: 'primary',
  224. '@click': "doUiAction('startUpdateItem', detailItem); closeDetailDrawer()"
  225. },
  226. quickAttrs: ['small']
  227. }
  228. ]
  229. }
  230. ]
  231. },
  232. ],
  233. includeList: [], // { type: < js | css | html | vueComponent >, path: ''}
  234. common: {
  235. data: {
  236. constantObj: {
  237. viewModeList: [
  238. { text: "简洁模式", value: "simple" },
  239. { text: "详细模式", value: "detail" }
  240. ]
  241. },
  242. validationRules: {
  243. requireRules: [
  244. v => !!v || '必填',
  245. ],
  246. },
  247. serverSearchWhereLike: { className: '' }, // 服务端like查询
  248. serverSearchWhere: { }, // 服务端查询
  249. serverSearchWhereIn: { }, // 服务端 in 查询
  250. filterMap: {}, // 结果筛选条件
  251. tableDataOrder: [
  252. {
  253. column: "operationAt",
  254. order: "desc"
  255. }
  256. ],
  257. tableDataOrderList: [
  258. { text: "班级名称↓", value: [
  259. {
  260. column: "className",
  261. order: "desc"
  262. },
  263. ] },
  264. { text: "更新时间↓", value: [
  265. {
  266. column: "operationAt",
  267. order: "desc"
  268. },
  269. ] },
  270. ],
  271. },
  272. dataExpression: {
  273. isMobile: 'window.innerWidth < 500'
  274. }, // data 表达式
  275. watch: {},
  276. computed: {
  277. tableDataComputed() {
  278. if(this.filterMap) {
  279. return this.tableData.filter(row => {
  280. for (const key in this.filterMap) {
  281. if (this.filterMap[key] && row[key] !== this.filterMap[key]) {
  282. return false;
  283. }
  284. }
  285. return true;
  286. });
  287. } else {
  288. return this.tableData;
  289. }
  290. },
  291. },
  292. doUiAction: {}, // 额外uiAction { [key]: [action1, action2]}
  293. async created() {
  294. await this.doUiAction('getTableData');
  295. },
  296. methods: {}
  297. },
  298. };
  299. module.exports = content;

标题-只有页面标题

  1. headContent: [
  2. { tag: 'jh-page-title', value: "班级管理" },
  3. ],

标题-排序&筛选&模式切换

  1. headContent: [
  2. { tag: 'jh-page-title', value: "班级管理" },
  3. { tag: 'jh-order' }, // 固定变量 model: 'tableDataOrder', items: 'tableDataOrderList'
  4. { tag: 'jh-search', searchList: [
  5. { tag: 'v-select', model: "serverSearchWhere.semester", colAttrs: { class: 'pb-0' }, attrs: { prefix: '学期:', color: 'success', ':items': 'constantObj.semester' } },
  6. { tag: 'v-select', model: "serverSearchWhere.segment", colAttrs: { class: 'pb-0' }, attrs: { prefix: '学部:', color: 'success', ':items': 'constantObj.segment' } },
  7. { tag: 'v-text-field', model: "serverSearchWhereLike.name", colAttrs: { class: 'pb-0' }, attrs: { label: '学生名字:', color: 'success' }, quickAttrs: ['clearable'] },
  8. ] },
  9. { tag: 'v-spacer'},
  10. { tag: 'jh-mode', model: 'viewMode' }, // 固定变量:viewMode
  11. ],
  12. common: {
  13. data: {
  14. constantObj: {
  15. },
  16. viewMode: 'simple',
  17. tableDataOrder: [
  18. {
  19. column: "operationAt",
  20. order: "desc"
  21. }
  22. ],
  23. tableDataOrderList: [
  24. { text: "班级名称↓", value: [
  25. {
  26. column: "className",
  27. order: "desc"
  28. },
  29. ] },
  30. { text: "更新时间↓", value: [
  31. {
  32. column: "operationAt",
  33. order: "desc"
  34. },
  35. ] },
  36. ],
  37. }
  38. }

内容-数据列表

  1. pageContent: [
  2. {
  3. tag: 'jh-list',
  4. props: {
  5. limit: 10, // 服务端搜索limit
  6. },
  7. attrs: { cols: 12, class: 'p-0 pb-7', ':style': '`height: calc(100vh - 140px); overflow-y: auto;overscroll-behavior: contain`' },
  8. headers: [
  9. {text: "学生Id", value: "studentId", width: 80, isSimpleMode: true},
  10. {text: "姓名", value: "name", width: 90, isTitle: true, slot: [`
  11. <div v-if="item.isMonitor" class="ml-1">
  12. <v-icon color="warning" small>mdi-shield-star</v-icon>
  13. <span>干部</span>
  14. </div>
  15. `]},
  16. {text: "性别", value: "gender", width: 60, isSimpleMode: true},
  17. {text: "学生状态", value: "studentStatus", width: 80},
  18. {text: "年级", value: "level", width: 70},
  19. {text: "入学-推荐人", value: "recommendBy", width: 100, isDetailMode: true},
  20. {text: "入学-跟进人", value: "followUpByUserName", width: 100, isDetailMode: true},
  21. {text: "跟进阶段", value: "followUpStage", width: 80},
  22. {text: "报名时间", value: "createAt", width: 150},
  23. {text: "操作者", value: "operationByUser", width: 90},
  24. {text: "操作时间", value: "operationAt", width: 150},
  25. {text: '操作', value: 'action'},
  26. ],
  27. rowActionList: [
  28. ]
  29. }
  30. ],
  31. common: {
  32. async created() {
  33. await this.doUiAction('getTableData');
  34. },
  35. doUiAction: {
  36. startDetailItem: ['startDetailItem']
  37. },
  38. methods: {
  39. startDetailItem(item) {
  40. console.log("点击", item)
  41. }
  42. }
  43. }

jh-list

属性 类型 必填 描述
props.limit string 分页每页数量
props.rightArrowText string 右边箭头文本
headers array 字段内容
headers.isSimpleMode boolean 是否只在简单模式显示,默认false
headers.isTitle boolean 是否作为行标题
rowActionList array 详情模式下的点击行

内容-数据列表(详情弹框)

  1. pageContent: [
  2. {
  3. tag: 'jh-list',
  4. props: {
  5. limit: 10,
  6. rightArrowText: '',
  7. },
  8. attrs: { cols: 12, class: 'p-0 pb-7', ':style': '`height: calc(100vh - 140px); overflow-y: auto;overscroll-behavior: contain`' },
  9. headers: [
  10. {text: "学生Id", value: "studentId", width: 80, isSimpleMode: true},
  11. {text: "姓名", value: "name", width: 90, isTitle: true, slot: [`
  12. <div v-if="item.isMonitor" class="ml-1">
  13. <v-icon color="warning" small>mdi-shield-star</v-icon>
  14. <span>干部</span>
  15. </div>
  16. `]},
  17. {text: "性别", value: "gender", width: 60, isSimpleMode: true},
  18. {text: "学生状态", value: "studentStatus", width: 80},
  19. {text: "年级", value: "level", width: 70},
  20. {text: "入学-推荐人", value: "recommendBy", width: 100, isDetailMode: true},
  21. {text: "入学-跟进人", value: "followUpByUserName", width: 100, isDetailMode: true},
  22. {text: "跟进阶段", value: "followUpStage", width: 80},
  23. {text: "报名时间", value: "createAt", width: 150},
  24. {text: "操作者", value: "operationByUser", width: 90},
  25. {text: "操作时间", value: "operationAt", width: 150},
  26. {text: '操作', value: 'action', align: 'center', sortable: false, width: 'window.innerWidth < 500 ? 90: 180', class: 'fixed', cellClass: 'fixed'},
  27. ],
  28. rowActionList: [
  29. { text: "编辑", icon: 'mdi-note-edit-outline', color: 'success', click: 'doUiAction("startUpdateItem", item)' }
  30. ],
  31. }
  32. ],
  33. actionContent: [
  34. {
  35. tag: 'jh-detail-drawer',
  36. key: "detail",
  37. attrs: {},
  38. title: "详情",
  39. headSlot: [
  40. ],
  41. contentList: [
  42. {
  43. type: 'preview',
  44. md: 12,
  45. formItemList: [
  46. {
  47. tag: 'div',
  48. colAttrs: { class: 'pa-0' },
  49. value: `
  50. <div class="p-3 border-b" >
  51. <div class="flex justify-between mb-2 items-center">
  52. <div>
  53. <span class="font-weight-bold text-base">{{ detailItem.name }}</span>
  54. </div>
  55. <span :class="'text-sm '">{{ detailItem.followUpStatus }}</span>
  56. </div>
  57. <div class="text-gray-500 flex justify-between">意向就读学部:{{ detailItem.segment }}</div>
  58. <div class="text-gray-500 flex justify-between">报名日期:{{ detailItem.createAt }}</div>
  59. </div>
  60. <div class="pa-0 h-2 bg-gray-100" ></div>
  61. `
  62. },
  63. { label: "性别", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.gender }}" },
  64. { label: "身份证件号", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.icNumber }}" },
  65. { label: "家庭住址", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.residentialAddress }}" },
  66. { label: "意向就读学部", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.segment }}" },
  67. { label: "意向就读年级", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.level }}" },
  68. { label: "意向就读方式", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.afterSchoolCareType }}" },
  69. { label: "原就读学校", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.schoolRoll }}" },
  70. { label: "中考分数", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.middleSchoolExamScore }}" },
  71. { label: "中考报名序号", tag: "span", colAttrs: { class: 'border-b pb-2 flex justify-between' }, value: "{{ detailItem.middleSchoolExamSequence }}" }
  72. ],
  73. action: [
  74. {
  75. tag: 'v-btn',
  76. value: "编辑",
  77. attrs: {
  78. color: 'primary',
  79. '@click': "doUiAction('startUpdateItem', detailItem); closeDetailDrawer()"
  80. },
  81. quickAttrs: ['small']
  82. }
  83. ]
  84. }
  85. ]
  86. }
  87. ],
  88. common: {
  89. async created() {
  90. await this.doUiAction('getTableData');
  91. },
  92. }

内容-圆点操作菜单

  1. pageContent: [
  2. {
  3. tag: 'jh-action',
  4. attrs: { class: 'h-16 w-16 p-2 fixed right-4 bottom-32' },
  5. actionList: [
  6. { tag: 'v-btn', value: '新增', icon: 'mdi-plus', color: 'success', click: "doUiAction('startCreateItem')" },
  7. { tag: 'v-btn', value: '随机分配跟进人', icon: 'mdi-plus', color: 'success', click: "doUiAction('randomFollowUp')", ':disabled': '!tableSelected.length' },
  8. ]
  9. }
  10. ]

弹框相关

👉参考PC端弹框相关配置 👈

命令详解

生成样例文件页面

默认生成 example_classexample_student 数据表、配置文件和页面,方便参考使用

  1. jianghu-init json --generateType=example

生成页面配置文件

根据数据表生成页面配置文件

  1. jianghu-init json --generateType=json --pageType=page --table=class --pageId=classManagement

配置渲染html

根据配置文件生成页面

  1. jianghu-init json --generateType=page --pageType=page --file=classManagement

开启Dev模式

开启dev模式,修改配置文件将自动更新页面

  1. jianghu-init json dev

参数说明

参数 描述
generateType 生成类型,可选 example(生成示例文件)、json(数据表生成配置文件)、page(配置文件生成页面)
pageType 页面类型,可选 page、component
table 数据表名,当generateType为json可用
dev 启用开发模式,执行后会自动检测当前项目的json文件更新并自动更新html文件

其他

字符串代码语法高亮

在VSCode中,可以安装以下插件来实现字符串代码的语法高亮,以提高代码的可读性:

安装以上插件之后,在字符串代码前指定语法名称,即可显示语法高亮效果。

  1. pageContent: [
  2. /*html*/`<v-btn @click="openTestMultiTabDrawer">打开测试多标签弹框</v-btn>`,
  3. ],
  4. style: /*css*/`
  5. .jh-v-input {
  6. width: 100%;
  7. }
  8. `