dengjunjie
5 天以前 4f39dcc195f28fa275fc2d065fbf1bf6a46c21b7
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<template>
    <!-- <u-card :title="title" > -->
    <view class="" slot="body">
        <!-- <view v-for="(item,index) in tree" :key="item.id"> -->
        <u-grid :col="2">
            <u-grid-item @tap="clickCoupon(item.url)" v-for="(item) in tree" :key="item.menuId">
                <u-icon :name="item.icon" custom-prefix="custom-icon" size="50" color="#888888"></u-icon>
                <view class="grid-text">{{item.menuName}}</view>
            </u-grid-item>
        </u-grid>
        <!-- </view> -->
        <u-toast ref="uToast" />
    </view>
 
    <!-- </u-card> -->
</template>
 
<script>
    import {
        config
    } from '../../common/config.js'
    export default {
        data() {
            return {
                // title: '操作功能'
                datas: [],
                tree: [],
                warehouseId: "",
                version: ""
            }
        },
        onShow() {
 
        },
        onLoad(res) {
            // var id = this.$mp.query.id;
            // this.warehouseId = this.$mp.query.warehouseId;
            this.warehouseId = res.warehouseId;
            uni.setNavigationBarTitle({
                title: res.menuName
            });
            this.getCurrentTree(res.menuId);
        },
        mounted() {
 
        },
        methods: {
            getCurrentTree(id) {
                this.$u.post('/api/Sys_Menu/GetTreeMenuPDAStash?ParentId=' + id, {}).then(result => {
                    this.tree = result;
                })
            },
            getTree(id, data, isRootId) {
                this.datas.forEach((x) => {
                    if (x.pid == id) {
                        x.lv = data.lv + 1;
                        if (isRootId) {
                            x.rootId = id;
                        }
                        if (!data.children) data.children = [];
                        data.children.push(x);
                        this.getTree(x.id, x, isRootId);
                    }
                });
            },
            getPermission(text) {
                // return true;
                return this.datas.find(x => x.text == text);
            },
            clickCoupon(url) {
                var _this = this;
                if (url == "出空托") {
                    uni.showModal({
                        title: '提示!',
                        content: '是否确定空托出库?',
                        success: function(res) {
                            if (res.confirm) {
                                _this.PdaOutEmpty()
                                //console.log('确认')
                            } else if (res.cancel) {
                                // console.log('取消')
                            }
                        }
                    })
                } else if (url == "入库放货完成") {
                    uni.showModal({
                        title: '提示!',
                        content: '是否确定放货完成?',
                        success: function(res) {
                            if (res.confirm) {
                                _this.ReleaseCompleted()
                                //console.log('确认')
                            } else if (res.cancel) {
                                // console.log('取消')
                            }
                        }
                    })
                }
                // console.log("clickCoupon")
                else if (this.hasLogin()) {
                    // this.$u.route(url)
                    this.$u.route({
                        url: url,
                        params: {
                            warehouseId: this.warehouseId
                        }
                    })
                } else {
                    this.$t.message.loading('登录失效请重新登录')
                    uni.reLaunch({
                        url: '/pages/login/login'
                    });
                }
            },
            PdaOutEmpty() {
                this.$u.post('/api/PDA/OutEmpty').then(
                    res => {
                        if (res.status) {
                            this.$refs.uToast.show({
                                title: "空托出库成功",
                                type: "success"
                            })
                            this.qty = "";
                        } else {
                            this.$refs.uToast.show({
                                title: res.message,
                                type: "error"
                            })
                        }
                    })
            },
            ReleaseCompleted() {
                this.$u.post('http://192.168.10.88:8099/api/AGV/ReleaseCompleted').then(
                    res => {
                        if (res.status) {
                            this.$refs.uToast.show({
                                title: "放货完成成功",
                                type: "success"
                            })
                            this.qty = "";
                        } else {
                            this.$refs.uToast.show({
                                title: res.message,
                                type: "error"
                            })
                        }
                    })
            },
            lock() {
                console.log("lock")
                if (this.hasLogin()) {
                    this.$u.route("pages/feeding/feeding")
                } else {
                    this.$t.message.loading('登录失效请重新登录')
                    uni.reLaunch({
                        url: '/pages/login/login'
                    });
                }
            },
 
            //判断是否登录
            hasLogin() {
                let haslogin = uni.getStorageSync('jo_user')
                if (haslogin == null || haslogin == "") {
                    return false
                } else {
                    return true
                }
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .grid-text {
        font-size: 28rpx;
        margin-top: 4rpx;
        color: $u-type-info;
    }
</style>