From 877254af10c1a515ab93889ae9f94c29973e85c8 Mon Sep 17 00:00:00 2001 From: xingyu Date: Mon, 25 Jul 2022 22:54:12 +0800 Subject: [PATCH 1/4] fix: useTable warning --- .../src/api/system/dept/index.ts | 4 +-- .../src/api/system/dept/types.ts | 5 ++++ .../src/api/system/dict/dict.data.ts | 6 ++--- .../src/api/system/dict/dict.type.ts | 6 ++--- .../src/api/system/dict/types.ts | 25 +++++++++++++++++++ .../src/api/system/post/index.ts | 6 ++--- .../src/api/system/post/types.ts | 12 +++++++++ yudao-ui-admin-vue3/src/hooks/web/useTable.ts | 20 +++++++-------- .../src/views/system/dict/dict.type.ts | 22 ++++++++++++++++ .../src/views/system/post/index.vue | 2 +- .../src/views/system/user/user.data.ts | 2 +- 11 files changed, 87 insertions(+), 23 deletions(-) diff --git a/yudao-ui-admin-vue3/src/api/system/dept/index.ts b/yudao-ui-admin-vue3/src/api/system/dept/index.ts index 4bcb2db8e..48d3b949c 100644 --- a/yudao-ui-admin-vue3/src/api/system/dept/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/dept/index.ts @@ -1,5 +1,5 @@ import { useAxios } from '@/hooks/web/useAxios' -import type { DeptVO } from './types' +import type { DeptVO, DeptListReqVO } from './types' const request = useAxios() @@ -9,7 +9,7 @@ export const listSimpleDeptApi = () => { } // 查询部门列表 -export const getDeptPageApi = (params) => { +export const getDeptPageApi = (params: DeptListReqVO) => { return request.get({ url: '/system/dept/list', params }) } 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 f3b2ddd43..3151c610f 100644 --- a/yudao-ui-admin-vue3/src/api/system/dept/types.ts +++ b/yudao-ui-admin-vue3/src/api/system/dept/types.ts @@ -5,3 +5,8 @@ export type DeptVO = { parentId: number createTime: string } + +export type DeptListReqVO = { + name: string + status: number +} diff --git a/yudao-ui-admin-vue3/src/api/system/dict/dict.data.ts b/yudao-ui-admin-vue3/src/api/system/dict/dict.data.ts index a78373336..dd9e9ec88 100644 --- a/yudao-ui-admin-vue3/src/api/system/dict/dict.data.ts +++ b/yudao-ui-admin-vue3/src/api/system/dict/dict.data.ts @@ -1,5 +1,5 @@ import { useAxios } from '@/hooks/web/useAxios' -import type { DictDataVO } from './types' +import type { DictDataVO, DictDataPageReqVO, DictDataExportReqVO } from './types' const request = useAxios() @@ -9,7 +9,7 @@ export const listSimpleDictDataApi = () => { } // 查询字典数据列表 -export const getDictDataPageApi = (params) => { +export const getDictDataPageApi = (params: DictDataPageReqVO) => { return request.get({ url: '/system/dict-data/page', params }) } @@ -33,6 +33,6 @@ export const deleteDictDataApi = (id: number) => { return request.delete({ url: '/system/dict-data/delete?id=' + id }) } // 导出字典类型数据 -export const exportDictDataApi = (params: DictDataVO) => { +export const exportDictDataApi = (params: DictDataExportReqVO) => { return request.get({ url: '/system/dict-data/export', params }) } diff --git a/yudao-ui-admin-vue3/src/api/system/dict/dict.type.ts b/yudao-ui-admin-vue3/src/api/system/dict/dict.type.ts index 4f278f326..7c2475c5d 100644 --- a/yudao-ui-admin-vue3/src/api/system/dict/dict.type.ts +++ b/yudao-ui-admin-vue3/src/api/system/dict/dict.type.ts @@ -1,5 +1,5 @@ import { useAxios } from '@/hooks/web/useAxios' -import type { DictTypeVO } from './types' +import type { DictTypeVO, DictTypePageReqVO, DictTypeExportReqVO } from './types' const request = useAxios() @@ -9,7 +9,7 @@ export const listSimpleDictTypeApi = () => { } // 查询字典列表 -export const getDictTypePageApi = (params) => { +export const getDictTypePageApi = (params: DictTypePageReqVO) => { return request.get({ url: '/system/dict-type/page', params }) } @@ -33,6 +33,6 @@ export const deleteDictTypeApi = (id: number) => { return request.delete({ url: '/system/dict-type/delete?id=' + id }) } // 导出字典类型 -export const exportDictTypeApi = (params: DictTypeVO) => { +export const exportDictTypeApi = (params: DictTypeExportReqVO) => { return request.get({ url: '/system/dict-type/export', params }) } diff --git a/yudao-ui-admin-vue3/src/api/system/dict/types.ts b/yudao-ui-admin-vue3/src/api/system/dict/types.ts index 8bb735b69..3b5893833 100644 --- a/yudao-ui-admin-vue3/src/api/system/dict/types.ts +++ b/yudao-ui-admin-vue3/src/api/system/dict/types.ts @@ -7,6 +7,20 @@ export type DictTypeVO = { createTime: string } +export type DictTypePageReqVO = { + name: string + type: string + status: number + createTime: [] +} + +export type DictTypeExportReqVO = { + name: string + type: string + status: number + createTime: [] +} + export type DictDataVO = { id: number sort: number @@ -19,3 +33,14 @@ export type DictDataVO = { remark: string createTime: string } +export type DictDataPageReqVO = { + label: string + dictType: string + status: number +} + +export type DictDataExportReqVO = { + label: string + dictType: string + status: number +} diff --git a/yudao-ui-admin-vue3/src/api/system/post/index.ts b/yudao-ui-admin-vue3/src/api/system/post/index.ts index 40eb9705a..e2703d08d 100644 --- a/yudao-ui-admin-vue3/src/api/system/post/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/post/index.ts @@ -1,10 +1,10 @@ import { useAxios } from '@/hooks/web/useAxios' -import type { PostVO } from './types' +import type { PostVO, PostPageReqVO, PostExportReqVO } from './types' const request = useAxios() // 查询岗位列表 -export const getPostPageApi = async (params) => { +export const getPostPageApi = async (params: PostPageReqVO) => { return await request.get({ url: '/system/post/page', params }) } @@ -33,6 +33,6 @@ export const deletePostApi = async (id: number) => { } // 导出岗位 -export const exportPostApi = async (params) => { +export const exportPostApi = async (params: PostExportReqVO) => { return await request.download({ url: '/system/post/export', params }) } diff --git a/yudao-ui-admin-vue3/src/api/system/post/types.ts b/yudao-ui-admin-vue3/src/api/system/post/types.ts index 893b820b7..261553514 100644 --- a/yudao-ui-admin-vue3/src/api/system/post/types.ts +++ b/yudao-ui-admin-vue3/src/api/system/post/types.ts @@ -7,3 +7,15 @@ export type PostVO = { remark: string createTime: string } + +export type PostPageReqVO = { + code: string + name: string + status: number +} + +export type PostExportReqVO = { + code: string + name: string + status: number +} diff --git a/yudao-ui-admin-vue3/src/hooks/web/useTable.ts b/yudao-ui-admin-vue3/src/hooks/web/useTable.ts index 0b3ab4f2c..7fdd04fa4 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useTable.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useTable.ts @@ -1,14 +1,14 @@ import download from '@/utils/download' import { Table, TableExpose } from '@/components/Table' -import { ElTable, ElMessageBox, ElMessage } from 'element-plus' -import { ref, reactive, watch, computed, unref, nextTick } from 'vue' +import { ElMessage, ElMessageBox, ElTable } from 'element-plus' +import { computed, nextTick, reactive, ref, unref, watch } from 'vue' import type { TableProps } from '@/components/Table/src/types' import { useI18n } from '@/hooks/web/useI18n' const { t } = useI18n() interface ResponseType { list: T[] - total?: string + total?: number } interface UseTableConfig { @@ -114,15 +114,13 @@ export const useTable = (config?: UseTableConfig) => { ElMessage.success(t('common.delSuccess')) // 计算出临界点 - const currentPage = + tableObject.currentPage = tableObject.total % tableObject.pageSize === idsLength || tableObject.pageSize === 1 ? tableObject.currentPage > 1 ? tableObject.currentPage - 1 : tableObject.currentPage : tableObject.currentPage - - tableObject.currentPage = currentPage - methods.getList() + await methods.getList() } const methods = { @@ -132,8 +130,10 @@ export const useTable = (config?: UseTableConfig) => { tableObject.loading = false }) if (res) { - tableObject.tableList = res?.list - tableObject.total = res?.total + tableObject.tableList = (res as unknown as ResponseType).list + if ((res as unknown as ResponseType).total) { + tableObject.total = (res as unknown as ResponseType).total as unknown as number + } } }, setProps: async (props: TableProps = {}) => { @@ -194,7 +194,7 @@ export const useTable = (config?: UseTableConfig) => { .then(async () => { const res = await config?.exportListApi?.(unref(paramsObj) as unknown as T) if (res) { - download.excel(res, fileName) + download.excel(res as unknown as Blob, fileName) } }) .finally(() => { diff --git a/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts b/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts index a243ab9da..2328ddd03 100644 --- a/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts +++ b/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts @@ -42,6 +42,28 @@ const crudSchemas = reactive([ field: 'status', dictType: DICT_TYPE.COMMON_STATUS }, + { + label: t('common.createTime'), + field: 'createTime', + table: { + show: false + }, + form: { + show: false + }, + detail: { + 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('form.remark'), field: 'remark', diff --git a/yudao-ui-admin-vue3/src/views/system/post/index.vue b/yudao-ui-admin-vue3/src/views/system/post/index.vue index d624d3de6..ce9e9c3c7 100644 --- a/yudao-ui-admin-vue3/src/views/system/post/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/post/index.vue @@ -21,7 +21,7 @@ const { getList, setSearchParams, delList, exportList } = methods // 导出操作 const handleExport = async () => { - await exportList('用户数据.xls') + await exportList('岗位数据.xls') } // ========== CRUD 相关 ========== 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 b3e0dcb62..2cbe8a4d3 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 @@ -115,7 +115,7 @@ const crudSchemas = reactive([ show: true, component: 'DatePicker', componentProps: { - type: 'daterange', + 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)] } From 59258f1a1db0a0aaddc5af107afbfe82b5ca23e7 Mon Sep 17 00:00:00 2001 From: xingyu Date: Mon, 25 Jul 2022 23:17:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20Druid=E5=8D=87=E7=BA=A7=E8=87=B31.2?= =?UTF-8?q?.11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index ec480e2a9..f81785926 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -22,7 +22,7 @@ 1.6.6 2.5 - 1.2.8 + 1.2.11 3.5.2 3.5.2 3.5.0 From 602149482a37567e45220c01cb5c397dd285cf17 Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 26 Jul 2022 09:32:56 +0800 Subject: [PATCH 3/4] =?UTF-8?q?chore:=20=E5=8D=87=E7=BA=A7=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-dependencies/pom.xml | 3 +-- yudao-ui-admin-vue3/package.json | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index f81785926..a05d671da 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -16,7 +16,7 @@ 1.6.2-snapshot - 2.6.9 + 2.6.10 3.0.3 1.6.6 @@ -29,7 +29,6 @@ 3.17.4 1.9.2 - 2.2.0 1.7.1 diff --git a/yudao-ui-admin-vue3/package.json b/yudao-ui-admin-vue3/package.json index 933a2db3a..8cc567bab 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.30.7", - "@typescript-eslint/parser": "^5.30.7", + "@typescript-eslint/eslint-plugin": "^5.31.0", + "@typescript-eslint/parser": "^5.31.0", "@vitejs/plugin-vue": "^3.0.1", "@vitejs/plugin-vue-jsx": "^2.0.0", "autoprefixer": "^10.4.7", From 383e5db997a1c15dac94c6c5e96a295b4a77e6bc Mon Sep 17 00:00:00 2001 From: xingyu Date: Tue, 26 Jul 2022 09:36:16 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E9=80=89=E6=8B=A9=E7=BB=84=E4=BB=B6=20=E8=BF=91?= =?UTF-8?q?=E4=B8=80=E5=91=A8=20=E8=BF=91=E4=B8=80=E4=B8=AA=E6=9C=88?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/user/user.data.ts | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) 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 2cbe8a4d3..0119f0e41 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 @@ -117,7 +117,36 @@ const crudSchemas = reactive([ 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)] + defaultTime: [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)], + shortcuts: [ + { + text: '近一周', + value: () => { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) + return [start, end] + } + }, + { + text: '近一个月', + value: () => { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) + return [start, end] + } + }, + { + text: '近三个月', + value: () => { + const end = new Date() + const start = new Date() + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) + return [start, end] + } + } + ] } } },