chenhaozhe
2026-03-11 0debeb9d6cfed5c4e6cd08eadc67acce164b12c8
修复 除 登录页面外,其余页面无法在网页端进行多语言同步的问题
3个文件已修改
450 ■■■■ 已修改文件
pages/caigouruku/POStockInBill.vue 178 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/login.vue 252 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/i18n.js 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/caigouruku/POStockInBill.vue
@@ -26,7 +26,9 @@
                </view>
            </view>
            <view class="form-item">
                <view class="title">{{ $t(`Gy.HStockPlaceName`) == "Gy.HStockPlaceName"?"仓位": $t(`Gy.HStockPlaceName`) }}:</view>
                <view class="title">
                    {{ $t(`Gy.HStockPlaceName`) == "Gy.HStockPlaceName"?"仓位": $t(`Gy.HStockPlaceName`) }}:
                </view>
                <view class="right" v-show="true">
                    <uni-combox :candidates="arrayHStockPlaceNameComputed" placeholder="请输入(或扫描)仓位"
                        v-model="hform.HStockPlaceName" @input="HStockPlaceNameChange"
@@ -37,15 +39,25 @@
            </view>
            <view class="tabs">
                <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">{{ $t(`Gy.SourceBillSelect`) == "Gy.SourceBillSelect"?"选择源单": $t(`Gy.SourceBillSelect`) }}</view>
                <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">{{ $t(`Gy.TableHeaderInfo`) == "Gy.TableHeaderInfo"?"表头信息": $t(`Gy.TableHeaderInfo`) }}</view>
                <view :class="tabs == 2 ? 'on':''" @tap="tabs = 2">{{ $t(`Gy.MaterInfo`) == "Gy.MaterInfo"?"物料信息": $t(`Gy.MaterInfo`) }}</view>
                <view :class="tabs == 3 ? 'on':''" @tap="tabs = 3">{{ $t(`Gy.BarCodeInfo`) == "Gy.BarCodeInfo"?"条码信息": $t(`Gy.BarCodeInfo`) }}</view>
                <view :class="tabs == 0 ? 'on':''" @tap="tabs = 0">
                    {{ $t(`Gy.SourceBillSelect`) == "Gy.SourceBillSelect"?"选择源单": $t(`Gy.SourceBillSelect`) }}
                </view>
                <view :class="tabs == 1 ? 'on':''" @tap="tabs = 1">
                    {{ $t(`Gy.TableHeaderInfo`) == "Gy.TableHeaderInfo"?"表头信息": $t(`Gy.TableHeaderInfo`) }}
                </view>
                <view :class="tabs == 2 ? 'on':''" @tap="tabs = 2">
                    {{ $t(`Gy.MaterInfo`) == "Gy.MaterInfo"?"物料信息": $t(`Gy.MaterInfo`) }}
                </view>
                <view :class="tabs == 3 ? 'on':''" @tap="tabs = 3">
                    {{ $t(`Gy.BarCodeInfo`) == "Gy.BarCodeInfo"?"条码信息": $t(`Gy.BarCodeInfo`) }}
                </view>
            </view>
            <view v-if="tabs == 0">
                <view class="form-item">
                    <view class="title">{{ $t(`Gy.HMainSourceBillType`) == "Gy.HMainSourceBillType"?"源单类型": $t(`Gy.HMainSourceBillType`) }}:</view>
                    <view class="title">
                        {{ $t(`Gy.HMainSourceBillType`) == "Gy.HMainSourceBillType"?"源单类型": $t(`Gy.HMainSourceBillType`) }}:
                    </view>
                    <view class="right" v-show="showHMainSourceBillType">
                        <picker :range="arrayHMainSourceBillType" v-model="HMainSourceBillType"
                            @change="HMainSourceBillTypeChange">
