Commit dd64d1cd by jml0128

feat:联调数字专区接口

1 parent 10467415
......@@ -2,7 +2,7 @@
* @Description:
* @Date: 2021-06-20 01:16:17
*/
export const createMap = () => {
export const createMap = (Vue, chartData) => {
return {
visualMap: {
borderColor: '#fff',
......@@ -54,84 +54,7 @@ export const createMap = () => {
},
top: 36,
left: 0,
data: [
{
name: '北京',
value: 54
},
{
name: '天津',
value: 13
},
{
name: '上海',
value: 40
},
{
name: '重庆',
value: 75
},
{
name: '河北',
value: 13
},
{
name: '河南',
value: 83
},
{
name: '云南',
value: 11
},
{
name: '辽宁',
value: 19
},
{
name: '黑龙江',
value: 15
},
{
name: '湖南',
value: 69
},
{
name: '安徽',
value: 60
},
{
name: '山东',
value: 39
},
{
name: '新疆',
value: 4
},
{
name: '江苏',
value: 31
},
{
name: '浙江',
value: 104
},
{
name: '江西',
value: 36
},
{
name: '湖北',
value: 1052
},
{
name: '广西',
value: 33
},
{
name: '甘肃',
value: 7
}
]
data: chartData
}
]
};
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-20 11:13:55
* @LastEditTime: 2021-07-02 11:44:28
-->
<template>
<div>
......@@ -17,7 +17,7 @@
:key="`${type}-${JSON.stringify(data)}`"
:type="type"
>
<template v-if="type == 13" #map>
<template v-if="isMap" #map>
<div class="ui-table-head">
<table class="ui-table" style="border-bottom:none;">
<colgroup>
......@@ -38,7 +38,7 @@
<col style="width:10%" />
</colgroup>
<tbody>
<tr v-for="(item, index) in table" :key="index">
<tr v-for="(item, index) in mapData" :key="index">
<td>
{{ item.name }}
</td>
......@@ -104,16 +104,6 @@ export default {
},
data() {
return {
table: [
{
name: '河北',
value: '1000'
},
{
name: '重庆',
value: '876'
}
],
option: {}
};
},
......@@ -160,13 +150,24 @@ export default {
height: isNumber(cHeight) ? `${cHeight}px` : cHeight
};
return customStyle;
},
isMap() {
return this.type == 13;
},
mapData() {
return this.data[0].map((item, index) => {
return {
value: item,
name: this.axis[0].names[index]
};
});
}
},
methods: {
createChart() {
this.option = this.chartsConfig.create(
this,
this.data,
this.isMap ? this.mapData : this.data,
this.axis[0].names,
this.yAxisUnit,
this.colors,
......
......@@ -3,7 +3,7 @@
* @Author: jml
* @Date: 2021-03-24 10:22:27
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-19 22:39:37
* @LastEditTime: 2021-07-02 11:49:58
-->
<template>
<div class="bi-table">
......@@ -33,7 +33,8 @@
:style="{
backgroundColor:
cIndex == 0 ? colors[isSingle && index === 0 ? 0 : 1] : '',
color: cIndex == 0 && colors.length > 1 ? '#fff' : ''
color:
(cIndex == 0 || index == 0) && colors.length > 1 ? '#fff' : ''
}"
>
{{ cItem }}
......
......@@ -14,11 +14,12 @@
</div>
<BiChartBlock
v-if="data[2]"
style="margin-top:30px;"
:chartConfig="data[2]"
></BiChartBlock>
<template name="项目参与人完成任务区间分布">
<template name="项目参与人完成任务区间分布" v-if="data[3]">
<BiChartBlock
style="margin-top:44px;"
:chartConfig="data[3]"
......
......@@ -102,12 +102,17 @@ export default {
message: '保存中...请稍等',
duration: 0
});
this.saveInfo().then(() => {
this.saveInfo()
.then(() => {
loading.close();
Message({
message: '保存成功',
type: 'success'
});
})
.catch(() => {
loading.close();
Message.error('保存失败');
});
}
},
......
......@@ -71,6 +71,8 @@ export const chartConfig = () => {
const {
blockTitle,
hideTitle,
hideColor,
hideTypes,
hideChart,
hideDesc,
hideLegend,
......@@ -131,9 +133,9 @@ export const chartConfig = () => {
title: {
show: !hideTitle,
name: title,
hideColor: false,
hideColor: hideColor,
hideDelete: hideDelete,
hideTypes: false
hideChangeChart: hideTypes
},
legend: {
show: !hideLegend,
......
......@@ -71,60 +71,15 @@ import mixin, { printWidth } from '../mixin/index';
import project from '../mixin/project';
import { chartConfig } from '../mock/index';
import { date, base } from 'xrk-tools';
import { date } 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];
};
const chartConfigToSetInfo = chartConfigs => {
return chartConfigs.map((item, index) => {
const { baseInfo, desc, analysisDesc, analysis, isDelete, chart } = item;
const { id, type } = baseInfo;
const { customText = '', setShow } = desc;
return {
groupDetailId: id,
topicDetailId: id,
fixedId: id,
type: type,
chartType: +chart.type,
colourGroup: Array.isArray(chart.colors)
? chart.colors.join(',')
: chart.colors,
showSort: +index + 1,
isDelete: isDelete,
resultUser: customText,
znResultUser: analysisDesc.customText,
resultIsShow: setShow ? 1 : 0,
znResultIsShow: analysisDesc.setShow ? 1 : 0,
znTableIsShow: analysis.setShow ? 1 : 0
};
});
};
import {
dealAxis,
dealLegends,
randomType,
chartConfigToSetInfo
} from './tools';
export default {
name: 'bi-configurable',
......@@ -345,7 +300,7 @@ export default {
];
},
dealFixedInfo(infoArr) {
const [group1 = {}, group2 = {}, group3 = {}] = infoArr;
const [group1 = {}, group2 = {}, group3 = {}, group4 = {}] = infoArr;
this.missionData = [
ChartConfigFn.createConfig(dealAxis(group1.fixedCountInfos), {
...group1,
......@@ -378,10 +333,10 @@ export default {
hideChart: true,
hideTitle: true
}),
ChartConfigFn.createConfig(dealAxis(group3.fixedCountInfos), {
...group3,
chartType: group3.chartType || 2,
legends: dealLegends(group3.fixedCountInfos),
ChartConfigFn.createConfig(dealAxis(group4.fixedCountInfos), {
...group4,
chartType: group4.chartType || 2,
legends: dealLegends(group4.fixedCountInfos),
blockTitle: '项目参与人完成任务区间分布',
legendName: '总参与项目执行人数${num}人',
hideDelete: true,
......
/*
* @Description:
* @Date: 2021-07-02 10:57:34
*/
import { base } from 'xrk-tools';
export const dealAxis = (arr = []) => {
return arr.map(item => ({
x: item.genderType || item.xTopicName || '-',
y: item.yTopicName,
value: item.num || item.countNum || 0
}));
};
export 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;
}, []);
};
export const randomType = (arr = []) => {
return arr[Math.ceil(Math.random() * arr.length)] || arr[0];
};
export const chartConfigToSetInfo = chartConfigs => {
return chartConfigs.map((item, index) => {
const { baseInfo, desc, analysisDesc, analysis, isDelete, chart } = item;
const { id, type } = baseInfo;
const { customText = '', setShow } = desc;
return {
groupDetailId: id,
topicDetailId: id,
fixedId: id,
type: type,
chartType: +chart.type,
colourGroup: Array.isArray(chart.colors)
? chart.colors.join(',')
: chart.colors,
showSort: +index + 1,
isDelete: isDelete,
resultUser: customText,
znResultUser: analysisDesc.customText,
resultIsShow: setShow ? 1 : 0,
znResultIsShow: analysisDesc.setShow ? 1 : 0,
znTableIsShow: analysis.setShow ? 1 : 0
};
});
};
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!