提交 47d49701 authored 作者: 张烨's avatar 张烨

feat:市场准入限制-对接232数据统计页面接口

上级 002c3693
...@@ -39,6 +39,18 @@ export function getStatNum(params) { ...@@ -39,6 +39,18 @@ export function getStatNum(params) {
}) })
} }
// 查询关税税率
/**
* @param {byYorM}
*/
export function getSearchTariff(params) {
return request({
method: 'GET',
url: `/api/marketsearchDetails/getSearchTariff`,
params
})
}
// 制裁领域分布 // 制裁领域分布
/** /**
* @param {years} * @param {years}
......
...@@ -88,9 +88,9 @@ ...@@ -88,9 +88,9 @@
<div class="box-echart-main"> <div class="box-echart-main">
<div class="box-echart-content"> <div class="box-echart-content">
<el-empty v-if="!box5ChartData.title.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" /> <el-empty v-if="!box5ChartData.title.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
<div v-if="box5ChartData.title.length" style="width: 100%; height: 100%;" id="box5Chart"></div> <div v-if="box5ChartData.title.length" style="width: 100%; height: 100%;" ref="box5Ref"></div>
</div> </div>
<TipTab style="margin-top: 6px;" /> <TipTab style="margin-top: 16px;" />
</div> </div>
</OverviewNormalBox> </OverviewNormalBox>
</div> </div>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<el-empty v-if="!box6Data.title.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" /> <el-empty v-if="!box6Data.title.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
<div v-if="box6Data.title.length" style="width: 100%; height: 100%;" id="box6Chart"></div> <div v-if="box6Data.title.length" style="width: 100%; height: 100%;" id="box6Chart"></div>
</div> </div>
<TipTab style="margin-top: 6px;" /> <TipTab />
</div> </div>
</OverviewNormalBox> </OverviewNormalBox>
</div> </div>
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
<el-empty v-if="!box7Data.data.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" /> <el-empty v-if="!box7Data.data.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
<div v-if="box7Data.data.length" style="width: 100%; height: 100%;" id="box7Chart"></div> <div v-if="box7Data.data.length" style="width: 100%; height: 100%;" id="box7Chart"></div>
</div> </div>
<TipTab style="margin-top: 6px;" /> <TipTab style="margin-top: 10px;" />
</div> </div>
</OverviewNormalBox> </OverviewNormalBox>
</div> </div>
...@@ -158,9 +158,9 @@ ...@@ -158,9 +158,9 @@
<div class="box-echart-main"> <div class="box-echart-main">
<div class="box-echart-content"> <div class="box-echart-content">
<el-empty v-if="!box8Data.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" /> <el-empty v-if="!box8Data.length" description="暂无数据" style="padding: 100px 0 0;" :image-size="100" />
<div v-if="box8Data.length" style="width: 100%; height: 100%;" id="box8Chart"></div> <div v-if="box8Data.length" style="width: 100%; height: 100%;" ref="box8Ref"></div>
</div> </div>
<TipTab style="margin-top: 6px;" /> <TipTab />
</div> </div>
</OverviewNormalBox> </OverviewNormalBox>
</div> </div>
...@@ -180,7 +180,6 @@ ...@@ -180,7 +180,6 @@
</template> </template>
<el-option v-for="item in releaseTimeList" :key="item.value" :label="item.label" :value="item.value" /> <el-option v-for="item in releaseTimeList" :key="item.value" :label="item.label" :value="item.value" />
</el-select> </el-select>
</div> </div>
</div> </div>
<div class="home-main-footer-main"> <div class="home-main-footer-main">
...@@ -279,8 +278,8 @@ import CarouselItem232 from '@/views/marketAccessRestrictions/marketAccessHome/c ...@@ -279,8 +278,8 @@ import CarouselItem232 from '@/views/marketAccessRestrictions/marketAccessHome/c
import setChart from "@/utils/setChart"; import setChart from "@/utils/setChart";
import router from "@/router"; import router from "@/router";
import getMultiLineChart from "./utils/multiLineChart"; import createLineChart from "@/views/marketAccessRestrictions/marketAccessHome/utils/baseLineChart";
import getPieChart from "./utils/piechart"; import createPieChart from "@/views/marketAccessRestrictions/marketAccessHome/utils/basePiechart.js";
import getRadarChart from "./utils/radarChart"; import getRadarChart from "./utils/radarChart";
import getBarChart from "./utils/barChart1"; import getBarChart from "./utils/barChart1";
...@@ -540,7 +539,7 @@ function transformAllData(originalData) { ...@@ -540,7 +539,7 @@ function transformAllData(originalData) {
// 4. 构建最终结果 // 4. 构建最终结果
return { return {
title: allYears, title: allYears,
data: categoryData list: categoryData
}; };
} }
...@@ -596,18 +595,19 @@ function transformAllData1(originalData) { ...@@ -596,18 +595,19 @@ function transformAllData1(originalData) {
// 4. 构建最终结果 // 4. 构建最终结果
return { return {
title: allDates, title: allDates,
data: categoryData list: categoryData
}; };
} }
const box5ChartData = ref({ const box5ChartData = ref({
title: [], title: [],
data: [ list: [
{ name: "337调查", value: [] }, { name: "337调查", value: [] },
{ name: "301调查", value: [] }, { name: "301调查", value: [] },
{ name: "232调查", value: [] } { name: "232调查", value: [] }
] ]
}); });
const box5Ref = ref(null)
const box5Active = ref(1); const box5Active = ref(1);
const hadleGetStatNum = async (event) => { const hadleGetStatNum = async (event) => {
if (event) box5Active.value = event; if (event) box5Active.value = event;
...@@ -623,8 +623,7 @@ const hadleGetStatNum = async (event) => { ...@@ -623,8 +623,7 @@ const hadleGetStatNum = async (event) => {
} }
} }
} catch (error) {} } catch (error) {}
let box5Chart = getMultiLineChart(box5ChartData.value); nextTick(() => { createLineChart(box5Ref, box5ChartData.value) })
nextTick(() => { setChart(box5Chart, "box5Chart") })
}; };
// 制裁领域分布 // 制裁领域分布
...@@ -767,6 +766,7 @@ const box8SurveyList = ref([ ...@@ -767,6 +766,7 @@ const box8SurveyList = ref([
// 调查结果分布 // 调查结果分布
const box8SelectedSurvey = ref("337"); const box8SelectedSurvey = ref("337");
const box8Data = ref([]); const box8Data = ref([]);
const box8Ref = ref(null);
const handleGetBox8Data = async () => { const handleGetBox8Data = async () => {
try { try {
const res = await getSearchResult({sortCode: box8SelectedSurvey.value}); const res = await getSearchResult({sortCode: box8SelectedSurvey.value});
...@@ -779,8 +779,7 @@ const handleGetBox8Data = async () => { ...@@ -779,8 +779,7 @@ const handleGetBox8Data = async () => {
} catch (error) { } catch (error) {
box8Data.value = [] box8Data.value = []
} }
const box8Chart = getPieChart(box8Data.value); nextTick(() => { createPieChart(box8Ref, box8Data.value, {labelType:1}) })
nextTick(() => { setChart(box8Chart, "box8Chart") })
}; };
// 资源库 // 资源库
...@@ -967,7 +966,7 @@ onMounted(async () => { ...@@ -967,7 +966,7 @@ onMounted(async () => {
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 8px 22px 20px; padding: 12px 30px 20px;
.box-echart-content { .box-echart-content {
width: 100%; width: 100%;
height: 20px; height: 20px;
......
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { MUTICHARTCOLORS } from '@/common/constant'
const getMultiLineChart = (data) => { // 十六进制颜色转 rgba 的工具函数
function hexToRgba(hex, alpha) {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
const getSerie = (data, index) => {
return { return {
name: data.name,
type: 'line',
smooth: true,
symbol: 'emptyCircle',
symbolSize: 6,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: hexToRgba(MUTICHARTCOLORS[index], 0.7)
}, {
offset: 1,
color: hexToRgba(MUTICHARTCOLORS[index], 0)
}])
},
emphasis: { focus: 'series' },
data: data.value
}
}
const createLineChart = (chartDom, data, option={}) => {
if (!chartDom.value) return;
// 先销毁之前的实例
const existingChart = echarts.getInstanceByDom(chartDom.value);
if (existingChart) existingChart.dispose();
// 获取容器宽度/高度
const containerWidth = chartDom.value.clientWidth;
const containerHeight = chartDom.value.clientHeight;
const myChart = echarts.init(chartDom.value);
myChart.setOption({
color: MUTICHARTCOLORS,
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
axisPointer: { axisPointer: {
type: 'cross', type: 'cross',
label: { label: { backgroundColor: '#6a7985' }
backgroundColor: '#6a7985'
}
} }
}, },
grid: { grid: {
width: '95%', top: 40,
height: '83%', bottom: 0,
top: '15%', right: 26,
left: '1%', left: 12,
containLabel: true containLabel: true
}, },
legend: { legend: {
show: true, show: data?.list?.length>1,
top: 10, top: 10,
icon: 'circle', icon: 'circle',
textStyle: { textStyle: {
...@@ -28,7 +68,6 @@ const getMultiLineChart = (data) => { ...@@ -28,7 +68,6 @@ const getMultiLineChart = (data) => {
fontSize: '14px', fontSize: '14px',
} }
}, },
color: ['#0A57A6', '#FA8C16', '#722ED1'],
xAxis: [ xAxis: [
{ {
type: 'category', type: 'category',
...@@ -78,69 +117,9 @@ const getMultiLineChart = (data) => { ...@@ -78,69 +117,9 @@ const getMultiLineChart = (data) => {
}, },
} }
], ],
series: [ series: data.list.map(getSerie)
{ })
name: data.data[0]?.name, return myChart
type: 'line',
smooth: true,
symbol: 'emptyCircle',
symbolSize: 6,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(10, 87, 166, 0.7)' // 起始颜色
}, {
offset: 1,
color: 'rgba(10, 87, 166, 0)' // 结束颜色
}])
},
emphasis: {
focus: 'series'
},
data: data.data[0]?.value
},
{
name: data.data[1]?.name,
type: 'line',
smooth: true,
symbol: 'emptyCircle',
symbolSize: 6,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(255, 172, 77, 0.7)' // 起始颜色
}, {
offset: 1,
color: 'rgba(255, 172, 77, 0)' // 结束颜色
}])
},
emphasis: {
focus: 'series'
},
data: data.data[1]?.value,
},
{
name: data.data[2]?.name,
type: 'line',
smooth: true,
symbol: 'emptyCircle',
symbolSize: 6,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: 'rgba(114, 46, 209, 0.7)' // 起始颜色
}, {
offset: 1,
color: 'rgba(114, 46, 209, 0)' // 结束颜色
}])
},
emphasis: {
focus: 'series'
},
data: data.data[2]?.value,
}
]
}
} }
export default getMultiLineChart export default createLineChart
\ No newline at end of file \ No newline at end of file
const getPieChart = (data) => { import * as echarts from 'echarts'
const colorList = ['#69B1FF','#FF7875','#B37FEB','#FFC069','#1677FF','#87E8DE','#ADC6FF','#FFBB96','#BAE0FF','#FFD591',] import { MUTICHARTCOLORS } from '@/common/constant'
let option = {
color: colorList, const truncateLabel = (value, maxLen = 6) => {
if (value === null || value === undefined) return ''
const str = String(value)
const chars = Array.from(str)
if (chars.length <= maxLen) return str
return `${chars.slice(0, maxLen).join('')}...`
}
const formatLabel = (node, type) => {
if (type==1) {
const name = truncateLabel(node.name, 6)
return `{name|${name}}\n{time|${ node.percent||0}%}`
}
return `{name|${node.name}} {time|${ node.percent||0}%}\n`
}
const createPieChart = (chartDom, data=[], option={}) => {
if (!chartDom.value) return;
// 先销毁之前的实例
const existingChart = echarts.getInstanceByDom(chartDom.value);
if (existingChart) existingChart.dispose();
// 获取容器宽度
const containerWidth = chartDom.value.clientWidth;
const myChart = echarts.init(chartDom.value);
myChart.setOption({
color: MUTICHARTCOLORS,
tooltip: {
formatter: node => `${node.name}: ${node.value}项 (${node.percent || 0}%)`,
},
series: [ series: [
{ {
type: 'pie', type: 'pie',
radius: [75, 100], radius: [70, 100],
height: '100%', height: '100%',
left: 'center',
width: '100%', width: '100%',
left: 'center',
itemStyle: { itemStyle: {
borderColor: '#fff', borderColor: '#fff',
borderWidth: 1 borderWidth: 1
}, },
label: { label: {
alignTo: 'edge', alignTo: 'edge',
formatter: '{name|{b}}\n{time|{c} 条 {d}%}', formatter: (node) => formatLabel(node, option.labelType),
minMargin: 5, minMargin: 5,
edgeDistance: 10, edgeDistance: 10,
lineHeight: 25, lineHeight: 22,
rich: { rich: {
name: { name: {
color: 'rgba(59, 65, 75, 1)', color: 'rgba(59, 65, 75, 1)',
fontFamily: 'Microsoft YaHei', fontFamily: 'Microsoft YaHei',
fontSize: 16, fontSize: 16,
fontWeight: 'bold', fontWeight: 'bold',
padding: [10, 0, 10, 0]
}, },
time: { time: {
fontSize: 16, color: 'rgba(95, 101, 108, 1)',
fontFamily: 'Microsoft YaHei', fontFamily: 'Microsoft YaHei',
color: '#rgba(95, 101, 108, 1)' fontSize: 16,
padding: [10, 0, 10, 0]
} }
} }
}, },
labelLine: { labelLine: {
length: 15, length: 15,
length2: 0, length2: 0,
maxSurfaceAngle: 80 maxSurfaceAngle: 88
}, },
labelLayout: function (params) { labelLayout: function (params) {
const isLeft = params.labelRect.x < 556 / 2; const isLeft = params.labelRect.x < containerWidth / 2;
const points = params.labelLinePoints; const points = params.labelLinePoints;
// Update the end point.
points[2][0] = isLeft // 调整引导线终点
? params.labelRect.x if (isLeft) {
: params.labelRect.x + params.labelRect.width; points[2][0] = params.labelRect.x; // 左对齐
return { } else {
labelLinePoints: points points[2][0] = params.labelRect.x + params.labelRect.width; // 右对齐
}; }
return { labelLinePoints: points };
}, },
data: data data: data
}] }
} ]
return option });
return myChart
} }
export default getPieChart; export default createPieChart;
\ No newline at end of file \ No newline at end of file
...@@ -5,7 +5,7 @@ const getBarChart = (nameList, valueList) => { ...@@ -5,7 +5,7 @@ const getBarChart = (nameList, valueList) => {
tooltip: {}, tooltip: {},
title: { title: {
text: '单位:万人', text: '单位:万人',
left: 660, right: 26,
top: 10, top: 10,
textStyle: { textStyle: {
color: 'rgba(95, 101, 108, 1)', color: 'rgba(95, 101, 108, 1)',
...@@ -16,18 +16,14 @@ const getBarChart = (nameList, valueList) => { ...@@ -16,18 +16,14 @@ const getBarChart = (nameList, valueList) => {
} }
}, },
grid: { grid: {
top: '5%', top: 40,
right: '3%', bottom: 0,
bottom: '1%', right: 26,
left: '1%', left: 12,
containLabel: true containLabel: true
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
splitLine: {
show: false
},
show: false
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
......
...@@ -43,7 +43,7 @@ const getBarChart = (nameList, valueList) => { ...@@ -43,7 +43,7 @@ const getBarChart = (nameList, valueList) => {
data: valueList, data: valueList,
label: { label: {
show: true, show: true,
position: [480, 0], position: [434, 0],
formatter: function (params) { formatter: function (params) {
return params.value + ' 次' return params.value + ' 次'
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论