sc
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="学员姓名" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入学员姓名" />
|
||||
<el-form-item label="学员姓名" prop="userName">
|
||||
<el-input v-model="formData.userName" placeholder="请输入学员姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -24,8 +24,8 @@
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="手机号码" prop="mobile">
|
||||
<el-input v-model="formData.mobile" maxlength="11" placeholder="请输入手机号码" />
|
||||
<el-form-item label="手机号码" prop="phone">
|
||||
<el-input v-model="formData.phone" maxlength="11" placeholder="请输入手机号码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -34,23 +34,6 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="钉钉手机号">
|
||||
<el-input
|
||||
v-model="formData.ddPhone"
|
||||
placeholder="请输入钉钉手机号"
|
||||
clearable
|
||||
@blur="getDingdingUserId"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" :offset="0">
|
||||
<el-form-item label="钉钉Id" prop="dingUserId">
|
||||
<el-input v-model="formData.dingUserId" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="考试类型" prop="examType">
|
||||
@@ -64,9 +47,9 @@
|
||||
>
|
||||
<el-option
|
||||
v-for="item in cartypeOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
:key="item.carTypeId"
|
||||
:label="item.carName"
|
||||
:value="item.carTypeId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -80,10 +63,8 @@
|
||||
</Dialog>
|
||||
</template>
|
||||
<script name="DialogCustomer" setup>
|
||||
import { formatDate } from '@/utils/formatTime'
|
||||
import { defaultProps, handleTree } from '@/utils/tree'
|
||||
|
||||
import * as CustomerApi from '@/api/Customer/customer'
|
||||
import * as CustomerApi from '@/api/Customer/customer.js'
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
@@ -94,15 +75,15 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({})
|
||||
const formRules = ref({
|
||||
name: [{ required: true, message: '学员姓名不能为空', trigger: 'blur' }],
|
||||
userName: [{ required: true, message: '学员姓名不能为空', trigger: 'blur' }],
|
||||
idcard: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入正确的邮箱地址',
|
||||
message: '请输入身份证号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
mobile: [{ required: true, message: '手机号不能为空', trigger: 'blur' }]
|
||||
phone: [{ required: true, message: '手机号不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
const cartypeOptions = ref([])
|
||||
@@ -110,31 +91,23 @@ const cartypeOptions = ref([])
|
||||
const deptList = ref([])
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type, id) => {
|
||||
const open = async (type, info) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await CustomerApi.getCustomerDetail(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
if (info?.userId) {
|
||||
formData.value = { ...info }
|
||||
}
|
||||
deptList.value = handleTree(await DeptApi.getSimpleDeptList({ allFlag: true }))
|
||||
getOptions()
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
function getOptions() {
|
||||
cartypeOptions.value = [
|
||||
{ id: '1', name: 'C1' },
|
||||
{ id: '2', name: 'C2' },
|
||||
{ id: '3', name: 'C3' }
|
||||
] // 示例数据
|
||||
CustomerApi.getCustomerExamCarType().then((data) => {
|
||||
cartypeOptions.value = data
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交表单 */
|
||||
@@ -166,12 +139,12 @@ const submitForm = async () => {
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
name: '',
|
||||
mobile: '',
|
||||
userName: '',
|
||||
phone: '',
|
||||
idcard: '',
|
||||
id: undefined,
|
||||
sex: 1,
|
||||
examType: []
|
||||
examType: [1011]
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-form :model="searchForm" inline @submit.prevent>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="searchForm.name"
|
||||
v-model="searchForm.userName"
|
||||
placeholder="请输入姓名"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
@@ -26,50 +26,60 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select
|
||||
<el-select
|
||||
v-model="searchForm.examType"
|
||||
placeholder="选择考试类型"
|
||||
clearable
|
||||
filterable
|
||||
multiple
|
||||
@change="handleQuery">
|
||||
<el-option
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in carTypeOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value" />
|
||||
:key="item.carTypeId"
|
||||
:label="item.carName"
|
||||
:value="item.carTypeId"
|
||||
/>
|
||||
</el-select>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery" v-hasPermi="['pers:employee:search']">搜索</el-button>
|
||||
<el-button @click="handleQuery" v-hasPermi="['customer:customer:search']">搜索</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['pers:employee:add']"
|
||||
v-hasPermi="['customer:customer:add']"
|
||||
>
|
||||
新增
|
||||
</el-button>
|
||||
<el-upload
|
||||
style="margin-left: 10px"
|
||||
ref="studentFile"
|
||||
action="#"
|
||||
:limit="1"
|
||||
accept=".xls,.xlsx"
|
||||
:show-file-list="false"
|
||||
:before-upload="fileBeforeUpload"
|
||||
:http-request="handleImport"
|
||||
v-hasPermi="['customer:customer:import']"
|
||||
>
|
||||
<el-button type="primary" plain>导入</el-button>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="tableList" border stripe>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="姓名" prop="name" />
|
||||
<el-table-column label="职位" prop="post" />
|
||||
<el-table-column label="手机号码" prop="mobile" width="120" />
|
||||
<el-table-column label="微信号" prop="wxAlias" min-width="120" />
|
||||
<el-table-column label="钉钉号" prop="dingUserId" min-width="120" />
|
||||
<el-table-column label="考勤方案" prop="attendanceSettingName" width="100" />
|
||||
<el-table-column label="绩效考核人" prop="meritsExamineUserNames" width="120" />
|
||||
<el-table-column label="已开通系统" prop="instanceName" min-width="120" />
|
||||
<el-table-column label="姓名" prop="userName" />
|
||||
<el-table-column label="性别" prop="sex" />
|
||||
<el-table-column label="手机号码" prop="phone" width="120" />
|
||||
<el-table-column label="身份证号" prop="idcard" min-width="120" />
|
||||
<el-table-column label="考试类型" prop="examType" min-width="120" />
|
||||
<el-table-column label="操作" width="260" fixed="right">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click="openForm('update', scope.row.id)"
|
||||
@click="openForm('update', scope.row)"
|
||||
v-hasPermi="['pers:employee:update']"
|
||||
>
|
||||
修改
|
||||
@@ -77,7 +87,7 @@
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
@click="handleDelete(scope.row.id)"
|
||||
@click="handleDelete(scope.row.userId)"
|
||||
v-hasPermi="['pers:employee:delete']"
|
||||
>
|
||||
删除
|
||||
@@ -98,7 +108,7 @@
|
||||
<script name="CustomerList" setup>
|
||||
import DialogCustomer from './Comp/DialogCustomer.vue'
|
||||
import { removeNullField } from '@/utils'
|
||||
import * as CustomerApi from '@/api/Customer/customer'
|
||||
import * as CustomerApi from '@/api/customer/customer.js'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
@@ -106,19 +116,16 @@ const { t } = useI18n() // 国际化
|
||||
const carTypeOptions = ref([])
|
||||
|
||||
const searchForm = ref({
|
||||
name: undefined,
|
||||
userName: undefined,
|
||||
examType: 1011,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
carTypeOptions.value = [
|
||||
{ value: '1', label: 'C1' },
|
||||
{ value: '2', label: 'C2' },
|
||||
{ value: '3', label: 'C3' }
|
||||
] // 示例数据
|
||||
|
||||
CustomerApi.getCustomerExamCarType().then((res) => {
|
||||
carTypeOptions.value = res
|
||||
})
|
||||
handleQuery()
|
||||
})
|
||||
|
||||
@@ -145,8 +152,8 @@ const getList = async () => {
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type, id = undefined) => {
|
||||
formRef.value.open(type, id)
|
||||
const openForm = (type, info = undefined) => {
|
||||
formRef.value.open(type, info)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
@@ -161,6 +168,33 @@ const handleDelete = async (id) => {
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const fileBeforeUpload = (file) => {
|
||||
let format = '.' + file.name.split('.')[1]
|
||||
if (!['.xls', '.xlsx'].includes(format)) {
|
||||
message.error(`请上传指定格式".xls,.xlsx"文件`)
|
||||
return false
|
||||
}
|
||||
let isRightSize = file.size / 1024 / 1024 < 20
|
||||
if (!isRightSize) {
|
||||
message.error('文件大小超过 20MB')
|
||||
}
|
||||
return isRightSize
|
||||
}
|
||||
|
||||
const uploading = ref(false)
|
||||
async function handleImport(data) {
|
||||
uploading.value = true
|
||||
const fd = new FormData()
|
||||
fd.append('file', data.file)
|
||||
try {
|
||||
await CustomerApi.importStudent(fd)
|
||||
message.success('导入成功')
|
||||
handleQuery()
|
||||
} finally {
|
||||
uploading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :model="searchForm" inline @submit.prevent>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="searchForm.userName"
|
||||
placeholder="请输入姓名"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="searchForm.phone"
|
||||
placeholder="请输入手机号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-input
|
||||
v-model="searchForm.idcard"
|
||||
placeholder="请输入身份证号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select
|
||||
v-model="searchForm.examType"
|
||||
placeholder="选择考试类型"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in carTypeOptions"
|
||||
:key="item.carTypeId"
|
||||
:label="item.carName"
|
||||
:value="item.carTypeId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-select
|
||||
v-model="searchForm.subject"
|
||||
placeholder="选择科目"
|
||||
clearable
|
||||
filterable
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option label="科一" :value="1" />
|
||||
<el-option label="科四" :value="4" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-date-picker
|
||||
v-model="searchForm.examTime"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="考试日期"
|
||||
end-placeholder="日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery" v-hasPermi="['customer:exam-record:list']">搜索</el-button>
|
||||
<el-button @click="handleExport" v-hasPermi="['customer:exam-record:export']">
|
||||
导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table v-loading="loading" :data="tableList" border stripe>
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column label="姓名" prop="userName" />
|
||||
<el-table-column label="手机号码" prop="phone" width="120" />
|
||||
<el-table-column label="身份证号" prop="idcard" min-width="120" />
|
||||
<el-table-column label="考试类型" prop="examType" min-width="120" />
|
||||
<el-table-column label="考试科目" prop="subject" min-width="120" />
|
||||
<el-table-column label="考试得分" prop="score" min-width="120" />
|
||||
<el-table-column label="交卷时间" prop="createTime" min-width="120" />
|
||||
<el-table-column label="考试时长" prop="testTimeStr" min-width="120" />
|
||||
</el-table>
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="searchForm.pageNo"
|
||||
v-model:limit="searchForm.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ExamRecord">
|
||||
import { removeNullField } from '@/utils'
|
||||
import * as ExamRecordApi from '@/api/customer/examRecord.js'
|
||||
|
||||
import { getCustomerExamCarType } from '@/api/customer/customer.js'
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const carTypeOptions = ref([])
|
||||
|
||||
const searchForm = ref({
|
||||
userName: undefined,
|
||||
examType: 1011,
|
||||
pageNo: 1,
|
||||
pageSize: 20
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getCustomerExamCarType().then((res) => {
|
||||
carTypeOptions.value = res
|
||||
})
|
||||
|
||||
handleQuery()
|
||||
})
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
searchForm.value.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
const loading = ref(false)
|
||||
const tableList = ref([])
|
||||
const total = ref(0)
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
if (searchForm.value.examTime && searchForm.value.examTime.length > 0) {
|
||||
searchForm.value.startTime = searchForm.value.examTime[0]
|
||||
searchForm.value.endTime = searchForm.value.examTime[1]
|
||||
} else {
|
||||
searchForm.value.startTime = undefined
|
||||
searchForm.value.endTime = undefined
|
||||
}
|
||||
const data = await ExamRecordApi.getRecordPage(removeNullField(searchForm.value))
|
||||
tableList.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
const params = removeNullField(searchForm.value)
|
||||
if (params.examTime && params.examTime.length > 0) {
|
||||
params.startTime = params.examTime[0]
|
||||
params.endTime = params.examTime[1]
|
||||
} else {
|
||||
params.startTime = undefined
|
||||
params.endTime = undefined
|
||||
}
|
||||
ExamRecordApi.exportRecord(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
message.success('导出成功')
|
||||
} else {
|
||||
message.error(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
Reference in New Issue
Block a user