Commit dd64d1cd by jml0128

feat:联调数字专区接口

1 parent 10467415
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: * @Description:
* @Date: 2021-06-20 01:16:17 * @Date: 2021-06-20 01:16:17
*/ */
export const createMap = () => { export const createMap = (Vue, chartData) => {
return { return {
visualMap: { visualMap: {
borderColor: '#fff', borderColor: '#fff',
...@@ -54,84 +54,7 @@ export const createMap = () => { ...@@ -54,84 +54,7 @@ export const createMap = () => {
}, },
top: 36, top: 36,
left: 0, left: 0,
data: [ data: chartData
{
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
}
]
} }
] ]
}; };
......
...@@ -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-06-20 11:13:55 * @LastEditTime: 2021-07-02 11:44:28
--> -->
<template> <template>
<div> <div>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
:key="`${type}-${JSON.stringify(data)}`" :key="`${type}-${JSON.stringify(data)}`"
:type="type" :type="type"
> >
<template v-if="type == 13" #map> <template v-if="isMap" #map>
<div class="ui-table-head"> <div class="ui-table-head">
<table class="ui-table" style="border-bottom:none;"> <table class="ui-table" style="border-bottom:none;">
<colgroup> <colgroup>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<col style="width:10%" /> <col style="width:10%" />
</colgroup> </colgroup>
<tbody> <tbody>
<tr v-for="(item, index) in table" :key="index"> <tr v-for="(item, index) in mapData" :key="index">
<td> <td>
{{ item.name }} {{ item.name }}
</td> </td>
...@@ -104,16 +104,6 @@ export default { ...@@ -104,16 +104,6 @@ export default {
}, },
data() { data() {
return { return {
table: [
{
name: '河北',
value: '1000'
},
{
name: '重庆',
value: '876'
}
],
option: {} option: {}
}; };
}, },
...@@ -160,13 +150,24 @@ export default { ...@@ -160,13 +150,24 @@ export default {
height: isNumber(cHeight) ? `${cHeight}px` : cHeight height: isNumber(cHeight) ? `${cHeight}px` : cHeight
}; };
return customStyle; 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: { methods: {
createChart() { createChart() {
this.option = this.chartsConfig.create( this.option = this.chartsConfig.create(
this, this,
this.data, this.isMap ? this.mapData : this.data,
this.axis[0].names, this.axis[0].names,
this.yAxisUnit, this.yAxisUnit,
this.colors, this.colors,
......
...@@ -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-06-19 22:39:37 * @LastEditTime: 2021-07-02 11:49:58
--> -->
<template> <template>
<div class="bi-table"> <div class="bi-table">
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
:style="{ :style="{
backgroundColor: backgroundColor:
cIndex == 0 ? colors[isSingle && index === 0 ? 0 : 1] : '', 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 }} {{ cItem }}
......
...@@ -14,11 +14,12 @@ ...@@ -14,11 +14,12 @@
</div> </div>
<BiChartBlock <BiChartBlock
v-if="data[2]"
style="margin-top:30px;" style="margin-top:30px;"
:chartConfig="data[2]" :chartConfig="data[2]"
></BiChartBlock> ></BiChartBlock>
<template name="项目参与人完成任务区间分布"> <template name="项目参与人完成任务区间分布" v-if="data[3]">
<BiChartBlock <BiChartBlock
style="margin-top:44px;" style="margin-top:44px;"
:chartConfig="data[3]" :chartConfig="data[3]"
......
...@@ -102,13 +102,18 @@ export default { ...@@ -102,13 +102,18 @@ export default {
message: '保存中...请稍等', message: '保存中...请稍等',
duration: 0 duration: 0
}); });
this.saveInfo().then(() => { this.saveInfo()
loading.close(); .then(() => {
Message({ loading.close();
message: '保存成功', Message({
type: 'success' message: '保存成功',
type: 'success'
});
})
.catch(() => {
loading.close();
Message.error('保存失败');
}); });
});
} }
}, },
exportFn() { exportFn() {
......
...@@ -71,6 +71,8 @@ export const chartConfig = () => { ...@@ -71,6 +71,8 @@ export const chartConfig = () => {
const { const {
blockTitle, blockTitle,
hideTitle, hideTitle,
hideColor,
hideTypes,
hideChart, hideChart,
hideDesc, hideDesc,
hideLegend, hideLegend,
...@@ -131,9 +133,9 @@ export const chartConfig = () => { ...@@ -131,9 +133,9 @@ export const chartConfig = () => {
title: { title: {
show: !hideTitle, show: !hideTitle,
name: title, name: title,
hideColor: false, hideColor: hideColor,
hideDelete: hideDelete, hideDelete: hideDelete,
hideTypes: false hideChangeChart: hideTypes
}, },
legend: { legend: {
show: !hideLegend, show: !hideLegend,
......
...@@ -71,60 +71,15 @@ import mixin, { printWidth } from '../mixin/index'; ...@@ -71,60 +71,15 @@ import mixin, { printWidth } from '../mixin/index';
import project from '../mixin/project'; import project from '../mixin/project';
import { chartConfig } from '../mock/index'; import { chartConfig } from '../mock/index';
import { date, base } from 'xrk-tools'; import { date } from 'xrk-tools';
const ChartConfigFn = chartConfig(); const ChartConfigFn = chartConfig();
const dealAxis = (arr = []) => { import {
return arr.map(item => ({ dealAxis,
x: item.genderType || item.xTopicName || '-', dealLegends,
y: item.yTopicName, randomType,
value: item.num || item.countNum || 0 chartConfigToSetInfo
})); } from './tools';
};
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
};
});
};
export default { export default {
name: 'bi-configurable', name: 'bi-configurable',
...@@ -345,7 +300,7 @@ export default { ...@@ -345,7 +300,7 @@ export default {
]; ];
}, },
dealFixedInfo(infoArr) { dealFixedInfo(infoArr) {
const [group1 = {}, group2 = {}, group3 = {}] = infoArr; const [group1 = {}, group2 = {}, group3 = {}, group4 = {}] = infoArr;
this.missionData = [ this.missionData = [
ChartConfigFn.createConfig(dealAxis(group1.fixedCountInfos), { ChartConfigFn.createConfig(dealAxis(group1.fixedCountInfos), {
...group1, ...group1,
...@@ -378,10 +333,10 @@ export default { ...@@ -378,10 +333,10 @@ export default {
hideChart: true, hideChart: true,
hideTitle: true hideTitle: true
}), }),
ChartConfigFn.createConfig(dealAxis(group3.fixedCountInfos), { ChartConfigFn.createConfig(dealAxis(group4.fixedCountInfos), {
...group3, ...group4,
chartType: group3.chartType || 2, chartType: group4.chartType || 2,
legends: dealLegends(group3.fixedCountInfos), legends: dealLegends(group4.fixedCountInfos),
blockTitle: '项目参与人完成任务区间分布', blockTitle: '项目参与人完成任务区间分布',
legendName: '总参与项目执行人数${num}人', legendName: '总参与项目执行人数${num}人',
hideDelete: true, 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!