快乐的昕的电脑
2025-11-24 07789424c8c1c6fff7335c2d41e83b9b7dbddf5f
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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
<template>
    <view class="page">
        <!-- 刷新按钮 -->
        <button @click="handleRefresh" class="refresh-btn">刷新</button>
        <view>
            <h4>说明:</br>开工时间=首件合格后取送检时间,</br>完工时间=报工数等于工单数的时间</h4>
        </view>
        <!-- 上半部分 -->
        <!-- 开工完工 -->
 
        <view class="top-section">
            <!-- 左边工单按钮组和输入框,左右布局 -->
            <view class="left-section">
                <view class="item">
                    <button class="btn-disabled">开工</button>
                    <input class="input-box" v-model="startTime" disabled="true" placeholder="开工时间=首件合格后取送检时间" />
                </view>
                <view class="item">
                    <button class="btn-disabled">完工</button>
                    <input class="input-box" v-model="endTime" disabled="true" placeholder="报工数达到计划数后自动完工" />
                </view>
                <view class="item">
                    <button @click="stateCheck(2)" class="btn-blue">暂停</button>
                    <input class="input-box" v-model="suspendTime" disabled="true" placeholder="点暂停按钮时写入" />
                </view>
                <!--<view class="item">
                    <button @click="stateCheck(2)" class="btn-blue">反暂停</button>
                    <input class="input-box" v-model="suspendTime" disabled="true" placeholder="点暂停按钮时写入" />
                </view>-->
                <!-- <view class="item">
        <button @click="stateCheck(3)" class="btn-blue">反完工</button>
        <input class="input-box" v-model="reverseTime" disabled="true" placeholder="点反完工按钮写入" />
    </view> -->
            </view>
 
            <!-- 右边工单状态 -->
            <view class="right-section">
                <text class="status-title">工单号</text>
                <text class="status-title"><input class="status-title" type="text" v-model="orderNo" disabled="true" /></text>
                <text class="status-title">工单状态</text>
                <view class="status-circle">
                    <input class="status-input" v-model="workOrderStatus" disabled="true" />
                </view>
            </view>
        </view>
 
        <!-- 下半部分保存取消按钮 -->
        <view class="bottom-section">
            <button class="save-btn" @click="sumbit">提交</button>
            <button class="cancel-btn" @click="clean">取消</button>
        </view>
    </view>
</template>
 
