chenhaozhe
6 天以前 cb1870d7d3848823a7d157735c6fe20b322ee454
完善 翻译模块
新增 在库检验单 模块
7个文件已修改
1个文件已添加
1084 ■■■■■ 已修改文件
.hbuilderx/launch.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main.js 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/ZLGL/zaikujianyandan/InStockCheckBill.vue 904 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/login.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/tab2.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/i18n.js 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.hbuilderx/launch.json
@@ -21,11 +21,11 @@
            "type" : "uni-app:app-ios"
        },
        {
            "customPlaygroundType" : "device",
            "customPlaygroundType" : "local",
            "localRepoPath" : "D:/WorkBench/ZY_APP_Dev/STUWMS/unpackage/debug",
            "openVueDevtools" : true,
            "packageName" : "com.shebeiguanli.www",
            "playground" : "standard",
            "playground" : "custom",
            "type" : "uni-app:app-android"
        }
    ]
main.js
@@ -1,32 +1,37 @@
// 导入i18n文件
import en from "./locale/en.json"
import ZhCN from "./locale/zh-Hans.json"
import {
    addMissingKeyToMap
} from "@/utils/i18n.js"
// 加载本地语言包
const messages = {
    "zh-Hans":ZhCN,
    en,
    "zh-Hans": ZhCN,
    en,
}
let i18nConfig = {
  locale: uni.getLocale(),// 获取已设置的语言
  messages,
  silentTranslationWarn: true,
  missing: function(locale, key, vm, values){
    // 页面中含有语言包中不存在的字段,需同步到数据库中
      console.log("[i18n]: 页面中key为: ", key ,"的字段在翻译文件中不存在,同步到数据库...")
    // 为降低同步的难度,APP中 对翻译模块的key 不采用数组的写法,统一使用 模块名.字段名的写法
  }
    locale: uni.getLocale(), // 获取已设置的语言
    messages,
    silentTranslationWarn: true,
    // missing: function(locale, key, vm, values){
    //   // 页面中含有语言包中不存在的字段,需同步到数据库中
    //     console.log("[i18n]: 页面中key为: ", key ,"的字段在翻译文件中不存在,同步到数据库...")
    //
    //   // 为降低同步的难度,APP中 对翻译模块的key 不采用数组的写法,统一使用 模块名.字段名的写法
    //   let [HMouldName, HFieldKey] = key.split('.')
    //
    //
    // }
}
import App from './App'
import Printer from './plugins/printer'
Vue.use(Printer);
// 生产环境
 // Vue.prototype.serverUrl = "https://qqyapi.xinlinsoft.cn/qqy-api";
// Vue.prototype.serverUrl = "https://qqyapi.xinlinsoft.cn/qqy-api";
// 开发环境
// Vue.prototype.serverUrl = "http://47.96.97.237/API";
@@ -41,9 +46,23 @@
// #ifndef VUE3
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const i18n = new VueI18n(i18nConfig)
// TODO missing回调无法满足 加载线上包 后的检验功能,需重写$t函数
const originalT = Vue.prototype.$t
Vue.prototype.$t = function(key, ...args) {
    // 调用原始 $t 执行翻译
    const translated = originalT.call(this, key, args);
    // console.log(i18n.getLocaleMessage(i18n.locale))
    if (translated == key) {
        // 翻译后的文本与传入的key相同,则表示翻译文本缺失 记录缺失的翻译文本
        let [moduleName, fieldCode] = key.split(".")
        addMissingKeyToMap(moduleName, fieldCode)
    }
    return translated
}
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
@@ -55,25 +74,29 @@
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
import { createI18n } from 'vue-i18n'// v9.x
import {
    createSSRApp
} from 'vue'
import {
    createI18n
} from 'vue-i18n' // v9.x
const i18n = createI18n(i18nConfig)
export function createApp() {
  const app = createSSRApp(App)
  app.use(i18n)
  return {
    app
  }
    const app = createSSRApp(App)
    app.use(i18n)
    return {
        app
    }
}
export default i18n
// #endif
// main.js uni.showToast 实现全局拦截设置默认提示时间为3.5秒
const originalShowToast = uni.showToast;
uni.showToast = (options) => {
  originalShowToast({
    duration: options.duration || 3500, // 默认2秒
    icon: options.icon || 'none',
    title: options.title || 'none',
    ...options
  });
    originalShowToast({
        duration: options.duration || 3500, // 默认2秒
        icon: options.icon || 'none',
        title: options.title || 'none',
        ...options
    });
};
manifest.json
@@ -163,5 +163,6 @@
        //自然方向
        "default"
    ],
    "locale" : "zh-Hans"
    "locale" : "zh-Hans",
    "fallbackLocale" : "zh-Hans"
}
pages.json
@@ -1364,6 +1364,13 @@
                "navigationBarTitleText": "模具报废出库单",
                "enablePullDownRefresh": true
            }
        },
        {
            "path" : "pages/ZLGL/zaikujianyandan/InStockCheckBill",
            "style" :
            {
                "navigationBarTitleText" : "在库检验单"
            }
        }
        
    ],
