feat: 优化跳转

This commit is contained in:
2025-12-18 20:08:37 +08:00
parent 186d1e0d53
commit 2ba8ac607e
3 changed files with 32 additions and 18 deletions

View File

@ -46,22 +46,28 @@ import PageTitle from "@/components/aboutTable/PageTitle.vue";
import MyTable from "@/components/aboutTable/MyTable.vue"; import MyTable from "@/components/aboutTable/MyTable.vue";
import Pages from "@/components/aboutTable/Pages.vue"; import Pages from "@/components/aboutTable/Pages.vue";
import Search from "@/components/aboutTable/Search.vue"; import Search from "@/components/aboutTable/Search.vue";
import { useRoute } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { tacticalGet, strategicDelete } from "@/api/huiShangyp/strategicApi.js"; import { tacticalGet, strategicDelete } from "@/api/huiShangyp/strategicApi.js";
import { reactive, ref, onMounted, getCurrentInstance, watch,computed } from "vue"; import { reactive, ref, onMounted, getCurrentInstance, watch, computed,nextTick } from "vue";
import AddForm from "./addForm.vue"; import AddForm from "./addForm.vue";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX") const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX")
const detailDiloag = ref(); const detailDiloag = ref();
const searchBox = ref(); //搜索框 const searchBox = ref(); //搜索框
const router = useRouter();
const route = useRoute();
onMounted(() => { onMounted(() => {
tabHeightFn() tabHeightFn()
if (route.query.id) { if (route.query.id) {
detailDiloag.value.init('edit', { nextTick(() => {
id: route.query.id addForm.value && addForm.value.init('edit', {
}); id: route.query.id
return });
router.replace({ path: '/strategicResearch' })// 移除id 避免刷新一直带参数
})
} }
getList() getList()
}); });
/** 是否市情报指挥中心 */ /** 是否市情报指挥中心 */
@ -136,11 +142,10 @@ const getList = () => {
// 表格高度计算 // 表格高度计算
const tabHeightFn = () => { const tabHeightFn = () => {
pageData.tableHeight = window.innerHeight - searchBox.value.offsetHeight - 250; pageData.tableHeight = window.innerHeight - searchBox.value.offsetHeight - 250;
window.onresize = function () { window.onresize = function() {
tabHeightFn(); tabHeightFn();
}; };
}; };
const route = useRoute()
const addForm = ref(null) const addForm = ref(null)
const getDataById = (type, row) => { const getDataById = (type, row) => {

View File

@ -46,21 +46,26 @@ import PageTitle from "@/components/aboutTable/PageTitle.vue";
import MyTable from "@/components/aboutTable/MyTable.vue"; import MyTable from "@/components/aboutTable/MyTable.vue";
import Pages from "@/components/aboutTable/Pages.vue"; import Pages from "@/components/aboutTable/Pages.vue";
import Search from "@/components/aboutTable/Search.vue"; import Search from "@/components/aboutTable/Search.vue";
import { useRoute } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { tacticalGet, strategicDelete } from "@/api/huiShangyp/tacticalApi.js"; import { tacticalGet, strategicDelete } from "@/api/huiShangyp/tacticalApi.js";
import { reactive, ref, onMounted, getCurrentInstance, watch, computed } from "vue"; import { reactive, ref, onMounted, getCurrentInstance, watch, computed, nextTick } from "vue";
import AddForm from "./addForm.vue"; import AddForm from "./addForm.vue";
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX") const { D_BZ_YPFS, D_BZ_YPLX } = proxy.$dict("D_BZ_YPFS", "D_BZ_YPLX")
const detailDiloag = ref(); const detailDiloag = ref();
const searchBox = ref(); //搜索框 const searchBox = ref(); //搜索框
const router = useRouter();
const route = useRoute();
onMounted(() => { onMounted(() => {
tabHeightFn() tabHeightFn()
if (route.query.id) { if (route.query.id) {
detailDiloag.value.init('edit', { nextTick(() => {
id: route.query.id addForm.value && addForm.value.init('edit', {
}); id: route.query.id
return });
router.replace({ path: '/tacticalResearch' })// 移除id 避免刷新一直带参数
})
} }
getList() getList()
}); });
@ -123,7 +128,7 @@ const changeSize = (val) => {
// 获取列表 // 获取列表
const getList = () => { const getList = () => {
pageData.tableConfiger.loading = true; pageData.tableConfiger.loading = true;
// bglx 报告类型01 战术研判 02 战略研判) // bglx 报告类型01 战术研判 02 战略研判)
let data = { ...pageData.pageConfiger, ...queryFrom.value, bglx: '01' }; let data = { ...pageData.pageConfiger, ...queryFrom.value, bglx: '01' };
tacticalGet(data).then(res => { tacticalGet(data).then(res => {
pageData.tableData = res.records || []; pageData.tableData = res.records || [];
@ -140,7 +145,7 @@ const tabHeightFn = () => {
tabHeightFn(); tabHeightFn();
}; };
}; };
const route = useRoute() // const route = useRoute()
const addForm = ref(null) const addForm = ref(null)
const getDataById = (type, row) => { const getDataById = (type, row) => {

View File

@ -116,8 +116,10 @@ const stopAutoScroll = () => {
// 点击项 // 点击项
const chooseItem = (item) => { const chooseItem = (item) => {
stopAutoScroll(); // 点击时停止自动滚动 stopAutoScroll(); // 点击时停止自动滚动
const path = props.bglx === '01' ? '/tacticalResearch' : '/strategicResearch'
router.push({ router.push({
path: '/forumPost', // path: '/forumPost',
path: path,
query: { id: item.id } query: { id: item.id }
}) })
}; };
@ -125,7 +127,9 @@ const chooseItem = (item) => {
// 添加跳转 // 添加跳转
const chooseForumPost = () => { const chooseForumPost = () => {
stopAutoScroll(); // 点击时停止自动滚动 stopAutoScroll(); // 点击时停止自动滚动
router.push({ path: '/forumPost' }) const path = props.bglx === '01' ? '/tacticalResearch' : '/strategicResearch'
router.push({ path: path })
}; };
// 生命周期 // 生命周期