a
This commit is contained in:
@@ -1039,7 +1039,7 @@ const edit = (id: string) => {
|
||||
const majorChange = (id: string) => {
|
||||
nextTick(() => {
|
||||
majorChangeRef.value?.init(id)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 退学
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="confirm"><span>确认</span></el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirm">确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -25,14 +25,14 @@
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input type="text" v-model="dataForm.name" :disabled="type != 1"></el-input>
|
||||
<el-input type="text" v-model="dataForm.name" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="身份证号" prop="idNumber">
|
||||
<el-input type="text" v-model="dataForm.idNumber" :disabled="type != 2"></el-input>
|
||||
<el-input type="text" v-model="dataForm.idNumber" disabled></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -46,7 +46,7 @@
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="原录取专业" prop="confirmedMajor">
|
||||
<el-select v-model="dataForm.confirmedMajor" filterable clearable placeholder="" :disabled="type != 1" @change="changeM(dataForm.confirmedMajor)">
|
||||
<el-select v-model="dataForm.confirmedMajor" filterable clearable placeholder="" disabled>
|
||||
<el-option
|
||||
v-for="item in planMajorList"
|
||||
:key="item.majorCode"
|
||||
@@ -75,12 +75,12 @@
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="学费" prop="feeTuition">
|
||||
<el-input-number v-model="dataForm.feeTuition" controls-position="right" :min="0" :max="999999" :step-strictly="true" :disabled="type == 2"></el-input-number>
|
||||
<el-input-number v-model="dataForm.feeTuition" controls-position="right" :min="0" :max="999999" :step-strictly="true" disabled></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="代办费" prop="feeAgency">
|
||||
<el-input-number v-model="dataForm.feeAgency" controls-position="right" :min="0" :max="999999" :step-strictly="true" :disabled="type == 2"></el-input-number>
|
||||
<el-input-number v-model="dataForm.feeAgency" controls-position="right" :min="0" :max="999999" :step-strictly="true" disabled></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -93,8 +93,8 @@
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="审核备注" prop="auditRemarks">
|
||||
<el-input type="textarea" v-model="dataForm.auditRemarks" placeholder="审核备注" :rows="2"></el-input>
|
||||
<el-form-item label="备注" prop="auditRemarks">
|
||||
<el-input type="textarea" v-model="dataForm.auditRemarks" placeholder="备注" :rows="2"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -110,17 +110,18 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, nextTick } from 'vue'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { useMessageBox } from '/@/hooks/message'
|
||||
import { useMessageBox, useMessage } from '/@/hooks/message'
|
||||
import { getObj, changeMajor } from '/@/api/recruit/recruitstudentsignup'
|
||||
import { getList } from "/@/api/recruit/recruitstudentplangroup"
|
||||
import { listByEdu } from "/@/api/recruit/recruitstudentplan"
|
||||
import { getDicts } from "/@/api/admin/dict"
|
||||
import { list as scoreList } from "/@/api/recruit/recruitstudentplancorrectscoreconfig"
|
||||
import { getStatusConfig, AUDIT_STATUS_LIST } from '/@/config/global'
|
||||
|
||||
const auditStatusList = AUDIT_STATUS_LIST
|
||||
// 消息提示 hooks
|
||||
const messageBox = useMessageBox()
|
||||
|
||||
const message = useMessage()
|
||||
// Emits
|
||||
const emit = defineEmits<{
|
||||
(e: 'refreshDataList'): void
|
||||
@@ -133,11 +134,9 @@ const dataFormRef = ref()
|
||||
const visible = ref(false)
|
||||
const canSubmit = ref(false)
|
||||
const title = ref("")
|
||||
const type = ref<number | null>(null)
|
||||
const planList = ref<any[]>([])
|
||||
const planMajorList = ref<any[]>([])
|
||||
const agencyFeeList = ref<any[]>([])
|
||||
const tuitionFeeList = ref<any[]>([])
|
||||
const schoolCodeList = ref<any[]>([])
|
||||
|
||||
const dataForm = reactive({
|
||||
@@ -210,7 +209,7 @@ const dataForm = reactive({
|
||||
feeAgency: 0
|
||||
})
|
||||
|
||||
const dataRule = {
|
||||
const dataRule = reactive({
|
||||
groupId: [
|
||||
{ required: true, message: '招生计划不能为空', trigger: 'change' }
|
||||
],
|
||||
@@ -229,7 +228,7 @@ const dataRule = {
|
||||
newConfirmedMajor: [
|
||||
{ required: true, message: '新录取专业不能为空', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
// 初始化数据
|
||||
const initData = () => {
|
||||
@@ -238,56 +237,45 @@ const initData = () => {
|
||||
})
|
||||
}
|
||||
|
||||
// 改变新专业
|
||||
const changeCM = (id: string) => {
|
||||
if (id) {
|
||||
let flag = false
|
||||
planMajorList.value.forEach((e: any) => {
|
||||
if (dataForm.newConfirmedMajor == e.majorCode && e.isZd == "1" && String(dataForm.degreeOfEducation) == "1") {
|
||||
flag = true
|
||||
}
|
||||
})
|
||||
if (String(dataForm.degreeOfEducation) == "1") {
|
||||
dataForm.feeTuition = 0
|
||||
tuitionFeeList.value.forEach((e: any) => {
|
||||
if (e.label == "0" && flag) {
|
||||
dataForm.feeTuition = e.value
|
||||
}
|
||||
})
|
||||
}
|
||||
// 根据新专业和文化程度更新学费
|
||||
const updateTuitionByNewMajorAndEducation = () => {
|
||||
if (!dataForm.newConfirmedMajor || !dataForm.degreeOfEducation) {
|
||||
return
|
||||
}
|
||||
|
||||
// 查找选中的新专业
|
||||
const selectedMajor = planMajorList.value.find((major: any) => major.majorCode === dataForm.newConfirmedMajor)
|
||||
if (!selectedMajor) {
|
||||
return
|
||||
}
|
||||
|
||||
// 根据文化程度选择对应的学费字段
|
||||
// '1' = 初中 -> czFee
|
||||
// '2' = 高中 -> gzFee
|
||||
// '3' = 技职校 -> jzxFee
|
||||
if (dataForm.degreeOfEducation === '1' && selectedMajor.czFee !== undefined && selectedMajor.czFee !== null) {
|
||||
dataForm.feeTuition = selectedMajor.czFee
|
||||
} else if (dataForm.degreeOfEducation === '2' && selectedMajor.gzFee !== undefined && selectedMajor.gzFee !== null) {
|
||||
dataForm.feeTuition = selectedMajor.gzFee
|
||||
} else if (dataForm.degreeOfEducation === '3' && selectedMajor.jzxFee !== undefined && selectedMajor.jzxFee !== null) {
|
||||
dataForm.feeTuition = selectedMajor.jzxFee
|
||||
}
|
||||
}
|
||||
|
||||
// 改变原专业
|
||||
const changeM = (id: string) => {
|
||||
// 改变新专业
|
||||
const changeCM = (id: string) => {
|
||||
if (id) {
|
||||
dataForm.confirmedMajor = id
|
||||
// 是初中生并且是中德班
|
||||
let flag = false
|
||||
planMajorList.value.forEach((e: any) => {
|
||||
if (dataForm.confirmedMajor == e.majorCode && e.isZd == "1" && String(dataForm.degreeOfEducation) == "1") {
|
||||
flag = true
|
||||
}
|
||||
})
|
||||
if (String(dataForm.degreeOfEducation) == "1") {
|
||||
dataForm.feeTuition = 0
|
||||
tuitionFeeList.value.forEach((e: any) => {
|
||||
if (e.label == "0" && flag) {
|
||||
dataForm.feeTuition = e.value
|
||||
}
|
||||
})
|
||||
}
|
||||
// 从新专业中获取学费
|
||||
updateTuitionByNewMajorAndEducation()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 表单提交
|
||||
const dataFormSubmit = async () => {
|
||||
const titleText = "确认调整录取专业么?"
|
||||
if (dataForm.confirmedMajor == dataForm.newConfirmedMajor) {
|
||||
ElNotification.error({
|
||||
title: '错误',
|
||||
message: '新专业不能和原专业相同'
|
||||
})
|
||||
message.error('新专业不能和原专业相同')
|
||||
return
|
||||
}
|
||||
try {
|
||||
@@ -297,10 +285,7 @@ const dataFormSubmit = async () => {
|
||||
canSubmit.value = false
|
||||
if (dataForm.id) {
|
||||
changeMajor(dataForm).then(() => {
|
||||
ElNotification.success({
|
||||
title: '成功',
|
||||
message: '操作成功'
|
||||
})
|
||||
message.success('操作成功')
|
||||
visible.value = false
|
||||
emit('refreshDataList')
|
||||
}).catch(() => {
|
||||
@@ -316,7 +301,7 @@ const dataFormSubmit = async () => {
|
||||
|
||||
// 初始化方法
|
||||
const init = (id: string | null) => {
|
||||
dataForm.id = id || null
|
||||
dataForm.id = id || ""
|
||||
visible.value = true
|
||||
canSubmit.value = true
|
||||
initData()
|
||||
@@ -326,48 +311,43 @@ const init = (id: string | null) => {
|
||||
// 获取数据字典代办费
|
||||
getDicts('agency_fee').then((res: any) => {
|
||||
agencyFeeList.value = res.data
|
||||
// 获取数据字典学费
|
||||
getDicts('tuition_fee').then((res: any) => {
|
||||
tuitionFeeList.value = res.data
|
||||
getObj(dataForm.id).then((response: any) => {
|
||||
Object.assign(dataForm, response.data)
|
||||
title.value = dataForm.serialNumber
|
||||
// 获取文化程度对应的专业
|
||||
planMajorList.value = []
|
||||
getObj(dataForm.id).then((response: any) => {
|
||||
Object.assign(dataForm, response.data)
|
||||
title.value = dataForm.serialNumber
|
||||
// 获取文化程度对应的专业
|
||||
planMajorList.value = []
|
||||
|
||||
agencyFeeList.value.forEach((e: any) => {
|
||||
if (String(dataForm.degreeOfEducation) == String(e.label)) {
|
||||
dataForm.feeAgency = e.value
|
||||
}
|
||||
})
|
||||
tuitionFeeList.value.forEach((e: any) => {
|
||||
if (String(dataForm.degreeOfEducation) == String(e.label) && (String(dataForm.degreeOfEducation) != "1")) {
|
||||
dataForm.feeTuition = e.value
|
||||
}
|
||||
})
|
||||
listByEdu({ groupId: dataForm.groupId, degreeOfEducation: dataForm.degreeOfEducation }).then((e: any) => {
|
||||
planMajorList.value = e.data
|
||||
})
|
||||
agencyFeeList.value.forEach((e: any) => {
|
||||
if (String(dataForm.degreeOfEducation) == String(e.label)) {
|
||||
dataForm.feeAgency = e.value
|
||||
}
|
||||
})
|
||||
listByEdu({ groupId: dataForm.groupId, degreeOfEducation: dataForm.degreeOfEducation }).then((e: any) => {
|
||||
planMajorList.value = e.data
|
||||
// 加载专业列表后,如果已有新专业,更新学费
|
||||
if (dataForm.newConfirmedMajor) {
|
||||
updateTuitionByNewMajorAndEducation()
|
||||
}
|
||||
// 获取招生计划下的学校和分数线
|
||||
scoreList({ groupId: dataForm.groupId }).then((data: any) => {
|
||||
schoolCodeList.value = data.data
|
||||
})
|
||||
|
||||
if ("1" == dataForm.degreeOfEducation) {
|
||||
title.value = "C" + title.value
|
||||
} else if ("2" == dataForm.degreeOfEducation) {
|
||||
title.value = "G" + title.value
|
||||
} else if ("3" == dataForm.degreeOfEducation) {
|
||||
title.value = "J" + title.value
|
||||
const educationPrefixMap: Record<string, string> = {
|
||||
'1': 'C', // 初中
|
||||
'2': 'G', // 高中
|
||||
'3': 'J' // 技职校
|
||||
}
|
||||
const prefix = educationPrefixMap[String(dataForm.degreeOfEducation)]
|
||||
if (prefix) {
|
||||
title.value = prefix + title.value
|
||||
}
|
||||
// 从字典数据获取录取状态标签
|
||||
const auditStatusConfig = getStatusConfig(auditStatusList, dataForm.auditStatus)
|
||||
if (auditStatusConfig && auditStatusConfig.label) {
|
||||
title.value = auditStatusConfig.label + " " + title.value
|
||||
}
|
||||
|
||||
if ("-20" == dataForm.auditStatus) {
|
||||
title.value = "未录取 " + title.value
|
||||
} else if ("0" == dataForm.auditStatus) {
|
||||
title.value = "待审核 " + title.value
|
||||
} else if ("20" == dataForm.auditStatus) {
|
||||
title.value = "已录取 " + title.value
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
:close-on-click-modal="false"
|
||||
v-model="visible"
|
||||
append-to-body
|
||||
width="900px">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataFormRef" @keyup.enter="dataFormSubmit"
|
||||
width="70%">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataFormRef" @keyup.enter="() => dataFormSubmit('1')"
|
||||
label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
@@ -43,7 +43,7 @@
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="成绩单" prop="scorePhoto">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
@@ -56,13 +56,13 @@
|
||||
:http-request="httpRequest"
|
||||
:on-success="uploadSuccess">
|
||||
<div v-if="dataForm.scorePhoto" class="avatar-wrapper">
|
||||
<img :src="dataForm.scorePhoto" class="avatar"/>
|
||||
<img :src="baseUrl + dataForm.scorePhoto" class="avatar"/>
|
||||
</div>
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="毕业证" prop="graPic">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
@@ -75,13 +75,13 @@
|
||||
:http-request="httpRequest"
|
||||
:on-success="upload2Success">
|
||||
<div v-if="dataForm.graPic" class="avatar-wrapper">
|
||||
<img :src="dataForm.graPic" class="avatar"/>
|
||||
<img :src="baseUrl + dataForm.graPic" class="avatar"/>
|
||||
</div>
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="在常营业执照" prop="yyPic">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
@@ -94,16 +94,14 @@
|
||||
:http-request="httpRequest"
|
||||
:on-success="upload3Success">
|
||||
<div v-if="dataForm.yyPic" class="avatar-wrapper">
|
||||
<img :src="dataForm.yyPic" class="avatar" @click="handlePictureCardPreview({ url: dataForm.yyPic })" />
|
||||
<img :src="baseUrl + dataForm.yyPic" class="avatar"/>
|
||||
</div>
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="在常就业社保证明" prop="sbPic">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="在常社保证明" prop="sbPic">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
class="avatar-uploader"
|
||||
@@ -115,13 +113,16 @@
|
||||
:http-request="httpRequest"
|
||||
:on-success="upload5Success">
|
||||
<div v-if="dataForm.sbPic" class="avatar-wrapper">
|
||||
<img :src="dataForm.sbPic" class="avatar"/>
|
||||
<img :src="baseUrl + dataForm.sbPic" class="avatar"/>
|
||||
</div>
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
</el-row>
|
||||
<el-row>
|
||||
|
||||
<el-col >
|
||||
<el-form-item label="在常租赁合同/房产证明" prop="housePic">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
@@ -141,7 +142,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-col>
|
||||
<el-form-item label="户口本" prop="householdPic">
|
||||
<el-upload
|
||||
:action="uploadUrl"
|
||||
@@ -173,8 +174,8 @@
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit('1')" v-auth="'recruit_recruitstudentsignup_edit'" v-if="canSubmit">保存</el-button>
|
||||
<el-button type="success" plain @click="dataFormSubmit('2')" v-auth="'signup_material_exam'" v-if="canSubmit">通过</el-button>
|
||||
<el-button type="danger" plain @click="dataFormSubmit('3')" v-auth="'signup_material_exam'" v-if="canSubmit">驳回</el-button>
|
||||
<el-button type="success" icon="CircleCheck" @click="dataFormSubmit('2')" v-auth="'signup_material_exam'" v-if="canSubmit">通过</el-button>
|
||||
<el-button type="danger" icon="CircleClose" @click="dataFormSubmit('3')" v-auth="'signup_material_exam'" v-if="canSubmit">驳回</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -186,7 +187,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, nextTick, computed, onMounted } from 'vue'
|
||||
import { Plus, Delete } from '@element-plus/icons-vue'
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useUserInfo } from '/@/stores/userInfo'
|
||||
import { useMessage } from '/@/hooks/message'
|
||||
@@ -204,7 +205,8 @@ const message = useMessage()
|
||||
// 使用 Pinia store
|
||||
const userInfoStore = useUserInfo()
|
||||
const { userInfos } = storeToRefs(userInfoStore)
|
||||
const uploadUrl = import.meta.env.VITE_API_URL + '/recruit/file/uploadAttachment'
|
||||
const baseUrl = import.meta.env.VITE_API_URL
|
||||
const uploadUrl = baseUrl + '/recruit/file/uploadAttachment'
|
||||
|
||||
// 创建权限对象
|
||||
const permissions = computed(() => {
|
||||
@@ -240,15 +242,6 @@ const type = ref<number | null>(null)
|
||||
const contactNameList = ref<any[]>([])
|
||||
const planList = ref<any[]>([])
|
||||
|
||||
const form = reactive({
|
||||
attachment: '',
|
||||
graPic: "",
|
||||
yyPic: "",
|
||||
housePic: "",
|
||||
sbPic: "",
|
||||
hkPic: ""
|
||||
})
|
||||
|
||||
const houseList = ref<any[]>([])
|
||||
const hkPicList = ref<any[]>([])
|
||||
|
||||
@@ -261,69 +254,18 @@ const dataForm = reactive({
|
||||
zlshRemark: "",
|
||||
groupId: "",
|
||||
name: "",
|
||||
oldName: "",
|
||||
gender: "",
|
||||
nationality: "",
|
||||
degreeOfEducation: "",
|
||||
isLeagueMember: "",
|
||||
schoolOfGraduation: "",
|
||||
isAccommodation: "",
|
||||
examRegistrationNumbers: "",
|
||||
isMinimumLivingSecurity: "",
|
||||
score: "",
|
||||
postcode: "",
|
||||
residenceType: "",
|
||||
correctedScore: "",
|
||||
placeScore: "",
|
||||
schoolFrom: "",
|
||||
idNumber: "",
|
||||
residenceProvince: "",
|
||||
residenceCity: "",
|
||||
residenceArea: "",
|
||||
residenceDetail: "",
|
||||
homeAddressProvince: "",
|
||||
homeAddressCity: "",
|
||||
homeAddressArea: "",
|
||||
homeAddressDetail: "",
|
||||
parentName: "",
|
||||
parentTelOne: "",
|
||||
parentTelTwo: "",
|
||||
selfTel: "",
|
||||
wishMajorOne: "",
|
||||
wishMajorTwo: "",
|
||||
wishMajorThree: "",
|
||||
confirmedMajor: "",
|
||||
sevenMajor: "",
|
||||
sixMajor: "",
|
||||
fiveMajor: "",
|
||||
fourMajor: "",
|
||||
threeMajor: "",
|
||||
twoMajor: "",
|
||||
feeContribute: 0,
|
||||
contactName: "",
|
||||
scorePhoto: "",
|
||||
graPic: "",
|
||||
yyPic: "",
|
||||
housePic: "",
|
||||
sbPic: "",
|
||||
contactName: "",
|
||||
oldSerialNumber: "",
|
||||
colorDiscrimination: "",
|
||||
nutrition: "",
|
||||
height: "",
|
||||
weight: "",
|
||||
pastMedicalHistory: "",
|
||||
eyesightLeft: "",
|
||||
eyesightRight: "",
|
||||
correctEyesightLeft: "",
|
||||
correctEyesightRight: "",
|
||||
remarks: "",
|
||||
auditRemarks: "",
|
||||
serialNumber: "",
|
||||
auditStatus: "",
|
||||
schoolCode: "",
|
||||
newConfirmedMajor: "",
|
||||
householdPic: "",
|
||||
zlsh: ""
|
||||
zlsh: "",
|
||||
// 以下字段从后端获取,用于显示和判断
|
||||
serialNumber: "",
|
||||
degreeOfEducation: "",
|
||||
auditStatus: ""
|
||||
})
|
||||
|
||||
const dataRule = {
|
||||
@@ -372,17 +314,6 @@ const handlePictureCardPreview = (file: any) => {
|
||||
dialogUploadVisible.value = true
|
||||
}
|
||||
|
||||
// 删除 avatar 模式的图片
|
||||
const handleRemoveAvatar = (field: string) => {
|
||||
const formObj = form as any
|
||||
const dataFormObj = dataForm as any
|
||||
if (field === 'scorePhoto') {
|
||||
formObj.attachment = ""
|
||||
} else {
|
||||
formObj[field] = ""
|
||||
}
|
||||
dataFormObj[field] = ""
|
||||
}
|
||||
|
||||
// 通用移除文件处理(多文件)
|
||||
const handleRemoveMultiple = (fileList: any[], dataFormField: string) => {
|
||||
@@ -393,7 +324,8 @@ const handleRemoveMultiple = (fileList: any[], dataFormField: string) => {
|
||||
fileList.forEach((e: any) => {
|
||||
if (e.url != file.url) {
|
||||
arr.push(e)
|
||||
strArr.push(e.url)
|
||||
// 保存时使用原始路径
|
||||
strArr.push(e.originalUrl || (e.url.startsWith(baseUrl) ? e.url.substring(baseUrl.length) : e.url))
|
||||
}
|
||||
})
|
||||
fileList.splice(0, fileList.length, ...arr)
|
||||
@@ -437,39 +369,38 @@ const httpRequest = (options: any) => {
|
||||
}
|
||||
|
||||
// 通用上传成功回调(单文件 - avatar模式)
|
||||
const handleUploadSuccess = (formField: string, dataFormField: string) => {
|
||||
const handleUploadSuccess = (dataFormField: string) => {
|
||||
return (res: any) => {
|
||||
const fileUrl = res.data.fileUrl
|
||||
const formObj = form as any
|
||||
const dataFormObj = dataForm as any
|
||||
formObj[formField] = fileUrl
|
||||
dataFormObj[dataFormField] = fileUrl
|
||||
}
|
||||
}
|
||||
|
||||
// 通用上传成功回调(多文件)
|
||||
const handleUploadSuccessMultiple = (fileList: any[], formField: string, dataFormField: string) => {
|
||||
const handleUploadSuccessMultiple = (fileList: any[], dataFormField: string) => {
|
||||
return (res: any) => {
|
||||
const fileUrl = res.data.fileUrl
|
||||
const formObj = form as any
|
||||
const fileUrl = res.data.fileUrl // 后端返回的原始路径
|
||||
const dataFormObj = dataForm as any
|
||||
formObj[formField] = fileUrl
|
||||
fileList.push({ url: fileUrl })
|
||||
// 添加到文件列表,显示时添加 baseUrl 前缀,同时保存原始路径用于提交
|
||||
fileList.push({ url: baseUrl + fileUrl, name: '', originalUrl: fileUrl })
|
||||
// 保存时使用原始路径
|
||||
const arr: string[] = []
|
||||
fileList.forEach((e: any) => {
|
||||
arr.push(e.url)
|
||||
// 优先使用保存的原始路径,如果没有则从 url 中提取
|
||||
arr.push(e.originalUrl || (e.url.startsWith(baseUrl) ? e.url.substring(baseUrl.length) : e.url))
|
||||
})
|
||||
dataFormObj[dataFormField] = arr.join(",")
|
||||
}
|
||||
}
|
||||
|
||||
// 上传成功回调
|
||||
const uploadSuccess = handleUploadSuccess('attachment', 'scorePhoto')
|
||||
const upload2Success = handleUploadSuccess('graPic', 'graPic')
|
||||
const upload3Success = handleUploadSuccess('yyPic', 'yyPic')
|
||||
const upload4Success = handleUploadSuccessMultiple(houseList.value, 'housePic', 'housePic')
|
||||
const upload5Success = handleUploadSuccess('sbPic', 'sbPic')
|
||||
const upload6Success = handleUploadSuccessMultiple(hkPicList.value, 'hkPic', 'householdPic')
|
||||
const uploadSuccess = handleUploadSuccess('scorePhoto')
|
||||
const upload2Success = handleUploadSuccess('graPic')
|
||||
const upload3Success = handleUploadSuccess('yyPic')
|
||||
const upload4Success = handleUploadSuccessMultiple(houseList.value, 'housePic')
|
||||
const upload5Success = handleUploadSuccess('sbPic')
|
||||
const upload6Success = handleUploadSuccessMultiple(hkPicList.value, 'householdPic')
|
||||
|
||||
// 初始化数据
|
||||
const initData = () => {
|
||||
@@ -516,16 +447,18 @@ const init = (id: string | null) => {
|
||||
title.value = dataForm.serialNumber
|
||||
// avatar 模式直接使用 dataForm 中的字段,不需要 fileList
|
||||
// 多图上传需要初始化列表
|
||||
if (dataForm.housePic != '') {
|
||||
const arr = dataForm.housePic.split(",")
|
||||
if (dataForm.housePic && dataForm.housePic != '') {
|
||||
const arr = dataForm.housePic.split(",").filter((item: string) => item && item.trim())
|
||||
arr.forEach((e: string) => {
|
||||
houseList.value.push({ url: e })
|
||||
// 保存原始路径,显示时添加 baseUrl 前缀
|
||||
houseList.value.push({ url: baseUrl + e, name: '', originalUrl: e })
|
||||
})
|
||||
}
|
||||
if (dataForm.householdPic != '') {
|
||||
const arr2 = dataForm.householdPic.split(",")
|
||||
if (dataForm.householdPic && dataForm.householdPic != '') {
|
||||
const arr2 = dataForm.householdPic.split(",").filter((item: string) => item && item.trim())
|
||||
arr2.forEach((e: string) => {
|
||||
hkPicList.value.push({ url: e })
|
||||
// 保存原始路径,显示时添加 baseUrl 前缀
|
||||
hkPicList.value.push({ url: baseUrl + e, name: '', originalUrl: e })
|
||||
})
|
||||
}
|
||||
|
||||
@@ -563,6 +496,7 @@ defineExpose({
|
||||
margin-bottom:18px!important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.avatar-uploader {
|
||||
:deep(.el-upload) {
|
||||
@@ -572,9 +506,8 @@ defineExpose({
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
|
||||
width: 148px;
|
||||
height: 148px;
|
||||
&:hover {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
@@ -584,26 +517,21 @@ defineExpose({
|
||||
.avatar-uploader-icon {
|
||||
font-size: 28px;
|
||||
color: #8c939d;
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
line-height: 178px;
|
||||
width: 148px;
|
||||
height: 148px;
|
||||
line-height: 148px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.avatar-wrapper {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
|
||||
width: 148px;
|
||||
height: 148px;
|
||||
.avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
width: 148px;
|
||||
height: 148px;
|
||||
display: block;
|
||||
object-fit: cover;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user