张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
<template>
    <view class="scan_index">
        <view class="scan_header"></view>
        <view class="scan_content">
            <view class="scan_content_search">
                <u-row gutter="5">
                    <u-col span="6" @click="propStock()">
                        <u-input
                            v-model="value"
                            border="surround"
                            disabled
                            disabledColor="#FFFFFF"
                            placeholder="请选择入库堆场"
                        ></u-input>
                    </u-col>
                    <u-col span="6" @click="propCell()">
                        <u-input
                            v-model="cell"
                            border="surround"
                            disabled
                            disabledColor="#FFFFFF"
                            placeholder="请选择单元"
                        ></u-input>
                    </u-col>
                </u-row>
            </view>
            <view class="scan_content_cistern" :data="cultivatedInfo">
                <view class="cistern_header">
                    水养池位置:{{cultivatedInfo.waterCultivatedName}}
                </view>
                <view class="cistern_content">
                    <view class="item_content_info">
                        <text class="label">已水养时长:</text>
                        <text>目前没有</text>
                    </view>
                    <view class="item_content_info">
                        <text class="label">入池时间:</text>
                        <text>{{cultivatedInfo.createTime}}</text>
                    </view>
                    <view class="item_content_info">
                        <text class="label">入池操作人:</text>
                        <text>{{cultivatedInfo.createUser}}</text>
                    </view>
                    <view class="item_content_info">
                        <text class="label">预计完成水养时间:</text>
                        <text>{{cultivatedInfo.expectTime}}</text>
                    </view>
                </view>
            </view>
            <view class="scan_content_scroll">
                <view class="scroll_item scroll_item-title">
                    <text class="scroll_item_dot">环号</text>
                    <text class="scroll_item_dot">块号</text>
                    <text class="scroll_item_dot">管片编号</text>
                </view>
                <scroll-view scroll-y="true" class="scroll_view">
                    <view 
                        class="scroll_item"
                        v-for="(item, index) in pipeIntoList"
                        :key="index">
                        <text class="scroll_item_dot">{{item.ringNum}}</text>
                        <text class="scroll_item_dot">{{item.blockNum}}</text>
                        <text class="scroll_item_dot">{{item.pipeNum}}</text>
                    </view>
                </scroll-view>
            </view>
            <view class="scan_content_button">
                <u-button
                    type="primary" 
                    text="提交"
                    @click="propModal()">
                </u-button>
            </view>
        </view>
        <u-picker
            :show="showStock"
            :columns="stockData" 
            keyName="repoName"
            closeOnClickOverlay
            @cancel="showStock = false"
            @confirm="confirmStock"
            @close="showStock = false"
            ></u-picker>
        <u-picker
            :show="showCell"
            :columns="cellData" 
            keyName="unitName"
            closeOnClickOverlay
            @cancel="showCell = false"
            @confirm="confirmCell"
            @close="showCell = false"
            ></u-picker>
            <u-modal 
                :show="showModal" 
                content='是否确认入库信息'
                showCancelButton
                @cancel="showModal = false"
                @confirm="submitCisternInfo"
            ></u-modal>
    </view>
</template>
 
<script>
import { throttle } from '../../plugins/public';
    export default {
        data() {
            return {
                ringNum: '', // 环号
                value: '', // 入库堆场展示
                stockValue: '', // 入库堆场
                cell: '', // 单元展示
                cellValue: '' ,// 单元
                showStock: false, // 选择堆场
                stockData: [], // 堆场信息
                showCell: false, // 选择单元
                cellData: [], // 单元信息
                pipeIntoList: [], // 环信息
                showModal: false, // 模态框
                cultivatedInfo: {}, // 水养池信息
            } 
        },
        onLoad(option) {
            uni.$off('scancodedate');
            const data = JSON.parse(option.data);
            this.pipeIntoList = data.pipeIntoList;
            this.cultivatedInfo = data.cultivatedInfo;
            this.stockData.push(data.repoPullDown);
            this.ringNum = data.pipeIntoList[0].ringNum;
        },
        methods: {
            // 打开选择堆场
            propStock() {
                this.value = '';
                this.stockValue = '';
                this.cellData = [];
                this.showStock = true;
            },
            // 打开选择单元
            propCell() {
                this.cell = '';
                this.cellValue = '';
                this.showCell = true;
            },
            // 确认选择堆场信息
            confirmStock(data) {
                this.value = data.value[0].repoName;
                this.stockValue = data.value[0].repoId;
                this.$set(this.cellData, 0, data.value[0].repoUnitList);
                this.showStock = false;
            },
            // 确认选择单元信息
            confirmCell(data) {
                this.cell = data.value[0].unitName;
                this.cellValue = data.value[0].unitId;
                this.showCell = false;
            },
            propModal() {
                if(!this.stockValue) {
                    uni.$u.toast('请选择堆场');
                    return false;
                } else if(!this.cellValue) {
                    uni.$u.toast('请输入单元');
                    return false;
                } else {
                    this.showModal = true;
                }
            },
            // 确认提交入库信息
            submitCisternInfo: throttle(function() {
                this.$api.putbank.submitPipePutbankInfo({
                    repoId: this.stockValue,
                    unitId: this.cellValue,
                    ringNum: this.ringNum
                }).then((res) => {
                    if(res.success) {
                        uni.$u.toast('入库成功!');
                        uni.navigateBack();
                    } else {
                        uni.$u.toast(res.statusMsg);
                    }
                })
            }, 3000),
        }
    }
</script>
 
<style scoped lang="scss">
.scan_index {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #F6F6F6;
    
    .scan_header {
        height: 14%;
        background: #1976FF;
        border-radius: 0 0 30% 30%;
    }
    
    .scan_content {
        position: absolute;
        top: 4%;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 30px);
        height: 96%;
        
        .scan_content_search {
            padding: 15px 10px;
            margin-bottom: 10px;
            background: #FFFFFF;
            border-radius: 4px;
        }
        
        .scan_content_cistern {
            margin-bottom: 10px;
            background: #FFFFFF;
            border-radius: 4px;
            
            .cistern_header {
                position: relative;
                padding: 5px 20px;
                color: #1976FF;
                font-size: 18px;
                background: #DAE9FF;
                
                &::before {
                    content: '';
                    position: absolute;
                    top: 50%;
                    left: 10px;
                    transform: translateY(-50%);
                    width: 3px;
                    height: 45%;
                    background: #1976FF;
                    border-radius: 4px 4px 0 0;
                }
            }
            
            .cistern_content {
                padding: 15px 0 15px 10px;
                border-radius: 0 0 4px 4px;
                
                .item_content_info {
                    display: flex;
                    align-items: center;
                    padding: 2px 10px;
                    background: #EDF3FF;
                    
                    &:first-child {
                        padding-top: 10px;
                    }
                    
                    &:last-child {
                        padding-bottom: 10px;
                    }
                    
                    .label {
                        color: #AFB0B1;
                    }
                }
            }
        }
        
        .scan_content_scroll {
            height: 43.8%;
            
            .scroll_item {
                display: flex;
                justify-content: space-around;
                padding: 5px 10px;
                font-size: 14px;
                background: #FFFFFF;
                
                &:nth-child(odd) {
                    background: #EDF3FF;
                }
                
                .scroll_item_dot {
                    width: 25%;
                    text-align: center;
                    
                    &:last-child {
                        width: 50%;
                    }
                }
            }
            
            .scroll_item-title {
                color: #1976FF;
                font-size: 16px;
                background: #EDF3FF;
            }
            
            .scroll_view {
                height: 85%;
            }
        }
        
        .scan_content_button {
            padding-bottom: 8px;
        }
    }
}
</style>