Commit ffeada69 by jml0128

feat:增加数字问卷bi

1 parent e7e4d9f8
{
"name": "xrk-bi",
"version": "0.2.0",
"version": "0.2.1",
"description": "xrk-bi",
"author": "xrk",
"main": "dist/bundler.js",
......@@ -32,7 +32,6 @@
},
"devDependencies": {
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/composition-api": "^1.0.0-rc.11",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-core": "^6.26.0",
......
......@@ -119,5 +119,12 @@ export default {
sort: 1,
icon: '',
create: createMapScatter
},
// 表格
15: {
name: 'article',
cnName: '图文',
sort: 1,
icon: 'http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/biaoge.svg'
}
};
<!--
* @Description:
* @Date: 2022-04-20 15:31:47
-->
<!--
* @Description: file content
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-04-20 15:50:05
-->
<template>
<div>
<BiBlank height="40" :usePrint="true"></BiBlank>
<div v-html="content"></div>
<BiBlank height="40" :usePrint="true"></BiBlank>
</div>
</template>
<script>
import BiBlank from './blank.vue';
export default {
name: 'bi-sex-icon',
components: { BiBlank },
props: {
title: {
type: String,
default: ''
},
content: {
type: String,
default: ''
}
},
data() {
return {
option: {}
};
},
created() {}
};
</script>
<style lang="scss" scoped>
.bi-sex-icon {
text-align: center;
padding-top: 110px;
height: 350px;
&_item {
display: inline-block;
margin: 0 45px;
p {
margin-top: 15px;
}
}
}
</style>
......@@ -93,13 +93,14 @@ export default {
this.myChart = init(document.getElementById(this.uuid));
}
const { option, myChart } = this;
const maxLength = option.series[0].data.length;
const cloneArr = [...option.series[0].data];
const f = (option.series || [])[0] || { data: [] };
const maxLength = f.data.length;
const cloneArr = [...f.data];
if (maxLength > 200) {
const setData = (_myChart, startIndex) => {
const endIndex = startIndex + 200;
if (startIndex == 0) {
option.series[0].data = cloneArr.slice(startIndex, endIndex);
f.data = cloneArr.slice(startIndex, endIndex);
_myChart.setOption(option);
} else {
_myChart.appendData({
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-28 21:17:43
* @LastEditTime: 2022-04-20 15:36:43
-->
<template>
<div style="position:relative;" class="bi-chart-block">
......@@ -44,6 +44,7 @@
}"
></BiTable>
<BiSexIcon v-else-if="chart.type == 12" v-bind="chart"></BiSexIcon>
<BiArticle v-else-if="chart.type == 15" v-bind="baseInfo"></BiArticle>
<BiChart :showGuide="showGuide" v-else v-bind="chart"></BiChart>
</template>
<BiChartLegend
......@@ -78,6 +79,7 @@ import BiTable from './table.vue';
import BiSexIcon from './sex-icon.vue';
import BiChartLegend from './chart-legend.vue';
import BiChartDesc from './chart-desc.vue';
import BiArticle from './article.vue';
import BiChartChoiceMinxinToggleAxis from './chart-choice-mixin-toggle-axis.vue';
import BiChartChoiceMinxinAnalysis from './chart-choice-mixin-analysis.vue';
......@@ -89,6 +91,7 @@ export default {
BiChart,
BiTable,
BiSexIcon,
BiArticle,
BiChartDesc,
BiChartLegend,
BiChartChoiceMinxinToggleAxis,
......@@ -108,6 +111,9 @@ export default {
analysisDesc() {
return this.chartConfig.analysisDesc || {};
},
baseInfo() {
return this.chartConfig.baseInfo || {};
},
chart() {
return this.chartConfig.chart || {};
},
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-07-28 21:34:18
* @LastEditTime: 2022-04-20 13:35:29
-->
<template>
<div :style="{ height: `${(cHeight + 80) * zoom}px`, zoom: 1 / zoom }">
......
......@@ -15,6 +15,7 @@
<div ref="print-area">
<div
class="print-item"
:class="item.className"
v-for="(item, index) in scaleDomsInfo.items"
:key="index"
:style="{
......@@ -133,6 +134,7 @@ export default {
type: Array,
default: () => []
},
printInfo: Boolean,
pageWrap: Boolean,
disabled: Boolean
},
......@@ -247,10 +249,17 @@ export default {
return Math.min(baseHeight / height, 1);
};
const newDom = (this.$refs['bi-single-choice_item'] || []).reduce(
(pre, cur) => {
(pre, cur, index) => {
const { $el } = cur;
const { offsetHeight } = $el;
const domUsePage = parseInt(offsetHeight / (baseHeight * baseScale));
if (this.printInfo) {
console.log(topDom, cur);
}
let className = 'print-item';
if (index == 0 && cur.chart.type == 15) {
className = 'print-item nowarp';
}
if (pre.height + offsetHeight < baseHeight * baseScale) {
// 当前dom高度加上历史高度 小于 A4纸高度的1.15倍
if (pre.height === 0) {
......@@ -271,6 +280,7 @@ export default {
pre.totalPage += Math.max(domUsePage, 1);
pre.height = offsetHeight;
pre.items.push({
className,
allHeight: offsetHeight,
scale: domUsePage === 0 ? cScale(offsetHeight) : 1,
chartConfigs: [cur.chartConfig]
......@@ -299,6 +309,9 @@ export default {
catalogueInfoArr: []
}
);
if (this.printInfo) {
console.log(newDom);
}
this.scaleDomsInfo = newDom;
this.$emit('page', {
pageSize: newDom.totalPage,
......@@ -329,6 +342,18 @@ export default {
}
};
</script>
<style lang="scss">
.print-item {
&.nowarp {
.bi-chart-block {
background: #fff;
& > div {
page-break-inside: inherit;
}
}
}
}
</style>
<style lang="scss" scoped>
.print-item {
......@@ -339,6 +364,9 @@ export default {
// page-break-before: auto;
// page-break-inside: avoid;
// }
&.nowarp {
page-break-before: inherit;
}
}
.bi-single-choice {
// page-break-before: always;
......
......@@ -73,6 +73,8 @@ export default {
&.one {
padding-left: 60px;
padding-top: 23px;
text-align: center;
padding-left: 130px;
& > div {
width: inherit;
& + div {
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-02-26 15:38:10
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-09-08 15:00:42
* @LastEditTime: 2022-04-20 13:26:04
-->
<template>
<div class="xrk-components-bi bi" :class="{ 'bi-print': print }">
......@@ -18,6 +18,9 @@
<BiZoneMobile v-if="mobile"></BiZoneMobile>
<BiZone v-else></BiZone>
</template>
<template v-if="projectType == 21">
<BiDigitalQuestionnaire></BiDigitalQuestionnaire>
</template>
<template v-if="projectType == 2" name="otc拜访">
<BiOtc></BiOtc>
</template>
......@@ -39,6 +42,7 @@ import BiZoneMobile from './project/6-zone-mobile.vue';
import BiOtc from './project/2-otc.vue';
import BiJcyl from './project/10-jcyl.vue';
import BiGradeHospital from './project/9-gradeHospital.vue';
import BiDigitalQuestionnaire from './project/21-digitalQuestionnaire.vue';
export default {
name: 'XrkBi',
......@@ -91,7 +95,8 @@ export default {
BiZoneMobile,
BiOtc,
BiJcyl,
BiGradeHospital
BiGradeHospital,
BiDigitalQuestionnaire
},
methods: {
setFontSize() {
......
......@@ -16,7 +16,7 @@ const dealStr = (str, unit = '') => {
export const dealAxis = (arr = [], unit = '', lastUnit = '') => {
return arr.map((item, index) => {
const isLast = index === arr.length - 1;
const xName = item.genderType || item.xTopicName;
const xName = item.genderType || item.xTopicName || item.optionName;
return {
x: xName ? dealStr(xName, isLast ? lastUnit : unit) : '-',
y: item.yTopicName,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!