Commit cedf1652 by jml0128

fix

1 parent d49f6391
{
"name": "xrk-bi",
"version": "0.1.1",
"version": "0.1.3",
"description": "xrk-bi",
"author": "xrk",
"main": "dist/bundler.js",
......
......@@ -214,6 +214,7 @@ export const initDivInput = (
let leftText = '';
let rightText = '';
let deleteText = '';
let isComposition = false;
dom.innerHTML = dom.innerText;
const setIndex = function() {
const { innerText } = this;
......@@ -246,13 +247,18 @@ export const initDivInput = (
);
};
dom.addEventListener('compositionstart', function(event) {
dom.addEventListener('compositionstart', function() {
isComposition = true;
setIndex.call(this);
});
dom.addEventListener('compositionend', function(event) {
isComposition = false;
dealText.call(this, event.data);
});
dom.addEventListener('beforeinput', function(event) {
if (isComposition) {
return;
}
const { inputType } = event;
if (inputType != 'insertCompositionText') {
setIndex.call(this);
......
......@@ -3,6 +3,7 @@
* @Date: 2021-06-20 01:16:17
*/
export const createMap = (Vue, chartData) => {
console.log('map', chartData);
return {
visualMap: {
borderColor: '#fff',
......@@ -17,20 +18,20 @@ export const createMap = (Vue, chartData) => {
color: '#6C71FF'
},
{
gte: 50,
gte: 51,
lte: 100,
label: '51-100',
color: '#34CE9C'
},
{
gte: 11,
lt: 50,
lte: 50,
label: '11-50',
color: '#3985FF'
},
{
gt: 0,
lt: 10,
lte: 10,
label: '0-10',
color: '#00BAFF'
}
......
......@@ -329,7 +329,7 @@ export default {
ChartConfigFn.createConfig(dealAxis(group1.fixedCountInfos), {
...group1,
chartType: group1.chartType || 12,
legends: dealLegends(group1.fixedCountInfos, '性'),
legends: dealLegends(group1.fixedCountInfos, '性', '性'),
blockTitle: '参与任务执行的性别分布',
legendName: '总参与项目执行人数${num}人',
hideDesc: true,
......@@ -354,10 +354,10 @@ export default {
disableTypes: [3, 4]
}),
ChartConfigFn.createConfig([], {
...group4,
...group2,
resultIsShow: 1,
hideBtn: true,
resultSystem: `${group2.analyseDescribe}${group4.resultSystem}`,
resultSystem: `${group2.analyseDescribe}`,
hideLegend: true,
hideChart: true,
hideTitle: true
......@@ -367,7 +367,7 @@ export default {
resultIsShow: 1,
hideBtn: true,
chartType: group3.chartType || 2,
legends: dealLegends(group3.fixedCountInfos),
legends: dealLegends(group3.fixedCountInfos, '个', ''),
blockTitle: '项目参与人完成任务区间分布',
legendName: '总参与项目执行人数${num}人',
hideDelete: true,
......
......@@ -308,7 +308,7 @@ export default {
ChartConfigFn.createConfig(dealAxis(group1.topicCountInfos), {
...group1,
chartType: group1.chartType || 12,
legends: dealLegends(group1.topicCountInfos),
legends: dealLegends(group1.topicCountInfos, '性', '性'),
blockTitle: '参与任务执行的性别分布',
legendName: '总参与项目执行人数${num}人',
hideDesc: true,
......@@ -319,10 +319,12 @@ export default {
disableTypes: [3, 4],
extendTypes: [12]
}),
ChartConfigFn.createConfig(dealAxis(group2.topicCountInfos), {
ChartConfigFn.createConfig(
dealAxis(group2.topicCountInfos, '', '以上'),
{
...group2,
chartType: group2.chartType || 1,
legends: dealLegends(group2.topicCountInfos),
legends: dealLegends(group2.topicCountInfos, '岁', '岁以上'),
blockTitle: '执行任务的年龄段',
legendName: '总参与项目执行人数${num}人',
hideDesc: true,
......@@ -331,7 +333,8 @@ export default {
width: 520,
height: 350,
disableTypes: [3, 4]
}),
}
),
ChartConfigFn.createConfig([], {
...group1,
resultIsShow: 1,
......
......@@ -4,22 +4,26 @@
*/
import { base } from '../chart-type/common';
export const dealAxis = (arr = []) => {
return arr.map(item => ({
x: item.genderType || item.xTopicName || '-',
export const dealAxis = (arr = [], unit = '', lastUnit = '') => {
return arr.map((item, index) => {
const isLast = index === arr.length - 1;
const xName = item.genderType || item.xTopicName;
return {
x: xName ? (isLast ? `${xName}${lastUnit}` : `${xName}${unit}`) : '-',
y: item.yTopicName,
value: item.num || item.countNum || 0
}));
};
});
};
export const dealLegends = (arr = [], unit = '') => {
export const dealLegends = (arr = [], unit = '', lastUnit = '') => {
const total = arr.reduce((pre, cur) => {
return pre + (cur.num || cur.countNum || 0);
}, 0);
return arr.reduce((pre, cur) => {
return arr.reduce((pre, cur, index) => {
pre.push(
`${cur.genderType || cur.xTopicName}${unit}${cur.num ||
cur.countNum ||
0}人,占比${base.numberFormat(
`${cur.genderType || cur.xTopicName}${
index === arr.length - 1 ? lastUnit : unit
}${cur.num || cur.countNum || 0}人,占比${base.numberFormat(
total ? (cur.num || cur.countNum || 0) / total : 0,
0.01
)}%`
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!