From a030cd7ebede3762fda4dcb6511f43712a417a58 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 20 六月 2025 13:25:45 +0800 Subject: [PATCH] 2025.6.20 --- src/components/inspection/TaskItem.vue | 156 ++++++++++++++++++++++++++++++++------------------- 1 files changed, 98 insertions(+), 58 deletions(-) diff --git a/src/components/inspection/TaskItem.vue b/src/components/inspection/TaskItem.vue index be50b89..433d7d1 100644 --- a/src/components/inspection/TaskItem.vue +++ b/src/components/inspection/TaskItem.vue @@ -1,40 +1,59 @@ <template> - <div class="demo-progress border-r-small f-b"> - <el-row> - <el-col span="8"> - <el-progress :width="100" type="dashboard" :percentage="(finish / total) * 100"> + <div v-if="value"> + <el-row justify="start"> + <el-text>{{ value.name }}</el-text> + </el-row> + <div> + <el-text>鎬婚噺</el-text> + <el-text v-if="value._totaltask > 0" size="default">{{ + value._completetask + '/' + value._totaltask + }}</el-text> + <el-text v-else size="default">{{ value.completetask + '/' + value.totaltask }}</el-text> + <el-progress + style="width: 300px" + type="line" + status="warning" + :text-inside="true" + :stroke-width="18" + :striped="percentFormat(value.completetask, value.totaltask) < 100" + striped-flow + :percentage="percentFormat(value.completetask, value.totaltask)" + > + <template #default="{ percentage }"> + <span class="percentage-value">{{ percentage }}%</span> + </template> + </el-progress> + </div> + <!-- </el-col> --> + <!-- <el-col span="12" class="flex-bottom"> --> + <!-- <div>{{ name }}</div> --> + <!-- <div>{{ planTime }}</div> --> + <!-- <div>{{ userName }}</div> --> + <el-row class="m-t-8"> + <div + align="center" + :style="'width: ' + 300 / value.count.length + 'px'" + v-for="item in value.count" + :key="item.sceneType" + > + <el-progress + :stroke-width="18" + status="exception" + :text-inside="true" + :striped="percentFormat(item.finish, item.total) < 100" + striped-flow + :percentage="percentFormat(item.finish, item.total)" + > <template #default="{ percentage }"> - <span class="percentage-value">{{ percentage }}%</span> - <span class="percentage-label">{{ finish + '/' + total }}</span> + <span class="percentage-value-small">{{ percentage }}%</span> </template> </el-progress> - </el-col> - <el-col span="16"> - <div>{{ name }}</div> - <!-- <div>{{ planTime }}</div> --> - <div>{{ userName }}</div> - <el-row style="gap: 10px"> - <div class="v-center" v-for="item in count" :key="item.sceneType"> - <el-progress - :width="50" - :stroke-width="3" - type="dashboard" - :percentage="(item.finish / item.total) * 100" - > - <template #default="{ percentage }"> - <span class="percentage-value-small">{{ percentage }}%</span> - </template> - </el-progress> - <div> - <el-text size="small">{{ item.sceneType }}</el-text> - <el-text size="small">{{ item.finish + '/' + item.total }}</el-text> - </div> - <div></div> - <!-- <div class="percentage-label-small">{{ item.sceneType }}</div> --> - <!-- <span class="percentage-label-small">{{ item.finish + '/' + item.total }} </span> --> - </div> - </el-row> - </el-col> + <el-text size="small" truncated>{{ item.sceneType }}</el-text> + <!-- <el-text size="small">{{ item.finish + '/' + item.total }}</el-text> --> + <!-- <span class="percentage-value-small">{{ percentFormat(item.finish, item.total) }}%</span> --> + <!-- <div class="percentage-label-small">{{ item.sceneType }}</div> --> + <!-- <span class="percentage-label-small">{{ item.finish + '/' + item.total }} </span> --> + </div> </el-row> </div> </template> @@ -45,37 +64,53 @@ */ export default { props: { - name: String, - district: String, - planTime: String, - startTime: String, - endTime: String, - userName: String, - status: String, + // name: String, + // province: String, + // district: String, + // planTime: String, + // startTime: String, + // endTime: String, + // userName: String, + // status: String, + // totaltask: Number, + // completetask: Number, + // count: Array, - count: Array + value: Object }, data() { return {} }, watch: {}, computed: { - total() { - let t = 0 - this.count.forEach((c) => { - t += c.total - }) - return t - }, - finish() { - let t = 0 - this.count.forEach((c) => { - t += c.finish - }) - return t - } + // total() { + // let t = 0 + // this.count.forEach((c) => { + // t += c.total + // }) + // return t + // }, + // finish() { + // let t = 0 + // this.count.forEach((c) => { + // t += c.finish + // }) + // return t + // } }, - methods: {} + methods: { + percentFormat(finish, total) { + if (total == 0) { + return 0 + } else { + const per = finish / total > 1 ? 1 : finish / total + return Math.round(per * 100) + } + }, + format(percentage) { + percentage === 100 ? 'Full' : `${percentage}%` + } + } } </script> @@ -85,10 +120,15 @@ border-radius: var(--el-border-radius-base); } +.flex-bottom { + display: flex; + flex-direction: column; + justify-content: end; +} + .percentage-value { display: block; - margin-top: 10px; - font-size: var(--el-font-size-base); + font-size: var(--el-font-size-small); } .percentage-value-small { display: block; -- Gitblit v1.9.3