feat:对接舆情监测相关接口

This commit is contained in:
zjc
2024-12-25 18:17:00 +08:00
parent 45c85763dd
commit 50a6b06381
23 changed files with 532 additions and 214 deletions

View File

@@ -28,20 +28,16 @@
default: () => {
return {}
}
},
dataList: {
type: Array,
default: () => []
}
})
let id = ref(guid())
let pieChart = null
var colorList = ['#FDC40A', '#FF5232', '#50F0A6', '#5FDFFA', '']
var title = ['企业', '农业', '工业', '纺织']
var dataValue = ['15', '30', '35', '20']
var dataList = title.map((item, index) => {
return {
name: item,
value: dataValue[index]
}
})
var defaultCofig = {
color: colorList,
@@ -49,7 +45,7 @@
orient: 'vertical',
bottom: 'center',
left: '70%',
data: dataList,
data: [],
itemWidth: fitChartSize(16),
itemHeight: fitChartSize(16),
itemGap: fitChartSize(10),
@@ -93,13 +89,15 @@
labelLine: {
show: false
},
data: dataList
data: []
}
]
}
const init = () => {
const initChart = () => {
const dom = document.getElementById(id.value)
pieChart = echarts.init(dom)
defaultCofig.series[0].data = props.dataList
pieChart.setOption({
...defaultCofig,
...props.config
@@ -111,12 +109,20 @@
if (pieChart) {
pieChart.dispose()
pieChart = null
init()
initChart()
}
}
onMounted(() => {
init()
})
watch(
() => props.dataList,
(newVal) => {
if (newVal.length > 0) {
nextTick(() => {
initChart()
})
}
},
{ immediate: true }
)
</script>
<style scoped lang="scss"></style>