import React, { useEffect, useRef } from "react"; import * as commonUtils from "@/utils/utils"; import useCommonBase from "@/components/Common/CommonHooks/useCommonBase"; import * as commonFunc from '@/components/Common/commonFunc'; import styles from "./index.less"; import { message } from "antd"; const useQuickSwitchTabEvent = props => { const { formData = [] } = props; const handleGetFileUrl = async (title, cb) => { let url = ""; if (!formData.length) { cb(url); return; } const config = formData.find(item => item.sGrd === "cppbt01"); if (!config) { cb(url); return; } const result = await props.onGetDataSet({ name: "cppbt01", configData: config, condition: { sSqlCondition: { sWorkOrderSlaveId: commonUtils.convertStrToObj( localStorage.xlybusinessglobalData ).currentWorkOrderInfo.sWorkOrderSlaveId } }, isWait: true }); const { cppbt01Data: tableData } = result; if (commonUtils.isEmptyArr(tableData)) { cb(url); return; } const data = tableData.find(item => item.sType === title); url = data?.sPicturePath; cb(url); }; return { ...props, onGetFileUrl: handleGetFileUrl }; }; const QuickSwitchTabComponent = baseProps => { const props = useQuickSwitchTabEvent( useCommonBase({ ...baseProps, sModelsId: "12710101117087374661080" }) ); const ref = useRef(null); useEffect(() => { if (ref.current) { ref.current.onselectstart = () => false; } }, []); let list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"]; const listId = [ "12710101117087374661080", "12710101117089395856660", "", "", "12710101117087404588200" ]; function translateList(language) { // 原始中文列表 const list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"]; // 定义多语言映射 const translations = { sEnglish: { "生产执行": "Production Execution", "质量巡检": "Quality Inspection", "拼版图": "Assembly Drawing", "产品图": "Product Drawing", "报工任务": "Work Reporting Task" }, sBig5: { "生产执行": "生產執行", "质量巡检": "質量巡檢", "拼版图": "拼版圖", "产品图": "產品圖", "报工任务": "報工任務" } }; // 根据语言设置进行转换 if (translations[language]) { return list.map(item => translations[language][item] || item); } // 默认返回原始列表 return list; } function translateTipList(language) { // 原始中文列表 const list = ["生产执行", "质量巡检", "拼版图", "产品图", "报工任务"]; // 定义多语言映射 const translations = { sEnglish: { "生产执行": "Production Execution-生产执行", "质量巡检": "Quality Inspection-质量巡检", "拼版图": "Assembly Drawing-拼版图", "产品图": "Product Drawing-产品图", "报工任务": "Work Reporting Task-报工任务" }, sBig5: { "生产执行": "生產執行", "质量巡检": "質量巡檢", "拼版图": "拼版圖", "产品图": "產品圖", "报工任务": "報工任務" } }; // 根据语言设置进行转换 if (translations[language]) { return list.map(item => translations[language][item] || item); } // 默认返回原始列表 return list; } const sLanguage = props.app.userinfo.sLanguage || 'sChinese'; list = translateList(sLanguage); const tipList = translateTipList(sLanguage); const no = commonFunc.showLocalMessage(props, 'No', '暂无'); return (