wangfei
2025-04-18 41091ccf87e8e77b4a1a50f5a7bf62d14c604d39
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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
<template>  
  <div>  
<div style="display: flex;width: 1780px;">
  <el-input v-model="flowCardId" clearable style="margin-left: 10px;margin-bottom: 10px;width: 200px;" :placeholder="$t('searchOrder.processcards')" />
  <el-select v-model="selectValuesa[0]" filterable :placeholder="$t('hellow.isForceList')" clearable
      style="width: 200px;margin-left: 10px;">
      <el-option :label="$t('hellow.noisForceList')" value="0"></el-option>
      <el-option :label="$t('hellow.yesisForceList')" value="1"></el-option>
    </el-select>
    <el-select v-model="selectValuesa[1]" filterable :placeholder="$t('searchOrder.state')" clearable
      style="width: 200px;margin-left: 10px;">
      <el-option :label="$t('film.execution')" value="1"></el-option>
      <el-option :label="$t('basicData.stop')" value="2"></el-option>
      <el-option :label="$t('sorter.endingtask')" value="3"></el-option>
    </el-select>
    <el-date-picker
            style="margin-left: 15px;"
             v-model="timeRange"
             type="datetimerange"
             :shortcuts="shortcuts"
             range-separator="至"
             :start-placeholder="$t('reportmanage.starttime')"
             :end-placeholder="$t('reportmanage.endtime')"
           />
        <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="sethistorical()">{{$t('reportmanage.inquire')}}</el-button>
   </div>
      <el-table ref="table" style="margin-top: 20px;height: 580px;width: 99%;" :data="tableDatax" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
    <el-table-column prop="flowCardId" align="center" :label="$t('searchOrder.processcards')" min-width="50" />
    <el-table-column prop="totalLayer" align="center" :label="$t('hellow.totalLayer')" min-width="20" />
    <el-table-column prop="totalPairQuantity" align="center" :label="$t('hellow.totalPairQuantity')" min-width="50" />
        <el-table-column
          align="center"
          :label="$t('hellow.isForceList')"
          min-width="50"
          prop="isForce"
        >
        <template #default="scope">  
      <el-tag :type="getStatusTypea(scope.row.isForce)">  
        {{ getStatusTexta(scope.row.isForce) }}  
      </el-tag>  
    </template> 
        </el-table-column>
        <el-table-column
          align="center"
          :label="$t('searchOrder.state')"
          min-width="50"
          prop="state"
        >
        <template #default="scope">  
      <el-tag :type="getStatusTypeb(scope.row.state)">  
        {{ getStatusTextb(scope.row.state) }}  
      </el-tag>  
    </template> 
        </el-table-column>
        <el-table-column prop="formattedCreateTime" align="center" :label="$t('reportmanage.starttime')" min-width="50" />
        <el-table-column prop="formattedUpdateTime" align="center" :label="$t('reportmanage.endtime')" min-width="50" />
        <el-table-column fixed="right" :label="$t('film.operate')" align="center">
            <template #default="scope">
          <el-button type="text" plain @click="handleptask(scope.row)">{{ $t('hellow.listFormula') }}</el-button>
          <el-button type="text" plain @click="handlecagedetails(scope.row)">{{ $t('hellow.HollowGlass') }}</el-button>
            </template>
        </el-table-column>
      </el-table>
