spring
4 天以前 435881d494e2be4ba5ce8bfccb02d6ef49e07314
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
<template>
    <view class="wrap">
        <scroll-view class="scroll-list workstation-feed-list" scroll-y="true">
            <u-cell-group class="list workstation-feed-list-cell" :border="false">
                            <view class="item u-border-bottom workstation-feed-view" :style="{backgroundColor: item.selected?backgroundColor.selectedColor:backgroundColor.unSelectedColor}" v-for="(item, index) in list" :key="item.id" @click="materialCardClick(item)"
                                >
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">零件号</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
                                                <span>{{item.partNo}}</span>
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">零件</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
                                                <span>{{item.partName}}</span>
 
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">IFS批次号</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
                                                <span>{{item.ifsBatchNo}}</span>
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">零件批号</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
                                                <span>{{item.partBatchNo}}</span>
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">规格型号</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
                                                <span>{{item.specs}}</span>
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">可用数量</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
                                
                                                <span>{{item.availableStockQuantity}}</span>
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">库存数量</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
 
                                                <span>{{item.stockQuantity}}</span>
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                                <view class="row-list">
                                    <u-row justify="space-between">
                                        <u-col span="4">
                                            <span class="span-lable">单位</span>
                                        </u-col>
                                        <u-col span="8">
                                            <view>
                                                <span>{{item.unit}}</span>
 
                                            </view>
                                        </u-col>
                                    </u-row>
                                </view>
                            </view>
            </u-cell-group>
        </scroll-view>
        <view class="view-fixed-two" style="width: 750rpx;text-align: center;">
            <u-button type="success" text="确定" size="medium" :customStyle="{borderRadius:'0rpx'}"
                @click="addFeed()">确定</u-button>
        </view>
    </view>
</template>
<script>
    export default {
        data() {
            return {
                queryParams: {
                    workstationId: null
                },
                list: [],
                backgroundColor:{
                    selectedColor:'#bbf59c',
                    unSelectedColor:'#ffffff'
                }
            };
        },
        onLoad(params) {
            if (params && params.workstationId !== "undefined") {
                this.queryParams.workstationId=params.workstationId
                this.loadList();
            }
        },
        onShow() {
          },
        methods: {
            materialCardClick(item) {
                item.selected = !item.selected
            },
            addFeed(){
                let selectedFeedList=[]
                this.list.forEach((item) => {
                    if(item.selected){
                        selectedFeedList.push(item)
                    }
                })
                this.refreshLastPage(selectedFeedList)
            },
            loadList() {
                let that=this
                that.$u.api.pigxFeed.getFeedingStock(that.queryParams).then(res => {
                    that.list = res.data
                    that.list.forEach((item) => {
                        that.$set(item, 'selected', false)
                    })
                });
            },
            //刷新上一个页面
            refreshLastPage(selectedFeedList) {
                // 告知 A.vue 更新数据
                // 获取页面栈
                let pages = getCurrentPages()
            
                // 获取上一页栈
                let prevPage = pages[pages.length - 2]
            
                // 触发上一页 upData 函数(并携带参数)
                prevPage.$vm.selectWorkstationFeed(selectedFeedList)
            
                // 返回上一页
                uni.navigateBack({
                    delta: 1
                })
            }
        }
    };
</script>
<style lang="scss">
    .custom-edit-input {
        border-bottom: 2rpx solid #F8F8F8;
    }
 
    .list .content {
        font-size: 12px;
        background-color: #efefef;
        box-sizing: border-box;
        border-radius: 14rpx;
        margin: 8px;
        padding: 5px 10px;
        box-shadow: none;
    }
    .workstation-feed-list{
        background-color: #F8F8F8;
    }
    .workstation-feed-list-cell {
        ::v-deep .u-cell-item-box {
            background-color: #F8F8F8;
        }
    }
    .workstation-feed-view{
        margin-left: 30rpx;
        margin-right: 30rpx;
        margin-top: 30rpx;
        border-radius: 20rpx;
        padding-left: 10rpx;
        padding-right: 10rpx;
        padding-bottom: 10rpx;
    }
</style>