|
@@ -10,38 +10,53 @@
|
|
|
<span><span class="tab-yellow"/>访问错误次数</span>
|
|
|
</div>
|
|
|
<div class="access-row" v-for="item in accessData">
|
|
|
- <div class="a-r-label">{{item.name}}</div>
|
|
|
+ <div class="a-r-label">{{ item.name }}</div>
|
|
|
<div class="a-r-progress">
|
|
|
<div class="p-total">
|
|
|
<span class="progress" :style="`width: calc(${(item.total/maxValue)*100}% - 40px)`"/>
|
|
|
- {{item.total}}
|
|
|
+ {{ item.total }}
|
|
|
</div>
|
|
|
<div class="p-total p-error">
|
|
|
<span class="progress" :style="`width: ${(item.error/item.total)*100}%`"/>
|
|
|
- {{item.error}}
|
|
|
+ {{ item.error }}
|
|
|
</div>
|
|
|
-<!-- <el-progress :percentage="item.total" :format="(percentage) => (percentage)"/>-->
|
|
|
-<!-- <el-progress :percentage="item.error" :format="(percentage) => (percentage)"/>-->
|
|
|
+ <!-- <el-progress :percentage="item.total" :format="(percentage) => (percentage)"/>-->
|
|
|
+ <!-- <el-progress :percentage="item.error" :format="(percentage) => (percentage)"/>-->
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
import {bizAccess} from "@/api/index/hl"
|
|
|
-import {onMounted} from "vue";
|
|
|
+import {onMounted, onUnmounted} from "vue";
|
|
|
import {useRouter} from "vue-router";
|
|
|
|
|
|
+const props = defineProps(["refreshTime"])
|
|
|
const accessData = ref([])
|
|
|
const maxValue = ref(0)
|
|
|
const router = useRouter()
|
|
|
-onMounted(async ()=>{
|
|
|
+const interval = ref(null)
|
|
|
+onMounted(() => {
|
|
|
+ getBiz()
|
|
|
+ interval.value = setInterval(() => {
|
|
|
+ getBiz()
|
|
|
+ }, props.refreshTime)
|
|
|
+})
|
|
|
+
|
|
|
+
|
|
|
+onUnmounted(() => {
|
|
|
+ clearInterval(interval.value)
|
|
|
+})
|
|
|
+
|
|
|
+const getBiz = async () => {
|
|
|
const res = await bizAccess()
|
|
|
accessData.value = res.data
|
|
|
- maxValue.value = Math.max(...accessData.value.map(item=>item.total))+20
|
|
|
-})
|
|
|
+ maxValue.value = Math.max(...accessData.value.map(item => item.total)) + 20
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
-function target(){
|
|
|
- router.push({path:"/alarm/bizAccess",query:{today:"true"}})
|
|
|
+function target() {
|
|
|
+ router.push({path: "/alarm/bizAccess", query: {today: "true"}})
|
|
|
}
|
|
|
|
|
|
</script>
|