Browse Source
- 新增 Progress 组件用于显示任务进度 - 在 TaskView2 组件中集成 Progress组件 - 优化任务列表数据结构,增加 progressVal 和 progressSum 字段master
2 changed files with 80 additions and 3 deletions
@ -0,0 +1,65 @@ |
|||
<script setup lang="ts"> |
|||
import { reactive } from "vue"; |
|||
import { ElProgress } from "element-plus"; |
|||
import { type ICellRendererParams, } from "ag-grid-enterprise"; |
|||
import { Typeof } from "@ease-forge/shared"; |
|||
|
|||
// 定义组件选项 |
|||
defineOptions({ |
|||
name: 'Progress', |
|||
}); |
|||
|
|||
// 定义 Props 类型 |
|||
interface ProgressProps { |
|||
|
|||
} |
|||
|
|||
/** 单元格组件Props */ |
|||
interface CellComponentProps<T = {}> { |
|||
params: ICellRendererParams<any, any, any> & T; |
|||
} |
|||
|
|||
// 读取组件 props 属性 |
|||
const props = defineProps<CellComponentProps<ProgressProps>>(); |
|||
|
|||
// 定义 State 类型 |
|||
interface ProgressState { |
|||
} |
|||
|
|||
// state 属性 |
|||
const state = reactive<ProgressState>({}); |
|||
|
|||
const params = props.params; |
|||
const progressVal = params?.data?.progressVal ?? 0; |
|||
const progressSum = params?.data?.progressSum; |
|||
|
|||
export type { |
|||
ProgressProps, |
|||
ProgressState, |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<ElProgress |
|||
v-if="Typeof.isNum(progressSum)" |
|||
class="ag-cell-progress flex-item-fill" |
|||
:percentage="progressVal/(Math.max(progressSum, 1))*100" |
|||
:textInside="true" |
|||
:format="()=>`${progressVal}/${progressSum}`" |
|||
:striped="true" |
|||
:stripedFlow="true" |
|||
:strokeWidth="18" |
|||
/> |
|||
</template> |
|||
|
|||
<style> |
|||
.ag-cell-value:has(> .ag-cell-progress), .ag-group-value:has(> .ag-cell-progress) { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
} |
|||
|
|||
.ag-cell-progress .el-progress-bar__innerText { |
|||
color: #434343; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue