#
whycq
2024-01-08 3cfc91d7824f4ee0f0bf61a52a82a56c6888c0c2
#
1个文件已修改
92 ■■■■■ 已修改文件
pages/mat/moduleMat.vue 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/mat/moduleMat.vue
@@ -1,10 +1,18 @@
<template>
    <view>
        <view class="card" v-for="item in data">
            <view class="card-title">
        <view class="back" @click="back()" v-show="backIds.length > 1">
            <uni-icons class="opt-icon" type="left" size="20" color="#b9b9b9"></uni-icons>
            <text>返回上一级</text>
            </view>
        <view class="card" v-for="item in data">
            <view class="card-left" @click="getPageList(item.tagId,true)">
                <view>名称:{{item.maktx}}</view>
                <view>编码:{{item.matnr}}</view>
                <view>规格:{{item.specs}}</view>
            </view>
            <view class="card-right">
                <uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
            </view>
        </view>
    </view>
</template>
@@ -13,23 +21,89 @@
    export default {
        data() {
            return {
                data: [
                    {id:1,uuid:3},
                    {id:2,uuid:4}
                ]
                data: [],
                uuid:1,
                backId:1,
                backIds: [],
            }
        },
        onShow() {
            this.baseUrl = uni.getStorageSync('baseUrl');
            this.token = uni.getStorageSync('token');
            this.getPageList('1',true)
        },
        methods: {
            getPageList(tagId,flag) {
                // console.log(tagId);
            
                // console.log(this.backIds);
                // console.log(this.backIds.length);
                let _this = this
                uni.request({
                    url: `${_this.baseUrl}/matV2/list/pda/page/auth`,
                    header: { 'token':uni.getStorageSync('token') },
                    data: {
                        curr: _this.curr,
                        limit: 20,
                        tagId: tagId
                    },
                    method:"GET",
                    success(res) {
                        res = res.data
                        if (res.data.records.length > 0) {
                            if (flag) {
                                _this.backIds.push(tagId)
                            }
                            _this.data = res.data.records
                            _this.backId = _this.uuid
                            _this.uuid = res.data.records[0].uuid
                        } else {
                            uni.showToast({title: '没有更多了!', icon: "none", position: 'top'})
                        }
                    }
                })
            },
            back() {
                let a = this.backIds.length - 2
                // console.log(this.backIds[a]);
                this.getPageList(this.backIds[a],false)
                this.backIds.pop()
                // console.log("back:"+this.backIds);
            }
        }
    }
</script>
<style>
    .back {
        height: 70rpx;
        display: flex;
        align-items: center;
        line-height: 2;
        background-color: #FFF;
    }
    .card {
        background-color: antiquewhite;
        background-color: #e3e3e3;
        margin: 16rpx;
        min-height: 50rpx;
        border-radius: 16rpx;
        display: flex;
        align-items: stretch;
    }
    .card-left {
        padding: 16rpx;
        flex: 1;
    }
    .card-right {
        width: 70rpx;
        border-left: 1px solid #FFF;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .opt-icon {
        padding: 8rpx;
    }
</style>