Commit 0d805885 by jml0128

联调可配置场景接口

1 parent e02d81d6
......@@ -1311,6 +1311,14 @@
"integrity": "sha1-1h9G2DslGSUOJ4Ta9bCUeai0HFk=",
"dev": true
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.nlark.com/axios/download/axios-0.21.1.tgz?cache=0&sync_timestamp=1618847188301&other_urls=https%3A%2F%2Fregistry.nlark.com%2Faxios%2Fdownload%2Faxios-0.21.1.tgz",
"integrity": "sha1-IlY0gZYvTWvemnbVFu8OXTwJsrg=",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-code-frame/download/babel-code-frame-6.26.0.tgz",
......@@ -2281,11 +2289,29 @@
"isarray": "^1.0.0"
}
},
"buffer-alloc": {
"version": "1.2.0",
"resolved": "https://registry.nlark.com/buffer-alloc/download/buffer-alloc-1.2.0.tgz",
"integrity": "sha1-iQ3ZDZI6hz4I4Q5f1RpX5bfM4Ow=",
"requires": {
"buffer-alloc-unsafe": "^1.1.0",
"buffer-fill": "^1.0.0"
}
},
"buffer-alloc-unsafe": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/buffer-alloc-unsafe/download/buffer-alloc-unsafe-1.1.0.tgz",
"integrity": "sha1-vX3CauKXLQ7aJTvgYdupkjScGfA="
},
"buffer-fill": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/buffer-fill/download/buffer-fill-1.0.0.tgz",
"integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
},
"buffer-from": {
"version": "1.1.1",
"resolved": "https://registry.nlark.com/buffer-from/download/buffer-from-1.1.1.tgz",
"integrity": "sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8=",
"dev": true
"integrity": "sha1-MnE7wCj3XAL9txDXx7zsHyxgcO8="
},
"buffer-indexof": {
"version": "1.1.1",
......@@ -3357,6 +3383,11 @@
}
}
},
"dijkstrajs": {
"version": "1.0.2",
"resolved": "https://registry.nlark.com/dijkstrajs/download/dijkstrajs-1.0.2.tgz",
"integrity": "sha1-LkjA07glRir+datK1egpyOzjYlc="
},
"dir-glob": {
"version": "2.2.2",
"resolved": "https://registry.nlark.com/dir-glob/download/dir-glob-2.2.2.tgz",
......@@ -7983,6 +8014,11 @@
"semver-compare": "^1.0.0"
}
},
"pngjs": {
"version": "3.4.0",
"resolved": "https://registry.npm.taobao.org/pngjs/download/pngjs-3.4.0.tgz",
"integrity": "sha1-mcp9clll+2VYFOr2XzjxK72/VV8="
},
"portfinder": {
"version": "1.0.28",
"resolved": "https://registry.npm.taobao.org/portfinder/download/portfinder-1.0.28.tgz",
......@@ -8689,6 +8725,181 @@
"resolved": "https://registry.npm.taobao.org/q/download/q-1.5.1.tgz",
"integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc="
},
"qrcode": {
"version": "1.4.4",
"resolved": "https://registry.nlark.com/qrcode/download/qrcode-1.4.4.tgz",
"integrity": "sha1-8MQ1aKfnUQpV78O4jZYC9xlj6oM=",
"requires": {
"buffer": "^5.4.3",
"buffer-alloc": "^1.2.0",
"buffer-from": "^1.1.1",
"dijkstrajs": "^1.0.1",
"isarray": "^2.0.1",
"pngjs": "^3.3.0",
"yargs": "^13.2.4"
},
"dependencies": {
"ansi-regex": {
"version": "4.1.0",
"resolved": "https://registry.nlark.com/ansi-regex/download/ansi-regex-4.1.0.tgz",
"integrity": "sha1-i5+PCM8ay4Q3Vqg5yox+MWjFGZc="
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.nlark.com/ansi-styles/download/ansi-styles-3.2.1.tgz?cache=0&sync_timestamp=1618995778321&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fansi-styles%2Fdownload%2Fansi-styles-3.2.1.tgz",
"integrity": "sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=",
"requires": {
"color-convert": "^1.9.0"
}
},
"buffer": {
"version": "5.7.1",
"resolved": "https://registry.npm.taobao.org/buffer/download/buffer-5.7.1.tgz",
"integrity": "sha1-umLnwTEzBTWCGXFghRqPZI6Z7tA=",
"requires": {
"base64-js": "^1.3.1",
"ieee754": "^1.1.13"
}
},
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.nlark.com/camelcase/download/camelcase-5.3.1.tgz",
"integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA="
},
"cliui": {
"version": "5.0.0",
"resolved": "https://registry.npm.taobao.org/cliui/download/cliui-5.0.0.tgz",
"integrity": "sha1-3u/P2y6AB4SqNPRvoI4GhRx7u8U=",
"requires": {
"string-width": "^3.1.0",
"strip-ansi": "^5.2.0",
"wrap-ansi": "^5.1.0"
}
},
"emoji-regex": {
"version": "7.0.3",
"resolved": "https://registry.nlark.com/emoji-regex/download/emoji-regex-7.0.3.tgz",
"integrity": "sha1-kzoEBShgyF6DwSJHnEdIqOTHIVY="
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.nlark.com/find-up/download/find-up-3.0.0.tgz?cache=0&sync_timestamp=1618847130383&other_urls=https%3A%2F%2Fregistry.nlark.com%2Ffind-up%2Fdownload%2Ffind-up-3.0.0.tgz",
"integrity": "sha1-SRafHXmTQwZG2mHsxa41XCHJe3M=",
"requires": {
"locate-path": "^3.0.0"
}
},
"get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.nlark.com/get-caller-file/download/get-caller-file-2.0.5.tgz",
"integrity": "sha1-T5RBKoLbMvNuOwuXQfipf+sDH34="
},
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.nlark.com/is-fullwidth-code-point/download/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
},
"isarray": {
"version": "2.0.5",
"resolved": "https://registry.npm.taobao.org/isarray/download/isarray-2.0.5.tgz",
"integrity": "sha1-ivHkwSISRMxiRZ+vOJQNTmRKVyM="
},
"locate-path": {
"version": "3.0.0",
"resolved": "https://registry.npm.taobao.org/locate-path/download/locate-path-3.0.0.tgz",
"integrity": "sha1-2+w7OrdZdYBxtY/ln8QYca8hQA4=",
"requires": {
"p-locate": "^3.0.0",
"path-exists": "^3.0.0"
}
},
"p-limit": {
"version": "2.3.0",
"resolved": "https://registry.nlark.com/p-limit/download/p-limit-2.3.0.tgz",
"integrity": "sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=",
"requires": {
"p-try": "^2.0.0"
}
},
"p-locate": {
"version": "3.0.0",
"resolved": "https://registry.nlark.com/p-locate/download/p-locate-3.0.0.tgz",
"integrity": "sha1-Mi1poFwCZLJZl9n0DNiokasAZKQ=",
"requires": {
"p-limit": "^2.0.0"
}
},
"p-try": {
"version": "2.2.0",
"resolved": "https://registry.nlark.com/p-try/download/p-try-2.2.0.tgz",
"integrity": "sha1-yyhoVA4xPWHeWPr741zpAE1VQOY="
},
"require-main-filename": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/require-main-filename/download/require-main-filename-2.0.0.tgz",
"integrity": "sha1-0LMp7MfMD2Fkn2IhW+aa9UqomJs="
},
"string-width": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/string-width/download/string-width-3.1.0.tgz?cache=0&sync_timestamp=1618558823901&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstring-width%2Fdownload%2Fstring-width-3.1.0.tgz",
"integrity": "sha1-InZ74htirxCBV0MG9prFG2IgOWE=",
"requires": {
"emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^5.1.0"
}
},
"strip-ansi": {
"version": "5.2.0",
"resolved": "https://registry.npm.taobao.org/strip-ansi/download/strip-ansi-5.2.0.tgz?cache=0&sync_timestamp=1618553320591&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fstrip-ansi%2Fdownload%2Fstrip-ansi-5.2.0.tgz",
"integrity": "sha1-jJpTb+tq/JYr36WxBKUJHBrZwK4=",
"requires": {
"ansi-regex": "^4.1.0"
}
},
"wrap-ansi": {
"version": "5.1.0",
"resolved": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-5.1.0.tgz?cache=0&sync_timestamp=1618558887146&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwrap-ansi%2Fdownload%2Fwrap-ansi-5.1.0.tgz",
"integrity": "sha1-H9H2cjXVttD+54EFYAG/tpTAOwk=",
"requires": {
"ansi-styles": "^3.2.0",
"string-width": "^3.0.0",
"strip-ansi": "^5.0.0"
}
},
"y18n": {
"version": "4.0.3",
"resolved": "https://registry.npm.taobao.org/y18n/download/y18n-4.0.3.tgz",
"integrity": "sha1-tfJZyCzW4zaSHv17/Yv1YN6e7t8="
},
"yargs": {
"version": "13.3.2",
"resolved": "https://registry.nlark.com/yargs/download/yargs-13.3.2.tgz?cache=0&sync_timestamp=1620086644940&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fyargs%2Fdownload%2Fyargs-13.3.2.tgz",
"integrity": "sha1-rX/+/sGqWVZayRX4Lcyzipwxot0=",
"requires": {
"cliui": "^5.0.0",
"find-up": "^3.0.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^3.0.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^13.1.2"
}
},
"yargs-parser": {
"version": "13.1.2",
"resolved": "https://registry.nlark.com/yargs-parser/download/yargs-parser-13.1.2.tgz",
"integrity": "sha1-Ew8JcC667vJlDVTObj5XBvek+zg=",
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
"qs": {
"version": "6.7.0",
"resolved": "https://registry.npm.taobao.org/qs/download/qs-6.7.0.tgz?cache=0&sync_timestamp=1616385328325&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fqs%2Fdownload%2Fqs-6.7.0.tgz",
......@@ -12113,6 +12324,15 @@
"mkdirp": "^0.5.1"
}
},
"xrk-tools": {
"version": "1.0.11",
"resolved": "https://registry.nlark.com/xrk-tools/download/xrk-tools-1.0.11.tgz",
"integrity": "sha1-qUTD/WET+sw+G0HIrifwTyIjftw=",
"requires": {
"axios": "^0.21.1",
"qrcode": "^1.4.4"
}
},
"xtend": {
"version": "4.0.2",
"resolved": "https://registry.nlark.com/xtend/download/xtend-4.0.2.tgz",
......
......@@ -27,7 +27,8 @@
"vue-awesome-swiper": "^4.1.1",
"vue-echarts": "^6.0.0-rc.5",
"vue-photo-preview": "^1.1.3",
"vuedraggable": "^2.24.3"
"vuedraggable": "^2.24.3",
"xrk-tools": "^1.0.11"
},
"devDependencies": {
"@vue/cli-plugin-eslint": "~4.5.0",
......
......@@ -6,9 +6,9 @@ import { dealString, dealFormatter, getInterval } from '../common';
const grid = {
containLabel: true,
left: 10,
right: 10,
right: 15,
bottom: 10,
top: 10
top: 15
};
export const createBar = (Vue, chartData, axisData, yAxisUnit, colors = []) => {
const _axisData = dealString(axisData);
......
......@@ -77,7 +77,6 @@ export default {
init() {
if (!this.myChart) {
if (this.type === 13) {
console.log(china);
registerMap('china', china);
// registerMap('chinaMapOutline', chinaMapOutline);
}
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-20 00:46:51
* @LastEditTime: 2021-06-30 22:36:55
-->
<template>
<div style="position:relative;" class="bi-chart-block">
......@@ -15,6 +15,7 @@
...title,
colors: chart.colors,
chartType: chart.type,
extendTypes: chart.extendTypes,
disableTypes: chart.disableTypes
}"
@change-colors="changeChartColors"
......@@ -139,7 +140,9 @@ export default {
toggleAxis() {
// 交换X轴与Y轴
const { data, axis } = this.chart;
console.log(axis);
this.chartConfig.chart['axis'] = axis.reverse();
this.chartConfig.legend['data'] = axis[1].names;
this.chartConfig.chart['data'] = data[0].reduce((pre, cur, index) => {
pre.push(
data.reduce((cPre, cCur) => {
......
......@@ -50,47 +50,27 @@ export default {
BiBlank
},
data() {
return {
test: {
title: [
{
name: '患者年龄',
axis: ['小于18岁', '18-40岁', '18-40岁']
},
{
name: '患者发病状态',
axis: ['新发疾病', '旧病复发', '旧病复发2', '旧病复发3']
}
],
arr: [
['50%', '100%', '100%', '60%'],
['50%', '0%', '100%', '20%'],
['50%', '10%', '100%', '10%'],
['50%', '20%', '100%', '10%'],
[4, 1, 2, 5]
],
res: {
x: '0.923',
p: '0.342'
}
}
};
return {};
},
props: {
hideBtn: Boolean,
setShow: Boolean,
title: String
title: String,
data: {
type: Object,
default: () => ({})
}
},
computed: {
xLength() {
return this.test.title[0].axis.length;
return this.data.title[0].axis.length;
},
tableConfig() {
const {
title,
arr,
res: { x, p }
} = this.test;
} = this.data;
const _arr = arr.slice(0, -1);
const c = [
['', '', title[0].name, '', '', '', ''],
......
......@@ -3,24 +3,33 @@
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-19 23:56:39
* @LastEditTime: 2021-06-30 19:34:58
-->
<template>
<div>
<BiBlank height="40" :usePrint="true"></BiBlank>
<div class="bi-sex-icon">
<div class="bi-sex-icon_item">
<img src="http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/boy.svg" alt="" />
<p>{{ axis[0].name }} {{ data[0][0] }}</p>
</div>
<div class="bi-sex-icon_item">
<img src="http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/girl.svg" alt="" />
<img
src="http://cdn.yxvzb.com/WEB/SaaS/images/bi/svg/girl.svg"
alt=""
/>
<p>{{ axis[1].name }} {{ data[0][1] }}</p>
</div>
</div>
<BiBlank height="40" :usePrint="true"></BiBlank>
</div>
</template>
<script>
import BiBlank from './blank.vue';
export default {
name: 'bi-sex-icon',
components: { BiBlank },
props: {
data: {
type: Array,
......
......@@ -97,6 +97,12 @@ export default {
Swiper,
SwiperSlide
},
props: {
coverContent: {
default: () => [],
type: Array
}
},
data() {
return {
swiperOptions: {
......@@ -220,32 +226,10 @@ export default {
} catch (error) {
console.log(error);
}
}
},
mounted() {
this.$refs['input'].forEach(item => {
item.addEventListener('paste', function(e) {
e.stopPropagation();
e.preventDefault();
var text = '',
event = e.originalEvent || e;
if (event.clipboardData && event.clipboardData.getData) {
text = event.clipboardData.getData('text/plain');
} else if (window.clipboardData && window.clipboardData.getData) {
text = window.clipboardData.getData('Text');
}
if (document.queryCommandSupported('insertText')) {
document.execCommand('insertText', false, text);
} else {
document.execCommand('paste', false, text);
}
});
});
},
created() {
this.content = [
dealCoverContent(arr) {
const baseContent = [
{
name: '奇正藏药医学沙龙推广项目数据报告',
className: 'bi-cover_title',
pos: {
top: this.isMobile ? this.dealPos(3.67) : 550,
......@@ -254,7 +238,6 @@ export default {
maxLength: 20
},
{
name: '2021/04/28期',
className: 'bi-cover_date',
pos: {
top: this.isMobile ? this.dealPos(7.15) : 820,
......@@ -263,7 +246,6 @@ export default {
maxLength: 16
},
{
name: '西藏奇正藏药营销有限公司',
className: 'bi-cover_company',
pos: {
top: this.isMobile ? this.dealPos(10.79) : 1540,
......@@ -272,6 +254,46 @@ export default {
maxLength: 26
}
];
this.content = baseContent.map((item, index) => {
const { name, pos } = arr[index];
name && (item.name = name);
pos && (item.pos = pos);
return item;
});
}
},
watch: {
coverContent: {
handler(newV) {
if (Array.isArray(newV) && newV.length > 0) {
this.dealCoverContent(newV);
this.$nextTick(() => {
this.$refs['input'].forEach(item => {
item.addEventListener('paste', function(e) {
e.stopPropagation();
e.preventDefault();
var text = '',
event = e.originalEvent || e;
if (event.clipboardData && event.clipboardData.getData) {
text = event.clipboardData.getData('text/plain');
} else if (
window.clipboardData &&
window.clipboardData.getData
) {
text = window.clipboardData.getData('Text');
}
if (document.queryCommandSupported('insertText')) {
document.execCommand('insertText', false, text);
} else {
document.execCommand('paste', false, text);
}
});
});
});
}
},
immediate: true
}
}
};
</script>
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-02-26 15:38:10
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-23 14:06:00
* @LastEditTime: 2021-06-30 16:53:40
-->
<template>
<div class="xrk-components-bi bi" :class="{ 'bi-print': print }">
......@@ -36,7 +36,23 @@ export default {
props: {
mobile: [Number, String, Boolean],
print: [Number, String, Boolean],
projectType: [Number, String]
projectType: [Number, String],
getBaseInfo: {
type: Function,
default: () => {}
},
getFixedInfo: {
type: Function,
default: () => {}
},
getTopicInfo: {
type: Function,
default: () => {}
},
getGroupInfo: {
type: Function,
default: () => {}
}
},
components: {
BiConfigurable,
......
......@@ -29,7 +29,7 @@ export default {
const pageInfo = args[0];
if (typeof pageInfo === 'object') {
const { pageSize, info } = pageInfo;
console.log(pageSize, info);
// console.log(pageSize, info);
pageKey && (this[pageKey] = pageSize);
pageInfoKey && (this[pageInfoKey] = info);
} else {
......
......@@ -29,7 +29,171 @@ export const chartConfig = () => {
}
return info;
};
const dealAxis = (arr, isGroup) => {
if (isGroup) {
console.log(JSON.stringify(arr));
const info = {
x: [],
y: [],
data: []
};
const a = arr.reduce((pre, cur) => {
if (cur.y) {
if (!pre[cur.y]) {
pre[cur.y] = [cur];
} else {
pre[cur.y].push(cur);
}
}
return pre;
}, {});
for (let y in a) {
const s = a[y].sort((itema, itemb) => {
if (itema.x < itemb.x) {
return -1;
}
});
info.y.push(y);
info.data.push(s.map(item => item.value));
info.x = s.map(item => item.x);
}
return info;
}
return {
x: arr.map(item => item.x),
y: [],
data: [arr.map(item => item.value)]
};
};
return {
createConfig: (arr, options = {}) => {
const {
blockTitle,
hideTitle,
hideChart,
hideDesc,
hideLegend,
hideDelete,
width = 1140,
height = 450,
colourGroup,
extendTypes = [],
disableTypes = [],
isDelete,
showSort,
xAxisName,
yAxisName,
legendName = '',
legends,
chartType,
isGroup,
resultIsShow,
resultSystem,
resultUser,
znResultSystem,
znResultUser,
znResultIsShow,
resultX2,
resultP
} = options;
const title = blockTitle;
const { x, y, data } = dealAxis(arr, isGroup);
const analysisData = data.map(item => {
return item.concat(
item.reduce((pre, cur) => {
return pre + cur;
}, 0)
);
});
return {
isDelete: isDelete || 0,
sort: showSort || 0,
chart: {
show: !hideChart,
type: chartType,
colors:
(typeof colourGroup === 'string' && colourGroup.split(',')) ||
colors[0],
data: data,
axis: [
{ name: xAxisName, names: x },
{ name: yAxisName, names: y }
],
width: width,
height: height,
extendTypes,
disableTypes
},
title: {
show: !hideTitle,
name: title,
hideColor: false,
hideDelete: hideDelete,
hideTypes: false
},
legend: {
show: !hideLegend,
title:
legendName &&
legendName.replace(
'${num}',
data[0].reduce((pre, cur) => {
pre += cur;
return pre;
}, 0)
),
data: legends || (isGroup ? y : x)
},
desc: {
show: !hideDesc,
setShow: !!resultIsShow,
text: resultSystem,
customText: resultUser || ''
},
analysis: {
show: isGroup,
setShow: true,
data: {
title: [
{
name: xAxisName,
axis: x
},
{
name: yAxisName,
axis: y
}
],
arr: [
...analysisData,
analysisData.reduce((pre, cur) => {
cur.forEach((item, index) => {
pre[index] = (pre[index] || 0) + item;
});
return pre;
}, [])
],
res: {
x: resultX2,
p: resultP
}
},
title: '卡方分析结果'
},
analysisDesc: {
show: isGroup,
setShow: !!znResultIsShow,
title: '智能分析',
text: znResultSystem,
customText: znResultUser,
resText: '总结可知:不同年龄患者的发病状态无显著性差异。'
}
};
},
create: (xLength, yLength, type = 1, options = {}) => {
index += 1;
const {
......@@ -40,7 +204,9 @@ export const chartConfig = () => {
hideLegend,
hideDelete,
width = 1140,
height = 450
height = 450,
extendTypes = [],
disableTypes = []
} = options;
const title = blockTitle || `${index}题目题目`;
const { x, y, data } = createData(xLength, yLength);
......@@ -57,8 +223,9 @@ export const chartConfig = () => {
{ name: `原始y轴-${index}`, names: y }
],
width: width,
height: height
// disableTypes: [3, 4]
height: height,
extendTypes,
disableTypes
},
title: {
show: !hideTitle,
......
......@@ -4,12 +4,12 @@
-->
<template>
<div class="bi-configurable">
<BiCover></BiCover>
<BiCover :coverContent="coverContent"></BiCover>
<BiCatalogue class="bi-block" :catalogueArr="catalogueArr"></BiCatalogue>
<BiOverview
class="bi-block"
name="项目总览"
title="关于双醋瑞因胶囊产品在云南省的零售药店巡店项目2020-03月度统计报表"
:title="projectName"
:data="baseInfo"
:textWrap="true"
></BiOverview>
......@@ -56,15 +56,43 @@ import BiSingleChoice from '../components/singleChoice.vue';
import BiCoverEnd from '../components/cover-end.vue';
import BiOperate from '../components/operate.vue';
import mixin from '../mixin/index';
import mixin, { printWidth } from '../mixin/index';
/**
* dealSingleChoice、sort、setPage
*/
import project from '../mixin/project';
import { chartConfig } from '../mock/index';
import { date, base } from 'xrk-tools';
const ChartConfigFn = chartConfig();
const dealAxis = arr => {
return arr.map(item => ({
x: item.genderType || item.xTopicName || '-',
y: item.yTopicName,
value: item.num || item.countNum || 0
}));
};
const dealLegends = arr => {
const total = arr.reduce((pre, cur) => {
return pre + (cur.num || cur.countNum || 0);
}, 0);
return arr.reduce((pre, cur) => {
pre.push(
`${cur.genderType || cur.xTopicName}${cur.num ||
cur.countNum ||
0}人,占比${base.numberFormat(
(cur.num || cur.countNum || 0) / total,
0.01
)}%`
);
return pre;
}, []);
};
const randomType = arr => {
return arr[Math.ceil(Math.random() * arr.length)] || arr[0];
};
export default {
name: 'bi-configurable',
mixins: [mixin, project],
......@@ -86,6 +114,7 @@ export default {
singleChoice: [],
singleChoiceMixin: [],
missionData: [],
coverContent: [],
questionInfo: [
{
name: '总参与题目',
......@@ -99,68 +128,9 @@ export default {
unit: '人'
}
],
baseInfo: [
[
{
name: '项目名称',
value: '在山西地区的零售药店巡店项目'
},
{
name: '服务商',
value: '北京医洋科技有限公司'
},
{
name: '任务月度',
value: '2020-03'
}
],
[
{
name: '任务量',
value: '222'
},
{
name: '项目执行人数',
value: '2131人'
},
{
name: '数据收集',
value: '415条'
}
],
[
{
name: '参与调研人数',
value: '213123'
},
{
name: '报表生成时间',
value: '2020-10-2'
}
]
],
textData: [
[
{
name: '总参与题目:',
value: '20题'
},
{
name: '当前选取报告输出题目:',
value: '20题'
}
],
[
{
name: '总参与数(人或者机构):',
value: '1000'
},
{
name: '分析维度:',
value: '主体分析+交叉分析'
}
]
]
projectName: '',
baseInfo: [],
textData: []
};
},
computed: {
......@@ -226,44 +196,199 @@ export default {
}
},
methods: {
setData() {
this.singleChoice = [
ChartConfigFn.create(60, 0, 1),
ChartConfigFn.create(60, 0, 2),
ChartConfigFn.create(20, 0, 5),
ChartConfigFn.create(25, 0, 6),
ChartConfigFn.create(15, 0, 11)
dealPos(dis) {
return dis * (this.isPrint ? printWidth : this.baseFontSize);
},
setData() {},
dealBaseInfo(info) {
const {
title,
titlePosition,
aspEnterpriseNameWrite,
aspNamePosition,
styleConfigureSettlementTime,
styleConfigureSettlementTimePosition,
projectName = '-',
aspEnterpriseName,
settlementTime,
taskSum,
executePeopleNumber,
dataCollectNumber,
examinePeopleNumber,
createDt,
totalTopicNum,
chooseTopicNum,
isContrainGroupAnalyse,
isContrainSingleAnalyse
} = info;
this.projectName = `${projectName}统计报表`;
this.coverContent = [
{
name: title,
pos: titlePosition
},
{
name: styleConfigureSettlementTime,
pos: styleConfigureSettlementTimePosition
},
{
name: aspEnterpriseNameWrite,
pos: aspNamePosition
}
];
this.singleChoiceMixin = [
ChartConfigFn.create(4, 4, 1),
ChartConfigFn.create(6, 6, 2),
ChartConfigFn.create(8, 8, 3),
ChartConfigFn.create(10, 10, 4)
this.baseInfo = [
[
{
name: '项目名称',
value: projectName
},
{
name: '服务商',
value: aspEnterpriseName
},
{
name: '提交时间',
value: settlementTime
}
],
[
{
name: '任务量',
value: taskSum
},
{
name: '项目执行人数',
value: `${executePeopleNumber}人`
},
{
name: '数据收集',
value: `${dataCollectNumber}条`
}
],
[
{
name: '参与调研人数',
value: `${examinePeopleNumber}人`
},
{
name: '报表生成时间',
value: date.dateFormat(createDt, 'Y-M-D')
}
]
];
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) {
this.missionData = [
ChartConfigFn.create(4, 0, 12, {
ChartConfigFn.createConfig(dealAxis(infoArr[0].fixedCountInfos), {
...infoArr[0],
chartType: infoArr[0].chartType || 12,
legends: dealLegends(infoArr[0].fixedCountInfos),
blockTitle: '参与任务执行的性别分布',
legendName: '总参与项目执行人数${num}人',
hideDesc: true,
hideDelete: true,
width: 520,
height: 350
height: 350,
disableTypes: [3, 4],
extendTypes: [12]
}),
ChartConfigFn.create(4, 0, 1, {
ChartConfigFn.createConfig(dealAxis(infoArr[1].fixedCountInfos), {
...infoArr[1],
chartType: infoArr[1].chartType || 1,
legends: dealLegends(infoArr[1].fixedCountInfos),
blockTitle: '执行任务的年龄段',
legendName: '总参与项目执行人数${num}人',
hideDesc: true,
hideDelete: true,
width: 520,
height: 350
height: 350,
disableTypes: [3, 4]
}),
ChartConfigFn.create(4, 0, 1, {
ChartConfigFn.createConfig([], {
...infoArr[1],
hideLegend: true,
hideChart: true,
hideTitle: true
}),
ChartConfigFn.create(4, 0, 1, { hideDelete: true, height: 400 })
ChartConfigFn.createConfig(dealAxis(infoArr[2].fixedCountInfos), {
...infoArr[2],
chartType: infoArr[1].chartType || 2,
legends: dealLegends(infoArr[2].fixedCountInfos),
blockTitle: '项目参与人完成任务区间分布',
legendName: '总参与项目执行人数${num}人',
hideDelete: 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]
});
});
},
dealChoiceMixin(arr) {
this.singleChoiceMixin = arr.map(item => {
return ChartConfigFn.createConfig(dealAxis(item.topicCountInfos), {
...item,
xAxisName: item.title,
yAxisName: item.secondTitle,
isGroup: true,
blockTitle: `${item.title}${item.secondTitle}`,
chartType: item.chartType || randomType([1, 2, 3, 4, 5, 6, 9, 10, 11])
});
});
}
},
created() {
this.setData();
Promise.all([
this.Bi.getBaseInfo(),
this.Bi.getFixedInfo(),
this.Bi.getTopicInfo(),
this.Bi.getGroupInfo()
]).then(([baseInfo, fixedInfo, topicInfo, topicMixinInfo]) => {
this.dealBaseInfo(baseInfo.data.data[0] || {});
this.dealFixedInfo(fixedInfo.data.data || []);
this.dealChoice(topicInfo.data.data || []);
this.dealChoiceMixin(topicMixinInfo.data.data || []);
});
window.status = 'completed';
}
};
......
......@@ -6,7 +6,7 @@
var path = require('path');
var webpack = require('webpack');
var entry =
process.env.NODE_ENV === 'development'
process.env.NODE_ENV !== 'development'
? './src/main.js'
: './src/lib/index.js';
module.exports = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!