pages/ZLGL/zaikujianyandan/InStockCheckBill.vue
New file
@@ -0,0 +1,904 @@
<template>
    <view>
        <!-- 基础信息填写 -->
        <view class="bill-main-area">
            <view class="bill-main-content">
                <!-- 基本信息 -->
                <view class="form-item">
                    <view class="title">条码:</view>
                    <view class="right">
                        <input :focus="barCodeFocus" v-model="hform.HBarCode" placeholder="请扫描(或输入)条码"
                            @confirm="getCode(hform.HBarCode)" />
                    </view>
                    <uni-icons type="scan"
                        style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
                        size="20" @click="toScanCode"></uni-icons>
                </view>
                <view class="form-item">
                    <view class="title">数量:</view>
                    <view class="right">
                        <input v-model="hform.HQty" />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">检验结果:</view>
                    <view>
                        <radio-group name="QualityCheck" @change="HCheckResuleChangeHandler">
                            <label>
                                <radio value="正常" :checked="hform.HCheckResult == '正常'" /><text>合格</text>
                            </label>
                            <view style="width: 1em;display: inline-block;"></view>
                            <label>
                                <radio value="异常" :checked="hform.HCheckResult == '异常'" /><text>不合格</text>
                            </label>
                        </radio-group>
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据日期:</view>
                    <view class="right disabled">
                        <input v-model="hform.HDate" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">单据号:</view>
                    <view class="right disabled">
                        <input v-model="hform.HBillNo" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">物料代码:</view>
                    <view class="right disabled">
                        <input v-model="hform.HMaterNumber" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">物料名称:</view>
                    <view class="right disabled">
                        <input v-model="hform.HMaterName" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">规格型号:</view>
                    <view class="right disabled">
                        <input v-model="hform.HModel" disabled />
                    </view>
                </view>
                <view class="form-item">
                    <view class="title">计量单位:</view>
                    <view class="right disabled">
                        <input v-model="hform.HUnitName" disabled />
                    </view>
                </view>
            </view>
        </view>
        <view class="bill-sub-area">
            <view class="bill-sub-tabs">
                <view :class="tabs == 1 ? 'selected':''" @tap="tabs = 1">物料信息</view>
                <view :class="tabs == 2 ? 'selected':''" @tap="tabs = 2">条码信息</view>
            </view>
            <view class="bill-main-contents">
                <!-- 条码缓存 -->
                <view v-if="tabs == 2">
                    <view class="over" v-if="BarCodeList.length == 0">
                        暂无数据
                    </view>
                    <view v-else class="list" v-for="(item,index) in BarCodeList" :key="index">
                        <uni-card style="margin: 10px;" @tap="dalBarCodeCache(item , index)">
                            <view class="card-detail">
                                <view class="detail">
                                    <text>条码编号:</text>{{item.HBarCode}}
                                </view>
                                <view class="detail">
                                    <text>源单单号:</text>{{item.HSourceBillNo}}
                                </view>
                                <view class="detail">
                                    <text>数量:</text>{{item.HQty}}
                                </view>
                                <view class="detail">
                                    <text>物料代码:</text>{{item.HMaterNumber}}
                                </view>
                                <view class="detail">
                                    <text>物料名称:</text>{{item.HMaterName}}
                                </view>
                                <view class="detail">
                                    <text>规格型号:</text>{{item.HModel}}
                                </view>
                                <view class="detail">
                                    <text>计量单位:</text>{{item.HUnitName}}
                                </view>
                                <view class="detail">
                                    <text>条码状态:</text>{{item.HBarCodeState}}
                                </view>
                            </view>
                        </uni-card>
                    </view>
                </view>
                <!-- 物料缓存 -->
                <view v-if="tabs == 1">
                    <view class="over" v-if="Object.keys(Materlist).length == 0">
                        暂无数据
                    </view>
                    <view v-else class="list" v-for="(item,index) in Materlist" :key="index">
                        <uni-card :title="item.HMaterName" :extra="item.HMaterNumber" style="margin: 10px;"
                            @tap="showBarCodeCache(item.HMaterNumber)">
                            <view class="card-detail">
                                <view class="detail">
                                    <text>源单单号:</text>{{item.HSourceBillNo}}
                                </view>
                                <view class="detail">
                                    <text>合格数量:</text>{{item.HRightQty}}
                                </view>
                                <view class="detail">
                                    <text>不合格数量:</text>{{item.HBadQty}}
                                </view>
                            </view>
                        </uni-card>
                    </view>
                </view>
            </view>
        </view>
        <view style="height: 120rpx;"></view>
        <view class="bottom-btn">
            <button class="btn-a" size="mini" @tap="submit">提交</button>
            <view style="flex: 1;"></view>
            <button class="btn-a" size="mini" @tap="addNew">新增</button>
            <button class="btn-c" size="mini" @tap="goBack">退出</button>
        </view>
    </view>
