wtt
2025-11-12 626e1bcfb9297d066f75d1ab207e9e14f8ec7c00
添加小卫组托单打印和列表强制隐藏功能
7个文件已修改
274 ■■■■ 已修改文件
.hbuilderx/launch.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/index/index.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/shouliaotongzhi/table.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/zutuo_xiaowei/form_xiaowei.vue 216 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
utils/menuListApp.js 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.hbuilderx/launch.json
@@ -21,11 +21,11 @@
            "type" : "uni-app:app-ios"
        },
        {
            "customPlaygroundType" : "local",
            "customPlaygroundType" : "device",
            "localRepoPath" : "D:/WorkBench/ZY_APP_Dev/STUWMS/unpackage/debug",
            "openVueDevtools" : true,
            "packageName" : "com.shebeiguanli.www",
            "playground" : "custom",
            "playground" : "standard",
            "type" : "uni-app:app-android"
        }
    ]
manifest.json
@@ -2,8 +2,8 @@
    "name" : "智云LMES",
    "appid" : "__UNI__B002F49",
    "description" : "",
    "versionName" : "2.0.12",
    "versionCode" : 212,
    "versionName" : "2.0.15",
    "versionCode" : 215,
    "transformPx" : false,
    /* 5+App特有相关 */
    "app-plus" : {
pages.json
@@ -920,7 +920,14 @@
            "style": {
                "navigationBarTitleText": "条码管理"
            }
        }, {
        },
        {
            "path": "pages/tiaomaguanli/table_son",
            "style": {
                "navigationBarTitleText": "条码管理_son"
            }
        },
        {
            "path": "pages/weiwairuku/table",
            "style": {
                "navigationBarTitleText": "委外入库",
@@ -1226,9 +1233,9 @@
            "path": "pages/zhuangxiangdan/form",
            "style": {
                "navigationBarTitleText": "装箱单"
{
            }
        },
        {
            "path": "pages/chaixiang/form",
            "style": {
                "navigationBarTitleText": "拆箱"
@@ -1245,8 +1252,7 @@
            "style": {
                "navigationBarTitleText": "组托-小卫"
            }
        }
        },
        },
        {
            "path": "pages/zhuangxiangdan/table",
            "style": {
pages/index/index.vue
@@ -6,14 +6,14 @@
            </view>
        </view>
        <view class="mains">
            <view v-if="!canEdit" :hidden="item.hidden" class="box" v-for="(item,index) in itemData" :key="index"
            <view v-if="!canEdit" :hidden="item.hidden||!item.id" class="box" v-for="(item,index) in itemData" :key="index"
                @tap="toUrl(item)">
                <image :src="item.img" mode=""></image>
                <view class="texts">
                    {{item.text}}
                </view>
            </view>
            <view :enable-hidden="item.hidden" v-if="canEdit" class="box edit" v-for="(item,index) in itemData"
            <view :enable-hidden="item.hidden" :hidden="!item.id"  v-if="canEdit" class="box edit" v-for="(item,index) in itemData"
                :key="index" @tap="switchHidden(index)">
                <uni-icons class="edit-mark" color="red" type="closeempty"></uni-icons>
                <image :src="item.img" mode=""></image>
@@ -53,7 +53,7 @@
                        img: '../../static/icon/icon8.png',
                        text: '收料通知单条码打印',
                        url: '/pages/tiaomaguanli/table?HBillType=1103',
                        id: 1,
                        id: 1,//id为0强制不显示
                        hidden: false,
                    },
                    {
@@ -287,9 +287,10 @@
                        id: 32,
                        hidden: false,
                    },{
                        img: '../../static/icon/icon16.png',
                        text: '装箱单',
                        url: '/pages/zhuangxiangdan/form',
                        id: 30,
                        id: 34,
                        hidden: false,
                    },
@@ -543,6 +544,7 @@
                Array.from(data).forEach(e => {
                    this.itemData[e["HIndex"]].hidden = !CommonUtils.stringToBoolean(e["HShowMode"])
                    this.itemData[e["HIndex"]].HMaker = e["HMaker"]
                    this.itemData[e["HIndex"]].id = e["HEntryID"]//用于数据库设置模块隐藏
                })
            },
            switchHidden(index) {
pages/shouliaotongzhi/table.vue
@@ -390,7 +390,7 @@
                    HMaterName,
                    HCoilNO,
                    HSupMaterNumber,
                    HFurnaceNO,
                    HFurnaceNO,//款号
                    HMaterModel,
                    HQty,
                    HPcsName,
pages/zutuo_xiaowei/form_xiaowei.vue
@@ -85,7 +85,20 @@
            <button class="btn-d" size="mini" @tap="cmdDelete">删除</button>
            <button class="btn-c" size="mini" @tap="cmdExit">退出</button>
        </view>
        <!-- 打印模块 -->
        <labelPrinterComponentVue ref="labelPrinter" :printInfo="printInfo" :printMode="'cpcl'">
        </labelPrinterComponentVue>
        <!-- 打印机选择列表 -->
        <view v-if="maskShow" class="uni-mask" @tap="maskShow = false">
            <scroll-view class="uni-scroll_box" scroll-y>
                <view class="uni-list-box" v-for="(device, index) in discoveredDevices" :key="index"
                    @tap="connectBT(device)">
                    <view class="uni-list_name">名称:{{ device.name }}</view>
                    <view class="uni-list_item">{{ connectedDeviceId === device.address?'已连接':'未连接' }}</view>
                </view>
            </scroll-view>
        </view>
        <view v-if="showResultTable" class="result-modal">
            <view class="modal-mask" @tap="closeResultTable"></view>
            <view class="modal-content">
@@ -105,10 +118,12 @@
                </view>
                <view class="modal-footer">
                    <button class="btn-a" size="mini" @tap="toAddNew">新增</button>
                    <button class="btn-a" size="mini" @tap="search">打印</button>
                    <view style="flex: 1;"></view>
                    <button class="btn-c" size="mini" @tap="closeResultTable">关闭</button>
                </view>
            </view>
            </view>
        </view>
    </view>
</template>
@@ -124,9 +139,13 @@
    import {
        MpaasScan
    } from "@/utils/mpaasScan.js"
    import labelPrinterComponentVue from "@/components/labelPrinterComponent/labelPrinterComponent.vue"
import getdateTime from '../../utils/getdateTime';
    export default {
        data() {
        components: {
            labelPrinterComponentVue
        },
        data() {
            return {
                // 计算列表高度
                bottomBtnTop: 0,
@@ -188,7 +207,10 @@
                titleData: [], //不需要显示的字段
                OperationType: 1, //从缓存列表中返回数据类型(1新增、2从缓存列表中返回)
                HBarCode_Pack_Temp: "", //从缓存列表中返回箱条码
                //蓝牙相关信息
                printInfo: "",//打印内容
                maskShow: false,//蓝牙打印机显示绑定
                printListData:[],//
                //展示表单
                showResultTable: false, // 控制结果表格显示
                    resultTableData: [], // 结果表格数据
@@ -577,6 +599,7 @@
                            if (count == 1) {
                                console.log('条码生成成功:', res.data.data[0]['条码编号']);
                                this.HBarCode_Pack = res.data.data[0]['条码编号'];
                                this.printListData = res.data.data;//条码信息保存用于打印
                                resolve(this.HBarCode_Pack); // 解析Promise
                            } else {
                                uni.showToast({
@@ -670,6 +693,7 @@
                toAddNew() {
                  // 重置数据,准备新增
                  this.showResultTable = false;
                  this.EnableSubmit=true;
                  this.resultTableData = [];
                  this.HBarCode_Pack = '';
                  this.HBarCode = '';
@@ -685,7 +709,173 @@
                },
            cmdExit() {
                uni.navigateBack()
            }
            },
            //打印模块函数
            /**
             * 打印函数
             */
            async search() {
                // #ifndef APP-PLUS
                uni.showModal({
                    content: "不支持蓝牙打印功能,请切换移动设备...",
                })
                return
                // #endif
                if (this.$printer.isConnected() === false) {
                    this.$refs.labelPrinter.openPopup()
                } else {
                    let printContent = []
                    let printInfoBuffer = []
                    let count = 0
                    uni.showLoading()
                    console.log('this.listData: ', this.printListData);
                    for (let listOne of this.printListData) {
                        let Message = await this.getPrintTemplate(listOne.HInterID, listOne.HItemID)
                        printContent.push(Message)
                        count++;
                        if (count == 10) {
                            printInfoBuffer.push(printContent.join("\r\n"))
                            count = 0
                            printContent = []
                        }
                    }
                    uni.hideLoading()
                    printInfoBuffer.push(printContent.join("\r\n"))
                    this.printInfo = JSON.stringify(printInfoBuffer)
                    printInfoBuffer = []
                    await this.$nextTick(() => {
                        this.$refs.labelPrinter.execPrint()
                    })
                }
            },
            /** 获取打印模板
             * @param {Object} HInterID
             * @param {Object} HItemID
             */
            async getPrintTemplate(HInterID,HItemID) {
                console.log('data: ', {
                    HOrginationName: uni.getStorageSync("Organization"),
                    HBillSubType: this.HBillType,
                    HInterID: HInterID,
                    HItemID: HItemID,
                })
                return new Promise((resolve, reject) => {
                    CommonUtils.doRequest2({
                        url: "/Sc_BarCode/Get_BarCodePrintCode_CPCL",
                        data: {
                            HOrginationName: uni.getStorageSync("Organization"),
                            HBillSubType: this.HBillType,
                            HInterID: HInterID,
                            HItemID: HItemID,
                        },
                        resFunction: (res) => {
                            let {
                                Message,
                                count
                            } = res.data
                            if (count == 1) {
                                console.log('Message: ',Message);
                                resolve(Message)
                            } else {
                                uni.showToast({
                                    icon: 'none',
                                    title: Message
                                })
                                reject();
                            }
                        },
                        errFunction: (err) => {
                            reject();
                        },
                    })
                })
            },
            /**
             * 查找打印机
             */
            async searchLabelPrinter() {
                // 查找打印机
                var that = this
                // 使用openBluetoothAdapter 接口,免去主动申请权限的麻烦
                uni.openBluetoothAdapter({
                    success: async (res) => {
                        await this.checkPermission();
                        console.log('start discovery devices');
                        this.discoveredDevices = [];
                        console.log(res)
                        bluetoothTool.discoveryNewDevice();
                        this.maskShow = true
                    },
                    fail: async (e) => {
                        console.error(e)
                        switch (e.code) {
                            case "10009":
                                this.showToast("此设备不支持设备搜索功能!");
                                break;
                            default:
                                console.error(e);
                        }
                    }
                })
            },
            onDevice(device) {
                console.log("监听寻找到新设备的事件---------------")
                console.log(device)
                if (typeof device === 'undefined') return;
                if (typeof device.name === 'undefined') return;
                console.log(device.name);
                if (device.name === '') return;
                if (device.name === null) return;
                if (device.name.toUpperCase().endsWith('_BLE') ||
                    device.name.toUpperCase().endsWith('-LE') ||
                    device.name.toUpperCase().endsWith('-BLE')) return;
                const isDuplicate = this.discoveredDevices.find(item => item.address === device.address);
                if (isDuplicate) return;
                this.discoveredDevices.push(device);
            },
            connectBT(device) {
                const vm = this;
                uni.showLoading({
                    title: '连接中'
                });
                bluetoothTool.connDevice(device.address, (result) => {
                    console.log(result)
                    uni.hideLoading()
                    if (result) {
                        //     // console.log(result);
                        bluetoothTool.cancelDiscovery();
                        // console.log(vm.$printer)
                        vm.$printer.init(new FakeConnectedDevice());
                        vm.connectedDeviceId = device.address;
                        uni.showToast({
                            icon: 'none',
                            title: '连接成功'
                        })
                        this.maskShow = false
                    } else {
                        uni.showToast({
                            icon: 'none',
                            title: '连接失败'
                        })
                    }
                });
            },
            stopSearchBT() {
                console.log("停止搜寻附近的蓝牙外围设备---------------")
                bluetoothTool.cancelDiscovery();
            },
            closeBluetooth() {
                console.log("停止蓝牙连接")
                const vm = this;
                if (vm.connectedDeviceId != '') {
                    bluetoothTool.closeBtSocket();
                    vm.connectedDeviceId = "";
                }
            },
        },
        computed: {
            listTableHeight: {
@@ -744,7 +934,19 @@
        padding: 8rpx 20rpx;
        font-size: 30rpx;
    }
    .uni-mask {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 3;
        display: flex;
        align-items: center;
        width: 100%;
        background: rgba(0, 0, 0, 0.6);
        padding: 0 30rpx;
        box-sizing: border-box;
    }
    .form {
        display: flex;
        flex-direction: column;
@@ -868,7 +1070,7 @@
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 9999;
      z-index: 2;
      
      .modal-mask {
        position: absolute;
utils/menuListApp.js
@@ -51,16 +51,16 @@
    let oMain = ""
    let oMainSub = []
    Array.from(payload).forEach((one, index) => {
        if (one.hidden == true) {
            oMainSub.push({
                HEntryID: one.id,
                HIndex: index,
                HName: one.text,
                HPicNum: one.img,
                HShowMode: !one.hidden,
                HMenuName: menuName,
            })
        }
        oMainSub.push({
            HEntryID: one.id,
            HIndex: index,
            HName: one.text,
            HPicNum: one.img,
            HShowMode: !one.hidden,
            HMenuName: menuName,
        })
    })
    oMain = JSON.stringify(oMainSub) + ";" + user + ";" + menuName + ";" +
        deviceType