chenhaozhe
2026-02-05 c141b01c990146b4ef41c17a69ad3066d721a91c
pages/MJGL/Sb_EquipDotCheckBill/Sb_EquipDotCheckBillList.vue
@@ -1,135 +1,129 @@
<template>
    <view class="content">
        <view class="tabs">
            <view :class="tabs == 0 ? 'on':''" @tap="changeTab(0)">缓存列表</view>
            <!-- <view :class="tabs == 1 ? 'on':''" @tap="changeTab(1)">已上传列表</view> -->
        </view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view class="form" v-if="tabs == 0">
            <view class="buttons" @tap="add">
                <uni-icons type="plus" style="margin-right: 10rpx;" size="22"></uni-icons>新增
            </view>
        </view>
        <view class="form" v-if="tabs == 1">
        <view class="form">
            <view class="form-item">
                <view class="title">单据号:</view>
                <view class="title">开始时间:</view>
                <view class="right">
                    <input v-model="hform.HBillNo" placeholder="请输入单据号" />
                    <uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HBeginDate">
                        <input :value="hform.HBeginDate" />
                    </uni-datetime-picker>
                </view>
            </view>
            <view class="form-item">
                <view class="title">源单单号:</view>
                <view class="title">结束时间:</view>
                <view class="right">
                    <input v-model="hform.HSourceBillNo" placeholder="请输入源单单号" />
                    <uni-datetime-picker type="date" :clear-icon="false" v-model="hform.HEndDate">
                        <input :value="hform.HEndDate" />
                    </uni-datetime-picker>
                </view>
            </view>
            <view v-if="showmore">
                <view class="form-item">
                    <view class="title">单据号:</view>
                    <view class="right">
                        <input v-model="hform.HBillNo" placeholder="请输入单据号" />
                    </view>
                </view>
            </view>
            <view class="other">
                <view v-if="!showmore" @tap="changeShowMore">
                    展开其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="bottom"></uni-icons>
                </view>
                <view v-if="showmore" @tap="changeShowMore">
                    折叠其他条件<uni-icons color="#1890FF" style="margin-left: 8rpx;" type="top"></uni-icons>
                </view>
            </view>
            <view class="buttons">
                <button class="btn-a" size="mini" type="default" @tap="clear">重置</button>
                <button class="btn-b" size="mini" type="default" @tap="creat">新增</button>
                <button class="btn-c" size="mini" type="default" @tap="search">查询</button>
            </view>
        </view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view style="width: 100%;height: 16rpx;background-color: #e5e5e5;" id="divide"></view>
        <view class="list" v-for="(item,index) in showList" :key="index" v-if="tabs==0">
            <uni-card :title="item.制单日期.substr(0,10)" :extra="item.单据号" style="margin: 10px;"
                @tap="showDetail = showDetail==index?-1:index">
                <view class="card-detail">
                    <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>{{dayjs(item.开始日期).format("YYYY-MM-DD HH:mm:DD")}}
                    </view>
                    <view class="detail" v-if="item.结束日期">
                        <text>结束日期:</text>{{dayjs(item.结束日期).format("YYYY-MM-DD HH:mm:DD")}}
                    </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.hmainid">
                        <text>内部单据号:</text>{{item.hmainid}}
                    </view>
                    <view class="detail" v-if="item.最终结论">
                        <text>最终结论:</text>{{item.最终结论}}
                    </view>
                </view>
        <view :style="{
            height: calcContentHeight + 'px',
            overflowY: 'auto'
        }">
                <view class="more">
                    <!-- <view class="part" style="border-right: 1px solid #eee;color: #3a78ff;" @tap.stop="edit(item)">
                        <uni-icons type="compose" style="color: #3a78ff;margin-right: 10rpx;" size="18"></uni-icons>编辑
                    </view> -->
                    <view style="flex: 1"></view>
                    <view class="part" style="color: #da0000;" @tap.stop="del(item)">
                        <uni-icons type="trash" style="color: #da0000;margin-right: 10rpx;" size="18"></uni-icons>删除
            <view class="list" v-for="(item,index) in showList" :key="index" v-if="tabs==0">
                <uni-card :title="item.制单日期.substr(0,10)" :extra="item.单据号" style="margin: 10px;"
                    @tap="showDetail = showDetail==index?-1:index">
                    <view class="card-detail">
                        <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="card-detail" v-if="showDetail == index">
                            <view class="detail" v-if="item.表头备注">
                                <text>表头备注:</text>{{item.表头备注}}
                            </view>
                            <view class="detail" v-if="item.开始日期">
                                <text>开始日期:</text>{{dayjs(item.开始日期).format("YYYY-MM-DD HH:mm:DD")}}
                            </view>
                            <view class="detail" v-if="item.结束日期">
                                <text>结束日期:</text>{{dayjs(item.结束日期).format("YYYY-MM-DD HH:mm:DD")}}
                            </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.hmainid">
                                <text>内部单据号:</text>{{item.hmainid}}
                            </view>
                        </view>
                    </view>
                </view>
            </uni-card>
                    <view class="more" v-if="showDetail == index && operations != index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="top" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>收起
                        </view>
                        <view class="part" @tap.stop="operations = operations==index?-1:index">
                            <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                                size="14"></uni-icons>操作
                        </view>
                    </view>
                    <view class="more" v-if="showDetail != index && operations != index">
                        <view class="part" style="border-right: 1px solid #eee;">
                            <uni-icons type="bottom" style="color: #888;margin-right: 10rpx;" size="14"></uni-icons>更多信息
                        </view>
                        <view class="part" @tap.stop="operations = operations==index?-1:index">
                            <uni-icons type="more-filled" style="color: #888;margin-right: 10rpx;"
                                size="14"></uni-icons>操作
                        </view>
                    </view>
                    <view class="op" v-if="operations == index">
                        <!-- <button class="op3" size="mini" plain @tap.stop="edit(item)">编辑</button> -->
                        <button class="op4" size="mini" plain @tap.stop="del(item)">删除</button>
                        <button class="op5" size="mini" plain @tap.stop="operations = -1">取消操作</button>
                    </view>
                </uni-card>
            </view>
        </view>
        <view class="list" v-for="(item,index) in showList" :key="index" v-if="tabs==1">
            <uni-card :title="item.日期" :extra="item.单据号" style="margin: 10px;"
                @tap="showDetail = showDetail==index?-1:index">
                <view class="card-detail">
                    <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="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>
                <view class="more">
                    <view class="part" style="color: #3a78ff;width: 100%;" @tap.stop="qrCodeDisplay(item)">
                        <uni-icons type="scan" style="color: #3a78ff;margin-right: 10rpx;" size="18"></uni-icons>显示二维码
                    </view>
                    <view class="part" style="color: #d98d00;width: 100%;" @tap.stop="revoke(item)">
                        <uni-icons type="undo" style="color: #d98d00;margin-right: 10rpx;" size="18"></uni-icons>撤销
                    </view>
                </view>
            </uni-card>
        <view class="pagination-zone" id="pagination-zone">
            <uni-pagination show-icon :page-size="size" :total="dataLength" :current="page"
                @change="onPaginationChangeHandler"></uni-pagination>
        </view>
        <view class="over" v-if="!listData || listData.length == 0">暂无数据</view>
        <view class="over" v-if="listData.length != 0 && listData.length != showList.length">加载中...</view>
        <view class="over" v-if="listData.length != 0 && listData.length == showList.length">已到底</view>
        <BarCodePopupVue ref="barcodePopup"></BarCodePopupVue>
    </view>
