diff --git a/package.json b/package.json index 4878c422..d103401a 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,10 @@ "vue-router": "^3.1.3", "vue-splitpane": "^1.0.6", "vue-ueditor-wrap": "^2.4.1", - "vuex": "^3.1.2" + "vuex": "^3.1.2", + "d2-crud-plus": "^1.16.2", + "d2-crud-x": "^2.10.2", + "d2p-extends": "^1.9.11" }, "devDependencies": { "@d2-projects/vue-filename-injector": "^1.1.0", diff --git a/src/api/index.js b/src/api/index.js index 8a00cab4..a713ffdc 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -3,7 +3,7 @@ import faker from 'faker/locale/zh_CN' import { service, request, serviceForMock, requestForMock, mock } from './service' import * as tools from './tools' -const files = require.context('./modules', true, /\.js$/) +const files = require.context('./modules', true, /\.api\.js$/) const generators = files.keys().map(key => files(key).default) export default assign({}, ...map(generators, generator => generator({ diff --git a/src/api/modules/demo.js b/src/api/modules/demo.api.js similarity index 100% rename from src/api/modules/demo.js rename to src/api/modules/demo.api.js diff --git a/src/api/modules/file.js b/src/api/modules/file.api.js similarity index 100% rename from src/api/modules/file.js rename to src/api/modules/file.api.js diff --git a/src/api/modules/sys.user.js b/src/api/modules/sys.user.api.js similarity index 100% rename from src/api/modules/sys.user.js rename to src/api/modules/sys.user.api.js diff --git a/src/assets/svg-icons/icons/d2-crud-plus.svg b/src/assets/svg-icons/icons/d2-crud-plus.svg new file mode 100644 index 00000000..7a0b63bd --- /dev/null +++ b/src/assets/svg-icons/icons/d2-crud-plus.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/d2-container/index.js b/src/components/d2-container/index.js index 1c723396..ab579c96 100644 --- a/src/components/d2-container/index.js +++ b/src/components/d2-container/index.js @@ -23,11 +23,6 @@ export default { type: Boolean, required: false, default: false - }, - betterScrollOptions: { - type: Object, - required: false, - default: () => ({}) } }, computed: { @@ -47,7 +42,6 @@ export default { class="container-component"> this.$emit('scroll', e) }> { slots } diff --git a/src/menu/index.js b/src/menu/index.js index e57108c6..f0dc649d 100644 --- a/src/menu/index.js +++ b/src/menu/index.js @@ -4,16 +4,12 @@ import { uniqueId } from 'lodash' import demoPlugins from './modules/demo-plugins' // 组件 import demoComponents from './modules/demo-components' -// 组件 -import demoCharts from './modules/demo-charts' -// 试验台 +// 功能 import demoPlayground from './modules/demo-playground' -// 示例 -import demoBusiness from './modules/demo-business' // CRUD import demoD2Crud from './modules/demo-d2-crud' -// 第三方网页 -import demoFrame from './modules/demo-frame' +// CRUD PLUS +import demoD2CrudPlus from './modules/demo-d2-crud-plus' /** * @description 给菜单数据补充上 path 字段 @@ -34,11 +30,9 @@ function supplementPath (menu) { export const menuAside = supplementPath([ demoComponents, demoPlugins, - demoCharts, demoPlayground, - demoBusiness, demoD2Crud, - demoFrame + demoD2CrudPlus ]) // 菜单 顶栏 @@ -48,29 +42,15 @@ export const menuHeader = supplementPath([ title: '首页', icon: 'home' }, + demoPlayground, + demoComponents, + demoPlugins, { - title: '功能', + title: '社区插件', icon: 'puzzle-piece', children: [ demoD2Crud, - demoComponents, - demoCharts, - demoPlugins, - demoFrame, - { - title: '新窗口打开链接', - icon: 'link', - children: [ - { path: 'https://github.com/d2-projects/d2-admin', title: 'D2Admin Github', icon: 'github' }, - { path: 'https://juejin.im/user/57a48b632e958a006691b946/posts', title: '掘金', icon: 'globe' }, - { path: 'https://my.oschina.net/u/3871516', title: '开源中国', icon: 'globe' }, - { path: 'https://www.zhihu.com/people/fairy-ever/activities', title: '知乎', icon: 'globe' }, - { path: 'https://segmentfault.com/blog/liyang-note-book', title: 'segmentfault 专栏', icon: 'globe' }, - { path: 'http://www.fairyever.com/', title: 'www.fairyever.com', icon: 'globe' } - ] - } + demoD2CrudPlus ] - }, - demoPlayground, - demoBusiness + } ]) diff --git a/src/menu/modules/demo-business.js b/src/menu/modules/demo-business.js deleted file mode 100644 index 736696f9..00000000 --- a/src/menu/modules/demo-business.js +++ /dev/null @@ -1,22 +0,0 @@ -export default { - path: '/demo/business', - title: '示例', - icon: 'flask', - children: (pre => [ - { path: `${pre}index`, title: '示例', icon: 'home' }, - { - title: '表格', - icon: 'table', - children: [ - { path: `${pre}table/1`, title: '表格 1' } - ] - }, - { - title: 'ISSUES', - icon: 'github', - children: [ - { path: `${pre}issues/142`, title: '#142' } - ] - } - ])('/demo/business/') -} diff --git a/src/menu/modules/demo-charts.js b/src/menu/modules/demo-charts.js deleted file mode 100644 index bfd808cd..00000000 --- a/src/menu/modules/demo-charts.js +++ /dev/null @@ -1,149 +0,0 @@ -export default { - path: '/demo/charts', - title: '图表', - icon: 'line-chart', - children: (pre => [ - { path: `${pre}index`, title: '图表', icon: 'home' }, - { - path: `${pre}list`, - title: '图表', - icon: 'cube', - children: [ - { - path: `${pre}list/line`, - title: '折线图', - children: [ - { path: `${pre}list/line/demo1`, title: '一般' }, - { path: `${pre}list/line/demo2`, title: '横坐标倾斜' }, - { path: `${pre}list/line/demo3`, title: '堆叠面积图' }, - { path: `${pre}list/line/demo4`, title: '显示数值' }, - { path: `${pre}list/line/demo5`, title: '设置别名' } - ] - }, - { - path: `${pre}list/histogram`, - title: '柱状图', - children: [ - { path: `${pre}list/histogram/demo1`, title: '一般' }, - { path: `${pre}list/histogram/demo2`, title: '指标维度' }, - { path: `${pre}list/histogram/demo3`, title: '混合图表' }, - { path: `${pre}list/histogram/demo4`, title: '堆叠柱状图' }, - { path: `${pre}list/histogram/demo5`, title: '显示数值' }, - { path: `${pre}list/histogram/demo6`, title: '横轴连续' } - ] - }, - { - path: `${pre}list/bar`, - title: '条形图', - children: [ - { path: `${pre}list/bar/demo1`, title: '一般' }, - { path: `${pre}list/bar/demo2`, title: '指标维度' }, - { path: `${pre}list/bar/demo3`, title: '排序条形图' }, - { path: `${pre}list/bar/demo4`, title: '堆叠条形图' }, - { path: `${pre}list/bar/demo5`, title: '纵轴连续' } - ] - }, - { - path: `${pre}list/pie`, - title: '饼图', - children: [ - { path: `${pre}list/pie/demo1`, title: '一般' }, - { path: `${pre}list/pie/demo2`, title: '指标维度' }, - { path: `${pre}list/pie/demo3`, title: '玫瑰图' }, - { path: `${pre}list/pie/demo4`, title: '限制条数' }, - { path: `${pre}list/pie/demo5`, title: '多圆饼图' }, - { path: `${pre}list/pie/demo6`, title: '设置半径' } - ] - }, - { - path: `${pre}list/ring`, - title: '环图', - children: [ - { path: `${pre}list/ring/demo1`, title: '一般' }, - { path: `${pre}list/ring/demo2`, title: '指标维度' }, - { path: `${pre}list/ring/demo3`, title: '玫瑰图' }, - { path: `${pre}list/ring/demo4`, title: '限制显示条数' }, - { path: `${pre}list/ring/demo5`, title: '设置半径' } - ] - }, - { - path: `${pre}list/waterfall`, - title: '瀑布图', - children: [ - { path: `${pre}list/waterfall/demo1`, title: '一般' } - ] - }, - { - path: `${pre}list/funnel`, - title: '漏斗图', - children: [ - { path: `${pre}list/funnel/demo1`, title: '一般' }, - { path: `${pre}list/funnel/demo2`, title: '金字塔' } - ] - }, - { - path: `${pre}list/radar`, - title: '雷达图', - children: [ - { path: `${pre}list/radar/demo1`, title: '一般' } - ] - }, - { - path: `${pre}list/map`, - title: '地图', - children: [ - { path: `${pre}list/map/demo1`, title: '一般' }, - { path: `${pre}list/map/demo2`, title: '设置城市' }, - { path: `${pre}list/map/demo3`, title: '设置样式' } - ] - }, - { - path: `${pre}list/sankey`, - title: '桑基图', - children: [ - { path: `${pre}list/sankey/demo1`, title: '一般' } - ] - }, - { - path: `${pre}list/heatmap`, - title: '热力图', - children: [ - { path: `${pre}list/heatmap/demo1`, title: '一般' }, - { path: `${pre}list/heatmap/demo2`, title: '地图热力图' } - ] - }, - { - path: `${pre}list/scatter`, - title: '散点图', - children: [ - { path: `${pre}list/scatter/demo1`, title: '单维度多指标' }, - { path: `${pre}list/scatter/demo2`, title: '双维度多指标' } - ] - }, - { - path: `${pre}list/candle`, - title: 'K线图', - children: [ - { path: `${pre}list/candle/demo1`, title: '一般' }, - { path: `${pre}list/candle/demo2`, title: 'MA VOL' }, - { path: `${pre}list/candle/demo3`, title: '自定义' } - ] - }, - { - path: `${pre}list/gauge`, - title: '仪表盘', - children: [ - { path: `${pre}list/gauge/demo1`, title: '一般' } - ] - }, - { - path: `${pre}list/tree`, - title: '树图', - children: [ - { path: `${pre}list/tree/demo1`, title: '径向树图' } - ] - } - ] - } - ])('/demo/charts/') -} diff --git a/src/menu/modules/demo-components.js b/src/menu/modules/demo-components.js index 233b9205..7edaf985 100644 --- a/src/menu/modules/demo-components.js +++ b/src/menu/modules/demo-components.js @@ -1,6 +1,6 @@ export default { path: '/demo/components', - title: '内置组件', + title: '组件', icon: 'puzzle-piece', children: (pre => [ { path: `${pre}index`, title: '扩展组件', icon: 'home' }, diff --git a/src/menu/modules/demo-d2-crud-plus.js b/src/menu/modules/demo-d2-crud-plus.js new file mode 100644 index 00000000..62d41e2c --- /dev/null +++ b/src/menu/modules/demo-d2-crud-plus.js @@ -0,0 +1,37 @@ +import '@/views/demo/d2-crud-plus/install' +export default { + path: '/demo/d2-crud-plus', + title: 'D2 CRUD PLUS', + iconSvg: 'd2-crud-plus', + children: (pre => [ + { path: `${pre}index`, title: 'D2 CRUD PLUS', icon: 'home' }, + { + title: '简单示例', + path: `${pre}demo` + }, + { + title: '表单分组', + path: `${pre}group` + }, + { + title: '综合示例', + path: `${pre}synthesize` + }, + { + title: '权限管理', + icon: 'link', + path: 'http://qiniu.veryreader.com/D2CrudPlusExample/#/permission/resource' + }, + { + title: '更多示例', + icon: 'link', + path: 'http://qiniu.veryreader.com/D2CrudPlusExample/' + }, + { + title: '帮助文档', + icon: 'link', + path: 'http://greper.gitee.io/d2-crud-plus/' + } + + ])('/demo/d2-crud-plus/') +} diff --git a/src/menu/modules/demo-frame.js b/src/menu/modules/demo-frame.js deleted file mode 100644 index 30995db3..00000000 --- a/src/menu/modules/demo-frame.js +++ /dev/null @@ -1,11 +0,0 @@ -export default { - path: '/demo/frame', - title: '内嵌网页', - icon: 'globe', - children: (pre => [ - { path: `${pre}index`, title: 'Frame ', icon: 'home' }, - { path: `${pre}d2-doc`, title: 'D2Admin 中文文档', iconSvg: 'd2-admin' }, - { path: `${pre}html`, title: '静态 HTML', icon: 'code' }, - { path: `${pre}report`, title: '构建分析', icon: 'pie-chart' } - ])('/demo/frame/') -} diff --git a/src/menu/modules/demo-playground.js b/src/menu/modules/demo-playground.js index 4200500f..76a32f65 100644 --- a/src/menu/modules/demo-playground.js +++ b/src/menu/modules/demo-playground.js @@ -1,9 +1,9 @@ export default { path: '/demo/playground', - title: '试验台', + title: '功能', icon: 'flask', children: (pre => [ - { path: `${pre}index`, title: '试验台', icon: 'home' }, + { path: `${pre}index`, title: '功能', icon: 'home' }, { title: 'svg 菜单图标', iconSvg: 'd2-admin', @@ -37,6 +37,28 @@ export default { { title: '正在开发 3' } ] }, + { + path: `${pre}frame`, + title: '内嵌网页', + icon: 'globe', + children: [ + { path: `${pre}frame/d2-doc`, title: 'D2Admin 中文文档', iconSvg: 'd2-admin' }, + { path: `${pre}frame/html`, title: '静态 HTML', icon: 'code' }, + { path: `${pre}frame/report`, title: '构建分析', icon: 'pie-chart' } + ] + }, + { + title: '新窗口打开链接', + icon: 'link', + children: [ + { path: 'https://github.com/d2-projects/d2-admin', title: 'D2Admin Github', icon: 'github' }, + { path: 'https://juejin.im/user/57a48b632e958a006691b946/posts', title: '掘金', icon: 'globe' }, + { path: 'https://my.oschina.net/u/3871516', title: '开源中国', icon: 'globe' }, + { path: 'https://www.zhihu.com/people/fairy-ever/activities', title: '知乎', icon: 'globe' }, + { path: 'https://segmentfault.com/blog/liyang-note-book', title: 'segmentfault 专栏', icon: 'globe' }, + { path: 'http://www.fairyever.com/', title: 'www.fairyever.com', icon: 'globe' } + ] + }, { path: `${pre}store`, title: '全局状态管理', diff --git a/src/menu/modules/demo-plugins.js b/src/menu/modules/demo-plugins.js index c486adfd..a97f16ef 100644 --- a/src/menu/modules/demo-plugins.js +++ b/src/menu/modules/demo-plugins.js @@ -4,6 +4,147 @@ export default { icon: 'plug', children: (pre => [ { path: `${pre}index`, title: '插件', icon: 'home' }, + { + path: `${pre}charts`, + title: '图表', + icon: 'bar-chart', + children: [ + { + path: `${pre}charts/line`, + title: '折线图', + children: [ + { path: `${pre}charts/line/demo1`, title: '一般' }, + { path: `${pre}charts/line/demo2`, title: '横坐标倾斜' }, + { path: `${pre}charts/line/demo3`, title: '堆叠面积图' }, + { path: `${pre}charts/line/demo4`, title: '显示数值' }, + { path: `${pre}charts/line/demo5`, title: '设置别名' } + ] + }, + { + path: `${pre}charts/histogram`, + title: '柱状图', + children: [ + { path: `${pre}charts/histogram/demo1`, title: '一般' }, + { path: `${pre}charts/histogram/demo2`, title: '指标维度' }, + { path: `${pre}charts/histogram/demo3`, title: '混合图表' }, + { path: `${pre}charts/histogram/demo4`, title: '堆叠柱状图' }, + { path: `${pre}charts/histogram/demo5`, title: '显示数值' }, + { path: `${pre}charts/histogram/demo6`, title: '横轴连续' } + ] + }, + { + path: `${pre}charts/bar`, + title: '条形图', + children: [ + { path: `${pre}charts/bar/demo1`, title: '一般' }, + { path: `${pre}charts/bar/demo2`, title: '指标维度' }, + { path: `${pre}charts/bar/demo3`, title: '排序条形图' }, + { path: `${pre}charts/bar/demo4`, title: '堆叠条形图' }, + { path: `${pre}charts/bar/demo5`, title: '纵轴连续' } + ] + }, + { + path: `${pre}charts/pie`, + title: '饼图', + children: [ + { path: `${pre}charts/pie/demo1`, title: '一般' }, + { path: `${pre}charts/pie/demo2`, title: '指标维度' }, + { path: `${pre}charts/pie/demo3`, title: '玫瑰图' }, + { path: `${pre}charts/pie/demo4`, title: '限制条数' }, + { path: `${pre}charts/pie/demo5`, title: '多圆饼图' }, + { path: `${pre}charts/pie/demo6`, title: '设置半径' } + ] + }, + { + path: `${pre}charts/ring`, + title: '环图', + children: [ + { path: `${pre}charts/ring/demo1`, title: '一般' }, + { path: `${pre}charts/ring/demo2`, title: '指标维度' }, + { path: `${pre}charts/ring/demo3`, title: '玫瑰图' }, + { path: `${pre}charts/ring/demo4`, title: '限制显示条数' }, + { path: `${pre}charts/ring/demo5`, title: '设置半径' } + ] + }, + { + path: `${pre}charts/waterfall`, + title: '瀑布图', + children: [ + { path: `${pre}charts/waterfall/demo1`, title: '一般' } + ] + }, + { + path: `${pre}charts/funnel`, + title: '漏斗图', + children: [ + { path: `${pre}charts/funnel/demo1`, title: '一般' }, + { path: `${pre}charts/funnel/demo2`, title: '金字塔' } + ] + }, + { + path: `${pre}charts/radar`, + title: '雷达图', + children: [ + { path: `${pre}charts/radar/demo1`, title: '一般' } + ] + }, + { + path: `${pre}charts/map`, + title: '地图', + children: [ + { path: `${pre}charts/map/demo1`, title: '一般' }, + { path: `${pre}charts/map/demo2`, title: '设置城市' }, + { path: `${pre}charts/map/demo3`, title: '设置样式' } + ] + }, + { + path: `${pre}charts/sankey`, + title: '桑基图', + children: [ + { path: `${pre}charts/sankey/demo1`, title: '一般' } + ] + }, + { + path: `${pre}charts/heatmap`, + title: '热力图', + children: [ + { path: `${pre}charts/heatmap/demo1`, title: '一般' }, + { path: `${pre}charts/heatmap/demo2`, title: '地图热力图' } + ] + }, + { + path: `${pre}charts/scatter`, + title: '散点图', + children: [ + { path: `${pre}charts/scatter/demo1`, title: '单维度多指标' }, + { path: `${pre}charts/scatter/demo2`, title: '双维度多指标' } + ] + }, + { + path: `${pre}charts/candle`, + title: 'K线图', + children: [ + { path: `${pre}charts/candle/demo1`, title: '一般' }, + { path: `${pre}charts/candle/demo2`, title: 'MA VOL' }, + { path: `${pre}charts/candle/demo3`, title: '自定义' } + ] + }, + { + path: `${pre}charts/gauge`, + title: '仪表盘', + children: [ + { path: `${pre}charts/gauge/demo1`, title: '一般' } + ] + }, + { + path: `${pre}charts/tree`, + title: '树图', + children: [ + { path: `${pre}charts/tree/demo1`, title: '径向树图' } + ] + } + ] + }, { path: `${pre}import`, title: '导入', diff --git a/src/router/modules/business.js b/src/router/modules/business.js deleted file mode 100644 index 8b5cfdac..00000000 --- a/src/router/modules/business.js +++ /dev/null @@ -1,63 +0,0 @@ -import layoutHeaderAside from '@/layout/header-aside' - -// 由于懒加载页面太多的话会造成webpack热更新太慢,所以开发环境不使用懒加载,只有生产环境使用懒加载 -const _import = require('@/libs/util.import.' + process.env.NODE_ENV) - -const meta = { auth: true } - -export default { - path: '/demo/business', - name: 'demo-business', - meta, - redirect: { name: 'demo-business-index' }, - component: layoutHeaderAside, - children: (pre => [ - { - path: 'index', - name: `${pre}index`, - component: _import('demo/business/index'), - meta: { - ...meta, - title: '示例首页' - } - }, - { - path: 'table/1', - name: `${pre}table-1`, - component: _import('demo/business/table/1'), - meta: { - ...meta, - title: '表格 1' - } - }, - { - path: 'issues/142', - name: `${pre}issues-142`, - component: _import('demo/business/issues/142'), - meta: { - ...meta, - title: 'issue #142' - } - }, - { - path: 'issues/142/edit/:id', - name: `${pre}issues-142-edit`, - component: _import('demo/business/issues/142/edit'), - props: true, - meta: { - ...meta, - title: '无缓存编辑' - } - }, - { - path: 'issues/142/edit-cache-db/:id', - name: `${pre}issues-142-edit-cache-db`, - component: _import('demo/business/issues/142/edit-cache-db'), - props: true, - meta: { - ...meta, - title: '带缓存编辑 DB' - } - } - ])('demo-business-') -} diff --git a/src/router/modules/charts.js b/src/router/modules/charts.js deleted file mode 100644 index 365ba8d3..00000000 --- a/src/router/modules/charts.js +++ /dev/null @@ -1,61 +0,0 @@ -import layoutHeaderAside from '@/layout/header-aside' - -// 由于懒加载页面太多的话会造成webpack热更新太慢,所以开发环境不使用懒加载,只有生产环境使用懒加载 -const _import = require('@/libs/util.import.' + process.env.NODE_ENV) - -const meta = { auth: true } - -export default { - path: '/demo/charts', - name: 'demo-charts', - meta, - redirect: { name: 'demo-charts-index' }, - component: layoutHeaderAside, - children: (pre => [ - { path: 'index', name: `${pre}index`, component: _import('demo/charts/index'), meta: { ...meta, title: '图表首页' } }, - { path: 'list/line/demo1', name: `${pre}list-line-demo1`, component: _import('demo/charts/list/line/demo1/index.vue'), meta: { ...meta, title: '折线图示例 1' } }, - { path: 'list/line/demo2', name: `${pre}list-line-demo2`, component: _import('demo/charts/list/line/demo2/index.vue'), meta: { ...meta, title: '折线图示例 2' } }, - { path: 'list/line/demo3', name: `${pre}list-line-demo3`, component: _import('demo/charts/list/line/demo3/index.vue'), meta: { ...meta, title: '折线图示例 3' } }, - { path: 'list/line/demo4', name: `${pre}list-line-demo4`, component: _import('demo/charts/list/line/demo4/index.vue'), meta: { ...meta, title: '折线图示例 4' } }, - { path: 'list/line/demo5', name: `${pre}list-line-demo5`, component: _import('demo/charts/list/line/demo5/index.vue'), meta: { ...meta, title: '折线图示例 5' } }, - { path: 'list/histogram/demo1', name: `${pre}list-histogram-demo1`, component: _import('demo/charts/list/histogram/demo1/index.vue'), meta: { ...meta, title: '柱状图示例 1' } }, - { path: 'list/histogram/demo2', name: `${pre}list-histogram-demo2`, component: _import('demo/charts/list/histogram/demo2/index.vue'), meta: { ...meta, title: '柱状图示例 2' } }, - { path: 'list/histogram/demo3', name: `${pre}list-histogram-demo3`, component: _import('demo/charts/list/histogram/demo3/index.vue'), meta: { ...meta, title: '柱状图示例 3' } }, - { path: 'list/histogram/demo4', name: `${pre}list-histogram-demo4`, component: _import('demo/charts/list/histogram/demo4/index.vue'), meta: { ...meta, title: '柱状图示例 4' } }, - { path: 'list/histogram/demo5', name: `${pre}list-histogram-demo5`, component: _import('demo/charts/list/histogram/demo5/index.vue'), meta: { ...meta, title: '柱状图示例 5' } }, - { path: 'list/histogram/demo6', name: `${pre}list-histogram-demo6`, component: _import('demo/charts/list/histogram/demo6/index.vue'), meta: { ...meta, title: '柱状图示例 6' } }, - { path: 'list/bar/demo1', name: `${pre}list-bar-demo1`, component: _import('demo/charts/list/bar/demo1/index.vue'), meta: { ...meta, title: '条形图示例 1' } }, - { path: 'list/bar/demo2', name: `${pre}list-bar-demo2`, component: _import('demo/charts/list/bar/demo2/index.vue'), meta: { ...meta, title: '条形图示例 2' } }, - { path: 'list/bar/demo3', name: `${pre}list-bar-demo3`, component: _import('demo/charts/list/bar/demo3/index.vue'), meta: { ...meta, title: '条形图示例 3' } }, - { path: 'list/bar/demo4', name: `${pre}list-bar-demo4`, component: _import('demo/charts/list/bar/demo4/index.vue'), meta: { ...meta, title: '条形图示例 4' } }, - { path: 'list/bar/demo5', name: `${pre}list-bar-demo5`, component: _import('demo/charts/list/bar/demo5/index.vue'), meta: { ...meta, title: '条形图示例 5' } }, - { path: 'list/pie/demo1', name: `${pre}list-pie-demo1`, component: _import('demo/charts/list/pie/demo1/index.vue'), meta: { ...meta, title: '饼图示例 1' } }, - { path: 'list/pie/demo2', name: `${pre}list-pie-demo2`, component: _import('demo/charts/list/pie/demo2/index.vue'), meta: { ...meta, title: '饼图示例 2' } }, - { path: 'list/pie/demo3', name: `${pre}list-pie-demo3`, component: _import('demo/charts/list/pie/demo3/index.vue'), meta: { ...meta, title: '饼图示例 3' } }, - { path: 'list/pie/demo4', name: `${pre}list-pie-demo4`, component: _import('demo/charts/list/pie/demo4/index.vue'), meta: { ...meta, title: '饼图示例 4' } }, - { path: 'list/pie/demo5', name: `${pre}list-pie-demo5`, component: _import('demo/charts/list/pie/demo5/index.vue'), meta: { ...meta, title: '饼图示例 5' } }, - { path: 'list/pie/demo6', name: `${pre}list-pie-demo6`, component: _import('demo/charts/list/pie/demo6/index.vue'), meta: { ...meta, title: '饼图示例 6' } }, - { path: 'list/ring/demo1', name: `${pre}list-ring-demo1`, component: _import('demo/charts/list/ring/demo1/index.vue'), meta: { ...meta, title: '环图示例 1' } }, - { path: 'list/ring/demo2', name: `${pre}list-ring-demo2`, component: _import('demo/charts/list/ring/demo2/index.vue'), meta: { ...meta, title: '环图示例 2' } }, - { path: 'list/ring/demo3', name: `${pre}list-ring-demo3`, component: _import('demo/charts/list/ring/demo3/index.vue'), meta: { ...meta, title: '环图示例 3' } }, - { path: 'list/ring/demo4', name: `${pre}list-ring-demo4`, component: _import('demo/charts/list/ring/demo4/index.vue'), meta: { ...meta, title: '环图示例 4' } }, - { path: 'list/ring/demo5', name: `${pre}list-ring-demo5`, component: _import('demo/charts/list/ring/demo5/index.vue'), meta: { ...meta, title: '环图示例 5' } }, - { path: 'list/waterfall/demo1', name: `${pre}list-waterfall-demo1`, component: _import('demo/charts/list/waterfall/demo1/index.vue'), meta: { ...meta, title: '瀑布图示例 1' } }, - { path: 'list/funnel/demo1', name: `${pre}list-funnel-demo1`, component: _import('demo/charts/list/funnel/demo1/index.vue'), meta: { ...meta, title: '漏斗图示例 1' } }, - { path: 'list/funnel/demo2', name: `${pre}list-funnel-demo2`, component: _import('demo/charts/list/funnel/demo2/index.vue'), meta: { ...meta, title: '漏斗图示例 2' } }, - { path: 'list/radar/demo1', name: `${pre}list-radar-demo1`, component: _import('demo/charts/list/radar/demo1/index.vue'), meta: { ...meta, title: '雷达图示例 1' } }, - { path: 'list/map/demo1', name: `${pre}list-map-demo1`, component: _import('demo/charts/list/map/demo1/index.vue'), meta: { ...meta, title: '地图示例 1' } }, - { path: 'list/map/demo2', name: `${pre}list-map-demo2`, component: _import('demo/charts/list/map/demo2/index.vue'), meta: { ...meta, title: '地图示例 2' } }, - { path: 'list/map/demo3', name: `${pre}list-map-demo3`, component: _import('demo/charts/list/map/demo3/index.vue'), meta: { ...meta, title: '地图示例 3' } }, - { path: 'list/sankey/demo1', name: `${pre}list-sankey-demo1`, component: _import('demo/charts/list/sankey/demo1/index.vue'), meta: { ...meta, title: '桑基图示例 1' } }, - { path: 'list/heatmap/demo1', name: `${pre}list-heatmap-demo1`, component: _import('demo/charts/list/heatmap/demo1/index.vue'), meta: { ...meta, title: '热力图示例 1' } }, - { path: 'list/heatmap/demo2', name: `${pre}list-heatmap-demo2`, component: _import('demo/charts/list/heatmap/demo2/index.vue'), meta: { ...meta, title: '热力图示例 2' } }, - { path: 'list/scatter/demo1', name: `${pre}list-scatter-demo1`, component: _import('demo/charts/list/scatter/demo1/index.vue'), meta: { ...meta, title: '散点图示例 1' } }, - { path: 'list/scatter/demo2', name: `${pre}list-scatter-demo2`, component: _import('demo/charts/list/scatter/demo2/index.vue'), meta: { ...meta, title: '散点图示例 2' } }, - { path: 'list/candle/demo1', name: `${pre}list-candle-demo1`, component: _import('demo/charts/list/candle/demo1/index.vue'), meta: { ...meta, title: 'K线图示例 1' } }, - { path: 'list/candle/demo2', name: `${pre}list-candle-demo2`, component: _import('demo/charts/list/candle/demo2/index.vue'), meta: { ...meta, title: 'K线图示例 2' } }, - { path: 'list/candle/demo3', name: `${pre}list-candle-demo3`, component: _import('demo/charts/list/candle/demo3/index.vue'), meta: { ...meta, title: 'K线图示例 3' } }, - { path: 'list/gauge/demo1', name: `${pre}list-gauge-demo1`, component: _import('demo/charts/list/gauge/demo1/index.vue'), meta: { ...meta, title: '仪表盘示例 1' } }, - { path: 'list/tree/demo1', name: `${pre}list-tree-demo1`, component: _import('demo/charts/list/tree/demo1/index.vue'), meta: { ...meta, title: '树图示例 1' } } - ])('demo-charts-') -} diff --git a/src/router/modules/d2-crud-plus.js b/src/router/modules/d2-crud-plus.js new file mode 100644 index 00000000..c1f9ac0c --- /dev/null +++ b/src/router/modules/d2-crud-plus.js @@ -0,0 +1,21 @@ +import layoutHeaderAside from '@/layout/header-aside' + +// 由于懒加载页面太多的话会造成webpack热更新太慢,所以开发环境不使用懒加载,只有生产环境使用懒加载 +const _import = require('@/libs/util.import.' + process.env.NODE_ENV) + +const meta = { auth: true } + +export default { + path: '/demo/d2-crud-plus', + name: 'demo-d2-crud-plus', + meta, + redirect: { name: 'demo-d2-crud-plus-index' }, + component: layoutHeaderAside, + children: (pre => [ + { path: 'index', name: `${pre}index`, component: _import('demo/d2-crud-plus/index'), meta: { ...meta, title: 'D2 CRUD PLUS 首页' } }, + { path: 'demo', name: `${pre}demo`, component: _import('demo/d2-crud-plus/demo'), meta: { ...meta, title: '简单示例' } }, + { path: 'group', name: `${pre}group`, component: _import('demo/d2-crud-plus/group'), meta: { ...meta, title: '表单分组' } }, + { path: 'synthesize', name: `${pre}synthesize`, component: _import('demo/d2-crud-plus/synthesize'), meta: { ...meta, title: '综合示例' } } + + ])('demo-d2-crud-plus-') +} diff --git a/src/router/modules/frame.js b/src/router/modules/frame.js deleted file mode 100644 index 973dc050..00000000 --- a/src/router/modules/frame.js +++ /dev/null @@ -1,20 +0,0 @@ -import layoutHeaderAside from '@/layout/header-aside' - -// 由于懒加载页面太多的话会造成webpack热更新太慢,所以开发环境不使用懒加载,只有生产环境使用懒加载 -const _import = require('@/libs/util.import.' + process.env.NODE_ENV) - -const meta = { auth: true } - -export default { - path: '/demo/frame', - name: 'demo-frame', - meta, - redirect: { name: 'demo-frame-index' }, - component: layoutHeaderAside, - children: (pre => [ - { path: 'index', name: `${pre}index`, component: _import('demo/frame/index'), meta: { ...meta, title: 'Frame 首页' } }, - { path: 'html', name: `${pre}html`, component: _import('demo/frame/html'), meta: { ...meta, title: '静态 HTML' } }, - { path: 'report', name: `${pre}report`, component: _import('demo/frame/report'), meta: { ...meta, title: 'Size report' } }, - { path: 'd2-doc', name: `${pre}d2-doc`, component: _import('demo/frame/d2-doc'), meta: { ...meta, title: 'D2Admin 中文文档' } } - ])('demo-frame-') -} diff --git a/src/router/modules/playground.js b/src/router/modules/playground.js index c6451f04..de276e35 100644 --- a/src/router/modules/playground.js +++ b/src/router/modules/playground.js @@ -12,7 +12,7 @@ export default { redirect: { name: 'demo-playground-index' }, component: layoutHeaderAside, children: (pre => [ - { path: 'index', name: `${pre}index`, component: _import('demo/playground/index'), meta: { ...meta, title: '试验台首页' } }, + { path: 'index', name: `${pre}index`, component: _import('demo/playground/index'), meta: { ...meta, title: '功能首页' } }, { path: 'store/page', name: `${pre}store-page`, component: _import('demo/playground/store/page'), meta: { ...meta, cache: true, title: '多标签页控制' } }, { path: 'store/menu', name: `${pre}store-menu`, component: _import('demo/playground/store/menu'), meta: { ...meta, title: '菜单控制' } }, { path: 'store/size', name: `${pre}store-size`, component: _import('demo/playground/store/size'), meta: { ...meta, title: '全局尺寸' } }, @@ -39,6 +39,9 @@ export default { { path: 'log/log', name: `${pre}log-log`, component: _import('demo/playground/log/log'), meta: { ...meta, title: '日志记录' } }, { path: 'add-routes/routes', name: `${pre}add-routes-routes`, component: _import('demo/playground/add-routes/routes'), meta: { ...meta, title: '添加页面' } }, { path: 'env', name: `${pre}env`, component: _import('demo/playground/env'), meta: { ...meta, title: '环境信息' } }, - { path: 'locales', name: `${pre}locales`, component: _import('demo/playground/locales'), meta: { ...meta, title: '国际化' } } + { path: 'locales', name: `${pre}locales`, component: _import('demo/playground/locales'), meta: { ...meta, title: '国际化' } }, + { path: 'frame/html', name: `${pre}frame-html`, component: _import('demo/playground/frame/html'), meta: { ...meta, title: '静态 HTML' } }, + { path: 'frame/report', name: `${pre}frame-report`, component: _import('demo/playground/frame/report'), meta: { ...meta, title: 'Size report' } }, + { path: 'frame/d2-doc', name: `${pre}frame-d2-doc`, component: _import('demo/playground/frame/d2-doc'), meta: { ...meta, title: 'D2Admin 中文文档' } } ])('demo-playground-') } diff --git a/src/router/modules/plugins.js b/src/router/modules/plugins.js index 8bebc4a3..da635b9d 100644 --- a/src/router/modules/plugins.js +++ b/src/router/modules/plugins.js @@ -21,6 +21,50 @@ export default { { path: 'import/csv', name: `${pre}import-csv`, component: _import('demo/plugins/import/csv.vue'), meta: { ...meta, title: '导入 csv' } }, { path: 'import/xlsx', name: `${pre}import-xlsx`, component: _import('demo/plugins/import/xlsx.vue'), meta: { ...meta, title: '导入 xlsx' } }, { path: 'index', name: `${pre}index`, component: _import('demo/plugins/index'), meta: { ...meta, title: '插件首页' } }, - { path: 'js-cookie', name: `${pre}js-cookie`, component: _import('demo/plugins/js-cookie'), meta: { ...meta, title: 'Cookie' } } + { path: 'js-cookie', name: `${pre}js-cookie`, component: _import('demo/plugins/js-cookie'), meta: { ...meta, title: 'Cookie' } }, + { path: 'charts/line/demo1', name: `${pre}charts-line-demo1`, component: _import('demo/plugins/charts/line/demo1/index.vue'), meta: { ...meta, title: '折线图示例 1' } }, + { path: 'charts/line/demo2', name: `${pre}charts-line-demo2`, component: _import('demo/plugins/charts/line/demo2/index.vue'), meta: { ...meta, title: '折线图示例 2' } }, + { path: 'charts/line/demo3', name: `${pre}charts-line-demo3`, component: _import('demo/plugins/charts/line/demo3/index.vue'), meta: { ...meta, title: '折线图示例 3' } }, + { path: 'charts/line/demo4', name: `${pre}charts-line-demo4`, component: _import('demo/plugins/charts/line/demo4/index.vue'), meta: { ...meta, title: '折线图示例 4' } }, + { path: 'charts/line/demo5', name: `${pre}charts-line-demo5`, component: _import('demo/plugins/charts/line/demo5/index.vue'), meta: { ...meta, title: '折线图示例 5' } }, + { path: 'charts/histogram/demo1', name: `${pre}charts-histogram-demo1`, component: _import('demo/plugins/charts/histogram/demo1/index.vue'), meta: { ...meta, title: '柱状图示例 1' } }, + { path: 'charts/histogram/demo2', name: `${pre}charts-histogram-demo2`, component: _import('demo/plugins/charts/histogram/demo2/index.vue'), meta: { ...meta, title: '柱状图示例 2' } }, + { path: 'charts/histogram/demo3', name: `${pre}charts-histogram-demo3`, component: _import('demo/plugins/charts/histogram/demo3/index.vue'), meta: { ...meta, title: '柱状图示例 3' } }, + { path: 'charts/histogram/demo4', name: `${pre}charts-histogram-demo4`, component: _import('demo/plugins/charts/histogram/demo4/index.vue'), meta: { ...meta, title: '柱状图示例 4' } }, + { path: 'charts/histogram/demo5', name: `${pre}charts-histogram-demo5`, component: _import('demo/plugins/charts/histogram/demo5/index.vue'), meta: { ...meta, title: '柱状图示例 5' } }, + { path: 'charts/histogram/demo6', name: `${pre}charts-histogram-demo6`, component: _import('demo/plugins/charts/histogram/demo6/index.vue'), meta: { ...meta, title: '柱状图示例 6' } }, + { path: 'charts/bar/demo1', name: `${pre}charts-bar-demo1`, component: _import('demo/plugins/charts/bar/demo1/index.vue'), meta: { ...meta, title: '条形图示例 1' } }, + { path: 'charts/bar/demo2', name: `${pre}charts-bar-demo2`, component: _import('demo/plugins/charts/bar/demo2/index.vue'), meta: { ...meta, title: '条形图示例 2' } }, + { path: 'charts/bar/demo3', name: `${pre}charts-bar-demo3`, component: _import('demo/plugins/charts/bar/demo3/index.vue'), meta: { ...meta, title: '条形图示例 3' } }, + { path: 'charts/bar/demo4', name: `${pre}charts-bar-demo4`, component: _import('demo/plugins/charts/bar/demo4/index.vue'), meta: { ...meta, title: '条形图示例 4' } }, + { path: 'charts/bar/demo5', name: `${pre}charts-bar-demo5`, component: _import('demo/plugins/charts/bar/demo5/index.vue'), meta: { ...meta, title: '条形图示例 5' } }, + { path: 'charts/pie/demo1', name: `${pre}charts-pie-demo1`, component: _import('demo/plugins/charts/pie/demo1/index.vue'), meta: { ...meta, title: '饼图示例 1' } }, + { path: 'charts/pie/demo2', name: `${pre}charts-pie-demo2`, component: _import('demo/plugins/charts/pie/demo2/index.vue'), meta: { ...meta, title: '饼图示例 2' } }, + { path: 'charts/pie/demo3', name: `${pre}charts-pie-demo3`, component: _import('demo/plugins/charts/pie/demo3/index.vue'), meta: { ...meta, title: '饼图示例 3' } }, + { path: 'charts/pie/demo4', name: `${pre}charts-pie-demo4`, component: _import('demo/plugins/charts/pie/demo4/index.vue'), meta: { ...meta, title: '饼图示例 4' } }, + { path: 'charts/pie/demo5', name: `${pre}charts-pie-demo5`, component: _import('demo/plugins/charts/pie/demo5/index.vue'), meta: { ...meta, title: '饼图示例 5' } }, + { path: 'charts/pie/demo6', name: `${pre}charts-pie-demo6`, component: _import('demo/plugins/charts/pie/demo6/index.vue'), meta: { ...meta, title: '饼图示例 6' } }, + { path: 'charts/ring/demo1', name: `${pre}charts-ring-demo1`, component: _import('demo/plugins/charts/ring/demo1/index.vue'), meta: { ...meta, title: '环图示例 1' } }, + { path: 'charts/ring/demo2', name: `${pre}charts-ring-demo2`, component: _import('demo/plugins/charts/ring/demo2/index.vue'), meta: { ...meta, title: '环图示例 2' } }, + { path: 'charts/ring/demo3', name: `${pre}charts-ring-demo3`, component: _import('demo/plugins/charts/ring/demo3/index.vue'), meta: { ...meta, title: '环图示例 3' } }, + { path: 'charts/ring/demo4', name: `${pre}charts-ring-demo4`, component: _import('demo/plugins/charts/ring/demo4/index.vue'), meta: { ...meta, title: '环图示例 4' } }, + { path: 'charts/ring/demo5', name: `${pre}charts-ring-demo5`, component: _import('demo/plugins/charts/ring/demo5/index.vue'), meta: { ...meta, title: '环图示例 5' } }, + { path: 'charts/waterfall/demo1', name: `${pre}charts-waterfall-demo1`, component: _import('demo/plugins/charts/waterfall/demo1/index.vue'), meta: { ...meta, title: '瀑布图示例 1' } }, + { path: 'charts/funnel/demo1', name: `${pre}charts-funnel-demo1`, component: _import('demo/plugins/charts/funnel/demo1/index.vue'), meta: { ...meta, title: '漏斗图示例 1' } }, + { path: 'charts/funnel/demo2', name: `${pre}charts-funnel-demo2`, component: _import('demo/plugins/charts/funnel/demo2/index.vue'), meta: { ...meta, title: '漏斗图示例 2' } }, + { path: 'charts/radar/demo1', name: `${pre}charts-radar-demo1`, component: _import('demo/plugins/charts/radar/demo1/index.vue'), meta: { ...meta, title: '雷达图示例 1' } }, + { path: 'charts/map/demo1', name: `${pre}charts-map-demo1`, component: _import('demo/plugins/charts/map/demo1/index.vue'), meta: { ...meta, title: '地图示例 1' } }, + { path: 'charts/map/demo2', name: `${pre}charts-map-demo2`, component: _import('demo/plugins/charts/map/demo2/index.vue'), meta: { ...meta, title: '地图示例 2' } }, + { path: 'charts/map/demo3', name: `${pre}charts-map-demo3`, component: _import('demo/plugins/charts/map/demo3/index.vue'), meta: { ...meta, title: '地图示例 3' } }, + { path: 'charts/sankey/demo1', name: `${pre}charts-sankey-demo1`, component: _import('demo/plugins/charts/sankey/demo1/index.vue'), meta: { ...meta, title: '桑基图示例 1' } }, + { path: 'charts/heatmap/demo1', name: `${pre}charts-heatmap-demo1`, component: _import('demo/plugins/charts/heatmap/demo1/index.vue'), meta: { ...meta, title: '热力图示例 1' } }, + { path: 'charts/heatmap/demo2', name: `${pre}charts-heatmap-demo2`, component: _import('demo/plugins/charts/heatmap/demo2/index.vue'), meta: { ...meta, title: '热力图示例 2' } }, + { path: 'charts/scatter/demo1', name: `${pre}charts-scatter-demo1`, component: _import('demo/plugins/charts/scatter/demo1/index.vue'), meta: { ...meta, title: '散点图示例 1' } }, + { path: 'charts/scatter/demo2', name: `${pre}charts-scatter-demo2`, component: _import('demo/plugins/charts/scatter/demo2/index.vue'), meta: { ...meta, title: '散点图示例 2' } }, + { path: 'charts/candle/demo1', name: `${pre}charts-candle-demo1`, component: _import('demo/plugins/charts/candle/demo1/index.vue'), meta: { ...meta, title: 'K线图示例 1' } }, + { path: 'charts/candle/demo2', name: `${pre}charts-candle-demo2`, component: _import('demo/plugins/charts/candle/demo2/index.vue'), meta: { ...meta, title: 'K线图示例 2' } }, + { path: 'charts/candle/demo3', name: `${pre}charts-candle-demo3`, component: _import('demo/plugins/charts/candle/demo3/index.vue'), meta: { ...meta, title: 'K线图示例 3' } }, + { path: 'charts/gauge/demo1', name: `${pre}charts-gauge-demo1`, component: _import('demo/plugins/charts/gauge/demo1/index.vue'), meta: { ...meta, title: '仪表盘示例 1' } }, + { path: 'charts/tree/demo1', name: `${pre}charts-tree-demo1`, component: _import('demo/plugins/charts/tree/demo1/index.vue'), meta: { ...meta, title: '树图示例 1' } } ])('demo-plugins-') } diff --git a/src/router/routes.js b/src/router/routes.js index 9e57ad35..e5df54fb 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -1,10 +1,8 @@ import playground from './modules/playground' -import frame from './modules/frame' import d2Crud from './modules/d2-crud' +import d2CrudPlus from './modules/d2-crud-plus' import plugins from './modules/plugins' -import charts from './modules/charts' import components from './modules/components' -import business from './modules/business' import layoutHeaderAside from '@/layout/header-aside' @@ -57,12 +55,10 @@ const frameIn = [ ] }, playground, - frame, d2Crud, + d2CrudPlus, plugins, - charts, - components, - business + components ] /** diff --git a/src/views/demo/business/index/index.vue b/src/views/demo/business/index/index.vue deleted file mode 100644 index e3bd2950..00000000 --- a/src/views/demo/business/index/index.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/src/views/demo/business/issues/142/edit-cache-db.vue b/src/views/demo/business/issues/142/edit-cache-db.vue deleted file mode 100644 index 845ed449..00000000 --- a/src/views/demo/business/issues/142/edit-cache-db.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - - - diff --git a/src/views/demo/business/issues/142/edit.vue b/src/views/demo/business/issues/142/edit.vue deleted file mode 100644 index 184e6e30..00000000 --- a/src/views/demo/business/issues/142/edit.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - - diff --git a/src/views/demo/business/issues/142/index.vue b/src/views/demo/business/issues/142/index.vue deleted file mode 100644 index 27fb86e2..00000000 --- a/src/views/demo/business/issues/142/index.vue +++ /dev/null @@ -1,72 +0,0 @@ - - - diff --git a/src/views/demo/business/issues/142/mixins/index.js b/src/views/demo/business/issues/142/mixins/index.js deleted file mode 100644 index 91505e12..00000000 --- a/src/views/demo/business/issues/142/mixins/index.js +++ /dev/null @@ -1,47 +0,0 @@ -export default { - props: { - id: { - type: String, - required: true - } - }, - data () { - return { - form: { - name: '', - address: '' - } - } - }, - methods: { - // [业务逻辑] 重置表单 - resetFormData () { - this.form = { - name: '', - address: '' - } - }, - // [业务逻辑] 根据 id 获取数据 - async getFormData (id) { - // 重置表单 - this.resetFormData() - // 请求数据 - try { - const res = await this.$api.DEMO_BUSINESS_ISSUE_142_DETAIL(id) - const { name, address } = res - this.form = { name, address } - this.$message.success('getFormData') - } catch (error) { - console.log('error', error) - } - }, - // [业务逻辑] 提交 - handleSubmit () { - this.$notify({ - title: 'Submit', - message: '提交了表单', - type: 'info' - }) - } - } -} diff --git a/src/views/demo/business/table/1/componnets/BooleanControl/index.vue b/src/views/demo/business/table/1/componnets/BooleanControl/index.vue deleted file mode 100644 index 91856e9a..00000000 --- a/src/views/demo/business/table/1/componnets/BooleanControl/index.vue +++ /dev/null @@ -1,85 +0,0 @@ - - - diff --git a/src/views/demo/business/table/1/componnets/BooleanControlMini/index.vue b/src/views/demo/business/table/1/componnets/BooleanControlMini/index.vue deleted file mode 100644 index 9bfebbe2..00000000 --- a/src/views/demo/business/table/1/componnets/BooleanControlMini/index.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - diff --git a/src/views/demo/business/table/1/componnets/PageFooter/index.vue b/src/views/demo/business/table/1/componnets/PageFooter/index.vue deleted file mode 100644 index 31ac9067..00000000 --- a/src/views/demo/business/table/1/componnets/PageFooter/index.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - diff --git a/src/views/demo/business/table/1/componnets/PageHeader/index.vue b/src/views/demo/business/table/1/componnets/PageHeader/index.vue deleted file mode 100644 index 6cfb1662..00000000 --- a/src/views/demo/business/table/1/componnets/PageHeader/index.vue +++ /dev/null @@ -1,99 +0,0 @@ - - - diff --git a/src/views/demo/business/table/1/componnets/PageMain/index.vue b/src/views/demo/business/table/1/componnets/PageMain/index.vue deleted file mode 100644 index d4bbd40e..00000000 --- a/src/views/demo/business/table/1/componnets/PageMain/index.vue +++ /dev/null @@ -1,230 +0,0 @@ - - - diff --git a/src/views/demo/business/table/1/index.vue b/src/views/demo/business/table/1/index.vue deleted file mode 100644 index 4bac8514..00000000 --- a/src/views/demo/business/table/1/index.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - diff --git a/src/views/demo/charts/index/index.vue b/src/views/demo/charts/index/index.vue deleted file mode 100644 index 6bc821b5..00000000 --- a/src/views/demo/charts/index/index.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/src/views/demo/d2-crud-plus/demo/api.js b/src/views/demo/d2-crud-plus/demo/api.js new file mode 100644 index 00000000..2007f17d --- /dev/null +++ b/src/views/demo/d2-crud-plus/demo/api.js @@ -0,0 +1,36 @@ +// 请求真实后端 +// import { request } from '@/api/service' + +// 请求模拟数据 +import { requestForMock } from '@/api/service' + +export function GetList (query) { + return requestForMock({ + url: '/d2crudplus/test/page', + method: 'get', + data: query + }) +} + +export function AddObj (obj) { + return requestForMock({ + url: '/d2crudplus/test/add', + method: 'post', + data: obj + }) +} + +export function UpdateObj (obj) { + return requestForMock({ + url: '/d2crudplus/test/update', + method: 'post', + data: obj + }) +} +export function DelObj (id) { + return requestForMock({ + url: '/d2crudplus/test/delete', + method: 'post', + data: { id } + }) +} diff --git a/src/views/demo/d2-crud-plus/demo/crud.js b/src/views/demo/d2-crud-plus/demo/crud.js new file mode 100644 index 00000000..28db5fec --- /dev/null +++ b/src/views/demo/d2-crud-plus/demo/crud.js @@ -0,0 +1,51 @@ +export const crudOptions = (vm) => { + return { + viewOptions: { + componentType: 'row' // 查看对话框字段使用行组件 + }, + columns: [ + { + title: 'ID', + key: 'id', + width: 90, + form: { + disabled: true + } + }, + { + title: '日期', + key: 'date', + type: 'date' + }, + { + title: '状态', + key: 'status', + sortable: true, + search: { disabled: false }, + type: 'select', + dict: { + url: '/d2crudplus/dicts/OpenStatusEnum' + } + }, + { + title: '地区', + key: 'address', + sortable: true, + width: 180, + search: { disabled: false }, + type: 'select', + form: { + component: { + props: { + multiple: true // 多选 + } + } + }, + dict: { + data: [{ value: 'sz', label: '深圳' }, { value: 'gz', label: '广州' }, { value: 'wh', label: '武汉' }, { value: 'sh', label: '上海' }] + }, + component: { props: { color: 'auto' } } // 自动染色 + } + ] + } +} diff --git a/src/views/demo/d2-crud-plus/demo/index.vue b/src/views/demo/d2-crud-plus/demo/index.vue new file mode 100644 index 00000000..8e045446 --- /dev/null +++ b/src/views/demo/d2-crud-plus/demo/index.vue @@ -0,0 +1,57 @@ + + + diff --git a/src/views/demo/d2-crud-plus/demo/mock.js b/src/views/demo/d2-crud-plus/demo/mock.js new file mode 100644 index 00000000..784266be --- /dev/null +++ b/src/views/demo/d2-crud-plus/demo/mock.js @@ -0,0 +1,49 @@ +import mockUtil from '../mock/base' +const options = { + name: 'd2crudplus/test', + idGenerator: 0 +} +const list = [ + { + date: '2016-05-02', + status: '0', + address: 'sz' + }, + { + date: '2016-05-04', + status: '1', + address: 'sh,sz' + }, + { + date: 2232433534511, + status: '1', + address: 'gz' + }, + { + date: '2016-05-03', + status: '2', + address: 'wh,gz' + } +] +const openStatus = [ + { value: '1', label: '打开', color: 'success' }, + { value: '2', label: '停止', color: 'info' }, + { value: '0', label: '关闭', color: 'danger' } +] + +options.list = list +const mock = mockUtil.buildMock(options) +mock.push( + { + path: '/d2crudplus/dicts/OpenStatusEnum', + method: 'get', + handle ({ body }) { + return { + code: 0, + msg: 'success', + data: openStatus + } + } + } +) +export default mock diff --git a/src/views/demo/d2-crud-plus/group/api.js b/src/views/demo/d2-crud-plus/group/api.js new file mode 100644 index 00000000..6229116b --- /dev/null +++ b/src/views/demo/d2-crud-plus/group/api.js @@ -0,0 +1,36 @@ +// 请求真实后端 +// import { request } from '@/api/service' + +// 请求模拟数据 +import { requestForMock } from '@/api/service' + +export function GetList (query) { + return requestForMock({ + url: '/d2crudplus/group/page', + method: 'get', + data: query + }) +} + +export function AddObj (obj) { + return requestForMock({ + url: '/d2crudplus/group/add', + method: 'post', + data: obj + }) +} + +export function UpdateObj (obj) { + return requestForMock({ + url: '/d2crudplus/group/update', + method: 'post', + data: obj + }) +} +export function DelObj (id) { + return requestForMock({ + url: '/d2crudplus/group/delete', + method: 'post', + data: { id } + }) +} diff --git a/src/views/demo/d2-crud-plus/group/crud.js b/src/views/demo/d2-crud-plus/group/crud.js new file mode 100644 index 00000000..d6ac8352 --- /dev/null +++ b/src/views/demo/d2-crud-plus/group/crud.js @@ -0,0 +1,121 @@ +export const crudOptions = { + options: { + height: '100%' // 表格高度100%, 使用toolbar必须设置 + }, + viewOptions: { + disabled: false + }, + rowHandle: { + }, + columns: [ + { + title: 'ID', + key: 'id', + width: 90, + form: { + disabled: true + } + }, + { + title: '商品标题', + key: 'title', + sortable: true + }, + { + title: '商品代码', + key: 'code', + search: { disabled: false }, + sortable: true + }, + { + title: '图片', + key: 'images', + sortable: true, + type: 'image-uploader', + form: { + component: { + span: 24 + } + } + }, + { + title: '价格', + key: 'price', + sortable: true + }, + { + title: '库存', + key: 'store', + sortable: true, + type: 'number' + }, + { + title: '简介', + key: 'intro', + sortable: true, + type: 'text-area' + }, + { + title: '详情', + key: 'content', + sortable: true, + type: 'editor-quill', + disabled: true + }, + { + title: '自定义', + key: 'custom', + sortable: true, + form: { + component: { + span: 24 + }, + slot: true + } + }, + { + title: '自定义2', + key: 'custom2', + sortable: true, + form: { + component: { + span: 24 + }, + slot: true + } + } + ], + formGroup: { + type: 'collapse', // tab + accordion: false, + groups: { + base: { + title: '商品基础', + icon: 'el-icon-goods', + columns: ['title', 'code', 'images'] + }, + price: { + title: '库存价格', + icon: 'el-icon-price-tag', + columns: ['store', 'price'] + }, + info: { + title: '详情', + collapsed: false, + icon: 'el-icon-warning-outline', + columns: ['intro', 'content'] + }, + custom: { + title: '自定义', + collapsed: true, + show (context) { + console.log('custom context', context) + return context.mode === 'view' + }, + disabled: false, + icon: 'el-icon-warning-outline', + columns: ['custom', 'custom2'] + } + } + } +} diff --git a/src/views/demo/d2-crud-plus/group/index.vue b/src/views/demo/d2-crud-plus/group/index.vue new file mode 100644 index 00000000..3540ef79 --- /dev/null +++ b/src/views/demo/d2-crud-plus/group/index.vue @@ -0,0 +1,61 @@ + + + + diff --git a/src/views/demo/d2-crud-plus/group/mock.js b/src/views/demo/d2-crud-plus/group/mock.js new file mode 100644 index 00000000..dcbd01ab --- /dev/null +++ b/src/views/demo/d2-crud-plus/group/mock.js @@ -0,0 +1,20 @@ +import mockUtil from '../mock/base' + +const options = { + name: 'd2crudplus/group', + idGenerator: 0 +} +const list = [ + { + title: '无线充电宝', + code: '100001', + images: 'https://img0.bdstatic.com/static/searchdetail/img/logo-2X_0c4ef02.png', + price: 100, + stock: 99, + intro: '30000毫安超大容量移动电源充电宝官方原装正品专用便携', + content: '' + } +] +options.list = list +const mock = mockUtil.buildMock(options) +export default mock diff --git a/src/views/demo/d2-crud-plus/index/code.js b/src/views/demo/d2-crud-plus/index/code.js new file mode 100644 index 00000000..5e0cd216 --- /dev/null +++ b/src/views/demo/d2-crud-plus/index/code.js @@ -0,0 +1,31 @@ +export default `columns: [ + { + title: '日期', //字段名称 + key: 'date', //字段key + type: 'date', //字段类型,添加、修改、查询将自动生成相应表单组件 + }, + { + title: '状态', + key: 'status', + type: 'select', //选择框,默认单选 + dict: { url: '/dicts/OpenStatusEnum' }//远程数据字典 + }, + { + title: '地区', + key: 'address', + type: 'select', //选择框 + form: { //表单组件自定义配置 + component: { //支持任何v-model组件 + props: { multiple: true } // 此处配置选择框为多选 + } + }, + dict: { + data: [ //本地数据字典 + { value: 'sz', label: '深圳' }, + { value: 'gz', label: '广州' }, + { value: 'wh', label: '武汉' }, + { value: 'sh', label: '上海' } + ] + } + } +]` diff --git a/src/views/demo/d2-crud-plus/index/image/gif.webp b/src/views/demo/d2-crud-plus/index/image/gif.webp new file mode 100644 index 00000000..f61b760a Binary files /dev/null and b/src/views/demo/d2-crud-plus/index/image/gif.webp differ diff --git a/src/views/demo/d2-crud-plus/index/index.vue b/src/views/demo/d2-crud-plus/index/index.vue new file mode 100644 index 00000000..01242bb8 --- /dev/null +++ b/src/views/demo/d2-crud-plus/index/index.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/views/demo/d2-crud-plus/install.js b/src/views/demo/d2-crud-plus/install.js new file mode 100644 index 00000000..93b07536 --- /dev/null +++ b/src/views/demo/d2-crud-plus/install.js @@ -0,0 +1,90 @@ +import Vue from 'vue' +import d2CrudX from 'd2-crud-x' +import { d2CrudPlus } from 'd2-crud-plus' +import { D2pAreaSelector, D2pFileUploader, D2pIconSelector, D2pTreeSelector, D2pFullEditor, D2pUploader, D2pDemoExtend } from 'd2p-extends' // 源码方式引入,上传组件支持懒加载 +// http请求 +import { requestForMock } from '@/api/service' +import './mock' // 模拟数据 + +// 按如下重命名引入可与官方版共存,index.vue中标签用使用加强版 +// 不传name,则d2CrudX的标签仍为,不可与官方版共存 +Vue.use(d2CrudX, { name: 'd2-crud-x' }) + +// 引入d2CrudPlus +Vue.use(d2CrudPlus, { + starTip: false, + getRemoteDictFunc (url, dict) { + // 此处配置你的字典http请求方法 + // 实际使用请改成request + return requestForMock({ + url: url, + data: dict.body, + method: 'get' + }) + }, + commonOption () { // 公共配置 + return { + format: { + response (res) { + return res + }, + page: { // page接口返回的数据结构配置, + request: { + current: 'current', + size: 'size' + }, + response: { + current: 'current', // 当前页码 ret.data.current + size: 'size', // 当前页码 ret.data.current + // size: (data) => { return data.size }, // 每页条数,ret.data.size, 你也可以配置一个方法,自定义返回 + total: 'total', // 总记录数 ret.data.total + records: 'records' // 列表数组 ret.data.records + } + } + }, + pageOptions: { + compact: true // 紧凑型页面模式 + }, + options: { + size: 'small', + height: '100%' // 表格高度100% + }, + formOptions: { + nullToBlankStr: true, // 提交修改表单时,将undefinded的数据修改为空字符串'',可以解决无法清空字段的问题 + defaultSpan: 12 // 默认的表单 span + }, + viewOptions: { + disabled: false, + componentType: 'form' // 【form,row】 表单组件 或 行组件展示 + }, + rowHandle: { + width: 260, + edit: { + type: 'primary' + } + } + } + } +}) + +// 安装扩展插件 +Vue.use(D2pTreeSelector) +Vue.use(D2pAreaSelector) +Vue.use(D2pIconSelector) +Vue.use(D2pFullEditor, { + ueditor: { + serverUrl: '/api/ueditor/' + } +}) +Vue.use(D2pDemoExtend) +Vue.use(D2pFileUploader) +Vue.use(D2pUploader, { + defaultType: 'form', + form: { + action: 'http://d2p.veryreader.com:7070/api/upload/form/upload', + name: 'file', + successHandle (res) { // 上传成功后,后台返回结果处理 + return { url: 'http://d2p.veryreader.com:7070' + res.data } // data是该文件的url + } + } +}) diff --git a/src/views/demo/d2-crud-plus/mock/base.js b/src/views/demo/d2-crud-plus/mock/base.js new file mode 100644 index 00000000..3327bc1e --- /dev/null +++ b/src/views/demo/d2-crud-plus/mock/base.js @@ -0,0 +1,234 @@ +function copyList (originList, newList, options, parentId) { + for (const item of originList) { + const newItem = { ...item, parentId } + newItem.id = ++options.idGenerator + newList.push(newItem) + if (item.children != null) { + newItem.children = [] + copyList(item.children, newItem.children, options, newItem.id) + } + } +} + +function delById (req, list) { + for (let i = 0; i < list.length; i++) { + const item = list[i] + if ((item.id) === parseInt(req.params.id)) { + console.log('remove i') + list.splice(i, 1) + break + } + if (item.children != null && item.children.length > 0) { + delById(req, item.children) + } + } +} +export default { + findById (id, list) { + for (const item of list) { + if (item.id === id) { + return item + } + if (item.children != null && item.children.length > 0) { + const sub = this.findById(id, item.children) + if (sub != null) { + return sub + } + } + } + }, + buildMock (options) { + const name = options.name + if (options.copyTimes == null) { + options.copyTimes = 29 + } + const list = [] + for (let i = 0; i < options.copyTimes; i++) { + copyList(options.list, list, options) + } + options.list = list + return [ + { + path: '/' + name + '/page', + method: 'get', + handle (req) { + let data = list + let size = 20 + let current = 1 + for (const item of list) { + if (item.children != null && item.children.length === 0) { + item.hasChildren = false + item.lazy = false + } + } + if (req != null && req.body != null) { + if (req.body.size != null) { + size = parseInt(req.body.size) + } + if (req.body.current != null) { + current = parseInt(req.body.current) + } + const query = { ...req.body } + delete query.current + delete query.size + if (Object.keys(query).length > 0) { + data = list.filter(item => { + let allFound = true // 是否所有条件都符合 + for (const key in query) { + // 判定某一个条件 + const value = query[key] + if (value == null || value === '') { + continue + } + if (value instanceof Array) { + // 如果条件中的value是数组的话,只要查到一个就行 + if (value.length === 0) { + continue + } + let found = false + for (const i of value) { + if (item[key] instanceof Array) { + for (const j of item[key]) { + if (i === j) { + found = true + break + } + } + if (found) { + break + } + } else if (item[key] === i || ((typeof item[key]) === 'string' && item[key].indexOf(i + '') >= 0)) { + found = true + break + } + if (found) { + break + } + } + if (!found) { + allFound = false + } + } else if (value instanceof Object) { + for (const key2 in value) { + const v = value[key2] + if (v && v !== item[key][key2]) { + return false + } + } + } else if (item[key] !== value) { + allFound = false + } + } + return allFound + }) + } + } + + const start = size * (current - 1) + let end = size * current + if (data.length < end) { + end = data.length + } + const records = data.slice(start, end) + const maxPage = data.length % size === 0 ? data.length / size : Math.floor(data.length / size) + 1 + if (current > maxPage) { + current = maxPage + } + if (current < 1) { + current = 1 + } + return { + code: 0, + msg: 'success', + data: { + records: records, + total: data.length, + size: size, + current: current + } + } + } + }, + { + path: '/' + name + '/get', + method: 'get', + handle (req) { + let id = req.params.id + id = parseInt(id) + let current = null + for (const item of list) { + if (item.id === id) { + current = item + break + } + } + return { + code: 0, + msg: 'success', + data: current + } + } + }, + { + path: '/' + name + '/add', + method: 'post', + handle (req) { + req.body.id = ++options.idGenerator + list.unshift(req.body) + return { + code: 0, + msg: 'success', + data: null + } + } + }, + { + path: '/' + name + '/update', + method: 'post', + handle (req) { + for (const item of list) { + if (item.id === req.body.id) { + Object.assign(item, req.body) + break + } + } + return { + code: 0, + msg: 'success', + data: null + } + } + }, + { + path: '/' + name + '/delete', + method: 'post', + handle (req) { + delById(req, list) + return { + code: 0, + msg: 'success', + data: null + } + } + }, + { + path: '/' + name + '/batchDelete', + method: 'post', + handle (req) { + const ids = req.body.ids + for (let i = list.length - 1; i >= 0; i--) { + const item = list[i] + if (ids.indexOf(item.id) >= 0) { + list.splice(i, 1) + } + } + return { + code: 0, + msg: 'success', + data: null + } + } + } + ] + } +} diff --git a/src/views/demo/d2-crud-plus/mock/index.js b/src/views/demo/d2-crud-plus/mock/index.js new file mode 100644 index 00000000..d088f5ab --- /dev/null +++ b/src/views/demo/d2-crud-plus/mock/index.js @@ -0,0 +1,44 @@ +import { mock } from '@/api/service' +import * as tools from '@/api/tools' + +const req = context => context.keys().map(context) + +// 模拟数据 +const apiList = req(require.context('../', true, /mock\.js$/)) + .filter(e => e.default) + .map(e => e.default) + +apiList.forEach(apiFile => { + for (const item of apiFile) { + mock + .onAny(new RegExp('^/api' + item.path)) + .reply(config => { + console.log('------------fake request start -------------') + console.log('request:', config) + const data = config.data ? JSON.parse(config.data) : {} + const query = config.url.indexOf('?') >= 0 ? config.url.substring(config.url.indexOf('?') + 1) : undefined + let params = {} + if (query) { + const arr = query.split('&') + for (const item of arr) { + const kv = item.split('=') + params[kv[0]] = kv[1] + } + } else { + params = data + } + const req = { + body: data, + params: params + } + const ret = item.handle(req) + console.log('response:', ret) + console.log('------------fake request end-------------') + if (ret.code === 0) { + return tools.responseSuccess(ret.data, ret.msg) + } else { + return tools.responseError(ret.data, ret.msg, ret.code) + } + }) + } +}) diff --git a/src/views/demo/d2-crud-plus/synthesize/api.js b/src/views/demo/d2-crud-plus/synthesize/api.js new file mode 100644 index 00000000..4719ae98 --- /dev/null +++ b/src/views/demo/d2-crud-plus/synthesize/api.js @@ -0,0 +1,40 @@ +// 请求模拟数据 +import { requestForMock } from '@/api/service' + +export function GetList (query) { + return requestForMock({ + url: '/d2-crud-plus/synthesize/page', + method: 'get', + data: query + }) +} + +export function AddObj (obj) { + return requestForMock({ + url: '/d2-crud-plus/synthesize/add', + method: 'post', + data: obj + }) +} + +export function UpdateObj (obj) { + return requestForMock({ + url: '/d2-crud-plus/synthesize/update', + method: 'post', + data: obj + }) +} +export function DelObj (id) { + return requestForMock({ + url: '/d2-crud-plus/synthesize/delete', + method: 'post', + data: { id } + }) +} +export function BatchDel (ids) { + return requestForMock({ + url: '/d2-crud-plus/synthesize/batchDelete', + method: 'post', + data: { ids } + }) +} diff --git a/src/views/demo/d2-crud-plus/synthesize/crud.js b/src/views/demo/d2-crud-plus/synthesize/crud.js new file mode 100644 index 00000000..dc5adc64 --- /dev/null +++ b/src/views/demo/d2-crud-plus/synthesize/crud.js @@ -0,0 +1,129 @@ +// 请求模拟数据 +import { requestForMock } from '@/api/service' + +export const crudOptions = { + rowHandle: { + // columnHeader: '操作', + width: 370, + custom: [ + { + text: ' 自定义', + type: 'warning', + size: 'small', + emit: 'customHandleBtn', + icon: 'el-icon-s-flag' + } + ], + fixed: 'right' + }, + pageOptions: { + compact: true // 是否紧凑型页面 + }, + options: { + height: '100%', // 表格高度100%, 使用toolbar必须设置 + highlightCurrentRow: true, + rowKey: 'id', + lazy: true, + load: (tree, treeNode, resolve) => { + requestForMock({ + url: '/d2crudplus/synthesize/children', + method: 'get', + data: { id: tree.id } + }).then(ret => { + console.log('懒加载数据', ret) + resolve(ret) + }) + }, + showSummary: true, + summaryMethod (param) { + const { columns, data } = param + const sums = [] + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '总价' + return + } + console.log('111', column) + if (column.label !== '金额(元)') { + return + } + const values = data.map(item => Number(item[column.property])) + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + return prev + curr + } else { + return prev + } + }, 0) + sums[index] += ' 元' + } else { + sums[index] = '' + } + }) + + return sums + } + }, + indexRow: { // 或者直接传true,不显示title,不居中 + title: '序号', + align: 'center' + }, + selectionRow: { + align: 'center', + width: 100 + }, + expandRow: { // 或者直接传true,不显示title,不居中 + title: '展开', + align: 'center' + }, + columns: [ + { + title: '数据列', + key: 'data', + sortable: true, + width: 200 + }, + { + title: 'ID', + key: 'id', + width: 90, + form: { + disabled: true + } + }, + { + title: '时间', + key: 'time', + type: 'datetime', + sortable: true, + width: 160 + }, + { + title: '地区', + key: 'province', + sortable: true, + search: { key: 'province', disabled: false }, + type: 'select', + form: { + component: { props: { filterable: true, multiple: true, clearable: true } } + }, + dict: { + data: [ + { value: 'sz', label: '深圳' }, + { value: 'gz', label: '广州' }, + { value: 'wh', label: '武汉' }, + { value: 'sh', label: '上海' } + ] + }, + width: 300 + }, + { + title: '金额(元)', + key: 'amount', + sortable: true, + type: 'number' + } + ] +} diff --git a/src/views/demo/d2-crud-plus/synthesize/helper.js b/src/views/demo/d2-crud-plus/synthesize/helper.js new file mode 100644 index 00000000..b5e8bb0b --- /dev/null +++ b/src/views/demo/d2-crud-plus/synthesize/helper.js @@ -0,0 +1,8 @@ +export default { + init: ` + `, + crud: ` +`, + template: ` + ` +} diff --git a/src/views/demo/d2-crud-plus/synthesize/index.vue b/src/views/demo/d2-crud-plus/synthesize/index.vue new file mode 100644 index 00000000..cd2ef9b1 --- /dev/null +++ b/src/views/demo/d2-crud-plus/synthesize/index.vue @@ -0,0 +1,104 @@ + + + diff --git a/src/views/demo/d2-crud-plus/synthesize/mock.js b/src/views/demo/d2-crud-plus/synthesize/mock.js new file mode 100644 index 00000000..d3461f27 --- /dev/null +++ b/src/views/demo/d2-crud-plus/synthesize/mock.js @@ -0,0 +1,101 @@ +import mockUtil from '../mock/base' + +const options = { + name: 'd2-crud-plus/synthesize', + idGenerator: 0 +} +const list = [ + { + data: '我会懒加载', + time: '2020-01-01 11:11:11', + province: 'wh', + amount: 100, + hasChildren: true, + loaded: false, + children: [ + { + data: '懒加载的子数据', + province: ['sh', 'gz'], + time: '2020-01-01 11:11:11', + amount: 100 + }, + { + data: '懒加载的子数据2', + province: ['sh', 'sz'], + time: '2020-01-01 11:11:11', + amount: 100 + } + ] + }, + { + data: 'data2', + province: 'sh', + time: '2020-01-01 11:11:11', + amount: 100, + children: [ + { + id: 999, + data: 'data1_1', + time: '2020-01-01 11:11:11', + province: ['gz', 'sz'], // 可以逗号分隔的字符串 'gz,sz' + amount: 100, + children: [ + { + id: 1000, + data: 'data1_1_1', + time: '2020-01-01 11:11:11', + province: ['sz', 'gz'], // 可以逗号分隔的字符串 'gz,sz' + amount: 100 + } + ] + }, + { + id: 888, + data: 'data1_2', + time: '2020-01-01 11:11:11', + province: 'sh', + amount: 100, + children: [ + { + id: 889, + data: 'data1_2_1', + time: '2020-01-01 11:11:11', + province: 'gz', + amount: 100 + } + ] + } + ] + }, + { + data: 'data3', + province: ['sh', 'gz'], + time: '2020-01-01 11:11:11', + amount: 100 + }, + { + data: 'data4', + province: ['sh', 'sz'], + time: '2020-01-01 11:11:11', + amount: 100 + } +] +options.list = list +const mock = mockUtil.buildMock(options) + +mock.push({ + path: '/d2crudplus/synthesize/children', + method: 'get', + handle (req) { + console.log('req', req) + const id = parseInt(req.params.id) + const item = mockUtil.findById(id, options.list) + console.log('children:', item.children) + return { + code: 0, + msg: 'success', + data: item.children + } + } +}) +export default mock diff --git a/src/views/demo/element/index.vue b/src/views/demo/element/index.vue deleted file mode 100644 index a01577ee..00000000 --- a/src/views/demo/element/index.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/src/views/demo/frame/index/index.vue b/src/views/demo/frame/index/index.vue deleted file mode 100644 index 2d2c4ef4..00000000 --- a/src/views/demo/frame/index/index.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/src/views/demo/frame/d2-doc/index.vue b/src/views/demo/playground/frame/d2-doc/index.vue similarity index 100% rename from src/views/demo/frame/d2-doc/index.vue rename to src/views/demo/playground/frame/d2-doc/index.vue diff --git a/src/views/demo/frame/html/index.vue b/src/views/demo/playground/frame/html/index.vue similarity index 100% rename from src/views/demo/frame/html/index.vue rename to src/views/demo/playground/frame/html/index.vue diff --git a/src/views/demo/frame/report/index.vue b/src/views/demo/playground/frame/report/index.vue similarity index 100% rename from src/views/demo/frame/report/index.vue rename to src/views/demo/playground/frame/report/index.vue diff --git a/src/views/demo/charts/list/_data/beijing.json b/src/views/demo/plugins/charts/_data/beijing.json similarity index 100% rename from src/views/demo/charts/list/_data/beijing.json rename to src/views/demo/plugins/charts/_data/beijing.json diff --git a/src/views/demo/charts/list/_data/china.json b/src/views/demo/plugins/charts/_data/china.json similarity index 100% rename from src/views/demo/charts/list/_data/china.json rename to src/views/demo/plugins/charts/_data/china.json diff --git a/src/views/demo/charts/list/_mixin/list.js b/src/views/demo/plugins/charts/_mixin/list.js similarity index 100% rename from src/views/demo/charts/list/_mixin/list.js rename to src/views/demo/plugins/charts/_mixin/list.js diff --git a/src/views/demo/charts/list/bar/demo1/index.vue b/src/views/demo/plugins/charts/bar/demo1/index.vue similarity index 95% rename from src/views/demo/charts/list/bar/demo1/index.vue rename to src/views/demo/plugins/charts/bar/demo1/index.vue index dc119fd7..68302d80 100644 --- a/src/views/demo/charts/list/bar/demo1/index.vue +++ b/src/views/demo/plugins/charts/bar/demo1/index.vue @@ -12,7 +12,7 @@