From d9d3291fb1f32d34359ea1dccdad23ed7364c534 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E9=98=94?= Date: Wed, 20 Nov 2024 08:34:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=95=8C=E9=9D=A2=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E6=96=B0=E5=A2=9E=E9=83=A8=E5=88=86=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C20241120=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.dev | 2 +- .env.pro | 4 +- mock/_createProductionServer.ts | 18 - mock/analysis/index.ts | 89 -- mock/department/index.ts | 205 --- mock/dict/index.ts | 63 - mock/menu/index.ts | 265 ---- mock/request/index.ts | 64 - mock/role/index.ts | 1180 ----------------- mock/table/index.ts | 256 ---- mock/user/index.ts | 135 -- mock/workplace/index.ts | 172 --- .../components/ProcedureConfig.vue | 12 +- src/views/IndexProcess/SqlRule/SqlRule.vue | 9 +- src/views/dataset/CodeRepItem/CodeRepItem.vue | 10 +- .../dataset/CodeRepTarget/CodeRepTarget.vue | 13 +- .../CodeRepTarget/components/Write.vue | 2 +- .../dataset/IndexClassMs/IndexClassMs.vue | 2 +- .../IndexSearchServiceMs.vue | 25 +- src/views/dataset/RepIndexSet/RepIndexSet.vue | 3 +- .../dataset/RepIndexSet/components/Write.vue | 22 +- src/views/dataset/RepSetRule/RepSetRule.vue | 3 +- .../RepStoreMapping/RepStoreMapping.vue | 4 +- .../RepStoreParameter/RepStoreParameter.vue | 2 +- .../reporting/RepTemplate/RepTemplate.vue | 5 - .../RepVariableManagement.vue | 5 - vite.config.ts | 11 +- 27 files changed, 75 insertions(+), 2506 deletions(-) delete mode 100644 mock/_createProductionServer.ts delete mode 100644 mock/analysis/index.ts delete mode 100644 mock/department/index.ts delete mode 100644 mock/dict/index.ts delete mode 100644 mock/menu/index.ts delete mode 100644 mock/request/index.ts delete mode 100644 mock/role/index.ts delete mode 100644 mock/table/index.ts delete mode 100644 mock/user/index.ts delete mode 100644 mock/workplace/index.ts diff --git a/.env.dev b/.env.dev index 95ca5c1..38158ab 100644 --- a/.env.dev +++ b/.env.dev @@ -2,7 +2,7 @@ NODE_ENV=production # 接口前缀-用于2.0系统尝试1 -VITE_API_BASE_PATH=dev +VITE_API_BASE_PATH=pro # 打包路径 VITE_BASE_PATH=./ diff --git a/.env.pro b/.env.pro index b1db8b6..54e605e 100644 --- a/.env.pro +++ b/.env.pro @@ -5,7 +5,7 @@ NODE_ENV=production VITE_API_BASE_PATH=pro # 打包路径 -VITE_BASE_PATH=./ +VITE_BASE_PATH=/index1 # 是否删除debugger VITE_DROP_DEBUGGER=true @@ -20,7 +20,7 @@ VITE_SOURCEMAP=false VITE_OUT_DIR=dist-pro # 标题 -VITE_APP_TITLE=东方国信 +VITE_APP_TITLE=指标管理 # 是否使用在线图标 VITE_USE_ONLINE_ICON=false diff --git a/mock/_createProductionServer.ts b/mock/_createProductionServer.ts deleted file mode 100644 index caa26bf..0000000 --- a/mock/_createProductionServer.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer' - -const modules = import.meta.glob('./**/*.ts', { - import: 'default', - eager: true -}) - -const mockModules: any[] = [] -Object.keys(modules).forEach(async (key) => { - if (key.includes('_')) { - return - } - mockModules.push(...(modules[key] as any)) -}) - -export function setupProdMockServer() { - createProdMockServer(mockModules) -} diff --git a/mock/analysis/index.ts b/mock/analysis/index.ts deleted file mode 100644 index 3128049..0000000 --- a/mock/analysis/index.ts +++ /dev/null @@ -1,89 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' - -const { code } = config - -const timeout = 1000 - -export default [ - // 分析页统计接口 - { - url: '/analysis/total', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: { - users: 102400, - messages: 81212, - moneys: 9280, - shoppings: 13600 - } - } - } - }, - // 用户来源 - { - url: '/analysis/userAccessSource', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { value: 1000, name: 'analysis.directAccess' }, - { value: 310, name: 'analysis.mailMarketing' }, - { value: 234, name: 'analysis.allianceAdvertising' }, - { value: 135, name: 'analysis.videoAdvertising' }, - { value: 1548, name: 'analysis.searchEngines' } - ] - } - } - }, - // 每周用户活跃量 - { - url: '/analysis/weeklyUserActivity', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { value: 13253, name: 'analysis.monday' }, - { value: 34235, name: 'analysis.tuesday' }, - { value: 26321, name: 'analysis.wednesday' }, - { value: 12340, name: 'analysis.thursday' }, - { value: 24643, name: 'analysis.friday' }, - { value: 1322, name: 'analysis.saturday' }, - { value: 1324, name: 'analysis.sunday' } - ] - } - } - }, - // 每月销售额 - { - url: '/analysis/monthlySales', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { estimate: 100, actual: 120, name: 'analysis.january' }, - { estimate: 120, actual: 82, name: 'analysis.february' }, - { estimate: 161, actual: 91, name: 'analysis.march' }, - { estimate: 134, actual: 154, name: 'analysis.april' }, - { estimate: 105, actual: 162, name: 'analysis.may' }, - { estimate: 160, actual: 140, name: 'analysis.june' }, - { estimate: 165, actual: 145, name: 'analysis.july' }, - { estimate: 114, actual: 250, name: 'analysis.august' }, - { estimate: 163, actual: 134, name: 'analysis.september' }, - { estimate: 185, actual: 56, name: 'analysis.october' }, - { estimate: 118, actual: 99, name: 'analysis.november' }, - { estimate: 123, actual: 123, name: 'analysis.december' } - ] - } - } - } -] as MockMethod[] diff --git a/mock/department/index.ts b/mock/department/index.ts deleted file mode 100644 index 67ac648..0000000 --- a/mock/department/index.ts +++ /dev/null @@ -1,205 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' -import { toAnyString } from '@/utils' -import Mock from 'mockjs' - -const { code } = config - -const departmentList: any = [] - -const citys = ['厦门总公司', '北京分公司', '上海分公司', '福州分公司', '深圳分公司', '杭州分公司'] - -for (let i = 0; i < 5; i++) { - departmentList.push({ - // 部门名称 - departmentName: citys[i], - id: toAnyString(), - createTime: '@datetime', - // 状态 - status: Mock.Random.integer(0, 1), - // 备注 - remark: '@cword(10, 15)', - children: [ - { - // 部门名称 - departmentName: '研发部', - createTime: '@datetime', - // 状态 - status: Mock.Random.integer(0, 1), - id: toAnyString(), - remark: '@cword(10, 15)' - }, - { - // 部门名称 - departmentName: '产品部', - createTime: '@datetime', - // 状态 - status: Mock.Random.integer(0, 1), - id: toAnyString(), - remark: '@cword(10, 15)' - }, - { - // 部门名称 - departmentName: '运营部', - createTime: '@datetime', - // 状态 - status: Mock.Random.integer(0, 1), - id: toAnyString(), - remark: '@cword(10, 15)' - }, - { - // 部门名称 - departmentName: '市场部', - createTime: '@datetime', - // 状态 - status: Mock.Random.integer(0, 1), - id: toAnyString(), - remark: '@cword(10, 15)' - }, - { - // 部门名称 - departmentName: '销售部', - createTime: '@datetime', - // 状态 - status: Mock.Random.integer(0, 1), - id: toAnyString(), - remark: '@cword(10, 15)' - }, - { - // 部门名称 - departmentName: '客服部', - createTime: '@datetime', - // 状态 - status: Mock.Random.integer(0, 1), - id: toAnyString(), - remark: '@cword(10, 15)' - } - ] - }) -} - -export default [ - // 列表接口 - { - url: '/department/list', - method: 'get', - response: () => { - return { - code: code, - data: { - list: departmentList - } - } - } - }, - { - url: '/department/table/list', - method: 'get', - response: () => { - return { - code: code, - data: { - list: departmentList, - total: 5 - } - } - } - }, - { - url: '/department/users', - method: 'get', - timeout: 1000, - response: ({ query }) => { - const { pageSize } = query - // 根据pageSize来创建数据 - const mockList: any = [] - for (let i = 0; i < pageSize; i++) { - mockList.push( - Mock.mock({ - // 用户名 - username: '@cname', - // 账号 - account: '@first', - // 邮箱 - email: '@EMAIL', - // 创建时间 - createTime: '@datetime', - // 角色 - role: '@first', - // 用户id - id: toAnyString() - }) - ) - } - return { - code: code, - data: { - total: 100, - list: mockList - } - } - } - }, - // 保存接口 - { - url: '/department/user/save', - method: 'post', - timeout: 1000, - response: () => { - return { - code: code, - data: 'success' - } - } - }, - // 删除接口 - { - url: '/department/user/delete', - method: 'post', - response: ({ body }) => { - const ids = body.ids - if (!ids) { - return { - code: 500, - message: '请选择需要删除的数据' - } - } else { - return { - code: code, - data: 'success' - } - } - } - }, - // 保存接口 - { - url: '/department/save', - method: 'post', - timeout: 1000, - response: () => { - return { - code: code, - data: 'success' - } - } - }, - // 删除接口 - { - url: '/department/delete', - method: 'post', - response: ({ body }) => { - const ids = body.ids - if (!ids) { - return { - code: 500, - message: '请选择需要删除的数据' - } - } else { - return { - code: code, - data: 'success' - } - } - } - } -] as MockMethod[] diff --git a/mock/dict/index.ts b/mock/dict/index.ts deleted file mode 100644 index 00230b8..0000000 --- a/mock/dict/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' - -const { code } = config - -const timeout = 1000 - -const dictObj: Recordable = { - importance: [ - { - value: 0, - label: 'tableDemo.commonly' - }, - { - value: 1, - label: 'tableDemo.good' - }, - { - value: 2, - label: 'tableDemo.important' - } - ] -} - -export default [ - // 字典接口 - { - url: '/dict/list', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: dictObj - } - } - }, - // 获取某个字典 - { - url: '/dict/one', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { - label: 'test1', - value: 0 - }, - { - label: 'test2', - value: 1 - }, - { - label: 'test3', - value: 2 - } - ] - } - } - } -] as MockMethod[] diff --git a/mock/menu/index.ts b/mock/menu/index.ts deleted file mode 100644 index 488b82c..0000000 --- a/mock/menu/index.ts +++ /dev/null @@ -1,265 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' -import Mock from 'mockjs' - -const { code } = config - -const timeout = 1000 - -export default [ - // 列表接口 - { - url: '/menu/list', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: { - list: [ - { - path: '/dashboard', - component: '#', - redirect: '/dashboard/analysis', - name: 'Dashboard', - status: Mock.Random.integer(0, 1), - id: 1, - title: '首页', - meta: { - title: '首页', - icon: 'ant-design:dashboard-filled', - alwaysShow: true - }, - children: [ - { - path: 'analysis', - component: 'views/Dashboard/Analysis', - name: 'Analysis', - status: Mock.Random.integer(0, 1), - id: 2, - title: '分析页', - meta: { - title: '分析页', - noCache: true - } - }, - { - path: 'workplace', - component: 'views/Dashboard/Workplace', - name: 'Workplace', - status: Mock.Random.integer(0, 1), - id: 3, - title: '工作台', - meta: { - title: '工作台', - noCache: true - } - } - ] - }, - { - path: '/external-link', - component: '#', - title: '文档', - meta: { - title: '文档', - icon: 'clarity:document-solid' - }, - name: 'ExternalLink', - status: Mock.Random.integer(0, 1), - id: 4, - children: [ - { - path: 'https://element-plus-admin-doc.cn/', - name: 'DocumentLink', - status: Mock.Random.integer(0, 1), - id: 5, - title: '文档', - meta: { - title: '文档' - } - } - ] - }, - { - path: '/level', - component: '#', - redirect: '/level/menu1/menu1-1/menu1-1-1', - name: 'Level', - status: Mock.Random.integer(0, 1), - id: 6, - title: '菜单', - meta: { - title: '菜单', - icon: 'carbon:skill-level-advanced' - }, - children: [ - { - path: 'menu1', - name: 'Menu1', - component: '##', - status: Mock.Random.integer(0, 1), - id: 7, - redirect: '/level/menu1/menu1-1/menu1-1-1', - title: '菜单1', - meta: { - title: '菜单1' - }, - children: [ - { - path: 'menu1-1', - name: 'Menu11', - component: '##', - status: Mock.Random.integer(0, 1), - id: 8, - redirect: '/level/menu1/menu1-1/menu1-1-1', - title: '菜单1-1', - meta: { - title: '菜单1-1', - alwaysShow: true - }, - children: [ - { - path: 'menu1-1-1', - name: 'Menu111', - component: 'views/Level/Menu111', - status: Mock.Random.integer(0, 1), - id: 9, - permission: ['edit', 'add', 'delete'], - title: '菜单1-1-1', - meta: { - title: '菜单1-1-1' - } - } - ] - }, - { - path: 'menu1-2', - name: 'Menu12', - component: 'views/Level/Menu12', - status: Mock.Random.integer(0, 1), - id: 10, - permission: ['edit', 'add', 'delete'], - title: '菜单1-2', - meta: { - title: '菜单1-2' - } - } - ] - }, - { - path: 'menu2', - name: 'Menu2Demo', - component: 'views/Level/Menu2', - status: Mock.Random.integer(0, 1), - id: 11, - permission: ['edit', 'add', 'delete'], - title: '菜单2', - meta: { - title: '菜单2' - } - } - ] - }, - { - path: '/example', - component: '#', - redirect: '/example/example-dialog', - name: 'Example', - status: Mock.Random.integer(0, 1), - id: 12, - title: '综合示例', - meta: { - title: '综合示例', - icon: 'ep:management', - alwaysShow: true - }, - children: [ - { - path: 'example-dialog', - component: 'views/Example/Dialog/ExampleDialog', - name: 'ExampleDialog', - status: Mock.Random.integer(0, 1), - id: 13, - title: '综合示例-弹窗', - permission: ['edit', 'add', 'delete'], - meta: { - title: '综合示例-弹窗', - permission: ['edit', 'add'] - } - }, - { - path: 'example-page', - component: 'views/Example/Page/ExamplePage', - name: 'ExamplePage', - status: Mock.Random.integer(0, 1), - id: 14, - permission: ['edit', 'add', 'delete'], - title: '综合示例-页面', - meta: { - title: '综合示例-页面', - permission: ['edit', 'add'] - } - }, - { - path: 'example-add', - component: 'views/Example/Page/ExampleAdd', - name: 'ExampleAdd', - status: Mock.Random.integer(0, 1), - id: 15, - permission: ['edit', 'add', 'delete'], - title: '综合示例-新增', - meta: { - title: '综合示例-新增', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page', - permission: ['delete', 'add'] - } - }, - { - path: 'example-edit', - component: 'views/Example/Page/ExampleEdit', - name: 'ExampleEdit', - status: Mock.Random.integer(0, 1), - id: 16, - permission: ['edit', 'add', 'delete'], - title: '综合示例-编辑', - meta: { - title: '综合示例-编辑', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page', - permission: ['delete', 'add'] - } - }, - { - path: 'example-detail', - component: 'views/Example/Page/ExampleDetail', - name: 'ExampleDetail', - status: Mock.Random.integer(0, 1), - id: 17, - permission: ['edit', 'add', 'delete'], - title: '综合示例-详情', - meta: { - title: '综合示例-详情', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page', - permission: ['delete', 'edit'] - } - } - ] - } - ] - } - } - } - } -] as MockMethod[] diff --git a/mock/request/index.ts b/mock/request/index.ts deleted file mode 100644 index c926137..0000000 --- a/mock/request/index.ts +++ /dev/null @@ -1,64 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' - -const timeout = 600000 - -const { code } = config - -export default [ - { - url: '/request/1', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: 'request-1' - } - } - }, - { - url: '/request/2', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: 'request-2' - } - } - }, - { - url: '/request/3', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: 'request-3' - } - } - }, - { - url: '/request/4', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: 'request-4' - } - } - }, - { - url: '/request/5', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: 'request-5' - } - } - } -] as MockMethod[] diff --git a/mock/role/index.ts b/mock/role/index.ts deleted file mode 100644 index b90f239..0000000 --- a/mock/role/index.ts +++ /dev/null @@ -1,1180 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' -import Mock from 'mockjs' -import { toAnyString } from '@/utils' - -const { code } = config - -const timeout = 1000 - -const adminList = [ - { - path: '/dashboard', - component: '#', - redirect: '/dashboard/analysis', - name: 'Dashboard', - meta: { - title: 'router.dashboard', - icon: 'ant-design:dashboard-filled', - alwaysShow: true - }, - children: [ - { - path: 'analysis', - component: 'views/Dashboard/Analysis', - name: 'Analysis', - meta: { - title: 'router.analysis', - noCache: true - } - }, - { - path: 'workplace', - component: 'views/Dashboard/Workplace', - name: 'Workplace', - meta: { - title: 'router.workplace', - noCache: true - } - } - ] - }, - { - path: '/external-link', - component: '#', - meta: {}, - name: 'ExternalLink', - children: [ - { - path: 'https://element-plus-admin-doc.cn/', - name: 'DocumentLink', - meta: { - title: 'router.document', - icon: 'clarity:document-solid' - } - } - ] - }, - { - path: '/guide', - component: '#', - name: 'Guide', - meta: {}, - children: [ - { - path: 'index', - component: 'views/Guide/Guide', - name: 'GuideDemo', - meta: { - title: 'router.guide', - icon: 'cib:telegram-plane' - } - } - ] - }, - { - path: '/components', - component: '#', - redirect: '/components/form/default-form', - name: 'ComponentsDemo', - meta: { - title: 'router.component', - icon: 'bx:bxs-component', - alwaysShow: true - }, - children: [ - { - path: 'form', - component: '##', - name: 'Form', - meta: { - title: 'router.form', - alwaysShow: true - }, - children: [ - { - path: 'default-form', - component: 'views/Components/Form/DefaultForm', - name: 'DefaultForm', - meta: { - title: 'router.defaultForm' - } - }, - { - path: 'use-form', - component: 'views/Components/Form/UseFormDemo', - name: 'UseForm', - meta: { - title: 'UseForm' - } - } - ] - }, - { - path: 'table', - component: '##', - redirect: '/components/table/default-table', - name: 'TableDemo', - meta: { - title: 'router.table', - alwaysShow: true - }, - children: [ - { - path: 'default-table', - component: 'views/Components/Table/DefaultTable', - name: 'DefaultTable', - meta: { - title: 'router.defaultTable' - } - }, - { - path: 'use-table', - component: 'views/Components/Table/UseTableDemo', - name: 'UseTable', - meta: { - title: 'UseTable' - } - }, - { - path: 'tree-table', - component: 'views/Components/Table/TreeTable', - name: 'TreeTable', - meta: { - title: 'TreeTable' - } - }, - { - path: 'table-image-preview', - component: 'views/Components/Table/TableImagePreview', - name: 'TableImagePreview', - meta: { - title: 'router.PicturePreview' - } - } - // { - // path: 'ref-table', - // component: 'views/Components/Table/RefTable', - // name: 'RefTable', - // meta: { - // title: 'RefTable' - // } - // } - ] - }, - { - path: 'editor-demo', - component: '##', - redirect: '/components/editor-demo/editor', - name: 'EditorDemo', - meta: { - title: 'router.editor', - alwaysShow: true - }, - children: [ - { - path: 'editor', - component: 'views/Components/Editor/Editor', - name: 'Editor', - meta: { - title: 'router.richText' - } - }, - { - path: 'json-editor', - component: 'views/Components/Editor/JsonEditor', - name: 'JsonEditor', - meta: { - title: 'router.jsonEditor' - } - } - ] - }, - { - path: 'search', - component: 'views/Components/Search', - name: 'Search', - meta: { - title: 'router.search' - } - }, - { - path: 'descriptions', - component: 'views/Components/Descriptions', - name: 'Descriptions', - meta: { - title: 'router.descriptions' - } - }, - { - path: 'image-viewer', - component: 'views/Components/ImageViewer', - name: 'ImageViewer', - meta: { - title: 'router.imageViewer' - } - }, - { - path: 'dialog', - component: 'views/Components/Dialog', - name: 'Dialog', - meta: { - title: 'router.dialog' - } - }, - { - path: 'icon', - component: 'views/Components/Icon', - name: 'Icon', - meta: { - title: 'router.icon' - } - }, - { - path: 'icon-picker', - component: 'views/Components/IconPicker', - name: 'IconPicker', - meta: { - title: 'router.iconPicker' - } - }, - { - path: 'echart', - component: 'views/Components/Echart', - name: 'Echart', - meta: { - title: 'router.echart' - } - }, - { - path: 'count-to', - component: 'views/Components/CountTo', - name: 'CountTo', - meta: { - title: 'router.countTo' - } - }, - { - path: 'qrcode', - component: 'views/Components/Qrcode', - name: 'Qrcode', - meta: { - title: 'router.qrcode' - } - }, - { - path: 'highlight', - component: 'views/Components/Highlight', - name: 'Highlight', - meta: { - title: 'router.highlight' - } - }, - { - path: 'infotip', - component: 'views/Components/Infotip', - name: 'Infotip', - meta: { - title: 'router.infotip' - } - }, - { - path: 'input-password', - component: 'views/Components/InputPassword', - name: 'InputPassword', - meta: { - title: 'router.inputPassword' - } - }, - { - path: 'waterfall', - component: 'views/Components/Waterfall', - name: 'Waterfall', - meta: { - title: 'router.waterfall' - } - } - ] - }, - { - path: '/function', - component: '#', - redirect: '/function/multipleTabs', - name: 'Function', - meta: { - title: 'router.function', - icon: 'ri:function-fill', - alwaysShow: true - }, - children: [ - { - path: 'multipleTabs', - component: 'views/Function/MultipleTabs', - name: 'MultipleTabs', - meta: { - title: 'router.multipleTabs' - } - }, - { - path: 'multipleTabs-demo/:id', - component: 'views/Function/MultipleTabsDemo', - name: 'MultipleTabsDemo', - meta: { - hidden: true, - title: 'router.details', - canTo: true - } - }, - { - path: 'request', - component: 'views/Function/Request', - name: 'Request', - meta: { - title: 'router.request' - } - }, - { - path: 'test', - component: () => 'views/Function/Test', - name: 'Test', - meta: { - title: 'router.permission', - permission: ['add', 'edit', 'delete'] - } - } - ] - }, - { - path: '/hooks', - component: '#', - redirect: '/hooks/useWatermark', - name: 'Hooks', - meta: { - title: 'hooks', - icon: 'ic:outline-webhook', - alwaysShow: true - }, - children: [ - { - path: 'useWatermark', - component: 'views/hooks/useWatermark', - name: 'UseWatermark', - meta: { - title: 'useWatermark' - } - }, - { - path: 'useTagsView', - component: 'views/hooks/useTagsView', - name: 'UseTagsView', - meta: { - title: 'useTagsView' - } - }, - { - path: 'useValidator', - component: 'views/hooks/useValidator', - name: 'UseValidator', - meta: { - title: 'useValidator' - } - }, - { - path: 'useCrudSchemas', - component: 'views/hooks/useCrudSchemas', - name: 'UseCrudSchemas', - meta: { - title: 'useCrudSchemas' - } - }, - { - path: 'useClipboard', - component: 'views/hooks/useClipboard', - name: 'UseClipboard', - meta: { - title: 'useClipboard' - } - }, - { - path: 'useNetwork', - component: 'views/hooks/useNetwork', - name: 'UseNetwork', - meta: { - title: 'useNetwork' - } - } - ] - }, - { - path: '/level', - component: '#', - redirect: '/level/menu1/menu1-1/menu1-1-1', - name: 'Level', - meta: { - title: 'router.level', - icon: 'carbon:skill-level-advanced' - }, - children: [ - { - path: 'menu1', - name: 'Menu1', - component: '##', - redirect: '/level/menu1/menu1-1/menu1-1-1', - meta: { - title: 'router.menu1' - }, - children: [ - { - path: 'menu1-1', - name: 'Menu11', - component: '##', - redirect: '/level/menu1/menu1-1/menu1-1-1', - meta: { - title: 'router.menu11', - alwaysShow: true - }, - children: [ - { - path: 'menu1-1-1', - name: 'Menu111', - component: 'views/Level/Menu111', - meta: { - title: 'router.menu111' - } - } - ] - }, - { - path: 'menu1-2', - name: 'Menu12', - component: 'views/Level/Menu12', - meta: { - title: 'router.menu12' - } - } - ] - }, - { - path: 'menu2', - name: 'Menu2Demo', - component: 'views/Level/Menu2', - meta: { - title: 'router.menu2' - } - } - ] - }, - { - path: '/example', - component: '#', - redirect: '/example/example-dialog', - name: 'Example', - meta: { - title: 'router.example', - icon: 'ep:management', - alwaysShow: true - }, - children: [ - { - path: 'example-dialog', - component: 'views/Example/Dialog/ExampleDialog', - name: 'ExampleDialog', - meta: { - title: 'router.exampleDialog' - } - }, - { - path: 'example-page', - component: 'views/Example/Page/ExamplePage', - name: 'ExamplePage', - meta: { - title: 'router.examplePage' - } - }, - { - path: 'example-add', - component: 'views/Example/Page/ExampleAdd', - name: 'ExampleAdd', - meta: { - title: 'router.exampleAdd', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page' - } - }, - { - path: 'example-edit', - component: 'views/Example/Page/ExampleEdit', - name: 'ExampleEdit', - meta: { - title: 'router.exampleEdit', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page' - } - }, - { - path: 'example-detail', - component: 'views/Example/Page/ExampleDetail', - name: 'ExampleDetail', - meta: { - title: 'router.exampleDetail', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page' - } - } - ] - }, - { - path: '/error', - component: '#', - redirect: '/error/404', - name: 'Error', - meta: { - title: 'router.errorPage', - icon: 'ci:error', - alwaysShow: true - }, - children: [ - { - path: '404-demo', - component: 'views/Error/404', - name: '404Demo', - meta: { - title: '404' - } - }, - { - path: '403-demo', - component: 'views/Error/403', - name: '403Demo', - meta: { - title: '403' - } - }, - { - path: '500-demo', - component: 'views/Error/500', - name: '500Demo', - meta: { - title: '500' - } - } - ] - }, - { - path: '/authorization', - component: '#', - redirect: '/authorization/user', - name: 'Authorization', - meta: { - title: 'router.authorization', - icon: 'eos-icons:role-binding', - alwaysShow: true - }, - children: [ - { - path: 'dict', - component: 'views/Authorization/dict/dict', - name: 'dict', - meta: { - title: 'router.dict' - } - }, - { - path: 'user', - component: 'views/Authorization/User/User', - name: 'User', - meta: { - title: 'router.user' - } - }, - { - path: 'menu', - component: 'views/Authorization/Menu/Menu', - name: 'Menu', - meta: { - title: 'router.menuManagement' - } - }, - { - path: 'role', - component: 'views/Authorization/Role/Role', - name: 'Role', - meta: { - title: 'router.role' - } - } - ] - } -] - -const testList: string[] = [ - '/dashboard', - '/dashboard/analysis', - '/dashboard/workplace', - 'external-link', - 'https://element-plus-admin-doc.cn/', - '/guide', - '/guide/index', - '/components', - '/components/form', - '/components/form/default-form', - '/components/form/use-form', - '/components/form/ref-form', - '/components/table', - '/components/table/default-table', - '/components/table/use-table', - '/components/table/tree-table', - '/components/table/table-image-preview', - '/components/table/ref-table', - '/components/editor-demo', - '/components/editor-demo/editor', - '/components/editor-demo/json-editor', - '/components/search', - '/components/descriptions', - '/components/image-viewer', - '/components/dialog', - '/components/icon', - '/components/iconPicker', - '/components/echart', - '/components/count-to', - '/components/qrcode', - '/components/highlight', - '/components/infotip', - '/components/input-password', - '/components/waterfall', - 'function', - '/function/multiple-tabs', - '/function/multiple-tabs-demo/:id', - '/function/request', - '/function/test', - '/hooks', - '/hooks/useWatermark', - '/hooks/useTagsView', - '/hooks/useValidator', - '/hooks/useCrudSchemas', - '/hooks/useClipboard', - '/hooks/useNetwork', - '/level', - '/level/menu1', - '/level/menu1/menu1-1', - '/level/menu1/menu1-1/menu1-1-1', - '/level/menu1/menu1-2', - '/level/menu2', - '/example', - '/example/example-dialog', - '/example/example-page', - '/example/example-add', - '/example/example-edit', - '/example/example-detail', - '/authorization', - '/authorization/department', - '/authorization/user', - '/authorization/role', - '/authorization/menu', - '/error', - '/error/404-demo', - '/error/403-demo', - '/error/500-demo' -] - -const List: any[] = [] - -const roleNames = [ - '超级管理员', - '管理员', - '普通用户', - '游客', - '12', - '11', - '13', - '14', - '15', - '16', - '17', - '18', - '19', - '20' -] -const menus = [ - [ - { - path: '/dashboard', - component: '#', - redirect: '/dashboard/analysis', - name: 'Dashboard', - status: Mock.Random.integer(0, 1), - id: 1, - meta: { - title: '首页', - icon: 'ant-design:dashboard-filled', - alwaysShow: true - }, - children: [ - { - path: 'analysis', - component: 'views/Dashboard/Analysis', - name: 'Analysis', - status: Mock.Random.integer(0, 1), - id: 2, - meta: { - title: '首页', - noCache: true - } - }, - { - path: 'workplace', - component: 'views/Dashboard/Workplace', - name: 'Workplace', - status: Mock.Random.integer(0, 1), - id: 3, - meta: { - title: '工作台', - noCache: true - } - } - ] - }, - { - path: '/external-link', - component: '#', - meta: { - title: '文档', - icon: 'clarity:document-solid' - }, - name: 'ExternalLink', - status: Mock.Random.integer(0, 1), - id: 4, - children: [ - { - path: 'https://element-plus-admin-doc.cn/', - name: 'DocumentLink', - status: Mock.Random.integer(0, 1), - id: 5, - meta: { - title: '文档' - } - } - ] - }, - { - path: '/level', - component: '#', - redirect: '/level/menu1/menu1-1/menu1-1-1', - name: 'Level', - status: Mock.Random.integer(0, 1), - id: 6, - meta: { - title: '菜单', - icon: 'carbon:skill-level-advanced' - }, - children: [ - { - path: 'menu1', - name: 'Menu1', - component: '##', - status: Mock.Random.integer(0, 1), - id: 7, - redirect: '/level/menu1/menu1-1/menu1-1-1', - meta: { - title: '菜单1' - }, - children: [ - { - path: 'menu1-1', - name: 'Menu11', - component: '##', - status: Mock.Random.integer(0, 1), - id: 8, - redirect: '/level/menu1/menu1-1/menu1-1-1', - meta: { - title: '菜单1-1', - alwaysShow: true - }, - children: [ - { - path: 'menu1-1-1', - name: 'Menu111', - component: 'views/Level/Menu111', - status: Mock.Random.integer(0, 1), - id: 9, - permission: ['edit', 'add', 'delete'], - meta: { - title: '菜单1-1-1', - permission: ['edit', 'add', 'delete'] - } - } - ] - }, - { - path: 'menu1-2', - name: 'Menu12', - component: 'views/Level/Menu12', - status: Mock.Random.integer(0, 1), - id: 10, - permission: ['edit', 'add', 'delete'], - meta: { - title: '菜单1-2', - permission: ['edit', 'add', 'delete'] - } - } - ] - }, - { - path: 'menu2', - name: 'Menu2Demo', - component: 'views/Level/Menu2', - status: Mock.Random.integer(0, 1), - id: 11, - permission: ['edit', 'add', 'delete'], - meta: { - title: '菜单2', - permission: ['edit', 'add', 'delete'] - } - } - ] - }, - { - path: '/example', - component: '#', - redirect: '/example/example-dialog', - name: 'Example', - status: Mock.Random.integer(0, 1), - id: 12, - meta: { - title: '综合示例', - icon: 'ep:management', - alwaysShow: true - }, - children: [ - { - path: 'example-dialog', - component: 'views/Example/Dialog/ExampleDialog', - name: 'ExampleDialog', - status: Mock.Random.integer(0, 1), - id: 13, - permission: ['edit', 'add', 'delete'], - meta: { - title: '综合示例-弹窗', - permission: ['edit', 'add', 'delete'] - } - }, - { - path: 'example-page', - component: 'views/Example/Page/ExamplePage', - name: 'ExamplePage', - status: Mock.Random.integer(0, 1), - id: 14, - permission: ['edit', 'add', 'delete'], - meta: { - title: '综合示例-页面', - permission: ['edit', 'add', 'delete'] - } - }, - { - path: 'example-add', - component: 'views/Example/Page/ExampleAdd', - name: 'ExampleAdd', - status: Mock.Random.integer(0, 1), - id: 15, - permission: ['edit', 'add', 'delete'], - meta: { - title: '综合示例-新增', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page', - permission: ['edit', 'add', 'delete'] - } - }, - { - path: 'example-edit', - component: 'views/Example/Page/ExampleEdit', - name: 'ExampleEdit', - status: Mock.Random.integer(0, 1), - id: 16, - permission: ['edit', 'add', 'delete'], - meta: { - title: '综合示例-编辑', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page', - permission: ['edit', 'add', 'delete'] - } - }, - { - path: 'example-detail', - component: 'views/Example/Page/ExampleDetail', - name: 'ExampleDetail', - status: Mock.Random.integer(0, 1), - id: 17, - permission: ['edit', 'add', 'delete'], - meta: { - title: '综合示例-详情', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page', - permission: ['edit', 'add', 'delete'] - } - } - ] - } - ], - [ - { - path: '/dashboard', - component: '#', - redirect: '/dashboard/analysis', - name: 'Dashboard', - status: Mock.Random.integer(0, 1), - id: 1, - meta: { - title: '首页', - icon: 'ant-design:dashboard-filled', - alwaysShow: true - }, - children: [ - { - path: 'analysis', - component: 'views/Dashboard/Analysis', - name: 'Analysis', - status: Mock.Random.integer(0, 1), - id: 2, - meta: { - title: '分析页', - noCache: true - } - }, - { - path: 'workplace', - component: 'views/Dashboard/Workplace', - name: 'Workplace', - status: Mock.Random.integer(0, 1), - id: 3, - meta: { - title: '工作台', - noCache: true - } - } - ] - } - ], - [ - { - path: '/external-link', - component: '#', - meta: { - title: '文档', - icon: 'clarity:document-solid' - }, - name: 'ExternalLink', - status: Mock.Random.integer(0, 1), - id: 4, - children: [ - { - path: 'https://element-plus-admin-doc.cn/', - name: 'DocumentLink', - status: Mock.Random.integer(0, 1), - id: 5, - meta: { - title: '文档' - } - } - ] - }, - { - path: '/level', - component: '#', - redirect: '/level/menu1/menu1-1/menu1-1-1', - name: 'Level', - status: Mock.Random.integer(0, 1), - id: 6, - meta: { - title: '菜单', - icon: 'carbon:skill-level-advanced' - }, - children: [ - { - path: 'menu1', - name: 'Menu1', - component: '##', - status: Mock.Random.integer(0, 1), - id: 7, - redirect: '/level/menu1/menu1-1/menu1-1-1', - meta: { - title: '菜单1' - }, - children: [ - { - path: 'menu1-1', - name: 'Menu11', - component: '##', - status: Mock.Random.integer(0, 1), - id: 8, - redirect: '/level/menu1/menu1-1/menu1-1-1', - meta: { - title: '菜单1-1', - alwaysShow: true - }, - children: [ - { - path: 'menu1-1-1', - name: 'Menu111', - component: 'views/Level/Menu111', - status: Mock.Random.integer(0, 1), - id: 9, - permission: ['edit', 'add', 'delete'], - meta: { - title: '菜单1-1-1', - permission: ['edit', 'add', 'delete'] - } - } - ] - }, - { - path: 'menu1-2', - name: 'Menu12', - component: 'views/Level/Menu12', - status: Mock.Random.integer(0, 1), - id: 10, - permission: ['edit', 'add', 'delete'], - meta: { - title: '菜单1-2', - permission: ['edit', 'add', 'delete'] - } - } - ] - }, - { - path: 'menu2', - name: 'Menu2Demo', - component: 'views/Level/Menu2', - status: Mock.Random.integer(0, 1), - id: 11, - permission: ['edit', 'add', 'delete'], - meta: { - title: '菜单2', - permission: ['edit', 'add', 'delete'] - } - } - ] - } - ], - [ - { - path: '/example', - component: '#', - redirect: '/example/example-dialog', - name: 'Example', - status: Mock.Random.integer(0, 1), - id: 12, - meta: { - title: '综合示例', - icon: 'ep:management', - alwaysShow: true - }, - children: [ - { - path: 'example-detail', - component: 'views/Example/Page/ExampleDetail', - name: 'ExampleDetail', - status: Mock.Random.integer(0, 1), - id: 17, - permission: ['edit', 'add', 'delete'], - meta: { - title: '综合示例-详情', - noTagsView: true, - noCache: true, - hidden: true, - showMainRoute: true, - activeMenu: '/example/example-page', - permission: ['edit', 'add', 'delete'] - } - } - ] - } - ] -] - -for (let i = 0; i < roleNames.length; i++) { - List.push( - Mock.mock({ - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - roleName: roleNames[i], - role: '@first', - status: Mock.Random.integer(0, 1), - createTime: '@datetime', - remark: '@cword(10, 15)', - menu: menus[i] - }) - ) -} - -export default [ - // 列表接口 - { - url: '/role/list', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: adminList - } - } - }, - { - url: '/role/table', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: { - list: List, - total: List.length - } - } - } - }, - // 列表接口 - { - url: '/role/list2', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: testList - } - } - }, - { - url: '/role/table', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: { - list: List, - total: List.length - } - } - } - } -] as MockMethod[] diff --git a/mock/table/index.ts b/mock/table/index.ts deleted file mode 100644 index cbe0541..0000000 --- a/mock/table/index.ts +++ /dev/null @@ -1,256 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' -import { toAnyString } from '@/utils' -import Mock from 'mockjs' - -const { code } = config - -const timeout = 1000 - -const count = 100 - -const baseContent = - '

