linwenling
2023-10-22 1660e0f0083d1a682bf0dca9dcaf2e8ba2502f38
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
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
<template>
  <div class="app-container" style="opacity: 1;">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <h1 style="font-size:21px">完美旅途</h1>
      <el-form-item label="时间" prop="startTime" >
        <el-date-picker
          v-model="dateRange"
          style="width: 200px;
                   height: 35px;
                   border-radius: 16px 16px 16px 16px;
                   opacity: 0.5;"
          value-format="yyyy-MM-dd HH-MM"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="去向" prop="destination" >
        <el-input
          v-model="queryParams.destination"
          placeholder="请输入去向"
          clearable
          style="width: 200px;
                   height: 35px;
                   border-radius: 16px 16px 16px 16px;
                   opacity: 0.5;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="旅游名称" prop="name" >
        <el-input
          v-model="queryParams.name"
          placeholder="请输入旅游名称"
          clearable
          style="width: 200px;
                   height: 35px;
                   border-radius: 16px 16px 16px 16px;
                   opacity: 0.5;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="旅游方式" prop="manner" >
        <el-input
          v-model="queryParams.manner"
          placeholder="请输入旅游方式"
          clearable
          style="width: 200px;
                   height: 35px;
                   border-radius: 16px 16px 16px 16px;
                   opacity: 0.5;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
 
      <el-form-item>
        <el-button  size="mini" @click="handleQuery" style=" width: 65px; height: 32px;background: #FFDDE3;border-radius:6px 6px 6px 6px;opacity:1;">搜索</el-button>
        <el-button  size="mini" @click="resetQuery" style=" width: 65px;height: 32px; background: #FFDDE3; border-radius:6px 6px 6px 6px;opacity: 1;">重置</el-button>
      </el-form-item>
    </el-form>
 
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:role:add']"
        >新增</el-button>
      </el-col>
 
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete1"
          v-hasPermi="['system:role:remove']"
        >删除</el-button>
      </el-col>
 
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <!-- 序号、基金/台账、时间、收入/支出、用途、使用人、现金/自动扣划、余额、电子文件、备注 操作-->
    <!-- 这里有个familyList数组 是在data()中定义的 -->
    <el-table v-loading="loading" :data="travelpriceList" @row-click="getRowId" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" style="background: #FFEFF2;  border-radius: 14px 14px 14px 14px;">
      <el-table-column type="expand" :cell-class-name="expandRowClassName">
        <template slot-scope="props">
          <div  >
            <el-table  :header-row-class-name="tableHeaderRowClassName"  v-loading="loading" :data="travelBase[props.row.id]"  style="background: #FFEFF2;  border-radius: 14px 14px 14px 14px;" :row-class-name="tableRowClassName1" >
              <el-table-column  label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="50px"/>
 
              <el-table-column label="时间" prop="happenDate" sortable width="100" align="center" >
                <template slot-scope="scope">{{scope.row.happenDate? scope.row.happenDate: '————'}}</template>
              </el-table-column>
 
              <el-table-column label="地点" prop="address" sortable width="100" />
 
              <el-table-column label="建筑" prop="scenic" sortable width="100" />
              <!-- <el-table-column label="旅期" prop="travelPeriod" sortable width="100" /> -->
              <el-table-column label="使用证件" prop="document" sortable width="100" />
              <el-table-column label="车次/航班" prop="flight" sortable width="120px" />
              <el-table-column label="餐费" prop="eat" sortable width="70px" />
              <el-table-column label="住宿费" prop="stay" sortable width="100px" />
              <el-table-column label="交通" prop="travel" sortable width="70px" />
              <el-table-column label="门票" prop="entrance" sortable width="70px" />
