From c35a260495e6e58f36a04fba966d0f9cc014ef0f Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Mon, 2 Oct 2023 15:14:01 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E2=80=9C=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86=E2=80=9D-=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=AF=BC=E5=87=BA-=E6=8C=89=E9=92=AE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=9A=84=E6=96=87=E4=BB=B6=E6=89=A9=E5=B1=95=E5=90=8D=E4=B8=BA?= =?UTF-8?q?xlsx=EF=BC=88SpringBoot=E5=90=8E=E5=8F=B0=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=98=AFxlsx=E6=A0=BC=E5=BC=8F=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=89=EF=BC=8C=E5=90=A6=E5=88=99excel?= =?UTF-8?q?=E6=89=93=E5=BC=80=E4=BC=9A=E6=8F=90=E7=A4=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/post/utils/hook.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/system/post/utils/hook.tsx b/src/views/system/post/utils/hook.tsx index 6349c81..8ba3bd3 100644 --- a/src/views/system/post/utils/hook.tsx +++ b/src/views/system/post/utils/hook.tsx @@ -162,7 +162,7 @@ export function usePostHook() { CommonUtils.fillPaginationParams(searchFormParams, pagination); CommonUtils.fillTimeRangeParams(searchFormParams, timeRange.value); - exportPostExcelApi(toRaw(searchFormParams), "岗位数据.xls"); + exportPostExcelApi(toRaw(searchFormParams), "岗位数据.xlsx"); } async function handleDelete(row) { From 1fc2fea75272cedd950919bf0d53b0a1cd50501e Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 3 Oct 2023 16:43:20 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E2=80=9C=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86=E2=80=9D-=E5=88=A0=E9=99=A4&?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4-=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E9=94=99=E8=AF=AF=EF=BC=9A=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=94=99=E8=AF=AF=EF=BC=88=E5=BA=94=E8=AF=A5=E6=98=AF=E4=BB=8E?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=97=A5=E5=BF=97=E6=8B=B7=E8=B4=9D=E8=BF=87?= =?UTF-8?q?=E6=9D=A5=E7=9A=84=E4=BB=A3=E7=A0=81=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=95=B4=EF=BC=89=EF=BC=8C=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E4=B9=9F=E5=81=9A=E4=BA=86=E5=AF=B9=E5=BA=94=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/post/utils/hook.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/system/post/utils/hook.tsx b/src/views/system/post/utils/hook.tsx index 8ba3bd3..1985291 100644 --- a/src/views/system/post/utils/hook.tsx +++ b/src/views/system/post/utils/hook.tsx @@ -166,8 +166,8 @@ export function usePostHook() { } async function handleDelete(row) { - await deletePostApi([row.logId]).then(() => { - message(`您删除了操作编号为${row.logId}的这条数据`, { + await deletePostApi([row.postId]).then(() => { + message(`您删除了编号为${row.postId}的这条岗位数据`, { type: "success" }); // 刷新列表 @@ -182,7 +182,7 @@ export function usePostHook() { } ElMessageBox.confirm( - `确认要删除编号为[ ${multipleSelection.value} ]的日志吗?`, + `确认要删除编号为[ ${multipleSelection.value} ]的岗位数据吗?`, "系统提示", { confirmButtonText: "确定", @@ -194,7 +194,7 @@ export function usePostHook() { ) .then(async () => { await deletePostApi(multipleSelection.value).then(() => { - message(`您删除了日志编号为[ ${multipleSelection.value} ]的数据`, { + message(`您删除了编号为[ ${multipleSelection.value} ]的岗位数据`, { type: "success" }); // 刷新列表 From 0217e53b872119cd8154c5b648eaea4e01aff66b Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 4 Oct 2023 23:28:54 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E2=80=9C=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86=E2=80=9D-=E6=9F=A5=E8=AF=A2+?= =?UTF-8?q?=E9=87=8D=E7=BD=AE+=E6=8E=92=E5=BA=8F=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/post/index.vue | 2 +- src/views/system/post/utils/hook.tsx | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index c080705..b0dec38 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -110,7 +110,7 @@ function openDialog(type: "add" | "update", row?: PostPageResponse) { type="primary" :icon="useRenderIcon(Search)" :loading="pageLoading" - @click="onSearch" + @click="onSearch(tableRef)" > 搜索 diff --git a/src/views/system/post/utils/hook.tsx b/src/views/system/post/utils/hook.tsx index 1985291..3c6d092 100644 --- a/src/views/system/post/utils/hook.tsx +++ b/src/views/system/post/utils/hook.tsx @@ -16,8 +16,8 @@ const statusMap = useUserStoreHook().dictionaryMap["common.status"]; export function usePostHook() { const defaultSort: Sort = { - prop: "createTime", - order: "descending" + prop: "post_sort", + order: "ascending" }; const pagination: PaginationProps = { @@ -80,6 +80,7 @@ export function usePostHook() { { label: "岗位排序", prop: "postSort", + sortable: "custom", minWidth: 120 }, { @@ -114,13 +115,18 @@ export function usePostHook() { function onSortChanged(sort: Sort) { sortState.value = sort; - onSearch(); + // 表格列的排序变化的时候,需要重置分页 + pagination.currentPage = 1; + getPostList(sort); } - async function onSearch() { - // 点击搜索的时候 需要重置分页 + async function onSearch(tableRef) { + // 点击搜索的时候,需要重置分页 pagination.currentPage = 1; - getPostList(); + // 点击搜索的时候,需要清空表格上列的排序 + tableRef.getTableRef().clearSort(); + // 使用默认排序发起请求 + getPostList(defaultSort); } function resetForm(formEl, tableRef) { @@ -134,9 +140,8 @@ export function usePostHook() { // Form组件的resetFields方法无法清除datepicker里面的数据。 searchFormParams.beginTime = undefined; searchFormParams.endTime = undefined; - tableRef.getTableRef().clearSort(); // 重置分页并查询 - onSearch(); + onSearch(tableRef); } async function getPostList(sort: Sort = defaultSort) { From 9563c073cf9411de5f23922ba147c3622f667af0 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 5 Oct 2023 00:41:14 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E2=80=9C=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86=E2=80=9D-pagination=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E3=80=81=E5=8F=98=E6=8D=A2page=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E6=97=B6=E6=8E=92=E5=BA=8F=E7=9A=84=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/post/utils/hook.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/views/system/post/utils/hook.tsx b/src/views/system/post/utils/hook.tsx index 3c6d092..264c9fe 100644 --- a/src/views/system/post/utils/hook.tsx +++ b/src/views/system/post/utils/hook.tsx @@ -16,7 +16,7 @@ const statusMap = useUserStoreHook().dictionaryMap["common.status"]; export function usePostHook() { const defaultSort: Sort = { - prop: "post_sort", + prop: "postSort", order: "ascending" }; @@ -117,7 +117,7 @@ export function usePostHook() { sortState.value = sort; // 表格列的排序变化的时候,需要重置分页 pagination.currentPage = 1; - getPostList(sort); + getPostList(); } async function onSearch(tableRef) { @@ -126,7 +126,7 @@ export function usePostHook() { // 点击搜索的时候,需要清空表格上列的排序 tableRef.getTableRef().clearSort(); // 使用默认排序发起请求 - getPostList(defaultSort); + getPostList(); } function resetForm(formEl, tableRef) { @@ -144,11 +144,9 @@ export function usePostHook() { onSearch(tableRef); } - async function getPostList(sort: Sort = defaultSort) { + async function getPostList() { pageLoading.value = true; - if (sort != null) { - CommonUtils.fillSortParams(searchFormParams, sort); - } + CommonUtils.fillSortParams(searchFormParams, sortState.value); CommonUtils.fillPaginationParams(searchFormParams, pagination); const { data } = await getPostListApi(toRaw(searchFormParams)).finally( From e07236ed1c8d03f0f2e36468af5345380a4c6542 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 5 Oct 2023 01:42:40 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E2=80=9C=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86=E2=80=9D-=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E3=80=81=E6=9F=A5=E8=AF=A2=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E7=BD=AE=E8=A1=A8=E6=A0=BC=E5=88=B0=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=8E=92=E5=BA=8F=EF=BC=8C=E5=B9=B6=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=95=B0=E6=8D=AE=EF=BC=8C=E4=BD=BF=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E4=B8=8A=E7=9A=84=E5=88=97=E6=8E=92=E5=BA=8F=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E4=BF=9D=E6=8C=81=E2=80=9C=E9=BB=98=E8=AE=A4=3D?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E7=BC=96=E7=A0=81=E5=8D=87=E5=BA=8F=E2=80=9D?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/post/utils/hook.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/views/system/post/utils/hook.tsx b/src/views/system/post/utils/hook.tsx index 264c9fe..ca20ec7 100644 --- a/src/views/system/post/utils/hook.tsx +++ b/src/views/system/post/utils/hook.tsx @@ -121,21 +121,14 @@ export function usePostHook() { } async function onSearch(tableRef) { - // 点击搜索的时候,需要重置分页 - pagination.currentPage = 1; - // 点击搜索的时候,需要清空表格上列的排序 - tableRef.getTableRef().clearSort(); - // 使用默认排序发起请求 - getPostList(); + // 点击搜索的时候,需要重置排序,重新排序的时候会重置分页并发起查询请求 + tableRef.getTableRef().sort("postSort", "ascending"); } function resetForm(formEl, tableRef) { if (!formEl) return; // 清空查询参数 formEl.resetFields(); - // 清空排序 - searchFormParams.orderColumn = undefined; - searchFormParams.orderDirection = undefined; // 清空时间查询 TODO 这块有点繁琐 有可以优化的地方吗? // Form组件的resetFields方法无法清除datepicker里面的数据。 searchFormParams.beginTime = undefined;