@@ -60,7 +72,9 @@
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">{{$t(`Gy.HMainSourceBillNo`) == "Gy.HMainSourceBillNo"?"源单单号": $t(`Gy.HMainSourceBillNo`) }}:</view>
                    <view class="title">
                        {{$t(`Gy.HMainSourceBillNo`) == "Gy.HMainSourceBillNo"?"源单单号": $t(`Gy.HMainSourceBillNo`) }}:
                    </view>
                    <view class="right" v-show="showHSourceBillNo">
                        <!-- <uni-combox v-if="reHSourceBillNo" :candidates="arrayHSourceBillNo" placeholder="请输入源单单号"
                            v-model="hform.HSourceBillNo" @input="HSourceBillNoChange"></uni-combox> -->
@@ -86,7 +100,7 @@
                    </view> -->
                </view>
                <view class="form-item">
                    <view class="title">日期:</view>
                    <view class="title">{{ $t(`Gy.HDate`) == "Gy.HDate"?"日期": $t(`Gy.HDate`) }}:</view>
                    <view class="right">
                        <picker mode="date" v-model="hform.HDate" @change="HDateChange">
                            <input disabled v-model="hform.HDate" placeholder="请选择日期" />
@@ -101,7 +115,7 @@
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据号:</view>
                    <view class="title">{{ $t(`Gy.HBillNo`) == "Gy.HBillNo"?"单据号": $t(`Gy.HBillNo`) }}:</view>
                    <view class="righton">
                        <input name="HBillNo" disabled v-model="hform.HBillNo" />
                    </view>
@@ -159,45 +173,45 @@
            <view v-if="tabs == 2">
                <view class="list" v-for="(item,index) in Materlist" :key="index">
                     <uni-card :title="item.物料名称" style="margin: 10px;" @tap="delMater(item, $event)">
                                <!-- 物料代码作为可点击链接 -->
                                <view class="card-header" @tap.stop="gotoInventoryQuery(item.物料代码)">
                                    <text class="link-text">物料代码:{{item.物料代码}}</text>
                                </view>
                                <view class="card-detail">
                                    <view class="detail">
                                        <text>源单单号:</text>{{item.源单单号}}
                                    </view>
                                    <view class="detail">
                                        <text>源单数量:</text>{{item.源单数量}}
                                    </view>
                                    <view class="detail">
                                        <text>数量:</text>{{item.数量}}
                                    </view>
                                    <view class="detail">
                                        <text>条码个数:</text>{{item.条码个数}}
                                    </view>
                                    <view class="detail" v-if="item.规格型号">
                                        <text>规格型号:</text>{{item.规格型号}}
                                    </view>
                                    <view class="detail" v-if="item.辅助属性">
                                        <text>辅助属性:</text>{{item.辅助属性}}
                                    </view>
                                    <view class="detail" v-if="item.款号">
                                        <text>款号:</text>{{item.款号}}
                                    </view>
                                    <view class="detail" v-if="item.合计数量">
                                        <text>合计数量:</text>{{item.合计数量}}
                                    </view>
                                    <view class="detail" v-if="item.单价">
                                        <text>单价:</text>{{item.单价}}
                                    </view>
                                    <view class="detail" v-if="materMeta[0].HWHName && /兴达/.test(hform.HStockOrgName)">
                                        <text>仓库:</text>{{materMeta[0].HWHName}}
                                    </view>
                                </view>
                            </uni-card>
                    <uni-card :title="item.物料名称" style="margin: 10px;" @tap="delMater(item, $event)">
                        <!-- 物料代码作为可点击链接 -->
                        <view class="card-header" @tap.stop="gotoInventoryQuery(item.物料代码)">
                            <text class="link-text">物料代码:{{item.物料代码}}</text>
                        </view>
                        <view class="card-detail">
                            <view class="detail">
                                <text>源单单号:</text>{{item.源单单号}}
                            </view>
                            <view class="detail">
                                <text>源单数量:</text>{{item.源单数量}}
                            </view>
                            <view class="detail">
                                <text>数量:</text>{{item.数量}}
                            </view>
                            <view class="detail">
                                <text>条码个数:</text>{{item.条码个数}}
                            </view>
                            <view class="detail" v-if="item.规格型号">
                                <text>规格型号:</text>{{item.规格型号}}
                            </view>
                            <view class="detail" v-if="item.辅助属性">
                                <text>辅助属性:</text>{{item.辅助属性}}
                            </view>
                            <view class="detail" v-if="item.款号">
                                <text>款号:</text>{{item.款号}}
                            </view>
                            <view class="detail" v-if="item.合计数量">
                                <text>合计数量:</text>{{item.合计数量}}
                            </view>
                            <view class="detail" v-if="item.单价">
                                <text>单价:</text>{{item.单价}}
                            </view>
                            <view class="detail" v-if="materMeta[0].HWHName && /兴达/.test(hform.HStockOrgName)">
                                <text>仓库:</text>{{materMeta[0].HWHName}}
                            </view>
                        </view>
                    </uni-card>
                </view>
                <view class="over" v-if="Materlist.length == 0">暂无数据</view>
            </view>
