From 404ac293cb06a53c1db8609842641257cb7caa4b Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 21 Jul 2022 11:43:20 +0800 Subject: [PATCH 1/9] style: fix logo center --- yudao-ui-admin-vue3/src/components/Logo/src/Logo.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-ui-admin-vue3/src/components/Logo/src/Logo.vue b/yudao-ui-admin-vue3/src/components/Logo/src/Logo.vue index f7dffe27b..c446184e1 100644 --- a/yudao-ui-admin-vue3/src/components/Logo/src/Logo.vue +++ b/yudao-ui-admin-vue3/src/components/Logo/src/Logo.vue @@ -59,7 +59,7 @@ watch( :class="[ prefixCls, layout !== 'classic' ? `${prefixCls}__Top` : '', - 'flex !h-[var(--logo-height)] items-center cursor-pointer pl-8px relative', + 'flex !h-[var(--logo-height)] items-center cursor-pointer justify-center relative', 'dark:bg-[var(--el-bg-color)]' ]" to="/" From 882bbb2187f112d817b245cc8d4cdaa57a787ac1 Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 21 Jul 2022 11:43:35 +0800 Subject: [PATCH 2/9] fix: router --- yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue | 2 +- yudao-ui-admin-vue3/src/router/modules/remaining.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue b/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue index 1801e7078..47c48213d 100644 --- a/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue +++ b/yudao-ui-admin-vue3/src/components/UserInfo/src/UserInfo.vue @@ -43,7 +43,7 @@ const loginOut = () => { .catch(() => {}) } const toProfile = async () => { - push('/user/profile') + push('/userinfo/profile') } const toDocument = () => { window.open('https://doc.iocoder.cn/') diff --git a/yudao-ui-admin-vue3/src/router/modules/remaining.ts b/yudao-ui-admin-vue3/src/router/modules/remaining.ts index 56536fcf3..92f3a367e 100644 --- a/yudao-ui-admin-vue3/src/router/modules/remaining.ts +++ b/yudao-ui-admin-vue3/src/router/modules/remaining.ts @@ -41,7 +41,7 @@ const remainingRouter: AppRouteRecordRaw[] = [ ] }, { - path: '/user', + path: '/userinfo', component: Layout, name: 'UserInfo', meta: { From cb091d18530703fad0b28f3826411cc0eab0eb79 Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 21 Jul 2022 11:43:57 +0800 Subject: [PATCH 3/9] feat: redis api --- .../src/api/infra/redis/index.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/yudao-ui-admin-vue3/src/api/infra/redis/index.ts b/yudao-ui-admin-vue3/src/api/infra/redis/index.ts index 08f0016b6..e9265bd78 100644 --- a/yudao-ui-admin-vue3/src/api/infra/redis/index.ts +++ b/yudao-ui-admin-vue3/src/api/infra/redis/index.ts @@ -23,3 +23,21 @@ export const getKeyListApi = (keyTemplate: string) => { } }) } +// 获取缓存内容 +export const getKeyValue = (key: string) => { + return request.get({ url: '/infra/redis/get-key-value?key=' + key }) +} + +// 根据键名删除缓存 +export const deleteKey = (key: string) => { + return request.delete({ url: '/infra/redis/delete-key?key=' + key }) +} + +export const deleteKeys = (keyTemplate: string) => { + return request.delete({ + url: '/infra/redis/delete-keys?', + params: { + keyTemplate + } + }) +} From 22429140bdb72f522f85cdc17672fab472376392 Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 21 Jul 2022 15:02:15 +0800 Subject: [PATCH 4/9] fix: components i18n --- .../src/components/Form/src/helper.ts | 17 ++++------- yudao-ui-admin-vue3/src/config/axios/index.ts | 28 +++++++++++-------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/yudao-ui-admin-vue3/src/components/Form/src/helper.ts b/yudao-ui-admin-vue3/src/components/Form/src/helper.ts index 2f75322b0..b81409c7e 100644 --- a/yudao-ui-admin-vue3/src/components/Form/src/helper.ts +++ b/yudao-ui-admin-vue3/src/components/Form/src/helper.ts @@ -1,10 +1,8 @@ -// import { useI18n } from '@/hooks/web/useI18n' +import { useI18n } from '@/hooks/web/useI18n' import type { Slots } from 'vue' import { getSlot } from '@/utils/tsxHelper' import { PlaceholderMoel } from './types' -// const { t } = useI18n() - /** * * @param schema 对应组件数据 @@ -12,12 +10,12 @@ import { PlaceholderMoel } from './types' * @description 用于自动设置placeholder */ export const setTextPlaceholder = (schema: FormSchema): PlaceholderMoel => { + const { t } = useI18n() const textMap = ['Input', 'Autocomplete', 'InputNumber', 'InputPassword'] const selectMap = ['Select', 'TimePicker', 'DatePicker', 'TimeSelect', 'TimeSelect'] if (textMap.includes(schema?.component as string)) { return { - // placeholder: t('common.inputText') - placeholder: '请输入' + placeholder: t('common.inputText') } } if (selectMap.includes(schema?.component as string)) { @@ -29,16 +27,13 @@ export const setTextPlaceholder = (schema: FormSchema): PlaceholderMoel => { ) ) { return { - // startPlaceholder: t('common.startTimeText'), - // endPlaceholder: t('common.endTimeText'), - startPlaceholder: '开始时间', - endPlaceholder: '结束时间', + startPlaceholder: t('common.startTimeText'), + endPlaceholder: t('common.endTimeText'), rangeSeparator: '-' } } else { return { - // placeholder: t('common.selectText') - placeholder: '请选择' + placeholder: t('common.selectText') } } } diff --git a/yudao-ui-admin-vue3/src/config/axios/index.ts b/yudao-ui-admin-vue3/src/config/axios/index.ts index e7d1cebce..fe4b2a95a 100644 --- a/yudao-ui-admin-vue3/src/config/axios/index.ts +++ b/yudao-ui-admin-vue3/src/config/axios/index.ts @@ -5,7 +5,6 @@ import { config } from '@/config/axios/config' import { getAccessToken, getRefreshToken, getTenantId } from '@/utils/auth' import errorCode from './errorCode' import { useI18n } from '@/hooks/web/useI18n' -const { t } = useI18n() const tenantEnable = import.meta.env.VITE_APP_TENANT_ENABLE const BASE_URL = import.meta.env.VITE_BASE_URL @@ -46,25 +45,27 @@ service.interceptors.request.use( const tenantId = getTenantId() if (tenantId) (config as Recordable).headers.common['tenant-id'] = tenantId } + const params = config.params || {} + const data = config.data || false if ( - config.method === 'post' && + config.method?.toUpperCase() === 'POST' && config!.headers!['Content-Type'] === 'application/x-www-form-urlencoded' ) { - config.data = qs.stringify(config.data) + config.data = qs.stringify(data) } // get参数编码 - if (config.method === 'get' && config.params) { + if (config.method?.toUpperCase() === 'GET' && config.params) { let url = config.url as string - url += '?' - const keys = Object.keys(config.params) - for (const key of keys) { - if (config.params[key] !== void 0 && config.params[key] !== null) { - url += `${key}=${encodeURIComponent(config.params[key])}&` - } - } // 给 get 请求加上时间戳参数,避免从缓存中拿数据 // const now = new Date().getTime() - // url = url.substring(0, url.length - 1) + `?_t=${now}` + // params = params.substring(0, url.length - 1) + `?_t=${now}` + url += '?' + const keys = Object.keys(params) + for (const key of keys) { + if (params[key] !== void 0 && params[key] !== null) { + url += `${key}=${encodeURIComponent(params[key])}&` + } + } config.params = {} config.url = url } @@ -85,6 +86,7 @@ service.interceptors.response.use( // 返回“[HTTP]请求没有返回值”; throw new Error() } + const { t } = useI18n() // 未设置状态码则默认成功状态 const code = data.code || result_code // 获取错误信息 @@ -134,6 +136,7 @@ service.interceptors.response.use( (error: AxiosError) => { console.log('err' + error) // for debug let { message } = error + const { t } = useI18n() if (message === 'Network Error') { message = t('sys.api.errorMessage') } else if (message.includes('timeout')) { @@ -146,6 +149,7 @@ service.interceptors.response.use( } ) function handleAuthorized() { + const { t } = useI18n() if (!isRelogin.show) { isRelogin.show = true ElMessageBox.confirm(t('sys.api.timeoutMessage'), t('common.confirmTitle'), { From bc233df98035cee8e9791dc7825b797def02db47 Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 21 Jul 2022 15:07:04 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20vue3=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=8C=BA=E9=97=B4=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/core/query/LambdaQueryWrapperX.java | 13 +++++++++++++ .../admin/user/vo/user/UserPageReqVO.java | 4 ++++ .../system/dal/mysql/user/AdminUserMapper.java | 3 ++- .../src/views/system/user/user.data.ts | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java index 463db3038..d9ba7c4be 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java @@ -94,6 +94,19 @@ public class LambdaQueryWrapperX extends LambdaQueryWrapper { return this; } + public LambdaQueryWrapperX betweenIfPresent(SFunction column, Object[] values) { + if (values!= null && values.length >0 && values[0] != null && values[1] != null) { + return (LambdaQueryWrapperX) super.between(column, values[0], values[1]); + } + if (values != null && values[0] != null) { + return (LambdaQueryWrapperX) ge(column, values[0]); + } + if (values != null && values[1] != null) { + return (LambdaQueryWrapperX) le(column, values[2]); + } + return this; + } + // ========== 重写父类方法,方便链式调用 ========== @Override diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java index 00f20eb4d..ee539189e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java @@ -37,6 +37,10 @@ public class UserPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private Date endTime; + @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date[] createTime; + @ApiModelProperty(value = "部门编号", example = "1024", notes = "同时筛选子部门") private Long deptId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java index b7d5e3daa..353cffab5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java @@ -33,7 +33,8 @@ public interface AdminUserMapper extends BaseMapperX { .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername()) .likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile()) .eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) + .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getBeginTime(),reqVO.getEndTime()) + .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) .inIfPresent(AdminUserDO::getDeptId, deptIds) .orderByDesc(AdminUserDO::getId)); diff --git a/yudao-ui-admin-vue3/src/views/system/user/user.data.ts b/yudao-ui-admin-vue3/src/views/system/user/user.data.ts index 49d65e267..2039bc9fe 100644 --- a/yudao-ui-admin-vue3/src/views/system/user/user.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/user/user.data.ts @@ -101,7 +101,7 @@ const crudSchemas = reactive([ }, { label: t('common.createTime'), - field: 'daterange', + field: 'createTime', table: { show: false }, @@ -115,7 +115,7 @@ const crudSchemas = reactive([ show: true, component: 'DatePicker', componentProps: { - type: 'daterange', + type: 'datetimerange', valueFormat: 'YYYY-MM-DD HH:mm:ss' } } From 1b2c2b4257de303e32e24c397635a9e5f8d3b65f Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 21 Jul 2022 16:51:58 +0800 Subject: [PATCH 6/9] fix: datetimerange type error --- .../src/views/system/dept/index.vue | 5 ++- .../views/system/errorCode/errorCode.data.ts | 17 +------- .../views/system/loginlog/loginLog.data.ts | 17 +------- .../src/views/system/menu/index.vue | 20 +++++---- .../src/views/system/oauth2/client/index.vue | 12 +++++- .../src/views/system/operatelog/index.vue | 2 +- .../system/operatelog/operatelog.data.ts | 42 +++++++++---------- .../src/views/system/role/role.data.ts | 7 +++- .../system/sms/smsChannel/sms.channel.data.ts | 17 +------- .../views/system/sms/smsLog/sms.log.data.ts | 14 +------ .../sms/smsTemplate/sms.template.data.ts | 17 +------- 11 files changed, 62 insertions(+), 108 deletions(-) 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 1bef630bc..8f3c8fb93 100644 --- a/yudao-ui-admin-vue3/src/views/system/dept/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/dept/index.vue @@ -29,10 +29,10 @@ const formRef = ref() // ========== 创建部门树结构 ========== const filterText = ref('') -const deptOptions = ref([]) // 树形结构 +const deptOptions = ref() // 树形结构 const treeRef = ref>() const getTree = async () => { - const res = await DeptApi.listSimpleDeptApi() + const res = await DeptApi.getDeptPageApi(null) deptOptions.value = handleTree(res) } const filterNode = (value: string, data: Tree) => { @@ -118,6 +118,7 @@ onMounted(async () => { :highlight-current="true" default-expand-all :filter-node-method="filterNode" + :expand-on-click-node="false" >