提交代码,处理电工证是否复审
This commit is contained in:
parent
09e1aab01b
commit
c396f12d05
|
@ -273,7 +273,7 @@ const handleDetele = (record) => {
|
|||
|
||||
.el-form-item__label {
|
||||
font-family: Microsoft YaHei;
|
||||
font-weight: 400;
|
||||
font-weight: 400 !important;
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
min-width: 34px;
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
<el-table-column prop="certificateUrl" label="资质证书" align="center">
|
||||
<template #default="scope">
|
||||
<template v-if="scope.row.certificateUrl">
|
||||
<el-image v-if="scope.row.certificateUrl && ['jpeg', 'jpg', 'png'].includes(scope.row.certificateUrl.split('.').pop().toLowerCase())"
|
||||
<el-image
|
||||
v-if="scope.row.certificateUrl && ['jpeg', 'jpg', 'png'].includes(scope.row.certificateUrl.split('.').pop().toLowerCase())"
|
||||
style="width: 70px; height: 44px;line-height: 50px;cursor: pointer;"
|
||||
:src="baseUrl + scope.row.certificateUrl" fit="fill"
|
||||
@click.stop="handleCardPreview(scope.row.certificateUrl)" />
|
||||
|
@ -69,18 +70,26 @@
|
|||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
|
||||
<el-form ref="postRef" :model="form" :rules="rules" label-width="150px">
|
||||
<el-form ref="postRef" :model="form" :rules="rules" label-width="160px">
|
||||
<el-form-item label="证书名称" prop="factoryArea">
|
||||
<el-input v-model="form.qualificationName" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="上传证书" prop="certificateUrl">
|
||||
<myFileUpload ref="qualifcationFileRef" @set-form-file="handleSetQualifcationFile" />
|
||||
</el-form-item>
|
||||
<el-form-item label="有效开始日期" prop="startTime">
|
||||
<el-form-item :label="form.qualificationName == '电工证' ? '电工证初领日期' : '有效开始日期'" prop="startTime">
|
||||
<el-date-picker v-model="form.startTime" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||
placeholder="请选择有效开始日期" style="width: 100%;" @change="handleDateChange" />
|
||||
</el-form-item>
|
||||
<el-form-item label="到期日期" v-if="isShowExpireTime">
|
||||
<el-form-item label="是否复审" v-if="form.qualificationName == '电工证'">
|
||||
<el-checkbox-group class="checkAllChose" v-model="checkedHasFiles" @change="handleCheckedHasFileChange">
|
||||
<el-checkbox v-for="(item, index) in hasFilesList" :key="index" :label="item.label"
|
||||
:value="item.value">
|
||||
{{ item.label }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="form.qualificationName == '电工证' ? '电工证复审日期' : '到期日期'" v-if="isShowExpireTime">
|
||||
<el-date-picker v-model="form.expireTime" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||
placeholder="请选择到期日期" style="width: 100%;" disabled />
|
||||
</el-form-item>
|
||||
|
@ -103,6 +112,7 @@ import { listUser } from "@/api/system/user"
|
|||
import { getUserCertificateList, getCurrentCertificateDetail, uploadFile, updateCurrentCertificate } from "@/api/qualification/myQualifications"
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const suffix = ref('')
|
||||
const baseUrl = import.meta.env.VITE_APP_BASE_API
|
||||
const dialogImageUrl = ref('')
|
||||
|
@ -127,7 +137,26 @@ const rules = ref({
|
|||
expireTime: [{ required: true, message: "请选择到期日期", trigger: "change" }],
|
||||
})
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
// 是否复审,选中的值
|
||||
const checkedHasFiles = ref([])
|
||||
const checkedFs = ref(false)
|
||||
const hasFilesList = [
|
||||
{ label: '', value: true },
|
||||
]
|
||||
|
||||
// 选择是否复审
|
||||
const handleCheckedHasFileChange = (value) => {
|
||||
if (value.length > 0) {
|
||||
// 选中状态
|
||||
checkedFs.value = true
|
||||
form.value.expireTime = moment(form.value.startTime).add(6, 'years').format('YYYY-MM-DD')
|
||||
}
|
||||
else {
|
||||
// 未选中状态
|
||||
checkedFs.value = false
|
||||
form.value.expireTime = moment(form.value.startTime).add(3, 'years').add(-1, 'day').format('YYYY-MM-DD')
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
|
@ -175,6 +204,10 @@ const handleDateChange = (val) => {
|
|||
form.value.expireFlag = 1
|
||||
isShowExpireTime.value = true
|
||||
if (form.value.qualificationName == 'LLP') form.value.expireTime = moment(val).add(4, 'years').format('YYYY-MM-DD')
|
||||
else if (form.value.qualificationName == '电工证') {
|
||||
if (checkedFs.value) form.value.expireTime = moment(val).add(6, 'years').format('YYYY-MM-DD')
|
||||
else form.value.expireTime = moment(val).add(3, 'years').add(-1, 'day').format('YYYY-MM-DD')
|
||||
}
|
||||
else form.value.expireTime = moment(val).add(3, 'years').format('YYYY-MM-DD')
|
||||
} else {
|
||||
form.value.expireFlag = 0
|
||||
|
@ -220,13 +253,13 @@ const handleEdit = (record) => {
|
|||
form.value = res.data
|
||||
if (form.value.expireTime) form.value.expireFlag = 1 // 默认值
|
||||
else form.value.expireFlag = 0
|
||||
form.value.qualificationName = record.qualificationName
|
||||
form.value.qualificationName = record.qualificationName
|
||||
open.value = true
|
||||
title.value = "编辑"
|
||||
nextTick(() => {
|
||||
// 初始化主题样式
|
||||
qualifcationFileRef.value.setFileInfo(res.data.certificateUrl)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -239,7 +272,7 @@ const isImageFile = (filePath) => {
|
|||
// 处理无后缀名情况
|
||||
if (!filePath || filePath.indexOf('.') === -1) return '';
|
||||
|
||||
suffix.value = filePath.split('.').pop();
|
||||
suffix.value = filePath.split('.').pop();
|
||||
return ['jpeg', 'jpg', 'png'].includes(suffix.value?.toLowerCase())
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
<el-table-column prop="certificateUrl" label="资质证书" align="center">
|
||||
<template #default="scope">
|
||||
<template v-if="scope.row.certificateUrl">
|
||||
<el-image v-if="scope.row.certificateUrl && ['jpeg', 'jpg', 'png'].includes(scope.row.certificateUrl.split('.').pop().toLowerCase())"
|
||||
<el-image
|
||||
v-if="scope.row.certificateUrl && ['jpeg', 'jpg', 'png'].includes(scope.row.certificateUrl.split('.').pop().toLowerCase())"
|
||||
style="width: 70px; height: 44px;line-height: 50px;cursor: pointer;"
|
||||
:src="baseUrl + scope.row.certificateUrl" fit="fill"
|
||||
@click.stop="handleCardPreview(scope.row.certificateUrl)" />
|
||||
|
@ -52,19 +53,27 @@
|
|||
<pdf-preview :pdf-url="dialogImageUrl" />
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body >
|
||||
<el-form ref="postRef" :model="form" :rules="rules" label-width="150px">
|
||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
|
||||
<el-form ref="postRef" :model="form" :rules="rules" label-width="160px">
|
||||
<el-form-item label="证书名称" prop="factoryArea">
|
||||
<el-input v-model="form.qualificationName" disabled />
|
||||
</el-form-item>
|
||||
<el-form-item label="上传证书" prop="certificateUrl">
|
||||
<myFileUpload ref="qualifcationFileRef" @set-form-file="handleSetQualifcationFile" />
|
||||
</el-form-item>
|
||||
<el-form-item label="有效开始日期" prop="startTime">
|
||||
<el-form-item :label="form.qualificationName == '电工证' ? '电工证初领日期' : '有效开始日期'" prop="startTime">
|
||||
<el-date-picker v-model="form.startTime" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||
placeholder="请选择有效开始日期" style="width: 100%;" @change="handleDateChange" />
|
||||
</el-form-item>
|
||||
<el-form-item label="到期日期" v-if="isShowExpireTime">
|
||||
<el-form-item label="是否复审" v-if="form.qualificationName == '电工证'">
|
||||
<el-checkbox-group class="checkAllChose" v-model="checkedHasFiles" @change="handleCheckedHasFileChange">
|
||||
<el-checkbox v-for="(item, index) in hasFilesList" :key="index" :label="item.label"
|
||||
:value="item.value">
|
||||
{{ item.label }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item :label="form.qualificationName == '电工证' ? '电工证复审日期' : '到期日期'" v-if="isShowExpireTime">
|
||||
<el-date-picker v-model="form.expireTime" type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
||||
placeholder="请选择到期日期" style="width: 100%;" disabled />
|
||||
</el-form-item>
|
||||
|
@ -85,6 +94,7 @@ import myFileUpload from './myFileUpload.vue'
|
|||
import PdfPreview from './PdfPreview.vue'
|
||||
import moment from 'moment'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const suffix = ref('')
|
||||
const baseUrl = import.meta.env.VITE_APP_BASE_API
|
||||
const dialogImageUrl = ref('')
|
||||
|
@ -106,7 +116,27 @@ const rules = ref({
|
|||
expireTime: [{ required: true, message: "请选择到期日期", trigger: "change" }],
|
||||
})
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
// 是否复审,选中的值
|
||||
const checkedHasFiles = ref([])
|
||||
const checkedFs = ref(false)
|
||||
const hasFilesList = [
|
||||
{ label: '', value: true },
|
||||
]
|
||||
|
||||
// 选择是否复审
|
||||
const handleCheckedHasFileChange = (value) => {
|
||||
if (value.length > 0) {
|
||||
// 选中状态
|
||||
checkedFs.value = true
|
||||
form.value.expireTime = moment(form.value.startTime).add(6, 'years').format('YYYY-MM-DD')
|
||||
}
|
||||
else {
|
||||
// 未选中状态
|
||||
checkedFs.value = false
|
||||
form.value.expireTime = moment(form.value.startTime).add(3, 'years').add(-1, 'day').format('YYYY-MM-DD')
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
getCurUserQualification();
|
||||
|
@ -126,6 +156,10 @@ const handleDateChange = (val) => {
|
|||
form.value.expireFlag = 1
|
||||
isShowExpireTime.value = true
|
||||
if (form.value.qualificationName == 'LLP') form.value.expireTime = moment(val).add(4, 'years').format('YYYY-MM-DD')
|
||||
else if (form.value.qualificationName == '电工证') {
|
||||
if (checkedFs.value) form.value.expireTime = moment(val).add(6, 'years').format('YYYY-MM-DD')
|
||||
else form.value.expireTime = moment(val).add(3, 'years').add(-1, 'day').format('YYYY-MM-DD')
|
||||
}
|
||||
else form.value.expireTime = moment(val).add(3, 'years').format('YYYY-MM-DD')
|
||||
} else {
|
||||
form.value.expireFlag = 0
|
||||
|
@ -178,13 +212,13 @@ const handleEdit = (record) => {
|
|||
nextTick(() => {
|
||||
// 初始化主题样式
|
||||
qualifcationFileRef.value.setFileInfo(res.data.certificateUrl)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
const handleSetQualifcationFile = (filePath) => {
|
||||
console.log('接收资质证件', filePath)
|
||||
form.value.certificateUrl = filePath
|
||||
}
|
||||
}
|
||||
// 判断是否为图片文件
|
||||
const isImageFile = (filePath) => {
|
||||
// 处理无后缀名情况
|
||||
|
|
Loading…
Reference in New Issue
Block a user