小小儁爺
2025-12-30 2b1c5e5c3cfe5ef193364490c293fdf0c7605757
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
<template>
    <view>
        <view class="uni-container">
 
            <view class="headTitle">浙江优步体育用品股份有限公司工序SOP</view>
 
 
            <uni-forms ref="form" :modelValue="form" class="headForm">
                <uni-forms-item label="车间名称" label-width='100' class="headFormItem">
                    <uni-data-select v-model="form.wkshopcode" @clear='search' :localdata="wkshopcodeArr"
                        @change="val=>search(val,'wkshopcode')"></uni-data-select>
                    <!--     <uni-easyinput type="text" v-model="form.wkshopcode" placeholder="请输入" @change='search'
                        @clear="search" /> -->
                </uni-forms-item>
                <uni-forms-item label="工单编号" label-width='100' class="headFormItem">
                    <uni-easyinput v-model="form.mesordercode" type="text" placeholder="请输入" @change='search'
                        @clear="search" />
                </uni-forms-item>
                <uni-forms-item label="源单单号" label-width='100' class="headFormItem">
                    <uni-easyinput v-model="form.sourceorder" type="text" placeholder="请输入" @change='search'
                        @clear="search" />
                </uni-forms-item>
                <uni-forms-item label="销售订单" label-width='100' class="headFormItem">
                    <uni-easyinput v-model="form.saleordercode" type="text" placeholder="请输入" @change='search'
                        @clear="search" />
                </uni-forms-item>
                <uni-forms-item label="产品编码" label-width='100' class="headFormItem">
                    <uni-easyinput v-model="form.partcode" type="text" placeholder="请输入" @change='search'
                        @clear="search" />
                </uni-forms-item>
                <uni-forms-item label="产品名称" label-width='100' class="headFormItem">
                    <uni-easyinput v-model="form.partname" type="text" placeholder="请输入" @change='search'
                        @clear="search" />
                </uni-forms-item>
            </uni-forms>
 
            <uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据" style="height: 52vh;">
                <!-- @selection-change="selectionChange"  type="selection" -->
                <uni-tr>
                    <uni-th width="80" align="center">序号</uni-th>
                    <uni-th width="150" align="center">生产车间</uni-th>
                    <uni-th width="150" align="center">工单编号</uni-th>
                    <uni-th width="150" align="center">源单编号</uni-th>
                    <uni-th width="150" align="center">销售订单</uni-th>
                    <uni-th width="150" align="center">产品编码</uni-th>
                    <uni-th width="150" align="center">产品名称</uni-th>
                    <uni-th width="150" align="center">产品规格</uni-th>
                    <uni-th width="150" align="center">工艺路线</uni-th>
                    <uni-th width="150" align="center">工单数</uni-th>
                    <uni-th width="204" align="center">操作</uni-th>
                </uni-tr>
                <uni-tr v-for="(item, index) in tableData" :key="index">
                    <uni-td>{{ item.rowNum }}</uni-td>
                    <uni-td>
                        <!-- <view class="name">{{ item.wkshp_name }}</view> -->
                        {{ item.wkshp_name?item.wkshp_name:'/' }}
                    </uni-td>
                    <uni-td align="center">{{ item.wo_code? item.wo_code:'/' }}</uni-td>
                    <uni-td align="center">{{ item.m_po?item.m_po:'/' }}</uni-td>
                    <uni-td align="center">{{ item.saleOrderCode?item.saleOrderCode:'/' }}</uni-td>
                    <uni-td align="center">{{ item.partcode?item.partcode:'/' }}</uni-td>
                    <uni-td align="center">{{ item.partname? item.partname:'/' }}</uni-td>
                    <uni-td align="center">{{ item.partspec ? item.partspec:'/'}}</uni-td>
                    <uni-td align="center">{{ item.route_name? item.route_name:'/' }}</uni-td>
                    <uni-td align="center">{{ item.plan_qty? item.plan_qty:'/' }}</uni-td>
 
                    <uni-td>
                        <view class="uni-group">
                            <button class="uni-button" size="mini" type="primary" @click="trClick(item)">选择工单</button>
                            <!-- <button class="uni-button" size="mini" type="warn">删除</button> -->
                        </view>
                    </uni-td>
                </uni-tr>
            </uni-table>
 
            <view class="uni-pagination-box"><uni-pagination show-icon :page-size="form.rows" :current="form.page"
                    :total="total" @change="change" /></view>
 
 
 
            <uni-table ref="table2" :loading="loading2" border stripe emptyText="请先选择工单" style="height: 28vh;">
                <!-- @selection-change="selectionChange"  type="selection" -->
                <uni-tr>
                    <uni-th width="80" align="center">序号</uni-th>
 
                    <uni-th width="150" align="center">工序编码</uni-th>
                    <uni-th width="150" align="center">工序名称</uni-th>
                    <uni-th width="150" align="center">已生产数量</uni-th>
                    <uni-th width="150" align="center">合格数量</uni-th>
                    <uni-th width="150" align="center">不良数量</uni-th>
                    <uni-th width="150" align="center">工废数量</uni-th>
                    <uni-th width="150" align="center">料废数量</uni-th>
                    <uni-th width="150" align="center">总可报数量</uni-th>
                    <uni-th width="150" align="center">待产数量</uni-th>
                    <uni-th width="204" align="center">sop预览</uni-th>
                </uni-tr>
                <uni-tr v-for="(item, index) in sopTableData" :key="index">
                    <uni-td>{{ item.seq }}</uni-td>
 
                    <uni-td> {{ item.step_code}} </uni-td>
                    <uni-td align="center">{{ item.stepname }}</uni-td>
                    <uni-td align="center">{{ item.produceq_qty }}</uni-td>
                    <uni-td align="center">{{ item.good_qty}}</uni-td>
                    <uni-td align="center">{{ item.ng_qty }}</uni-td>
                    <uni-td align="center">{{ item.laborbad_qty }}</uni-td>
                    <uni-td align="center">{{ item.materielbad_qty }}</uni-td>
                    <uni-td align="center">{{ item.plan_qty }}</uni-td>
                    <uni-td align="center">{{ item.delive_qty }}</uni-td>
 
                    <uni-td>
                        <view class="uni-group">
                            <button class="uni-button" size="mini" type="primary" @click="sopClick(item)">工序预览</button>
                            <!-- <button class="uni-button" size="mini" type="warn">删除</button> -->
                        </view>
                    </uni-td>
                </uni-tr>
            </uni-table>
 
        </view>
    </view>