<div style="margin-top: 20px;margin-left: 40%;">
      <el-pagination
        v-model:current-page="currentPage2"
        :page-size="pageSize"
        :size="large"
        :disabled="disabled"
        layout="prev, pager, next, jumper"
        :total="totalRecords"
        @current-change="handlePageChange2"
        style="margin-top: 10px;"
    />
  </div>
  <el-dialog v-model="dialogFormVisiblef" top="5vh" width="65%" :title="$t('hellow.HollowGlass')">
    <el-table  ref="table" style="margin-top: 20px;height: 450px;"
        :data="tableDatacagedetails" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
        <el-table-column prop="flowCardId" :label="$t('hellow.flowCardId')" align="center" width="140"/>
          <el-table-column prop="glassId" :label="$t('searchOrder.glassID')" align="center" width="140"/>
          <el-table-column prop="hollowSequence" :label="$t('hellow.order')" align="center"/>
          <el-table-column prop="thickness" :label="$t('hellow.thickness')" align="center"/>
          <el-table-column prop="layer" :label="$t('hellow.layer')" align="center"/>
          <el-table-column prop="filmsId" :label="$t('hellow.coatingtypes')" align="center"/>
          <el-table-column prop="height" :label="$t('hellow.height')" align="center"/>
          <el-table-column prop="width" :label="$t('hellow.width')" align="center"/>
          <el-table-column prop="state" :label="$t('hellow.state')" align="center">
            <template #default="scope">
            {{ scope.row.state == -1 ? $t('hellow.waitingout') : $t('hellow.finishout') }}
            </template>
          </el-table-column>
        </el-table>
</el-dialog>
<el-dialog v-model="dialogFormVisiblea" top="10vh" width="90%" :title="$t('hellow.listFormula')">
  <div style="margin-left: 50px;margin-top: 10px;margin-bottom: 10px;">
    <el-form label-width="150px" label-position="right">
      <!-- 第一行:3个元素 -->
      <el-row style="margin-top: 20px;">
        <el-col :span="8">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.formulaName')" style="width: 90%;">
              <el-input disabled v-model="formulaName" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="8">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('Mounting.removalmethoda')" style="width: 90%;">
              <el-select v-model="filmRemove" clearable style="width: 100%" disabled placeholder=" ">
                <el-option :label="$t('Mounting.removal')" value="1"></el-option>
                <el-option :label="$t('Mounting.noremoval')" value="0"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="8">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.sealInsertb')" style="width: 90%;">
              <el-input disabled v-model="sealInsert" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
      </el-row>
 
      <!-- 第二行:4个元素 -->
      <el-row style="margin-top: 20px;">
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.topRemove')" style="width: 90%;">
              <el-input disabled v-model="topRemove" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.bottomRemove')" style="width: 90%;">
              <el-input disabled v-model="bottomRemove" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.leftRemove')" style="width: 90%;">
              <el-input disabled v-model="leftRemove" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.rightRemove')" style="width: 90%;">
              <el-input disabled v-model="rightRemove" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
      </el-row>
 
      <!-- 第三行:4个元素 -->
      <el-row style="margin-top: 20px;">
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.casOneb')" style="width: 90%;">
              <el-select v-model="casOne" clearable disabled style="width: 100%" placeholder=" ">
                <el-option :label="$t('hellow.F')" value="0"></el-option>
                <el-option :label="$t('hellow.Y')" value="1"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.casTwob')" style="width: 90%;">
              <el-select v-model="casTwo" clearable disabled style="width: 100%" placeholder=" ">
                <el-option :label="$t('hellow.F')" value="0"></el-option>
                <el-option :label="$t('hellow.Y')" value="1"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.casThreeb')" style="width: 90%;">
              <el-select v-model="casThree" clearable disabled style="width: 100%" placeholder=" ">
                <el-option :label="$t('hellow.F')" value="0"></el-option>
                <el-option :label="$t('hellow.Y')" value="1"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.casFourb')" style="width: 90%;">
              <el-select v-model="casFour" clearable disabled style="width: 100%" placeholder=" ">
                <el-option :label="$t('hellow.F')" value="0"></el-option>
                <el-option :label="$t('hellow.Y')" value="1"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
      </el-row>
 
      <!-- 第四行:4个元素 -->
      <el-row style="margin-top: 20px;">
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.frameOneb')" style="width: 90%;">
              <el-input disabled v-model="frameOne" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.frameTwob')" style="width: 90%;">
              <el-input disabled v-model="frameTwo" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.frameThreeb')" style="width: 90%;">
              <el-input disabled v-model="frameThree" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.frameFourb')" style="width: 90%;">
              <el-input disabled v-model="frameFour" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
      </el-row>
 
      <!-- 第五行:4个元素 -->
      <el-row style="margin-top: 20px;">
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameHeightbOne')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameHeightOne" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameHeightbTwo')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameHeightTwo" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameHeightbThree')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameHeightThree" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameHeightbFour')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameHeightFour" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
      </el-row>
 
      <!-- 第六行:4个元素 -->
      <el-row style="margin-top: 20px;">
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameWidthbOne')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameWidthOne" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameWidthbTwo')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameWidthTwo" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameWidthbThree')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameWidthThree" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameWidthbFour')" style="width: 90%;">
              <el-input disabled v-model="intervalFrameWidthFour" autocomplete="off" />
            </el-form-item>
          </div>
        </el-col>
      </el-row>
 
      <!-- 第七行:4个元素 -->
      <el-row style="margin-top: 20px;">
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameTypedOne')" style="width: 90%;">
              <el-select v-model="intervalFrameTypeOne" clearable style="width: 100%" disabled placeholder=" ">
                <el-option :label="$t('hellow.intervalFrameTypeb')" value="1"></el-option>
                <el-option :label="$t('hellow.intervalFrameTypea')" value="5"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameTypedTwo')" style="width: 90%;">
              <el-select v-model="intervalFrameTypeTwo" clearable style="width: 100%" disabled placeholder=" ">
                <el-option :label="$t('hellow.intervalFrameTypeb')" value="1"></el-option>
                <el-option :label="$t('hellow.intervalFrameTypea')" value="5"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameTypedThree')" style="width: 90%;">
              <el-select v-model="intervalFrameTypeThree" clearable style="width: 100%" disabled placeholder=" ">
                <el-option :label="$t('hellow.intervalFrameTypeb')" value="1"></el-option>
                <el-option :label="$t('hellow.intervalFrameTypea')" value="5"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
        <el-col :span="6">
          <div style="font-size: 15px;">
            <el-form-item :label="$t('hellow.intervalFrameTypedFour')" style="width: 90%;">
              <el-select v-model="intervalFrameTypeFour" clearable style="width: 100%" disabled placeholder=" ">
                <el-option :label="$t('hellow.intervalFrameTypeb')" value="1"></el-option>
                <el-option :label="$t('hellow.intervalFrameTypea')" value="5"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </div>
