From 40c92a9ea2269e9b34b305d9663419004aaa5dfa Mon Sep 17 00:00:00 2001 From: xingyu Date: Mon, 1 Aug 2022 21:05:42 +0800 Subject: [PATCH 01/10] perf: dept --- .../src/api/system/dept/types.ts | 7 +++-- .../src/views/system/dept/dept.data.ts | 4 +-- .../src/views/system/dept/index.vue | 28 ++++++++++++++++--- .../src/views/system/user/index.vue | 20 +++++++------ 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/yudao-ui-admin-vue3/src/api/system/dept/types.ts b/yudao-ui-admin-vue3/src/api/system/dept/types.ts index 3151c610f..470fcd3d8 100644 --- a/yudao-ui-admin-vue3/src/api/system/dept/types.ts +++ b/yudao-ui-admin-vue3/src/api/system/dept/types.ts @@ -1,9 +1,12 @@ export type DeptVO = { id: number name: string - status: number parentId: number - createTime: string + status: number + sort: number + leaderUserId: number + phone: string + email: string } export type DeptListReqVO = { diff --git a/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts b/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts index 1a66624d3..0116a6463 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts @@ -17,7 +17,7 @@ export const modelSchema = reactive([ }, { label: '负责人', - field: 'email', + field: 'leaderUserId', component: 'Input' }, { @@ -33,7 +33,7 @@ export const modelSchema = reactive([ { label: '显示排序', field: 'sort', - component: 'Input' + component: 'InputNumber' }, { label: '状态', diff --git a/yudao-ui-admin-vue3/src/views/system/dept/index.vue b/yudao-ui-admin-vue3/src/views/system/dept/index.vue index b956eb6a1..020e38d89 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/dept/index.vue @@ -1,6 +1,6 @@ + - + @@ -491,14 +492,15 @@ getList() - - - + From fa79f4226e4ffff387ce011f83011de8222941d6 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 2 Aug 2022 09:54:46 +0800 Subject: [PATCH 02/10] chore: update deps --- yudao-ui-admin-vue3/package.json | 6 +++--- yudao-ui-admin-vue3/vite.config.ts | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/yudao-ui-admin-vue3/package.json b/yudao-ui-admin-vue3/package.json index 4e7ebb03e..c221f0d68 100644 --- a/yudao-ui-admin-vue3/package.json +++ b/yudao-ui-admin-vue3/package.json @@ -65,8 +65,8 @@ "@types/nprogress": "^0.2.0", "@types/qrcode": "^1.4.2", "@types/qs": "^6.9.7", - "@typescript-eslint/eslint-plugin": "^5.31.0", - "@typescript-eslint/parser": "^5.31.0", + "@typescript-eslint/eslint-plugin": "^5.32.0", + "@typescript-eslint/parser": "^5.32.0", "@vitejs/plugin-vue": "^3.0.1", "@vitejs/plugin-vue-jsx": "^2.0.0", "autoprefixer": "^10.4.8", @@ -91,7 +91,7 @@ "stylelint-config-standard": "^26.0.0", "stylelint-order": "^5.0.0", "typescript": "4.7.4", - "unplugin-vue-define-options": "^0.6.2", + "unplugin-vue-define-options": "^0.7.1", "vite": "3.0.4", "vite-plugin-compression": "^0.5.1", "vite-plugin-eslint": "^1.7.0", diff --git a/yudao-ui-admin-vue3/vite.config.ts b/yudao-ui-admin-vue3/vite.config.ts index 835c7e9f3..ef8ffe395 100644 --- a/yudao-ui-admin-vue3/vite.config.ts +++ b/yudao-ui-admin-vue3/vite.config.ts @@ -138,6 +138,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { 'vue-router', 'vue-types', 'vue-i18n', + 'element-plus/es', 'element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/en', '@iconify/iconify', From 93a97cd52635423db6dde8bfa908f851962d5d50 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 2 Aug 2022 10:19:02 +0800 Subject: [PATCH 03/10] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E6=A0=A1=E9=AA=8C=E5=92=8C=E6=9F=A5=E8=AF=A2=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin-vue3/src/utils/tree.ts | 4 ++-- .../infra/apiAccessLog/apiAccessLog.data.ts | 11 ++++++++++- .../views/infra/apiErrorLog/apiErrorLog.data.ts | 11 ++++++++++- .../src/views/infra/codegen/codegen.data.ts | 9 +++++++++ .../src/views/infra/config/config.data.ts | 9 +++++++++ .../dataSourceConfig/dataSourceConfig.data.ts | 9 +++++++++ .../views/infra/fileConfig/fileConfig.data.ts | 9 +++++++++ .../src/views/infra/fileList/fileList.data.ts | 9 +++++++++ .../src/views/pay/app/app.data.ts | 16 +++++++++++++--- .../src/views/pay/merchant/merchant.data.ts | 13 +++++++++++-- .../src/views/pay/order/order.data.ts | 16 ++++++++++++++++ .../src/views/pay/refund/refund.data.ts | 9 +++++++++ .../src/views/system/dept/dept.data.ts | 14 ++++++++++++++ .../src/views/system/dept/index.vue | 4 ++-- .../src/views/system/dict/dict.data.ts | 4 ++-- .../src/views/system/menu/index.vue | 17 +++++++++-------- .../src/views/system/notice/notice.data.ts | 3 +-- .../src/views/system/post/post.data.ts | 3 +-- .../system/sms/smsTemplate/sms.template.data.ts | 7 +++---- .../src/views/system/user/index.vue | 2 +- .../src/views/system/user/user.data.ts | 12 +++++++++++- yudao-ui-admin/src/views/system/dept/index.vue | 2 +- .../src/views/system/tenant/index.vue | 2 -- 23 files changed, 161 insertions(+), 34 deletions(-) diff --git a/yudao-ui-admin-vue3/src/utils/tree.ts b/yudao-ui-admin-vue3/src/utils/tree.ts index a82fb1c27..76ec0a2e1 100644 --- a/yudao-ui-admin-vue3/src/utils/tree.ts +++ b/yudao-ui-admin-vue3/src/utils/tree.ts @@ -213,7 +213,7 @@ export const eachTree = (treeDatas: any[], callBack: Fn, parentNode = {}) => { * @param {*} parentId 父节点字段 默认 'parentId' * @param {*} children 孩子节点字段 默认 'children' */ -export const handleTree = (data, id?: string, parentId?: string, children?: string) => { +export const handleTree = (data: any[], id?: string, parentId?: string, children?: string) => { const config = { id: id || 'id', parentId: parentId || 'parentId', @@ -222,7 +222,7 @@ export const handleTree = (data, id?: string, parentId?: string, children?: stri const childrenListMap = {} const nodeIds = {} - const tree = [] + const tree: any[] = [] for (const d of data) { const parentId = d[config.parentId] diff --git a/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts b/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts index 97fae4357..69423dd9d 100644 --- a/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts @@ -50,7 +50,16 @@ const crudSchemas = reactive([ }, { label: '请求时间', - field: 'beginTime' + field: 'beginTime', + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } + } }, { label: '执行时长', diff --git a/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts b/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts index 8ded13e8e..404262be5 100644 --- a/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts @@ -50,7 +50,16 @@ const crudSchemas = reactive([ }, { label: '异常发生时间', - field: 'exceptionTime' + field: 'exceptionTime', + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } + } }, { label: '异常名', diff --git a/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts b/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts index 5253c9636..27e49ff31 100644 --- a/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/codegen/codegen.data.ts @@ -50,6 +50,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts b/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts index c040d4fe3..425918d15 100644 --- a/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts @@ -91,6 +91,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts b/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts index 2d5869f2a..4431c0c45 100644 --- a/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/dataSourceConfig/dataSourceConfig.data.ts @@ -58,6 +58,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts b/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts index 6dd5e5e4a..b2383346f 100644 --- a/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts @@ -76,6 +76,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts b/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts index 6984e693e..e203fd4cf 100644 --- a/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts @@ -36,6 +36,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts b/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts index 652da6359..544428cba 100644 --- a/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts @@ -8,9 +8,10 @@ const { t } = useI18n() // 国际化 // 表单校验 export const rules = reactive({ name: [required], - code: [required], - sort: [required], - status: [required] + status: [required], + payNotifyUrl: [required], + refundNotifyUrl: [required], + merchantId: [required] }) // CrudSchema @@ -53,6 +54,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts b/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts index 7db448ea9..53a2dc581 100644 --- a/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts @@ -7,9 +7,9 @@ const { t } = useI18n() // 国际化 // 表单校验 export const rules = reactive({ + no: [required], name: [required], - code: [required], - sort: [required], + shortName: [required], status: [required] }) @@ -77,6 +77,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts b/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts index e16b9979f..8cdf1c9b0 100644 --- a/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts @@ -157,6 +157,22 @@ const crudSchemas = reactive([ label: '渠道订单号', field: 'channelOrderNo' }, + { + label: t('common.createTime'), + field: 'createTime', + form: { + show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } + } + }, { label: t('table.action'), field: 'action', diff --git a/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts b/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts index 19c8e8ec9..6d1fef177 100644 --- a/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts @@ -84,6 +84,15 @@ const crudSchemas = reactive([ field: 'createTime', form: { show: false + }, + search: { + show: true, + component: 'DatePicker', + componentProps: { + type: 'datetimerange', + valueFormat: 'YYYY-MM-DD HH:mm:ss', + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)] + } } }, { diff --git a/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts b/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts index 0116a6463..ad6458699 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/dept/dept.data.ts @@ -1,5 +1,19 @@ import { required } from '@/utils/formRules' import { reactive } from 'vue' +// 表单校验 +export const rules = reactive({ + name: [required], + sort: [required], + email: [required], + phone: [ + { + pattern: + /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/, + trigger: 'blur', + message: '请输入正确的手机号码' + } + ] +}) export const modelSchema = reactive([ { diff --git a/yudao-ui-admin-vue3/src/views/system/dept/index.vue b/yudao-ui-admin-vue3/src/views/system/dept/index.vue index 020e38d89..5dcbd10b5 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/dept/index.vue @@ -5,7 +5,7 @@ import { handleTree } from '@/utils/tree' import { onMounted, ref, unref, watch } from 'vue' import * as DeptApi from '@/api/system/dept' import { Form, FormExpose } from '@/components/Form' -import { modelSchema } from './dept.data' +import { modelSchema, rules } from './dept.data' import { DeptVO } from '@/api/system/dept/types' import { useMessage } from '@/hooks/web/useMessage' import { getListSimpleUsersApi } from '@/api/system/user' @@ -159,7 +159,7 @@ onMounted(async () => {
-
+