37 lines
952 B
Plaintext
37 lines
952 B
Plaintext
<template>
|
|
<text v-if="text != ''" :class="pcClass" :style="pcStyle">{{ text }}</text>
|
|
</template>
|
|
|
|
<script lang="uts" setup>
|
|
import { computed } from 'vue'
|
|
|
|
/**
|
|
* 优先级角标
|
|
* 0 → P0 紧急(红) / 1 → P1 优先(黄) / 2 → P2 常规(蓝)
|
|
*/
|
|
const props = defineProps({
|
|
level : { type: Number, default: 2 },
|
|
/** 自定义文字,空则取 P0/P1/P2 */
|
|
text : { type: String, default: '' },
|
|
/** 实底(默认)或浅底 */
|
|
outline : { type: Boolean, default: false }
|
|
})
|
|
|
|
const label = computed(() : string => {
|
|
if (props.text != '') { return props.text }
|
|
return `P${props.level}`
|
|
})
|
|
|
|
const pcClass = computed(() : string => {
|
|
return `hr-pc hr-pc${props.level}`
|
|
})
|
|
|
|
const pcStyle = computed(() : string => {
|
|
let c = '#DC2626'
|
|
if (props.level == 1) { c = '#F59E0B' }
|
|
if (props.level == 2) { c = '#2563EB' }
|
|
if (!props.outline) { return '' }
|
|
return `background-color:${c}1A;color:${c};`
|
|
})
|
|
</script>
|