快乐的昕的电脑
2025-09-23 c51b746a6369f235be7fb45500c8c1c5765b5a20
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
<template>
    <view class="page">
        
        <view>
            <h4>说明:多工单模式时换模是统一的</h4>
        </view>
        <view class="refresh-btn" @click="handleRefresh">刷新</view>
        <!-- 顶部表单部分 -->
        <view class="top-section">
            <view class="form-group">
                <label>模具编号:</label>
                <input class="input" v-model="order.moldId" placeholder="工单带出" disabled="true" />
            </view>
            <view class="form-group">
                <label>使用次数:</label>
                <input class="input" v-model="order.moldInseptionQty" placeholder="模具带出" disabled="true" />
            </view>
            <view class="form-group">
                <label>提醒保养次数:</label>
                <input class="input" v-model="order.modlLifeWorning" placeholder="模具带出" disabled="true" />
            </view>
        </view>
 
        <!-- 中间状态部分,上下结构 -->
        <view class="middle-section">
            <view class="item">
                <button class="btn-disabled">换模开始(=前工单完工)</button>
                <input class="txt-inp" v-model="startTime" placeholder="输入换模开始时间" />
            </view>
            <view class="item">
                <button @click="stateCheck(1)" class="btn-blue">换模完成(点击按钮)</button>
                <input class="txt-inp" v-model="endTime" placeholder="点击换模完成写入" />
            </view>
        </view>
 
        <!-- 底部保存/取消按钮 -->
        <view class="bottom-section">
            <button class="save-btn" @click="save">保存并生效</button>
            <button class="cancel-btn" @click="cancel">取消</button>
        </view>
    </view>
</template>
 
<script>
    export default {
        props: {
            orderNo: String,
            orderId: Number,
            machineNo: String
        },
        data() {
            return {
                startTime: '',
                endTime: '',
                order: {},
                statusForm: {}
            }
        },
        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.getOrderById();
 
            this.findByOrderId();
        },
        methods: {
 
            handleRefresh() {
                this.getOrderById();
                this.findByOrderId();
            },
 
            save() {
                if (!this.statusForm.id) {
                    this.$showMessage("id为空,不允许推送");
                    return;
                }
 
                this.$post({
                    url: "/MesOrderSta/ChangeMoldTime",
                    data: {
                        changeMoldStartTime: this.startTime,
                        changeMoldEndTime: this.endTime,
                        id: this.statusForm.id,
                        orderId: this.orderId,
                        machineNo: this.machineNo,
                        flag: this.flag
                    }
                }).then(res => {
                    if (res.data.tbBillList) {
                        this.$showMessage("保存成功");
                        this.findByOrderId();
                        
                        uni.showToast({
                                icon: 'success',
                                title: '保存成功',
                                duration: 30001,
                            });
                            
                    } else {
                        this.$showMessage("保存失败");
                        this.cancel();
                    }
                })
            },
            cancel() {
                this.startTime = this.statusForm.changeMoldStartTime;
                this.endTime = this.statusForm.changeMoldEndTime;
            },
            getOrderById() {
                this.$post({
                    url: "/Womdaa/GetWomdaaById",
                    data: {
                        orderId: this.orderId,
                        orderNo: this.orderNo
                    }
                }).then(res => {
                    this.order = res.data.tbBillList;
                })
            },
            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.changeMoldStartTime;
                    this.endTime = res.data.tbBillList.changeMoldEndTime;
                })
            },
            stateCheck(item) {
                switch (item) {
                    case 0:
                        this.startTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
                        this.endTime = this.statusForm.changeMoldEndTime;
                        break;
                    case 1:
                        this.startTime = this.statusForm.changeMoldStartTime;
                        this.endTime = this.$getDate('yyyy-mm-dd hh24:mi:ss');
                        break;
                }
                this.flag = item;
            }
        }
    };
</script>
 
<style scoped>
    /* 页面撑满窗体 */
    .page {
        padding: 2vh;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
    }
 
    .refresh-btn {
        position: absolute;
        top: -5px;
        right: 40px;
        background-color: #00A2E9;
        color: white;
        padding: 10px 15px;
        font-size: 35px;
        border-radius: 5px;
        cursor: pointer;
    }
 
    .refresh-btn:disabled {
        background-color: #ccc;
    }
 
    /* 顶部表单部分 */
    .top-section {
        /* display: flex;
        justify-content: space-between;
        margin-bottom: 2vh; */
        display: flex;
                margin-bottom: 2vh;
                flex-direction: row;
                flex-wrap: nowrap;
                align-content: center;
                justify-content: space-between;
                align-items: baseline;
    }
 
    .form-group {
        display: flex;
        align-items: center;
        margin-bottom: 1.5vh;
    }
 
    label {
        /* margin-right: 1vw;
        font-size: 1.6vw; */
        /* Larger font size for labels */
        float: left;
                /* margin-right: 1vw; */
                font-size: 1.6vw;
                margin-top: 24px;
    }
 
    .input {
        padding: 1vh;
        font-size: 1.5vw;
        /* Larger font size for input fields */
        border: 1px solid #ccc;
        width: 20vw;
        /* Set relative width for input fields */
    }
 
    /* 中间状态部分,上下布局 */
    .middle-section {
        display: flex;
        flex-direction: column;
        margin-bottom: 4vh;
    }
 
    .item {
        display: flex;
        flex-direction: row;
        /* Arrange items vertically */
        align-items: flex-start;
        margin-bottom: 2vh;
    }
 
    button {
        width: 100%;
        /* Full width for buttons */
        padding: 1.5vh;
        font-size: 1.5vw;
        /* Larger font size for buttons */
        border: none;
        text-align: center;
    }
 
    .btn-disabled {
        background-color: #ccc;
        color: white;
    }
 
    .btn-blue {
        background-color: #00A2E9;
        color: white;
    }
 
    input {
        margin-top: 10px;
        padding: 10px;
        font-size: 14px;
        border: 1px solid #ccc;
        width: 100%;
        /* 输入框撑满宽度 */
    }
 
    /* 底部保存/取消按钮 */
    .bottom-section {
        display: flex;
        justify-content: space-between;
        margin-top: 4vh;
        margin-bottom: 4vh;
    }
 
    .save-btn,
    .cancel-btn {
        width: 48%;
        /* Half-width buttons */
        padding: 1.5vh;
        background-color: #00A2E9;
        color: white;
        font-size: 1.6vw;
        /* Larger font size for save/cancel buttons */
        border: none;
        text-align: center;
    }
 
    .txt-inp {
        height: 8vh;
        padding: 1vh;
        font-size: 1.5vw;
        /* Increased font size */
        width: 100%;
        /* Full width for input in middle section */
        box-sizing: border-box;
    }
</style>