张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
<template>
  <div class="main tabs_main" style="height:89%">
    <div class="main_header">
      <!-- <div class="header_item">
        <span class="header_label">项目名称:</span>
        <el-select v-model="search.assistId" placeholder="请选择项目名称" clearable>
            <el-option
            v-for="item in optionsAuxiliary"
            :key="item.id"
            :label="item.assistName+'-'+item.assistModel"
            :value="item.id">
            </el-option>
        </el-select>
      </div> -->
      <div class="header_item">
        <span class="header_label">车牌号:</span>
        <el-input v-model="search.carBrand" :size="size" clearable placeholder="请输入车牌号"></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">环号:</span>
        <el-input v-model="search.ringNum" :size="size" clearable placeholder="请输入环号"></el-input>
      </div>
      <div class="header_item">
        <span class="header_label">管片编号:</span>
        <el-input v-model="search.pipeNum" :size="size" clearable placeholder="请输入管片编号"></el-input>
      </div>
      <div class="header_item">
        <el-button icon="el-icon-search" v-if="showButton('search')" @click="searchButtonInfo(true)">查询</el-button>
        <el-button class="search_btn" icon="el-icon-plus" v-if="showButton('insert')" @click="insertProp">新增</el-button>
      </div>
    </div>
    <div class="main_content">
      <el-table
        v-loading="loading"
        :data="dataList"
        height="100%">
        <el-table-column align="center" label="序号" width="60">
          <template #default="scope">
            <span>{{(pageNum - 1) * pageSize + scope.$index + 1}}</span>
          </template>
        </el-table-column>
        <el-table-column prop="realName" label="出库人" align="center" width="120"></el-table-column>
        <el-table-column prop="carBrand" label="车牌号" align="center"  show-overflow-tooltip></el-table-column>
        <el-table-column prop="gdName" label="GPS设备" align="center"  show-overflow-tooltip></el-table-column>
        <el-table-column prop="proName" label="项目名称" align="center"  show-overflow-tooltip></el-table-column>
        <el-table-column prop="carDriver" label="司机" align="center" ></el-table-column>
        <el-table-column prop="carPhone" label="联系电话" align="center"  show-overflow-tooltip></el-table-column>
        <el-table-column prop="reciverName" label="收货人" align="center" ></el-table-column>
        <el-table-column prop="reciverPhone" label="收货人电话" align="center" width="120" ></el-table-column>
        <el-table-column prop="reciverUnit" label="收货单位" align="center" width="120" ></el-table-column>
        <el-table-column  label="运输起止时间" align="center" width="250">
            <template #default="{row}">
                <div>{{row.strTime}}-{{row.endTime}}</div>
            </template>
        </el-table-column>
        <el-table-column prop="notes" label="备注" align="center" show-overflow-tooltip></el-table-column>
        <el-table-column label="操作" align="center" width="450">
          <template #default="{ row }">
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="showGps(row)">GPS轨迹</el-button>
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="infoUpload(row)">发运单打印</el-button>
            <el-button class="table_btn" size="mini" v-if="showButton('update')" @click="updateProp(row)">修改</el-button>
            <el-button class="delete_btn" size="mini" v-if="showButton('delete')" @click="deleteInfo(row)">删除</el-button>
            <el-button class="table_btn" size="mini" v-if="showButton('delete')" @click="detailsInfo(row)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="main_footer">
      <el-pagination
        background
        @current-change="changePageNum"
        @size-change="changePageSize"
        :current-page="pageNum"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
    <el-dialog
      class="prop_dialog"
      :title="asyncTitle === true ? '新增出库' :asyncTitle === false ? '修改出库信息':'出库详情'"
      :close-on-click-modal="false"
      :visible.sync="asyncVisible"
      width="35%">
      <el-form ref="ruleForm" :model="ruleForm" :rules="rules" label-width="auto" class="rule_form" style="overflow-x: hidden;">
        <el-form-item label="车牌号:" prop="carId">
          <el-select v-model="ruleForm.carId" :size="size" placeholder="请选择车牌号" @change="carsChange" clearable :disabled="disabled">
            <el-option
                v-for="item in optionsCarbrand"
                :key="item.carId"
                :label="item.carBrand"
                :value="item.carId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="GPS设备:" prop="gdId">
          <el-select v-model="ruleForm.gdId" :size="size" placeholder="请选择GPS设备" clearable :disabled="disabled">
            <el-option
                v-for="item in gpsDevicesGroup"
                :key="item.gdId"
                :label="item.gdName"
                :value="item.gdId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="项目名称:" prop="proId">
          <el-select v-model="ruleForm.proId" :size="size" placeholder="请选择项目名称" clearable :disabled="disabled">
            <el-option
                v-for="item in projectNameGroup"
                :key="item.proId"
                :label="item.proName"
                :value="item.proId">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="司机:" prop="carDriver">
          <el-input v-model="ruleForm.carDriver" :size="size" clearable placeholder="请输入司机" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="联系电话:" prop="carPhone">
          <el-input v-model="ruleForm.carPhone" :size="size"  clearable placeholder="请输入联系电话" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="收货人:" prop="inUserId">
            <el-select v-model="ruleForm.inUserId" placeholder="请选择收货人" @change="usersChange" clearable  :disabled="disabled">
                <el-option
                v-for="item in optionsReciver"
                :key="item.id"
                :label="item.reciverName"
                :value="item.id">
                </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="收货人电话:" prop="reciverPhone">
          <el-input v-model="ruleForm.reciverPhone" :size="size" clearable placeholder="请输入收货人电话" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="收货单位:" prop="reciverUnit">
          <el-input v-model="ruleForm.reciverUnit" :size="size" clearable placeholder="请输入收货单位" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="运输起止时间:" prop="time">
          <el-date-picker
            v-model="ruleForm.time"
            type="datetimerange"
            value-format="yyyy-MM-dd HH:mm:ss"
            :default-time="['00:00:00','23:59:59']"
            range-separator="-"
            :disabled="disabled"
            start-placeholder="起始时间"
            end-placeholder="结束时间">
        </el-date-picker>
        </el-form-item>
        <el-form-item label="备注:" prop="notes">
          <el-input v-model="ruleForm.notes" :size="size" type="textarea" :rows="2" clearable placeholder="请输入备注" :disabled="disabled"></el-input>
        </el-form-item>
        <div class="form_lines"></div>
        <div class="form_header_item" v-if="asyncTitle ===true">
            <span class="form_header_label">出库人:</span>
            <el-input v-model="searchSegment.realName" :size="size" clearable placeholder="请输入出库人" :disabled="true"></el-input>
        </div>
        <div class="form_header_item" v-if="asyncTitle ===true || asyncTitle ===false">
            <span class="form_header_label">环号:</span>
            <el-input v-model="searchSegment.ringNum" :size="size" placeholder="请输入环号" @blur="changeBlur" :disabled="disabled"></el-input>
        </div>
        <div style="margin-top:15px">
            <el-table
                ref="multipleTable"
                :data="asyncTitle === true?segmentList:asyncTitle ===false?segmentListX:segmentListD"
                tooltip-effect="dark"
                style="width: 100%"
                @selection-change="handleSelectionChange">>
                <el-table-column
                type="selection"
                :selectable="selecttable"
                width="55">
                </el-table-column>
                <el-table-column prop="pipeNum" label="管片编号" align="center" width="150"></el-table-column>
                <el-table-column prop="ringNum" label="环号" align="center"></el-table-column>
                <el-table-column prop="sizeName" label="尺寸" align="center"></el-table-column>
                <el-table-column prop="reinforcementName" label="配筋" align="center"></el-table-column>
                <el-table-column prop="blockNumName" label="块号" align="center"></el-table-column>
            </el-table>
        </div>
      </el-form>
      <div slot="footer" v-if="asyncTitle === true || asyncTitle === false">
        <el-button @click="asyncVisible = false">取 消</el-button>
        <el-button class="submit_btn" @click="asyncTitle ? submitInsert() : submitUpdate()">提 交</el-button>
      </div>
    </el-dialog>
    <!-- GPS轨迹和发运单上传 -->
    <el-dialog
      class="prop_dialog"
      :title="asyncGps ? 'GPS轨迹' : '发运单'"
      :close-on-click-modal="false"
      :visible.sync="GPSVisible"
      width="55%">
    <!-- <el-form ref="noteForm" :model="noteForm" :rules="noterules" label-width="auto" class="rule_form" style="overflow-x: hidden;height:180px" v-if="!asyncGps">
        <el-form-item label="发运单:" prop="imageList">
            <upload-image :file-list="noteForm.imageList"  @delectImage="delectImage" :disabled="disabled">
                <template #info>
                    <span>支持jpg、png、gif格式文件</span>
                </template>
            </upload-image>
        </el-form-item>
      </el-form> -->
      <div v-if="!asyncGps" class="debit_note">
        <div class="debit_note_headers"><span>{{printLists.proName}}发运签收单</span></div>
        <div class="debit_note_mains">
          <div class="debit_note_num">
            <div class="debit_note_text">编号:</div>
            <div class="debit_note_data">{{printLists.pipeOutNumber}}</div>
          </div>
          <div class="debit_note_content">
            <div class="debit_note_rows">
              <div class="debit_note_rows1">
                <div class="debit_note_row1_text">出厂时间</div>
                <div class="debit_note_row1_data">{{printLists.strTime}}</div>
              </div>
              <div class="debit_note_rows1">
                <div class="debit_note_row1_text">混凝土强度等级</div>
                <div class="debit_note_row1_data"></div>
              </div>
            </div>
            <div class="debit_note_rows">
              <div class="debit_note_rows1">
                <div class="debit_note_row1_text">生产厂家/发货单位</div>
                <div class="debit_note_row1_data">{{printLists.companyName}}</div>
              </div>
              <div class="debit_note_rows1">
                <div class="debit_note_row1_text">工程名称</div>
                <div class="debit_note_row1_data">{{printLists.proName}}</div>
              </div>
            </div>
            <div class="debit_note_rows">
              <div class="debit_note_rows1">
                <div class="debit_note_row1_text">收货单位</div>
                <div class="debit_note_row1_data">{{printLists.reciverUnit}}</div>
              </div>
              <div class="debit_note_rows1">
                <div class="debit_note_row1_text">发货编号</div>
                <div class="debit_note_row1_data">{{printLists.pipeOutNumber}}</div>
              </div>
            </div>
            <div class="debit_note_middle">
              <div class="debit_note_titles">管片流水号</div>
              <div class="debit_note_titles">配筋类型</div>
              <div class="debit_note_titles">管片型号</div>
              <div class="debit_note_titles">规格</div>
              <div class="debit_note_titles">管片型号检查</div>
            </div>
            <div class="debit_note_middle" v-for="(item,index) in pieceGroup" :key="index">
              <div class="debit_note_titles debit_note_info">{{item.pipeNum}}</div>
              <div class="debit_note_titles debit_note_info">{{item.reinforcementName}}</div>
              <div class="debit_note_titles debit_note_info">{{item.turnName}}</div>
              <div class="debit_note_titles debit_note_info">{{item.sizeName}}</div>
              <div class="debit_note_titles debit_note_info">{{item.blockNumName}}</div>
            </div>
            <div class="debit_note_footer">
              <div class="debit_footer_title">1、外形外观合格R</div>
              <div class="debit_footer_title">2、混凝土强度达到C60R</div>
              <div class="debit_footer_title">3、其他满足标准及规范要求R</div>
            </div>
            <div class="debit_note_footer">
              <div class="debit_footer_title">4、垫管片方木共计:</div>
              <div class="debit_footer_title debit_footer_datas"></div>
              <div class="debit_footer_title">规格:</div>
              <div class="debit_footer_title debit_footer_datas"></div>
              <div class="debit_footer_title">木方返还</div>
              <div class="debit_footer_title debit_footer_datas"></div>
              <div class="debit_footer_title">根,</div>
              <div class="debit_footer_title">规格:</div>
              <div class="debit_footer_title debit_footer_datas"></div>
            </div>
            <div class="debit_note_bottom">
              <div class="debit_bottom_items">
                <div class="debit_items_title">发货联系人:</div>
                <div class="debit_items_datas">{{printLists.carDriver}}</div>
                <div class="debit_items_title">电话:</div>
                <div class="debit_items_datas">{{printLists.carPhone}}</div>
              </div>
              <div class="debit_bottom_items">
                <div class="debit_items_title">收货联系人:</div>
                <div class="debit_items_datas">{{printLists.reciverName}}</div>
                <div class="debit_items_title">电话:</div>
                <div class="debit_items_datas">{{printLists.reciverPhone}}</div>
              </div>
            </div>
            <div class="debit_note_bottom">
              <div class="debit_bottom_items">
                <div class="debit_items_title">车牌号:</div>
                <div class="debit_items_datas">{{printLists.carBrand}}</div>
              </div>
              <div class="debit_bottom_items" style="justify-content: space-around;">
                <div class="debit_items_title">司机发车签字:</div>
                <div class="debit_items_title">司机返厂签字:</div>
              </div>
            </div>
            <div class="debit_note_marks">
              <div class="debit_marks_text">备注:</div>
              <div class="debit_marks_datas"></div>
            </div>
          </div>
        </div>
      </div>
      <div slot="footer" v-if="!asyncGps">
        <!-- <el-button @click="GPSVisible = false">取 消</el-button> -->
        <el-button class="submit_btn" @click="asyncGps ? submitGps() : submitNote()">打 印</el-button>
      </div>
      <div v-if="asyncGps" class="map_gps"><!--  @ready="ready"-->
        <baidu-map class="map_gps" :scroll-wheel-zoom="true" :center="map.center" :zoom="map.zoom" :ak="ak" @ready="ready">
            <bm-polyline :path="lineList" stroke-color="#0ff" :stroke-opacity="0.5" :stroke-weight="8"></bm-polyline>
        </baidu-map>
        <div class="gps_infos">
          <div class="gps_infos_items">
            <div class="gps_items_text">车牌号:</div>
            <div class="gps_items_datas">{{showDatas&&showDatas.carBrand}}</div>
          </div>
          <div class="gps_infos_items">
            <div class="gps_items_text">车辆类型:</div>
            <div class="gps_items_datas">{{showDatas&&showDatas.carTypeName}}</div>
          </div>
          <div class="gps_infos_items">
            <div class="gps_items_text">司机:</div>
            <div class="gps_items_datas">{{showDatas&&showDatas.carDriver}}</div>
          </div>
          <div class="gps_infos_items">
            <div class="gps_items_text">联系电话:</div>
            <div class="gps_items_datas">{{showDatas&&showDatas.carPhone}}</div>
          </div>
        </div>
      </div>
    </el-dialog>
    <div v-show="showAbtn">
      <a id="segmentPrint" :href="`printpipezhen://${pitchNums}`"><p></p></a>
    </div>
  </div>
