diff --git a/.env.development b/.env.development index 500d6b0..2439ac8 100644 --- a/.env.development +++ b/.env.development @@ -12,9 +12,7 @@ VITE_APP_BASE_API = 'http://192.168.110.209:8899' # 罗成 # VITE_APP_BASE_API = 'http://192.168.110.213:8899' # 朱银 -# VITE_APP_BASE_API = 'http://192.168.110.149:8899' -#曾涛 -# VITE_APP_BASE_API = 'http://192.168.110.171:8899' +# VITE_APP_BASE_API = 'http://192.168.110.180:8899' # 无人机接口地址 diff --git a/public/catalog.xlsx b/public/catalog.xlsx index 1cca466..7ebf378 100644 Binary files a/public/catalog.xlsx and b/public/catalog.xlsx differ diff --git a/src/App.vue b/src/App.vue index c641c7d..a0780e4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,3 +19,11 @@ onMounted(() => { }); }); + diff --git a/src/api/design/appointment/index.ts b/src/api/design/appointment/index.ts index 61fdca8..9deefc3 100644 --- a/src/api/design/appointment/index.ts +++ b/src/api/design/appointment/index.ts @@ -27,3 +27,11 @@ export const systemUserList = (query) => { params: query }); }; +// 查询 +export const desUserList = (query) => { + return request({ + url: '/design/drawingreviewReceipts/desUser/list', + method: 'get', + params: query + }); +}; diff --git a/src/api/design/drawingreview/index.ts b/src/api/design/drawingreview/index.ts index d28e0be..7ed39e6 100644 --- a/src/api/design/drawingreview/index.ts +++ b/src/api/design/drawingreview/index.ts @@ -56,7 +56,7 @@ export const fillOutTheDesignVerificationForm = (data) => { export const drawingreviewReceipts = (data) => { return request({ url: '/design/drawingreviewReceipts', - method: 'post', + method: 'put', data }); }; @@ -96,3 +96,10 @@ export const drawingreview = (id) => { method: 'get' }); }; +// 获取单据 +export const getDrawingreviewReceipts = (id) => { + return request({ + url: '/design/drawingreviewReceipts/review/' + id, + method: 'get' + }); +}; diff --git a/src/api/formalities/listOfFormalities/index.ts b/src/api/formalities/listOfFormalities/index.ts index 427f8d8..61fcba2 100644 --- a/src/api/formalities/listOfFormalities/index.ts +++ b/src/api/formalities/listOfFormalities/index.ts @@ -75,3 +75,12 @@ export const getWhetherItExists = (id: string | number): AxiosPromise => { + return request({ + url: '/formalities/formalitiesAreConsolidated/addFormalities', + method: 'post', + data + }); +}; diff --git a/src/api/materials/batchPlan/index.ts b/src/api/materials/batchPlan/index.ts index c9231af..5b9690b 100644 --- a/src/api/materials/batchPlan/index.ts +++ b/src/api/materials/batchPlan/index.ts @@ -160,3 +160,13 @@ export const obtainTheVersion = (query: any) => { params: query }); }; +/** + * 获取到物资剩余量 + */ +export const mrpBaseRemaining = (query: any) => { + return request({ + url: '/cailiaoshebei/mrpBase/remaining', + method: 'get', + params: query + }); +}; diff --git a/src/api/materials/materialIssue/index.ts b/src/api/materials/materialIssue/index.ts index a366fa6..99af31a 100644 --- a/src/api/materials/materialIssue/index.ts +++ b/src/api/materials/materialIssue/index.ts @@ -68,3 +68,10 @@ export const getMaterialName = (id: any) => { method: 'get' }); }; +//获取出库记录 +export const inventoryList = (id: any) => { + return request({ + url: '/materials/materialIssue/inventory/list/' + id, + method: 'get' + }); +}; diff --git a/src/api/menu.ts b/src/api/menu.ts index a3ae80e..fc1d542 100644 --- a/src/api/menu.ts +++ b/src/api/menu.ts @@ -3,9 +3,9 @@ import { AxiosPromise } from 'axios'; import { RouteRecordRaw } from 'vue-router'; // 获取路由 -export function getRouters(): AxiosPromise { +export function getRouters(id: string): AxiosPromise { return request({ - url: '/system/menu/getRouters', + url: '/system/menu/getRouters/' + id, method: 'get' }); } diff --git a/src/api/project/contractor/types.ts b/src/api/project/contractor/types.ts index f041fa6..0d4ab3f 100644 --- a/src/api/project/contractor/types.ts +++ b/src/api/project/contractor/types.ts @@ -28,10 +28,10 @@ export interface ContractorVO { * 管理人联系电话 */ custodianPhone: string; - /** + /** * 分包类型 */ - contractorType?: string; + contractorType?: string; /** * 公司相关文件 @@ -54,6 +54,14 @@ export interface ContractorForm extends BaseEntity { * 主键id */ id?: string | number; + /** + * 供应商id + */ + supplierId?: string | number; + /** + * 供应商 + */ + supplier?: string; /** * 主键id @@ -127,10 +135,10 @@ export interface ContractorQuery extends PageQuery { * 管理人联系电话 */ custodianPhone?: string; - /** + /** * 分包类型 */ - contractorType?: string; + contractorType?: string; /** * 日期范围参数 diff --git a/src/api/project/project/index.ts b/src/api/project/project/index.ts index 5b76894..04d5b65 100644 --- a/src/api/project/project/index.ts +++ b/src/api/project/project/index.ts @@ -186,3 +186,14 @@ export const uploadProjectFile = (data: any) => { data: data }); }; + +/** + * 切换项目 + * @param id + */ +export const changeProject = (id: string | number) => { + return request({ + url: '/project/project/changeProject/' + id, + method: 'get' + }); +}; diff --git a/src/api/supplierInput/supplierInput/index.ts b/src/api/supplierInput/supplierInput/index.ts index 719aa11..834b072 100644 --- a/src/api/supplierInput/supplierInput/index.ts +++ b/src/api/supplierInput/supplierInput/index.ts @@ -8,7 +8,7 @@ import { SupplierInputVO, SupplierInputForm, SupplierInputQuery } from '@/api/su * @returns {*} */ -export const listSupplierInput = (query?: SupplierInputQuery): AxiosPromise => { +export const listSupplierInput = (query?: any): AxiosPromise => { return request({ url: '/supplierInput/supplierInput/list', method: 'get', diff --git a/src/api/system/menu/index.ts b/src/api/system/menu/index.ts index 7a0cf74..15cf1b5 100644 --- a/src/api/system/menu/index.ts +++ b/src/api/system/menu/index.ts @@ -68,3 +68,11 @@ export const delMenu = (menuId: string | number) => { method: 'delete' }); }; + +// 获取所有路由 +export const getAllRouters = () => { + return request({ + url: '/system/menu/getAllRouters', + method: 'get' + }); +}; diff --git a/src/api/system/post/index.ts b/src/api/system/post/index.ts index a910be8..54a64b2 100644 --- a/src/api/system/post/index.ts +++ b/src/api/system/post/index.ts @@ -75,3 +75,11 @@ export function getRoleList(deptId?: number | string): AxiosPromise { } }); } + +// 获取部门下的项目列表 +export function getProjectByDeptId(deptId?: number | string): AxiosPromise { + return request({ + url: '/system/dept/projectIdList/' + deptId, + method: 'get' + }); +} diff --git a/src/api/system/user/types.ts b/src/api/system/user/types.ts index 4bdca11..88461ad 100644 --- a/src/api/system/user/types.ts +++ b/src/api/system/user/types.ts @@ -60,19 +60,20 @@ export interface UserForm { nickName?: string; password: string; phonenumber?: string; + projectRoles?: any[]; email?: string; sex?: string; status: string; remark?: string; postIds: string[]; - roleIds: string[]; filePath?: string; } export interface UserInfoVO { user: UserVO; roles: RoleVO[]; - roleIds: string[]; + + projectRoles: any[]; posts: PostVO[]; postIds: string[]; roleGroup: string; diff --git a/src/components/Process/submitVerify.vue b/src/components/Process/submitVerify.vue index 03000a9..f678b11 100644 --- a/src/components/Process/submitVerify.vue +++ b/src/components/Process/submitVerify.vue @@ -185,6 +185,10 @@ const props = defineProps({ taskVariables: { type: Object as () => Record, default: () => {} + }, + businessId1: { + type: String, + default: '' } }); //遮罩层 @@ -336,6 +340,9 @@ const handleCompleteTask = async () => { } if (isDrawing.value) { isShowSubmit.value = true; + nextTick(() => { + detailFormTeRef.value.getInfo(props.businessId1); + }); return; } await proxy?.$modal.confirm('是否确认提交?'); @@ -538,6 +545,9 @@ const handleTermination = async () => { const handleTerminationTask = async () => { if (isDrawing.value) { isShowTermination.value = true; + nextTick(() => { + detailFormTeRef.value.getInfo(props.businessId); + }); return; } const params = { diff --git a/src/components/ProjectSelector/index.vue b/src/components/ProjectSelector/index.vue index 5ba301d..1259482 100644 --- a/src/components/ProjectSelector/index.vue +++ b/src/components/ProjectSelector/index.vue @@ -1,5 +1,5 @@ , @@ -49,7 +55,22 @@ const props = defineProps({ default: '' } }); +const total = ref(0); +onMounted(() => { + if (onlyOneChild.value.meta?.title == '我的待办' || props.item.meta?.title == '我的任务') { + console.log(44444444); + getWaitingList(); + } +}); +// 获取我的待办 +//分页 +const getWaitingList = () => { + pageByTaskWait({ pageNum: 1, pageSize: 10 }).then((resp) => { + console.log(resp); + total.value = resp.total; + }); +}; const onlyOneChild = ref({}); const hasOneShowingChild = (parent: RouteRecordRaw, children?: RouteRecordRaw[]) => { @@ -64,12 +85,12 @@ const hasOneShowingChild = (parent: RouteRecordRaw, children?: RouteRecordRaw[]) return true; }); - // When there is only one child router, the child router is displayed by default + // 只有一个子路由时默认显示子路由 if (showingChildren.length === 1) { return true; } - // Show parent if there are no child router to display + // 没有子路由可显示时显示父路由 if (showingChildren.length === 0) { onlyOneChild.value = { ...parent, path: '', noShowingChildren: true }; return true; @@ -98,4 +119,49 @@ const hasTitle = (title: string | undefined): string => { } return title; }; +//用深度监听 消息 +watch( + () => noticeStore.state.value.notices, + (newVal) => { + if (onlyOneChild.value.meta?.title == '我的待办') { + console.log(121212121); + + let time = setTimeout(() => { + getWaitingList(); + clearTimeout(time); + }, 500); + } + }, + { deep: true } +); + + diff --git a/src/permission.ts b/src/permission.ts index 9e4507a..6162675 100644 --- a/src/permission.ts +++ b/src/permission.ts @@ -1,3 +1,4 @@ +import $cache from '@/plugins/cache'; import { to as tos } from 'await-to-js'; import router from './router'; import NProgress from 'nprogress'; @@ -9,6 +10,8 @@ import useUserStore from '@/store/modules/user'; import useSettingsStore from '@/store/modules/settings'; import usePermissionStore from '@/store/modules/permission'; +let isFirst = false; + NProgress.configure({ showSpinner: false }); const whiteList = ['/login', '/register', '/social-callback', '/register*', '/register/*', '/materials/purchaseDoc/uploadCode']; @@ -16,54 +19,64 @@ const isWhiteList = (path: string) => { return whiteList.some((pattern) => isPathMatch(pattern, path)); }; -router.beforeEach(async (to, from, next) => { +router.beforeEach(async (to, from) => { NProgress.start(); - if (to.path == '/indexEquipment' || to.path == '/materials/purchaseDoc/uploadCode' || to.path == '/codeDetail') { - next(); - } else if (getToken()) { - to.meta.title && useSettingsStore().setTitle(to.meta.title); - /* has token*/ - if (to.path === '/login') { - next({ path: '/' }); - NProgress.done(); - } else if (isWhiteList(to.path)) { - next(); - } else { - if (useUserStore().roles.length === 0) { - isRelogin.show = true; - // 判断当前用户是否已拉取完user_info信息 - const [err] = await tos(useUserStore().getInfo()); - if (err) { - await useUserStore().logout(); - ElMessage.error(err); - next({ path: '/' }); - } else { - isRelogin.show = false; - const accessRoutes = await usePermissionStore().generateRoutes(); - // 根据roles权限生成可访问的路由表 - accessRoutes.forEach((route) => { - if (!isHttp(route.path)) { - router.addRoute(route); // 动态添加可访问路由表 - } - }); - // @ts-expect-error hack方法 确保addRoutes已完成 - next({ path: to.path, replace: true, params: to.params, query: to.query, hash: to.hash, name: to.name as string }); // hack方法 确保addRoutes已完成 - } - } else { - next(); - } - } - } else { - // 没有token - if (isWhiteList(to.path)) { - // 在免登录白名单,直接进入 - next(); - } else { - const redirect = encodeURIComponent(to.fullPath || '/'); - next(`/login?redirect=${redirect}`); // 否则全部重定向到登录页 - NProgress.done(); - } + + // 特殊页面放行 + if (['/indexEquipment', '/materials/purchaseDoc/uploadCode', '/codeDetail'].includes(to.path)) { + return true; } + + // 已登录 + if (getToken()) { + if (to.meta.title) useSettingsStore().setTitle(to.meta.title); + + if (to.path === '/login') { + NProgress.done(); + return { path: '/' }; + } + + if (isWhiteList(to.path)) { + return true; + } + if ((!isFirst && useUserStore().roles.length === 0) || $cache.local.getJSON('isCheckRole') === 'true') { + isFirst = true; + isRelogin.show = true; + + const [err] = await tos(useUserStore().getInfo()); + + if (err) { + await useUserStore().logout(); + ElMessage.error(err); + NProgress.done(); + return { path: '/' }; + } + + isRelogin.show = false; + const accessRoutes = await usePermissionStore().generateRoutes(); + accessRoutes.forEach((route) => { + if (!isHttp(route.path)) router.addRoute(route); + }); + + $cache.local.remove('isCheckRole'); + + // 确保路由已添加后再跳转 + return { ...to, replace: true }; + } + + return true; + } else { + isFirst = false; + } + + // 未登录 + if (isWhiteList(to.path)) { + return true; + } + + const redirect = encodeURIComponent(to.fullPath || '/'); + NProgress.done(); + return { path: `/login?redirect=${redirect}` }; }); router.afterEach(() => { diff --git a/src/router/index.ts b/src/router/index.ts index a14689d..083d2d1 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -1,6 +1,7 @@ import { createWebHistory, createRouter, RouteRecordRaw } from 'vue-router'; /* Layout */ import Layout from '@/layout/index.vue'; +import usePermissionStore from '@/store/modules/permission'; /** * Note: 路由配置项 @@ -65,11 +66,7 @@ export const constantRoutes: RouteRecordRaw[] = [ component: () => import('@/views/register.vue'), hidden: true }, - { - path: '/:pathMatch(.*)*', - component: () => import('@/views/error/404.vue'), - hidden: true - }, + { path: '/401', component: () => import('@/views/error/401.vue'), @@ -134,10 +131,16 @@ export const constantRoutes: RouteRecordRaw[] = [ component: () => import('@/views/gis2D/index.vue'), hidden: true }, + { path: '/materials/purchaseDoc/uploadCode', component: () => import('@/views/materials/purchaseDoc/uploadCode.vue'), hidden: true + }, + { + path: '/:pathMatch(.*)*', + component: () => import('@/views/error/404.vue'), + hidden: true } ]; @@ -231,3 +234,11 @@ const router = createRouter({ }); export default router; + +export function resetRouter() { + router.getRoutes().forEach((route) => { + if (route.name && !constantRoutes.find((r) => r.name === route.name)) { + router.hasRoute(route.name) && router.removeRoute(route.name); + } + }); +} diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 43fcef8..7efcf2d 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -10,6 +10,7 @@ import ParentView from '@/components/ParentView/index.vue'; import InnerLink from '@/layout/components/InnerLink/index.vue'; import { createCustomNameComponent } from '@/utils/createCustomNameComponent'; +import { useUserStoreHook } from './user'; // 匹配views里面所有的.vue文件 const modules = import.meta.glob('./../../views/**/*.vue'); @@ -44,7 +45,7 @@ export const usePermissionStore = defineStore('permission', () => { sidebarRouters.value = routes; }; const generateRoutes = async (): Promise => { - const res = await getRouters(); + const res = await getRouters(useUserStoreHook().selectedProject?.id || '0'); const { data } = res; const sdata = JSON.parse(JSON.stringify(data)); const rdata = JSON.parse(JSON.stringify(data)); diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index e62d8ae..086d45c 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -28,7 +28,6 @@ const getSelectedProjectFromStorage = () => { const getProjectTeamListFromStorage = () => { const stored = $cache.local.getJSON('ProjectTeamList'); console.log('获取缓存的项目班组列表:', stored); - return stored ? stored : null; }; @@ -41,7 +40,9 @@ export const useUserStore = defineStore('user', () => { const deptId = ref(''); const avatar = ref(''); const roles = ref>([]); // 用户角色编码集合 → 判断路由权限 - const permissions = ref>([]); // 用户权限编码集合 → 判断按钮权限 + const permissions = ref>([]); // 用户权限编码集合 → 判断按钮权限 + const permissionList = ref>([]); // 用户所有权限列表 + const roleList = ref>([]); // 用户所有角色列表 const projects = ref>([]); // 从localStorage获取缓存的项目,如果没有则默认为null @@ -66,15 +67,32 @@ export const useUserStore = defineStore('user', () => { // 获取用户信息 const getInfo = async (): Promise => { + // **新增项目数据获取** + const [projectErr, projectRes] = await to(getUserProject()); + if (projectRes?.data) { + const projectList = projectRes.data.map((p) => ({ + id: p.projectId, + name: p.projectName || '未知项目' + })); + setProjects(projectList); + // 如果有缓存的选中项目,且该项目在当前项目列表中存在,则使用缓存的项目 + const storedProject = getSelectedProjectFromStorage(); + if (storedProject && projectList.some((p) => p.id === storedProject.id)) { + setSelectedProject(storedProject); + } else if (projectList.length > 0) { + // 否则默认选择第一个项目 + setSelectedProject(projectList[0]); + } + } const [err, res] = await to(getUserInfo()); if (res) { const data = res.data; const user = data.user; const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar; - if (data.roles && data.roles.length > 0) { - roles.value = data.roles; - permissions.value = data.permissions; + permissionList.value = data.permissions; + roleList.value = data.roles; + setRoles(); } else { roles.value = ['ROLE_DEFAULT']; } @@ -85,30 +103,38 @@ export const useUserStore = defineStore('user', () => { tenantId.value = user.tenantId; deptId.value = user.deptId; - // **新增项目数据获取** - const [projectErr, projectRes] = await to(getUserProject()); - if (projectRes?.data) { - const projectList = projectRes.data.map((p) => ({ - id: p.projectId, - name: p.projectName || '未知项目' - })); - - setProjects(projectList); - - // 如果有缓存的选中项目,且该项目在当前项目列表中存在,则使用缓存的项目 - const storedProject = getSelectedProjectFromStorage(); - if (storedProject && projectList.some((p) => p.id === storedProject.id)) { - setSelectedProject(storedProject); - } else if (projectList.length > 0) { - // 否则默认选择第一个项目 - setSelectedProject(projectList[0]); - } - } - return Promise.resolve(); } return Promise.reject(err); }; + const setInfo = async () => { + const [err, res] = await to(getUserInfo()); + if (res) { + const data = res.data; + const user = data.user; + const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar; + if (data.roles && data.roles.length > 0) { + permissionList.value = data.permissions; + roleList.value = data.roles; + setRoles(); + } else { + roles.value = ['ROLE_DEFAULT']; + } + name.value = user.userName; + nickname.value = user.nickName; + avatar.value = profile; + userId.value = user.userId; + tenantId.value = user.tenantId; + deptId.value = user.deptId; + } + }; + + const setRoles = () => { + const projectRole = roleList.value.find((item) => item.projectId == selectedProject.value?.id)?.projectRoles || []; + roles.value = projectRole; + const projectPermissions = permissionList.value.find((item) => item.projectId == selectedProject.value?.id)?.projectPermissions || []; + permissions.value = projectPermissions; + }; // 注销 const logout = async (): Promise => { @@ -158,7 +184,9 @@ export const useUserStore = defineStore('user', () => { setProjectTeamList, projects, selectedProject, - ProjectTeamList + ProjectTeamList, + setInfo, + setRoles }; }); diff --git a/src/utils/sse.ts b/src/utils/sse.ts index 04103f7..897d3ac 100644 --- a/src/utils/sse.ts +++ b/src/utils/sse.ts @@ -20,12 +20,10 @@ export const initSSE = (url: any) => { }); watch(error, () => { - console.log('SSE connection error:', error.value); error.value = null; }); watch(data, () => { - console.log('🚀 ~ initSSE ~ data:', JSON.parse(data.value)); let label = ''; let route1 = ''; let detailId = ''; @@ -33,6 +31,9 @@ export const initSSE = (url: any) => { if (JSON.parse(data.value)) { const obj = JSON.parse(data.value); route1 = obj.type; + if (obj.type == 'count') { + return; + } label = obj.content; // detailId = obj.detailId; data.value = null; diff --git a/src/views/biddingManagemen/biddingLimit/index.vue b/src/views/biddingManagemen/biddingLimit/index.vue index ce13de3..eca3c03 100644 --- a/src/views/biddingManagemen/biddingLimit/index.vue +++ b/src/views/biddingManagemen/biddingLimit/index.vue @@ -63,14 +63,7 @@ diff --git a/src/views/contract/bidCost/index.vue b/src/views/contract/bidCost/index.vue index 46e9499..9ef0c55 100644 --- a/src/views/contract/bidCost/index.vue +++ b/src/views/contract/bidCost/index.vue @@ -48,7 +48,7 @@ icon="view" @click="handleViewInfo" v-hasPermi="['bidding:biddingLimitList:getVersionDetail']" - v-if="versionObj.status != 'draft'" + v-if="versionObj.status && versionObj.status != 'draft'" >查看流程 @@ -60,13 +60,22 @@ - + + +