20-configurable.vue
12.6 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
<!--
* @Description:
* @Date: 2021-06-17 20:27:04
-->
<template>
<div class="bi-configurable">
<BiCover
:coverContent="coverContent"
ref="cover"
:coverList="coverList"
:coverId="coverId"
:coverUrl="coverUrl"
@change="
({ id, templatePicUrl }) => {
coverId = id;
coverUrl = templatePicUrl;
}
"
></BiCover>
<BiCatalogue class="bi-block" :catalogueArr="catalogueArr"></BiCatalogue>
<BiOverview
class="bi-block"
name="项目总览"
:title="projectName"
:data="baseInfo"
:textWrap="true"
></BiOverview>
<BiMission
class="bi-block"
name="项目执行任务模块"
:data="missionData"
@page="setPage(arguments, 'page1')"
></BiMission>
<BiSingleChoice
v-if="showSingleChoice.length > 0"
class="bi-block no-border"
:singleChoice="showSingleChoice"
:pageWrap="true"
@sort="sort(arguments, 'singleChoice', hideSingleChoice)"
@page="setPage(arguments, 'page2')"
>
<BiSingleChoiceInfo
index="3"
name="项目相关调研模块"
:info="textData"
></BiSingleChoiceInfo>
</BiSingleChoice>
<BiSingleChoice
v-if="showSingleChoiceMixin.length > 0"
class="bi-block no-border"
:singleChoice="showSingleChoiceMixin"
:pageWrap="true"
@sort="sort(arguments, 'singleChoiceMixin', hideSingleChoiceMixin)"
@page="setPage(arguments, 'page3', 'page3Info')"
></BiSingleChoice>
<BiCoverEnd title="奇正藏药医学沙龙推广项目数据报告"></BiCoverEnd>
<BiOperate
:questionData="[...singleChoice, ...singleChoiceMixin]"
:saveInfo="saveInfo"
:exportBi="exportBi"
></BiOperate>
</div>
</template>
<script>
import BiSingleChoiceInfo from '../components/singleChoiceInfo.vue';
import BiCover from '../components/cover.vue';
import BiCatalogue from '../components/catalogue.vue';
import BiOverview from '../components/overview.vue';
import BiMission from '../components/mission.vue';
import BiSingleChoice from '../components/singleChoice.vue';
import BiCoverEnd from '../components/cover-end.vue';
import BiOperate from '../components/operate.vue';
import mixin, { printWidth } from '../mixin/index';
/**
* dealSingleChoice、sort、setPage
*/
import project from '../mixin/project';
import { chartConfig } from '../mock/index';
import { date } from '../chart-type/common';
const ChartConfigFn = chartConfig();
import {
dealAxis,
dealLegends,
randomType,
chartConfigToSetInfo
} from './tools';
export default {
name: 'bi-configurable',
mixins: [mixin, project],
components: {
BiCover,
BiCatalogue,
BiOverview,
BiMission,
BiSingleChoice,
BiSingleChoiceInfo,
BiCoverEnd,
BiOperate
},
data() {
return {
page1: 0,
page2: 0,
page3Info: [],
singleChoice: [],
singleChoiceMixin: [],
missionData: [],
coverId: 0,
coverUrl: '',
coverContent: [],
coverList: [],
projectName: '',
baseInfo: [],
textData: [],
biInfo: {}
};
},
computed: {
catalogueArr() {
const { page1 = 0, page2 = 0, page3Info = [] } = this;
return [
{
name: '项目总览',
child: [
{
name: '项目总览',
page: 1
}
]
},
{
name: '项目执行任务模块',
child: [
// {
// name: '任务量分析',
// page: page1 + 1
// },
{
name: '执行任务人员画像',
page: page1 + 1
},
{
name: '项目参与人完成任务区间分布',
page: page1 + 1
}
]
},
{
name: '项目相关调研模块',
child: [
{
name: '单因素分析',
page: page1 + 2
},
...page3Info
.filter(item => item.name)
.map(item => {
return {
...item,
page: page1 + 1 + page2 + item.page
};
})
]
}
];
},
showSingleChoice() {
return this.dealSingleChoice(this.singleChoice);
},
hideSingleChoice() {
return this.dealSingleChoice(this.singleChoice, true);
},
showSingleChoiceMixin() {
return this.dealSingleChoice(this.singleChoiceMixin);
},
hideSingleChoiceMixin() {
return this.dealSingleChoice(this.singleChoiceMixin, true);
}
},
methods: {
dealPos(dis) {
return dis * (this.isPrint ? printWidth : this.baseFontSize);
},
dealBaseInfo(info) {
const {
id,
coverTemplateId, // 模板ID
coverTemplateUrl = '',
styleConfigureId, // 配置ID
title,
titlePosition,
aspEnterpriseNameWrite,
aspNamePosition,
styleConfigureSettlementTime,
styleConfigureSettlementTimePosition,
projectName = '-',
sendEnterpriseName = '-',
aspEnterpriseName = '-',
settlementTime,
taskSum,
executePeopleNumber,
dataCollectNumber,
examinePeopleNumber,
createDt,
totalTopicNum,
chooseTopicNum,
isContrainGroupAnalyse,
isContrainSingleAnalyse
} = info;
this.biInfo = {
biInfoId: id,
styleConfigureId
};
this.coverId = coverTemplateId;
this.coverUrl = coverTemplateUrl;
const biCreateDt = date.dateFormat(createDt, 'Y-M-D');
this.projectName = `${projectName}${biCreateDt}服务报告`;
this.coverContent = [
{
name: title,
pos: titlePosition
},
{
name: styleConfigureSettlementTime,
pos: styleConfigureSettlementTimePosition
},
{
name: aspEnterpriseNameWrite,
pos: aspNamePosition
}
];
this.baseInfo = [
[
{
name: '项目名称',
value: projectName
},
{
name: '发起方',
value: sendEnterpriseName
},
{
name: '服务商',
value: aspEnterpriseName
}
],
[
{
name: '提交时间',
value: settlementTime
},
{
name: '任务数量',
value: taskSum
},
{
name: '项目执行人数',
value: `${executePeopleNumber}人`
}
],
[
{
name: '数据收集数',
value: `${dataCollectNumber}条`
},
{
name: '参与调研样本',
value: `${examinePeopleNumber}份`
},
{
name: '报表生成时间',
value: biCreateDt
}
]
];
this.textData = [
[
{
name: '总参与题目:',
value: `${totalTopicNum}题`
},
{
name: '当前选取报告输出题目:',
value: `${chooseTopicNum}题`
}
],
[
{
name: '总参与数(人或者机构):',
value: executePeopleNumber
},
{
name: '分析维度:',
value: [
{ show: isContrainSingleAnalyse, name: '主体分析' },
{ show: isContrainGroupAnalyse, name: '交叉分析' }
]
.filter(item => item.show == 1)
.map(item => item.name)
.join('+')
}
]
];
},
dealFixedInfo(infoArr) {
// eslint-disable-next-line no-unused-vars
const [group1 = {}, group2 = {}, group3 = {}, group4 = {}] = infoArr;
this.missionData = [
ChartConfigFn.createConfig(dealAxis(group1.fixedCountInfos), {
...group1,
chartType: group1.chartType || 12,
legends: dealLegends(group1.fixedCountInfos, '性'),
blockTitle: '参与任务执行的性别分布',
legendName: '总参与项目执行人数${num}人',
hideDesc: true,
hideDelete: true,
dontContenteditable: true,
width: 520,
height: 350,
disableTypes: [3, 4],
extendTypes: [12]
}),
ChartConfigFn.createConfig(dealAxis(group2.fixedCountInfos), {
...group2,
chartType: group2.chartType || 1,
legends: dealLegends(group2.fixedCountInfos),
blockTitle: '执行任务的年龄段',
legendName: '总参与项目执行人数${num}人',
hideDesc: true,
hideDelete: true,
dontContenteditable: true,
width: 520,
height: 350,
disableTypes: [3, 4]
}),
ChartConfigFn.createConfig([], {
...group4,
resultSystem: `${group1.resultSystem},${group2.resultSystem}`,
hideLegend: true,
hideChart: true,
hideTitle: true
}),
ChartConfigFn.createConfig(dealAxis(group3.fixedCountInfos), {
...group3,
chartType: group3.chartType || 2,
legends: dealLegends(group3.fixedCountInfos),
blockTitle: '项目参与人完成任务区间分布',
legendName: '总参与项目执行人数${num}人',
hideDelete: true,
dontContenteditable: true,
height: 400,
disableTypes: [3, 4]
})
];
},
dealChoice(arr) {
this.singleChoice = arr
.map(item => {
return ChartConfigFn.createConfig(dealAxis(item.topicCountInfos), {
...item,
blockTitle: item.topicTitle,
chartType: item.chartType || randomType([1, 2, 5, 6, 9, 10, 11]),
disableTypes: [3, 4]
});
})
.sort((a, b) => {
if (a.sort < b.sort) {
return -1;
}
});
},
dealChoiceMixin(arr) {
this.singleChoiceMixin = arr
.map(item => {
return ChartConfigFn.createConfig(dealAxis(item.topicCountInfos), {
...item,
xAxisName: item.title,
yAxisName: item.secondTitle,
isGroup: true,
dontContenteditable: true,
toggleAxisContenteditable: true,
blockTitle: `${item.xFactor}因素与${item.yFactor}因素相关性分析`,
chartType:
item.chartType || randomType([1, 2, 3, 4, 5, 6, 9, 10, 11])
});
})
.sort((a, b) => {
if (a.sort < b.sort) {
return -1;
}
});
},
saveInfo() {
const { biInfoId, styleConfigureId } = this.biInfo;
const { content } = this.$refs['cover'];
return this.Bi.saveInfo({
biInfoId: biInfoId,
commandType: 2,
biStyleConfigureInfo: {
aspEnterpriseNameWrite: content[2].name || '', //乙方封面名称
aspNamePosition: JSON.stringify(content[2].pos), //乙方封面名称位置
styleConfigId: styleConfigureId, //封面配置ID
coverTemplateId: this.coverId, //封面ID
settlementTime: content[1].name || '', //封面时间
settlementTimePosition: JSON.stringify(content[1].pos), //封面时间位置
title: content[0].name || '', //封面标题
titlePosition: JSON.stringify(content[0].pos) //标题位置
},
makeSceneFixedDetailInfos: chartConfigToSetInfo(this.missionData),
makeSceneStyleConfigureTopicDetailInfos: chartConfigToSetInfo(
this.singleChoice
),
makeSceneGroupDetails: chartConfigToSetInfo(this.singleChoiceMixin)
});
},
exportBi() {
window.open(this.Bi.exportBi(), '_blank');
}
},
created() {
Promise.all([
this.Bi.getBaseInfo(),
this.Bi.getFixedInfo(),
this.Bi.getTopicInfo(),
this.Bi.getGroupInfo(),
this.Bi.getTemplateList()
])
.then(
([
baseInfo,
fixedInfo,
topicInfo,
topicMixinInfo,
tempaletList = { data: { data: [] } }
]) => {
this.dealBaseInfo(baseInfo.data.data[0] || {});
this.dealFixedInfo(fixedInfo.data.data || []);
this.dealChoice(topicInfo.data.data || []);
this.dealChoiceMixin(topicMixinInfo.data.data || []);
this.coverList = tempaletList.data.data || [];
window.status = '1';
}
)
.catch(() => {
window.status = '1';
});
}
};
</script>
<style lang="scss" scoped>
.bi-block {
margin-top: 8px;
}
</style>