222
schangxiang@126.com
2025-09-03 667c3bc186be6c460cae63c20a60a48a2323dcc2
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
<template>
    <view class="page-containter page-containter-x">
        <view class="page-header">
            <page-header-x ctitle="缸体下线" />
            <user-row></user-row>
        </view>
        <view class="page-content">
            <view class="task">
                <!-- 站点 -->
                <view class="task_site">
                    <u-row gutter="16">
                        
                        <u-col span="4">
                            <u-button type="primary"  @click="intoEmpty">空托盘入库</u-button>
                        </u-col>
                        <u-col span="4">
                            <u-button type="primary"  @click="addEmptySalverStore">增加空托库存</u-button>
                        </u-col>
                        <!-- 新建组盘 -->
                        <u-col span="4">
                            <u-button type="success" @click="navTo">新建组盘</u-button>
                        </u-col>
                        <u-col span="4">
                            <u-button type="warning" @click="handReresh">刷新</u-button>
                        </u-col>
                        <u-col span="5">
                            <u-input placeholder="请选择站点" v-model="site" type="select" :border="true" @click="siteFlag = true"></u-input>
                            <u-action-sheet :list="siteList" v-model="siteFlag" @click="confirm"></u-action-sheet>
                        </u-col>
                        <!-- 呼叫空托盘 -->
                        <u-col span="3">
                            <u-button type="primary" :disabled="!this.site" @click="callEmpty">呼叫空托盘</u-button>
                        </u-col>
                    </u-row>
                </view>
                <text class="noData" v-show="taskList.length == 0">---没有数据---</text>
                <view class="task_item" v-for="(task,index) in taskList" :key="task.id">
                    <u-card :show-head="false" :show-foot="false" @click="navToEdit(task)">
                        <view class="sy-description-frame" slot="body">
                            <view class="sy-description">
                                <view class="description-label" style="width:74px;">组盘编号:</view>
                                <view class="description-content">{{task.orderCode}}</view>
                            </view>
                            <view class="sy-description">
                                <view class="description-label" style="width:74px;">产品编号:</view>
                                <view class="description-content">{{task.productCode}}</view>
                            </view>
                            <view class="sy-description">
                                <view class="description-label" style="width:74px;">供应商:</view>
                                <view class="description-content">{{task.supplier}}</view>
                            </view>
                            <view class="sy-description">
                                <view class="description-label" style="width:74px;">创建时间:</view>
                                <view class="description-content">{{task.createDate.replace(/T/g,' ')}}</view>
                            </view>
                            
                            <u-row>
                                <!-- 产品名称 -->
                                <u-col span="7">
                                    <view class="sy-description">
                                        <view class="description-label" style="width:73px;">产品名称:</view>
                                        <view class="description-content">{{task.productName}}</view>
                                    </view>
                                </u-col>
                                <!-- 数量 -->
                                <u-col span="5">
                                    <view class="sy-description">
                                        <view class="description-label" style="width:74px;">数量:</view>
                                        <view class="description-content">{{task.quantity}}</view>
                                    </view>
                                </u-col>
                            </u-row>
                            <u-row>
                                <u-col span="6">
                                    <view class="sy-description">
                                        <view class="description-label" style="width:74px;">起始位置:</view>
                                        <view class="description-content">{{task.siteCode}}</view>
                                    </view>
                                </u-col>
                                <u-col span="6">
                                    <view class="sy-description">
                                        <view class="description-label" style="width:74px;">目标位置:</view>
                                        <view class="description-content">{{task.toSiteCode}}</view>
                                    </view>
                                </u-col>
                            </u-row>
                            <u-row>
                                <!-- 托盘号-->
                                <u-col span="6">
                                    <view class="sy-description">
                                        <view class="description-label" style="width:74px;">托盘号:</view>
                                        <view class="description-content">{{task.containerCode}}</view>
                                    </view>
                                </u-col>
                            </u-row>
                            <!-- 状态、操作 -->
                            <u-row>
                                <!-- 任务状态 -->
                                <u-col span="6">
                                    <u-row>
                                        <u-col span="6">状态:</u-col>
                                        <u-col span="6">
                                            <u-tag :text="getBtnTitle(task.status)" :type="getTagType(task.status)"   mode="light"/>
                                        </u-col>
                                    </u-row>
                                </u-col>
                                <!-- 操作 -->
                                <u-col span="6">
                                    <u-row>
                                        <u-col span="6">操作:</u-col>
                                        <u-col span="6">
                                            <u-button :type="task.status == '1' ? 'primary': ''" :disabled="task.status != '1'"
                                             @click="sendTask(index)" class="sendBtn">下发任务</u-button>
                                        </u-col>
                                    </u-row>
                                </u-col>
                            </u-row>    
                        </view>
                    </u-card>
                </view>
                <text class="reachBottom" v-show="taskList.length != 0 && taskList.length == total">---我也是有底线的---</text>
                <u-modal v-model="show" :content="content" :show-cancel-button="true" @confirm="send()"></u-modal>
            </view>
        </view>
        
    </view>
    
    
