Commit cedf1652 by jml0128

fix

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