动态路由,首页自动跳转

yanfeiyong
严飞永 3 weeks ago
parent 287620b18a
commit 54c10c873d

@ -1,7 +1,6 @@
import { createRouter, createWebHashHistory } from "vue-router";
import { createWebHistory, createRouter } from 'vue-router'
/* Layout */
import Layout from "@/layout";
import Layout from '@/layout'
/**
* Note: 路由配置项
@ -28,204 +27,149 @@ import Layout from "@/layout";
// 公共路由
export const constantRoutes = [
{
path: "/redirect",
path: '/redirect',
component: Layout,
hidden: true,
children: [
{
path: "/redirect/:path(.*)",
component: () => import("@/views/redirect"),
},
],
path: '/redirect/:path(.*)',
component: () => import('@/views/redirect/index.vue')
}
]
},
{
path: "/login",
component: () => import("@/views/login"),
hidden: true,
path: '/login',
component: () => import('@/views/login'),
hidden: true
},
{
path: "/register",
component: () => import("@/views/register"),
hidden: true,
path: '/register',
component: () => import('@/views/register'),
hidden: true
},
{
path: "/404",
component: () => import("@/views/error/404"),
hidden: true,
path: "/:pathMatch(.*)*",
component: () => import('@/views/error/404'),
hidden: true
},
{
path: "/401",
component: () => import("@/views/error/401"),
hidden: true,
path: '/401',
component: () => import('@/views/error/401'),
hidden: true
},
{
path: "",
path: '',
component: Layout,
hidden: true,
redirect: "index",
redirect: '/index',
children: [
{
path: "index",
component: () => import("@/views/index"),
name: "Index",
meta: { title: "首页", icon: "dashboard", affix: true },
},
// {
// path: 'assetsAuth',
// component: () => import('@/views/auditPages/assetsManagement/assetsAuth'),
// name: 'AssetsAuth',
// // meta: { title: '新增资产', icon: 'user', activeMenu: "/assets" }
// meta: { title: '新增资产', icon: 'user', activeMenu: "/assetsManage/assets" }
// }
{
path: "/auditPages/assetsType",
name: "assetsType1",
component: () => import("@/views/components/assetsType/index_v1.vue"),
// meta: { title: '新增资产', icon: 'user', activeMenu: "/assetsManage/assets" }
},
{
path: "taskInfo",
component: () => import("@/views/taskManagement/info"),
name: "TaskInfo",
meta: { title: "任务详情", icon: "user", activeMenu: "/task2" },
},
{
path: "taskAudit",
component: () => import("@/views/auditPages/taskManagement/auditList"),
name: "taskAudit",
meta: { title: "任务审核", icon: "user", activeMenu: "/task" },
},
{
path: "taskAuditInfo",
component: () => import("@/views/auditPages/taskManagement/audit"),
name: "taskAuditInfo",
meta: { title: "资产审核", icon: "user", activeMenu: "/task" },
},
{
path: "taskAuditInfolishichakan",
component: () => import("@/views/auditPages/taskManagement/audit"),
name: "taskAuditInfolishichakan",
meta: { title: "资产提交记录", icon: "user", activeMenu: "/task" },
},
{
path: 'mytaskInfo',
component: () => import('@/views/myTask/info'),
name: 'mytaskInfo',
meta: { title: '任务详情', icon: 'user', activeMenu: "/myTask2" }
},
{
path: "unitAuth",
component: () => import("@/views/auditPages/unitManagement/index"),
name: "UnitAuth",
meta: { title: "新增单位", icon: "user", activeMenu: "/unit" },
},
{
path: "unitAssetsAuth",
component: () =>
import("@/views/auditPages/unitAutonomicFill/assetsAuth"),
name: "unitAssetsAuth",
meta: { title: "资产修改", icon: "user", activeMenu: "/unitFill" },
},
],
path: '/index',
component: () => import('@/views/index'),
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true }
}
]
},
{
path: "/user",
path: '/user',
component: Layout,
hidden: true,
redirect: "noredirect",
redirect: 'noredirect',
children: [
{
path: "profile",
component: () => import("@/views/system/user/profile/index"),
name: "Profile",
meta: { title: "个人中心", icon: "user" },
},
],
},
];
path: 'profile/:activeTab?',
component: () => import('@/views/system/user/profile/index'),
name: 'Profile',
meta: { title: '个人中心', icon: 'user' }
}
]
}
]
// 动态路由,基于用户权限动态去加载
export const dynamicRoutes = [
{
path: "/system/user-auth",
path: '/system/user-auth',
component: Layout,
hidden: true,
permissions: ["system:user:edit"],
permissions: ['system:user:edit'],
children: [
{
path: "role/:userId(\\d+)",
component: () => import("@/views/system/user/authRole"),
name: "AuthRole",
meta: { title: "分配角色", activeMenu: "/system/user" },
},
],
path: 'role/:userId(\\d+)',
component: () => import('@/views/system/user/authRole'),
name: 'AuthRole',
meta: { title: '分配角色', activeMenu: '/system/user' }
}
]
},
{
path: "/system/role-auth",
path: '/system/role-auth',
component: Layout,
hidden: true,
permissions: ["system:role:edit"],
permissions: ['system:role:edit'],
children: [
{
path: "user/:roleId(\\d+)",
component: () => import("@/views/system/role/authUser"),
name: "AuthUser",
meta: { title: "分配用户", activeMenu: "/system/role" },
},
],
path: 'user/:roleId(\\d+)',
component: () => import('@/views/system/role/authUser'),
name: 'AuthUser',
meta: { title: '分配用户', activeMenu: '/system/role' }
}
]
},
{
path: "/system/dict-data",
path: '/system/dict-data',
component: Layout,
hidden: true,
permissions: ["system:dict:list"],
permissions: ['system:dict:list'],
children: [
{
path: "index/:dictId(\\d+)",
component: () => import("@/views/system/dict/data"),
name: "Data",
meta: { title: "字典数据", activeMenu: "/system/dict" },
},
],
path: 'index/:dictId(\\d+)',
component: () => import('@/views/system/dict/data'),
name: 'Data',
meta: { title: '字典数据', activeMenu: '/system/dict' }
}
]
},
{
path: "/monitor/job-log",
path: '/monitor/job-log',
component: Layout,
hidden: true,
permissions: ["monitor:job:list"],
permissions: ['monitor:job:list'],
children: [
{
path: "index/:jobId(\\d+)",
component: () => import("@/views/monitor/job/log"),
name: "JobLog",
meta: { title: "调度日志", activeMenu: "/monitor/job" },
},
],
path: 'index/:jobId(\\d+)',
component: () => import('@/views/monitor/job/log'),
name: 'JobLog',
meta: { title: '调度日志', activeMenu: '/monitor/job' }
}
]
},
{
path: "/tool/gen-edit",
path: '/tool/gen-edit',
component: Layout,
hidden: true,
permissions: ["tool:gen:edit"],
permissions: ['tool:gen:edit'],
children: [
{
path: "index/:tableId(\\d+)",
component: () => import("@/views/tool/gen/editTable"),
name: "GenEdit",
meta: { title: "修改生成配置", activeMenu: "/tool/gen" },
},
],
},
];
path: 'index/:tableId(\\d+)',
component: () => import('@/views/tool/gen/editTable'),
name: 'GenEdit',
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
}
]
}
]
// 创建路由
const router = createRouter({
history: createWebHashHistory(),
scrollBehavior: () => ({ top: 0 }),
history: createWebHistory(),
routes: constantRoutes,
});
// 防止连续点击多次路由报错的方法在Vue Router 4中不再需要
// 因为它已经内置处理了这种情况
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {
return savedPosition
}
return { top: 0 }
},
})
export default router;
export default router

@ -668,6 +668,7 @@ const ruleFormRef = ref(null);
// route
const pageType = route.query.pageType || route.params.pageType;
const id = route.query.id || route.params.id;
const routeName = route.query.name;
const queryData = route.query || route.params;
const loading = ref(false);
@ -799,7 +800,7 @@ async function newAssets() {
}
function sendBack() {
router.push({ path: "/assetsManage2/gzhZC", params: queryData });
router.go(-1);
}
onMounted(async () => {

@ -592,6 +592,7 @@ const handleAdd = () => {
router.push({
path: "/assetsManage2/gzhZC-info",
query: {
name: "GzhZC",
pageType: "add",
type: 2,
parentName: "/assetsManage2/gzhZC",
@ -606,6 +607,7 @@ const goInfo = (row, id) => {
router.push({
path: "/assetsManage2/gzhZC-info",
query: {
name: "GzhZC",
pageType: "look",
type: 2,
id: row.id,
@ -618,6 +620,7 @@ const goInfo = (row, id) => {
router.push({
path: "/assetsManage2/gzhZC-info",
query: {
name: "GzhZC",
pageType: "change",
type: 2,
id: row.id,

@ -427,6 +427,7 @@ const loading = ref(false);
const disabled = ref(false);
const pageType = ref(route.query.pageType || "");
const id = ref(route.query.id || "");
const routeName = route.query.name;
const queryData = ref(route.query.queryData || {});
// Rules
@ -482,7 +483,7 @@ const handleSelect = (item) => {
};
const sendBack = () => {
router.push({ path: "/assetsManage2/xcxZC", params: queryData });
router.push({ name: routeName, params: queryData });
};
const newAssets = async () => {

@ -60,7 +60,7 @@
<el-input
v-model="formInline.dwmc"
placeholder="请输入所属单位"
style="width: 95%;"
style="width: 95%"
></el-input>
</el-form-item>
</el-col>
@ -134,7 +134,9 @@
</div>
<main>
<div class="search-title">
<span class="search-title-span">资产列表蓝色为单位新增资产</span>
<span class="search-title-span"
>资产列表蓝色为单位新增资产</span
>
<el-row
:gutter="10"
class="mb8"
@ -181,7 +183,7 @@
>
<el-table-column
type="index"
width="60"
width="60"
label="序号"
align="center"
/>
@ -404,7 +406,7 @@
</el-row>
</template>
<script setup>
import { Upload,Download,Plus } from '@element-plus/icons-vue'
import { Upload, Download, Plus } from "@element-plus/icons-vue";
import { ref, onMounted, onUnmounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import myPagination from "@/views/components/Pagination/index.vue";
@ -417,7 +419,7 @@ import {
const { proxy } = getCurrentInstance();
const router = useRouter();
const route = useRoute();
const size = ref('default')
const size = ref("default");
//
const deptOptions = ref(undefined);
@ -445,7 +447,7 @@ const upload = ref({
isUploading: false,
updateSupport: 0,
headers: { Authorization: "Bearer " + getToken() },
url:
url:
import.meta.env.VITE_APP_HJ === "test"
? import.meta.env.VITE_APP_BASE_API +
"/tc/assetOfficialAccount/importData"
@ -529,8 +531,14 @@ function handleFileUploadProgress(event, file, fileList) {
function handleFileSuccess(response, file, fileList) {
upload.value.open = false;
upload.value.isUploading = false;
this.$refs.upload.clearFiles()
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
this.$refs.upload.clearFiles();
this.$alert(
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
response.msg +
"</div>",
"导入结果",
{ dangerouslyUseHTMLString: true }
);
getList();
}
@ -543,19 +551,20 @@ function handleAdd() {
router.push({
path: "/assetsManage2/xcxZC-info",
query: {
name: "XcxZC",
pageType: "add",
type: 1,
parentName: "/assetsManage2/xcxZC",
},
});
}
function goInfo(row, id) {
proxy.setActiveMenu("/assetsManage2/xcxZC");
if (id === 1) {
proxy.setActiveMenu("/assetsManage2/xcxZC");
router.push({
path: "/assetsManage2/xcxZC-info",
query: {
name: "XcxZC",
pageType: "look",
type: 1,
id: row.id,
@ -567,6 +576,7 @@ function goInfo(row, id) {
router.push({
path: "/assetsManage2/xcxZC-info",
query: {
name: "XcxZC",
pageType: "change",
type: 1,
id: row.id,

@ -1,13 +1,54 @@
<template></template>
<script setup>
import { ref, watch } from "vue";
import { useRouter } from "vue-router";
import useUserStore from "@/store/modules/user";
import usePermissionStore from "@/store/modules/permission";
<script setup name="Index">
const version = ref('3.8.9')
const router = useRouter();
const userStore = useUserStore();
const permissionStore = usePermissionStore();
const hasRedirected = ref(false);
function goTarget(url) {
window.open(url, '__blank')
}
</script>
const handleRedirect = () => {
if (hasRedirected.value) return;
// permissionStore
const routes = permissionStore.defaultRoutes || [];
console.log("当前路由数据:", routes);
const validRoutes = routes.filter(
(item) => !item.hidden && item.path && item.path !== "/"
);
if (validRoutes.length === 0) {
return;
}
<style scoped lang="scss">
</style>
const firstChild = validRoutes[0]?.children?.[0];
if (!firstChild?.path) {
return;
}
hasRedirected.value = true;
const formatPath = (path) => {
return path.startsWith("/") ? path.slice(1) : path;
};
const targetPath = userStore.roles.includes("unit")
? `/${formatPath(firstChild.path)}`
: `/${formatPath(validRoutes[0].path)}/${formatPath(firstChild.path)}`;
console.log("跳转至:", targetPath);
router.push(targetPath).catch((err) => {
console.error("路由跳转异常:", err);
});
};
watch(
() => permissionStore.defaultRoutes || [],
(newVal) => {
if (newVal.length > 0) handleRedirect();
},
{ immediate: true, deep: true }
);
</script>

@ -311,28 +311,45 @@ function handleExport() {
`公众号资产${new Date().getTime()}.xlsx`
);
}
function handleAdd() {
const handleAdd = () => {
proxy.setActiveMenu("/myAssets2/myOfficialAccount");
router.push({
name: "myAssetsAuth",
path: "/assetsManage2/xcxZC-info",
query: {
pageType: "add",
type: 2,
},
});
}
// /
const goInfo = (row, id) => {
router.push({
name: "myAssetsAuth",
query: {
pageType: id === 1 ? "look" : "change",
type: 2,
id: row.id,
queryData: formInline.value,
type: 1,
queryData: formInline,
name: "MyOfficialAccount",
},
});
};
const goInfo = (row, id) => {
if (id === 1) {
proxy.setActiveMenu("/myAssets2/myOfficialAccount");
router.push({
path: "/assetsManage2/xcxZC-info",
query: {
name: "MyOfficialAccount",
pageType: "look",
type: 1,
id: row.id,
queryData: formInline.value,
},
});
} else if (id === 2) {
proxy.setActiveMenu("/myAssets2/myOfficialAccount");
router.push({
path: "/assetsManage2/xcxZC-info",
query: {
name: "MyOfficialAccount",
pageType: "change",
type: 1,
id: row.id,
queryData: formInline.value,
},
});
}
};
//
const tableRowClassName = ({ rowIndex }) => {

@ -1,6 +1,12 @@
<template>
<div class="L-main" id="L-size-main">
<div class="content-search" id="L-header">
<div
class="L-main"
id="L-size-main"
>
<div
class="content-search"
id="L-header"
>
<div class="search-title">查询条件</div>
<el-form
:inline="true"
@ -12,16 +18,22 @@
>
<el-row>
<el-col :span="7">
<el-form-item label="小程序名称:" prop="xcxmc">
<el-form-item
label="小程序名称:"
prop="xcxmc"
>
<el-input
v-model="formInline.xcxmc"
placeholder="请输入小程序名称"
style="width: 95%;"
style="width: 95%"
></el-input>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="小程序状态:" prop="xtzt">
<el-form-item
label="小程序状态:"
prop="xtzt"
>
<el-select
v-model="formInline.xtzt"
placeholder="请选择小程序状态"
@ -36,11 +48,13 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="7" style="text-align: right">
<el-col
:span="7"
style="text-align: right"
>
<el-form-item class="unit-form">
<el-button @click="resetQuery"></el-button>
<el-button @click="resetQuery"></el-button>
<el-button
type="primary"
@click="handleQuery"
>查询</el-button
@ -53,7 +67,10 @@
<main>
<div class="search-title">
<span class="search-title-span">资产列表</span>
<el-row :gutter="10" class="mb8">
<el-row
:gutter="10"
class="mb8"
>
<el-col :span="1.5">
<el-button
type="warning"
@ -108,22 +125,40 @@
align="center"
>
<template #default="scope">
<span v-if="scope.row.state == 1" style="color: #16b771">
<span
v-if="scope.row.state == 1"
style="color: #16b771"
>
正常
</span>
<span v-if="scope.row.state == 2" style="color: #f58a0c">
<span
v-if="scope.row.state == 2"
style="color: #f58a0c"
>
注销
</span>
<span v-if="scope.row.state == 3" style="color: #1485ef">
<span
v-if="scope.row.state == 3"
style="color: #1485ef"
>
迁移
</span>
<span v-if="scope.row.state == 4" style="color: #29a07a">
<span
v-if="scope.row.state == 4"
style="color: #29a07a"
>
受限
</span>
<span v-if="scope.row.state == 5" style="color: #f50c0c">
<span
v-if="scope.row.state == 5"
style="color: #f50c0c"
>
违规
</span>
<span v-if="scope.row.state == 6" style="color: #f58a0c">
<span
v-if="scope.row.state == 6"
style="color: #f58a0c"
>
未知
</span>
</template>
@ -196,126 +231,137 @@
</template>
<script setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import myPagination from '@/views/components/Pagination/index.vue'
import { miniProgramsList } from '@/api/auditPagesApi/index'
import { ref, reactive, onMounted, onUnmounted } from "vue";
import { useRoute, useRouter } from "vue-router";
import myPagination from "@/views/components/Pagination/index.vue";
import { miniProgramsList } from "@/api/auditPagesApi/index";
import { Download, Plus } from "@element-plus/icons-vue";
const route = useRoute()
const router = useRouter()
const route = useRoute();
const router = useRouter();
//
const formInline = reactive({
xtzt: '',
xcxmc: '',
xtzt: "",
xcxmc: "",
current: 1,
size: 10
})
size: 10,
});
//
const total = ref(0)
const tableData = ref([])
const loading = ref(false)
const tabHeader = ref(undefined)
const queryForm = ref(null)
const total = ref(0);
const tableData = ref([]);
const loading = ref(false);
const tabHeader = ref(undefined);
const queryForm = ref(null);
const { proxy } = getCurrentInstance();
const { gzh_state } = proxy.useDict(
"gzh_state"
);
//
const handleAdd = () => {
router.push({
name: 'myAssetsAuth',
query: {
pageType: 'add',
type: 1,
queryData: formInline,
name: 'MyProgram'
}
})
}
const { gzh_state } = proxy.useDict("gzh_state");
const getList = async () => {
loading.value = true
loading.value = true;
try {
const res = await miniProgramsList(formInline)
total.value = res.data.total
tableData.value = res.data.records
const res = await miniProgramsList(formInline);
total.value = res.data.total;
tableData.value = res.data.records;
} finally {
loading.value = false
loading.value = false;
}
}
};
const resetQuery = () => {
if (queryForm.value) {
queryForm.value.resetFields()
queryForm.value.resetFields();
}
handleQuery()
}
handleQuery();
};
const handleQuery = () => {
formInline.current = 1
getList()
}
formInline.current = 1;
getList();
};
const getPagination = ({ page, limit }) => {
formInline.current = page
formInline.size = limit
getList()
}
formInline.current = page;
formInline.size = limit;
getList();
};
const handleExport = () => {
console.log('导出数据:', formInline)
}
const goInfo = (row, id) => {
console.log("导出数据:", formInline);
};
//
const handleAdd = () => {
proxy.setActiveMenu("/myAssets2/myProgram");
router.push({
name: 'myAssetsAuth',
path: "/assetsManage2/xcxZC-info",
query: {
pageType: id === 1 ? 'look' : 'change',
pageType: "add",
type: 1,
id: row.id,
queryData: formInline,
name: 'MyProgram'
}
})
}
name: "MyProgram",
},
});
};
const goInfo = (row, id) => {
if (id === 1) {
proxy.setActiveMenu("/myAssets2/myProgram");
router.push({
path: "/assetsManage2/xcxZC-info",
query: {
name: "MyProgram",
pageType: "look",
type: 1,
id: row.id,
queryData: formInline.value,
},
});
} else if (id === 2) {
proxy.setActiveMenu("/myAssets2/myProgram");
router.push({
path: "/assetsManage2/xcxZC-info",
query: {
name: "MyProgram",
pageType: "change",
type: 1,
id: row.id,
queryData: formInline.value,
},
});
}
};
//
const tableRowClassName = ({ rowIndex }) => {
return rowIndex % 2 !== 0 ? 'evenNumber-row' : ''
}
return rowIndex % 2 !== 0 ? "evenNumber-row" : "";
};
//
const cancalDebounce = () => {
const element = document.getElementById('L-size-main')
const header = document.getElementById('L-header')
const pagination = document.getElementById('L-pagination')
const element = document.getElementById("L-size-main");
const header = document.getElementById("L-header");
const pagination = document.getElementById("L-pagination");
if (element && header && pagination) {
const elementHeight = element.offsetHeight
const headerHeight = header.offsetHeight
const paginationtHeight = pagination.offsetHeight
tabHeader.value = elementHeight - headerHeight - paginationtHeight - 110
const elementHeight = element.offsetHeight;
const headerHeight = header.offsetHeight;
const paginationtHeight = pagination.offsetHeight;
tabHeader.value = elementHeight - headerHeight - paginationtHeight - 110;
}
}
};
onMounted(() => {
if (Object.keys(route.params).length !== 0) {
Object.assign(formInline, route.params)
Object.assign(formInline, route.params);
} else {
formInline.current = 1
formInline.size = 20
formInline.current = 1;
formInline.size = 20;
}
getList()
cancalDebounce()
window.addEventListener('resize', cancalDebounce)
})
getList();
cancalDebounce();
window.addEventListener("resize", cancalDebounce);
});
onUnmounted(() => {
window.removeEventListener('resize', cancalDebounce)
})
</script>
window.removeEventListener("resize", cancalDebounce);
});
</script>

@ -316,7 +316,6 @@ const rules = {
const tabclicklist = ref([]);
//
//
function getInfo() {
loading.value = true;
@ -416,7 +415,6 @@ function cancalDebounce() {
const header = document.getElementById("L-header");
const paginationEl = document.getElementById("L-pagination");
if (!element || !header || !paginationEl) return;
const elementHeight = element.offsetHeight;
const headerHeight = header.offsetHeight;
const paginationtHeight = paginationEl.offsetHeight;

@ -1,538 +1,23 @@
<!-- 任务管理aaa -->
<template>
<!-- 任务核查 -->
<div class="L-task-info">
<div class="info-left info-left-two" id="L-size-main">
<div class="content-info content-info-two" id="L-header">
<div class="info-title">任务详情</div>
<el-button type="primary" @click="sendBack" class="fanhuipiaofu" size='mini'>返回</el-button>
<div class="teshu-top-info">
<div class="top-info">
<el-row class="top-row">
<el-col :span="8">
任务下发时间<span>{{ titleInfoObj.taskTime }}</span>
</el-col>
<el-col :span="8">
任务名称<span>{{ titleInfoObj.taskName }}</span>
</el-col>
<el-col :span="8">
任务状态<span>{{ taskstatus(titleInfoObj.taskStatus) }}</span>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
任务期限<span>{{ titleInfoObj.taskDeadline }}</span>
</el-col>
<el-col :span="16">
核查资产类型<span>{{ listTow.join(",") }}</span>
</el-col>
</el-row>
</div>
</div>
</div>
<main class="renwuxiangqing">
<div class="info-cut-off-rule-my" id="L-tab">
<div class="info-title">资产信息</div>
</div>
<div class="info-bottom-box">
<el-form :inline="true" :model="formInline" size="small" class="demo-form-inline" v-if="index == 1">
<el-row>
<el-col :span="7">
<el-form-item label="系统名称:">
<el-input v-model="formInline.xtmc" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="7">
<el-form-item label="审核状态:">
<el-select v-model="formInline.status" placeholder="请选择">
<el-option label="未核查" value="0" />
<el-option label="已核查" value="1" />
<el-option label="审核通过" value="3" />
<el-option label="审核不通过" value="4" />
<el-option label="已关停" value="5" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item>
<el-button size="mini" type="primary" @click="handleQuery()"></el-button>
<el-button size="mini" @click="resetQuery()"></el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-form :inline="true" :model="formInlineTwo" size="small" class="demo-form-inline" v-if="index == 2">
<el-row>
<el-col :span="7">
<el-form-item label="单位名称:">
<el-input v-model="formInlineTwo.unitName" placeholder="请输入"></el-input>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item>
<el-button size="mini" type="primary" @click="handleQuery()"></el-button>
<el-button size="mini" @click="resetQuery()"></el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
<section v-if="index == 1">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane
v-for="item in chanckListTow"
:key="item.lable"
:label="item.conent"
:name="item.lable"
:xtmcName="item.xtmcName"
/>
</el-tabs>
<el-table
v-loading="loading"
:data="tableData"
:height="tabHeader"
:max-height="tabHeader"
:row-class-name="tableRowClassName"
>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column :label="xtmcName" prop="xtmc" align="center" />
<el-table-column label="核查单位" prop="zcdwmc" align="center" />
<el-table-column label="单位核查时间" prop="updateTime" align="center" />
<el-table-column label="审核状态" width="200px" prop="status" class-name="table-status" align="center">
<template #default="scope">
<span v-if="scope.row.status == 0" style="color: #E6A23C;">
未核查
</span>
<span v-if="scope.row.status == 1" style="color: #67C23A;">
已核查
</span>
<span v-if="scope.row.status == 3" style="color: #67C23A;">
审核通过
</span>
<span v-if="scope.row.status == 4" style="color: #F56C6C;">
审核不通过
</span>
<span v-if="scope.row.status == 5" style="color: #F56C6C;">
已关停
</span>
</template>
</el-table-column>
<el-table-column label="操作" prop="userId" class-name="table-operation" align="center">
<template #default="scope">
<div style="display: flex;align-items: center;justify-content: center;">
<div
style="display: flex;align-items: center;cursor: pointer;"
@click="goInfo(1, scope.row)"
v-if="(scope.row.status != 4 && scope.row.status != 0) || (route.query.pageType == 'look' || route.meta.pageType == 'look')"
>
<img src="@/assets/images/icon-ck@2x.png" alt="" style="width: 20px;margin-right: 5px;">
<span class="look-info" style="color: #1485EF;">查看</span>
</div>
<div
v-if="(route.query.pageType == 'info' || route.meta.pageType == 'info') && scope.row.status != 3 && scope.row.status != 5 && scope.row.status != 1"
style="display: flex;align-items: center;cursor: pointer;margin-left: 10px;"
@click="goInfo(2, scope.row)"
>
<img src="@/assets/images/icon-shenhe@2x.png" alt="" style="width: 15px;margin-right: 5px;">
<span class="del-info" style="color: #1485EF;">核查</span>
</div>
<div
style="display: flex;align-items: center;cursor: pointer;margin-left: 5px;"
@click="goInfo(3, scope.row)"
v-show='scope.row.btgyy'
>
<img src="@/assets/images/icon-ck@2x.png" alt="" style="width: 20px;margin-right: 5px;">
<span class="look-info" style="color: #1485EF;">查看原因</span>
</div>
</div>
</template>
</el-table-column>
</el-table>
</section>
<my-pagination
id="L-pagination"
:total="total"
:page="pagination.current"
:limit="pagination.size"
@pagination="getPagination"
:current-page.sync="pagination.current"
/>
</div>
</main>
</div>
<div class="info-right" v-if="route.query.pageType == 'look' || route.meta.pageType == 'look'">
<div class="info-title">任务流程节点</div>
<div class="timeline">
<div class="timeline-items" v-for="(item, index) in timeLineData" :key="index">
<div class="left-box">
<img class="main-img" :src="returnidimg(item.assetName)" alt="">
<img class="icon-jt" v-if="(index + 1) != timeLineData.length" src="@/assets/images/icon-jt@2x.png" alt="">
</div>
<div class="right-box">
<span class="span-title">{{ item.assetName }}:</span>
<span class="span-time">{{ item.xfTime }}</span>
</div>
</div>
</div>
</div>
<my-dialog title="查看原因" ref="liebiaoDialog" @close="importClose" class="taskDialogBox" width="40%">
<el-descriptions>
<el-descriptions-item label="不通过原因">
{{ chakanyuanyin }}
</el-descriptions-item>
</el-descriptions>
</my-dialog>
<el-button type="primary" @click="sendBack" class="fanhuipiaofu" size="mini">返回</el-button>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, computed } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import useUserStore from "@/store/modules/user";
import myPagination from "@/views/components/Pagination/index.vue";
import myDialog from "@/views/components/myDialog/index.vue";
import { getassetTaskid, geassetTaskcHc } from "@/api/renwuApi/index.js";
import { assetLcpage } from "@/api/renwuApi/index.js";
import {require} from "@/utils/require.js";
const route = useRoute();
const router = useRouter();
const userStore = useUserStore();
console.log("userStore:", userStore.roles);
const index = ref(1);
const formInline = ref({});
const formInlineTwo = ref({
unitName: "",
});
const total = ref(0);
const pagination = ref({
current: 1,
size: 10,
});
const tableData = ref([]);
const tableDataTwo = ref([]);
const loading = ref(false);
const tabHeader = ref(undefined);
const timeLineData = ref([]);
const titleInfoObj = ref({});
const chakanyuanyin = ref("");
const activeName = ref("0");
const xtmcName = ref("系统名称");
const liebiaoDialog = ref(null);
const chanckList = [
{
lable: "0",
conent: "web资产",
xtmcName: "系统名称",
},
{
lable: "1",
conent: "小程序资产",
xtmcName: "小程序名称",
},
{
lable: "2",
conent: "公众号资产",
xtmcName: "公众号名称",
},
{
lable: "3",
conent: "电子邮件资产",
xtmcName: "电子邮箱后缀",
},
{
lable: "4",
conent: "移动应用程序资产",
xtmcName: "移动应用程序名称",
},
];
const chanckListTow = ref([]);
const listTow = ref([]);
console.log('当前路由参数:', route.query);
const sendBack = () => {
if (localStorage.getItem('ismypagination')) {
let formInline = JSON.parse(localStorage.getItem('ismypagination'));
formInline.isfanhui = true;
localStorage.setItem("ismypagination", JSON.stringify(formInline));
}
//
titleInfo();
getList();
router.go(-1);
};
const handleClick = (tab) => {
activeName.value = tab.props.name;
xtmcName.value = tab.props.xtmcName;
localStorage.setItem("activeName", activeName.value);
handleQuery();
};
const returnidimg = (iswenzi) => {
const listsna = [
{
name: "下发",
imgdata: require('@/assets/images/rwxf.png'),
}, {
name: "提交",
imgdata: require('@/assets/images/wctj.png'),
}, {
name: "不通过",
imgdata: require('@/assets/images/shbh.png'),
}, {
name: "审核通过",
imgdata: require('@/assets/images/shtg.png'),
}, {
name: "驳回",
imgdata: require('@/assets/images/shbh.png'),
}
];
const item = listsna.find(item => iswenzi.includes(item.name));
return item ? item.imgdata : require('@/assets/images/wctj.png');
};
const assetLcpageList = async () => {
const obj = {
taskId: route.query.id || route.meta.id
};
const res = await assetLcpage(obj);
timeLineData.value = res.data;
};
const importClose = () => {};
const goInfo = (type, row) => {
if (type === 1) {
router.push({
name: 'mytaskAuditInfo',
query: {
pageType: "look",
taskId: row.taskId,
assetId: row.id,
type: activeName.value,
}
});
}
if (type === 2) {
router.push({
name: 'mytaskAuditInfo',
query: {
pageType: "change",
taskId: row.taskId,
assetId: row.id,
type: activeName.value,
}
});
}
if (type === 3) {
chakanyuanyin.value = row.btgyy;
liebiaoDialog.value.open();
}
};
const taskstatus = (id) => {
if (id) {
const obj = {
0: "已关闭",
1: "进行中",
2: "正常完成",
3: "超期完成",
4: "正常完成",
5: "审核驳回"
};
return obj[id];
}
return "-";
};
const titleInfoObjtype = (type = "0,1") => {
const list = type.split(",");
listTow.value = [];
chanckListTow.value = [];
chanckList.forEach(res => {
list.forEach(element => {
if (element === res.lable) {
listTow.value.push(res.conent);
chanckListTow.value.push(res);
}
});
});
activeName.value = chanckListTow.value[0].lable;
if (localStorage.getItem("activeName")) {
activeName.value = localStorage.getItem("activeName");
localStorage.setItem("activeName", activeName.value);
}
const listname = chanckListTow.value.filter(item => item.lable === activeName.value);
if (listname.length) {
xtmcName.value = listname[0].xtmcName;
}
handleQuery();
};
const titleInfo = async () => {
const res = await getassetTaskid(route.query.id || route.meta.id);
if (res.code === 200) {
titleInfoObj.value = res.data;
titleInfoObjtype(titleInfoObj.value.type);
}
};
const resetQuery = () => {
activeName.value = chanckListTow.value[0].lable;
pagination.value = {
current: 1,
size: 10,
type: activeName.value,
};
if (index.value === 1) {
formInline.value = {
type: activeName.value,
};
localStorage.removeItem("ismypaginationTow");
getList();
} else if (index.value === 2) {
formInlineTwo.value = {
unitName: "",
};
getListTwo();
}
};
const handleQuery = () => {
pagination.value = {
current: 1,
size: 10,
type: activeName.value,
};
if (index.value === 1) {
pagination.value = { ...pagination.value, ...formInline.value };
formInline.value.isfanhuiTow = false;
localStorage.setItem("ismypaginationTow", JSON.stringify(formInline.value));
getList();
} else if (index.value === 2) {
getListTwo();
}
};
const getPagination = (pages) => {
pagination.value.current = pages.page;
pagination.value.size = pages.limit;
if (index.value === 1) {
getList();
} else if (index.value === 2) {
getListTwo();
}
};
const activeTab = (id) => {
index.value = id;
if (id === 1) {
formInline.value = {
unit: "",
type: "",
status: "",
};
getList();
} else {
formInlineTwo.value = {
unitName: "",
};
getList();
}
};
const getList = async () => {
loading.value = true;
pagination.value.taskId = route.query.id || route.meta.id;
pagination.value.type = activeName.value;
if (userStore.roles.includes("unit")) {
pagination.value.dwmc = store.state.user.useer.nickName;
}
const res = await geassetTaskcHc(pagination.value);
tableData.value = res.data.records;
loading.value = false;
total.value = res.data.total;
};
const getListTwo = () => {};
const tableRowClassName = ({ rowIndex }) => {
return rowIndex % 2 !== 0 ? 'evenNumber-row' : '';
};
const cancalDebounce = () => {
const element = document.getElementById('L-size-main');
const header = document.getElementById('L-header');
const tab = document.getElementById('L-tab');
const pagination = document.getElementById('L-pagination');
if (element && header && pagination && tab) {
const elementHeight = element.offsetHeight;
const headerHeight = header.offsetHeight;
const paginationtHeight = pagination.offsetHeight;
const tabHeight = tab.offsetHeight;
tabHeader.value = elementHeight - headerHeight - paginationtHeight - tabHeight - 160;
}
};
onMounted(() => {
cancalDebounce();
window.addEventListener('resize', cancalDebounce);
titleInfo();
assetLcpageList();
if (localStorage.getItem('ismypaginationTow')) {
const storedData = JSON.parse(localStorage.getItem('ismypaginationTow'));
if (storedData.isfanhuiTow) {
formInline.value = storedData;
titleInfo();
} else {
localStorage.removeItem("ismypaginationTow");
}
}
});
onUnmounted(() => {
window.removeEventListener('resize', cancalDebounce);
});
</script>
<style lang="scss" scoped>
::v-deep .el-timeline {
padding-left: 0;
font-size: 12px;
}
::v-deep .el-form-item__label {
padding-right: 3px;
}
.look-info {}
::v-deep .el-dialog {
margin-top: 20vh !important;
}
.content-info {
position: relative;
}
.fanhuipiaofu {
position: absolute;
right: 20px;

Loading…
Cancel
Save