| | |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | <!-- 项目管理模块 --> |
| | | <view class="common-module project-module" |
| | | v-if="hasProjectItems"> |
| | | <view class="module-header"> |
| | | <view class="module-title-container"> |
| | | <text class="module-title">项目管理</text> |
| | | </view> |
| | | </view> |
| | | <view class="module-content"> |
| | | <up-grid :border="false" |
| | | col="4"> |
| | | <up-grid-item v-for="(item, index) in projectItems" |
| | | :key="index" |
| | | @click="handleCommonItemClick(item)"> |
| | | <view class="icon-container"> |
| | | <image :src="item.icon" |
| | | class="item-icon"></image> |
| | | </view> |
| | | <text class="item-label">{{item.label}}</text> |
| | | </up-grid-item> |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | <!-- 营销管理模块 --> |
| | | <view class="common-module marketing-module" |
| | | v-if="hasMarketingItems"> |
| | |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | <!-- 车辆管理模块 --> |
| | | <view class="common-module vehicle-module" |
| | | v-if="hasVehicleItems"> |
| | | <view class="module-header"> |
| | | <view class="module-title-container"> |
| | | <text class="module-title">车辆管理</text> |
| | | </view> |
| | | </view> |
| | | <view class="module-content"> |
| | | <up-grid :border="false" |
| | | col="4"> |
| | | <up-grid-item v-for="(item, index) in vehicleItems" |
| | | :key="index" |
| | | @click="handleCommonItemClick(item)"> |
| | | <view class="icon-container"> |
| | | <image :src="item.icon" |
| | | class="item-icon"></image> |
| | | </view> |
| | | <text class="item-label">{{item.label}}</text> |
| | | </up-grid-item> |
| | | </up-grid> |
| | | </view> |
| | | </view> |
| | | <!-- 安全生产模块 --> |
| | | <view class="common-module collaboration-module" |
| | | v-if="hasSafetyItems"> |
| | |
| | | // 工艺设计功能数据 |
| | | const designItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/xiaoshoubaojia.svg", |
| | | icon: "/static/images/icon/jichucanshu.svg", |
| | | label: "基础参数", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xiaoshoubaojia.svg", |
| | | icon: "/static/images/icon/gongxuguanli.svg", |
| | | label: "工序管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xiaoshoubaojia.svg", |
| | | icon: "/static/images/icon/bom.svg", |
| | | label: "BOM", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xiaoshoubaojia.svg", |
| | | icon: "/static/images/icon/gongyiluxian.svg", |
| | | label: "工艺路线", |
| | | }, |
| | | ]); |
| | | |
| | | // 项目管理功能数据 |
| | | const projectItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/xiangmuguanli.svg", |
| | | label: "项目管理", |
| | | }, |
| | | ]); |
| | | |
| | | // 车辆管理功能数据 |
| | | const vehicleItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/cheliangguanli.svg", |
| | | label: "车辆管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/jiayoukaguanli.svg", |
| | | label: "加油卡管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/jiayoujilu.svg", |
| | | label: "加油记录", |
| | | }, |
| | | ]); |
| | | |
| | |
| | | { |
| | | icon: "/static/images/icon/kehuwanglai.svg", |
| | | label: "客户往来", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/zhaotoubiaoguanli.svg", |
| | | label: "招投标管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/susongguanli.svg", |
| | | label: "诉讼管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/fahuotaizhang.svg", |
| | | label: "发货台账", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/hetongguanli.svg", |
| | | label: "销售合同", |
| | | }, |
| | | ]); |
| | | |
| | |
| | | // 档案管理功能数据 |
| | | const archiveManagementItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/gongyingshangdangan.svg", |
| | | icon: "/static/images/icon/jieyuedengji.svg", |
| | | label: "借阅登记", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/hetongguanli.svg", |
| | | icon: "/static/images/icon/guihuandengji.svg", |
| | | label: "归还登记", |
| | | }, |
| | | ]); |
| | |
| | | // 仓储物流功能数据 |
| | | const warehouseLogisticsItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/xiaoshoutaizhang.svg", |
| | | icon: "/static/images/icon/kucunguanli.svg", |
| | | label: "库存管理", |
| | | }, |
| | | ]); |
| | |
| | | icon: "/static/images/icon/hetongguanli.svg", |
| | | label: "合同管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/hetongguanli.svg", |
| | | label: "转正申请", |
| | | path: "/pages/oa/HrManage/regular-apply/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/renyuanxinzi.svg", |
| | | label: "调动申请", |
| | | path: "/pages/oa/HrManage/transfer-apply/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/gongchuguanli.svg", |
| | | label: "工作交接", |
| | | path: "/pages/oa/HrManage/work-handover/index", |
| | | }, |
| | | ]); |
| | | const qualityItems = reactive([ |
| | | { |
| | |
| | | { |
| | | icon: "/static/images/icon/chuchangjianyan.svg", |
| | | label: "出厂检验", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/baobiaoguanli.svg", |
| | | label: "报表管理", |
| | | }, |
| | | ]); |
| | | const safetyItems = reactive([ |
| | |
| | | ]); |
| | | // 协同办公功能数据 |
| | | const collaborationItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/xietongshenpi.svg", |
| | | label: "协同审批", |
| | | }, |
| | | // { |
| | | // icon: "/static/images/icon/xietongshenpi.svg", |
| | | // label: "协同审批", |
| | | // }, |
| | | { |
| | | icon: "/static/images/icon/guizhangzhidu.svg", |
| | | label: "审批管理", |
| | | path: "/pages/oa/ApproveManage/approve-template/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xietongshenpi.svg", |
| | | label: "协同审批", |
| | | path: "/pages/oa/ApproveManage/approve-list/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/huiyiguanli.svg", |
| | | label: "会议管理", |
| | |
| | | icon: "/static/images/icon/kehubaifang.svg", |
| | | label: "客户拜访", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/qingjiaguanli.svg", |
| | | label: "请假申请", |
| | | path: "/pages/oa/AttendManage/leave-apply/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/dakaqiandao.svg", |
| | | label: "加班申请", |
| | | path: "/pages/oa/AttendManage/overtime-apply/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/chuchaiguanli.svg", |
| | | label: "差旅报销", |
| | | path: "/pages/oa/ReimburseManage/travel-reimburse/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/baoxiaoguanli.svg", |
| | | label: "费用报销", |
| | | path: "/pages/oa/ReimburseManage/cost-reimburse/index", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/kuandaiyutongxin.svg", |
| | | label: "宽带与通信管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/fangwuzulin.svg", |
| | | label: "房屋租赁管理", |
| | | }, |
| | | ]); |
| | | |
| | | // 生产管控功能数据 |
| | | const productionItems = reactive([ |
| | | { |
| | | icon: "/static/images/icon/shengchandingdan@2x.svg", |
| | | label: "生产订单", |
| | | }, |
| | | // { |
| | | // icon: "/static/images/icon/shengchanpaigong@2x.svg", |
| | | // label: "生产派工", |
| | | // }, |
| | | // { |
| | | // icon: "/static/images/icon/shengchanpaichan@2x.svg", |
| | | // label: "工序排产", |
| | | // }, |
| | | { |
| | | icon: "/static/images/icon/shengchanbaogong.svg", |
| | | icon: "/static/images/icon/shengchanjihua.svg", |
| | | label: "主生产计划", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/shengchandingdan.svg", |
| | | label: "生产订单", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/shengchanzhuisu.svg", |
| | | label: "生产追溯", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/shengchanshikuang.svg", |
| | | label: "工序生产实况", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/shengchanpaichan.svg", |
| | | label: "生产排产", |
| | | }, |
| | | |
| | | { |
| | | icon: "/static/images/icon/shengchanbaogong.svg", |
| | | label: "生产报工", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/shengchanbaogong.svg", |
| | | label: "生产工单", |
| | | icon: "/static/images/icon/baogongtaizhang.svg", |
| | | label: "报工台账", |
| | | }, |
| | | // { |
| | | // icon: "/static/images/icon/shengchanhesuan@2x.svg", |
| | | // label: "生产核算", |
| | | // }, |
| | | { |
| | | icon: "/static/images/icon/shengchanhesuan.svg", |
| | | label: "生产核算", |
| | | }, |
| | | ]); |
| | | |
| | | // 设备管理功能数据 |
| | |
| | | // icon: '/static/images/icon/shebeitaizhang@2x.svg', |
| | | // label: '设备台账', |
| | | // }, |
| | | { |
| | | icon: "/static/images/icon/saomashebei.svg", |
| | | label: "扫码查设备", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/yunxingguanli.svg", |
| | | label: "运行管理", |
| | |
| | | }, |
| | | ]); |
| | | |
| | | // 扫码查设备:解析 deviceId 后跳转到设备信息页 |
| | | const getDeviceIdFromScan = scanResult => { |
| | | if (!scanResult) return null; |
| | | const match = scanResult.match(/deviceId=(\d+)/); |
| | | if (match && match[1]) return match[1]; |
| | | if (/^\d+$/.test(scanResult.trim())) return scanResult.trim(); |
| | | try { |
| | | const obj = JSON.parse(scanResult); |
| | | if (obj.deviceId) return String(obj.deviceId); |
| | | } catch (e) { |
| | | // 忽略非 JSON 内容 |
| | | } |
| | | return null; |
| | | }; |
| | | |
| | | const startScanDevice = () => { |
| | | uni.scanCode({ |
| | | scanType: ["qrCode", "barCode"], |
| | | success: res => { |
| | | console.log("扫码结果:", res.result); |
| | | const deviceId = getDeviceIdFromScan(res.result); |
| | | if (!deviceId) { |
| | | uni.showToast({ title: "未识别到设备ID", icon: "none" }); |
| | | return; |
| | | } |
| | | uni.navigateTo({ |
| | | url: `/pages/equipmentManagement/deviceInfo/index?deviceId=${deviceId}`, |
| | | }); |
| | | }, |
| | | fail: err => { |
| | | console.error("扫码失败:", err); |
| | | uni.showToast({ title: "扫码失败,请重试", icon: "none" }); |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | // 处理常用功能点击 |
| | | const handleCommonItemClick = item => { |
| | | if (item.path) { |
| | | uni.navigateTo({ url: item.path }); |
| | | return; |
| | | } |
| | | // 根据不同的功能项进行跳转 |
| | | switch (item.label) { |
| | | case "客户档案": |
| | |
| | | case "客户往来": |
| | | uni.navigateTo({ |
| | | url: "/pages/sales/receiptPaymentLedger/index", |
| | | }); |
| | | break; |
| | | case "项目管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/projectManagement/project/index", |
| | | }); |
| | | break; |
| | | case "招投标管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/sales/biddingManagement/index", |
| | | }); |
| | | break; |
| | | case "诉讼管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/sales/lawsuitManagement/index", |
| | | }); |
| | | break; |
| | | case "发货台账": |
| | | uni.navigateTo({ |
| | | url: "/pages/sales/deliveryLedger/index", |
| | | }); |
| | | break; |
| | | case "销售合同": |
| | | uni.navigateTo({ |
| | | url: "/pages/sales/contractManagement/index", |
| | | }); |
| | | break; |
| | | case "报表管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/qualityManagement/inspectionReport/index", |
| | | }); |
| | | break; |
| | | case "车辆管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/inventoryManagement/vehicleInfo/index", |
| | | }); |
| | | break; |
| | | case "加油卡管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/inventoryManagement/fuelCard/index", |
| | | }); |
| | | break; |
| | | case "加油记录": |
| | | uni.navigateTo({ |
| | | url: "/pages/inventoryManagement/fuelRecord/index", |
| | | }); |
| | | break; |
| | | case "宽带与通信管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/cooperativeOffice/broadbandCommunication/index", |
| | | }); |
| | | break; |
| | | case "房屋租赁管理": |
| | | uni.navigateTo({ |
| | | url: "/pages/cooperativeOffice/houseLeaseManagement/index", |
| | | }); |
| | | break; |
| | | case "采购台账": |
| | |
| | | url: "/pages/productionManagement/productionDispatching/index", |
| | | }); |
| | | break; |
| | | case "工序排产": |
| | | case "工艺路线": |
| | | uni.navigateTo({ |
| | | url: "/pages/productionManagement/processScheduling/index", |
| | | url: "/pages/productionManagement/processRoute/index", |
| | | }); |
| | | break; |
| | | case "生产工单": |
| | |
| | | url: "/pages/productionManagement/mainProductionPlan/index", |
| | | }); |
| | | break; |
| | | case "生产排产": |
| | | uni.navigateTo({ |
| | | url: "/pages/productionManagement/productionScheduling/index", |
| | | }); |
| | | break; |
| | | case "生产报工": |
| | | getcode(); |
| | | break; |
| | | case "报工台账": |
| | | uni.navigateTo({ |
| | | url: "/pages/productionManagement/productionReporting/ledger", |
| | | }); |
| | | break; |
| | | case "生产核算": |
| | | uni.navigateTo({ |
| | | url: "/pages/productionManagement/productionAccounting/index", |
| | | }); |
| | | break; |
| | | case "生产追溯": |
| | | uni.navigateTo({ |
| | | url: "/pages/productionManagement/productionTraceability/index", |
| | | }); |
| | | break; |
| | | case "工序生产实况": |
| | | uni.navigateTo({ |
| | | url: "/pages/productionManagement/processStatistics/index", |
| | | }); |
| | | break; |
| | | case "设备台账": |
| | | uni.navigateTo({ |
| | | url: "/pages/equipmentManagement/ledger/index", |
| | | }); |
| | | break; |
| | | case "扫码查设备": |
| | | startScanDevice(); |
| | | break; |
| | | case "运行管理": |
| | | uni.navigateTo({ |
| | |
| | | factoryList.value = []; |
| | | }); |
| | | } |
| | | const getcode = () => { |
| | | const getcode = async () => { |
| | | uni.scanCode({ |
| | | success: async res => { |
| | | // 解析二维码内容 |
| | |
| | | // 新接口返回的是单个对象,不是数组 |
| | | const workData = workRes.data; |
| | | console.log("工单数据:", workData); |
| | | |
| | | if (workData.endOrder === true) { |
| | | modal.msgError("该订单已结束,无法报工"); |
| | | return; |
| | | } |
| | | |
| | | orderRow = JSON.stringify(workData); |
| | | |
| | |
| | | |
| | | // 收集所有有权限的菜单标题(根据 meta.title) |
| | | const allowedMenuTitles = new Set(); |
| | | const alwaysShowTitles = new Set(["采购退货单", "供应商管理"]); |
| | | const alwaysShowTitles = new Set(["采购退货单", "供应商管理", "扫码查设备"]); |
| | | const collectMenuTitles = routes => { |
| | | if (!Array.isArray(routes)) return; |
| | | routes.forEach(route => { |
| | |
| | | specialMapping: { 规章制度: "规章制度管理" }, |
| | | }, |
| | | purchase: { specialMapping: { 供应商档案: "供应商管理" } }, |
| | | // 手机端人事模块已占用「合同管理」label(走 /staff/staffContract), |
| | | // 销售合同改用「销售合同」label,此处映射回后端的菜单标题 |
| | | marketing: { specialMapping: { 销售合同: "合同管理" } }, |
| | | }; |
| | | console.log(allowedMenuTitles); |
| | | // 通用过滤函数 |
| | | const filterArray = (targetArray, specialMapping) => { |
| | | const filtered = targetArray.filter(item => { |
| | | if (alwaysShowTitles.has(item.label)) return true; |
| | | let matched = allowedMenuTitles.has(item.label); |
| | | if (specialMapping && !matched && specialMapping[item.label]) { |
| | | matched = allowedMenuTitles.has(specialMapping[item.label]); |
| | |
| | | }; |
| | | |
| | | // 过滤各个模块 |
| | | filterArray(marketingItems); |
| | | filterArray(marketingItems, menuMapping.marketing.specialMapping); |
| | | filterArray(designItems); |
| | | filterArray(purchaseItems, menuMapping.purchase.specialMapping); |
| | | filterArray(financeManagementItems); |
| | | filterArray(collaborationItems, menuMapping.collaboration.specialMapping); |
| | |
| | | filterArray(productionItems); |
| | | filterArray(equipmentItems); |
| | | filterArray(archiveManagementItems); |
| | | filterArray(afterSalesServiceItems); |
| | | filterArray(projectItems); |
| | | filterArray(vehicleItems); |
| | | }; |
| | | |
| | | // 检查模块是否有菜单项需要显示 |
| | |
| | | const hasArchiveManagementItems = computed( |
| | | () => archiveManagementItems.length > 0 |
| | | ); |
| | | const hasProjectItems = computed(() => projectItems.length > 0); |
| | | const hasVehicleItems = computed(() => vehicleItems.length > 0); |
| | | |
| | | onMounted(() => { |
| | | // 每次进入首页都强制刷新用户信息和路由权限,不做本地缓存判断 |
| | |
| | | --module-color: #4caf50; |
| | | } |
| | | |
| | | .oa-module { |
| | | --module-color: #673ab7; |
| | | } |
| | | |
| | | .production-module { |
| | | --module-color: #ff9800; |
| | | } |
| | | |
| | | .equipment-module { |
| | | --module-color: #9c27b0; |
| | | } |
| | | |
| | | .project-module { |
| | | --module-color: #0066ff; |
| | | } |
| | | |
| | | .vehicle-module { |
| | | --module-color: #ff8a3d; |
| | | } |
| | | |
| | | .module-header { |
| | |
| | | --module-color: #4caf50; |
| | | } |
| | | |
| | | .oa-module { |
| | | --module-color: #673ab7; |
| | | } |
| | | |
| | | .production-module { |
| | | --module-color: #ff9800; |
| | | } |
| | |
| | | --module-color: #9c27b0; |
| | | } |
| | | |
| | | .project-module { |
| | | --module-color: #0066ff; |
| | | } |
| | | |
| | | .vehicle-module { |
| | | --module-color: #ff8a3d; |
| | | } |
| | | |
| | | .module-header { |
| | | margin-bottom: 18px; |
| | | padding-left: 18px; |