<!--              <el-table-column label="购物" prop="shopping" sortable width="70px" />-->
              <el-table-column label="电子文件" prop="url" width="160" >
                <template slot-scope="scope" >
                  <img
                    class="el-upload-list__item-thumbnail"
                    src="../../assets/images/deviceLis.png"
                    alt=""
                    style="width: 35px; height: 35px;"
                    fit="cover"
                    v-if="!scope.row.url "
                  >
                  <img
                    class="el-upload-list__item-thumbnail"
                    src="../../assets/images/deviceA.png"
                    alt=""
                    style="width: 35px; height: 35px;"
                    fit="cover"
                    v-if="scope.row.url "
                  >
                </template>
              </el-table-column>
<!--              <el-table-column label="备注" prop="remark" sortable width="100" />-->
 
 
              <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope" v-if="scope.row.roleId !== 1">
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-edit"
                    @click="handleUpdate1(scope.row)"
                    v-hasPermi="['familymodel:economy:info']"
                  >修改</el-button>
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-delete"
                    @click="handleDelete1(scope.row)"
                    v-hasPermi="['system:role:remove']"
                  >删除</el-button>
                  <el-button size="mini" type="text" icon="el-icon-d-arrow-right"  @click="handleCheck1(scope.row)">查看详情</el-button>
 
                </template>
              </el-table-column>
            </el-table>
          </div>
 
 
        </template>
      </el-table-column>
      <!-- <el-table-column type="selection" width="55"  align="center" /> -->
      <el-table-column fixed label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="60px"/>
      <el-table-column label="起" prop="startTime" sortable width="100" align="center">
        <template slot-scope="scope">{{scope.row.startTime? scope.row.startTime: '————'}}</template>
      </el-table-column>
      <el-table-column label="止" prop="endTime" sortable width="100" align="center">
        <template slot-scope="scope">{{scope.row.endTime? scope.row.endTime: '————'}}</template>
      </el-table-column>