<script>
    export default {
        props: {
            orderNo: String,
            orderId: Number,
            machineNo: String
        },
        data() {
            return {
                workOrderStatus: "",
                startTime: "",
                endTime: "",
                suspendTime: "",
                reverseTime: "",
                statusForm: {},
                flag: -1
            };
        },
        created() {
 
            // let machine = uni.getStorageSync('machine');
            // let orderId = uni.getStorageSync('orderId');
            // let orderNo = uni.getStorageSync('orderNo');
 
            // if (orderId) {
            //     this.orderId = orderId;
            // } else {
            //     if (!this.orderId) {
            //         this.orderId = uni.getStorageSync('id');
            //     }
 
            // }
 
            // if (orderNo) {
            //     this.orderNo = orderNo;
            // } else {
            //     if (!this.orderNo) {
            //         this.orderNo = uni.getStorageSync('daa001');
            //     }
            // }
 
            // if (machine) {
            //     this.machineNo = machine;
            // } else {
            //     if (!this.machineNo) {
            //         this.machineNo = uni.getStorageSync('machineNo');
            //     }
            // }
 
 
            if (!this.orderId && !this.orderNo) {
                return;
            }
 
            this.init();
        },
        methods: {
            // 刷新方法
            handleRefresh() {
                this.init(); // 刷新数据
            },
            sumbit() {
                this.$post({
                    url: "/MesOrderSta/UpdateTime",
                    data: {
                        startTime: this.startTime,
                        endTime: this.endTime,
                        suspendTime: this.suspendTime,
                        reverseTime: this.reverseTime,
                        id: this.statusForm.id,
                        orderId: this.orderId,
                        machineNo: this.machineNo,
                        flag: this.flag
                    }
                }).then(res => {
                    if (res.data.tbBillList) {
                        this.init();
                        this.$showMessage("保存成功");
                    } else {
                        this.clean();
                        this.$showMessage("保存失败");
                    }
                })
            },
            clean() {
                this.startTime = this.statusForm.startTime;
                this.endTime = this.statusForm.endTime;
                this.suspendTime = this.statusForm.suspendTime;
                this.reverseTime = this.statusForm.reverseTime;
            },
            init() {
                this.$post({
                    url: "/MesOrderSta/init",
                    data: {
                        orderId: this.orderId,
                        orderNo: this.orderNo,
                        machineNo: this.machineNo
                    }
                }).then(res => {
                    this.findByOrderId();
                })
            },
            findByOrderId() {
                this.$post({
                    url: "/MesOrderSta/FindByOrderNo",
                    data: {
                        orderId: this.orderId,
                        orderNo: this.orderNo
                    }
                }).then(res => {
                    this.statusForm = res.data.tbBillList;
                    this.startTime = res.data.tbBillList.startTime;
                    this.endTime = res.data.tbBillList.endTime;
                    this.suspendTime = res.data.tbBillList.suspendTime;
                    this.reverseTime = res.data.tbBillList.reverseTime;
                    this.workOrderStatus = res.data.tbBillList.orderStatus;
                })
            },
            stateCheck(item) {
                this.$post({
                    url: "/MesOrderSta/StateCheck",
                    data: {
                        orderId: this.orderId,
                        flag: item
                    }
                }).then(res => {
                    if (res.data.tbBillList) {
                        this.flag = item;
                        switch (item) {
                            case 0:
                                this.startTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
                                this.endTime = this.statusForm.endTime;
                                this.suspendTime = this.statusForm.suspendTime;
                                this.reverseTime = this.statusForm.reverseTime;
                                break;
                            case 1:
                                this.startTime = this.statusForm.startTime;
                                this.endTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
                                this.suspendTime = this.statusForm.suspendTime;
                                this.reverseTime = this.statusForm.reverseTime;
                                break;
                            case 2:
                                this.startTime = this.statusForm.startTime;
                                this.endTime = this.statusForm.endTime;
                                this.suspendTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
                                this.reverseTime = this.statusForm.reverseTime;
                                break;
                            case 3:
                                this.startTime = this.statusForm.startTime;
                                this.endTime = this.statusForm.endTime;
                                this.suspendTime = this.statusForm.suspendTime;
                                this.reverseTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
                                break;
                        }
                    } else {
                        this.$showMessage(res.message);
                    }
                })
            }
        }
    };
</script>
 
