parent
5fe486d490
commit
a4e121ecb0
@ -0,0 +1,53 @@
|
||||
<script lang="ts" setup>
|
||||
import { type PropType, computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
status: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
trigger: {
|
||||
type: Function as PropType<Function>,
|
||||
default: () => { },
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
const actionConfig = {
|
||||
2: [{ label: '查看', key: 'view' }, { label: '通过', key: 'approval' }, { label: '不通过', key: 'reject' }],
|
||||
3: [{ label: '查看', key: 'view' }],
|
||||
5: [{ label: '查看', key: 'view' }],
|
||||
}
|
||||
|
||||
const actions = computed(() => {
|
||||
return actionConfig[props.status]
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :data-id="id">
|
||||
<n-button
|
||||
v-for="(action, index) in actions" :key="index" class="normal"
|
||||
:class="{ gap: index !== 0, reject: index === 1 }" text @click="(trigger(action) as any)"
|
||||
>
|
||||
{{ action.label }}
|
||||
</n-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.normal {
|
||||
color: blue
|
||||
}
|
||||
|
||||
.gap {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
.reject {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,50 @@
|
||||
<script lang="ts" setup>
|
||||
const props = defineProps({
|
||||
status: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="wrap">
|
||||
<div
|
||||
:class="{
|
||||
'point-green': props.status === 3,
|
||||
'point-orange': props.status === 2 || props.status === 1,
|
||||
'point-red': props.status === 5,
|
||||
}" class="point"
|
||||
/>{{ props.label }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
.wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.point{
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
margin-right: 8px;
|
||||
|
||||
&-green{
|
||||
background: #02c984;
|
||||
}
|
||||
|
||||
&-orange{
|
||||
background: #fe9800;
|
||||
}
|
||||
|
||||
&-red{
|
||||
background: #FF4E4F;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue