spring
10 天以前 f26f29d84e0a68831a6af14dab3eec5500496d2e
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
<template>
    <view class="wrap">
        <view>
            <scroll-view class="scroll-list duty-person-scroll" scroll-y="true">
                <u-cell-group class="list" :border="false">
                    <view>
                        <view class="row-list person-row" v-for="(item, index) in personList" :key="item.staffId"  >
                            <view style="width: 100%;padding-left: 20rpx;">
                            <u-row justify="space-between">
                                <u-col span="1">
                                    <u-checkbox 
                                                    v-model="item.checked" 
                                                    :name="item.staffName"
                                                ></u-checkbox>
                                </u-col>
                                <u-col span="11">
                                    <view @click="clickPerson(item)">
                                        <span>{{item.staffName}}</span>
                                    </view>
                                </u-col>
                            </u-row>
                            </view>
                        </view>
                    </view>
                </u-cell-group>
            </scroll-view>
        </view>
        <view class="person-btn-view">
            <u-button text="确定" type="success" size="medium" :customStyle="{width:'150rpx'}" @click="confirmPerson">
                确定</u-button>
        </view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                personList:[{staffId:1,staffName:'小明',checked:false},
                {staffId:2,staffName:'小达',checked:false},
                {staffId:3,staffName:'小管',checked:false},
                {staffId:4,staffName:'小宋',checked:false},
                {staffId:5,staffName:'小宋',checked:false},
                {staffId:6,staffName:'小宋',checked:false},
                {staffId:7,staffName:'小宋',checked:false},
                {staffId:8,staffName:'小宋',checked:false},
                {staffId:9,staffName:'小宋',checked:false},
                {staffId:10,staffName:'小宋',checked:false},
                {staffId:11,staffName:'小宋',checked:false},
                {staffId:12,staffName:'小宋',checked:false},
                {staffId:13,staffName:'小宋',checked:false},
                {staffId:14,staffName:'小宋',checked:false},
                {staffId:15,staffName:'小宋',checked:false},
                {staffId:16,staffName:'小宋',checked:false},
                {staffId:17,staffName:'小宋',checked:false},
                {staffId:18,staffName:'小达',checked:false}],
                originList: []
            };
        },
        onLoad(option) {
            if (option.item) {
                        let obj = JSON.parse(decodeURIComponent(option.item));
                        console.log(obj)
                        this.personList = obj
                        // this.getInfo(obj.id)
                    }
        },
        onShow() {
 
        },
        methods: {
            loadList() {
 
                // uni.showLoading({
                //             title: '正在请求...',
                //             mask: true
                //         });    
 
                // 查询工单列表
                /*this.$u.api.pigxWareHouse.fetchList().then(res => {
 
                    // uni.hideLoading();
                    this.originList = res.data
                    this.optaskList = this.originList
                })*/
            },
            //确认选中
            confirmPerson(){
                //筛选出 personList中checked==true的人
                this.refreshLastPage()
            },
            clickPerson(person){
                person.checked=!person.checked
            },
            //刷新上一个页面
            refreshLastPage() {
                // 告知 A.vue 更新数据
                // 获取页面栈
                let pages = getCurrentPages()
 
                // 获取上一页栈
                let prevPage = pages[pages.length - 2]
 
                // 触发上一页 upData 函数(并携带参数)
                prevPage.$vm.setProductPerson(this.personList)
 
                // 返回上一页
                uni.navigateBack({
                    delta: 1
                })
            },
        }
    };
</script>
<style lang="scss">
    .duty-person-scroll{
        background-color: #f8f8f8;
    }
    .duty-person-scroll{
        ::v-deep .u-cell-item-box{
            background-color: #f8f8f8;
        }
    }
    .person-row{
        height: 70rpx;
        display: flex;
        align-items: center;
    }
    .person-btn-view{
        display: flex;
        justify-content: space-between;
        margin-top: 20rpx;
    }
</style>