</template>
<script>
    import dayjs from "dayjs";
    import {
        getUserInfo
    } from "../../../utils/auth";
    import {
        CommonUtils
    } from "../../../utils/common";
    import {
        MpaasScan
    } from "@/utils/mpaasScan.js"
    export default {
        name: "InStockCheckBill",
        components: {},
        data() {
            return {
                tabs: 1,
                barCodeFocus: false,
                HModName: "QC_InStockChechBill",
                HBillType: "7526",
                hform: {
                    HInterID: 0,
                    HBarCode: "",
                    HQty: 0,
                    HBillType: "7526",
                    HCheckResult: '正常',
                    HDate: dayjs(new Date()).format("YYYY-MM-DD"),
                    HBillNo: "",
                    HMaterNumber: "",
                    HMaterName: "",
                    HMaterModel: "",
                    HUnitName: "",
                    HUser: uni.getStorageSync("HEmpID")
                },
                Materlist: {}, // 物料缓存,用物料代码作为key,其中保存的合格数量和不合格数量相加为0则从缓存中删去
                BarCodeList: [], // 条码缓存
            };
        },
        onLoad() {
            this.getMaxBillNo()
        },
        methods: {
            addNew() {
                uni.redirectTo({
                    url: "/pages/ZLGL/zaikujianyandan/InStockCheckBill?OperationType=1"
                })
            },
            async submit() {
                if (this.hform.HInterID == 0 || !this.hform.HInterID) {
                    uni.showToast({
                        title: '单据内码获取失败,错误的单据内码!',
                        icon: 'none'
                    })
                } else if (!this.hform.HBillNo) {
                    uni.showToast({
                        title: '单据号获取失败,错误的单据号!',
                        icon: 'none'
                    })
                } else if (!this.Materlist || this.Materlist.length == 0) {
                    uni.showToast({
                        title: '没有扫码信息,请先扫描条码,确认无误后再提交!',
                        icon: 'none'
                    })
                } else {
                    this.hform.HYear = dayjs(this.hform.HDate).year()
                    this.hform.HPeriod = dayjs(this.hform.HDate).month()
                    let sMainSub = {
                        sMain: this.hform,
                        sSub: this.Materlist
                    }
                    try {
                        let res = await CommonUtils.doRequest2Sync({
                            url: '/QC_InStockCheckBill/saveBill',
                            method: 'POST',
                            data: sMainSub
                        })
                        if (!res) {
                            return
                        }
                        console.log(1, res);
                        uni.hideLoading()
                        if (res.data.count == 1) {
                            uni.showModal({
                                title: '提示',
                                content: res.data.Message + '。是否继续新增?',
                                success: (res) => {
                                    if (res.confirm) {
                                        console.log('用户点击确定');
                                        uni.redirectTo({
                                            url: '/pages/ZLGL/zaikujianyandan/InStockCheckBill?OperationType=1'
                                        })
                                    } else if (res.cancel) {
                                        console.log('用户点击取消');
                                    }
                                }
                            });
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    } catch (err) {
                        console.warn(err);
                        uni.showToast({
                            title: '接口请求失败:' + err,
                            icon: 'none'
                        })
                    }
                }
            },
            goBack() {
                uni.showModal({
                    title: '提示',
                    content: '确认要退出当前页面吗?',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.navigateBack()
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            },
            async getMaxBillNo() {
                try {
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/Web/GetMAXNum",
                        data: {
                            HBillType: this.HBillType,
                        },
                    });
                    if (!res) {
                        return;
                    }
                    let {
                        data,
                        Message,
                        count
                    } = res.data;
                    if (count == 1) {
                        this.hform.HInterID = data[0].HInterID;
                        this.hform.HBillNo = data[0].HBillNo;
                    } else {
                        throw Message;
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: "获取单据号异常: " + err,
                    });
                }
            },
            dalBarCodeCache(item, index) {
                console.log('item: ',item);
                let Qty = this.BarCodeList[index]["HQty"]
                let quit = false
                let HBarCodeState = this.BarCodeList[index]["HBarCodeState"]
                uni.showModal({
                    title: "提示",
                    content: "是否删除 条码 " + this.BarCodeList[index]["HBarCode"],
                    success: async (res) => {
                        if (res.confirm) {
                            // if (HBarCodeState == '正常') {
                            //     this.Materlist[HMaterNumber]["HRightQty"] -= Qty
                            // } else if (HBarCodeState == '异常') {
                            //     this.Materlist[HMaterNumber]["HBadQty"] -= Qty
                            // }
                            // // 将条码记录从缓存中删除
                            // this.Materlist[HMaterNumber]["HBarCodeCache"].splice(index, 1)
                            // this.BarCodeList.splice(index, 1)
                            // if (this.Materlist[HMaterNumber]["HBarCodeCache"].length == 0) {
                            //     // 物料记录中无条码,则删除物料记录
                            //     this.$delete(this.Materlist, HMaterNumber)
                            // }
                            let delRes = await CommonUtils.doRequest2Async({
                                url: '/QC_InStockCheckBillController/set_DelPonderationBillMain_Temp_InterIDAndSource_Json',
                                data: {
                                    HItemID: item.HItemID,
                                    HInterID: this.hform.HInterID,
                                    HMaterID: item.HMaterID,
                                    HAuxPropID: item.HAuxPropID || 0,
                                    HMTONo: item.HMTONo || "",
                                    HSourceInterID: item.HSourceInterID,
                                    HSourceEntryID: item.HSourceEntryID,
                                    HBillType: this.hform.HBillType
                                },
                            })
                            console.log('delRes: ',delRes);
                            if(delRes.data.count == 1) {
                                this.Materlist = {}
                                this.BarCodeList = []
                                this.DisBillEntryList()
                            }
                        } else if (res.cancel) {
                            quit = true
                        }
                    }
                })
                if (quit) {
                    return
                }
            },
            showBarCodeCache(key) {
                this.BarCodeList = this.Materlist[key]["HBarCodeCache"]
                this.tabs = 2
            },
            HCheckResuleChangeHandler({
                detail
            }) {
                console.log('value: ', detail.value);
                this.hform.HCheckResult = detail.value
            },
            async DisBillEntryList() {
                try {
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/QC_InStockCheckBillController/GetBillEntryTmpList_Json",
                        data: {
                            HInterID: this.hform.HInterID,
                            HBillNo: this.hform.HBillNo,
                            HBillType: this.hform.HBillType,
                            HStockOrgID: uni.getStorageSync('OrganizationID')
                        }
                    })
                    if (!res) {
                        return
                    }
                    let {
                        count,
                        data,
                        Message
                    } = res.data
                    if (count == 1) {
                        console.log('data: ', data);
                        this.BillEntryListPreProcess(data)
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
                            message: `获取条码明细错误: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        title: "温馨提示",
                        message: `获取条码明细错误: ${err}`
                    })
                }
            },
            BillEntryListPreProcess(data) {
                // 调整回传的单据符合 前端显示的格式
                let [
                    materList,
                    barCodeList
                ] = data
                let barCodeObj = {}
                // 调整条码列表
                for (let i = 0; i < barCodeList.length; i++) {
                    if (!barCodeObj[barCodeList[i]["HMaterNumber"]]) {
                        barCodeObj[barCodeList[i]["HMaterNumber"]] = []
                    }
                    barCodeObj[barCodeList[i]["HMaterNumber"]].push({
                        HBarCode: barCodeList[i]["HBarCode"],
                        HSourceBillNo: barCodeList[i]["源单单号"],
                        HMaterID: barCodeList[i]["HMaterID"],
                        HMaterNumber: barCodeList[i]["物料代码"],
                        HMaterName: barCodeList[i]["物料名称"],
                        HMaterModel: barCodeList[i]["规格型号"],
                        HQty: barCodeList[i]["数量"],
                        HAuxPropID: barCodeList[i]["HAuxPropID"],
                        HMTONo:  barCodeList[i]["HMTONo"],
                        HBarCodeState: barCodeList[i]["条码状态"],
                        HItemID: barCodeList[i]["HItemID"],
                        HSourceInterID: barCodeList[i]["HSourceInterID"],
                        HSourceEntryID: barCodeList[i]["HSourceEntryID"]
                    })
                    // 调整物料列表
                    for (let i = 0; i < materList.length; i++) {
                        this.$set(this.Materlist, `${materList[i]["物料代码"]}`, {
                            HSourceBillNo: materList[i]["源单单号"],
                            HMaterID: materList[i]["HMaterID"],
                            HMaterNumber: materList[i]["物料代码"],
                            HMaterName: materList[i]["物料名称"],
                            HMaterModel: materList[i]["规格型号"],
                            HUnitName: materList[i]["计量单位"],
                            HInterID: materList[i]["HInterID"],
                            HItemID: materList[i]["HItemID"],
                            HRightQty: materList[i]["合格数量"],
                            HBadQty: materList[i]["不合格数量"],
                            HBarCodeCache: barCodeObj[materList[i]["物料代码"]]
                        })
                    }
                }
                this.tabs = 1
            },
            toScanCode() {
                MpaasScan.scanCode((code) => {
                    if (code) {
                        this.getCode(code);
                    }
                })
            },
            async getCode(HBarCode) {
                // 带出条码信息
                console.log('HBarCode: ', HBarCode);
                try {
                    // let res = await CommonUtils.doRequest2Sync({
                    //     url: "/Gy_BarCodeBillList/page",
                    //     data: {
                    //         sWhere: ` and 条码编号=''${HBarCode}''`,
                    //         user: getUserInfo()["Czymc"],
                    //         page: 1,
                    //         size: 50
                    //     }
                    // })
                    let res = await CommonUtils.doRequest2Sync({
                        url: "/QC_InStockCheckBill/getBarCode",
                        data: {
                            sBarCode: HBarCode,
                            "HInterID": this.hform.HInterID,
                            "HBillType": this.hform.HBillType,
                            "HBillNo": this.hform.HBillNo,
                            "HMaker": getUserInfo()["Czymc"],
                            "HWhID": 0,
                            "HSPID": 0,
                            "HQty": 0,
                            "HRedBlueFlag": false,
                            "SourceFlag": true,
                            "HSourceBillNo": "",
                            "HSourceBillType": "",
                            "HStockOrgID": uni.getStorageSync("OrganizationID"),
                            "HScanStyle": "",
                            "HCustom1": "",
                            "HCustom2": "",
                            sBarCodeStatus: this.hform.HCheckResult
                        }
                    })
                    if (!res) {
                        return
                    }
                    let {
                        data,
                        count,
                        Message
                    } = res.data
                    if (count == 1) {
                        console.log('data: ', data);
                        let barCodeInfo = data[0]
                        // 展示条码信息
                        Object.assign(this.hform, {
                            HBarCode: "",
                            HQty: barCodeInfo["数量"],
                            HSourceBillNo: barCodeInfo["HSourceBillNo"],
                            HMaterNumber: barCodeInfo["物料代码"],
                            HMaterName: barCodeInfo["物料名称"],
                            HMaterModel: barCodeInfo["规格型号"],
                        })
                        this.DisBillEntryList()
                        // 条码根据当前是否合格 录入 物料缓存
                        // if (!this.Materlist[`${barCodeInfo["物料代码"]}`]) {
                        //     this.$set(this.Materlist, `${barCodeInfo["物料代码"]}`, {
                        //         HSourceBillNo: barCodeInfo["源单单号"],
                        //         HMaterID: barCodeInfo["HMaterID"],
                        //         HMaterNumber: barCodeInfo["物料代码"],
                        //         HMaterName: barCodeInfo["物料名称"],
                        //         HMaterModel: barCodeInfo["规格型号"],
                        //         HUnitName: barCodeInfo["计量单位"],
                        //         HRightQty: 0,
                        //         HBadQty: 0,
                        //         HBarCodeCache: []
                        //     })
                        // }
                        //
                        // if (this.hform.HCheckResult == '正常') {
                        //     this.Materlist[`${barCodeInfo["物料代码"]}`]["HRightQty"] += barCodeInfo["数量"]
                        //     // 存入条码缓存
                        //     this.Materlist[`${barCodeInfo["物料代码"]}`]["HBarCodeCache"].push({
                        //         HBarCode: HBarCode,
                        //         HSourceBillNo: barCodeInfo["源单单号"],
                        //         HMaterNumber: barCodeInfo["物料代码"],
                        //         HMaterName: barCodeInfo["物料名称"],
                        //         HMaterModel: barCodeInfo["规格型号"],
                        //         HUnitName: barCodeInfo["计量单位"],
                        //         HQty: barCodeInfo["数量"],
                        //         HBarCodeState: '正常'
                        //     })
                        // } else {
                        //     this.Materlist[`${barCodeInfo["物料代码"]}`]["HBadQty"] += barCodeInfo["数量"]
                        //     this.Materlist[`${barCodeInfo["物料代码"]}`]["HBarCodeCache"].push({
                        //         HBarCode: HBarCode,
                        //         HSourceBillNo: barCodeInfo["源单单号"],
                        //         HMaterNumber: barCodeInfo["物料代码"],
                        //         HMaterName: barCodeInfo["物料名称"],
                        //         HMaterModel: barCodeInfo["规格型号"],
                        //         HUnitName: barCodeInfo["计量单位"],
                        //         HQty: barCodeInfo["数量"],
                        //         HBarCodeState: '异常'
                        //     })
                        // }
                    } else {
                        CommonUtils.showTips({
                            titie: '温馨提示',
                            message: `获取条码信息失败: ${Message}`
                        })
                    }
                } catch (err) {
                    CommonUtils.showTips({
                        titie: '温馨提示',
                        message: `获取条码信息失败: ${err}`
                    })
                }
            }
        }
    }
</script>
<style lang="scss">
    input {
        width: inherit;
        font-size: 26rpx;
    }
    .uni-input {
        padding: 0;
    }
    .bill-main-tabs,
    .bill-sub-tabs {
        box-sizing: border-box;
        width: 730rpx;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 20rpx;
        flex-shrink: 0;
        overflow-x: auto;
        border-bottom: 1px solid #ddd;
        padding: 20rpx 10rpx;
        white-space: nowrap;
        view {
            width: auto;
            font-size: 26rpx;
            color: #555;
            text-align: center;
            padding: 16rpx 0;
        }
        .selected {
            color: #3a78ff;
            font-weight: bold;
            border-bottom: 3px solid #3a78ff;
        }
    }
    .bill-main-content,
    .bill-sub-content {
        box-sizing: border-box;
        padding: 0 30rpx 0 30rpx;
        display: flex;
        flex-direction: column;
        .form-item {
            width: 100%;
            display: flex;
            align-items: center;
            font-size: 26rpx;
            padding: 6rpx 0;
            .title {
                width: 5em;
                text {
                    color: red;
                    font-weight: bold;
                }
            }
            .right {
                // width: 450rpx;
                padding: 8rpx 20rpx;
                font-size: 26rpx;
                flex: 1;
                border-radius: 22rpx;
                border: 1px solid #acacac;
                .uni-combox {
                    padding: 0;
                    height: auto;
                    .uni-input-placeholder,
                    .uni-input-input {
                        font-size: 26rpx;
                    }
                }
                .uni-combox::v-deep input {
                    height: inherit;
                    font-size: 26rpx;
                }
            }
            .disabled {
                border: 1px solid #e4e4e4;
                background-color: #e4e4e4;
            }
            .none-border {
                border: none;
            }
        }
    }
    .bottom-btn {
        box-sizing: border-box;
        width: 100%;
        height: 120rpx;
        position: fixed;
        bottom: 0;
        left: 0;
        background-color: #fff;
        box-shadow: 0 2rpx 10rpx 2rpx rgba(0, 0, 0, 0.4);
        padding: 30rpx 40rpx 40rpx 40rpx;
        display: flex;
        flex-direction: row;
        gap: 10rpx;
        button {
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 28rpx;
        }
        .btn-a {
            background-color: #3a78ff;
            color: #fff;
        }
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
        .btn-c {
            background-color: #acacac;
            color: #fff;
            // position: absolute;
            // right: 120rpx;
        }
        .btn-d {
            background-color: #ff8901;
            color: #fff;
        }
    }
    .buttons {
        box-sizing: border-box;
        width: 100%;
        display: flex;
        justify-content: center;
        padding: 10rpx 0;
        button {
            border-radius: 50rpx;
            width: 180rpx;
            height: 66rpx;
            line-height: 66rpx;
            font-size: 26rpx;
        }
        .btn-a {
            background-color: #acacac;
            color: #fff;
        }
        .btn-b {
            background-color: #41a863;
            color: #fff;
        }
        .btn-c {
            background-color: #3a78ff;
            color: #fff;
        }
    }
    .list {
        width: 100%;
        .card-detail {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: center;
            line-height: 120%;
            gap: 10rpx 0;
            input {
                font-size: 26rpx;
            }
            .detail {
                // width: 50%;
                box-sizing: border-box;
                font-size: 26rpx;
                color: #555;
                padding-right: 20rpx;
                text {
                    color: #999;
                    font-size: 26rpx;
                }
            }
            .editable {
                width: 50%;
                display: inline-flex;
                flex-direction: row;
                align-items: center;
                text {
                    flex-shrink: 0;
                }
                .sampleDestory {
                    border: 1px solid #acacac;
                    border-radius: 5rpx;
                    padding: 0 12rpx;
                }
            }
        }
    }
    .icon-wrapper {
        background-color: #3a78ff;
        border-radius: 100%;
        width: 40rpx;
        height: 40rpx;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
        .uni-icons {
            color: #fff !important;
        }
    }
    .icon-wrapper-big {
        background-color: #3a78ff;
        border-radius: 100%;
        width: 50rpx;
        height: 50rpx;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
        margin-left: 20rpx;
        .uni-icons {
            color: #fff !important;
        }
    }
    .more {
        color: #888;
        font-size: 22rpx;
        display: flex;
        border-top: 1px solid #eee;
        padding-top: 10rpx;
        .part {
            width: 100%;
            text-align: center;
        }
    }
    .pass-background {
        background-color: #cee3f2;
        border: none;
    }
    .unpass-background {
        background-color: #f0d6e3;
        border: none;
    }
    .list {
        width: 100%;
        .card-detail {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            line-height: 120%;
            .detail {
                // width: 50%;
                font-size: 26rpx;
                margin-bottom: 12rpx;
                color: #555;
                margin-right: 20rpx;
                text {
                    color: #999;
                    font-size: 26rpx;
                }
            }
        }
        .more {
            color: #888;
            font-size: 24rpx;
            display: flex;
            border-top: 1px solid #eee;
            padding-top: 20rpx;
            .part {
                width: 50%;
                text-align: center;
            }
        }
    }
</style>
pages/index/login.vue
@@ -151,12 +151,12 @@
        methods: {
            async ApplyLanguagePack(lang, forceUpdate = false) {
                // 读取语言包并加载
                let languagePack = await getLanguagePackJson(lang)
                // this.$i18n.setLocaleMessage(lang, JSON.parse(languagePack))
                // let languagePack = await getLanguagePackJson(lang)
                // this.$i18n.setLocaleMessage(lang, languagePack)
                this.$i18n.locale = lang
            },
            onLanguageChangeHandler(e) {
                //TODO: 动态获取后端的语言包文件,并将语言包应用到全局
                //动态获取后端的语言包文件,并将语言包应用到全局
                console.log('e: ', e.detail.value);
                if (e.detail.value == 0) {
                    this.Language = '中文'
pages/index/tab2.vue
@@ -468,7 +468,7 @@
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "来料检验(锦隆)",
                        "text": "来料检验(批量)",
                        "url": "/pages/ZLGL/lailiaojianyan_fast/Kf_QCStockInCheckBill_Fast",
                        "id": 55,
                        "hidden": false
@@ -486,6 +486,13 @@
                        "url": "/pages/ZLGL/QualityReportStep/QualityReportStepBillList",
                        "id": 55,
                        "hidden": false
                    },
                    {
                        "img": "../../static/icon/icon8.png",
                        "text": "在库检验单查询",
                        "url": "/pages/ZLGL/zaikujianyandan/InStockCheckBill",
                        "id": 58,
                        "hidden": false
                    }
                    
                ]
utils/i18n.js
@@ -3,10 +3,14 @@
import {
    CommonUtils
} from "./common.js"
const MissingKeysMap = new Map()
let MissingKeysMap = {}
let enableCollectMissingKey = false
let clockID = null
// 远程获取语言包
export async function getLanguagePackJson(language, forceUpdate = false) {
    // TODO 获取语言包时,添加一个版本字段,对比浏览器缓存中的版本字段和后端文件的是否对应
    // 如果对应,则不返回任何文件,使用缓存文件即可。
    try {
        const res = await CommonUtils.doRequest2Async({
            url: '/Xt_grdAlignment_WMES/SelectMESLanguage_JSON',
@@ -15,17 +19,24 @@
                forceUpdate: forceUpdate
            }
        })
        let {data, Message, count} = res.data
        if(count == 1) {
        let {
            data,
            Message,
            count
        } = res.data
        if (count == 1) {
            enableCollectMissingKey = true
            return data
        }else {
        } else {
            enableCollectMissingKey = false
            CommonUtils.showTips({
                title: "温馨提示",
                message: "[i18n]获取语言包失败: " + Message
            })
            return
        }
    }catch(err) {
    } catch (err) {
        enableCollectMissingKey = false
        CommonUtils.showTips({
            title: "温馨提示",
            message: "[i18n]获取语言包失败: " + err.message
@@ -34,13 +45,52 @@
    }
}
export function addMissingKeyToMap(key) {
    MissingKeysMap.set(key, key)
export function addMissingKeyToMap(key, HFieldCode) {
    if (enableCollectMissingKey) {
        if (!MissingKeysMap[key]) {
            MissingKeysMap[key] = new Set()
        }
        // 防止页面初次加载时,使用本地翻译模块导致的 假缺失现象
        MissingKeysMap[key].add(HFieldCode)
        console.log('MissingKeysMap: ', MissingKeysMap);
        if (!clockID) {
            clockID = setTimeout(() => {
                syncMissingKeyToDB()
            }, 1000)
        } else {
            clearTimeout(clockID)
            clockID = setTimeout(() => {
                syncMissingKeyToDB()
            }, 1000)
        }
    }
}
// 添加缺失字段到远程数据库
export async function syncMissingKeyToDB(){
export async function syncMissingKeyToDB() {
    console.log('MissingKeysMap: ', MissingKeysMap);
    for (let key in MissingKeysMap) {
        if (MissingKeysMap.hasOwnProperty(key)) {
            MissingKeysMap[key] = Array.from(MissingKeysMap[key])
        }
    }
    CommonUtils.doRequest2Sync({
        url: "/Xt_grdAlignment_WMES/syncMissingKeyToDB",
        data: {
            missingObj: JSON.stringify(MissingKeysMap)
        }
    })
    // 清除缺失字段缓存
    MissingKeysMap.clear()
}
    MissingKeysMap = {}
    // 重启应用
    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();
    }
}