chooseExaminer.vue
2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<template>
<el-dialog
v-model="show" destroy-on-close title="选择考官" width="800"
>
<div>
<el-button :disabled="showBtn" type="primary" @click="handelAddExaminer">批量添加考官</el-button>
<!-- <el-button type="primary" @click="handelAdd">添加考官</el-button>-->
</div>
<br>
<el-table v-loading="loading" :data="infoList" border @selection-change="handleSelectionChange">
<el-table-column :selectable="selectable" align="center" type="selection" width="55" />
<el-table-column align="center" label="序号" type="index" width="55" />
<el-table-column align="center" label="姓名" prop="perName" />
<el-table-column align="center" label="会员号" prop="perCode" width="130px" />
<el-table-column align="center" label="证件号码" min-width="200" prop="perIdcCode" />
<el-table-column
align="center" label="注册单位" min-width="200" prop="roleInfo.unit"
/>
</el-table>
<pagination
v-show="total > 0"
v-model:limit="queryParams.pageSize"
v-model:page="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- <ChooseRankExaminer ref="ChooseRankExaminerRef" is-validity="0" @chosen="chosenExaminer" />-->
</el-dialog>
</template>
<script setup>
import { computed, getCurrentInstance, ref } from 'vue'
import { listApi, selfAdd } from '@/api/exam/examinationAudit'
// import ChooseRankExaminer from '/@/views/exam/components/chooseRankExaminer.vue'
import useUserStore from '/@/store/modules/user'
const memId = computed(() => useUserStore().memId)
const emit = defineEmits(['chosen'])
const show = ref(false)
const infoList = ref([])
const loading = ref(false)
const total = ref(0)
const ids = ref([])
const list = ref([])
const showBtn = ref(true)
const queryParams = ref({
pageNum: 1,
pageSize: 10
})
const { proxy } = getCurrentInstance()
async function getList() {
const res = await listApi({ chooseFlag: 1 })
infoList.value = res.rows
for (const val of infoList.value) {
if (val.roleInfo) val.roleInfo = JSON.parse(val.roleInfo)
}
total.value = res.total
}
async function chosenExaminer(row) {
await selfAdd(memId.value, row.perId)
await proxy.$modal.msgSuccess('操作成功!')
emit('chosen', memId.value)
show.value = false
}
function selectable(row) {
return !list.value.some(v => v.perId == row.perId)
}
function handleSelectionChange(e) {
ids.value = e.map(v => v.perId)
showBtn.value = !e.length
}
function handelAddExaminer() {
if (!ids.value.length) {
proxy.$modal.msgError('请选择考官')
return
}
emit('chosen', ids.value)
show.value = false
}
function handelAdd() {
proxy.$refs['ChooseRankExaminerRef'].open({
ec: memId.value,
type: '1',
chosen: list.value
})
}
function open(row) {
ids.value = []
list.value = row.chosen ?? []
show.value = true
queryParams.value = {
pageNum: 1,
pageSize: 10
}
getList()
}
defineExpose({
open
})
</script>
<style scoped>
</style>