+
-
@@ -154,7 +154,6 @@
const getNewsPointRank = async () => {
let res = await getNewsPointRankApi()
pointRankData.value = res.data
- console.log(res, '1111')
}
const getTypeRate = async () => {
let res = await getTypeRateApi()
diff --git a/src/views/workOrder/components/box-3.vue b/src/views/workOrder/components/box-3.vue
index 7654f05..660aff6 100644
--- a/src/views/workOrder/components/box-3.vue
+++ b/src/views/workOrder/components/box-3.vue
@@ -5,49 +5,54 @@
-

+
今日消息总条数
-
+
条
-

+
紧急消息
-
+
条
-

+
重要消息
-
+
条
-

+
普通消息
-
+
条
@@ -75,14 +80,22 @@
import pie from './pie.vue'
import { getNewsListApi, getNewsStateApi, getNewsTotalApi } from '@/api/news'
- const list = ref([])
-
+ let list = ref([])
+ let countInfo = ref({
+ important: 0,
+ normal: 0,
+ total: 0,
+ warn: 0
+ })
+ let newsStateList = ref([])
const getNewsTotal = async () => {
let res = await getNewsTotalApi()
- console.log(res, '============')
+ countInfo.value = res.data
}
const getNewsState = async () => {
let res = await getNewsStateApi()
+ newsStateList.value = res.data
+ console.log(newsStateList.value, '=================')
}
const getNewsList = async () => {
let res = await getNewsListApi()
diff --git a/src/views/workOrder/components/pie.vue b/src/views/workOrder/components/pie.vue
index 92a0ede..e40e2cf 100644
--- a/src/views/workOrder/components/pie.vue
+++ b/src/views/workOrder/components/pie.vue
@@ -8,145 +8,169 @@
const { id, setOption } = useEchart()
- let option = {
- backgroundColor: 'transparent',
- title: [
- {
- text: '45.5%',
- x: 'center',
- top: '42%',
- textStyle: {
- color: '#02F9FA',
- fontSize: fitChartSize(24)
- }
- },
- {
- text: '完成率',
- x: 'center',
- top: '54%',
- textStyle: {
- color: '#fff',
- fontSize: fitChartSize(12)
- }
- }
- ],
- series: [
- {
- type: 'gauge',
- radius: '100%',
- center: ['50%', '50%'],
- min: 0,
- max: 100,
- startAngle: 90,
- endAngle: 450,
- clockwise: false,
- itemStyle: {
- color: '#00D0FF'
- },
- axisLine: {
- show: true,
- roundCap: false,
- lineStyle: {
- color: [
- [0, '#075199'],
- [1, '#075199']
- ],
- width: fitChartSize(6)
- }
- },
- progress: {
- show: true,
- roundCap: false,
- width: fitChartSize(6)
- },
- pointer: {
- // 指针
- show: false
- },
- axisTick: {
- // 刻度
- show: false
- },
- splitLine: {
- // 分割线
- show: false
- },
- axisLabel: {
- // 刻度标签
- show: false
- },
- detail: {
- // 仪表盘详情
- show: false
- },
- data: [
- {
- value: 50
- }
- ]
- },
- {
- type: 'gauge',
- radius: '95%',
- center: ['50%', '50%'],
- min: 0,
- max: 100,
- startAngle: 90,
- endAngle: 450,
- clockwise: false,
- itemStyle: {
- color: '#057EB9'
- },
- axisLine: {
- roundCap: false,
- lineStyle: {
- color: [
- [0, '#075199'],
- [1, '#075199']
- ],
- width: fitChartSize(10)
- }
- },
- progress: {
- show: true,
- roundCap: false,
- width: fitChartSize(10)
- },
- pointer: {
- // 指针
- show: false
- },
- axisTick: {
- // 刻度
- show: false
- },
- splitLine: {
- // 分割线
- show: false
- },
- axisLabel: {
- // 刻度标签
- show: false
- },
- detail: {
- // 仪表盘详情
- show: false
- },
- data: [
- {
- value: 50
- }
- ]
- }
- ]
- }
- const init = () => {
- setOption(option)
- }
-
- onMounted(() => {
- init()
+ let props = defineProps({
+ value: {
+ type: Number,
+ default: () => 0
+ },
+ label: {
+ type: String,
+ default: () => ''
+ }
})
+ watch(
+ () => props.value,
+ (val) => {
+ if (val) {
+ nextTick(() => {
+ init()
+ })
+ }
+ },
+ { immediate: true }
+ )
+
+ let params = null
+
+ const init = () => {
+ if (!params) {
+ params = {
+ backgroundColor: 'transparent',
+ title: [
+ {
+ text: `${(props.value * 100).toFixed(2)}%`,
+ x: 'center',
+ top: '40%',
+ textStyle: {
+ color: '#02F9FA',
+ fontSize: fitChartSize(24)
+ }
+ },
+ {
+ text: props.label,
+ x: 'center',
+ top: '56%',
+ textStyle: {
+ color: '#fff',
+ fontSize: fitChartSize(12)
+ }
+ }
+ ],
+ series: [
+ {
+ type: 'gauge',
+ radius: '100%',
+ center: ['50%', '50%'],
+ min: 0,
+ max: 1,
+ startAngle: 90,
+ endAngle: 450,
+ clockwise: false,
+ itemStyle: {
+ color: '#00D0FF'
+ },
+ axisLine: {
+ show: true,
+ roundCap: false,
+ lineStyle: {
+ color: [
+ [0, '#075199'],
+ [1, '#075199']
+ ],
+ width: fitChartSize(6)
+ }
+ },
+ progress: {
+ show: true,
+ roundCap: false,
+ width: fitChartSize(6)
+ },
+ pointer: {
+ // 指针
+ show: false
+ },
+ axisTick: {
+ // 刻度
+ show: false
+ },
+ splitLine: {
+ // 分割线
+ show: false
+ },
+ axisLabel: {
+ // 刻度标签
+ show: false
+ },
+ detail: {
+ // 仪表盘详情
+ show: false
+ },
+ data: [
+ {
+ value: props.value
+ }
+ ]
+ },
+ {
+ type: 'gauge',
+ radius: '95%',
+ center: ['50%', '50%'],
+ min: 0,
+ max: 1,
+ startAngle: 90,
+ endAngle: 450,
+ clockwise: false,
+ itemStyle: {
+ color: '#057EB9'
+ },
+ axisLine: {
+ roundCap: false,
+ lineStyle: {
+ color: [
+ [0, '#075199'],
+ [1, '#075199']
+ ],
+ width: fitChartSize(10)
+ }
+ },
+ progress: {
+ show: true,
+ roundCap: false,
+ width: fitChartSize(10)
+ },
+ pointer: {
+ // 指针
+ show: false
+ },
+ axisTick: {
+ // 刻度
+ show: false
+ },
+ splitLine: {
+ // 分割线
+ show: false
+ },
+ axisLabel: {
+ // 刻度标签
+ show: false
+ },
+ detail: {
+ // 仪表盘详情
+ show: false
+ },
+ data: [
+ {
+ value: props.value
+ }
+ ]
+ }
+ ]
+ }
+ } else {
+ params.series[0].data[0].value = props.value
+ }
+ setOption(params)
+ }