@@ -523,7 +537,7 @@
                    this.hform.HBarCode = ""
                })
            },
            //扫码
            toScanCode() {
                var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
@@ -803,7 +817,7 @@
                        if (this.HWHNameList[i]['启用仓位'] == 'Y') {
                            this.showHStockPlaceName = true
                            this.getStockPlaceRemote(this.HWHNameList[i]["HSPGroupID"])
                        }
                        }
                    }
                }
            },
@@ -1543,30 +1557,30 @@
                    },
                });
            },
             gotoInventoryQuery(HMaterNumber) {
                    console.log('跳转到库存查询,物料代码:', HMaterNumber);
                    // 使用uni.navigateTo跳转到新页面
                    uni.navigateTo({
                        url: `/pages/jishikucunchaxun/table?OperationType=2&HMaterNumber=${HMaterNumber}`,
                        success: (res) => {
                            console.log('跳转成功');
                        },
                        fail: (err) => {
                            console.error('跳转失败:', err);
                            // 如果页面不存在,可以跳转到默认页面
                            uni.showToast({
                                title: '功能正在开发中',
                                icon: 'none'
                            });
                        }
                    });
                },
            gotoInventoryQuery(HMaterNumber) {
                console.log('跳转到库存查询,物料代码:', HMaterNumber);
                // 使用uni.navigateTo跳转到新页面
                uni.navigateTo({
                    url: `/pages/jishikucunchaxun/table?OperationType=2&HMaterNumber=${HMaterNumber}`,
                    success: (res) => {
                        console.log('跳转成功');
                    },
                    fail: (err) => {
                        console.error('跳转失败:', err);
                        // 如果页面不存在,可以跳转到默认页面
                        uni.showToast({
                            title: '功能正在开发中',
                            icon: 'none'
                        });
                    }
                });
            },
            delMater(item) {
                if (event && event.target.classList && event.target.classList.contains('link-text')) {
                            return; // 如果是链接点击,不执行删除
                        }
                if (event && event.target.classList && event.target.classList.contains('link-text')) {
                    return; // 如果是链接点击,不执行删除
                }
                uni.showModal({
                    title: '提示',
                    content: '确认要删除 "' + item.物料名称 + '" 所有扫码记录?删除后将不可恢复!',
@@ -2044,10 +2058,12 @@
            color: #fff;
        }
    }
    /* 添加链接样式 */
    .link-text {
        color: #3a78ff; /* 蓝色,类似超链接 */
    }
    /* 添加链接样式 */
    .link-text {
        color: #3a78ff;
        /* 蓝色,类似超链接 */
    }
    .list {
        width: 100%;
@@ -2067,10 +2083,10 @@
                margin-right: 20rpx;
                text {
                    color: #999;
                    font-size: 26rpx;
                }
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
pages/index/login.vue
@@ -110,7 +110,7 @@
                    "杭州凯贝奈特": 'http://192.168.50.253:8080/API/',
                    "杭州凯贝奈特外网": 'http://erp.hzcabinet.cn:9090/API/',
                    "翁涛涛本地测试": 'http://localhost:81/API/',
                    "陈镐哲本地测试": 'http://192.168.0.121:81/API/',
                    "陈镐哲本地测试": 'http://192.168.0.101:81/API/',
                    "陈镐哲本地测试2": 'http://192.168.88.82:81/API/',
                    "张瑞广本地测试": 'http://localhost:8082/API/',
                    "余思杰本地测试": 'http://localhost:8082/LuBaoAPI/',
@@ -164,13 +164,13 @@
        methods: {
            async ApplyLanguagePack(lang, forceUpdate = false) {
                // 读取语言包并加载
                // let {
                //     data,
                //     getRemoteFile
                // } = await getLanguagePackJson(lang)
                // if (getRemoteFile) {
                //     this.$i18n.setLocaleMessage(lang, data)
                // }
                let {
                    data,
                    getRemoteFile
                } = await getLanguagePackJson(lang)
                if (getRemoteFile) {
                    this.$i18n.setLocaleMessage(lang, data)
                }
                this.$i18n.locale = lang
            },
            onLanguageChangeHandler(e) {
@@ -305,124 +305,126 @@
                        title: '登录中...',
                        mask: true
                    })
                    if (this.serverUrlName =="余姚华远"){//华远不需要wms验证
                        var data = {
                            UserName: this.UserName,
                            PassWord: this.PassWord,
                            HOrgName: this.HOrgName,
                            Organization: this.Organization
                        }
                        var data2 = {//用于保存登录信息
                            HUserNumber: this.UserName,
                            HPassWord: this.PassWord,
                            HStockOrgID: this.HOrgName,
                            HStockOrgName: this.Organization
                        }
                    uni.setStorageSync('loginData', JSON.stringify(data2));
                    uni.request({
                        url: this.serverUrl + '/Web/GetUser',
                        method: 'GET',
                        data: data,
                        success: (res) => {
                            console.log(res)
                            uni.hideLoading()
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                            if (res.data.count == 1) {
                                setLoginData(data2)
                                setUserInfo(res.data.data[0])
                                uni.setStorageSync('HUserName', res.data.data[0].Czymc);
                                uni.setStorageSync('HBillerID', res.data.data[0].HK3UserID);
                                uni.setStorageSync('SourceFlag', false);
                                uni.setStorageSync('login', "login");
                                uni.setStorageSync('Organization', this.Organization);
                                uni.setStorageSync('OrganizationID', this.HOrgName);
                                this.CommonUtils.setServerUrl(this.serverUrl)
                                uni.reLaunch({
                                    url: '/pages/index/index'
                    if (this.serverUrlName == "余姚华远") { //华远不需要wms验证
                        var data = {
                            UserName: this.UserName,
                            PassWord: this.PassWord,
                            HOrgName: this.HOrgName,
                            Organization: this.Organization
                        }
                        var data2 = { //用于保存登录信息
                            HUserNumber: this.UserName,
                            HPassWord: this.PassWord,
                            HStockOrgID: this.HOrgName,
                            HStockOrgName: this.Organization
                        }
                        uni.setStorageSync('loginData', JSON.stringify(data2));
                        uni.request({
                            url: this.serverUrl + '/Web/GetUser',
                            method: 'GET',
                            data: data,
                            success: (res) => {
                                console.log(res)
                                uni.hideLoading()
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                            }
                        },
                        fail: (res) => {
                            console.log(res);
                            uni.hideLoading()
                            uni.showToast({
                                title: '接口请求失败',
                                icon: 'none'
                            })
                        },
                    });
                    }else{
                        var data = {
                            HUserNumber: this.UserName,
                            HPassWord: this.PassWord,
                            HStockOrgID: this.HOrgName,
                            HStockOrgName: this.Organization
                        }
                        uni.setStorageSync('loginData', JSON.stringify(data));
                        uni.request({
                            url: this.serverUrl + 'WEBSController/GetUser_Json',
                            method: 'GET',
                            data: data,
                            success: (res) => {
                                console.log(res)
                                uni.hideLoading()
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                                if (res.data.count == 1) {
                                    setLoginData(data)
                                    setUserInfo(res.data.data[0])
                                    uni.setStorageSync('HUserName', res.data.data[0].Czymc);
                                    uni.setStorageSync('HBillerID', res.data.data[0].HK3UserID);
                                    uni.setStorageSync('SourceFlag', false);
                                    uni.setStorageSync('login', "login");
                                    uni.setStorageSync('Organization', this.Organization);
                                    uni.setStorageSync('OrganizationID', this.HOrgName);
                                    //存储部门 职员 仓库 等信息
                                    uni.setStorageSync('HDeptID', res.data.data[0].HDeptID); //部门
                                    uni.setStorageSync('HDeptName', res.data.data[0].HDeptName);
                                    uni.setStorageSync('HEmpID', res.data.data[0].HEmpID); //职员
                                    uni.setStorageSync('HEmpName', res.data.data[0].HEmpName);
                                    uni.setStorageSync('HSCWHID', res.data.data[0].HSCWHID); //调入仓库
                                    uni.setStorageSync('HSCWHName', res.data.data[0].HSCWHName);
                                    uni.setStorageSync('HWhID', res.data.data[0].HWhID); //对应仓库
                                    uni.setStorageSync('HWhName', res.data.data[0].HWhName);
                                    uni.setStorageSync('HWorkCenterID', res.data.data[0].HWorkCenterID); //工作中心
                                    uni.setStorageSync('HWorkCenterName', res.data.data[0].HWorkCenterName);
                                    uni.setStorageSync('HSecManagerID', res.data.data[0].HSecManagerID); //对应验收
                                    uni.setStorageSync('HSecManagerName', res.data.data[0].HSecManagerName);
                                    uni.setStorageSync('HGroupID', res.data.data[0].HGroupID); //对应班组
                                    uni.setStorageSync('HGroupName', res.data.data[0].HGroupName);
                                    uni.setStorageSync('HProcID', res.data.data[0].HProcID); //对应工序
                                    uni.setStorageSync('HProcName', res.data.data[0].HProcName);
                                    uni.setStorageSync('HSourceID', res.data.data[0].HSourceID); //对应生产资源
                                    uni.setStorageSync('HSourceName', res.data.data[0].HSourceName);
                                    this.CommonUtils.setServerUrl(this.serverUrl)
                                    // this.WebSocketServices.createConnect(res.data.data[0].Czybm,res.data.data[0].Czymc);
                                    // getuiUtils.getClientID()
                                    getuiUtils.getClientID(res.data.data[0].Czybm, res.data.data[0].Czymc)
                                    uni.reLaunch({
                                        url: '/pages/index/index'
                                    })
                                }
                            },
                            fail: (res) => {
                                console.log(res);
                                uni.hideLoading()
                                uni.showToast({
                                    title: '接口请求失败',
                                    icon: 'none'
                                })
                            },
                        });
                    }
                                if (res.data.count == 1) {
                                    setLoginData(data2)
                                    setUserInfo(res.data.data[0])
                                    uni.setStorageSync('HUserName', res.data.data[0].Czymc);
                                    uni.setStorageSync('HBillerID', res.data.data[0].HK3UserID);
                                    uni.setStorageSync('SourceFlag', false);
                                    uni.setStorageSync('login', "login");
                                    uni.setStorageSync('Organization', this.Organization);
                                    uni.setStorageSync('OrganizationID', this.HOrgName);
                                    this.CommonUtils.setServerUrl(this.serverUrl)
                                    uni.reLaunch({
                                        url: '/pages/index/index'
                                    })
                                }
                            },
                            fail: (res) => {
                                console.log(res);
                                uni.hideLoading()
                                uni.showToast({
                                    title: '接口请求失败',
                                    icon: 'none'
                                })
                            },
                        });
                    } else {
                        var data = {
                            HUserNumber: this.UserName,
                            HPassWord: this.PassWord,
                            HStockOrgID: this.HOrgName,
                            HStockOrgName: this.Organization
                        }
                        uni.setStorageSync('loginData', JSON.stringify(data));
                        uni.request({
                            url: this.serverUrl + 'WEBSController/GetUser_Json',
                            method: 'GET',
                            data: data,
                            success: (res) => {
                                console.log(res)
                                uni.hideLoading()
                                uni.showToast({
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                                if (res.data.count == 1) {
                                    setLoginData(data)
                                    setUserInfo(res.data.data[0])
                                    uni.setStorageSync('HUserName', res.data.data[0].Czymc);
                                    uni.setStorageSync('HBillerID', res.data.data[0].HK3UserID);
                                    uni.setStorageSync('SourceFlag', false);
                                    uni.setStorageSync('login', "login");
                                    uni.setStorageSync('Organization', this.Organization);
                                    uni.setStorageSync('OrganizationID', this.HOrgName);
                                    //存储部门 职员 仓库 等信息
                                    uni.setStorageSync('HDeptID', res.data.data[0].HDeptID); //部门
                                    uni.setStorageSync('HDeptName', res.data.data[0].HDeptName);
                                    uni.setStorageSync('HEmpID', res.data.data[0].HEmpID); //职员
                                    uni.setStorageSync('HEmpName', res.data.data[0].HEmpName);
                                    uni.setStorageSync('HSCWHID', res.data.data[0].HSCWHID); //调入仓库
                                    uni.setStorageSync('HSCWHName', res.data.data[0].HSCWHName);
                                    uni.setStorageSync('HWhID', res.data.data[0].HWhID); //对应仓库
                                    uni.setStorageSync('HWhName', res.data.data[0].HWhName);
                                    uni.setStorageSync('HWorkCenterID', res.data.data[0]
                                        .HWorkCenterID); //工作中心
                                    uni.setStorageSync('HWorkCenterName', res.data.data[0].HWorkCenterName);
                                    uni.setStorageSync('HSecManagerID', res.data.data[0]
                                        .HSecManagerID); //对应验收
                                    uni.setStorageSync('HSecManagerName', res.data.data[0].HSecManagerName);
                                    uni.setStorageSync('HGroupID', res.data.data[0].HGroupID); //对应班组
                                    uni.setStorageSync('HGroupName', res.data.data[0].HGroupName);
                                    uni.setStorageSync('HProcID', res.data.data[0].HProcID); //对应工序
                                    uni.setStorageSync('HProcName', res.data.data[0].HProcName);
                                    uni.setStorageSync('HSourceID', res.data.data[0].HSourceID); //对应生产资源
                                    uni.setStorageSync('HSourceName', res.data.data[0].HSourceName);
                                    this.CommonUtils.setServerUrl(this.serverUrl)
                                    // this.WebSocketServices.createConnect(res.data.data[0].Czybm,res.data.data[0].Czymc);
                                    // getuiUtils.getClientID()
                                    getuiUtils.getClientID(res.data.data[0].Czybm, res.data.data[0].Czymc)
                                    uni.reLaunch({
                                        url: '/pages/index/index'
                                    })
                                }
                            },
                            fail: (res) => {
                                console.log(res);
                                uni.hideLoading()
                                uni.showToast({
                                    title: '接口请求失败',
                                    icon: 'none'
                                })
                            },
                        });
                    }
                }
            }
        }
utils/i18n.js
@@ -85,7 +85,7 @@
            MissingKeysMap[key] = Array.from(MissingKeysMap[key])
        }
    }
    CommonUtils.doRequest2Sync({
    await CommonUtils.doRequest2Sync({
        url: "/Xt_grdAlignment_WMES/syncMissingKeyToDB",
        data: {
            missingObj: JSON.stringify(MissingKeysMap)
@@ -98,12 +98,14 @@
    // 重启应用
    const systemInfo = uni.getSystemInfoSync();
    const platform = systemInfo.platform;
    if (platform === 'ios' || platform === 'android') {
        // App 端:完全重启
        plus.runtime.restart();
    } else if (platform === 'h5') {
        // H5 端:刷新页面
        window.location.reload();
    }
    // #ifdef APP-PLUS
    // App 端:完全重启
    plus.runtime.restart();
    // #endif
    // #ifdef H5
    console.log('H5回到登录页: ');
    uni.reLaunch({
        url: '/pages/index/login'
    })
    // #endif
}