<!--      <el-table-column label="总天数" prop="totalDay" sortable width="85px" />-->
      <el-table-column label="旅游名称" prop="name" sortable width="200px" />
      <el-table-column label="去向" prop="destination" sortable width="150px" />
      <el-table-column label="旅游性质" prop="property" sortable width="100" />
      <el-table-column label="旅游方式" prop="manner" sortable width="100" />
      <el-table-column label="总金额" prop="totalPrice" sortable width="100" />
      <el-table-column label="餐费" prop="eatTotal" sortable width="70px" />
      <el-table-column label="住宿" prop="stayTotal" sortable width="70px" />
      <el-table-column label="交通" prop="travelTotal" sortable width="70px" />
      <el-table-column label="门票" prop="entranceTotal" sortable width="70px" />
      <el-table-column label="团费" prop="groupTotal" sortable width="70px" />
 
 
      <el-table-column  label="操作" align="center" sortable width="180" >
        <template slot-scope="scope" v-if="scope.row.roleId !== 1">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['person:travel:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-circle-plus"
            @click="handleAdd1(scope.row)"
 
            v-hasPermi="['person:travel:edit']"
          >新增</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
 
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:role:remove']"
          > 删除</el-button>
          <!-- <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['familymodel:economy:info']">
            <el-button size="mini" type="text" icon="el-icon-d-arrow-right"  @click="handleCheck(scope.row)">查看详情</el-button>
          </el-dropdown> -->
          <!-- <el-button class="button" size="mini" type="text"  @click="handleShow"  v-hasPermi="['system:role:add']">
            <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn> </el-button> -->
 
        </template>
 
      </el-table-column>
    </el-table>
    <div style="background-color: #FEF7FC;">
      <el-dialog :title="title" :visible.sync="openDataScope" width="1300px" append-to-body >
        <div style="background-color: #FEF7FC;">
          <el-table v-loading="loading" :data="detailList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName"  >
            <el-table-column type="selection" width="50"  align="center" />
            <el-table-column  label="序号" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="80px"/>
            <el-table-column label="时间" prop="happenTime" sortable width="150" align="center">
              <template slot-scope="scope">{{scope.row.happenTime? scope.row.happenTime: '————'}}</template>
            </el-table-column>
            <el-table-column label="内容" prop="content" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="总金额" prop="totalCost" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="餐费" prop="eat" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="住宿" prop="stay" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="交通" prop="traffic" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="门票" prop="entrance" sortable :show-overflow-tooltip="true" width="100px" />
            <el-table-column label="购物" prop="shopping" sortable :show-overflow-tooltip="true" width="100px" />
 
            <el-table-column label="操作" align="center" sortable class-name="small-padding fixed-width">
              <template slot-scope="scope" v-if="scope.row.roleId !== 1">
 
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit"
                  @click="handleUpdate1(scope.row)"
                  v-hasPermi="['familymodel:economy:info']"
                >修改</el-button>
 
              </template>
            </el-table-column>
 
          </el-table>
          <pagination
            v-show="total>0"
            :total="total"
            :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize"
            @pagination="getList"
            style="background: #FEF7FC;"
          />
        </div>
 
      </el-dialog>
    </div>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
      style="background: #FEF7FC;"
    />
 
 
<!--     新增旅游经历-->
    <el-dialog :title="title" :visible.sync="dialog1Visible" width="800px" append-to-body>
      <el-form ref="elForm2" :model="formDat4" :rules="rules2" size="medium" label-width="100px">
 
        <el-form-item label="标题" prop="name">
          <el-input v-model="formDat4.name" placeholder="请输入标题" clearable :style="{width: '80%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="起始时间" prop="startTime">
          <el-date-picker v-model="formDat.startTime" type="date" placeholder="请选择日期"
                          :editable="false" :clearable="false" :style="{width: '100%'}"  value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间" prop="endTime">
          <el-date-picker v-model="formDat.endTime" type="date" placeholder="请选择日期"
                          :editable="false" :clearable="false" :style="{width: '100%'}"  value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="去向" prop="destination">
          <el-input  v-model="formDat4.destination" placeholder="请输入去向" style="width: 80%;"></el-input>
 
        </el-form-item>
        <el-form-item label="团费" prop="groupTotal">
          <el-input v-model="formDat4.groupTotal" type="number"  placeholder="请输入团费" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="旅游性质" prop="property">
          <el-select v-model="formDat4.property" placeholder="请选择性质" clearable :style="{width: '80%'}" >
            <el-option label="自费" value="自费"></el-option>
            <el-option label="公费" value="公费"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="旅游方式" prop="manner">
          <el-input  v-model="formDat4.manner" placeholder="请输入旅游方式" style="width: 80%;"></el-input>
 
        </el-form-item>
 
      </el-form>
      <h4 class="form-header"> </h4>
 
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitDataScope">确 定</el-button>
        <el-button @click="dialog1Visible = false ">取 消</el-button>
      </div>
    </el-dialog>
<!--  新增每日行程内容-->
    <el-dialog title="添加每日行程内容" :visible.sync="centerDialogVisible" width="60%" center append-to-body>
      <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-width="100px">
        <h4 class="form-header">行程内容 </h4>
 
        <el-form-item label="时间" prop="happenDate">
          <el-date-picker v-model="formDat.happenDate" type="date" placeholder="请选择日期"
                          :editable="false" :clearable="false" :style="{width: '100%'}"  value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="地点" prop="address">
          <el-input v-model="formDat.address" placeholder="请输入地点" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="建筑" prop="scenic">
          <el-input v-model="formDat.scenic" placeholder="请输入建筑" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="出行方式" prop="travelMode">
          <el-input v-model="formDat.travelMode" placeholder="请输入出行方式" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="持证旅游" prop="certificate">
          <el-select v-model="formDat.certificate" placeholder="请选择证件" clearable :style="{width: '80%'}" >
            <el-option label="居民身份证" value="居民身份证"></el-option>
            <el-option label="临时身份证" value="临时身份证"></el-option>
            <el-option label="户口本" value="户口本"></el-option>
            <el-option label="护照" value="护照"></el-option>
            <el-option label="学生证" value="学生证"></el-option>
          </el-select>
        </el-form-item>
 
        <el-form-item label="车次/航班" prop="flight">
          <el-input v-model="formDat.flight" placeholder="请输入车次/航班" clearable :style="{width: '100%'}" ></el-input>
        </el-form-item>
<!--        <el-form-item label="备注" prop="remark">-->
<!--          <el-input v-model="formDat.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" ></el-input>-->
<!--        </el-form-item>-->
 
 
        <h4 class="form-header">相关图片 </h4>
        <el-upload
          action="#"
          list-type="picture-card"
          multiple
          :http-request="requestUpload"
          :file-list="fileList"
        >
          <i slot="default" class="el-icon-plus"></i>
          <div slot="file" slot-scope="{file}">
            <img
              class="el-upload-list__item-thumbnail"
              :src="file.url"
              alt=""
              style="width: 126px; height: 126px"
              fit="cover"
              :preview-src-list="[file.url]"
            >
            <span class="el-upload-list__item-actions">
          <span
            class="el-upload-list__item-preview"
            @click="handlePictureCardPreview(file)"
          >
            <i class="el-icon-zoom-in"></i>
          </span>
 
          <span
            v-if="!disabled"
            class="el-upload-list__item-delete"
            @click="handleRemove(file)"
          >
            <i class="el-icon-delete"></i>
          </span>
        </span>
 
 
          </div>
        </el-upload>
        <h4 class="form-header">其他附件 </h4>
        <el-upload
          action=""
          :file-list="fileListOther"
          class="upload-demo"
          multiple
 
          :on-remove="handleRemove"
          :http-request="requestUpload"
          :show-file-list="true"
        >
          <el-button type="primary">上传</el-button>
          <template #tip>
            <div class="el-upload__tip">
            </div>
          </template>
        </el-upload>
 
      </el-form>
      <el-form ref="elForm" :model="formDat" :rules="rules1" size="medium" label-width="100px">
        <h4 class="form-header">费用明细 </h4>
        <el-form-item label="住宿酒店" prop="hotel">
          <el-input v-model="formDat.hotel" placeholder="请输入住宿酒店" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="住宿费用" prop="stay">
          <el-input v-model="formDat.stay" type="number"  placeholder="请输入住宿费用" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="交通费用" prop="travel">
          <el-input v-model="formDat.travel" type="number"  placeholder="请输入交通费用" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="餐费" prop="eat">
          <el-input v-model="formDat.eat"  type="number"  placeholder="请输入餐费用" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="门票费用" prop="entrance">
          <el-input v-model="formDat.entrance" type="number"  placeholder="请输入门票费用" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
 
      </el-form>
      <h4 class="form-header"> </h4>
 
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitDataScope1">确 定</el-button>
        <el-button @click="centerDialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>
 
  </div>
</template>
 
<script>
import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role";
import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu";
 
 
 
//在system/note/index.js中导入接口函数  --接好了
import {
  listTravelPrice,
  listTravelBase,
  delTravelBase,
  delTravelPrice,
  addTravelPrice,
  uploadPic,
  // updateTravelPrice,
  addTravelBase,
 
} from "@/api/travel/index";
import {getSelfEconomyInfo} from "@/api/selfeconomy";
import {delFamilyevent, listFamilyevent} from "@/api/bignote";
 
export default {
  name: "Role",
  dicts: ['sys_normal_disable'],
  data() {
    return {
      // 遮罩层
      disabled: false,
      loading: true,
      formData:[],
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      //
      travelpriceList: [],
      target:[],
      travelBase:[],
      baseData:[],
      detailList:[],
      // 弹出层标题
      title: "",
      title1:"",
      // 是否显示弹出层
      open: false,
      centerDialogVisible: false,
      dialog1Visible: false,
      dialog2Visible: false,
      // 是否显示弹出层(数据权限)
      openDataScope: false,
      menuExpand: false,
      menuNodeAll: false,
      deptExpand: true,
      deptNodeAll: false,
      // 日期范围
      dateRange: [],
      // 数据范围选项
      fot:[".jpg",".jif"],
      fileList:[
      ],
      fileListOther:[
 
      ],
      dsb:true,
      btn:false,
      formDat: {
        people: undefined,
        address: undefined,
        happenTime: undefined,
        title: undefined,
        travelPeriod:undefined,
        certificate: undefined,
        totalPrice: undefined,
        self: undefined,
        remark: undefined,
        groupTotal:undefined,
        url: undefined,
      },
      formDat1: {
        eat: undefined,
        stay: undefined,
        traffic: undefined,
        entrance: undefined,
        shopping:undefined,
        content: undefined,
      },
      formDat2: {
        id: undefined,
        detailList: undefined,
      },
      formDat7: {
        id: undefined,
        detailList: undefined,
      },
      formDat4: {
        manner: undefined,
        startTime: undefined,
        endTime: undefined,
        property:undefined,
        name: undefined,
        destination: undefined,
      },
      // 菜单列表
      menuOptions: [],
      // 部门列表
      deptOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
 
      },
      // 表单参数
      form: {},
      defaultProps: {
        children: "children",
        label: "label"
      },
      //表单校验
      rules: {
        name: [{
          required: true,
          message: '请输入旅游名称',
          trigger: 'blur'
        }],
 
        address: [{
          required: true,
          message: '请输入地点',
          trigger: 'blur'
        }],
        title: [{
          required: true,
          message: '请输入标题',
          trigger: 'blur'
        }],
        travelPeriod: [{
          required: true,
          message: '请输入旅期',
          trigger: 'blur'
        }],
        document: [{
          required: true,
          message: '请输入证件',
          trigger: 'blur'
        }],
        happenDate: [{
          required: true,
          message: '请选择日期选择',
          trigger: 'change'
        }],
        manner: [{
          required: true,
          message: '请输入出行方式',
          trigger: 'blur'
        }],
        property: [{
          required: true,
          message: '请选择旅游性质',
          trigger: 'change'
        }],
 
      },
      rules1: {
        stay: [{
          required: true,
          message: '请输入住宿费',
          trigger: 'blur'
        }],
 
        hotel: [{
          required: true,
          message: '请输入住宿酒店',
          trigger: 'blur'
        }],
        travel: [{
          required: true,
          message: '请输入交通费',
          trigger: 'blur'
        }],
        entrance: [{
          required: true,
          message: '请输入门票',
          trigger: 'blur'
        }],
        eat: [{
          required: true,
          message: '请输入餐费',
          trigger: 'blur'
        }],
 
 
      },
      rules2: {
        manner: [{
          required: true,
          message: '请输入旅游方式',
          trigger: 'blur'
        }],
        groupTotal: [{
          required: true,
          message: '请输入团费',
          trigger: 'blur'
        }],
        destination: [{
          required: true,
          message: '请选择去向',
          trigger: 'change'
        }],
        property: [{
          required: true,
          message: '请输入旅游名称',
          trigger: 'blur'
        }],
        startTime: [{
          required: true,
          message: '请选择日期',
          trigger: 'change'
        }],
        endTime: [{
          required: true,
          message: '请选择日期',
          trigger: 'change'
        }],
        name: [{
          required: true,
          message: '请选择标题',
          trigger: 'blur'
        }],
      },
 
      typeOptions: [
        {
          value: '0',
          label: '自费',
        },
        {
          value: '1',
          label: '公费',
        }],
      typeOptions1: [
        {
          value: '0',
          label: '现金',
        },
        {
          value: '1',
          label: '自动扣划',
        }
      ],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    //展开行
    expandRowClassName({ row, rowIndex }) {
      // 返回对应行的样式配置对象
      return {
        'expand-row': true, // 添加自定义样式类名
        'expand-row-height': '40px' // 设置展开行的高度
      };
    },
    //首行样式
    tableHeaderRowClassName() {
      return 'custom-header-row';
    },
    // 取消按钮
    cancelData() {
      this.open = false;
      this.reset();
    },
 
    //隔行变色
    tableRowClassName({ row, rowIndex }) {
      if (rowIndex % 2 == 0) {
        return "statistics-warning-row1";
      } else {
        return "statistics-warning-row";
      }
    },
    //隔行变色
    tableRowClassName1({ row, rowIndex }) {
      if (rowIndex % 2 == 0) {
        return "statistics-warning-row3";
      } else {
        return "statistics-warning-row2";
      }
    },
    /** 查询角色列表 */
    //列表显示家大事记
 
 
    getList() {
      this.loading = true;
 
      listTravelPrice(this.queryParams).then(response => {
        this.travelpriceList = response.data.data;
 
        this.total = response.data.total;
        this.loading = false;
 
        const travelBaseMap = {};
 
        // 将所有请求存储起来
        const promises = [];
        for (const item of this.travelpriceList) {
          const promise = listTravelBase({ cid: item.id }).then(result => {
            travelBaseMap[item.id] = result.data;
          });
          promises.push(promise);
        }
 
        // 等待所有数据都请求完毕后再设置travelBase
        Promise.all(promises).then(() => {
          this.travelBase = travelBaseMap;
        });
      });
 
 
    },
 
    handleRemove(file) {
      for(let i = 0; i < this.fileListOther.length; i++)
      {
        if(this.fileListOther[i].url==file.url)
          this.$delete(this.fileListOther,i);
      }
    },
 
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    getRowId(row)
    {
      return row.id
 
    },
    // 取消按钮(数据权限)
    cancelDataScope() {
      this.openDataScope = false;
      this.reset();
    },
    // 表单重置
    reset() {
      if (this.$refs.menu != undefined) {
        this.$refs.menu.setCheckedKeys([]);
      }
      this.menuExpand = false,
        this.menuNodeAll = false,
        this.deptExpand = true,
        this.deptNodeAll = false,
        this.form = {
          roleId: undefined,
          roleName: undefined,
          roleKey: undefined,
          roleSort: 0,
          status: "0",
          menuIds: [],
          deptIds: [],
          menuCheckStrictly: true,
          deptCheckStrictly: true,
          remark: undefined
        };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.dateRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      console.log(this.ids)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
 
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.dialog1Visible = true;
      this.dialog2Visible = false;
      this.title = "添加旅游内容";
    },
    /** 新增按钮操作 */
    handleAdd1(row) {
      const id = row.id
      this.row = row;
      this.reset();
      this.centerDialogVisible = true;
      this.title1 = "添加每日行程内容";
 
    },
 
    /** 提交按钮(数据权限) */
    submitDataScope1: async function() {
      const id = this.row.id
 
      this.formDat.cid = id;
      let ul = this.fileList.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      let uls = this.fileListOther.map(function (elem){
        return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")
      }).join(",")
      this.formDat.url = ul+","+uls
      console.log(this.formDat)
      this.$refs["elForm"].validate(valid => {
        if (valid) {
 
          addTravelBase(this.formDat).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.centerDialogVisible = false;
            this.getList();
          });
        }
      });
      Object.keys(this.formDat).forEach(key => {
        this.formDat[key] = '';
      });
      this.handleRemove(this.fileList[0]);
      this.handleRemoveFile(this.fileListOther[0]);
    },
    //  弹窗
    handleShow(row){
      const id = row.id;
 
      this.openDataScope = true
      //   this.getList()
      //alert(123)
      this.detailList = row.detailList
      // alert(row.index)
      this.title = "每日费用详情";
      this.getList1()
    },
 
    /** 查看详细信息 */
    handleCheck(row){
      const id = row.id;
      // alert(id)
      //  alert(row.fee_id)
      this.$router.push("/self/travel/Info/" + id);
    },
    handleCheck1(row){
      const id = row.id;
      this.$router.push("/self/travel/travelInfo/" + id);
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
 
      const id = row.id;
      // console.log(id);
      let jd = true
      // this.$router.push("/self/travel/edit/" + id);
      this.$router.push({
        path:"/self/travel/edit/" + id,
        query:{
          detail:jd
        }
      });
    },
    /** 修改按钮操作 */
    handleUpdate1(row) {
      const id = row.id;
      let jd = true
 
      this.$router.push({
        path:"/self/travel/travelInfo/" + id,
        query:{
          detail:jd
        }
      });
    },
 
 
    handlePictureCardPreview(file) {
      this.dialogImageUrl = file.url;
      this.dialogVisible = true;
    },
    /** 提交按钮(数据权限) */
    submitDataScope: function() {
 
 
      this.$refs["elForm2"].validate(valid => {
        if (valid) {
          console.log(this.formDat4);
          addTravelPrice(this.formDat4).then(response => {
            this.$modal.msgSuccess("新增成功");
 
            this.dialog1Visible = false;
            this.getList();
          });
        }
      });
      // 清空formDat对象的数据
      Object.keys(this.formDat4).forEach(key => {
        this.formDat4[key] = '';
      });
      this.handleRemove(this.fileList[0]);
      this.handleRemoveFile(this.fileListOther[0]);
    },
    requestUpload(params)
    {
      var file = params.file;
      var formData = new FormData();
      formData.append('uploadFile', file);
      let _this = this
 
      uploadPic(formData).then(response => {
        let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length)
 
        if(_this.fot.includes(pth) === true)
        {
          _this.fileList.push({name:response.data.fileName, "url":response.data.url})
 
        }
 
        else{
          _this.fileListOther.push({name:response.data.fileName, url:response.data.url})
 
        }
      })
 
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const Ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除所选数据项?').then(function() {
        return delTravelPrice(Ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 删除按钮操作 */
     handleDelete1(row) {
      const id = row.id || this.ids;
      console.log(id)
      this.$modal.confirm('是否确认删除所选中数据项?').then(function() {
        return delTravelBase(id);
      }).then(() => {
        this.getList();
        this.ids = []
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const Ids = this.ids;
 
      if(Ids.length==0)
      {
        this.download('/zfEconomy/export', {
          ...this.queryParams
        }, `zfEconomy_${new Date().getTime()}.xlsx`)
      }else
      {
        this.download('/zfEconomy/export1/'+Ids, {
        }, `zfEconomy_${new Date().getTime()}.xlsx`)
      }
    }
    ,
    handleExportTemplate(){
      this.download('/zfEconomy/model', {
 
      }, `zfEconomy_${new Date().getTime()}.xlsx`)
    },
    /** 导入操作*/
    handleEnport(params){
      var file = params.file;
      var formData = new FormData();
      formData.append('excelImport', file);
      let _this = this
      alert(file)
      enload(formData).then(response => {
        _this.getList();
        Message({ message: "导入成功", type: 'warning' })
 
      }).catch(err)
      {
        Message({ message: "导入失败", type: 'error' })
      }
 
    }
  },
};
 
 
</script>
 
<style>
.el-table__row.statistics-warning-row {
  background: #E0EEFE;
 
}
.el-table__row.statistics-warning-row1 {
  background: #FFEFF2;
}
 
.el-table__row.statistics-warning-row2 {
  background: #EBFFF2;
}
.el-table__row.statistics-warning-row3 {
  background: #f8f8dc;
}
.button {
  background: center no-repeat url('../../assets/images/弹窗 1.png') ;
  /* margin-left: 66vw; */
}
.button_delete {
  background: center no-repeat url('../../assets/images/删除2.png') ;
 
  /* margin-left: 66vw; */
}
.custom-header-row {
  background-color: #EBAFB4 /* 更改为你想要的背景颜色 */
  /* color: #FFF; 更改为你想要的文字颜色 */
}
</style>