</template>
 
<script>
    import {getTaskList,callEmpty,changeOrderStatus} from '../../api/cylinder/cylinder.js'
    import PageHeaderX from '../../compontents/PageHeaderX.vue'
    import UserRow from '../../compontents/UserRow.vue'
    import $config from '../../util/config.js'
    export default {
        components:{"page-header-x":PageHeaderX,UserRow},
        data() {
            return {
                site:'', //当前站点
                siteFlag:false,//站点选择框
                siteList:$config.sites.offlineBody,
                show:false, //是否发送任务
                content:'是否推送任务?',
                count:0,//当前发送的任务的索引
                total:0, //缸体下线列表的所有数据条数
                taskForm:{ //获取缸体下线列表请求参数
                    pagesize: 100,
                    pagenum: 1,
                    id: 1,
                },
                taskList:[],//缸体下线列表数据
            }
        },
        //页面加载事件
        onReady() {
            //this.getTaskList();
        },
        //页面加载
        onShow(){
            this.getTaskList();
        },
        //下来刷新
        onPullDownRefresh() {
            this.taskList = [];
            this.taskForm.pagenum = 1;
            this.getTaskList(()=>{
                uni.stopPullDownRefresh();
            })
        },
        //下拉触底事件
        onReachBottom() {
            this.taskForm.pagenum ++;
            //如果数据条数等的总的数据条数不在请求接口
            if(this.taskList.length == this.total) {
                return;
            }else {
                this.getTaskList((f)=>{
                    if (!f) this.taskForm.pagenum --;
                });
            }
        },
        methods: {
            //手动刷新
            handReresh(){
                this.taskList = [];
                this.taskForm.pagenum = 1;
                this.getTaskList(()=>{
                                
                })
            },
            //获取缸体下线列表
            getTaskList(callback){
                getTaskList(this.taskForm).then(res => {
                    this.total = res.total;
                    this.taskList.push(...res.data);
                    callback && callback(true);
                }).catch(()=>{
                    callback && callback(false);
                })
            },
            //呼叫空托盘
            callEmpty(){
                callEmpty(this.site).then(res => {
                    uni.showToast({
                        title:'呼叫成功',
                        icon:'success'
                    })
                }).catch(()=>{})
            },
            //获取任务tag的颜色
            getTagType(status){
                switch(status) {
                    case 2:
                      return 'warning';
                      break;
                    case 4:
                      return 'success';
                      break;
                    default:
                        return 'primary';
                        break;
                }
            },
            //获取任务的状态
            getBtnTitle(status) {
                let res = '状态未定义';
                if ($config.offLineStatus[status]){
                    res = $config.offLineStatus[status];
                }
                return res;
            },
            //推送任务
            sendTask(index){
                this.show = true;
                this.count = index;
            },
            //发送任务
            send(){
                changeOrderStatus(this.taskList[this.count].orderCode).then(res => {
                    uni.showToast({
                        title:'下发任务成功',
                        icon: 'success'
                    });
                    this.taskList[this.count].status = 2,
                    this.count = 0;
                }).catch(()=>{})
            },
            //站点选择框确定
            confirm(index) {
                this.site = this.siteList[index].text;
            },
            //入空托盘
            intoEmpty(){
                uni.navigateTo({
                    url:`../addSite/addEmptySalver?type=body`
                })
            },
            addEmptySalverStore(){
                uni.navigateTo({
                    url:`../addSite/addEmptySalverStore?type=body`
                })
            },
            //跳转到新建组盘页面 type组盘类型 1缸体组盘,2缸盖组盘
            navTo(type){
                uni.navigateTo({
                    url:`../addSite/addSite?type=body`
                })
            },
            //跳转到编辑组盘页面
            navToEdit(task){
                if(task.status==1){//1表示新建
                    uni.navigateTo({
                        url:`../addSite/addSite?type=body&addEditFlag=edit&orderCodeId=`+task.orderCodeId
                    })
                }
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .task_site {
        width: 94%;
        margin: 15rpx auto;
        .u-col {
            text-align: right !important;
            font-size: 32rpx;
        }
    }
    .task_item {
        .u-col {
            padding:0 !important;
        }
    }
    .reachBottom,.noData {
        width: 100%;
        color: #999;
        display: flex;
        justify-content: center;
        letter-spacing: 5rpx;
        margin: 20rpx auto;
    }
</style>