loulijun2021
2023-12-08 ee4c68b99fa9ccd733ca547aeb16db90c7e2dd23
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
<template>
    <view>
        <page-nav title="存货档案"></page-nav>
 
 
        <view class="flex_center" style="margin: 20rpx;">
 
            <!-- #ifdef H5 -->
            <u--input prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" placeholder="请输入存货信息"
                style="width:100%;background-color: #fff;border-radius: 40rpx;" border="surround"
                v-model="inputBoxValue" @change="confirmInputBoxValue">
            </u--input>
            <!-- #endif -->
 
            <!-- #ifdef APP-PLUS -->
            <u-input prefixIcon="search" prefixIconStyle="font-size: 22px;color: #909399" placeholder="请输入存货信息"
                style="width:100%;background-color: #fff;border-radius: 40rpx;" border="surround"
                v-model="inputBoxValue" @change="confirmInputBoxValue">
            </u-input>
            <!-- #endif -->
 
 
        </view>
 
 
        <u-alert :title="alertTitle" type="info"></u-alert>
 
 
        <view style="max-height: 540px;overflow: auto;">
            <u-checkbox-group v-model="checkboxValue" iconPlacement="right" placement="column" @change="checkboxChange">
                <u-checkbox :key="item.code.trim()+'/'+item.name"
                    :label="item.code.trim()+'/'+item.name" :labelSize='16' :size='16'
                    :borderBottom='true' v-for="item in collapseArr" :name="item.code+'/'+item.name">
                </u-checkbox>
            </u-checkbox-group>
        </view>
 
        <u-button size="large" type="primary" @click="back" text="确认">
        </u-button>
 
 
    </view>
</template>
 
 
<script>
    import {
        InventoryTreePermissions
    } from '../../config/api.js';
    export default {
        onLoad(option) {
            App.watch(this.getTopRightMessageCountIsChange, 'topRightMessageCountIsChange')
 
            console.log(option, 66)
 
            this.checkboxValue = JSON.parse(option.param)
 
            console.log(this.checkboxValue)
        },
 
        onPullDownRefresh() {
            setTimeout(() => {
                this.init(() => {
                    uni.stopPullDownRefresh();
                })
            }, 1000);
        },
 
        data() {
            return {
                topRightMessageCount: '',
                inputBoxValue: '',
                alertTitle: '',
 
                collapseArr: [],
                checkboxValue: [],
 
            }
        },
        created() {
 
        },
        mounted() {
            this.init()
 
            this.getInventoryTreePermissions()
        },
        methods: {
            init() {
                uni.stopPullDownRefresh();
            },
        
            //输入框回车确认事件
            confirmInputBoxValue(val) {
                console.log('确认', val)
                this.getInventoryTreePermissions(val)
 
            },
 
            async getInventoryTreePermissions(param) {
 
                const {
                    data: res
                } = await InventoryTreePermissions(param === undefined ? '' : param)
                this.collapseArr = res
                this.alertTitle = '产品(共' + res.length + '个)'
            },
 
            checkboxChange(val) {
                console.log(val)
                this.checkboxValue = val
            },
 
            back() {
                let pages = getCurrentPages() // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
                let prevPage = pages[pages.length - 2] //上一页页面实例
                uni.navigateBack({
                    delta: 1, //返回层数,2则上上页
                    success: () => {
                        prevPage.$vm.getCheckboxValue(this.checkboxValue) //上一级的方法事件
                    }
                })
            },
 
 
 
        }
 
 
 
    }
</script>
 
<style lang="scss" scoped>
    @import url('@/style/global.css');
 
    ::v-deep .uicon-arrow-left>span {
        display: block;
    }
 
    ::v-deep .u-alert__text--info--light {
        margin-bottom: 0;
        font-size: 32rpx !important;
        padding-left: 10rpx;
        color: #212121 !important;
        font-weight: lighter;
    }
 
    ::v-deep .u-alert--info--light {
        background-color: rgba(255, 255, 255, 0.7);
    }
 
    ::v-deep .u-checkbox {
        height: 33px !important;
        padding: 5px 10px;
        border-bottom: 1px solid rgb(214, 215, 217);
    }
</style>