</template>
 
<script>
    import {
        SopSearchMesOrderSearch,
        SopSearchUpdateMesOrderStepSearch,
        SopSearchMesOrderProcessSopSearch,
        PrentOrganizationNoCompany
    } from '../../config/api.js';
 
    export default {
        data() {
            return {
                tableData: [],
                // 数据总量
                total: 0,
                loading: false,
                loading2: false,
                form: {
                    wkshopcode: '', // 车间编码
                    mesorderstus: '', // 工单状态码
                    mesordercode: '', // 工单编号
                    partcode: '', // 产品编码
                    ordertype: '', // ordertype
                    sourceorder: '', // 源单单号
                    saleordercode: '', // 销售订单
                    partname: '', // 产品名称
                    partspec: '', // 产品规格
                    creatuser: '', // 创建人员
                    datatype: 'ED', // 日期类型(计划开工(PS)、计划完工(PE)、预计交付(ED)、创建日期(CT))
                    timeValue: [], // 查询日期
                    prop: 'lm_date', // 排序字段
                    order: 'desc', // 排序字段
                    page: 1, // 第几页
                    rows: 15 // 每页多少条
                },
                sopTableData: [],
                wkshopcodeArr: [],
                rowData: {} // 行点击事件存储值
 
            }
        },
        onLoad() {
            // this.selectedIndexs = []
            this.getData(1)
        },
        mounted() {
            this.getPrentOrganizationNoCompany()
        },
        methods: {
            async getPrentOrganizationNoCompany() {
                const res = await PrentOrganizationNoCompany()
                this.wkshopcodeArr = res.data.map(({
                    torg_name,
                    torg_code
                }) => ({
                    text: torg_name,
                    value: torg_code
                }))
            },
 
            // // 多选处理
            // selectedItems() {
            //     return this.selectedIndexs.map(i => this.tableData[i])
            // },
            // // 多选
            // selectionChange(e) {
            //     console.log(e.detail.index)
            //     this.selectedIndexs = e.detail.index
            // },
            // //批量删除
            // delTable() {
            //     console.log(this.selectedItems())
            // },
 
            // 选择工单
            trClick(row) {
                this.rowData = row
                const data = {
                    sourceid: row.sourceid,
                    sourcewo: row.m_po,
                    wocode: row.wo_code,
                    data_sources: row.data_sources
                }
                this.loading2 = true
                SopSearchUpdateMesOrderStepSearch(data).then(res => {
                    this.sopTableData = res.data.stepdata
                    this.loading2 = false
                })
            },
            // 工序预览
            async sopClick(row) {
 
                const data = {
                    materielcode: this.rowData.partcode,
                    routecode: this.rowData.route_code,
                    stepcode: row.step_code
                }
 
                const {
                    data: res
                } = await SopSearchMesOrderProcessSopSearch(data)
                // console.log(res)
 
                if (res.length === 0) {
                    return uni.$u.toast('此工序未上传sop,请先上传!')
                } else {
                    // 跳转到sop页面,且传入sop信息和工单信息
                    const rowData = {
                        wo_code: this.rowData.wo_code,
                        partname: this.rowData.partname
                    }
                    uni.navigateTo({
                        url: './sop?sopArr=' + JSON.stringify(res) + '&mesOrderObj=' + JSON.stringify(rowData)
                    });
                }
 
 
 
 
 
            },
            // 分页触发
            change(e) {
                // this.$refs.table.clearSelection()
                // this.selectedIndexs.length = 0
                this.getData(e.current)
            },
            // 搜索
            search(val, type) {
                if (type === 'wkshopcode') {
                    this.form.wkshopcode = val
                }
                this.getData(1)
            },
            // 获取数据
            getData(pageCurrent) {
                this.loading = true
                this.form.page = pageCurrent
 
                const data = {
                    wkshopcode: this.form.wkshopcode,
                    mesorderstus: this.form.mesorderstus, // 工单状态码
                    mesordercode: this.form.mesordercode, // 工单编号
                    partcode: this.form.partcode, // 产品编码
                    partname: this.form.partname, // 产品名称
                    partspec: this.form.partspec, // 产品规格
                    creatuser: this.form.creatuser, // 创建人员
                    sourceorder: this.form.sourceorder, // 源单单号
                    saleordercode: this.form.saleordercode, // 销售订单
                    ordertype: this.form.ordertype, // 单据类型
                    datatype: this.form.datatype,
                    searchdate: this.form.timeValue.join('~'),
                    // createdate: this.form.createdate.toString().length > 0 ? handleDatetime(this.form.createdate) : '', // 创建时间
                    prop: this.form.prop, // 排序字段
                    order: this.form.order, // 排序字段
                    page: this.form.page, // 第几页
                    rows: this.form.rows // 每页多少条
                }
 
                SopSearchMesOrderSearch(data).then(res => {
                    console.log(res)
                    this.tableData = res.data
                    this.total = res.count
                    this.loading = false
 
                })
                // this.request({
                //     pageSize: this.pageSize,
                //     pageCurrent: pageCurrent,
                //     value: value,
                //     success: res => {
                //         // console.log('data', res);
                //         this.tableData = res.data
                //         this.total = res.total
                //         this.loading = false
                //     }
                // })
 
 
 
 
 
            },
            // 伪request请求
            request(options) {
                const {
                    pageSize,
                    pageCurrent,
                    success,
                    value
                } = options
                let total = tableData.length
                let data = tableData.filter((item, index) => {
                    const idx = index - (pageCurrent - 1) * pageSize
                    return idx < pageSize && idx >= 0
                })
                if (value) {
                    data = []
                    tableData.forEach(item => {
                        if (item.name.indexOf(value) !== -1) {
                            data.push(item)
                        }
                    })
                    total = data.length
                }
 
                setTimeout(() => {
                    typeof success === 'function' &&
                        success({
                            data: data,
                            total: total
                        })
                }, 500)
            }
        }
    }
</script>
 
 
<style scoped>
    /* #ifndef H5 */
    /* page {
    padding-top: 85px;
} */
    /* #endif */
 
    .uni-container {
        /*     background-color: #e8e8e8; */
    }
 
    .uni-group {
        display: flex;
        align-items: center;
    }
 
    ::v-deep .uni-table-mask {
        background-color: transparent !important;
    }
 
    .headTitle {
        height: 6vh;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 40rpx;
        font-weight: bolder;
        font-family: Arial;
    }
 
    .headForm {
        height: 6vh;
        /* border-bottom: 2rpx solid #000; */
 
        span {
            display: flex;
            justify-content: space-evenly;
            align-items: center;
        }
 
        .headFormItem {
            width: 500rpx;
        }
    }
 
    .uni-pagination-box {
        height: 4vh;
        margin: 1vh 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: #fff;
    }
</style>