Commit ffeada69 by jml0128

feat:增加数字问卷bi

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