Bladeren bron

考试明细统计调整

luoaoxuan 1 jaar geleden
bovenliggende
commit
5fed68578c
1 gewijzigde bestanden met toevoegingen van 16 en 5 verwijderingen
  1. 16 5
      src/views/platform/examination/exam/detail.vue

+ 16 - 5
src/views/platform/examination/exam/detail.vue

@@ -262,8 +262,9 @@ export default {
         }
     },
     data () {
-        const { userList } = this.$store.getters || {}
+        const { userList, mainPosition } = this.$store.getters || {}
         return {
+            mainPosition,
             userList,
             title: '考试详情',
             dialogVisible: this.visible,
@@ -360,11 +361,21 @@ export default {
             this.posData()
         },
         // 获取部门数据
-        posData () {
+        async posData () {
+            const sql = `select p.*,r.SUB_PID_ as userId FROM IBPS_PARTY_POSITION p INNER JOIN ibps_party_rel r ON p.id_ = r.MAIN_PID_ WHERE r.BIZ_ = 'mainPost' ORDER BY p.CREATE_TIME_ DESC`
+            const { variables: { data }} = await this.$common.request('sql', sql)
             this.paperList.forEach((item) => {
-                const user = this.userList.find((u) => u.userName === item.userName)
-                item.positionId = user.positionId
-                item.positionName = user.positions
+                const mainUser = data.find(i => i.userId === item.examinee)
+                // 如果有主部门  只统计主部门
+                if (mainUser) {
+                    item.positionId = mainUser?.ID_ || ''
+                    item.positionName = mainUser?.NAME_ || ''
+                } else {
+                    // 没有主部门 则统计全部
+                    const user = this.userList.find((u) => u.userId === item.examinee)
+                    item.positionId = user?.positionId || ''
+                    item.positionName = user?.positions || ''
+                }
             })
         },
         handleActionEvent ({ key }) {