bug 修改 修改路由模式
This commit is contained in:
parent
2342a3555e
commit
afb041ea9f
@ -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,
|
||||||
|
|||||||
@ -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()
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 })
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
@ -12,13 +12,4 @@ 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);
|
|
||||||
}
|
}
|
||||||
@ -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("登录成功");
|
||||||
|
|
||||||
|
|||||||
@ -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(() => {
|
||||||
|
|||||||
@ -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" });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 组件挂载时加载集团列表
|
// 组件挂载时加载集团列表
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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>
|
||||||
|
|
||||||
|
|||||||
@ -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],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user