chooseRankExaminer.vue
4.46 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<template>
<el-dialog
v-model="show" width="800" title="选择考官" append-to-body
draggable
>
<el-form ref="dialogQueryRef" :inline="true" :model="queryParams" size="small" @submit.native.prevent>
<el-form-item label="考官姓名" prop="name">
<el-input
v-model.trim="queryParams.name" style="width: 190px;" placeholder="考官姓名" clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item v-show="queryParams.type==1" label="考官编号" prop="certCode">
<el-input
v-model.trim="queryParams.certCode" style="width: 190px;" placeholder="考官编号" clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="证件号码" prop="idcCode">-->
<!-- <el-input v-model="queryParams.idcCode" placeholder="身份证号" style="width: 214px" clearable @keyup.enter="handleQuery" />-->
<!-- </el-form-item>-->
<el-form-item label=" ">
<el-button type="primary" icon="Search" @click="handleQuery">查 询</el-button>
<el-button icon="Refresh" @click="resetQuery">重 置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" border :data="infoList">
<el-table-column type="index" width="55" align="center" label="序号" />
<el-table-column label="姓名" align="center" prop="name" />
<el-table-column width="130px" label="会员号" align="center" prop="perCode" />
<el-table-column label="证件号码" align="center" prop="idcCode" min-width="200" />
<!-- <el-table-column-->
<!-- label="注册地" align="center" prop="memName" min-width="200"-->
<!-- />-->
<el-table-column
label="注册单位" align="center" prop="roleInfo.unit" min-width="200"
/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<span v-if="checkChosen(scope.row)">选择</span>
<el-button v-else link type="primary" @click="handleChoose(scope.row)">选择</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
</el-dialog>
</template>
<script setup>
import { getCurrentInstance, ref, toRefs } from 'vue'
import { reactive } from '@vue/runtime-core'
import { coachList } from '@/api/exam/info'
import _ from 'lodash'
const { proxy } = getCurrentInstance()
const emit = defineEmits(['chosen'])
const props = defineProps({
isValidity: {
type: String,
default: ' 1'
}
})
const show = ref(false)
const infoList = ref([])
const loading = ref(false)
const total = ref(0)
const data = reactive({
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
idcCode: null,
type: ''
}
})
const { queryParams } = toRefs(data)
function getList() {
if (!queryParams.value.name) return proxy.$message.warning('请输入考官姓名')
if (!queryParams.value.certCode && queryParams.value.type == 1) return proxy.$message.warning('请输入考官编号')
loading.value = true
infoList.value = []
coachList(queryParams.value).then(response => {
infoList.value = response.rows
for (const val of infoList.value) {
if (val.personRoleInfo) val.roleInfo = JSON.parse(val.personRoleInfo)
}
total.value = response.total
loading.value = false
if (infoList.value.length == 0) return proxy.$message.error('请核实考官编号、有效期及归属地!')
})
}
function checkChosen(row) {
return _.some(chosen, (c) => {
return c.perId == row.perId
})
}
function handleQuery() {
queryParams.value.pageNum = 1
getList()
}
function resetQuery() {
proxy.resetForm('dialogQueryRef')
infoList.value = []
total.value = 0
// handleQuery()
}
function handleChoose(row) {
if (row.canChoose != 1 && props.isValidity == 1) {
return proxy.$message.warning('该考官资质已过期!')
} else {
emit('chosen', {
perId: row.perId,
name: row.name
}, ec)
show.value = false
}
}
let ec = null
let chosen = null
function open(params, row) {
ec = params.ec
queryParams.value.type = params.type
chosen = params.chosen || []
resetQuery()
if (row) queryParams.value.shenMemId = row + ''
show.value = true
}
defineExpose({
open
})
</script>
<style scoped>
</style>