index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <!-- 企业信息设置 -->
  2. <template>
  3. <div>
  4. <!-- v-if="completeNum !== tabList?.length" -->
  5. <div class="white-bgc mb-3">
  6. <ProgressBar
  7. label="企业信息填写完成度:"
  8. :num="completeCount"
  9. :total="totalCount"
  10. :fontSize="14"
  11. :inlineDisplay="true"
  12. style="width: 350px;"
  13. ></ProgressBar>
  14. </div>
  15. <v-card class="card-box pa-5" style="min-height: 500px">
  16. <v-tabs v-model="tab" align-tabs="start" color="primary" bg-color="#f7f8fa">
  17. <v-tab v-for="val in tabList" :key="val.value" :value="val.value" >
  18. {{ val.label }}
  19. <template v-slot:append>
  20. <template v-if="status.find(e => e.id === val.id).status === false">
  21. <v-icon color="orange">mdi-information-outline</v-icon>
  22. <v-tooltip activator="parent" location="top">请完善{{ val.label }}</v-tooltip>
  23. </template>
  24. </template>
  25. </v-tab>
  26. </v-tabs>
  27. <div class="mt-3">
  28. <template v-for="item in tabList" :key="item.id">
  29. <div v-show="item.value === tab">
  30. <component
  31. ref="componentRef"
  32. :is="item.path"
  33. @complete="handleComplete"
  34. />
  35. </div>
  36. </template>
  37. </div>
  38. </v-card>
  39. </div>
  40. </template>
  41. <script setup>
  42. defineOptions({ name: 'enterprise-system-management-information-settings'})
  43. import basicInfo from './informationSettingsComponents/basicInfo.vue'
  44. import enterpriseLogo from './informationSettingsComponents/enterpriseLogo.vue'
  45. import enterpriseAlbum from './informationSettingsComponents/enterpriseAlbum.vue'
  46. import welfareLabel from './informationSettingsComponents/welfareLabel.vue'
  47. import enterpriseLabel from './informationSettingsComponents/enterpriseLabel.vue'
  48. import businessInformation from './informationSettingsComponents/businessInformation.vue'
  49. import ProgressBar from '@/components/ProgressBar'
  50. import { ref, watch } from 'vue'
  51. import {
  52. useRoute,
  53. } from 'vue-router'
  54. import { useI18n } from '@/hooks/web/useI18n'
  55. const componentRef = ref()
  56. const route = useRoute()
  57. const { t } = useI18n()
  58. // tab
  59. const tab = ref(1)
  60. const tabList = [
  61. { label: t('enterprise.infoSetting.basicInfo'), value: 1, path: basicInfo, id: 'basicInfo' },
  62. { label: t('enterprise.infoSetting.enterpriseLogo'), value: 2, path: enterpriseLogo, id: 'enterpriseLogo' },
  63. { label: t('enterprise.infoSetting.enterpriseAlbum'), value: 3, path: enterpriseAlbum, id: 'enterpriseAlbum' },
  64. { label: t('enterprise.infoSetting.welfareLabel'), value: 4, path: welfareLabel, id: 'welfareLabel' },
  65. { label: t('enterprise.infoSetting.enterpriseLabel'), value: 7, path: enterpriseLabel, id: 'enterpriseLabel' },
  66. { label: t('enterprise.infoSetting.businessInformation'), value: 5, path: businessInformation, id: 'businessInformation' },
  67. ]
  68. const status = ref([
  69. { id: 'basicInfo', status: false },
  70. { id: 'enterpriseLogo', status: false },
  71. { id: 'enterpriseAlbum', status: false },
  72. { id: 'welfareLabel', status: false },
  73. { id: 'enterpriseLabel', status: false },
  74. { id: 'businessInformation', status: false }
  75. ])
  76. watch(() => route?.query?.tabKey, (newVal) => {
  77. if (newVal) tab.value = newVal - 0
  78. }, { deep: true, immediate: true })
  79. // 完成度计算
  80. const completeCount = ref(0) // 总完成数
  81. const totalCount = ref(0) // 总数
  82. const calcCompletion = () => {
  83. let complete = 0
  84. let total = 0
  85. status.value.forEach(e => {
  86. if (!e.totalCount) return
  87. //
  88. total = total + e.totalCount
  89. complete = complete + (e.completeCount || 0)
  90. e.status = e.completeCount === e.totalCount
  91. })
  92. completeCount.value = complete
  93. totalCount.value = total
  94. }
  95. // 企业信息填写完成度
  96. const handleComplete = (val) => { // completeNum: tab内完成数, totalNum: tab内总数。
  97. if (!val || !val.id) return
  98. const item = status.value.find(e => e.id === val.id)
  99. if (item) {
  100. item.completeCount = val.completeCount || 0
  101. item.totalCount = val.totalCount || 0
  102. }
  103. calcCompletion()
  104. // 目前 基础信息里面的企业名称 和工商信息里面的企业名称 没有要求需要一致
  105. // if (val.isUpdate && val.id === 'businessInformation') {
  106. // // 工商信息更改同时更新基本信息
  107. // if (componentRef.value?.length) {
  108. // componentRef.value[0].getBaseInfo()
  109. // }
  110. // }
  111. }
  112. </script>
  113. <style scoped lang="scss">
  114. .topTip {
  115. background-color: #f7f8fa;
  116. color: #2f3640;
  117. padding: 12px 20px;
  118. margin: 10px 0 20px;
  119. font-size: 14px;
  120. }
  121. </style>