chenhaozhe
2025-07-31 70bde89905aa72e21901aa08ffd4573345b51311
优化页面逻辑
1个文件已添加
5个文件已修改
272 ■■■■ 已修改文件
pages/caigoudingdan/caigoudingdan.vue 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/caigoudingdan/generate.vue 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/shouliaotongzhi/table.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tiaomadaying/tiaomadaying.vue 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/zhijiediaobo/form.vue 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/elemIterator.js 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/caigoudingdan/caigoudingdan.vue
@@ -4,7 +4,7 @@
            <view class="form-item">
                <view class="title"><text>*</text>条码:</view>
                <view class="right" style="width: 380rpx;">
                    <input auto-focus v-model="HBarCode" placeholder="请扫描(或输入)条码" @focus="HBarCode = ''" @blur="getCode(HBarCode)" @confirm="getCode(HBarCode)" />
                    <input :focus="HBarCodeFocus" v-model="HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(HBarCode)" />
                </view>
                <uni-icons type="scan"
                    style="margin-left: 10rpx;background-color: #3A78FF;padding: 6rpx;color: #fff;border-radius: 100%;"
@@ -32,7 +32,7 @@
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item)">
        <view class="list" v-for="(item,index) in listData" :key="index" @tap="toSon(item, index+1)">
            <uni-card :title="item.物料代码" :extra="'No. ' + Number(index+1)" style="margin: 10px;">
                <view class="card-detail">
                    <view class="detail">
