You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

592 lines
24 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div>
<xy-dialog ref="dialog" :width="70" :is-show.sync="isShow" :type="'form'" :title="typeName" :form="form">
<template v-slot:show>
<div class="xy-table-item" style="padding: 0 20px;">
<div class="xy-table-item-label" style="font-weight: bold;width:0;padding: 0;display: none;">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>
</div>
<div class="xy-table-item-content" style="flex-grow: 1;">
<div class="courseName" v-if="type=='check' || type=='checkshow' ">
<div>课程名称:{{subjectObj.title}}</div>
<div>开课日期:{{subjectObj.date?subjectObj.date:'开课待定'}}</div>
<div>课程体系:{{subjectObj.leibie}}</div>
</div>
<div>
<lx-header icon="" :text="''"
style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<template v-slot:textcontent>
<span>{{type=='checkshow' || type=='check'?'报名信息':'个人信息'}}</span>
<span v-if="type=='checkshow' || type=='check'">
(注:<span style="color:red">红色标识</span>为学员本次报名提交的信息,<span style="color:#000">黑色标识</span>为学员过往信息)
</span>
</template>
</lx-header>
<div>
<el-descriptions class="margin-top" :column="2" border>
<!-- 学员字段表 -->
<el-descriptions-item v-for="item in selectFormList" :span="item.span?item.span:1">
<template slot="label">
{{item.name}}
</template>
<div v-if="item.field==='company_date'">
{{student_info[item.field]?(student_info[item.field]=='0000-00-00'?'':student_info[item.field]):''}}
</div>
<div v-else style="word-break: break-word; word-wrap: break-word; overflow-wrap: break-word;">
{{student_info[item.field]?student_info[item.field]:''}}
<!-- 显示不同的数据,用红色标注 -->
<template v-if="change_data.length>0">
<template v-for="change in change_data">
<span style="color:red; word-break: break-word; word-wrap: break-word; overflow-wrap: break-word;"
v-if="change[item.field] && change[item.field] != student_info[item.field]">-->{{change[item.field]}}</span>
</template>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item :span="2" v-if="type==='check' || type==='checkshow' || type==='setPosition'">
<template slot="label">
本班职务
</template>
{{sign_result.position?sign_result.position:''}}
</el-descriptions-item>
<!-- 报名信息 -->
<template v-if="sign_info.length>0">
<!-- <lx-header v-if="type==='check' || type==='checkshow' || type==='setPosition'" icon="" text="报名信息"
style="margin-bottom: 10px; border: 0px; margin-top: 15px">
</lx-header> -->
<template v-if="type==='check' || type==='checkshow' || type==='setPosition'">
<!-- <el-descriptions class="margin-top" :column="2" border> -->
<el-descriptions-item :span="2" label="本次报名表单"><span style="color:#909399">以下为本次提交的答案,个人资料后续变更不会覆盖。</span></el-descriptions-item>
<template v-for="item in sign_info">
<el-descriptions-item :span="2" v-if="item.submit_files && item.submit_files.length>0">
<template slot="label">
{{item.name}}
</template>
<div>
<template v-for="file in item.submit_files">
<div v-if="isImageFile(file)" style="display:inline-block;margin:10px;">
<el-image
style="width:100px;height:100px;cursor:pointer;"
:src="host+file"
:preview-src-list="[host+file]"
fit="cover"
></el-image>
</div>
<div v-else style="display:inline-block;margin:10px;">
<a :href="host+file" target="_blank" style="color:#409EFF;text-decoration:none;">
<i class="el-icon-document"></i>
{{getAnswerFileName(item, file)}}
</a>
</div>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item v-else :span="2">
<template slot="label">
{{item.name}}
</template>
<div v-if="item.edit_input === 'radio' || item.edit_input === 'checkbox'" style="margin-bottom:8px">
<el-tag v-for="option in item.select_item" :key="option.key" :effect="answerSelected(item, option) ? 'dark' : 'plain'" :type="answerSelected(item, option) ? '' : 'info'" style="margin:0 8px 4px 0">{{option.value}}</el-tag>
</div>
<div style="white-space:pre-wrap;word-break: break-word; word-wrap: break-word; overflow-wrap: break-word;">{{item.display_value !== undefined ? item.display_value : item.value}}</div>
<div v-if="item.supplement_text" style="white-space:pre-wrap;color:#606266;margin-top:8px">{{item.supplement_text}}</div>
</el-descriptions-item>
</template>
<!-- </el-descriptions> -->
</template>
</template>
</el-descriptions>
</div>
<!-- 操作日志 -->
<lx-header v-if="(type=='checkshow' || type=='check') &&(sign_result.audits && sign_result.audits.length>0)" icon="" text="操作日志"
style="margin-bottom: 10px; border: 0px; margin-top: 15px">
</lx-header>
<div v-if="(type=='checkshow' || type=='check') &&(sign_result.audits && sign_result.audits.length>0)">
<xy-table :list="sign_result.audits" :isPage="false" height="200" :table-item="audit_item">
<template v-slot:username>
<el-table-column align='center' label="操作人" width="120" header-align="center">
<template slot-scope="scope">
<div v-if="scope.row.event=='created'">
学员
</div>
<div v-else>
{{scope.row.user?scope.row.user.username:''}}
</div>
</template>
</el-table-column>
</template>
<template v-slot:event>
<el-table-column align='center' label="操作类型" width="120" header-align="center">
<template slot-scope="scope">
<div v-if="scope.row.event=='created'">
提交报名
</div>
<div v-else>
更新状态
</div>
</template>
</el-table-column>
</template>
<template v-slot:values>
<el-table-column align='left' width="450" label="操作详情" header-align="center" min-width="200" show-overflow-tooltip>
<template slot-scope="scope">
<div v-if="scope.row.event=='created'" style="word-break: break-word;">
提交报名信息
</div>
<div v-else style="word-break: break-word;">
<template v-for="item in apply_status_list">
<span style="font-weight: bold;" v-if="scope.row.old_values.status===item.id">{{item.value}}</span>
</template>
变更为:
<template v-for="item in apply_status_list">
<span style="color:red" v-if="scope.row.new_values.status===item.id">{{item.value}}</span>
</template>
</div>
</template>
</el-table-column>
</template>
<template v-slot:created_at>
<el-table-column align='center' label="操作时间" width="240" header-align="center">
<template slot-scope="scope">
{{base.formatDate(scope.row.created_at)}}
</template>
</el-table-column>
</template>
</xy-table>
</div>
<!-- 审核查看 -->
<lx-header v-if="type=='checkshow' || type=='check'" icon="" text="审核结果"
style="margin-bottom: 10px; border: 0px; margin-top: 15px">
</lx-header>
<div v-if="type=='checkshow'">
<div class="studentInfo">
<div>
<span>审核结果:</span>
<span v-for="item in apply_status_list">
<el-tag :type="item.type" v-if="sign_result.status===item.id">{{item.value}}</el-tag>
</span>
</div>
<div>
<span>评分:</span>
<span>{{sign_result.score}}</span>
</div>
<div v-if="sign_result.replacement_text"><span>报名更换记录:</span>{{ sign_result.replacement_text }}</div>
<div v-if="sign_result.status===5">
<span>放弃原因:</span>
<span style="word-break: break-word; word-wrap: break-word; overflow-wrap: break-word;">{{sign_result.giveup_reason}}</span>
</div>
<div style="display: flex;" v-if="sign_result.status===1">
<span>录取通知书:</span>
<div>
<div v-for="item in sign_result.files">
<a :href="item.url" target="_blank" style="color:#0077CC">{{item.original_name}}</a>
</div>
</div>
</div>
<div>
<span>备注:</span>
<span style="word-break: break-word; word-wrap: break-word; overflow-wrap: break-word;">{{sign_result.reason?sign_result.reason:''}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<!-- 审核 -->
<template v-slot:status v-if="type=='check'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>审核:
</div>
<div class="xy-table-item-content">
<el-select filterable v-model="form.status" placeholder="请选择">
<el-option v-for="item in apply_status_list" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:score v-if="type=='check'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>评分:
</div>
<div class="xy-table-item-content">
<el-input type="number" v-model="form.score" placeholder="请输入评分"></el-input>
</div>
</div>
</template>
<template v-slot:giveup_reason v-if="type=='check'&& form.status===5">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>放弃原因:
</div>
<div class="xy-table-item-content">
<el-input type="textarea" v-model="form.giveup_reason" placeholder="请输入放弃原因"></el-input>
</div>
</div>
</template>
<template v-slot:file_ids v-if="type=='check' && form.status===1">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>录取通知书:
</div>
<div class="xy-table-item-content">
<el-upload :action="action" class='upload-demo' :file-list="fileList" ref="pictureUpload"
:auto-upload="true" accept=".pdf" :limit="1" :on-success="uploadSuccess" :on-remove="uploadRemove">
<el-button size="small" type="primary">点击上传</el-button>
<div class="el-upload__tip" slot="tip">只能上传pdf文件</div>
</el-upload>
</div>
</div>
</template>
<template v-slot:reason v-if="type=='check'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>备注:
</div>
<div class="xy-table-item-content">
<el-input type="textarea" v-model="form.reason" placeholder="请输入备注(展示给学员查看)"></el-input>
</div>
</div>
</template>
<!-- 设置班委 -->
<template v-slot:position v-if="type=='setPosition'">
<div class="xy-table-item">
<div class="xy-table-item-label" style="font-weight: bold">
<span style="color: red;font-weight: bold;padding-right: 4px;"></span>班委名称:
</div>
<div class="xy-table-item-content">
<el-input type="text" v-model="form.position" placeholder="请输入班委名称(如:班长)"></el-input>
</div>
</div>
</template>
<template v-slot:footerContent>
<el-button type="primary" style='margin-left:5px;margin-bottom:5px;' v-if="type=='check' || type=='setPosition'"
@click="submit">确认</el-button>
<el-button type="primary" plain style='margin-left:5px;margin-bottom:5px;'
v-else-if="type=='check'|| type=='setPosition'" @click="isShow=false">取消</el-button>
<el-button type="primary" plain style='margin-left:5px;margin-bottom:5px;'
v-else-if="type=='show'||type=='checkshow'" @click="isShow=false">关闭</el-button>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
show
} from '@/api/student/index.js'
import {
save,
show as showSign
} from '@/api/apply/index.js'
import myMixins from "@/mixin/selectMixin.js";
import formMixin from "@/mixin/formMixin.js";
export default {
mixins: [myMixins, formMixin],
components: {
},
data() {
return {
isShow: false,
type: 'show',
typeName: '查看个人明细',
id: '',
action: `${process.env.VUE_APP_UPLOAD_API}`,
host: `${process.env.VUE_APP_BASE_API}`,
subjectObj: {},
student_info: {},
row: {},
sign_info: [], //报名的信息,是去除 user表字段的其他字段
change_data: [], // 有变更的user表中的字段 ,提交上来的一定是user表中的字段
sign_result: {},
fileList: [],
form: {
show: '',
status: 0,
score: '',
giveup_reason: '',
file_ids: [],
reason: '',
position: ''
},
audit_item:[{
prop:'username',
label:'操作人'
},{
prop:'ip_address',
label:'Ip',
width:120
},{
prop:'event',
label:'操作类型'
},{
prop:'values',
label:'操作详情'
},{
prop:'created_at',
label:'操作时间'
},],
}
},
created() {},
methods: {
getAnswerFileName(item, url) {
const files = item.fileList || item.fileListArr || []
const found = files.map(file => file.response || file).find(file => String(file.url || '').endsWith(url))
return found ? (found.original_name || found.name || this.getFileName(url)) : this.getFileName(url)
},
answerSelected(item, option) {
if (Array.isArray(item.selected_keys)) return item.selected_keys.map(String).includes(String(option.key))
const values = item.edit_input === 'checkbox' ? String(item.value || '').split(',') : [String(item.value == null ? '' : item.value)]
return values.includes(String(option.value))
},
// 判断文件是否为图片
isImageFile(filePath) {
if (!filePath) return false
const imageExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.svg']
const lowerPath = filePath.toLowerCase()
return imageExtensions.some(ext => lowerPath.endsWith(ext))
},
// 从文件路径中提取文件名
getFileName(filePath) {
if (!filePath) return '未知文件'
const parts = filePath.split('/')
return parts[parts.length - 1] || '未知文件'
},
uploadSuccess(response, file, fileList) {
this.fileList = fileList
},
uploadRemove(file, fileList) {
this.fileList = fileList
},
// beforeUpload(file) {
// const isImage = file.type.includes('image');
// if (!isImage) {
// this.$message.error('请上传正确的图片格式文件');
// }
// return isImage && isLt2M;
// },
submit() {
// 如果是 不通过, remark必填
if(this.form.status===2){
if(this.base.isNull(this.form.reason)){
this.$message({
type: 'warning',
message: '审核不通过时,请填写备注'
})
return
}
}
const payload = { id: this.id }
if (this.type === 'setPosition') {
payload.position = this.form.position
} else {
payload.status = this.form.status
payload.reason = this.form.reason
if (this.form.status === 5) payload.giveup_reason = this.form.giveup_reason
if (String(this.form.score) !== String(this.sign_result.score == null ? '' : this.sign_result.score)) {
payload.score = this.form.score
}
if (this.form.status === 1) {
const fileIds = this.fileList.map(file => file.response ? file.response.id : file.id)
const originalIds = (this.sign_result.files || []).map(file => file.id)
if (fileIds.map(String).join(',') !== originalIds.map(String).join(',')) {
payload.file_ids = fileIds
}
}
}
save(payload).then(res => {
if (!res || res.errcode) return
this.$message({
type: 'success',
message: this.type === 'check' ? '审核成功' : '设置成功'
})
this.isShow = false
this.$emit('refresh')
})
},
getDetail() {
show({
id: this.id,
}).then(res => {
this.student_info = res
})
},
getSignDetail() {
showSign({
id: this.id,
show_relation: ['user']
}).then(res => {
this.student_info = res.user
this.sign_result = res
this.form.position = res.position ? res.position : ''
this.change_data = res.change_data ? res.change_data : []
// 提取出 自定义表单中不属于user的字段
let _arr = []
if (res.data && Array.isArray(res.data)) {
(res.form_answers || res.data).map(item => {
if (item.hidden) return
if (item.edit_input === 'files') {
if (!this.base.isNull(item.value) && item.value.indexOf("/storage/files/") !== -1) {
item.submit_files = item.value.split(",")
}
}
// 处理自定义字段中是否 是个人用户信息
if (item.field) {
console.log("item.field")
_arr.push(item)
}
})
this.sign_info = _arr
} else {
this.sign_info = []
}
this.form.status = res.status ? res.status : 0
this.form.score = res.score == null ? '' : res.score
this.form.reason = res.reason ? res.reason : ''
this.form.giveup_reason = res.giveup_reason ? res.giveup_reason : ''
this.fileList = res.files ? res.files : []
console.log("this.sign_info", this.sign_info, this.change_data)
})
}
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'show') {
this.typeName = "查看个人明细"
this.getDetail()
} else if (this.type === 'check' || this.type === 'checkshow' || this.type === 'setPosition') {
this.getSignDetail()
if (this.type === 'check') {
this.typeName = '审核'
} else if (this.type === 'setPosition') {
this.typeName = '设置班委'
} else {
this.typeName = '查看'
}
}
} else {
this.id = ''
this.type = 'show'
this.subjectObj = {}
this.sign_result = {}
this.sign_info = []
this.change_data = []
this.fileList = []
this.student_info = {}
this.row = {}
this.$refs['dialog'].reset()
}
},
}
}
</script>
<style scoped lang="scss">
::v-deep .show,
::v-deep .file_ids,
::v-deep .reason,
::v-deep .giveup_reason {
flex-basis: 100%;
}
// 防止内容溢出导致宽度扩展
.xy-table-item-content {
min-width: 0;
max-width: 100%;
overflow: hidden;
word-break: break-word;
word-wrap: break-word;
overflow-wrap: break-word;
}
// el-descriptions 组件样式
::v-deep .el-descriptions {
max-width: 100%;
overflow: hidden;
}
::v-deep .el-descriptions-item__label {
width: 15%;
}
::v-deep .el-descriptions-item__content {
word-break: break-word;
word-wrap: break-word;
overflow-wrap: break-word;
max-width: 85%;
}
// 表格内容防止溢出
::v-deep .el-table {
max-width: 100%;
overflow: hidden;
}
::v-deep .el-table__body-wrapper {
overflow-x: auto;
}
::v-deep .v-header {
margin-top: 0 !important;
}
.studentInfo {
&>div {
display: flex;
&>div {
width: 50%;
span:first-child {
display: inline-block;
width: 160px;
text-align: right;
}
}
img {
width: 80px;
height: 80px;
}
}
}
.companyInfo {
&>div {
display: flex;
span:first-child {
display: inline-block;
width: 160px;
text-align: right;
}
}
}
</style>