activityHis.vue
24.8 KB
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
<template>
<div style="background-color:#f7f7f7;padding:10px 10px;height:700px">
<!-- 详情活动方案 -->
<div style="background-color:#fff;">
<div style="height:58px;line-height:58px;background-color:#fff;padding-left:20px;">
<div style="color:#0006"> <span>活动策划</span> <span style="padding:0 5px;">></span> <span
style="color:#000000e6">活动方案详情</span></div>
</div>
<div ref="actXiang" style="width: 600px;height:500px;">
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
<div>我的PDF是11、</div>
</div>
<div style="display: flex;justify-content: flex-end;padding:10px">
<el-button @click="downloadPdf" style="background-color: #3F9B6A;color: #fff"
v-if="activeName=='first'">活动策划调整方案导出
</el-button>
</div>
</div>
</div>
</template>
<script>
import {
deleteById,
queryByPage,
xiangByPage,
fujiaTable,
mingTable,
danqueryById,
xiangedit,
actEdit,
actAdd,
actPage,
MingAdd,
MingDel,
cereGet,
cereAdd,
cereEdit,
cereDel,
copy,
excelQueryByPage,
excelAdd,
effectEvaluation,
lishiDeta
} from '../../api/activityBz'
import actbians from "./activityBian"
import * as echarts from 'echarts'
import Vue from 'vue'
import html2canvas from 'html2canvas'
import jsPDF from 'jspdf'
import wangEditor from "@/components/editor/index";
import {
uploadUrl
} from '@/utils/request'
export default {
components: {
actbians,
wangEditor
},
data() {
return {
uploadFileUrl: uploadUrl, // 请求地址
daoData: [],
actbianMsg: {},
bianshow: false, //编辑页
fileData: [],
fenlei: [],
secondData: {},
formSear: {
planName: '',
state: null,
dataOwnership: '1',
pageNumber: 1,
pageSize: 10,
isDraft: 0
},
planFen: '',
eventTheme: '',
currentPage: 1,
total: 100,
flag: false,
pageSize: 10,
ggXin: false,
radio: '1',
shan: '',
activeName: 'first',
rules: {
coDe: [{
required: true,
message: '请输入活动名称',
trigger: 'blur'
},
],
},
formInline: {
merchantName: '', // 商家名称
storeId: '', // 编码
contacts: '', // 联系人
businessEntity: '', //经营主体
page: 1, // 当前页
pageSize: 10 // 每页记录数
},
tableData: [],
id: '',
text: '123',
tableData1: [{
id: 0,
name: '类型',
planName: '',
text: '活动地点',
eventTheme: ''
}, {
id: 0,
name: '活动开始时间',
planName: '',
text: '活动结束时间',
eventTheme: ''
}, {
id: 0,
name: '活动主题',
planName: '',
text: '活动主办方',
eventTheme: ''
}, {
id: 0,
name: '活动参与方',
planName: '',
text: '活动主要目的',
eventTheme: ''
}, {
id: 0,
name: '范围设置',
planName: '',
text: '状态',
eventTheme: ''
}],
internalLaborCostEstimation: '',
externalLaborCostEstimation: '',
tableData3: [{
id: 0,
name: '商品成本预估',
planName: '',
text: '设备成本预估',
eventTheme: ''
}, {
id: 0,
name: '宣传费用预估',
planName: '',
text: '其他必要成本预估',
eventTheme: ''
}, {
id: 0,
name: '总成本预估',
planName: '',
text: '备注',
eventTheme: ''
}],
expectedAttractTraffic: '',
expectedParticipation: '',
tableData4: [{
id: 0,
name: '预计直接收益',
planName: '',
text: '预计间接收益',
eventTheme: '-'
}],
createUser: '',
createDate: '',
tableData5: [{
id: 0,
name: '更新人',
planName: '',
text: '更新时间',
eventTheme: '-'
}],
tableData2: [], //基本信息明细列表
tableData6: [], //基本信息附件列表
addMing: false, //执行效果添加明细
zhixingBian: false, //判断是否编辑执行效果
tableDa: [], //执行效果明细列表
zhiXing: true, //判断是否是新增的执行效果
mingFrom: {
detailLtemName: '',
estimatedQuantity: '',
estimatedCost: '',
notes: ''
},
planTime: [],
zhixingList: {
planTime: [],
planName: '', //活动名称
eventAddrs: '', //实际举办地点
eventStartTime: 0, //实际开始时间
eventEndTime: 0, //实际结束时间
sponsor: '', //实际主办方
participants: '', //实际参与方
internalLaborCostEstimation: '', //内部人工成本
externalLaborCostEstimation: '', //外部人工成本
costEstimationGoods: '', //商品成本
setCostEstimate: '', //设备成本
estimatedPromotionalExpenses: '', //宣传费用预估
otherNecessaryEstimates: '', //其他成本预估
totalCostEstimation: '', //总成本预估
notes: '', //备注
expectedAttractTraffic: '', //吸引流量
expectedParticipation: '', //参与人数
expectedDirectBenefits: '', //直接收益
expectedIndirectBenefits: '', //间接收益
createDate: '', //创建时间
feedbackContent: ''
}, //执行效果列表
pageindex: {
pageNumber: 1,
pageSize: 10,
dataOwnership: '1',
isDraft: 0
},
multipleSelection: [],
options: [],
xinADD: {
classificationName: '',
parentId: '',
classificationType: '0'
},
value: '',
xiaoDui: false, //效果对比
dataList: [],
fenleiDelId: null, //删除的分类ID
xiaoduiObj: {
biliOne: '0%',
bilis: 0,
biliTwo: '0%',
biliT: 0
}, //效果对比数据
fujiLei: '',
defaultProps: {
children: 'children',
label: 'classificationName'
},
copy: {
planName: ''
},
copyShow: false,
duibiOne: {},
duibiTwo: {},
searchShow: false,
searPei: {
name: true,
lei: false,
staut: false,
},
lishiList: null,
labelStyle: {
width: '197px',
height: '42px',
},
labelStyleOne: {
width: '94px',
height: '42px',
color: '#000',
},
contentClassNameOne: {
width: '219px',
padding: '9px 10px',
// height:'42px',
},
lidata: [],
lixiang: {},
duibiList: {},
tiaozhengShow: false,
jiucuoShow: false,
jiuMsg: '',
editId: '',
zhixingqingk: ''
}
},
created() {
this.getAll()
},
computed: {
},
methods: {
getStatus(state) {
switch (state) {
case '':
return '待提交';
case '1':
return '待审核';
case '2':
return '业务部审核';
case '3':
return '品牌审核';
case '4':
return '审核通过';
case '5':
return '审核不通过'
}
},
//查询全数据
async getAll() {
const res = await queryByPage(this.pageindex)
this.tableData = res.data.content
this.total = res.data.content.length
},
//删除记录按钮
handleDelete(val) {
if (this.multipleSelection.length == 1) {
const h = this.$createElement;
this.$msgbox({
title: '消息',
message: h('p', null, [
h('span', null, '是否删除 '),
]),
showCancelButton: true,
showClose: false,
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass: 'oe-dialog-btn',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
deleteById({
id: this.multipleSelection[0].id
}).then(res => {
this.getAll()
done();
})
} else {
done();
}
}
})
} else {
this.$message({
message: '请选择一个文件删除',
customClass: 'custom-message',
offset: 100
})
}
},
actDelete(item) {
const h = this.$createElement;
this.$msgbox({
title: '消息',
message: h('p', null, [
h('span', null, '是否删除 '),
]),
showCancelButton: true,
showClose: false,
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass: 'oe-dialog-btn',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
deleteById({
id: item.id
}).then(res => {
this.getAll()
done();
})
} else {
done();
}
}
})
},
//查询
async onSubmit() {
const res = await danqueryById(this.formSear)
this.tableData = res.data.content
},
//重置按钮
resetting() {
this.formSear = {
planName: '',
state: null,
dataOwnership: '1',
pageNumber: 1,
pageSize: 10,
isDraft: 0
}
this.getAll()
},
//编辑页
BianchildClose(msg) {
this.bianshow = msg
this.getAll()
},
actBian(item) {
this.actbianMsg = item
this.bianshow = true
},
//详情点击
handleEditForm(item, val, flag) {
if (val == 1) {
this.zhixingBian = flag
this.activeName = 'first'
} else if (val == 2 || flag) {
this.zhixingBian = flag
this.activeName = 'second'
} else if (val == 3) {
this.zhixingBian = flag
this.activeName = 'fourd'
}
this.liData = []
this.ggXin = true
this.editId = item.id
this.lixiang = {}
this.lishiList = null
this.fileData = []
this.zhixingList = {
planTime: [],
planName: '', //活动名称
eventAddrs: '', //实际举办地点
eventStartTime: 0, //实际开始时间
eventEndTime: 0, //实际结束时间
sponsor: '', //实际主办方
participants: '', //实际参与方
internalLaborCostEstimation: '', //内部人工成本
externalLaborCostEstimation: '', //外部人工成本
costEstimationGoods: '', //商品成本
setCostEstimate: '', //设备成本
estimatedPromotionalExpenses: '', //宣传费用预估
otherNecessaryEstimates: '', //其他成本预估
totalCostEstimation: '', //总成本预估
notes: '', //备注
expectedAttractTraffic: '', //吸引流量
expectedParticipation: '', //参与人数
expectedDirectBenefits: '', //直接收益
expectedIndirectBenefits: '', //间接收益
createDate: '', //创建时间
feedbackContent: ''
} //执行效果列表
actPage({
detailsId: item.id,
pageNumber: 1,
pageSize: 10,
}).then(res => {
console.log(res.data.content)
if (res.data.content.length == 0) {
this.zhiXing = true
} else {
mingTable({
detailsId: res.data.content[0].id,
pageNumber: 1,
pageSize: 10,
}).then(res => {
this.tableDa = res.data.content
})
this.zhiXing = false
this.zhixingList = res.data.content[0]
if ((typeof this.zhixingList.eventStartTime) == 'object' || (typeof this.zhixingList
.eventEndTime) == 'object') {
this.zhixingList.planTime = []
} else {
console.log(typeof this.zhixingList.eventStartTime)
this.zhixingList.planTime = [this.zhixingList.eventStartTime, this.zhixingList
.eventEndTime
]
}
}
})
let that = this
this.planTime = [item.eventStartTime, item.eventEndTime]
fujiaTable({
detailsId: item.id,
pageNumber: 1,
pageSize: 10,
}).then(res => {
this.tableData6 = res.data.content
})
mingTable({
detailsId: item.id,
pageNumber: 1,
pageSize: 10,
}).then(res => {
this.tableData2 = res.data.content
})
danqueryById({
id: item.id,
dataOwnership: '1',
pageNumber: 1,
pageSize: 10,
}).then(res => {
this.secondData = res.data.content[0]
//基本信息
// that.id=res.data.content[0].id
that.text = res.data.content[0].planName
that.tableData1[0].eventTheme = res.data.content[0].planType
that.tableData1[0].planName = res.data.content[0].eventAddrs
that.tableData1[1].eventTheme = res.data.content[0].eventStartTime
that.tableData1[1].planName = res.data.content[0].eventEndTime
that.tableData1[2].eventTheme = res.data.content[0].eventTheme
that.tableData1[2].planName = res.data.content[0].sponsor
that.tableData1[3].eventTheme = res.data.content[0].participants
that.tableData1[3].planName = res.data.content[0].mainPurpose
that.tableData1[4].planName = this.getStatus(res.data.content[0].state)
that.tableData1[4].eventTheme = res.data.content[0].rangeSetting
//活动成本信息
that.internalLaborCostEstimation = res.data.content[0].internalLaborCostEstimation
that.externalLaborCostEstimation = res.data.content[0].externalLaborCostEstimation
that.tableData3[0].eventTheme = res.data.content[0].costEstimationGoods
that.tableData3[0].planName = res.data.content[0].setCostEstimate
that.tableData3[1].eventTheme = res.data.content[0].estimatedPromotionalExpenses
that.tableData3[1].planName = res.data.content[0].otherNecessaryEstimates
that.tableData3[2].eventTheme = res.data.content[0].totalCostEstimation
that.tableData3[2].planName = res.data.content[0].notes
//预估效果
that.expectedAttractTraffic = res.data.content[0].expectedAttractTraffic
that.expectedParticipation = res.data.content[0].expectedParticipation
that.tableData4[0].eventTheme = res.data.content[0].expectedDirectBenefits
that.tableData4[0].planName = res.data.content[0].expectedIndirectBenefits
//系统信息
that.createUser = res.data.content[0].createUser
that.createDate = res.data.content[0].createDate
that.tableData5[0].planName = '-'
that.tableData5[0].eventTheme = res.data.content[0].updateUser
}).catch(err => {
console.log(err)
})
if (!item) {
this.formItem = {}
} else {
this.formItem = item
}
lishiDeta({
eventDetailsId: item.id
}).then(res => {
this.liData = res.data
})
},
formTime(data) {
this.zhixingList.planTime = data
},
removeEmptyValues(obj) {
if (typeof obj !== 'object' || obj === null) {
return obj;
}
const newObj = Array.isArray(obj) ? [] : {};
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
const value = obj[key];
if (value !== null && value !== undefined && value !== '' && !this.isEmptyObject(value)) {
if (Array.isArray(newObj)) {
newObj.push(this.removeEmptyValues(value));
} else {
newObj[key] = this.removeEmptyValues(value);
}
}
}
}
return newObj;
},
isEmptyObject(obj) {
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
//获取当前时间
updateCurrentTime() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0');
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
handleCurrentChange(val) {
this.currentPage = val
},
handleSizeChange(val) {
this.pageSize = val
},
closeFn() {
this.ggXin = false
},
handleClick(val) {
console.log(val)
if (val == 'foud') {
lishiDeta({
eventDetailsId: item.id
}).then(res => {
this.liData = res.data
})
}
},
refreshData() {
// console.log('12123')
this.tableDa = []
this.activeName = 'first'
this.zhixingBian = false
},
reshData() {
this.tableDa = []
this.tiaozhengShow = false
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
toggleSelection(rows) {
if (rows) {
rows.forEach(row => {
this.$refs.mulTable.toggleRowSelection(row);
});
}
},
tableAll() {
this.$refs.mulTable.clearSelection(); // 清除所有选项
const allRows = this.$refs.mulTable.data; // 获取所有行数据
allRows.forEach(row => {
this.$refs.mulTable.toggleRowSelection(row, true); // 全选所有项
});
},
TabClick(tab, event) {
console.log(tab, event)
if (tab.index == '0') {
this.getAll()
} else {
this.tableData = []
}
},
minSev() {
if (this.zhiXing) {
this.tableDa.push(this.mingFrom)
} else {
this.mingFrom.detailsId = this.zhixingList.id
MingAdd(this.mingFrom).then(res => {
this.mingcha(this.zhixingList.id)
})
}
this.mingFrom = {
detailLtemName: '',
estimatedQuantity: '',
estimatedCost: '',
notes: ''
}
this.addMing = false
},
// 查询执行明细
mingcha(id) {
mingTable({
detailsId: id,
pageNumber: 1,
pageSize: 10
}).then(res => {
this.tableDa = res.data.content
})
},
MingDelete(index, item) {
const h = this.$createElement;
this.$msgbox({
title: '消息',
message: h('p', null, [
h('span', null, '是否删除 '),
]),
showCancelButton: true,
showClose: false,
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass: 'oe-dialog-btn',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
if (this.zhiXing) {
this.tableDa.splice(item, 1);
} else {
MingDel({
id: item.id
}).then(res => {
this.mingcha(this.zhixingList.id)
})
}
done();
} else {
done();
}
}
})
},
tianMing() {
if (this.zhixingBian) {
this.addMing = true
}
},
duibi() {
if (this.multipleSelection.length == 1) {
this.xiaoDui = true
this.duibiOne = this.multipleSelection[0]
console.log(this.multipleSelection[0])
let that = this
actPage({
detailsId: this.multipleSelection[0].id,
pageNumber: 1,
pageSize: 10,
}).then(res => {
this.duibiTwo = res.data.content[0] === undefined ? {} : res.data.content[0];
console.log(this.duibiTwo)
if (res.data.content[0] === undefined || res.data.content[0].totalCostEstimation == '') {
that.xiaoduiObj.biliTwo = '0%'
that.xiaoduiObj.biliT = 0
} else {
that.xiaoduiObj.biliT = that.duibiTwo.internalLaborCostEstimation / that.duibiTwo
.totalCostEstimation * 100
that.xiaoduiObj.biliTwo =
`${Math.round(that.duibiTwo.internalLaborCostEstimation / that.duibiTwo.totalCostEstimation*100)}%`
}
})
if (that.duibiOne.totalCostEstimation == '') {
that.xiaoduiObj.biliOne = '0%'
that.xiaoduiObj.bilis = 0
} else {
that.xiaoduiObj.bilis = that.duibiOne.internalLaborCostEstimation / that.duibiOne
.totalCostEstimation * 100
that.xiaoduiObj.biliOne =
`${Math.round(that.duibiOne.internalLaborCostEstimation / that.duibiOne.totalCostEstimation*100)}%`
}
} else {
this.$message({
message: '请选择一个文件对比',
customClass: 'custom-message',
offset: 100
})
}
},
koop(item) {
this.copy.id = item.id
this.copyShow = true
},
copyClose() {
this.copyShow = false
this.copy.planName = ''
},
copysev() {
if (this.copy.planName == '') {
this.$message({
message: '请填写数据',
customClass: 'custom-message',
offset: 100
})
return;
} else {
copy(this.copy).then(res => {
this.copyShow = false
this.getAll()
})
}
},
fenleiChange(value) {
this.xinADD.parentId = value[value.length - 1]
},
customFormat(percentage) {
let zong
if (percentage == undefined || percentage === null || percentage == '') {
percentage = 0
zong = 10000
}
return `${percentage} / ${percentage==''?zong:parseInt(percentage) *10}`;
},
baifenbi(item) {
let zong
if (item == undefined || item === null || item == '') {
item = 0
zong = 10000
return Math.round(item / (item * 10) * 100);
} else {
return Math.round(item / zong * 100);
}
},
handleUploadSuccess(response, file, fileList) {
const fileMsg = {
name: file.name,
url: file.response.data.url,
}
// 将文件地址存储在 uploadedFiles 数组中
this.fileData.push(fileMsg);
},
handleRemove() {
this.fileData = []
},
daoru(response, file, fileList) {
this.daoData.push(file.raw)
const formDate = new FormData()
formDate.append('file', this.daoData[0])
excelAdd(formDate).then(res => {
this.getAll()
})
},
async daochu() {
let res = await excelQueryByPage(this.pageindex)
if (!res) {
return
}
const blob = new Blob([res], {
type: 'application/vnd.ms-excel'
})
const fileName = '审核流程.xls'
if ('download' in document.createElement('a')) {
// 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else {
// IE10+下载
navigator.msSaveBlob(blob, fileName)
}
this.$message({
message: '导出成功',
type: 'success'
})
},
// 下载
async downloadPdf() {
const content = this.$refs.actXiang
console.log(content)
// return
// 使用 html2canvas 将 div 渲染为画布
const canvas = await html2canvas(content)
// 获取画布的图像数据
const imgData = canvas.toDataURL('image/png')
// return
// console.log(imgData,'图片11111')
// 创建一个新的 PDF 文档
const pdf = new jsPDF('p', 'mm', 'a4')
// 添加图像到 PDF,第二个参数是图像格式,第三个参数是缩放比例
const imgWidth = 190; // 图像的宽度(mm)
const imgHeight = (canvas.height * imgWidth) / canvas.width // 保持图像的宽高比
console.log(canvas.height, canvas.width,'imgWidth, imgHeight')
console.log(imgWidth, imgHeight,'imgWidth, imgHeight')
pdf.addImage(imgData, 'PNG', 10, 10, imgWidth, imgHeight) // 10, 10 是图像在 PDF 中的位置(mm)
// 保存 PDF 文件
pdf.save('活动方案.pdf');
},
// 下载
async lishidownloadPdf() {
const content = this.$refs.lishiRef;
// 使用 html2canvas 将 div 渲染为画布
const canvas = await html2canvas(content);
// 获取画布的图像数据
const imgData = canvas.toDataURL('image/png');
// 创建一个新的 PDF 文档
const pdf = new jsPDF('p', 'mm', 'a4');
// 添加图像到 PDF,第二个参数是图像格式,第三个参数是缩放比例
const imgWidth = 190; // 图像的宽度(mm)
const imgHeight = (canvas.height * imgWidth) / canvas.width; // 保持图像的宽高比
pdf.addImage(imgData, 'PNG', 10, 10, imgWidth, imgHeight); // 10, 10 是图像在 PDF 中的位置(mm)
// 保存 PDF 文件
pdf.save('历史方案.pdf');
},
setSearch() {
this.searchShow = true
},
lichange(e) {
this.lishiList = e
let msg = this.liData[e]
this.duibiList = JSON.parse(msg.modifyContent)
this.lixiang = JSON.parse(msg.originalData)
},
tiaozheng() {
this.tiaozhengShow = true
},
jiucuo() {
this.jiuMsg = ''
this.jiucuoShow = true
},
jiuCheck() {
xiangedit({
id: this.editId,
isErrorCorrection: this.jiuMsg
}).then(res => {
this.jiucuoShow = false
})
},
//执行效果保存
async bianji() {
if (this.fileData.length != 0) {
this.zhixingList.feedbackContent = this.fileData[0].url
}
if (this.zhiXing) {
this.zhixingList.eventStartTime = this.zhixingList.planTime[0]
this.zhixingList.eventEndTime = this.zhixingList.planTime[1]
this.zhixingList.detailsId = this.secondData.id
this.zhixingList.createDate = this.updateCurrentTime()
actAdd(this.zhixingList).then(res => {
for (let i = 0; i < this.tableDa.length; i++) {
this.tableDa[i].detailsId = res.data.id
MingAdd(this.tableDa[i]).then(res => {
this.$message({
message: '保存成功',
type: 'success'
})
})
}
})
} else {
let that = this
Vue.delete(that.zhixingList, 'createDate')
this.zhixingList.eventStartTime = this.zhixingList.planTime[0]
this.zhixingList.eventEndTime = this.zhixingList.planTime[1]
Vue.delete(that.zhixingList, 'planTime')
this.zhixingList.updateDate = ''
await actEdit(this.zhixingList)
this.$message({
message: '保存成功',
type: 'success'
})
}
this.ggXin = false
this.getAll()
},
searchQuit() {
this.searPei = {
name: true,
lei: false,
staut: false,
}
this.searchShow = false
},
}
}
</script>