schedule.vue
1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<template>
<div>
<el-progress :percentage="num" :format="format" />
</div>
</template>
<script setup >
import { ref, watch } from 'vue'
const props = defineProps({
auditProcess: {}
})
const rList = ref([])
const rInx = ref()
const num = ref(0)
const format = ref()
watch(() => props.auditProcess, (newV, oldV) => {
if (newV) {
if (props.auditProcess) {
rList.value = newV.rules
rInx.value = newV.nowLevel
if (!rInx.value) {
num.value = 0
format.value = (percentage) => {
percentage = 0 + '/' + 0
return percentage
}
return
}
if (rInx.value < 0) {
rInx.value = rList.value?.findIndex(item => item == (rInx.value * -1))
if (rInx.value <= 0) {
num.value = 0
format.value = (percentage) => {
percentage = 0 + '/' + rList.value?.length
return percentage
}
} else {
num.value = ((rInx.value / rList.value?.length) * 100).toFixed(0)
format.value = (percentage) => {
percentage = rInx.value + '/' + rList.value?.length
return percentage
}
}
} else {
rInx.value = rList.value?.findIndex(item => item == rInx.value) + 1
num.value = ((rInx.value / rList.value?.length) * 100).toFixed(0)
format.value = (percentage) => {
percentage = rInx.value + '/' + rList.value?.length
return percentage
}
}
} else {
format.value = (percentage) => {
percentage = 0 + '/' + 0
return percentage
}
}
}
}, { deep: true, immediate: true })
defineExpose({
open
})
</script>
<style scope>
</style>