Ver Fonte

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 há 9 meses atrás
pai
commit
5a5b969bf7

+ 39 - 6
src/views/recruit/enterprise/systemManagement/groupAccount/components/record.vue

@@ -28,7 +28,7 @@ import { enterpriseInviteRecordPage } from '@/api/recruit/enterprise/enterpriseI
 defineOptions({name: 'groupAccount-component-record'})
 const props = defineProps({
   inviteType: {
-    type: String,
+    type: [String, Number],
     default: '0' // 类型 (0 邀请同事 | 1 邀请子公司),示例值(2)
   }
 })
@@ -38,25 +38,58 @@ const loading = ref(false)
 const query = ref({
   pageSize: 10,
   pageNo: 1,
-  type: props.inviteType
+  type: props.inviteType - 0
 })
 const headers = [
-  { title: '企业名称', key: 'enterpriseName' },
-  { title: '被邀请人', key: 'name' },
-  { title: t('enterprise.userManagement.invitationTime'), key: 'loginDate', value: item => timesTampChange(item.loginDate), sortable: false },
+  { title: '企业名称', key: 'showInfo.currentAccountEnterpriseAnotherName', sortable: false },
+  { title: '邀请人', key: 'showInfo.currentAccountUserName', sortable: false },
+  { title: 'invited', key: 'showInfo.invited', sortable: false },
+  { title: t('enterprise.userManagement.invitationTime'), key: 'showInfo.time', sortable: false },
 ]
+headers.forEach(e => { if (e.title === 'invited') e.title = props.inviteType - 0 ? '被邀请企业' : '被邀请人' })
+
 // 获取数据
 const getData = async () => {
   loading.value = true
   try {
+    const info = JSON.parse(localStorage.getItem('baseInfo')) || null
     const { list, total: number } = await enterpriseInviteRecordPage(query.value)
-    tableData.value = list
+    const invitedNames = await Promise.all(list.map(async () => getInvited()))
+    tableData.value = list.map((e, index) => {
+      const showInfo = {
+        currentAccountEnterpriseAnotherName: info?.enterpriseAnotherName || '--',
+        currentAccountUserName: info?.name || '--',
+        invited: invitedNames[index] || '--', // 使用预先获取的invited名称
+        time: e.createTime ? timesTampChange(e.createTime) : '--',
+      }
+      return { showInfo, ...e }
+    })
+    console.log('tableData.value', tableData.value)
     total.value = number
   } finally {
     loading.value = false
   }
 }
+
+const getInvited = async (val) => {
+  try {
+    if (val) {
+      const api = props.inviteType - 0 ? enterpriseInviteRecordPage: enterpriseInviteRecordPage
+      const { data } = await api(query.value)
+      return data.name
+    } else {
+      return '-占位-'
+    }
+  } catch (error) {
+    console.log('error', error)
+  }
+}
 getData()
+
+const handleChangePage = (index) => {
+  query.value.pageNo = index
+  getData()
+}
 </script>
 <style lang="scss" scoped>
 </style>