#
whycq
2024-09-29 d8a5af48e83a64903c63624b994d3aa2b4992e7e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<template>
    <view>
        <view class="back" @click="back()" v-show="backIds.length > 1">
            <uni-icons class="opt-icon" type="left" size="20" color="#FFF"></uni-icons>
            <text style="color: #FFF;">返回上一级</text>
        </view>
        <view class="card" v-for="item in data">
            <view class="card-left" @click="getPageList(item.tagId,true)">
                <view>序号: {{item.tagId}}</view>
                <view>名称: {{item.maktx}}</view>
                <view>编码: {{item.matnr}}</view>
                <view>规格: {{item.specs}}</view>
            </view>
            <view class="card-right" @click="findBySelect(item.matnr)">
                <uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
            </view>
        </view>
        <!-- 弹窗选择 -->
        <uni-popup ref="inputDialog" type="dialog">
            <view class="pop">
                <view class="pop-btn" @click="select(1)">
                    当前物料
                </view>
                <view class="pop-btn" @click="select(2)">
                    当前节点所有物料
                </view>
                <view class="pop-btn" @click="select(3)">
                    子节点所有物料
                </view>
            </view>
        </uni-popup>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                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);
            },
            typeShow() {
                this.$refs.inputDialog.open()
            },
            findBySelect(matnr) {
                this.getOpenerEventChannel().emit('acceptDataFromOpenedPage', {data: matnr});
                uni.navigateBack({
                    
                })
                
            }
        }
    }
</script>
 
<style>
    .back {
        height: 100rpx;
        display: flex;
        align-items: center;
        line-height: 2;
        background-color: #55aaff;
    }
    .card {
        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;
    }
    .pop {
        min-height: 200rpx;
        width: 80vw;
        background-color: #55aaff;
        border-radius: 20rpx;
        color: #eee;
    }
    .pop-btn {
        height: 100rpx;
        line-height: 100rpx;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #ccc;
    }
    .pop-btn:last-child {
        border: none;
    }
</style>