</template>
@@ -151,7 +145,8 @@
                serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
                tabs: 0,
                urls: '/Web/GetEquipmentBillsList',
                MvarReportTitle: '设备点检记录单缓存',
                MvarReportTitle: '设备点检记录单列表',
                showmore: false,
                hform: {
                    HBillNo: '',
                    HSourceBillNo: '',
@@ -160,69 +155,76 @@
                    HStockOrgID: uni.getStorageSync('OrganizationID'),
                    Type: "DJ",
                    sWhere: "",
                    HBeginDate: dayjs(new Date()).subtract(30, 'day').format("YYYY-MM-DD"),
                    HEndDate: dayjs(new Date()).format("YYYY-MM-DD"),
                },
                sWhere: '',
                listData: [],
                showList: [],
                showDetail: -1,
                operations: -1,
                page: 1,
                size: 50,
                dataLength: 0,
                divideBottom: 0,
                paginationTop: 0,
            }
        },
        onShow() {
            //用户模块权限判断
            this.CheckModRight()
            this.changeTab(0)
            console.log(this.userInfo, uni.getStorageSync('HUserName'))
        },
        components: {
            BarCodePopupVue
        },
        onReachBottom: function() {
            this.page++
            setTimeout(() => {
                this.showList = this.showList.concat(this.getPage(this.page, this.listData))
            }, 100)
        },
        onPullDownRefresh: function() {
            this.clear()
            setTimeout(() => {
                uni.stopPullDownRefresh();
            }, 1000);
        computed: {
            calcContentHeight: {
                get() {
                    return this.paginationTop - this.divideBottom
                }
            }
        },
        onReady() {
            this.getCalcHeight()
        },
        methods: {
            changeShowMore() {
                this.showmore = !this.showmore
                this.$nextTick(() => {
                    // 重新计算内容视口高度
                    this.getCalcHeight()
                })
            },
            getCalcHeight() {
                let query = uni.createSelectorQuery().in(this)
                query
                    .select("#divide")
                    .boundingClientRect()
                    .select("#pagination-zone")
                    .boundingClientRect()
                    .exec(res => {
                        this.divideBottom = Math.ceil(res[0].bottom)
                        this.paginationTop = Math.floor(res[1].top)
                    })
            },
            async qrCodeDisplay(item) {
                this.$refs.barcodePopup.setCodeInfo(item.HBillNo)
                await this.$nextTick()
                this.$refs.barcodePopup.open()
            },
            CheckModRight() {
                uni.request({
                    url: this.serverUrl + '/WEBSController/CheckModRight_Json',
                    data: {
                        ModRightName: 'CE_OtherOut',
                        HUserName: uni.getStorageSync('HUserName')
                    },
                    success: (res) => {
                        if (res.data.count == 1) {} else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                });
            onPaginationChangeHandler({
                current
            }) {
                this.page = current
                this.showList = this.getPage(current, this.size, this.listData)
            },
            getPage(page, list) {
                let sindex = (parseInt(page) - 1) * 20
                let eindex = parseInt(page) * 20
            getPage(page, size, list) {
                let sindex = (parseInt(page) - 1) * size
                let eindex = parseInt(page) * size
                let newList = list.slice(sindex, eindex)
                return newList
            },
@@ -234,12 +236,10 @@
                if (this.tabs == 0) {
                    this.urls = '/Web/GetEquipmentBillsList'
                }
                // if (this.tabs == 1) {
                //    this.urls = '/WEBSController/GetKf_ICStockBillQueryList_User_Json'
                // }
                this.getList()
                this.search()
            },
            async getList() {
                console.log('this.hform: ', this.hform);
                try {
                    let res = await CommonUtils.doRequest2Async({
                        url: this.urls,
@@ -253,8 +253,12 @@
                    } = res.data
                    if (count == 1) {
                        if(data == null) {
                           data = []
                        }
                        this.listData = data
                        this.showList = this.getPage(this.page, data)
                        this.showList = this.getPage(this.page, this.size, data)
                        this.dataLength = data.length
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
@@ -270,18 +274,19 @@
            },
            search() {
                this.sWhere = ''
                this.hform.sWhere = ''
                this.listData = []
                this.page = 1
                this.showList = []
                console.log(this.hform)
                // if (this.hform.HBillNo) {
                //     this.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
                // }
                // if (this.hform.HSourceBillNo) {
                //     this.sWhere += " and 设备类型 like '%" + this.hform.HSourceBillNo + "%'";
                // }
                if (this.hform.HBillNo) {
                    this.hform.sWhere += " and 单据号 like '%" + this.hform.HBillNo + "%'";
                }
                if (this.hform.HBeginDate && this.hform.HEndDate) {
                    this.hform.sWhere +=
                        ` and 日期 between convert(date, '${this.hform.HBeginDate}') and convert(date, '${this.hform.HEndDate}')`;
                }
                this.getList()
            },
            clear() {
@@ -293,51 +298,19 @@
                this.hform = {
                    HBillNo: '',
                    HSourceBillNo: '',
                    HBillType: 1206,
                    HBillType: 3903,
                    user: uni.getStorageSync('HUserName'),
                    HStockOrgID: uni.getStorageSync('OrganizationID'),
                    sWhere: '',
                    Type: "DJ"
                    Type: "DJ",
                    HBeginDate: dayjs(new Date()).subtract(30, 'd').format("YYYY-MM-DD"),
                    HEndDate: dayjs(new Date()).format("YYYY-MM-DD")
                }
                this.getList()
                this.search()
            },
            add() {
            creat() {
                uni.navigateTo({
                    url: '/pages/MJGL/Sb_EquipDotCheckBill/Sb_EquipDotCheckBill?operationType=1'
                })
            },
            //编辑
            edit(item) {
                console.log(item)
                uni.request({
                    url: this.serverUrl + '/WEBSController/TempList_Modify_Json',
                    data: {
                        "HInterID": item.HInterID,
                        "HBillNo": item.单据号,
                        "HBillType": this.hform.HBillType
                    },
                    success: (res) => {
                        console.log(1, res);
                        if (res.data.count == 1) {
                            uni.navigateTo({
                                url: './OtherOutBill?OperationType=2&HInterID=' + item.HInterID
                            })
                        } else {
                            uni.showToast({
                                title: res.data.Message,
                                icon: 'none'
                            })
                        }
                    },
                    fail: (res) => {
                        console.log(res);
                        uni.hideLoading()
                        uni.showToast({
                            title: '接口请求失败',
                            icon: 'none'
                        })
                    },
                })
            },
            //删除
@@ -380,51 +353,7 @@
                        }
                    }
                });
            },
            //撤销
            revoke(item) {
                // console.log(item.hmainid,uni.getStorageSync('HUserName'))
                uni.showModal({
                    title: '提示',
                    content: '是否确认撤销',
                    success: (res) => {
                        if (res.confirm) {
                            console.log('用户点击确定');
                            uni.request({
                                url: this.serverUrl +
                                    '/WEBSController/set_DeleteICStockBillAndWMS_Json',
                                data: {
                                    HInterID: item.HInterID,
                                    HBillNo: item.单据号,
                                    HBillType: this.hform.HBillType,
                                    HMaker: uni.getStorageSync('HUserName'),
                                    MvarReportTitle: this.MvarReportTitle,
                                },
                                success: (res) => {
                                    console.log(1, res);
                                    if (res.data.count == 1) {
                                        this.clear()
                                    }
                                    uni.showToast({
                                        title: res.data.Message,
                                        icon: 'none'
                                    })
                                },
                                fail: (res) => {
                                    console.log(res);
                                    uni.hideLoading()
                                    uni.showToast({
                                        title: '接口请求失败',
                                        icon: 'none'
                                    })
                                },
                            });
                        } else if (res.cancel) {
                            console.log('用户点击取消');
                        }
                    }
                });
            },
            }
        }
    }
</script>