</template>
 
<script>
import qidian from "../../../assets/start_line.png";
import zhong from "../../../assets/end_line.png";
import BaiduMap from 'vue-baidu-map/components/map/Map.vue';
import BmPolyline from 'vue-baidu-map/components/overlays/Polyline.vue';
// import UploadImage from '../../../components/uploadImage.vue'
import { buttonPinia } from '../../../pinia/index';
import { throttle, changeSize} from '../../../plugins/public'; // 导入节流、动态切换组件尺寸方法
  export default {
    components:{
      //  UploadImage,
       BaiduMap,
       BmPolyline
    },
    data() {
      return {
         map: {
            // center: { lng:115.21708150241663, lat: 37.503218241177095},
            center:{},
            zoom: 18,
            show: true,
            dragging: true
        },
        lineBmap:null,//地图
        lineMap:null,
        ak: "T7cpTR9uqOivVMmfcgC4TbNyVS2sbcMw",
        lineList:[],//轨迹点
        size: changeSize(), // 组件尺寸
        pageNum: 1,
        pageSize: 10,
        search:{},//查询条件
        showDatas:null,//一行的数据
        showAbtn:false,//是否展示a标签
        pitchNums:null,//打印编号
        pipeOutId:null,//出库id
        projectNameGroup:[],//项目名称族
        printLists:null,//发运单打印数据
        pieceGroup:[
        ],
        searchSegment:{
            realName:sessionStorage.getItem('realName'),
        },//弹框中的查询条件
        total: 0,
        loading: false,
        disabled:false,//是否禁止修改
        dataList: [], //出库信息列表
        detailDatas:[],//详情列表
        segmentList:[],//管片列表(添加按钮里面)
        segmentListX:[],
        segmentListD:[],
        segmentLists:[],//管片列表(修改和详情中拼接的所有管片)
        optionsCarbrand:[],//车牌号
        pipeInfos:[],//已有的管片
        gpsDevicesGroup:[],//GPS设备下拉框
        multipleSelection: [],//多选框
        asyncGps:true,// GPS轨迹:true 发运单上传:false
        asyncTitle: true, // 对话框title 新增:true  修改:false
        GPSVisible:false,//GPS和发运单弹框
        asyncVisible: false, // 添加 修改对话框
        ruleForm: {
        }, // 按钮表单
        noteForm:{},//发运单
        noterules:{
            imageList: [{
            required: true,
            message: '请选择发运单',
            trigger: ['change','blur']
          }],
        },//发运单
        rules: {
          carId: [{
            required: true,
            message: '请选择车牌号',
            trigger: 'change'
          }],
          gdId: [{
            required: true,
            message: '请选择GPS设备',
            trigger: 'change'
          }],
          proId: [{
            required: true,
            message: '请选择项目名称',
            trigger: 'change'
          }],
          carDriver: [{
            required: true,
            message: '请输入司机姓名',
            trigger: 'blur'
          }],
          carPhone: [{
            required: true,
            message: '请输入联系电话',
            trigger: 'blur'
          },{
            pattern:
              /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur'
          }],
          reciverPhone: [{
            required: false,
            message: '请输入收货人联系电话',
            trigger: 'blur'
          },{
            pattern:
              /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur'
          }],
          inUserId: [{
            required: true,
            message: '请输入收货人',
            trigger: 'blur'
          }],
          time: [{
            required: true,
            message: '请选择起止时间',
            trigger: 'change'
          }],
        },
        optionsReciver:[],//收货人
      }
    },
    watch: {
      asyncVisible(bol) {
        if(!bol) {
          this.ruleForm = {};
          this.$refs.ruleForm.resetFields();
        }
      },
      GPSVisible(bol) {
        if(!bol) {
          this.noteForm = {};
          this.$refs.noteForm.resetFields();
        }else{
            this.$set(this.noteForm, 'imageList', []);
        }
      }
    },
    mounted() {
      const that = this;
      // 根据窗口大小动态修改组件尺寸
      window.onresize = () => {
        that.size = changeSize();
      }
      that.getAllTypes()
      that.getAllCar()
      that.getAllSegments()
      that.getAllProjects()
    },
    methods: {
    //获取所有项目
    getAllProjects(){
      this.$api.Engineer.searchProjects({pageNum:1,pageSize: 1000000}).then(res=>{
        if(res.statusMsg==='ok'){
          this.projectNameGroup = res.data.list
        }else{
          this.$message.warning(res.statusMsg)
        }
      })
    },
    //轨迹配置
    ready({ BMap, map}){
        this.lineBmap = BMap
        this.lineMap = map
    },
    //获取车辆下拉
    getAllCar(){
        this.$api.DuctpiecePLM.getAllCarInfo({}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.optionsCarbrand = res.data
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
    },
    //详情按钮
    detailsInfo(row){
        // this.getAllSegments()
        this.carsChange(row.carId)
        this.segmentListD = []
        this.asyncTitle = '66'
        this.asyncVisible = true;
        this.disabled = true
        this.$api.DuctpiecePLM.detailsOutInfo({pipeOutId: row.pipeOutId}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.ruleForm = res.data
                this.$set(this.ruleForm,'time',[res.data.strTime,res.data.endTime])
                // this.segmentLists = [...res.data.pipeInfos,...this.segmentList]
                this.segmentLists = res.data.pipeInfos
                this.segmentListD = this.segmentLists
                res.data.pipeInfos.forEach(item=>{
                    const num = this.segmentListD.findIndex(element => element.pipeId === item.pipeId)
                    this.$refs.multipleTable.clearSelection()
                    this.$nextTick(()=>{
                        this.$refs.multipleTable.toggleRowSelection(this.segmentListD[num],true);
                    })
                })
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
    },
    //是否禁止多选
    selecttable(){
        if(this.asyncTitle === '66'){
            return false
        }else{
            return true
        }
    },
    //发运单上传按钮
    infoUpload(row){
        this.asyncGps = false
        this.GPSVisible = true
        this.pipeOutId = row.pipeOutId
        this.pitchNums = row.pipeOutId
        this.$api.DuctpiecePLM.detailsOutInfo({pipeOutId: row.pipeOutId}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.printLists= res.data
                if(res.data.pipeInfos.length===0){
                  this.pieceGroup =[{},{},{},{}]
                }else{
                  this.pieceGroup = res.data.pipeInfos
                  for(let i=0;i<=5-res.data.pipeInfos.length;i++){
                    this.pieceGroup.push({})
                  }
                }
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
    },
    //发运单打印提交按钮
    submitNote(){
      this.gopPrints()
      this.GPSVisible = false
    },
    //执行去打印
    gopPrints(){
        this.$nextTick(()=>{
          document.getElementById("segmentPrint").click();
        })
    },
    //GPS轨迹
    showGps(row){
        this.lineList = []
        this.showDatas = row
        this.asyncGps = true
        this.GPSVisible = true
        this.$api.DuctpiecePLM.getGpsLine({pipeOutId:row.pipeOutId}).then(res=>{
            if(res.statusMsg === 'ok'){
                res.data.map(item=>{
                    this.lineList.push({
                        lng:item.longitude,
                        lat:item.latitude
                    })
                })
                this.map.center = {lng:this.lineList[0].lng,lat:this.lineList[0].lat}
                this.setLineMark(this.lineList)
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
    },
    //设置起点和终点坐标
    setLineMark(val){
        // console.log(val[0].lng,val[0].lat,'起点坐标')
        //起点标注
        var point = new this.lineBmap.Point(val[0].lng,val[0].lat)   
        var myIcon = new this.lineBmap.Icon(qidian, new this.lineBmap.Size(100, 100))
        var offset = new this.lineBmap.Size(30, 5);
        var marker = new this.lineBmap.Marker(point, { icon: myIcon ,offset: offset}) // 创建标注  
        this.lineMap.addOverlay(marker) // 将标注添加到地图中
        //坐标转换
        // var convertor = new this.lineBmap.Convertor()
        // convertor.translate([point],1,5,(datas)=>{
        //     var marker=new this.lineBmap.Marker(datas.points[0], { icon: myIcon }) // 创建标注  
        //     this.lineMap.addOverlay(marker) // 将标注添加到地图中
        // })
        
        //终点标注
        var point2 = new this.lineBmap.Point(val[val.length-1].lng,val[val.length-1].lat)   
        var myIcon2 = new this.lineBmap.Icon(zhong, new this.lineBmap.Size(100, 100)) 
        var offset2 = new this.lineBmap.Size(30, 5);
        var marker2 = new this.lineBmap.Marker(point2, { icon: myIcon2,offset: offset2 }) // 创建标注  
        this.lineMap.addOverlay(marker2) // 将标注添加到地图中
 
        //设置轨迹样式
        // var array=[];
        // this.lineList.forEach(Element=>{
        //     array.push(new this.lineBmap.Point(Element.lng, Element.lat))
        // })
        // var polyline = new this.lineBmap.Polyline(array, {strokeColor:"red", strokeWeight:5, strokeOpacity:0.5});
        // this.lineMap.addOverlay(polyline);
        
    },
    //table表格多选
    handleSelectionChange(val) {
        this.multipleSelection = val.map(item=>{
            return item.pipeId
        })
    },
    //环号失去焦点查询
    changeBlur(){
        this.getAllSegments(this.searchSegment.ringNum)
    },
    //获取管片列表
    getAllSegments(val){
        this.$api.DuctpiecePLM.getAllPipInfos({
            ringNum:val,
          }).then(res=>{
            if(res.statusMsg === 'ok'){
              if(this.asyncTitle ===false){
                if(val !==''){
                  this.segmentListX = res.data
                }else{
                  this.segmentListX = [...this.pipeInfos,...res.data]
                }
                this.pipeInfos.forEach(item=>{
                  const num = this.segmentListX.findIndex(element => element.pipeId === item.pipeId)
                  this.$nextTick(()=>{
                      this.$refs.multipleTable.toggleRowSelection(this.segmentListX[num],true);
                  })
                })
              }else{
                this.segmentList = res.data
                this.pipeInfos.forEach(item=>{
                  const num = this.segmentList.findIndex(element => element.pipeId === item.pipeId)
                  this.$nextTick(()=>{
                      this.$refs.multipleTable.toggleRowSelection(this.segmentList[num],true);
                  })
                })
              }
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
    },
    //改变车牌号带出司机
    carsChange(val){
        this.$api.DuctpiecePLM.detailsCarInfo({carId:val}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.$set(this.ruleForm,'carDriver',res.data.carDriver)
                this.$set(this.ruleForm,'carPhone',res.data.carPhone)
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
        this.$api.DuctpiecePLM.getGpsDeviceLists({carId:val}).then(res=>{
          if(res.statusMsg === 'ok'){
            this.gpsDevicesGroup = res.data
          }else{
            this.$message.warning(res.statusMsg)
          }
        })
    },
    //改变收货人去带出收货人电话
    usersChange(val){
        if(val !== ''){
            this.$set(this.ruleForm,'reciverPhone',this.optionsReciver.find(itm => itm.id === val).reciverPhone)
            this.$set(this.ruleForm,'reciverUnit',this.optionsReciver.find(itm => itm.id === val).reciverUnit)
        }else{
            this.$set(this.ruleForm,'reciverPhone','')
            this.$set(this.ruleForm,'reciverUnit','')
        }
    },
    //获取收货人信息
      getAllTypes(){
        this.$api.DuctpiecePLM.getAllReciverInfo({}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.optionsReciver = res.data
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
      // 查询按钮列表信息
      searchButtonInfo(bol) {
        if(bol) {
          this.pageNum = 1;
        }
        let params = Object.assign({},this.search,{
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          stockType:1
        })
        params.strTime = this.search.time&&this.search.time[0]
        params.endTime = this.search.time&&this.search.time[1]
        delete params.time
        this.loading = true;
        this.$api.DuctpiecePLM.searchOutInfo(params).then((res) => {
          if(res.statusMsg === 'ok') {
            this.total = res.data.total;
            this.dataList = res.data.list;
          }else{
            this.$message.warning(res.statusMsg)
          }
          this.loading = false;
        })
      },
      // 修改按钮信息
      updateProp(row) {
        // this.getAllSegments()
        this.carsChange(row.carId)
        this.disabled = false
        this.segmentListX = []
        this.asyncTitle = false;
        this.asyncVisible = true;
        this.$api.DuctpiecePLM.detailsOutInfo({pipeOutId: row.pipeOutId}).then(res=>{
            if(res.statusMsg === 'ok'){
                this.ruleForm = res.data
                this.$set(this.ruleForm,'time',[res.data.strTime,res.data.endTime])
                this.segmentLists = [...res.data.pipeInfos,...this.segmentList]
                this.segmentListX = this.segmentLists
                this.pipeInfos = res.data.pipeInfos
                res.data.pipeInfos.forEach(item=>{
                    const num = this.segmentListX.findIndex(element => element.pipeId === item.pipeId)
                    this.$nextTick(()=>{
                        this.$refs.multipleTable.toggleRowSelection(this.segmentListX[num],true);
                    })
                })
            }else{
                this.$message.warning(res.statusMsg)
            }
        })
      },
    //删除上传图片
    delectImage(item){
        let uploadId = item.id
        this.noteForm.imageList.splice(this.noteForm.imageList.findIndex(itm => itm.id === uploadId),1)
        this.$message.success("删除成功!")
    },
      // 新增按钮信息
      insertProp() {
        this.asyncTitle = true;
        this.asyncVisible = true;
        this.disabled = false
        this.$refs.multipleTable.clearSelection();
        // this.getAllSegments()
      },
      // 删除按钮信息
      deleteInfo(row) {
        this.$confirm("该操作将删除该信息,是否继续删除?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
       })
       .then(() => {
         this.$api.DuctpiecePLM.deleteOutInfo({pipeOutId: row.pipeOutId})
        .then(res => {
          if(res.statusMsg === 'ok') {
            this.searchButtonInfo(true);
            this.$message.success("删除成功!");
          } else {
            this.$message.warning(res.statusMsg);
          }
        })
       })
       .catch(() => {
         this.$message.warning("您已取消");
       })
      },
      // 提交添加按钮信息
      submitInsert: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.pipeIds = this.multipleSelection
            params.strTime = this.ruleForm.time && this.ruleForm.time[0]
            params.endTime = this.ruleForm.time && this.ruleForm.time[1]
            delete params.time
            this.$api.DuctpiecePLM.insertOutInfo(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('添加成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 提交修改按钮信息
      submitUpdate: throttle(function() {
        this.$refs.ruleForm.validate((valid) => {
          if(valid) {
            const params = Object.assign({}, this.ruleForm);
            params.pipeIds = this.multipleSelection
            params.strTime = this.ruleForm.time && this.ruleForm.time[0]
            params.endTime = this.ruleForm.time && this.ruleForm.time[1]
            delete params.time
            this.$api.DuctpiecePLM.updateOutInfo(params).then((res) => {
              if(res.statusMsg === 'ok') {
                this.asyncVisible = false;
                this.searchButtonInfo(true);
                this.$message.success('修改成功!');
              } else {
                this.$message.warning(res.statusMsg);
              }
            })
          }
        })
      }, 3000),
      // 判断按钮权限信息
      showButton(str) {
        const pinia = buttonPinia();
        return pinia.$state.buttonInfo.includes(str);
      },      
      // 切换页数
      changePageNum(page) {
        this.pageNum = page;
        this.searchButtonInfo();
      },
      // 切换每页条数
      changePageSize(size) {
        this.pageSize = size;
        this.searchButtonInfo();
      }
    }
  }
</script>
 
<style lang="scss" scoped>
@import '../../../style/layout-main.scss';
.gps_infos{
  padding: 20px;
  position: absolute;
  top: 15%;
  right: 10px;
  background: url("../../../assets/gps_info_bg.png") no-repeat;
  background-size: 100% 100%;
 
  .gps_infos_items{
    display: flex;
    margin-top: 5px;
    .gps_items_text{
      width: 80px;
      flex: none;
      color: #fff;
      font-size: 16px;
    }
    .gps_items_datas{
      color: #39B5FE;
      font-size: 16px;
    }
  }
}
 
.debit_note{
  width: 100%;
  height: 600px;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background-color: #fff;
 
  .debit_note_headers{
      height: 50px;
      color: rgba(50, 133, 199, 1);
      text-decoration: underline;
      text-underline-position: under;
      text-underline-offset: 12px;
      text-decoration-thickness:1px;
    span{
      color: rgba(50, 133, 199, 1);
      font-size: 25px;
      line-height: 50px;
      display: flex;
      justify-content: center;
      text-decoration: underline;
      text-underline-position: under;
      text-underline-offset: 24px;
      text-decoration-thickness:1px;
    }
  }
  .debit_note_mains{
    display: flex;
    flex-direction: column;
    margin-top:20px;
    margin-bottom: 10px;
    flex: 1;
    padding: 0 20px;
    .debit_note_num{
      display: flex;
      justify-content: flex-end;
      margin-right: 15px;
      .debit_note_text{
        flex: none;
        font-size: 18px;
        color: rgba(50, 133, 199, 1);
      }
      .debit_note_data{
        color: rgba(50, 51, 51, 1);
        font-size: 18px;
      }
    }
    .debit_note_content{
      border-top: 0.86px solid rgba(50, 133, 199, 1);
      border-left: 0.86px solid rgba(50, 133, 199, 1);
      flex: 1;
      .debit_note_rows{
        width: 100%;
        display: flex;
        line-height: 30px;
        .debit_note_rows1{
          width: 100%;
          display: flex;
          .debit_note_row1_text{
            width: 154px;
            padding:10px;
            color: rgba(50, 133, 199, 1);
            flex: none;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 16px;
            border-right: 0.86px solid rgba(50, 133, 199, 1);
            border-bottom: 0.86px solid rgba(50, 133, 199, 1);
          }
          .debit_note_row1_data{
            flex: 1;
            font-size: 16px;
            color: rgba(50, 51, 51, 1);
            display: flex;
            align-items: center;
            justify-content: center;
            border-right: 0.86px solid rgba(50, 133, 199, 1);
            border-bottom: 0.86px solid rgba(50, 133, 199, 1);
          }
        }
      }
      .debit_note_middle{
        width: 100%;
        line-height: 30px;
        display: flex;
        .debit_note_titles{
          width: 100%;
          text-align: center;
          padding: 10px;
          color: rgba(50, 133, 199, 1);
          font-size: 16px;
          border-right: 0.86px solid rgba(50, 133, 199, 1);
          border-bottom: 0.86px solid rgba(50, 133, 199, 1);
        }
        .debit_note_info{
          height: 50px;
          color: rgba(50, 51, 51, 1);
        }
      }
      .debit_note_footer{
        width: 100%;
        line-height: 30px;
        display: flex;
        justify-content: space-around;
        border-right: 0.86px solid rgba(50, 133, 199, 1);
        border-bottom: 0.86px solid rgba(50, 133, 199, 1);
        .debit_footer_title{
          padding: 10px;
          color: rgba(50, 133, 199, 1);
          font-size: 16px;
        }
        .debit_footer_datas{
          color:rgba(50, 51, 51, 1);
        }
      }
      .debit_note_bottom{
        display: flex;
        width: 100%;
        line-height: 30px;
        .debit_bottom_items{
          width: 100%;
          display: flex;
          border-right: 0.86px solid rgba(50, 133, 199, 1);
          border-bottom: 0.86px solid rgba(50, 133, 199, 1);
 
          .debit_items_title{
            padding: 10px;
            color:rgba(50, 133, 199, 1);
            font-size: 16px;
          }
          .debit_items_datas{
            padding: 10px;
            color:rgba(50, 51, 51, 1);
            font-size: 16px;
          }
        }
      }
      .debit_note_marks{
        display: flex;
        width: 100%;
        line-height: 30px;
        border-right: 0.86px solid rgba(50, 133, 199, 1);
        border-bottom: 0.86px solid rgba(50, 133, 199, 1);
        .debit_marks_text{
          padding: 10px;
          color:rgba(50, 133, 199, 1);
          font-size: 16px;
        }
        .debit_marks_datas{
          padding: 10px;
          color:rgba(50, 51, 51, 1);
          font-size: 16px;
        }
      }
    }
  }
}
.form_lines{
    width: 100%;
    border: 1px solid #0D5274;
    margin: 20px 10px;
}
.form_header_item{
    display: flex;
    align-items: center;
    margin-right: 10px;
    margin-top: 15px;
    .form_header_label {
      color: #EAEAEA;
      white-space: nowrap;
      text-align: right;
    }
}
/deep/.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{
    background-color: #1890ff;
    border-color: #1890ff;
}
.map_gps{
    width: 100%;
    height: 500px;
}
</style>