bug 修改 修改路由模式

This commit is contained in:
扈兆增 2026-05-05 22:38:24 +08:00
parent 2342a3555e
commit afb041ea9f
12 changed files with 36 additions and 54 deletions

View File

@ -63,6 +63,9 @@ const page = ref(1);
const size = ref(props.defaultPageSize); const size = ref(props.defaultPageSize);
const selectedRowKeys = ref<string[]>([]); const selectedRowKeys = ref<string[]>([]);
const selectedRows = ref<any[]>([]); const selectedRows = ref<any[]>([]);
//使 filter
const lastFilter = ref<Record<string, any> | undefined>(undefined);
// //
const scrollConfig = computed(() => ({ const scrollConfig = computed(() => ({
@ -100,13 +103,17 @@ const paginationConfig = computed(() => ({
*/ */
const getList = async (filter?: Record<string, any>) => { const getList = async (filter?: Record<string, any>) => {
loading.value = true; loading.value = true;
// filter
if (filter !== undefined) {
lastFilter.value = filter;
}
try { try {
// //
const params = { const params = {
...props.searchParams, ...props.searchParams,
skip: page.value, skip: page.value,
take: size.value, take: size.value,
filter: filter, filter: lastFilter.value,
// skip/take // skip/take
// skip: (page.value - 1) * size.value, // skip: (page.value - 1) * size.value,

View File

@ -11,7 +11,6 @@ import Sidebar from "./Sidebar/index.vue";
import { useTagsViewStore } from "@/store/modules/tagsView"; import { useTagsViewStore } from "@/store/modules/tagsView";
import { useUserStore } from "@/store/modules/user"; import { useUserStore } from "@/store/modules/user";
import {getPath,removePath } from '@/utils/auth';
// const url = import.meta.env.VITE_APP_BASE_API; // const url = import.meta.env.VITE_APP_BASE_API;
@ -32,9 +31,7 @@ function logout() {
tagsViewStore.delAllViews(); tagsViewStore.delAllViews();
}) })
.then(() => { .then(() => {
// router.push(`/login?redirect=${route.fullPath}`); router.push(`/login`);
router.push(`${getPath()}?redirect=${route.fullPath}`);
removePath()
}); });
}); });
} }

View File

@ -80,7 +80,7 @@ router.beforeEach(async (to, from, next) => {
} catch (error) { } catch (error) {
console.log(error); console.log(error);
await userStore.resetToken(); await userStore.resetToken();
next(`/login?redirect=${to.path}`); next(`/login`);
NProgress.done(); NProgress.done();
} }
} }
@ -91,7 +91,7 @@ router.beforeEach(async (to, from, next) => {
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
next(); next();
} else { } else {
next(`/login?redirect=${to.path}`); next(`/login`);
NProgress.done(); NProgress.done();
} }
} }

View File

@ -1,4 +1,4 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'; import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import { usePermissionStoreHook } from '@/store/modules/permission'; import { usePermissionStoreHook } from '@/store/modules/permission';
export const Layout = () => import('@/layout/index.vue'); export const Layout = () => import('@/layout/index.vue');
@ -45,7 +45,7 @@ export const constantRoutes: RouteRecordRaw[] = [
// 创建路由 // 创建路由
const router = createRouter({ const router = createRouter({
history: createWebHashHistory(), history: createWebHistory(),
routes: constantRoutes as RouteRecordRaw[], routes: constantRoutes as RouteRecordRaw[],
// 刷新时,滚动条位置还原 // 刷新时,滚动条位置还原
scrollBehavior: () => ({ left: 0, top: 0 }) scrollBehavior: () => ({ left: 0, top: 0 })

View File

@ -1,16 +1,4 @@
.ant-model { .ant-modal {
.ant-modal-content {
border-radius: 2px;
}
.ant-modal-header {
padding: 16px 24px;
color: rgba(0, 0, 0, 0.85);
border-bottom: 1px solid #f0f0f0;
border-radius: 2px 2px 0 0;
background-color: #005293;
}
}
:where(.css-dev-only-do-not-override-ekaqbe).ant-modal {
.ant-modal-content { .ant-modal-content {
border-radius: 2px; border-radius: 2px;
padding: 0 !important; padding: 0 !important;
@ -37,7 +25,7 @@
} }
} }
} }
:where(.css-dev-only-do-not-override-ekaqbe).ant-btn > span { .ant-btn > span {
display: inline-flex; display: inline-flex;
} }
.ant-image-preview-root { .ant-image-preview-root {

View File

@ -13,12 +13,3 @@ export function setToken(token: any) {
export function removeToken() { export function removeToken() {
return Cookies.remove(TokenKey); return Cookies.remove(TokenKey);
} }
export function setPath(path:any) {
Cookies.set(PathKey,path);
}
export function getPath() {
return Cookies.get(PathKey);
}
export function removePath() {
return Cookies.remove(PathKey);
}

View File

@ -187,7 +187,7 @@ import loginImg from "@/assets/images/logo.png";
import { UserOutlined, LockOutlined, MobileOutlined } from "@ant-design/icons-vue"; import { UserOutlined, LockOutlined, MobileOutlined } from "@ant-design/icons-vue";
import { getCaptcha, sendSmsCode, smsLoginApi, resetPassword } from "@/api/auth"; import { getCaptcha, sendSmsCode, smsLoginApi, resetPassword } from "@/api/auth";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import { setPath, setToken } from "@/utils/auth"; import { setToken } from "@/utils/auth";
// //
import router from "@/router"; import router from "@/router";
@ -371,7 +371,6 @@ function onFinish() {
userStore userStore
.login(user) .login(user)
.then(() => { .then(() => {
setPath("/login-sjtb");
router.push({ path: "/" }); router.push({ path: "/" });
state.loading = false; state.loading = false;
message.success("登录成功"); message.success("登录成功");
@ -457,7 +456,6 @@ const onSmsLogin = async () => {
}); });
// ========== ========== // ========== ==========
setPath("/login-sjtb");
router.push({ path: accessRoutes[0].children[0].opturl }); router.push({ path: accessRoutes[0].children[0].opturl });
message.success("登录成功"); message.success("登录成功");

View File

@ -240,7 +240,6 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { setPath } from '@/utils/auth';
import { onMounted, reactive, ref, toRefs, watch } from "vue"; import { onMounted, reactive, ref, toRefs, watch } from "vue";
import loginImg from "@/assets/images/logo.png"; import loginImg from "@/assets/images/logo.png";
import { UserOutlined, LockOutlined, MobileOutlined } from "@ant-design/icons-vue"; import { UserOutlined, LockOutlined, MobileOutlined } from "@ant-design/icons-vue";
@ -363,7 +362,6 @@ function onFinish() {
.login(user) .login(user)
.then(() => { .then(() => {
router.push({ path: "/" }); router.push({ path: "/" });
setPath('/login')
state.loading = false; state.loading = false;
}) })
.catch(() => { .catch(() => {

View File

@ -557,7 +557,7 @@ const onRegister = async () => {
// //
setTimeout(() => { setTimeout(() => {
router.push({ path: "/login-sjtb" }); router.push({ path: "/login" });
}, 1500); }, 1500);
} catch (error: any) { } catch (error: any) {
@ -574,7 +574,7 @@ const onRegister = async () => {
// //
const backToLogin = () => { const backToLogin = () => {
router.push({ path: "/login-sjtb" }); router.push({ path: "/login" });
}; };
// //

View File

@ -164,6 +164,8 @@
v-model:value="formData.fcnt" v-model:value="formData.fcnt"
style="width: 100%" style="width: 100%"
placeholder="数量" placeholder="数量"
:step="1"
:precision="0"
:min="0" :min="0"
:disabled="isView" :disabled="isView"
/> />
@ -234,7 +236,6 @@
v-model:value="formData.wt" v-model:value="formData.wt"
style="width: 100%" style="width: 100%"
placeholder="水温" placeholder="水温"
:min="0"
:disabled="isView" :disabled="isView"
/> />
</a-form-item> </a-form-item>
@ -543,12 +544,12 @@ const beforeVideoUpload: UploadProps["beforeUpload"] = (file) => {
const isMp4 = file.type === "video/mp4" || file.name.toLowerCase().endsWith(".mp4"); const isMp4 = file.type === "video/mp4" || file.name.toLowerCase().endsWith(".mp4");
if (!isMp4) { if (!isMp4) {
message.error("只能上传 MP4 格式的视频!"); message.error("只能上传 MP4 格式的视频!");
return false; return Upload.LIST_IGNORE;
} }
const isLt50M = file.size / 1024 / 1024 < 10; // 50M const isLt50M = file.size / 1024 / 1024 < 10; // 50M
if (!isLt50M) { if (!isLt50M) {
message.error("视频大小不能超过 10MB!"); message.error("视频大小不能超过 10MB!");
return false; return Upload.LIST_IGNORE;
} }
// false // false
return false; return false;

View File

@ -183,15 +183,16 @@
<a-input-number <a-input-number
v-model:value="editingData[column.dataIndex]" v-model:value="editingData[column.dataIndex]"
style="width: 100%" style="width: 100%"
@change="(val) => delWarning(val, column.dataIndex)" :step="1"
:precision="0"
:min="0" :min="0"
@change="(val) => delWarning(val, column.dataIndex)"
/> />
</template> </template>
<template v-else-if="['wt'].includes(column.dataIndex)"> <template v-else-if="['wt'].includes(column.dataIndex)">
<a-input-number <a-input-number
v-model:value="editingData[column.dataIndex]" v-model:value="editingData[column.dataIndex]"
style="width: 100%" style="width: 100%"
:min="0"
/> />
</template> </template>

View File

@ -302,6 +302,7 @@ interface ColumnConfig {
} }
const fileInputRef = ref<any>(null); const fileInputRef = ref<any>(null);
const tableRef = ref<any>(null); const tableRef = ref<any>(null);
const searchRef = ref<any>(null);
// //
const direction = ref<any>([]); const direction = ref<any>([]);
const guoyuStatus = ref<any>([]); const guoyuStatus = ref<any>([]);
@ -460,7 +461,7 @@ const handleDelete = (ids: any[]) => {
let res: any = await delFishDraft(ids); let res: any = await delFishDraft(ids);
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("删除成功"); message.success("删除成功");
tableRef.value?.getList(); tableRef.value?.refresh();
} }
}, },
}); });
@ -477,7 +478,7 @@ const handleSubmit = (ids: any[]) => {
let res: any = await submitFishDraft(ids); let res: any = await submitFishDraft(ids);
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("提交成功"); message.success("提交成功");
tableRef.value?.getList(); tableRef.value?.refresh();
} }
}, },
}); });
@ -521,7 +522,7 @@ const handleSuccess = (ids: any[]) => {
let res: any = await successFishDraft({ ids: ids, approveComment: rejectReason }); let res: any = await successFishDraft({ ids: ids, approveComment: rejectReason });
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("审批成功"); message.success("审批成功");
tableRef.value?.getList(); tableRef.value?.refresh();
} }
}, },
}); });
@ -571,7 +572,7 @@ const handleReject = (id: any) => {
let res: any = await rejectFishDraft({ id: id, rejectReason: rejectReason }); let res: any = await rejectFishDraft({ id: id, rejectReason: rejectReason });
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("驳回成功"); message.success("驳回成功");
tableRef.value?.getList(); tableRef.value?.refresh();
} }
}, },
}); });
@ -602,7 +603,7 @@ const handleEditSubmit = async (values: FormData) => {
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("编辑成功"); message.success("编辑成功");
editModalVisible.value = false; editModalVisible.value = false;
tableRef.value?.getList(); tableRef.value?.refresh();
} }
editModalRef.value.localLoading = false; editModalRef.value.localLoading = false;
} else { } else {
@ -613,7 +614,7 @@ const handleEditSubmit = async (values: FormData) => {
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("新增成功"); message.success("新增成功");
editModalVisible.value = false; editModalVisible.value = false;
tableRef.value?.getList(); tableRef.value?.refresh();
} }
editModalRef.value.localLoading = false; editModalRef.value.localLoading = false;
} }
@ -684,7 +685,7 @@ const handleModalOk = () => {
}); });
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("导入成功"); message.success("导入成功");
tableRef.value?.getList(); tableRef.value?.refresh();
visible.value = false; visible.value = false;
await markImportTaskSuccess({ id: taskId.value }); await markImportTaskSuccess({ id: taskId.value });
} else { } else {
@ -705,7 +706,7 @@ const handleCustomCancel = () => {
let res: any = await cancelImportTask({ taskId: taskId.value }); let res: any = await cancelImportTask({ taskId: taskId.value });
if (res && res?.code == 0) { if (res && res?.code == 0) {
message.success("取消成功"); message.success("取消成功");
tableRef.value?.getList(); tableRef.value?.refresh();
visible.value = false; visible.value = false;
} else { } else {
message.error("取消失败"); message.error("取消失败");
@ -863,13 +864,13 @@ const handleSearchFinish = (values: any) => {
value: values.ftp, value: values.ftp,
}, },
{ {
field: "TM", field: "strdt",
operator: "gte", operator: "gte",
dataType: "date", dataType: "date",
value: values.strdt[0], value: values.strdt[0],
}, },
{ {
field: "TM", field: "strdt",
operator: "lte", operator: "lte",
dataType: "date", dataType: "date",
value: values.strdt[1], value: values.strdt[1],