| | |
| | | <template> |
| | | <view class="content"> |
| | | <!-- OA办公模块 --> |
| | | <view class="common-module oa-module" |
| | | v-if="hasOaItems"> |
| | | <view class="module-header"> |
| | | <view class="module-title-container"> |
| | | <text class="module-title">OA办公</text> |
| | | </view> |
| | | </view> |
| | | <view class="module-content"> |
| | | <up-grid :border="false" |
| | | col="4"> |
| | | <up-grid-item v-for="(item, index) in oaItems" |
| | | :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="hasCollaborationItems"> |
| | |
| | | <script setup> |
| | | import { ref, onMounted, nextTick, reactive, computed } from "vue"; |
| | | import { userLoginFacotryList } from "@/api/login"; |
| | | import { getProductWorkOrderById } from "@/api/productionManagement/productionReporting"; |
| | | import DownloadProgressMask from "@/components/DownloadProgressMask.vue"; |
| | | import { OA_WORKBENCH_ITEMS } from "@/config/oaWorkbench.js"; |
| | | import modal from "@/plugins/modal"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | |
| | |
| | | icon: "/static/images/icon/gongxuguanli.svg", |
| | | label: "工序管理", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/bom.svg", |
| | | label: "BOM", |
| | | }, |
| | | // { |
| | | // icon: "/static/images/icon/bom.svg", |
| | | // label: "BOM", |
| | | // }, |
| | | { |
| | | icon: "/static/images/icon/gongyiluxian.svg", |
| | | label: "工艺路线", |
| | |
| | | icon: "/static/images/icon/kehudangan.svg", |
| | | label: "客户档案", |
| | | }, |
| | | { |
| | | icon: "/static/images/icon/xiaoshoubaojia.svg", |
| | | label: "销售报价", |
| | | }, |
| | | // { |
| | | // icon: "/static/images/icon/xiaoshoubaojia.svg", |
| | | // label: "销售报价", |
| | | // }, |
| | | { |
| | | icon: "/static/images/icon/xiaoshoutaizhang.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([ |
| | | { |
| | |
| | | label: "安全培训考核", |
| | | }, |
| | | ]); |
| | | // OA办公功能数据(纯前端配置,不参与后端权限过滤) |
| | | const oaItems = reactive( |
| | | OA_WORKBENCH_ITEMS.map(item => ({ ...item })) |
| | | ); |
| | | |
| | | // 协同办公功能数据 |
| | | 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", |
| | | }, |
| | | ]); |
| | | |
| | |
| | | }); |
| | | break; |
| | | case "生产报工": |
| | | getcode(); |
| | | uni.navigateTo({ |
| | | url: "/pages/productionManagement/workOrder/index", |
| | | }); |
| | | break; |
| | | case "报工台账": |
| | | uni.navigateTo({ |
| | |
| | | factoryList.value = []; |
| | | }); |
| | | } |
| | | const getcode = async () => { |
| | | uni.scanCode({ |
| | | success: async res => { |
| | | // 解析二维码内容 |
| | | const scanResult = res.result; |
| | | let orderRow = ""; |
| | | |
| | | // 判断扫描结果是否为纯数字(id) |
| | | const isNumericId = /^\d+$/.test(scanResult.trim()); |
| | | |
| | | if (isNumericId) { |
| | | // 如果是纯数字,根据 id 获取工单数据 |
| | | const workOrderId = scanResult.trim(); |
| | | modal.loading("正在获取工单信息..."); |
| | | try { |
| | | const workRes = await getProductWorkOrderById({ id: workOrderId }); |
| | | modal.closeLoading(); |
| | | |
| | | console.log("工单查询结果:", workRes); |
| | | |
| | | if (workRes.code === 200 && workRes.data) { |
| | | // 新接口返回的是单个对象,不是数组 |
| | | const workData = workRes.data; |
| | | console.log("工单数据:", workData); |
| | | |
| | | if (workData.endOrder === true) { |
| | | modal.msgError("该订单已结束,无法报工"); |
| | | return; |
| | | } |
| | | |
| | | orderRow = JSON.stringify(workData); |
| | | |
| | | console.log("构造的orderRow:", orderRow); |
| | | } else { |
| | | modal.msgError("未找到对应的工单信息"); |
| | | return; |
| | | } |
| | | } catch (error) { |
| | | modal.closeLoading(); |
| | | console.error("获取工单信息失败:", error); |
| | | modal.msgError("获取工单信息失败: " + (error.message || "未知错误")); |
| | | return; |
| | | } |
| | | } else { |
| | | // 如果不是纯数字,尝试从扫码结果中提取orderRow参数 |
| | | try { |
| | | // 处理混合格式: http://...?orderRow={...} |
| | | const orderRowStart = scanResult.indexOf("orderRow={"); |
| | | if (orderRowStart !== -1) { |
| | | // 提取从orderRow={开始的JSON内容 |
| | | const jsonPart = scanResult.substring(orderRowStart + 9); // 9是"orderRow=".length |
| | | orderRow = jsonPart; |
| | | } else { |
| | | // 如果直接是JSON字符串,尝试解析 |
| | | orderRow = scanResult; |
| | | } |
| | | } catch (e) { |
| | | console.error(e, "解析失败====????====="); |
| | | orderRow = ""; |
| | | } |
| | | |
| | | // 验证是否为有效的JSON |
| | | try { |
| | | JSON.parse(orderRow); |
| | | } catch (error) { |
| | | modal.msgError("订单解析失败,请检查二维码格式"); |
| | | return; |
| | | } |
| | | } |
| | | // 扫码成功后跳转到生产报工页面,并传递orderRow参数 |
| | | uni.navigateTo({ |
| | | url: `/pages/productionManagement/productionReport/index?orderRow=${orderRow}`, |
| | | }); |
| | | }, |
| | | fail: err => { |
| | | uni.showToast({ |
| | | title: "扫码失败", |
| | | icon: "none", |
| | | }); |
| | | }, |
| | | }); |
| | | }; |
| | | const changeFactory = async arr => { |
| | | show.value = false; |
| | | const factoryId = factoryListTem.value[arr.indexs[0]].deptId; |
| | |
| | | const hasAfterSalesServiceItems = computed( |
| | | () => afterSalesServiceItems.length > 0 |
| | | ); |
| | | const hasOaItems = computed(() => oaItems.length > 0); |
| | | const hasCollaborationItems = computed(() => collaborationItems.length > 0); |
| | | const hasSafetyItems = computed(() => safetyItems.length > 0); |
| | | const hasQualityItems = computed(() => qualityItems.length > 0); |