#
whycq
2023-10-13 16c451494bcbe8df764a7b59b87ee1466bc07f7e
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
<template>
    <view>
        <z-input v-for="it in zInputList" 
            :desc="it.desc" :btn="it.btn" :btn-name="it.btnName" v-model="it.val" 
            :lenCheck="it.lenCheck" :focus="it.focus" @clickBtn='entry(it.name)'>
        </z-input>
        <view>输入框1</view>
        <view>{{zInputList[0].val}}</view>
        
        <view>输入框2</view>
        <view>{{zInputList[1].val}}</view>
        
        <view>输入框2</view>
        <view>{{zInputList[2].val}}</view>
        
        <button @click="focus">focus</button>
        
        <hr>
        
        <z-data-list class="data-list" 
            v-for="(it,i) in zDataList" 
            :key="i"  
            :list="it.detl" 
            :index="i+1"
            @goDetail='goDetail(it.detl,i)' 
            
        ></z-data-list>
        
        
        <button @click="add">add</button>
        
        <hr>
        
        <!-- 垫高 -->
        <view style="height: 100rpx;"></view>
    </view>
</template>
 
<script>
    import addMat, { isEmpty } from '@/pages/api/addMat.js'
    export default {
        data() {
            return {
                zInputList: [ 
                    {name: 'ccc',desc: '订单号',btn: true,btnName: '阿斯顿',val: 'orderNo',focus: true},
                    {name: 'yyy',desc: '托盘码',val: '2',lenCheck: 8,focus: false},
                    {name: 'aaa',desc: '物料码',btn: true,btnName: '提取',placeholder: '',val: '1',focus: false}
                ],
                zDataList: [
                    {
                        detl: [
                            {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                            {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                            {key: '规格',value: '700*699*80'},
                            {key: '批号',value: '20231007204944',type: 'input'},
                            {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                            {key: '序号',value: 1},
                        ]
                    },
                    {
                        detl: [
                            {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                            {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                            {key: '规格',value: '700*699*80'},
                            {key: '批号',value: '20231007204944',type: 'input'},
                            {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                            {key: '序号',value: 2},
                        ]
                    },
                    {
                        detl: [
                            {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                            {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                            {key: '规格',value: '700*699*80'},
                            {key: '批号',value: '20231007204944',type: 'input'},
                            {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                            {key: '序号',value: 3},
                        ]
                    },
                    {
                        detl: [
                            {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                            {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                            {key: '规格',value: '700*699*80'},
                            {key: '批号',value: '20231007204944',type: 'input'},
                            {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                            {key: '序号',value: 4},
                        ]
                    },
                    {
                        detl: [
                            {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                            {key: '商品名称',value: '尼龙头(灰白)'},
                            {key: '规格',value: '700*699*80'},
                            {key: '批号',value: '20231007204944',type: 'input'},
                            {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                            {key: '序号',value: 5},
                        ]
                    }
                ],
            }
        },
        methods: {
            entry(e) {
            },
            ccc() {
            },
            async add() {
                let mat = await addMat.addMat()
                if (!addMat.isEmpty(mat)) {
                    this.zDataList.push(mat)
                }
            },
            focus() {
                if (this.zInputList[0].focus) {
                    this.zInputList[0].focus = false
                    this.zInputList[1].focus = true
                    this.zInputList[2].focus = false
                } else if (this.zInputList[1].focus){
                    this.zInputList[0].focus = false
                    this.zInputList[1].focus = false
                    this.zInputList[2].focus = true
                } else {
                    this.zInputList[0].focus = true
                    this.zInputList[1].focus = false
                    this.zInputList[2].focus = false
                }
                
            },
            goDetail(param,index) {
                let _this = this
                uni.navigateTo({
                    url: '/pages/common/data-list/dataDetail',
                    // 传
                    success: function(data) {
                        data.eventChannel.emit('param', {
                            param: param,
                            index: index
                        })
                    },
                    // 接
                    events: {
                        dataList: function(data) {
                            console.log(data);
                        },
                        del: function(data) {
                            _this.zDataList.splice(data.data,1)
                        }
                    },
                })
            }
        }
        
    }
</script>
 
<style>
    .data-list {
        
    }
    .data-list:last-child {
        margin-bottom: 100px;
    }
    hr {
        margin-top: 10px;
        margin-bottom: 10px;
    }
</style>