I am testing data, I am testing data.

' - -interface ListProps { - id: string - author: string - title: string - content: string - importance: number - display_time: string - pageviews: number - image_uri: string -} - -interface TreeListProps { - id: string - author: string - title: string - content: string - importance: number - display_time: string - pageviews: number - children: TreeListProps[] -} - -let List: ListProps[] = [] - -for (let i = 0; i < count; i++) { - List.push( - Mock.mock({ - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(100, 500)', - image_uri: Mock.Random.image('@integer(100, 500)x@integer(100, 500)') - }) - ) -} - -const treeList: TreeListProps[] = [] - -for (let i = 0; i < count; i++) { - treeList.push( - Mock.mock({ - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(300, 5000)', - children: [ - { - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(300, 5000)', - children: [ - { - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(300, 5000)' - }, - { - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(300, 5000)' - } - ] - }, - { - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(300, 5000)' - }, - { - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(300, 5000)' - }, - { - id: toAnyString(), - // timestamp: +Mock.Random.date('T'), - author: '@first', - title: '@title(5, 10)', - content: baseContent, - importance: '@integer(1, 3)', - display_time: '@datetime', - pageviews: '@integer(300, 5000)' - } - ] - // image_uri - }) - ) -} - -export default [ - // 树形列表接口 - { - url: '/example/treeList', - method: 'get', - timeout, - response: ({ query }) => { - const { title, pageIndex, pageSize } = query - const mockList = treeList.filter((item) => { - if (title && item.title.indexOf(title) < 0) return false - return true - }) - const pageList = mockList.filter( - (_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1) - ) - return { - code: code, - data: { - total: mockList.length, - list: pageList - } - } - } - }, - // 列表接口 - { - url: '/example/list', - method: 'get', - timeout, - response: ({ query }) => { - const { title, pageIndex, pageSize } = query - const mockList = List.filter((item) => { - if (title && item.title.indexOf(title) < 0) return false - return true - }) - const pageList = mockList.filter( - (_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1) - ) - return { - code: code, - data: { - total: mockList.length, - list: pageList - } - } - } - }, - // 保存接口 - { - url: '/example/save', - method: 'post', - timeout, - response: ({ body }) => { - if (!body.id) { - List = [ - Object.assign(body, { - id: toAnyString() - }) - ].concat(List) - return { - code: code, - data: 'success' - } - } else { - List.map((item) => { - if (item.id === body.id) { - for (const key in item) { - item[key] = body[key] - } - } - }) - return { - code: code, - data: 'success' - } - } - } - }, - // 详情接口 - { - url: '/example/detail', - method: 'get', - response: ({ query }) => { - const { id } = query - for (const example of List) { - if (example.id === id) { - return { - code: code, - data: example - } - } - } - } - }, - // 删除接口 - { - url: '/example/delete', - method: 'post', - response: ({ body }) => { - const ids = body.ids - if (!ids) { - return { - code: 500, - message: '请选择需要删除的数据' - } - } else { - let i = List.length - while (i--) { - if (ids.indexOf(List[i].id) !== -1) { - List.splice(i, 1) - } - } - return { - code: code, - data: 'success' - } - } - } - } -] as MockMethod[] diff --git a/mock/user/index.ts b/mock/user/index.ts deleted file mode 100644 index 8e5ea49..0000000 --- a/mock/user/index.ts +++ /dev/null @@ -1,135 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' - -const { code } = config - -const timeout = 1000 - -const List: { - username: string - password: string - role: string - roleId: string - permissions: string | string[] -}[] = [ - { - username: 'admin', - password: 'o9%2B2oAvFf9DHDj1yBTJHhw%3D%3D', - role: 'admin', - roleId: '1', - permissions: ['*.*.*'] - }, - { - username: 'test', - password: 'test', - role: 'test', - roleId: '2', - permissions: ['example:dialog:create', 'example:dialog:delete'] - } -] - -export default [ - // 列表接口 - { - url: '/user/list', - method: 'get', - response: ({ query }) => { - const { username, pageIndex, pageSize } = query - - const mockList = List.filter((item) => { - if (username && item.username.indexOf(username) < 0) return false - return true - }) - const pageList = mockList.filter( - (_, index) => index < pageSize * pageIndex && index >= pageSize * (pageIndex - 1) - ) - - return { - code: code, - data: { - total: mockList.length, - list: pageList - } - } - } - }, - // 登录接口 - { - url: '/user/login', - method: 'post', - timeout, - response: ({ body }) => { - const data = body - let hasUser = false - for (const user of List) { - if (user.username === data.username && user.password === data.password) { - hasUser = true - return { - code: code, - data: user - } - } - } - if (!hasUser) { - return { - code: 500, - message: '账号或密码错误' - } - } - } - }, - { - url: '/mobile/login', - method: 'post', - timeout, - response: ({ body }) => { - debugger - const data = body - let hasUser = false - for (const user of List) { - if (user.username === data.username && user.password === data.password) { - hasUser = true - return { - code: code, - data: user - } - } - } - return { - code: code, - data: { - code: 1 - } - } - if (!hasUser) { - return { - code: 500, - message: '账号或密码错误' - } - } - } - }, - // 退出接口 - { - url: '/user/loginOut', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: null - } - } - }, - { - url: '/mobile/logout', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: null - } - } - } -] as MockMethod[] diff --git a/mock/workplace/index.ts b/mock/workplace/index.ts deleted file mode 100644 index b6c854d..0000000 --- a/mock/workplace/index.ts +++ /dev/null @@ -1,172 +0,0 @@ -import config from '@/config/axios/config' -import { MockMethod } from 'vite-plugin-mock' - -const { code } = config - -const timeout = 1000 - -export default [ - // 获取统计 - { - url: '/workplace/total', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: { - project: 40, - access: 2340, - todo: 10 - } - } - } - }, - // 获取项目 - { - url: '/workplace/project', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { - name: 'Github', - icon: 'akar-icons:github-fill', - message: 'workplace.introduction', - personal: 'Archer', - time: new Date() - }, - { - name: 'Vue', - icon: 'logos:vue', - message: 'workplace.introduction', - personal: 'Archer', - time: new Date() - }, - { - name: 'Angular', - icon: 'logos:angular-icon', - message: 'workplace.introduction', - personal: 'Archer', - time: new Date() - }, - { - name: 'React', - icon: 'logos:react', - message: 'workplace.introduction', - personal: 'Archer', - time: new Date() - }, - { - name: 'Webpack', - icon: 'logos:webpack', - message: 'workplace.introduction', - personal: 'Archer', - time: new Date() - }, - { - name: 'Vite', - icon: 'vscode-icons:file-type-vite', - message: 'workplace.introduction', - personal: 'Archer', - time: new Date() - } - ] - } - } - }, - // 获取动态 - { - url: '/workplace/dynamic', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { - keys: ['workplace.push', 'Github'], - time: new Date() - }, - { - keys: ['workplace.push', 'Github'], - time: new Date() - }, - { - keys: ['workplace.push', 'Github'], - time: new Date() - }, - { - keys: ['workplace.push', 'Github'], - time: new Date() - }, - { - keys: ['workplace.push', 'Github'], - time: new Date() - }, - { - keys: ['workplace.push', 'Github'], - time: new Date() - } - ] - } - } - }, - // 获取团队信息 - { - url: '/workplace/team', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { - name: 'Github', - icon: 'akar-icons:github-fill' - }, - { - name: 'Vue', - icon: 'logos:vue' - }, - { - name: 'Angular', - icon: 'logos:angular-icon' - }, - { - name: 'React', - icon: 'logos:react' - }, - { - name: 'Webpack', - icon: 'logos:webpack' - }, - { - name: 'Vite', - icon: 'vscode-icons:file-type-vite' - } - ] - } - } - }, - // 获取指数 - { - url: '/workplace/radar', - method: 'get', - timeout, - response: () => { - return { - code: code, - data: [ - { name: 'workplace.quote', max: 65, personal: 42, team: 50 }, - { name: 'workplace.contribution', max: 160, personal: 30, team: 140 }, - { name: 'workplace.hot', max: 300, personal: 20, team: 28 }, - { name: 'workplace.yield', max: 130, personal: 35, team: 35 }, - { name: 'workplace.follow', max: 100, personal: 80, team: 90 } - ] - } - } - } -] as MockMethod[] diff --git a/src/views/IndexProcess/ProcedureRule/components/ProcedureConfig.vue b/src/views/IndexProcess/ProcedureRule/components/ProcedureConfig.vue index f6da175..fb3c1c2 100644 --- a/src/views/IndexProcess/ProcedureRule/components/ProcedureConfig.vue +++ b/src/views/IndexProcess/ProcedureRule/components/ProcedureConfig.vue @@ -104,10 +104,10 @@ watch( (ruleInfo) => { if (!ruleInfo) return sqlInfo = Object.assign(sqlInfo,ruleInfo); - if(editorInstance){ - const model = editorInstance.getModel(); - model.setValue(sqlInfo.ruleSql); - } + // if(editorInstance){ + // const model = editorInstance.getModel(); + // model.setValue(sqlInfo.ruleSql); + // } }, { deep: true, @@ -118,7 +118,7 @@ watch( const formatterSql = ()=>{ const model = editorInstance.getModel(); if (model) { - const formattedSql = format(model.getValue()); + const formattedSql = format(editorInstance.getValue()); model.setValue(formattedSql); } } @@ -135,11 +135,13 @@ const submit = async () =>{ return false; } const model = editorInstance.getModel(); + console.log(model.getValue(),"sql的信息"); if(!model.getValue()){ ElMessage.warning('请输入SQL语句'); return false; } sqlInfo.ruleSql = model.getValue(); + return sqlInfo } defineExpose({ diff --git a/src/views/IndexProcess/SqlRule/SqlRule.vue b/src/views/IndexProcess/SqlRule/SqlRule.vue index d9e3a50..16f95bf 100644 --- a/src/views/IndexProcess/SqlRule/SqlRule.vue +++ b/src/views/IndexProcess/SqlRule/SqlRule.vue @@ -47,11 +47,14 @@ setParamsSubmit.ruleJson = JSON.stringify(setParamsSubmit.ruleJson); } let paramsList = Object.assign(basicInfoSubmit,setParamsSubmit,procedureConfigSubmit,{ruleClass:'SqlRule'}); - if(props.currentRow){ + if(typeof paramsList.ruleJson != 'string'){ + paramsList.ruleJson = JSON.stringify(paramsList.ruleJson); + } + if(props.currentRow){//新增两个参数信息 paramsList.itemId = props.currentRow.code; paramsList.itemName = props.currentRow.itemName; } - console.log(paramsList,props.currentRow); + saveRepSetRuleApi(paramsList).then(res=>{ loading.value = false; if(res.head.code == '0'){ @@ -72,7 +75,7 @@ - + diff --git a/src/views/dataset/CodeRepItem/CodeRepItem.vue b/src/views/dataset/CodeRepItem/CodeRepItem.vue index 031d2cd..1abc065 100644 --- a/src/views/dataset/CodeRepItem/CodeRepItem.vue +++ b/src/views/dataset/CodeRepItem/CodeRepItem.vue @@ -28,11 +28,10 @@ import RepSetRuleWrite from '@/views/dataset/RepSetRule/components/Write.vue' import { RULE_TYPE_LIST } from '@/views/IndexProcess/constants' import { getIndexType } from '@/api/dataset/RepIndexSet' import { transfDictList } from '@/utils'; -import { Alignment } from 'element-plus/es/components/table-v2/src/constants' const route = useRoute(); const pageQuery = ref(route || null); -const indexsetCode = pageQuery.value?.query?.indexsetCode; +let indexsetCode = pageQuery.value?.query?.indexsetCode; let indexType_param_LIST = ref([]); let indexCalType_param_LIST = ref([]); let indexDataType_param_LIST = ref([]); @@ -67,6 +66,10 @@ const { tableRegister, tableState, tableMethods } = useTable({ pageSize: unref(pageSize), ...unref(searchParams) }) + if(res.body.list && res.body.list.length !=0 && !indexsetCode){ + //此时给一个默认的indexSet的值 + indexsetCode = res.body.list[0].indexsetCode; + } return { list: res.body.list, total: res.body.total @@ -282,11 +285,12 @@ const save = async () => { if (formData) { saveLoading.value = true const res = await saveCodeRepItemApi(formData) - .catch(() => {}) + .catch(() => {ElMessage.warning('保存失败');}) .finally(() => { saveLoading.value = false }) if (res) { + ElMessage.success(res.head.code == '0'?'保存成功':res.head.msg); dialogVisible.value = false currentPage.value = 1 getList() diff --git a/src/views/dataset/CodeRepTarget/CodeRepTarget.vue b/src/views/dataset/CodeRepTarget/CodeRepTarget.vue index 0e3c140..b37eeab 100644 --- a/src/views/dataset/CodeRepTarget/CodeRepTarget.vue +++ b/src/views/dataset/CodeRepTarget/CodeRepTarget.vue @@ -27,7 +27,7 @@ import {useRoute} from "vue-router" const route = useRoute(); const pageQuery = ref(route || null); -const indexsetCode = pageQuery.value?.query?.indexsetCode; +let indexsetCode = pageQuery.value?.query?.indexsetCode; const { t } = useI18n() @@ -41,6 +41,10 @@ const { tableRegister, tableState, tableMethods } = useTable({ pageSize: unref(pageSize), ...unref(searchParams) }) + if(res.body.list && res.body.list.length !=0 && !indexsetCode){ + //此时给一个默认的indexSet的值 + indexsetCode = res.body.list[0].indexsetCode; + } return { list: res.body.list, total: res.body.total @@ -85,7 +89,7 @@ const tableColumns = reactive([ { field: 'action', label: t('tableDemo.action'), - width: 160, + width: 120, fixed: 'right', slots: { default: (data: any) => { @@ -176,7 +180,7 @@ const action = async (row: TableData, type: string) => { const AddAction = () => { dialogTitle.value = t('tableDemo.add') - currentRow.value = undefined + currentRow.value = {indexsetCode:indexsetCode} dialogVisible.value = true actionType.value = 'add' } @@ -189,11 +193,12 @@ const save = async () => { if (formData) { saveLoading.value = true const res = await saveCodeRepTargetApi(formData) - .catch(() => {}) + .catch(() => {ElMessage.warning('保存失败');}) .finally(() => { saveLoading.value = false }) if (res) { + ElMessage.success('保存成功'); dialogVisible.value = false currentPage.value = 1 getList() diff --git a/src/views/dataset/CodeRepTarget/components/Write.vue b/src/views/dataset/CodeRepTarget/components/Write.vue index c51b00d..0769840 100644 --- a/src/views/dataset/CodeRepTarget/components/Write.vue +++ b/src/views/dataset/CodeRepTarget/components/Write.vue @@ -32,7 +32,7 @@ const formSchema = reactive([ label: '指标集代码', component: 'Input', componentProps: { - disabled:props.actionType == 'edit' + disabled:true }, }, { diff --git a/src/views/dataset/IndexClassMs/IndexClassMs.vue b/src/views/dataset/IndexClassMs/IndexClassMs.vue index 55ffb85..6a450fe 100644 --- a/src/views/dataset/IndexClassMs/IndexClassMs.vue +++ b/src/views/dataset/IndexClassMs/IndexClassMs.vue @@ -144,7 +144,7 @@ const tableColumns = reactive([ { field: 'action', label: t('tableDemo.action'), - width:160, + width:80, slots: { default: (data: any) => { return ( diff --git a/src/views/dataset/IndexSearchServiceMs/IndexSearchServiceMs.vue b/src/views/dataset/IndexSearchServiceMs/IndexSearchServiceMs.vue index f7e0b3c..8f39567 100644 --- a/src/views/dataset/IndexSearchServiceMs/IndexSearchServiceMs.vue +++ b/src/views/dataset/IndexSearchServiceMs/IndexSearchServiceMs.vue @@ -75,18 +75,13 @@ const { getList, getElTableExpose, delList, refresh } = tableMethods const tableColumns = reactive([ { - field: 'selection', - type: 'selection', - fixed: true + field: 'organName', + label: '机构名称' + }, + { + field: 'paramDate', + label: '数据日期' }, - { - field: 'organName', - label: '机构名称' - }, - { - field: 'paramDate', - label: '数据日期' - }, { field: 'indexSetCode', label: '指标集代码', @@ -117,10 +112,10 @@ const tableColumns = reactive([ field: 'frequency', label: '频度', slots:{ - default:(data)=>{ - return {data.row.frequency?frequency_param_LIST.value[data.row.frequency]?.label:''} - } - } + default:(data)=>{ + return {data.row.frequency?frequency_param_LIST.value[data.row.frequency]?.label:''} + } + } }, { field: 'indexValue', diff --git a/src/views/dataset/RepIndexSet/RepIndexSet.vue b/src/views/dataset/RepIndexSet/RepIndexSet.vue index 31bdd9f..9fb0cdd 100644 --- a/src/views/dataset/RepIndexSet/RepIndexSet.vue +++ b/src/views/dataset/RepIndexSet/RepIndexSet.vue @@ -280,11 +280,12 @@ const save = async () => { if (formData) { saveLoading.value = true const res = await saveRepIndexSetApi(formData) - .catch(() => {}) + .catch(() => {ElMessage.warning('保存失败');}) .finally(() => { saveLoading.value = false }) if (res) { + ElMessage.success(res.head.code == '0'?'保存成功':res.head.msg); dialogVisible.value = false currentPage.value = 1 getList() diff --git a/src/views/dataset/RepIndexSet/components/Write.vue b/src/views/dataset/RepIndexSet/components/Write.vue index 887cf5a..381968f 100644 --- a/src/views/dataset/RepIndexSet/components/Write.vue +++ b/src/views/dataset/RepIndexSet/components/Write.vue @@ -5,6 +5,9 @@ import { PropType, reactive, watch } from 'vue' import { useValidator } from '@/hooks/web/useValidator' import { getIndexType } from '@/api/dataset/RepIndexSet'; import { transfDictList } from '@/utils'; +import { + getRepDataModelListApi, +} from '@/api/dataset/RepDataModel' const { required } = useValidator() @@ -95,23 +98,34 @@ const formSchema = reactive([ filterable: true, // multiple: true, collapseTags: true, - showCheckbox: true, + // showCheckbox: true, style:{width:'100%'}, - checkOnClickNode: true, + // checkOnClickNode: true, }, component: 'TreeSelect', optionApi: async () => { - return props.indexTypeParam; } }, { field: 'modelCode', label: '数据模型编码', - component: 'Input', + component: 'Select', componentProps: { }, + optionApi:async ()=>{ + let res = await getRepDataModelListApi({}).then(item=>{ + return item.body.list; + }); + res = res.map(item=>{ + return { + label:item.modelCode, + value:item.modelCode + } + }) + return res; + } }, { field: 'createOrgan', diff --git a/src/views/dataset/RepSetRule/RepSetRule.vue b/src/views/dataset/RepSetRule/RepSetRule.vue index 90ae077..287f186 100644 --- a/src/views/dataset/RepSetRule/RepSetRule.vue +++ b/src/views/dataset/RepSetRule/RepSetRule.vue @@ -328,9 +328,8 @@ const exportExcel = async () => { --> - 导入 - 导出 + diff --git a/src/views/dataset/RepStoreMapping/RepStoreMapping.vue b/src/views/dataset/RepStoreMapping/RepStoreMapping.vue index 1fa7872..2407ad8 100644 --- a/src/views/dataset/RepStoreMapping/RepStoreMapping.vue +++ b/src/views/dataset/RepStoreMapping/RepStoreMapping.vue @@ -278,7 +278,7 @@ const onSelectionChange = (selection: TableData[]) => { /** 导出Excel */ const exportExcel = async () => { - const data = { ...unref(searchParams),fileName:'模型映射' } + const data = { ...unref(searchParams),fileName:'模型映射.xls' } await exportExcelApi(data) } @@ -304,7 +304,7 @@ const exportExcel = async () => { diff --git a/src/views/dataset/RepStoreParameter/RepStoreParameter.vue b/src/views/dataset/RepStoreParameter/RepStoreParameter.vue index e72a687..8028e81 100644 --- a/src/views/dataset/RepStoreParameter/RepStoreParameter.vue +++ b/src/views/dataset/RepStoreParameter/RepStoreParameter.vue @@ -259,7 +259,7 @@ const exportExcel = async () => { diff --git a/src/views/reporting/RepTemplate/RepTemplate.vue b/src/views/reporting/RepTemplate/RepTemplate.vue index 0bbe9d3..371f1b4 100644 --- a/src/views/reporting/RepTemplate/RepTemplate.vue +++ b/src/views/reporting/RepTemplate/RepTemplate.vue @@ -58,11 +58,6 @@ const { loading, dataList, total, currentPage, pageSize } = tableState const { getList, getElTableExpose, delList, refresh } = tableMethods const tableColumns = reactive([ - { - field: 'selection', - type: 'selection', - fixed: true - }, { field: 'tName', label: '名称', diff --git a/src/views/reporting/RepVariableManagement/RepVariableManagement.vue b/src/views/reporting/RepVariableManagement/RepVariableManagement.vue index 0adcd45..90758fb 100644 --- a/src/views/reporting/RepVariableManagement/RepVariableManagement.vue +++ b/src/views/reporting/RepVariableManagement/RepVariableManagement.vue @@ -47,11 +47,6 @@ const { loading, dataList, total, currentPage, pageSize } = tableState const { getList, getElTableExpose, delList, refresh } = tableMethods const tableColumns = reactive([ - { - field: 'selection', - type: 'selection', - fixed: true - }, { field: 'repCode', label: '报告编码' diff --git a/vite.config.ts b/vite.config.ts index 7cfd87d..ad1a1b3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -111,19 +111,22 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { proxy: { // 选项写法 '/api': { - target: 'http://localhost:8082/srdb', - // target: 'http://172.16.87.114:8095/ordb', + // target: 'http://localhost:8082/srdb', + target: 'http://172.16.87.114:8095/ordb', + // target: 'http://10.57.52.34:8095/ordb', changeOrigin: true, rewrite: path => path.replace(/^\/api/, '') }, '/pro': { - target: 'http://localhost:8082/srdb', - // target: 'http://172.16.87.114:8095/ordb', + // target: 'http://localhost:8082/srdb', + target: 'http://172.16.87.114:8095/ordb', + // target: 'http://10.57.52.34:8095/ordb', changeOrigin: true, rewrite: path => path.replace(/^\/pro/, '') }, '/dev': { target: 'http://172.16.87.114:8095/ordb', + // target: 'http://10.57.52.34:8095/ordb', changeOrigin: true, rewrite: path => path.replace(/^\/dev/, '') },