@@ -64,6 +64,7 @@
    export default {
        data() {
            return {
                HBarCodeFocus: true,
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                HBarCode: '',
@@ -77,7 +78,9 @@
                listData: [],
            }
        },
        onLoad() {},
        onLoad() {
            this.HBarCodeFocus = true
        },
        methods: {
            //扫码
            toScanCode() {
@@ -107,7 +110,7 @@
                        (res) => {
                            console.log('采购订单: ', res)
                            let {data, count, Message} = res.data
                            if(count == 0 && data.count > 0){
                            if(count == 1 && Array.from(data).length> 0){
                                CommonUtils.playSound(1)
                                this.baseInfo = {
                                    HBillNo: data[0].单据号,
@@ -118,6 +121,7 @@
                                this.listData = data
                            } else {
                                CommonUtils.playSound(0)
                                this.refeshBarcodeState()
                                uni.showToast({
                                    title: "此条码无返回值...",
                                    icon: 'none'
@@ -125,15 +129,24 @@
                            }
                        },
                        (err) => {
                            this.refeshBarcodeState()
                            CommonUtils.playSound(0)
                        }
                    )
                }
            },
            toSon(item) {
            async refeshBarcodeState(){
                this.HBarCodeFocus = false
                await this.$nextTick(() => {
                    this.HBarCode = ""
                    this.HBarCodeFocus = true
                })
            },
            toSon(item, lineNo) {
                uni.navigateTo({
                    url: `./generate?OperationType=1&closeType=1&linterid=${this.baseInfo.HInterID}&hmaterid=${item["HMaterID"]}`
                    url: `./generate?OperationType=1&closeType=1&linterid=${this.baseInfo.HInterID}&hmaterid=${item["HMaterID"]}&lineNo=${lineNo}`
                })
            }
        }
pages/caigoudingdan/generate.vue
@@ -98,6 +98,7 @@
    export default {
        data() {
            return {
                lineNo: 0,
                printInfo: "",
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
@@ -109,6 +110,7 @@
                baseInfo: {
                    HBillNo: '',
                    HMainID: '',
                    HSupName: '',
                    HSubID: '',
                    HOrderBillNo: '',
                    HMaterID: '',
@@ -121,6 +123,8 @@
                    HMinQty: '',
                    HBQty: '',
                    HSupID: '',
                    HBatchNo: '',
                    HDate: '',
                },
                sWhere: '',
                listData: [],
@@ -131,10 +135,11 @@
            labelPrinterComponentVue
        },
        onLoad(e) {
            console.log(e)
            console.log("页面传递参数: ",e)
            this.OperationType = e.OperationType
            this.linterid = e.linterid
            this.hmaterid = e.hmaterid
            this.lineNo = e.lineNo
            this.getData()
        },
        methods: {
@@ -161,7 +166,11 @@
                                HMaterModel: data[0]['规格型号'],
                                HQty: data[0]['数量'],
                                HMTONo: data[0]['计划跟踪号'],
                                HSupID: data[0]['HSupID']
                                HSupID: data[0]['HSupID'],
                                HBatchNo: data[0]['批号'],
                                HSupName: data[0]['供应商'],
                                HBatchNo: data[0]['批号'],
                                HDate: data[0]['日期'],
                            }
                            this.listData = data
                        } else {
@@ -205,22 +214,35 @@
B QR 500 30 M 2 U 3
LA,${listOne['条码编号']}
ENDQR
T 24 0 30 30 供应商: ${listOne['供应商']}
T 24 0 30 80 供应商料号:
T 24 0 30 130 物料编码: ${listOne['物料代码']}
T 24 0 30 180 物料分组: ${listOne['托号']}
T 24 0 300 180 规格型号: ${listOne['规格型号']}
T 24 0 30 230 数量:  ${listOne['数量']}
T 24 0 300 230 日期: ${listOne['日期'].split(" ")[0]}
T 24 0 30 280 检验员:
T 24 0 300 280 计划跟踪号: ${listOne['计划跟踪号']}
T 24 0 30 330 检验结果:
T 24 0 10 30 供应商: ${this.baseInfo.HSupName}
T 24 0 10 55 (eng)
T 24 0 10 80 供应商料号:  ${this.baseInfo.HMaterNumber}
T 24 0 10 105 (eng)
T 24 0 10 130 物料名称: ${this.baseInfo.HMaterName}
T 24 0 5 155 (eng)
T 24 0 5 180 分组: ${this.baseInfo.HBatchNo}
T 24 0 5 205 (eng)
T 24 0 300 180 规格: ${this.baseInfo.HMaterModel}
T 24 0 300 205 (eng)
T 24 0 10 230 数量:  ${this.baseInfo.HQty} (${this.baseInfo.HPcsName})
T 24 0 5 255 (eng)
T 24 0 300 230 日期: ${this.baseInfo.HDate}
T 24 0 300 255 (eng)
T 24 0 5 280 检验员:
T 24 0 5 305 (eng)
T 24 0 300 280 采购单号: ${this.baseInfo.HBillNo || ''}
T 24 0 300 305 (eng)
T 24 0 5 330 检验结果:
T 24 0 5 355 (eng)
BOX 260 330 280 350 4
T 24 0 290 330 合格
T 24 0 290 355 (eng)
BOX 360 330 380 350 4
T 24 0 390 330 不合格
T 24 0 390 355 (eng)
BOX 480 330 500 350 4
T 24 0 510 330 特采
T 24 0 510 355 (eng)
FORM
PRINT`)
                        count++;
@@ -249,9 +271,9 @@
                //获取选择的工厂代码
                var CampanyName = "xxx";
                //获取选择的源单类型
                var HSourceBillType = "收料通知单";
                var HSourceBillType = "采购订单";
                //获取选择的条码类型
                var HSelectBarCodeType = "唯一条码";
                var HSelectBarCodeType = "品种条码";
                //获取当前登录人员
                var UserName = uni.getStorageSync('HUserName');
                var sMainSub = sMainStr + ';' + HOrgType + ';' + HSourceBillType + ';' + HSelectBarCodeType + ';' +
pages/shouliaotongzhi/table.vue
@@ -4,7 +4,7 @@
            <view class="form-item">
                <view class="title"><text>*</text>条码:</view>
                <view class="right" style="width: 380rpx;">
                    <input auto-focus v-model="HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(HBarCode)"/>
                    <input :focus="HBarCodeFocus" v-model="HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(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>
@@ -57,6 +57,8 @@
    export default {
        data() {
            return {
                HBarCodeFocus: false,
                userInfo:getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
                HBarCode:'',
@@ -70,9 +72,18 @@
                listData:[],
            }
        },
        onLoad() {},
        onLoad() {
            this.HBarCodeFocus = true
        },
        methods: {
            playSound(e){
            async refreshBarCodeState() {
                this.HBarCodeFocus = false
                await this.$nextTick(() => {
                    this.HBarCodeFocus = true
                    this.HBarCode = ""
                })
            },
             playSound(e){
                const innerAudioContext = uni.createInnerAudioContext();
                if(e == 1){
                    innerAudioContext.src = '/static/success.wav';
@@ -96,6 +107,8 @@
            //扫条码处理
            getCode(HBarCode){
                if(!HBarCode){
                    this.playSound(0)
                    this.refreshBarCodeState()
                    uni.showToast({
                        title:'条码不能为空',
                        icon:'none'
@@ -119,6 +132,7 @@
                                this.listData = data
                            }else{
                                this.playSound(0)
                                this.refreshBarCodeState()
                                uni.showToast({
                                    title:res.data.Message,
                                    icon:'none'
@@ -127,6 +141,7 @@
                        },
                        fail: (res) => {
                            this.playSound(0)
                            this.refreshBarCodeState()
                            console.log(res);
                            uni.showToast({
                                title:'接口请求失败',
pages/tiaomadaying/tiaomadaying.vue
@@ -6,7 +6,8 @@
                <view class="item">
                    <view class="left">条码编号:</view>
                    <view class="right barcode">
                        <input auto-focus name="HBarCode" v-model="lailiaoInfo.barCodeNo" @focus="lailiaoInfo.barCodeNo = ''" @blur="barCodeEntryHandler(lailiaoInfo.barCodeNo)"
                        <input :focus="HBarCodeFocus" name="HBarCode" v-model="lailiaoInfo.barCodeNo"
                            @focus="lailiaoInfo.barCodeNo = ''" @confirm="barCodeEntryHandler(lailiaoInfo.barCodeNo)"
                            placeholder="请扫描商品条码" />
                    </view>
                    <view>
@@ -121,6 +122,8 @@
    export default {
        data() {
            return {
                HBarCodeFocus: false,
                printInfo: "",
                userInfo: getUserInfo(),
                buttonStatus: {
@@ -155,7 +158,17 @@
        components: {
            labelPrinterComponentVue
        },
        onLoad() {
            this.HBarCodeFocus = true
        },
        methods: {
            async refreshBarcodeState() {
                this.HBarCodeFocus = false
                await this.$nextTick(() => {
                    this.HBarCodeFocus = true
                    this.lailiaoInfo.barCodeNo = ""
                })
            },
            async print() {
                if (this.$printer.isConnected() === false) {
                    this.$refs.labelPrinter.openPopup()
@@ -281,7 +294,7 @@
                    // await this.$nextTick(() => {
                    //     this.$refs.labelPrinter.execPrint()
                    // })
// T 24 0 300 280 计划跟踪号: ${this.lailiaoInfo.HMTONo || ''}
                    // T 24 0 300 280 计划跟踪号: ${this.lailiaoInfo.HMTONo || ''}
                    this.printInfo = `! 0 200 200 400 1
PAGE-WIDTH 608
SETQRVER 3
@@ -334,10 +347,10 @@
                        icon: 'none',
                        title: '查询的单据号不存在...'
                    })
                }
                let d = data[row - 1]
                console.log('条码接收数据: ',d)
                console.log('条码接收数据: ', d)
                this.lailiaoInfo = Object.assign(this.lailiaoInfo, {
                    HMaterNumber: d['物料编码'],
                    HMaterName: d['物料名称'],
@@ -386,13 +399,14 @@
                    btn2: false
                }
            },
            barCodeEntryHandler(barCode){
            barCodeEntryHandler(barCode) {
                if (CommonUtils.isEmpty(barCode) === false) {
                    console.log('条码内容:' + barCode);
                    this.lailiaoInfo.barCodeNo = barCode;
                    if (barCode.includes("@") === false) {
                        this.buttonStatus.btn2 = false
                        CommonUtils.playSound(0)
                        this.refreshBarcodeState()
                        return uni.showToast({
                            icon: 'none',
                            title: '条码格式错误,请重新扫描...'
@@ -418,22 +432,24 @@
                                count
                            } = res.data
                            if (count > 0) {
                                this.setLailiaoInfo(data, Row)
                            }else {
                            } else {
                                CommonUtils.playSound(0)
                                this.refreshBarcodeState()
                            }
                        },
                        (error) => {
                            CommonUtils.playSound(0)
                            this.refreshBarcodeState()
                            this.buttonStatus.btn2 = false
                        }
                    )
                }
            },
             toScanCode() {
            toScanCode() {
                uni.scanCode({
                    onlyFromCamera: true,
                    success: (res) => {
@@ -442,7 +458,8 @@
                });
            },
            GenereateBarCode() {
                let HBarCodeNoStr = `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber}@${this.lailiaoInfo.HMTONo}@${this.lailiaoInfo.HQty}@${this.lailiaoInfo.HSupID}`
                let HBarCodeNoStr =
                    `${this.lailiaoInfo.HBillNo}@${this.lailiaoInfo.HBillLineNo}@${this.lailiaoInfo.HMaterNumber}@${this.lailiaoInfo.HMTONo}@${this.lailiaoInfo.HQty}@${this.lailiaoInfo.HSupID}`
                let sMain = []
                sMain[0] = this.lailiaoInfo
                let sMainStr = JSON.stringify(sMain);
@@ -567,7 +584,7 @@
                        }
                    }
                    .barcode {
                        background-color: #fff !important;
                    }
pages/zhijiediaobo/form.vue
@@ -4,7 +4,8 @@
            <view class="form-item">
                <view class="title">条码:</view>
                <view class="right" style="width: 380rpx;">
                    <input v-model="hform.HBarCode" placeholder="请扫描(或输入)条码" @confirm="getCode(hform.HBarCode)" />
                    <input :focus="barCodeFocus" v-model="hform.HBarCode" placeholder="请扫描(或输入)条码"
                        @confirm="getCode(hform.HBarCode)" />
                </view>
                <view class="icon-wrapper">
                    <uni-icons type="scan" size="20" @click="toScanCode"></uni-icons>
@@ -63,7 +64,8 @@
                    <view class="right" v-show="showHSourceBillNo">
                        <!-- <uni-combox v-if="reHSourceBillNo" :candidates="arrayHSourceBillNo" placeholder="请输入源单单号"
                            v-model="hform.HSourceBillNo" @input="HSourceBillNoChange"></uni-combox> -->
                        <input type="text" name="HSourceBillNo" v-model="hform.HSourceBillNo" placeholder="请输入源单单号" />
                        <input :focus="HSourcebillNoFocus" type="text" @confirm="onHSourceBillNoConfirmHandler" name="HSourceBillNo"
                            v-model="hform.HSourceBillNo" placeholder="请输入源单单号" />
                    </view>
                    <view class="icon-wrapper" v-show="showHSourceBillNo" :disabled="hform.HMainSourceBillType === -1">
@@ -352,17 +354,19 @@
    import {
        getUserInfo
    } from "@/utils/auth.js";
    import elemIterator from '../../utils/elemIterator';
    import BillListPopupVue from '../../components/BillListPopup/BillListPopup.vue';
    export default {
        data() {
            return {
                userInfo: getUserInfo(),
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                HModName: 'Kf_MoveStockBill_PDA',
                ModRightName: 'CE_MoveStock',
                OperationType: 1,
                HInterID_Temp: '',
                HSCIsStockMgr: false,
                HIsStockMgr: false,
                showHStockPlaceName: true,
@@ -370,6 +374,8 @@
                showHSourceBillNo: true,
                reHSourceBillNo: true,
                showHSupName: true,
                barCodeFocus: false,
                HSourcebillNoFocus: false,
                HStockStyleArray: ["组织内调拨", "跨组织调拨"],
@@ -417,17 +423,17 @@
                    HQty: '',
                    HSCWHName: getUserInfo().HWHName,
                    HSCWHID: getUserInfo().HWhID,
                    HWHName: getUserInfo().HWHName,
                    HWHID: getUserInfo().HWhID,
                    HWHName: "",
                    HWHID: "",
                    HStockStyle: '组织内调拨',
                    HOutStockPlaceName:  getUserInfo().HSPName,
                    HOutStockPlaceName: getUserInfo().HSPName,
                    HOutStockPlaceID: getUserInfo().HSPID,
                    HStockPlaceName: getUserInfo().HSPName,
                    HStockPlaceID: getUserInfo().HSPID,
                    HTransferDirect: '', //调拨方向
                    HShipType: '', // 出库类型    
                    HMainSourceBillType: 3720,
                    HMainSourceBillType: 1402,
                    HSourceBillNo: '', //CGDD000200
                    HFIFOWHName: '',
                    HFIFOWHID: '',
@@ -468,8 +474,10 @@
            if (e.HInterID) {
                this.HInterID_Temp = e.HInterID
                // this.btnType = 1
                this.barCodeFocus = true
                this.RoadBillMain(e.HInterID)
            } else {
                this.HSourcebillNoFocus = true
                this.getNewData()
            }
            this.getHBaseList()
@@ -520,6 +528,15 @@
                        }
                    }
                )
            },
            onHSourceBillNoConfirmHandler() {
                if (this.hform.HMainSourceBillType == -1) {
                    // 手工录入不进行提交
                    this.playSound(1)
                    return
                }
                this.getHBarCodeData(this.hform.HSourceBillNo)
            },
            playSound(e) {
                const innerAudioContext = uni.createInnerAudioContext();
@@ -1048,7 +1065,7 @@
                    this.hform.HFIFOWHID = 0
                }
                uni.request({
                    url: this.serverUrl + '/WEBSController/get_SourceBarCode_MateOut_Json',
                    url: this.serverUrl + '/WEBSController/get_SourceBarCode_MoveStock_Json',
                    data: {
                        HInterID: this.hform.HInterID,
                        HBillNo: this.hform.HBillNo,
@@ -1056,10 +1073,10 @@
                        HSourceBillNo: HBarCode,
                        HSourceBillType: this.hform.HMainSourceBillType,
                        HMaker: this.hform.HMaker,
                        HStockOrgID: this.hform.HStockOrgID,
                        HFIFOWHID: this.hform.HFIFOWHID,
                        HPTQty: this.hform.HPTQty || 0,
                        HPlanMode: this.hform.HPlanMode || 0
                        HOWNERID: this.hform.HStockOrgID,
                        HFIFOWhID: this.hform.HFIFOWHID,
                        // HPTQty: this.hform.HPTQty || 0,
                        // HPlanMode: this.hform.HPlanMode || 0
                    },
                    success: (res) => {
                        if (res.data.count == 1) {
@@ -1078,19 +1095,35 @@
                            }
                            this.tabs = 2
                            this.showHSupName = false
                            this.barCodeFocus = true
                            this.playSound(1)
                            this.DisBillEntryList()
                        } else {
                            this.playSound(0)
                            console.log('res: ',res);
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                            this.HSourcebillNoFocus = false
                            this.$nextTick(() => {
                                this.hform.HSourceBillNo = ""
                                this.HSourcebillNoFocus = true
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                    fail: (err) => {
                        console.log('err: ',err);
                        this.playSound(0)
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                        this.HSourcebillNoFocus = false
                        this.$nextTick(() => {
                            this.hform.HSourceBillNo = ""
                            this.HSourcebillNoFocus = true
                        })
                    },
                });
@@ -1139,18 +1172,30 @@
                                    this.DisBillEntryList()
                                } else {
                                    this.playSound(0)
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                    this.barCodeFocus = false
                                    this.$nextTick(() => {
                                        this.barCodeFocus = true
                                        this.hform.HBarCode = ""
                                    })
                                }
                            },
                            fail: (res) => {
                                this.playSound(0)
                                this.barCodeFocus = true
                                console.log(res);
                                uni.showToast({
                                    title: '接口请求失败',
                                    icon: 'none'
                                })
                                this.barCodeFocus = false
                                this.$nextTick(() => {
                                    this.barCodeFocus = true
                                    this.hform.HBarCode = ""
                                })
                            },
                        });
@@ -1277,14 +1322,25 @@
                                    title: res.data.Message,
                                    icon: 'none'
                                })
                                this.barCodeFocus = false
                                this.$nextTick(() => {
                                    this.barCodeFocus = true
                                    this.hform.HBarCode = ""
                                })
                            }
                        },
                        fail: (res) => {
                            this.playSound(0)
                            this.barCodeFocus = true
                            console.log(res);
                            uni.showToast({
                                title: '接口请求失败',
                                icon: 'none'
                            })
                            this.barCodeFocus = false
                            this.$nextTick(() => {
                                this.barCodeFocus = true
                                this.hform.HBarCode = ""
                            })
                        },
                    });
@@ -1593,7 +1649,7 @@
                    }
                }
            },
            goBack() {
                uni.showModal({
                    title: '提示',
utils/elemIterator.js
New file
@@ -0,0 +1,49 @@
import { CommonUtils } from "./common"
export default class elemIterator{
    current = 0
    elemArray = []
    constructor(current, elemArray){
        if(CommonUtils.isAllDigits(current) == false) {
            current = 0
        }
        if(Array.isArray(elemArray) == false){
            elemArray = []
        }
        this.current =  Number(current)
        this.elemArray = elemArray
    }
    setElemArray(elemArray) {
        if(Array.isArray(elemArray) == false){
            throw new TypeError()
        }
        this.elemArray = elemArray
    }
    setElemArrayArgs(...args) {
        this.elemArray = args
    }
    moveNext(){
        this.current++
        if(this.current == this.elemArray.length){
            this.current = 0
        }
    }
    getCurrentElem(){
        return this.elemArray[this.current]
    }
    exec(callback){
        if(Object.prototype.toString.call(callback) !== '[object Function]'){
            throw new TypeError()
        }
        callback.call(null, this.elemArray[this.current])
    }
}