From 807d02b7a650c6450c313dd728848e02f74a1b78 Mon Sep 17 00:00:00 2001
From: Admin <978517621@qq.com>
Date: 星期一, 28 十一月 2022 15:15:34 +0800
Subject: [PATCH] 添加提示
---
src/views/specialCheck/index.vue | 3 -
src/views/layout/components/Sidebar/index.vue | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 105 insertions(+), 6 deletions(-)
diff --git a/src/views/layout/components/Sidebar/index.vue b/src/views/layout/components/Sidebar/index.vue
index 9ccb651..1890b89 100644
--- a/src/views/layout/components/Sidebar/index.vue
+++ b/src/views/layout/components/Sidebar/index.vue
@@ -19,7 +19,10 @@
import { mapGetters } from 'vuex'
import SidebarItem from './SidebarItem'
import variables from '@/styles/variables.scss'
-
+import { getCheckUnitType, getSpecialCheckTask } from "@/api/specialCheck"
+import { getUnDoneCheckTask } from '@/api/selfCheck'
+import lazyLoading from "../../../../utils/lazyLoading";
+import {initRouterNode} from "../../../../utils/router";
export default {
components: { SidebarItem },
computed: {
@@ -35,10 +38,109 @@
},
data() {
return {
- isCollapse: false
+ isCollapse: false,
+ unitType: null,
+ deadline: ''
}
},
- methods: {
+ created() {
+ const t = this
+ t.getCheckUnitType()
+ },
+ methods: {
+ async getCheckUnitType(){
+ const t = this
+ const constRoutes = []
+ let res = await getCheckUnitType()
+ if(res.data.code === "200"){
+ t.unitType = res.data.result.checkUnitType
+ if(t.unitType>0){
+ t.getSpecialCheckTask().then((res)=>{
+ const date = new Date(res);
+ if(date.getTime() > Date.now()){
+ for (let index in t.permission_routes){
+ if(t.permission_routes[index].title && t.permission_routes[index].title == '安全专项检查'){
+ t.permission_routes[index].title = t.permission_routes[index].title + '(1)'
+ }
+ }
+ t.initRouterNode(constRoutes, t.permission_routes)
+ t.$store.commit('SET_ROUTES', constRoutes.filter(item => item.children.length > 0))
+ }
+ })
+ }
+ }else{
+ t.getUncheckList().then((res)=>{
+ if(res[0].selfcheckStatus == 0 || (res[0].selfcheckStatus == 1 && res[0].rectifyStatus ==0)){
+ for (let index in t.permission_routes){
+ if(t.permission_routes[index].title && t.permission_routes[index].title == '专项检查'){
+ t.permission_routes[index].title = t.permission_routes[index].title + '(1)'
+ }
+ }
+ t.initRouterNode(constRoutes, t.permission_routes)
+ t.$store.commit('SET_ROUTES', constRoutes.filter(item => item.children.length > 0))
+ }
+ })
+ }
+ },
+
+ async getSpecialCheckTask(){
+ const t = this
+ const res = await getSpecialCheckTask()
+ if(res.data.code === "200"){
+ if(res.data.result.specialCheckTaskSimplifyInfos.length>0){
+ return res.data.result.specialCheckTaskSimplifyInfos[0].deadline
+ }
+ }else{
+ t.$message({
+ type:'warning',
+ message:res.data.message
+ })
+ }
+ },
+
+ async getUncheckList(){
+ const t = this
+ let data = {pageIndex: 1,pageSize: 10}
+ let res = await getUnDoneCheckTask(data)
+ if(res.data.code === "200"){
+ if(res.data.result.records.length>0){
+ return res.data.result.records
+ }
+ }else{
+ t.$message({
+ type:'warning',
+ message:res.data.message
+ })
+ }
+ },
+
+ initRouterNode(routers, data) {
+ for (var item of data) {
+ if (item.type !== 1) {
+ continue
+ }
+ const menu = Object.assign({}, item)
+
+ // menu.component = import(`@/views/${menu.component}.vue`)
+
+ menu.component = lazyLoading(menu.component)
+
+ if (item.children && item.children.length > 0) {
+ menu.children = []
+ initRouterNode(menu.children, item.children)
+ }
+
+ const meta = {}
+ // 给页面添加权限、标题、第三方网页链接
+ meta.permTypes = menu.permTypes ? menu.permTypes : null
+ meta.title = menu.title ? menu.title : null
+ meta.url = menu.url ? menu.url : null
+ if (menu.icon) { meta.icon = menu.icon }
+ menu.meta = meta
+
+ routers.push(menu)
+ }
+ }
}
}
</script>
diff --git a/src/views/specialCheck/index.vue b/src/views/specialCheck/index.vue
index beeaf74..8080813 100644
--- a/src/views/specialCheck/index.vue
+++ b/src/views/specialCheck/index.vue
@@ -96,9 +96,6 @@
t.taskMenu = res.data.result.specialCheckTaskSimplifyInfos
t.openeds[0] = t.taskMenu[0].id + '-' + t.taskMenu[0].taskName
t.openeds[1] = '1'
- console.log(t.openeds,'openeds')
- // t.$refs.wholesale.enterpriseType = t.unitType
- // t.$refs.wholesale.getEnterpriseCompleteInfoList()
}else{
t.$message({
type:'warning',
--
Gitblit v1.9.2