chenhaozhe
2026-01-08 0407d386bea756ac23597c6c4174f50dc90527a9
pages/MJGL/Sb_EquipMaintainBill/Sb_EquipMaintainBillList.vue
@@ -1,135 +1,128 @@
<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="add">新增</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 id="divide" style="width: 100%;height: 16rpx;background-color: #e5e5e5;"></view>
        <view :style="{
            height: calcContentHeight + 'px',
            overflowY: 'auto'
        }">
            <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="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 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="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>
@@ -160,13 +153,28 @@
                    HStockOrgID: uni.getStorageSync('OrganizationID'),
                    Type: "BY",
                    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: 20,
                dataLength: 0,
                divideBottom: 0,
                paginationTop: 0,
                showmore: false,
            }
        },
        computed: {
            calcContentHeight: {
                get() {
                    return this.paginationTop - this.divideBottom
                }
            }
        },
        onShow() {
@@ -178,19 +186,35 @@
        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);
        },
        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()
@@ -220,9 +244,15 @@
                    },
                });
            },
            getPage(page, list) {
                let sindex = (parseInt(page) - 1) * 20
                let eindex = parseInt(page) * 20
            onPaginationChangeHandler({
                current
            }) {
                this.page = current
                this.showList = this.getPage(current, this.size, this.listData)
            },
            getPage(page, size, list) {
                let sindex = (parseInt(page) - 1) * size
                let eindex = parseInt(page) * size
                let newList = list.slice(sindex, eindex)
                return newList
            },
@@ -237,7 +267,7 @@
                // if (this.tabs == 1) {
                //    this.urls = '/WEBSController/GetKf_ICStockBillQueryList_User_Json'
                // }
                this.getList()
                this.search()
            },
            async getList() {
                try {
@@ -253,8 +283,13 @@
                    } = 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)
                        console.log('this.showList: ', this.showList);
                        this.dataLength = data.length
                    } else {
                        CommonUtils.showTips({
                            title: "温馨提示",
@@ -270,18 +305,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() {
@@ -297,9 +333,11 @@
                    user: uni.getStorageSync('HUserName'),
                    HStockOrgID: uni.getStorageSync('OrganizationID'),
                    sWhere: '',
                    Type: "BY"
                    Type: "BY",
                    HBeginDate: dayjs(new Date()).subtract(30, 'day').format("YYYY-MM-DD"),
                    HEndDate: dayjs(new Date()).format("YYYY-MM-DD"),
                }
                this.getList()
                this.search()
            },
            add() {
                uni.navigateTo({