|
@@ -3,172 +3,158 @@
|
|
|
<div class="height260" id="radarChart" ref="radarChart" />
|
|
|
</div>
|
|
|
</template>
|
|
|
-<script>
|
|
|
-import { defineComponent, onMounted, ref,watch } from 'vue'
|
|
|
+<script setup>
|
|
|
+/*----------------------------------依赖引入-----------------------------------*/
|
|
|
import * as echarts from 'echarts'
|
|
|
+import { ElMessage, ElNotification } from 'element-plus'
|
|
|
+import { ref, onMounted, watch, getCurrentInstance, reactive, toRefs, } from 'vue'
|
|
|
+/*----------------------------------接口引入-----------------------------------*/
|
|
|
+/*----------------------------------组件引入-----------------------------------*/
|
|
|
+/*----------------------------------store引入-----------------------------------*/
|
|
|
+/*----------------------------------公共方法引入-----------------------------------*/
|
|
|
+/*----------------------------------公共变量-----------------------------------*/
|
|
|
+const props = defineProps({
|
|
|
+ getTableData: Object,
|
|
|
+}) //数据双向绑定
|
|
|
+const emit = defineEmits([])
|
|
|
+const { proxy } = getCurrentInstance()
|
|
|
+/*----------------------------------变量声明-----------------------------------*/
|
|
|
+// 读取数据 func
|
|
|
+const loading = ref(true)
|
|
|
+const getData = async () => {
|
|
|
+ loading.value = false
|
|
|
+}
|
|
|
|
|
|
-export default defineComponent({
|
|
|
- name: 'RadarChart',
|
|
|
- props:{
|
|
|
- getTableData:Object,
|
|
|
- },
|
|
|
- setup(props) {
|
|
|
-
|
|
|
- // 读取数据 func
|
|
|
- const loading = ref(true)
|
|
|
- const getData = async () => {
|
|
|
-
|
|
|
- // loading.value = true;
|
|
|
- // await store.dispatch("Home/queryWorksChartData");
|
|
|
- loading.value = false
|
|
|
- }
|
|
|
- function echarts2(){
|
|
|
- let myChart = echarts.init(document.getElementById('radarChart'))
|
|
|
- // 绘制图表
|
|
|
- myChart.setOption({
|
|
|
- backgroundColor: '#FFF',
|
|
|
- tooltip: {},
|
|
|
- grid: {
|
|
|
- left: '20',
|
|
|
- right: '40',
|
|
|
- top: '-20',
|
|
|
- bottom: '0',
|
|
|
- containLabel: true,
|
|
|
+function echarts2() {
|
|
|
+ let myChart = echarts.init(document.getElementById('radarChart'))
|
|
|
+ // 绘制图表
|
|
|
+ myChart.setOption({
|
|
|
+ backgroundColor: '#FFF',
|
|
|
+ tooltip: {},
|
|
|
+ grid: {
|
|
|
+ left: '20',
|
|
|
+ right: '40',
|
|
|
+ top: '-20',
|
|
|
+ bottom: '0',
|
|
|
+ containLabel: true,
|
|
|
+ },
|
|
|
+ radar: {
|
|
|
+ radius: '60%',
|
|
|
+ center: ['50%', '55%'],
|
|
|
+ splitNumber: 5,
|
|
|
+ nameGap: '15',
|
|
|
+ name: {
|
|
|
+ textStyle: {
|
|
|
+ color: '#a8a8a8',
|
|
|
},
|
|
|
- radar: {
|
|
|
- radius: '60%',
|
|
|
- center: ['50%', '55%'],
|
|
|
- splitNumber: 5,
|
|
|
- nameGap: '15',
|
|
|
- name: {
|
|
|
- textStyle: {
|
|
|
- color: '#a8a8a8',
|
|
|
- },
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- lineStyle: {
|
|
|
- color: '#ebebeb',
|
|
|
- },
|
|
|
- },
|
|
|
- splitLine: {
|
|
|
- lineStyle: {
|
|
|
- width: 1,
|
|
|
- color: '#ebebeb',
|
|
|
- },
|
|
|
- },
|
|
|
- splitArea: {
|
|
|
- areaStyle: {
|
|
|
- color: ['#f8f8f8', '#fff'].reverse(),
|
|
|
- },
|
|
|
- },
|
|
|
- indicator: [
|
|
|
- {
|
|
|
- name: '电压平衡度',
|
|
|
- max: 20,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '电流平衡度',
|
|
|
- max: 20,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '功率因数',
|
|
|
- max: 20,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '电压合格率',
|
|
|
- max: 20,
|
|
|
- },
|
|
|
- {
|
|
|
- name: '负载率',
|
|
|
- max: 20,
|
|
|
- },
|
|
|
- ],
|
|
|
+ },
|
|
|
+ axisLine: {
|
|
|
+ lineStyle: {
|
|
|
+ color: '#ebebeb',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ splitLine: {
|
|
|
+ lineStyle: {
|
|
|
+ width: 1,
|
|
|
+ color: '#ebebeb',
|
|
|
+ },
|
|
|
+ },
|
|
|
+ splitArea: {
|
|
|
+ areaStyle: {
|
|
|
+ color: ['#f8f8f8', '#fff'].reverse(),
|
|
|
},
|
|
|
- series: [
|
|
|
+ },
|
|
|
+ indicator: [
|
|
|
+ {
|
|
|
+ name: '电压平衡度',
|
|
|
+ max: 20,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '电流平衡度',
|
|
|
+ max: 20,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '功率因数',
|
|
|
+ max: 20,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '电压合格率',
|
|
|
+ max: 20,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '负载率',
|
|
|
+ max: 20,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: 'Title✍',
|
|
|
+ type: 'radar',
|
|
|
+ symbolSize: 12,
|
|
|
+ itemStyle: {
|
|
|
+ borderColor: '#ebebeb',
|
|
|
+ borderWidth: 2,
|
|
|
+ },
|
|
|
+ areaStyle: {
|
|
|
+ opacity: 0.3,
|
|
|
+ },
|
|
|
+ data: [
|
|
|
{
|
|
|
- name: 'Title✍',
|
|
|
- type: 'radar',
|
|
|
- symbolSize: 12,
|
|
|
itemStyle: {
|
|
|
- borderColor: '#ebebeb',
|
|
|
- borderWidth: 2,
|
|
|
- },
|
|
|
- areaStyle: {
|
|
|
- opacity: 0.3,
|
|
|
+ color: '#5eb6db',
|
|
|
},
|
|
|
- data: [
|
|
|
- {
|
|
|
- itemStyle: {
|
|
|
- color: '#5eb6db',
|
|
|
- },
|
|
|
- value: [props.getTableData.vtBalunQ?20:0,props.getTableData.elBalunQ?20:0, props.getTableData.cosQ?20:0, props.getTableData.uq?20:0, props.getTableData.iloadQ?20:0],
|
|
|
- },
|
|
|
- ],
|
|
|
+ value: [props.getTableData.vtBalunQ ? 20 : 0, props.getTableData.elBalunQ ? 20 : 0, props.getTableData.cosQ ? 20 : 0, props.getTableData.uq ? 20 : 0, props.getTableData.iloadQ ? 20 : 0],
|
|
|
},
|
|
|
],
|
|
|
- })
|
|
|
- window.addEventListener('resize', () => {
|
|
|
- myChart.resize()
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- const writeValue = (val) => {
|
|
|
-
|
|
|
- val
|
|
|
-
|
|
|
- getData()
|
|
|
- echarts2()
|
|
|
- }
|
|
|
-
|
|
|
- //监听变化
|
|
|
- watch(
|
|
|
- () => props.getTableData,
|
|
|
- (newVal, oldVal, clear) => {
|
|
|
- // 执行异步任务,并得到关闭异步任务的 id
|
|
|
- // console.log(newVal)
|
|
|
- let id = writeValue(newVal, oldVal)
|
|
|
- // 如果 watch 监听被重复执行了,则会先清除上次未完成的异步任务
|
|
|
- clear(() => clearTimeout(id))
|
|
|
},
|
|
|
- { lazy: true }
|
|
|
- )
|
|
|
-
|
|
|
- onMounted(() => {
|
|
|
- getData()
|
|
|
- echarts2()
|
|
|
+ ],
|
|
|
+ })
|
|
|
+ window.addEventListener('resize', () => {
|
|
|
+ myChart.resize()
|
|
|
+ })
|
|
|
|
|
|
-
|
|
|
- })
|
|
|
+}
|
|
|
|
|
|
- return {
|
|
|
- loading,
|
|
|
-
|
|
|
- getData,
|
|
|
- echarts2
|
|
|
- }
|
|
|
+//监听变化
|
|
|
+watch(
|
|
|
+ () => props.getTableData,
|
|
|
+ (newVal, oldVal, clear) => {
|
|
|
+ getData()
|
|
|
+ echarts2()
|
|
|
},
|
|
|
+ { lazy: true }
|
|
|
+)
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getData()
|
|
|
+ echarts2()
|
|
|
})
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.homeBoxCard {
|
|
|
margin-bottom: 24px;
|
|
|
+
|
|
|
::v-deep(.el-card__header) {
|
|
|
padding-left: 12px;
|
|
|
padding-right: 12px;
|
|
|
}
|
|
|
+
|
|
|
::v-deep(.el-card__body) {
|
|
|
padding: 12px;
|
|
|
font-size: 14px;
|
|
|
line-height: 1.5715;
|
|
|
}
|
|
|
+
|
|
|
::v-deep(.el-divider) {
|
|
|
margin: 8px 0;
|
|
|
}
|
|
|
+
|
|
|
.num {
|
|
|
font-size: 30px;
|
|
|
color: #515a6e;
|
|
|
}
|
|
|
+
|
|
|
.height260 {
|
|
|
height: 260px;
|
|
|
}
|