</el-dialog>
</div>
</template>  
<script lang="ts" setup>
import {useI18n} from 'vue-i18n'
import {useRouter} from "vue-router"
import request from "@/utils/request"
import {host, WebSocketHost} from '@/utils/constants'
import {onBeforeUnmount, onMounted, onUnmounted, reactive, ref} from "vue";
import {closeWebSocket, initializeWebSocket} from '@/utils/WebSocketService';
import {ElMessage, ElMessageBox} from 'element-plus'
const {t} = useI18n()
let language = ref(localStorage.getItem('lang') || 'zh')
import { inject } from 'vue';
const globalDate = inject('globalDate');
const router = useRouter()
const timeRange = ref([])
const selectValuesa = reactive([]);
const tableDatax = ref([])
const currentPage2 = ref(1)
const totalRecords = ref(0)
const rawGlassHeight = ref('');
const rawGlassThickness = ref('');
const flowCardId = ref('');
const rawGlassfilmsId = ref('');
const slot = ref('');
const formattedCreate = ref('') 
const formulaName = ref('') 
const filmRemove = ref('') 
const topRemove = ref('') 
const bottomRemove = ref('') 
const leftRemove = ref('') 
const rightRemove = ref('') 
const frameOne = ref('') 
const frameTwo = ref('') 
const frameThree = ref('') 
const frameFour = ref('') 
const sealInsert = ref('') 
const casOne = ref('') 
const casTwo = ref('') 
const casThree = ref('') 
const casFour = ref('') 
const intervalFrameTypeOne = ref('') 
const intervalFrameWidthOne = ref('') 
const intervalFrameHeightOne = ref('') 
const intervalFrameTypeTwo = ref('') 
const intervalFrameWidthTwo = ref('') 
const intervalFrameHeightTwo = ref('') 
const intervalFrameTypeThree = ref('') 
const intervalFrameWidthThree = ref('') 
const intervalFrameHeightThre = ref('') 
const intervalFrameTypeFour = ref('') 
const intervalFrameWidthFour = ref('') 
const intervalFrameHeightFour = ref('') 
const createTime = ref('') 
const updateTime = ref('') 
const tableDatacagedetails = ref([])
const dialogFormVisiblea = ref(false)
const dialogFormVisiblef = ref(false)
let getglobalDate = window.localStorage.getItem('getglobalDate')
const historical = async () => {
try {
let startTime = window.localStorage.getItem('startTime')
    const response = await request.post("/hollowGlass/hollowGlassOutRelationInfo/queryHollowHistoryTask", {
      pageNo: 1,
      pageSize: 20,
      cell: 930,
      flowCardId: '',
      isForceList: [],
      stateList: [],
      beginDate: startTime,
      endDate: getglobalDate
  })
    if (response.code == 200) {
      ElMessage.success(response.message);
      const formattedData = response.data.records.map(record => ({
      ...record,
      formattedCreateTime: formatTimestamp(record.createTime),
      formattedUpdateTime: formatTimestamp(record.updateTime),
    }));
      tableDatax.value = formattedData;
      totalRecords.value = response.data.total/2 || 0
    } else {
      ElMessage.error(response.message);
  }
}
catch (error) {
}
}
const handlePageChange2 = (newPage) => {
currentPage2.value = newPage;
window.localStorage.setItem('pagenumber', currentPage2.value)
historicala(currentPage2.value);
};
const historicala = async (page) => {
try {
let celllist=[]
let stateList=[]
  if(selectValuesa[0]!=null&&selectValuesa[0]!='undefined'){
if(selectValuesa[0]!=""){
  celllist=[selectValuesa[0]];
}
}
if(selectValuesa[1]!=null&&selectValuesa[1]!='undefined'){
    if(selectValuesa[1]!=""){
      stateList=[selectValuesa[1]];
    }
  }
let page = window.localStorage.getItem('pagenumber')
let startTime = window.localStorage.getItem('startTime')
    const response = await request.post("/hollowGlass/hollowGlassOutRelationInfo/queryHollowHistoryTask", {
      pageNo: page,
      pageSize: 20,
      cell: 930,
      flowCardId: flowCardId.value,
      isForceList: celllist,
      stateList: stateList,
        beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
        endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
  })
    if (response.code == 200) {
      ElMessage.success(response.message);
      const formattedData = response.data.records.map(record => ({
      ...record,
      formattedCreateTime: formatTimestamp(record.createTime),
      formattedUpdateTime: formatTimestamp(record.updateTime),
    }));
      tableDatax.value = formattedData;
      totalRecords.value = response.data.total/2 || 0
    } else {
      ElMessage.error(response.message);
  }
}
catch (error) {
}
}
// 历史查询点击
const sethistorical = async () => {
try { 
let celllist=[]
let stateList=[]
  if(selectValuesa[0]!=null&&selectValuesa[0]!='undefined'){
if(selectValuesa[0]!=""){
  celllist=[selectValuesa[0]];
}
}
if(selectValuesa[1]!=null&&selectValuesa[1]!='undefined'){
    if(selectValuesa[1]!=""){
      stateList=[selectValuesa[1]];
    }
  }
let startTime = window.localStorage.getItem('startTime')
let page = window.localStorage.getItem('pagenumber')
const response = await request.post("/hollowGlass/hollowGlassOutRelationInfo/queryHollowHistoryTask", {
      pageNo: 1,
      pageSize: 20,
      cell: 930,
      flowCardId: flowCardId.value,
      isForceList: celllist,
      stateList: stateList,
        beginDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[0])) || '',
        endDate: (formatTimestamp(timeRange.value) && formatTimestamp(timeRange.value[1])) || '',
  })
    if (response.code == 200) {
      currentPage2.value = 1
      ElMessage.success(response.message);
      const formattedData = response.data.records.map(record => ({
      ...record,
      formattedCreateTime: formatTimestamp(record.createTime),
      formattedUpdateTime: formatTimestamp(record.updateTime),
    }));
      // tableDatax.value = response.data.records;
      tableDatax.value = formattedData;
      totalRecords.value = response.data.total/2 || 0
    } else {
      ElMessage.error(response.message);
  }
}
catch (error) {
}
}
// 配方信息
const handleptask = (row) => {
  fetchcagedl(row); 
  dialogFormVisiblea.value = true;
};
const removalMethodMap = {
  1: t('Mounting.removal'),
  0: t('Mounting.noremoval')
};
const fetchcagedl = async (row) => {
  try  {
    var url="/hollowGlass/hollowFormulaDetails/getFormulaDetailsById?id="+ row.formulaId;
    const response = await request.get(url)
    if (response.code == 200) {
      ElMessage.success(response.message);
        formulaName.value = response.data.formulaName
        filmRemove.value = removalMethodMap[response.data.filmRemove];
        topRemove.value = response.data.topRemove
        bottomRemove.value = response.data.bottomRemove
        leftRemove.value = response.data.leftRemove
        rightRemove.value = response.data.rightRemove
        frameOne.value = response.data.frameOne
        frameTwo.value = response.data.frameTwo
        frameThree.value = response.data.frameThree
        frameFour.value = response.data.frameFour
        sealInsert.value = response.data.sealInsert
        casOne.value = response.data.casOne
        casTwo.value = response.data.casTwo
        casThree.value = response.data.casThree
        casFour.value = response.data.casFour
        intervalFrameTypeOne.value = response.data.intervalFrameTypeOne
        intervalFrameWidthOne.value = response.data.intervalFrameWidthOne
        intervalFrameHeightOne.value = response.data.intervalFrameHeightOne
        intervalFrameTypeTwo.value = response.data.intervalFrameTypeTwo
        intervalFrameWidthTwo.value = response.data.intervalFrameWidthTwo
        intervalFrameHeightTwo.value = response.data.intervalFrameHeightTwo
        intervalFrameTypeThree.value = response.data.intervalFrameTypeThree
        intervalFrameWidthThree.value = response.data.intervalFrameWidthThree
        intervalFrameHeightThre.value = response.data.intervalFrameHeightThre
        intervalFrameTypeFour.value = response.data.intervalFrameTypeFour
        intervalFrameWidthFour.value = response.data.intervalFrameWidthFour
        intervalFrameHeightFour.value = response.data.intervalFrameHeightFour
    } else {
      ElMessage.error(response.message);
    }
}
catch (error) {
  }
}
// 队列信息
const handlecagedetails = (row) => {
  const { id } = row;
  fetchcagedetails(id); 
  dialogFormVisiblef.value = true;
};
const fetchcagedetails = async (id) => {
  try  {
    var url="/hollowGlass/hollowGlassQueueInfo/queryHollowGlassQueueInfoByTask?taskId="+ id;
    const response = await request.post(url)
    if (response.code == 200) {
      ElMessage.success(response.message);
      const formattedData = response.data.map(record => ({
      ...record,
      formaCreateTime: formatTimestamp(record.createTime),
      formaUpdateTime: formatTimestamp(record.updateTime),
    }));
    tableDatacagedetails.value = formattedData;
    } else {
      ElMessage.error(response.message);
    }
}
catch (error) {
  }
}
// 格式化时间戳为年月日时间字符串的函数
function formatTimestamp(timestamp) {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并补零
const day = String(date.getDate()).padStart(2, '0'); // 补零
const hours = String(date.getHours()).padStart(2, '0'); // 补零(如果需要显示时间)
const minutes = String(date.getMinutes()).padStart(2, '0'); // 补零(如果需要显示时间)
const seconds = String(date.getSeconds()).padStart(2, '0'); // 补零(如果需要显示时间)
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
const shortcuts = [
  {
    text: '最近一周',
    value: () => {
      const backendTime = new Date(getglobalDate)
      const oneWeekAgo = new Date(getglobalDate)
      oneWeekAgo.setHours(0, 0, 0, 0);
      oneWeekAgo.setDate(oneWeekAgo.getDate() - 7)
      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
    },
  },
  {
    text: '最近一个月',
    value: () => {
      const backendTime = new Date(getglobalDate)
      const oneWeekAgo = new Date(getglobalDate)
      oneWeekAgo.setHours(0, 0, 0, 0);
      oneWeekAgo.setMonth(oneWeekAgo.getMonth() - 1)
      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
    },
  },
  {
    text: '最近三个月',
    value: () => {
      const backendTime = new Date(getglobalDate)
      const oneWeekAgo = new Date(getglobalDate)
      oneWeekAgo.setHours(0, 0, 0, 0);
      oneWeekAgo.setMonth(oneWeekAgo.getMonth() - 3)
      timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)]
      window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
},
  },
]
// 格式化后端时间并计算一周前的时间
const defaultTime = ref<[Date, Date]>([new Date(), new Date()]);
function parseAndSetTime() {
const backendTime = new Date(getglobalDate);
const oneWeekAgo = new Date(backendTime.getTime() - 7 * 24 * 60 * 60 * 1000); // 减去7天
  oneWeekAgo.setHours(0, 0, 0, 0);
timeRange.value = [formatTimestamp(oneWeekAgo), formatTimestamp(backendTime)];
window.localStorage.setItem('startTime', formatTimestamp(oneWeekAgo))
}
function getStatusTypeb(state: number) {  
switch (state) {  
  case 1:
    return 'primary';  
  case 2: 
    return 'success';  
  case 3: 
    return 'info';  
}  
}
function getStatusTextb(state: number) {
switch (state) {
  case 1:  
    return t('film.execution');
  case 2:  
    return t('basicData.stop');
  case 3:  
    return t('sorter.endingtask');
}  
}
function getStatusTypea(isForce: number) {  
switch (isForce) {  
  case 0: 
    return 'primary';  
  case 1: 
    return 'success';  
}  
}  
function getStatusTexta(isForce: number) {
switch (isForce) {
  case 0:
    return t('hellow.noisForceList');
  case 1:  
  return t('hellow.yesisForceList');
}  
}
function getStatustate(state: number) {  
switch (state) {  
  case 0: 
    return 'primary';  
  case 1: 
    return 'success';  
}  
}  
function getStatustatet(state: number) {
switch (state) {
  case 0:  
    return t('hellow.noisForceList');
  case 1:  
  return t('hellow.yesisForceList');
}  
}
function getisPairstate(isPair: number) {  
switch (isPair) {  
  case 0: 
    return 'info';  
  case 1: 
    return 'success';  
}  
}  
function getisPairstatet(isPair: number) {
switch (isPair) {
  case 1:  
    return t('sorter.yes');
  case 0:  
  return t('hellow.no');
}  
}
onMounted(() => {
parseAndSetTime();
historical();
});
</script>
<style scoped>
#dt { display:block; float:left;line-height: 20px;margin-left: 100px;}
#dta { display:block; float:left;line-height: 20px;margin-left: 80%;}
</style>