<style scoped>
    .page {
        padding: 2vh;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }
 
    /* 刷新按钮样式 */
    .refresh-btn {
        position: absolute;
        top: 10px;
        right: 10px;
        background-color: #00A2E9;
        /* 蓝色背景 */
        color: white;
        height: 60px;
        border: none;
        border-radius: 5px;
        font-size: 35px;
        cursor: pointer;
        width: 90px !important; /* 更窄 */
        height: 60px !important; /* 更高 */
        font-size: 22px !important;
        padding: 0 !important;
        border-radius: 8px !important;
    }
 
    /* 上半部分:左右布局 */
    .top-section {
        display: flex;
        justify-content: space-between;
        flex-grow: 1;
        margin-bottom: 4vh;
    }
 
    /* 左边按钮和输入框部分(左右布局) */
    .left-section {
        width: 65%;
        display: flex;
        flex-direction: column;
    }
 
    .item {
        display: flex;
        align-items: center;
        margin-bottom: 3vh; /* 原1.5vh,改为3vh,按钮间距更大 */
    }
 
    /* 统一按钮和输入框的高度 */
    button,
    .input-box {
        width: 55% !important; /* 原70%,改为50%,更窄 */
        height: 4vh !important; /* 原6vh,改为4vh,更矮 */
        font-size: 1.2vw !important; /* 字体更小 */
        padding: 0 0.8vw !important; /* 内边距略减 */
        border: 2px solid #999 !important;
        border-radius: 5px !important;
        box-sizing: border-box;
    }
 
    button {
        width: 30%;
        padding: 0;
        font-size: 1.8vw;
        /* Larger font for buttons */
        margin-right: 1vw;
        line-height: 5vh;
    }
 
    .btn-disabled {
        background-color: #ccc;
        color: #fff;
        border: none;
    }
 
    .btn-blue {
        background-color: #00A2E9;
        color: #fff;
        border: none;
    }
 
    .input-box {
        width: 70%;
        padding: 0 1vw;
        font-size: 1.5vw;
        /* Increased font size for input */
        border: 1px solid #ccc;
        box-sizing: border-box;
        /* 确保高度一致 */
    }
 
    /* 右边工单状态部分 */
    .right-section {
        width: 30%; /* 原来是30%,调大一点 */
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        text-align: center;
        padding-top: 45px;
        flex-wrap: wrap;
        align-content: flex-start;
        margin-top: -44px;
    }
 
    .status-title {
        margin-bottom: 2vh;
        font-size: 2vw;
        /* Larger font size for titles */
    }
 
    .status-circle {
        width: 11vw;
        /* Enlarged status circle */
        height: 11vw;
        background-color: #00A2E9;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
 
    .status-input {
        color: white;
        font-size: 2vw;
        /* Increased font size for status input */
        background: transparent;
        border: none;
        text-align: center;
        width: 100%;
        height: 100%;
        outline: none;
    }
 
    /* 下半部分:保存和取消按钮 */
    .bottom-section {
        display: flex;
        margin-top: 1vh;
        height: 100%;
        justify-content: flex-end; /* 让按钮靠右对齐(可选) */
        gap: 16px; /* 按钮间距 */
    }
 
    .save-btn,
    .cancel-btn {
        background-color: #00A2E9;
        color: white;
        border: none;
        text-align: center;
 
        width: 90px !important; /* 更窄 */
        height: 60px !important; /* 更高 */
        font-size: 22px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        display: inline-block;
    }
 
    /* 让右侧工单号输入框变长 */
    .status-title input.status-title {
        width: 110%; /* 或 100%,根据实际需求调整 */
        min-width: 320px; /* 可选,保证最小宽度 */
        font-size: 2vw;
        box-sizing: border-box;
    }
 
    .button,
    .input-box {
        font-size: 2.2vw !important; /* 字体更大 */
        height: 6vh !important; /* 高度略增 */
    }
 
    .input-box {
        border: 2.5px solid #999 !important; /* 边框更粗更明显 */
        border-radius: 6px !important; /* 圆角略大 */
        padding: 0 1.5vw !important;
    }
 
    button {
        border: 2.5px solid #999 !important; /* 按钮边框加粗 */
        border-radius: 6px !important;
    }
 
    .left-section .item button {
        border-width: 1px !important; /* 边框更粗 */
        border-style: solid !important;
        border-color: #999 !important; /* 保持原有色调 */
        font-size: 2.6vw !important; /* 字体更大 */
        font-weight: bold;
        height: 7vh !important; /* 按钮高度加大 */
        width: 32% !important; /* 原55%,改为40%,按钮更窄 */
        min-width: 80px;
        margin-right: 2%; /* 与输入框间距 */
        box-sizing: border-box;
    }
 
    .left-section .item .input-box {
        width: 48% !important; /* 原66%,改为48%,更短 */
        min-width: 100px; /* 可选,保证最小宽度 */
        box-sizing: border-box;
    }
 
</style>