| | |
| | | <el-input v-model.trim="state.form.courseName" :disabled="disabled" placeholder="请输入课程名称" ></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="培训等级:" prop="level" > |
| | | <el-input v-model.trim="state.form.level" :disabled="disabled" placeholder="请输入培训等级" ></el-input> |
| | | <el-select |
| | | v-model="state.form.level" |
| | | style="width: 100%" |
| | | > |
| | | <el-option |
| | | v-for="item in state.levelList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <!-- <el-input v-model.trim="state.form.level" :disabled="disabled" placeholder="请输入培训等级" ></el-input>--> |
| | | </el-form-item> |
| | | <el-form-item label="要求课时(分):" prop="period" > |
| | | <el-input v-model.trim="state.form.period" :disabled="disabled" placeholder="请输入要求课时(分)" ></el-input> |
| | |
| | | <el-radio :label="0">不合格</el-radio> |
| | | <el-radio :label="1">合格</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="培训记录:" prop="passed" > |
| | | <el-upload accept=".jpg,.jpeg,.png,.doc,.docx,.pdf,.xls,xlsx,ppt,pptx" style="width: 100%" :action="state.uploadUrl" :headers="state.header" method="post" :on-success="(res, uploadFile)=>handleAvatarSuccess(res, uploadFile)" :on-exceed="showTip" v-model:file-list="state.fileList" :before-upload="picSize" :on-remove="(file, uploadFiles)=>handleRemove(file, uploadFiles)" > |
| | | <el-button type="primary">点击上传</el-button> |
| | | <!-- <template #tip>--> |
| | | <!-- <div class="el-upload__tip">尺寸小于5M,最多可上传1份</div>--> |
| | | <!-- </template>--> |
| | | </el-upload> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer v-if="state.title !='查看'"> |
| | |
| | | import {addStudent, checkStuIdNo, checkStuPhone, editStudent} from "@/api/onlineEducation/student"; |
| | | import {addRecord, editRecord} from "@/api/onlineEducation/examRecord"; |
| | | import {getCompany} from "@/api/onlineEducation/company"; |
| | | import {delPic} from "@/api/onlineEducation/banner"; |
| | | import {getToken} from "@/utils/auth"; |
| | | |
| | | const emit = defineEmits(["getList"]); |
| | | const dialogVisible = ref(false) |
| | |
| | | passed: 0, |
| | | studentName: '', |
| | | courseName: '', |
| | | companyId: null |
| | | companyId: null, |
| | | files: [] |
| | | |
| | | }, |
| | | formRules:{ |
| | |
| | | companyPageNum: 1, // 当前页码 |
| | | companyPageSize: 10, // 每页显示的数量 |
| | | hasMoreItems: null, // 是否还有更多选项 |
| | | levelList: [ |
| | | { |
| | | id: 1, |
| | | name: '公司级' |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '部门级' |
| | | }, |
| | | ], |
| | | uploadUrl: import.meta.env.VITE_APP_BASE_API + '/system/common/uploadFile', |
| | | header: { |
| | | Authorization: getToken() |
| | | }, |
| | | |
| | | }) |
| | | onMounted(() => { |
| | |
| | | if( type === 'view'){ |
| | | disabled.value = true; |
| | | } |
| | | state.form = value |
| | | |
| | | state.form = JSON.parse(JSON.stringify(value)) |
| | | state.form.studentId = value.student.id |
| | | state.form.studentName = value.student.name |
| | | state.fileList = value.files.map(i => { |
| | | return { |
| | | name: i.fileName, |
| | | path: i.filePath |
| | | } |
| | | }) |
| | | // state.form.studentName = value.company.name; |
| | | console.log("ba",state.form) |
| | | } |
| | |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }else if(state.title == '编辑'){ |
| | | const {id, name, phone, sex, companyId, empno, post, duty, idNo} = state.form |
| | | const data = {id, name, phone, sex, companyId, empno, post, duty, idNo} |
| | | const {...data} = state.form |
| | | const res = await editRecord(data) |
| | | if(res.code == 200){ |
| | | ElMessage.success(res.message) |
| | |
| | | state.stuPageNum = 1; |
| | | state.stuPageSize = 10; |
| | | state.studentList = []; |
| | | state.fileList = [] |
| | | superRef.value.clearValidate(); |
| | | superRef.value.resetFields() |
| | | dialogVisible.value = false; |
| | |
| | | ElMessage.warning(res.message) |
| | | } |
| | | } |
| | | const handleAvatarSuccess = (response,uploadFile) => { |
| | | if(response.code == 200){ |
| | | state.form.files = state.fileList.map(item => { |
| | | return { |
| | | fileName: item.response ? item.response?.data.originName: item.name, |
| | | filePath: item.response ? item.response?.data.path: item.path |
| | | } |
| | | }) |
| | | }else{ |
| | | // state.fileList = [] |
| | | // state.form.files = [] |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: res.message |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const showTip =()=>{ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '超出文件上传数量' |
| | | }); |
| | | } |
| | | const picSize = async (rawFile) => { |
| | | if(rawFile.size / 1024 / 1024 > 5){ |
| | | ElMessage({ |
| | | type: 'warning', |
| | | message: '文件大小不能超过5M' |
| | | }); |
| | | return false |
| | | } |
| | | }; |
| | | const handleRemove = async (file, uploadFiles) => { |
| | | state.form.files = state.fileList.map(item => { |
| | | return { |
| | | fileName: item.response ? item.response?.data.originName: item.name, |
| | | filePath: item.response ? item.response?.data.path: item.path |
| | | } |
| | | }) |
| | | // let path = state.form.filePath; |
| | | // await delPic({path: path}).then(res => { |
| | | // if(res.code == 200){ |
| | | // // ElMessage({ |
| | | // // type: 'success', |
| | | // // message: '文件已删除' |
| | | // // }) |
| | | // state.form.fileName = '' |
| | | // state.form.filePath = '' |
| | | // }else{ |
| | | // ElMessage({ |
| | | // type: 'warning', |
| | | // message: res.message |
| | | // }) |
| | | // } |
| | | // }).catch(() => { |
| | | // state.form.fileName = '' |
| | | // state.form.filePath = '' |
| | | // }); |
| | | } |
| | | |
| | | |
| | | defineExpose({ |