|
@@ -5,8 +5,8 @@
|
|
|
<div class="white-bgc mb-3">
|
|
|
<ProgressBar
|
|
|
label="企业信息填写完成度:"
|
|
|
- :num="completeNum"
|
|
|
- :total="status?.length"
|
|
|
+ :num="completeCount"
|
|
|
+ :total="totalCount"
|
|
|
:fontSize="14"
|
|
|
:inlineDisplay="true"
|
|
|
style="width: 350px;"
|
|
@@ -78,14 +78,34 @@ watch(() => route?.query?.tabKey, (newVal) => {
|
|
|
if (newVal) tab.value = newVal - 0
|
|
|
}, { deep: true, immediate: true })
|
|
|
|
|
|
-const completeNum = ref(0)
|
|
|
-const handleComplete = (val) => {
|
|
|
- if (!val?.id) return
|
|
|
- completeNum.value = 0
|
|
|
+// 完成度计算
|
|
|
+const completeCount = ref(0) // 总完成数
|
|
|
+const totalCount = ref(0) // 总数
|
|
|
+const calcCompletion = () => {
|
|
|
+ let complete = 0
|
|
|
+ let total = 0
|
|
|
status.value.forEach(e => {
|
|
|
- if (e.id === val.id) e.status = val.status || false
|
|
|
- if (e.status) completeNum.value++
|
|
|
+ if (!e.totalCount) return
|
|
|
+ //
|
|
|
+ total = total + e.totalCount
|
|
|
+ //
|
|
|
+ if (e.completeCount) {
|
|
|
+ complete = complete + e.completeCount
|
|
|
+ e.status = e.completeCount === e.totalCount
|
|
|
+ }
|
|
|
})
|
|
|
+ completeCount.value = complete
|
|
|
+ totalCount.value = total
|
|
|
+}
|
|
|
+
|
|
|
+const handleComplete = (val) => { // completeNum: tab内完成数, totalNum: tab内总数。
|
|
|
+ if (!val || !val.id) return
|
|
|
+ const item = status.value.find(e => e.id === val.id)
|
|
|
+ if (item) {
|
|
|
+ item.completeCount = val.completeCount || 0
|
|
|
+ item.totalCount = val.totalCount || 0
|
|
|
+ }
|
|
|
+ calcCompletion()
|
|
|
}
|
|
|
</script>
|
|
|
|