分包商页面完善 工资卡见证页面初步完善
This commit is contained in:
parent
fc5c10a3bc
commit
40454371ea
|
|
@ -20,10 +20,11 @@ export const editSubBaseInfoAPI = (data) => {
|
|||
}
|
||||
|
||||
// 删除分包商基础信息
|
||||
export const deleteSubBaseInfoAPI = (id) => {
|
||||
export const deleteSubBaseInfoAPI = (data) => {
|
||||
return request({
|
||||
url: `/project/****/${id}`,
|
||||
method: 'DELETE',
|
||||
url: '/bmw/pmSub/delSub',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
import requestFormData from '@/utils/request_formdata'
|
||||
|
||||
// 工资卡见证 人员工资卡列表接口
|
||||
export const getPersonContractListAPI = (data) => {
|
||||
return request({
|
||||
url: '/bmw/workerContract/list',
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 工资卡见证 获取工资卡详情接口
|
||||
export const getContractDetailAPI = (id) => {
|
||||
return request({
|
||||
url: `/bmw/workerContract/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 工资卡见证 获取工资卡详情列表接口(历史工资卡信息)
|
||||
export const getContractDetailListAPI = (data) => {
|
||||
return request({
|
||||
url: `/bmw/workerContract/workerList`,
|
||||
method: 'get',
|
||||
params: data,
|
||||
})
|
||||
}
|
||||
|
||||
// 工资卡见证 工资卡上传接口
|
||||
export const uploadContractAPI = (data) => {
|
||||
return requestFormData({
|
||||
url: `/bmw/workerContract/edit`,
|
||||
method: 'post',
|
||||
data,
|
||||
})
|
||||
}
|
||||
// 工资卡见证 查询工资卡详情
|
||||
export const getContractDetailLookFileAPI = (id) => {
|
||||
return request({
|
||||
url: `/bmw/workerContract/lookFile/${id}`,
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
clearable
|
||||
:maxlength="item.f_max || 50"
|
||||
v-if="item.f_type === 'ipt'"
|
||||
v-model="queryParams[item.f_model]"
|
||||
v-model.trim="queryParams[item.f_model]"
|
||||
:placeholder="`请输入${item.f_label}`"
|
||||
:style="{ width: item.f_width || '240px' }"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -125,6 +125,12 @@ export default {
|
|||
components: {
|
||||
UploadImgFormData,
|
||||
},
|
||||
props: {
|
||||
editFormData: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formType: 1,
|
||||
|
|
@ -207,8 +213,6 @@ export default {
|
|||
return new Promise((resolve, reject) => {
|
||||
this.$refs.addOrEditFormRef.validate(async (valid) => {
|
||||
if (valid) {
|
||||
console.log(this.addOrEditForm)
|
||||
|
||||
// 组装参数
|
||||
const {
|
||||
businessLicense,
|
||||
|
|
@ -296,5 +300,34 @@ export default {
|
|||
this.$refs.addOrEditFormRef.resetFields()
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
editFormData: {
|
||||
handler(newVal) {
|
||||
if (Object.keys(newVal).length > 0) {
|
||||
Object.assign(this.addOrEditForm, newVal)
|
||||
// const {
|
||||
// subName,
|
||||
// legalPerson,
|
||||
// legalPersonPhone,
|
||||
// subAddress,
|
||||
// id,
|
||||
// } = newVal
|
||||
|
||||
// this.addOrEditForm.subName = subName
|
||||
// this.addOrEditForm.legalPerson = legalPerson
|
||||
// this.addOrEditForm.legalPersonPhone = legalPersonPhone
|
||||
// this.addOrEditForm.subAddress = subAddress
|
||||
// this.addOrEditForm.id = id
|
||||
// this.addOrEditForm.businessLicense = []
|
||||
// this.addOrEditForm.electronicStamp = []
|
||||
// this.addOrEditForm.idCard = []
|
||||
// this.addOrEditForm.electronicSignature = []
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
export const formLabel = [
|
||||
{
|
||||
f_label: '关键词',
|
||||
f_model: 'keyword',
|
||||
f_model: 'keyWord',
|
||||
f_type: 'ipt',
|
||||
isShow: false, // 是否展示label
|
||||
},
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
</template>
|
||||
|
||||
<!-- 标段工程数量 -->
|
||||
<template :slot="item" slot-scope="{ data }" v-for="item in slots">
|
||||
</template>
|
||||
<!-- <template :slot="item" slot-scope="{ data }" v-for="item in slots">
|
||||
</template> -->
|
||||
|
||||
<template slot="handle" slot-scope="{ data }">
|
||||
<el-button
|
||||
|
|
@ -61,8 +61,10 @@
|
|||
@closeDialogOuter="handleCloseDialogOuter"
|
||||
>
|
||||
<template slot="outerContent">
|
||||
<AddOrEditForm ref="addOrEditFormContentRef" />
|
||||
|
||||
<AddOrEditForm
|
||||
ref="addOrEditFormContentRef"
|
||||
:editFormData="editFormData"
|
||||
/>
|
||||
<el-row class="dialog-footer-btn">
|
||||
<el-button size="medium" @click="handleCloseDialogOuter">
|
||||
取消
|
||||
|
|
@ -102,9 +104,8 @@ export default {
|
|||
formLabel,
|
||||
columnsList,
|
||||
dialogConfig,
|
||||
|
||||
editFormData: {},
|
||||
getSubBaseInfoListAPI,
|
||||
|
||||
slots: {
|
||||
businessLicense: 'businessLicense',
|
||||
idCard: 'idCard',
|
||||
|
|
@ -116,13 +117,37 @@ export default {
|
|||
methods: {
|
||||
// 导出按钮
|
||||
onHandleExportSubBaseInfo(queryParams) {
|
||||
console.log(queryParams, '导出')
|
||||
this.download(
|
||||
'/bmw/pmSub/export',
|
||||
{
|
||||
...queryParams,
|
||||
},
|
||||
`分包商列表.xlsx`,
|
||||
)
|
||||
},
|
||||
|
||||
// 新增或修改
|
||||
onHandleAddOrEditSubBaseInfo(type, data) {
|
||||
this.dialogConfig.outerTitle =
|
||||
type === 1 ? '新增标段工程' : '修改标段工程'
|
||||
type === 1 ? '新增分包商' : '修改分包商'
|
||||
|
||||
if (type === 2) {
|
||||
const {
|
||||
subName,
|
||||
legalPerson,
|
||||
legalPersonPhone,
|
||||
subAddress,
|
||||
id,
|
||||
} = data
|
||||
|
||||
this.editFormData = {
|
||||
subName,
|
||||
legalPerson,
|
||||
legalPersonPhone,
|
||||
subAddress,
|
||||
id,
|
||||
}
|
||||
}
|
||||
this.dialogConfig.outerVisible = true
|
||||
},
|
||||
|
||||
|
|
@ -134,22 +159,22 @@ export default {
|
|||
type: 'warning',
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await deleteSubBaseInfoAPI(data.id)
|
||||
const res = await deleteSubBaseInfoAPI({
|
||||
id: data.id,
|
||||
})
|
||||
console.log(res, '删除结果')
|
||||
if (res.code === 200) {
|
||||
this.$msgSuccess('删除成功')
|
||||
this.$refs.allProjectTableRef.getTableList() // 更新列表
|
||||
this.$modal.msgSuccess('删除成功')
|
||||
this.$refs.subBaseInfoTableRef.getTableList() // 更新列表
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('取消')
|
||||
// console.log('取消')
|
||||
})
|
||||
},
|
||||
|
||||
// 确定按钮
|
||||
async onHandleConfirmAddOrEdit() {
|
||||
this.$refs.addOrEditFormContentRef.formType =
|
||||
this.dialogConfig.outerTitle === '新增标段工程' ? 1 : 2
|
||||
try {
|
||||
await this.$refs.addOrEditFormContentRef.onHandleConfirmAddOrEditFun()
|
||||
this.handleCloseDialogOuter()
|
||||
|
|
|
|||
|
|
@ -265,77 +265,6 @@ export default {
|
|||
},
|
||||
// 确定按钮
|
||||
onHandleConfirmAddOrEditFun() {
|
||||
// return new Promise(async (resolve, reject) => {
|
||||
// const status = this.checkFormStatus()
|
||||
// if (status === 'all_filled') {
|
||||
// params.bmWorkerContract = this.contractInfoForm
|
||||
// }
|
||||
|
||||
// if (status === 'partial') {
|
||||
// this.$modal.msgError(
|
||||
// '请完善合同见证中的必填信息(除附件外)后再提交',
|
||||
// )
|
||||
|
||||
// return reject(new Error('合同信息未完善'))
|
||||
// }
|
||||
|
||||
// if (status === 'all_empty') {
|
||||
// await new Promise((resolve, reject) => {
|
||||
// this.$confirm(
|
||||
// '当前合同信息为空,确定后将关闭该上传页面',
|
||||
// '温馨提示',
|
||||
// )
|
||||
// .then(() => {
|
||||
// resolve()
|
||||
// })
|
||||
// .catch(() => {
|
||||
// reject()
|
||||
// })
|
||||
// })
|
||||
// .then(() => {
|
||||
// return resolve()
|
||||
// })
|
||||
// .catch(() => {
|
||||
// return reject()
|
||||
// })
|
||||
// }
|
||||
|
||||
// const params = {
|
||||
// ...this.contractInfoForm,
|
||||
// workerId: this.workerId,
|
||||
// }
|
||||
|
||||
// // 判断是否为重新上传(修改)
|
||||
// if (this.queryDetailsId) {
|
||||
// params.id = this.queryDetailsId
|
||||
// }
|
||||
|
||||
// const filesList = []
|
||||
// const formData = new FormData()
|
||||
|
||||
// this.contractImageList.forEach((item) => {
|
||||
// item.fileList.forEach((file) => {
|
||||
// filesList.push({
|
||||
// type: item.type,
|
||||
// name: 'contract',
|
||||
// })
|
||||
// formData.append('files', file.raw)
|
||||
// })
|
||||
// })
|
||||
// formData.append('params', JSON.stringify(params))
|
||||
// formData.append('fileMsg', JSON.stringify(filesList))
|
||||
|
||||
// const res = await uploadContractAPI(formData)
|
||||
// console.log(res, 'res 合同上传')
|
||||
// if (res.code === 200) {
|
||||
// this.$modal.msgSuccess('合同上传成功')
|
||||
// resolve()
|
||||
// } else {
|
||||
// this.$modal.msgError(res.msg)
|
||||
// reject()
|
||||
// }
|
||||
// })
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const status = this.checkFormStatus()
|
||||
|
||||
|
|
@ -349,11 +278,6 @@ export default {
|
|||
params.id = this.queryDetailsId
|
||||
}
|
||||
|
||||
// 全量填写:追加合同信息
|
||||
if (status === 'all_filled') {
|
||||
params.bmWorkerContract = this.contractInfoForm
|
||||
}
|
||||
|
||||
// 部分填写:提示错误并终止
|
||||
if (status === 'partial') {
|
||||
this.$modal.msgError(
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ export const columnsList = [
|
|||
|
||||
export const dialogConfig = {
|
||||
outerVisible: false,
|
||||
outerTitle: '',
|
||||
outerWidth: '80%',
|
||||
outerTitle: '工资卡见证',
|
||||
outerWidth: '60%',
|
||||
minHeight: '',
|
||||
maxHeight: '',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,22 +160,6 @@ export default {
|
|||
// )
|
||||
},
|
||||
|
||||
// 新增或修改
|
||||
onHandleAddOrEditPersonEntry(type, data) {
|
||||
this.dialogConfig.outerTitle = type === 1 ? '新增人员' : '修改人员'
|
||||
this.formType = type
|
||||
if (type === 2) {
|
||||
this.queryDetailsId = data.id
|
||||
this.einStatus = data.einStatus
|
||||
this.dialogConfig.outerVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.uploadContractContentRef.getEntryPersonDetail()
|
||||
})
|
||||
} else {
|
||||
this.dialogConfig.outerVisible = true
|
||||
}
|
||||
},
|
||||
|
||||
// 删除
|
||||
onHandleDeletePersonEntry(data) {
|
||||
this.$confirm('确定删除该人员吗?', '温馨提示', {
|
||||
|
|
@ -215,23 +199,23 @@ export default {
|
|||
.then(async () => {
|
||||
this.workerId = data.workerId
|
||||
this.queryDetailsId = data.id
|
||||
this.dialogConfig.outerTitle = '工资卡见证'
|
||||
this.dialogConfig.minHeight = ''
|
||||
this.dialogConfig.maxHeight = ''
|
||||
this.dialogConfig.outerWidth = '80%'
|
||||
// this.dialogConfig.outerTitle = '工资卡见证'
|
||||
// this.dialogConfig.minHeight = ''
|
||||
// this.dialogConfig.maxHeight = ''
|
||||
// this.dialogConfig.outerWidth = '60%'
|
||||
this.dialogConfig.outerVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.uploadContractContentRef.getContractDetail()
|
||||
})
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs.uploadContractContentRef.getContractDetail()
|
||||
// })
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
this.workerId = data.workerId
|
||||
this.queryDetailsId = ''
|
||||
this.dialogConfig.outerTitle = '工资卡见证'
|
||||
this.dialogConfig.minHeight = ''
|
||||
this.dialogConfig.maxHeight = ''
|
||||
this.dialogConfig.outerWidth = '80%'
|
||||
// this.dialogConfig.outerTitle = '工资卡见证'
|
||||
// this.dialogConfig.minHeight = ''
|
||||
// this.dialogConfig.maxHeight = ''
|
||||
// this.dialogConfig.outerWidth = '70%'
|
||||
this.dialogConfig.outerVisible = true
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,33 +1,46 @@
|
|||
<template>
|
||||
<!-- 新增或修改标段工程表单 -->
|
||||
<div>
|
||||
<!-- 合同信息表单 -->
|
||||
<!-- 工资卡信息表单 -->
|
||||
<el-form
|
||||
label-width="140px"
|
||||
ref="contractInfoFormRef"
|
||||
:model="contractInfoForm"
|
||||
ref="salaryCardInfoFormRef"
|
||||
:model="salaryCardInfoForm"
|
||||
>
|
||||
<TitleTip
|
||||
titleText="工资卡见证"
|
||||
borderBottom="none"
|
||||
padding="24px 10px"
|
||||
backgroundColor="#f8fafc"
|
||||
justifyContent="flex-start"
|
||||
>
|
||||
<template>
|
||||
<span class="tip-text"> (生产工资册之前必须完善) </span>
|
||||
</template>
|
||||
</TitleTip>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="合同见证照片" prop="businessLicense">
|
||||
<el-form-item label="工资卡见证照片">
|
||||
<div style="display: flex; gap: 10px">
|
||||
<div
|
||||
class="contract-img-box"
|
||||
v-for="item in contractImageList"
|
||||
v-for="item in bankImageList"
|
||||
:key="item.title"
|
||||
>
|
||||
<UploadImgFormData
|
||||
:key="item.title"
|
||||
:limit="1"
|
||||
:file-size="10"
|
||||
:file-size="20"
|
||||
:multiple="true"
|
||||
v-if="item.type != 5"
|
||||
:is-detail="formType === 2"
|
||||
:file-type="['jpg', 'png', 'jpeg']"
|
||||
:file-list.sync="item.fileList"
|
||||
:file-type="['jpg', 'png', 'jpeg']"
|
||||
:is-uploaded="item.fileList.length >= 1"
|
||||
/>
|
||||
|
||||
<span> {{ item.title }} </span>
|
||||
<span v-if="item.type != 5">
|
||||
{{ item.title }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
|
@ -36,84 +49,51 @@
|
|||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同编号" prop="contractCode">
|
||||
<el-form-item label="银行卡号" prop="bankCardCode">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入合同编号"
|
||||
v-model="contractInfoForm.contractCode"
|
||||
placeholder="请输入银行卡号"
|
||||
v-model="salaryCardInfoForm.bankCardCode"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同期限类型" prop="contractTermType">
|
||||
<el-radio-group
|
||||
size="mini"
|
||||
v-model="contractInfoForm.contractTermType"
|
||||
>
|
||||
<el-radio-button
|
||||
label="以完成一定工作为期限的合同"
|
||||
/>
|
||||
<el-radio-button label="固定期限合同" />
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同签订日期" prop="contractStartDate">
|
||||
<el-date-picker
|
||||
type="date"
|
||||
style="width: 100%"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择合同签订日期"
|
||||
v-model="contractInfoForm.contractStartDate"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合同终止日期" prop="contractStopDate">
|
||||
<el-date-picker
|
||||
type="date"
|
||||
style="width: 100%"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择合同终止日期"
|
||||
v-model="contractInfoForm.contractStopDate"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工资核定方式" prop="wageApprovedWay">
|
||||
<el-radio-group
|
||||
size="mini"
|
||||
v-model="contractInfoForm.wageApprovedWay"
|
||||
>
|
||||
<el-radio-button label="天" />
|
||||
<el-radio-button label="月" />
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="工资核定标准" prop="wageCriterion">
|
||||
<el-form-item label="银行名称" prop="bankName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入工资核定标准"
|
||||
v-model="contractInfoForm.wageCriterion"
|
||||
placeholder="请输入银行名称"
|
||||
v-model="salaryCardInfoForm.bankName"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="附件" prop="phone">
|
||||
<!-- <el-input
|
||||
<el-col :span="12">
|
||||
<el-form-item label="附件">
|
||||
<UploadFileFormData
|
||||
:limit="3"
|
||||
:file-size="20"
|
||||
:multiple="true"
|
||||
uploadTip="身份证、银行卡扫描件,承诺书、劳动合同或用工协议扫描件"
|
||||
:file-list.sync="bankImageList[4].fileList"
|
||||
:file-type="[
|
||||
'jpg',
|
||||
'png',
|
||||
'jpeg',
|
||||
'pdf',
|
||||
'doc',
|
||||
'docx',
|
||||
]"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="银行支行名称" prop="bankBranchName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入附件"
|
||||
v-model="contractInfoForm.phone"
|
||||
/> -->
|
||||
placeholder="请输入银行支行名称"
|
||||
v-model="salaryCardInfoForm.bankBranchName"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -124,6 +104,7 @@
|
|||
<script>
|
||||
import UploadImg from '@/components/UploadImg'
|
||||
import UploadImgFormData from '@/components/UploadImgFormData'
|
||||
import UploadFileFormData from '@/components/UploadFileFormData'
|
||||
import {
|
||||
uploadContractAPI,
|
||||
getContractDetailAPI,
|
||||
|
|
@ -152,96 +133,165 @@ export default {
|
|||
components: {
|
||||
UploadImg,
|
||||
UploadImgFormData,
|
||||
UploadFileFormData,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 合同信息表单
|
||||
contractInfoForm: {
|
||||
contractCode: '', // 合同编号
|
||||
contractTermType: '以完成一定工作为期限的合同', // 合同期限类型
|
||||
contractStartDate: '', // 合同签订日期
|
||||
contractStopDate: '', // 合同终止日期
|
||||
wageApprovedWay: '天', // 工资核定方式
|
||||
wageCriterion: '', // 工资核定标准
|
||||
// 工资卡信息表单
|
||||
salaryCardInfoForm: {
|
||||
bankCardCode: '', // 银行卡号
|
||||
bankName: '', // 银行名称
|
||||
bankBranchName: '', // 银行支行名称
|
||||
},
|
||||
|
||||
addOrEditForm: {
|
||||
name: '', // 姓名
|
||||
idNumber: '', // 身份证号
|
||||
sex: '', // 性别
|
||||
birthday: '', // 出生日期
|
||||
nation: '', // 民族
|
||||
issuingAuthority: '', // 签发机关
|
||||
startTime: '', // 生效日期
|
||||
endTime: '', // 失效日期
|
||||
address: '', // 身份证住址
|
||||
subName: '', // 分包商名称
|
||||
legalRepresentative: '', // 法定代表人
|
||||
phone: '', // 联系电话
|
||||
businessAddress: '', // 营业住址
|
||||
|
||||
businessLicense: [], // 营业执照
|
||||
electronicStamp: [], // 电子公章
|
||||
idCard: [], // 身份证正反面
|
||||
electronicSignature: [], // 电子签名/法人印章
|
||||
},
|
||||
contractImageList: [
|
||||
bankImageList: [
|
||||
{
|
||||
title: '人员手持合同照',
|
||||
title: '手持银行卡、承诺书',
|
||||
type: 1,
|
||||
name: 'bank',
|
||||
fileList: [],
|
||||
},
|
||||
{
|
||||
title: '工作内容页',
|
||||
title: '银行卡照片',
|
||||
type: 2,
|
||||
name: 'bank',
|
||||
fileList: [],
|
||||
},
|
||||
{
|
||||
title: '薪酬约定页',
|
||||
title: '个人工资卡承诺书',
|
||||
type: 3,
|
||||
name: 'bank',
|
||||
fileList: [],
|
||||
},
|
||||
{
|
||||
title: '本人签名页',
|
||||
title: '其它照片',
|
||||
type: 4,
|
||||
name: 'bank',
|
||||
fileList: [],
|
||||
},
|
||||
{
|
||||
title: '其他照片',
|
||||
title: '附件',
|
||||
type: 5,
|
||||
name: 'bank',
|
||||
fileList: [],
|
||||
},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 检查表单状态
|
||||
checkFormStatus() {
|
||||
// 检查图片是否有上传(排除附件)
|
||||
const fieldsList = [
|
||||
'bankCardCode', // 银行卡号
|
||||
'bankName', // 银行名称
|
||||
'bankBranchName', // 银行支行名称
|
||||
]
|
||||
const imageFieldsToCheck = this.bankImageList.slice(0, -1) // 排除最后一个附件
|
||||
|
||||
// 检查字段是否全部为空或全部有值
|
||||
let emptyFieldCount = 0
|
||||
let filledFieldCount = 0
|
||||
|
||||
// 检查普通字段
|
||||
fieldsList.forEach((field) => {
|
||||
if (!this.contractInfoForm[field]) {
|
||||
emptyFieldCount++
|
||||
} else {
|
||||
filledFieldCount++
|
||||
}
|
||||
})
|
||||
|
||||
// 检查图片字段
|
||||
imageFieldsToCheck.forEach((item) => {
|
||||
if (item.fileList.length === 0) {
|
||||
emptyFieldCount++
|
||||
} else {
|
||||
filledFieldCount++
|
||||
}
|
||||
})
|
||||
|
||||
// 返回状态
|
||||
if (
|
||||
emptyFieldCount ===
|
||||
fieldsList.length + imageFieldsToCheck.length
|
||||
) {
|
||||
return 'all_empty' // 全部为空
|
||||
} else if (
|
||||
filledFieldCount ===
|
||||
fieldsList.length + imageFieldsToCheck.length
|
||||
) {
|
||||
return 'all_filled' // 全部有值
|
||||
} else {
|
||||
return 'partial' // 部分有值
|
||||
}
|
||||
},
|
||||
// 确定按钮
|
||||
onHandleConfirmAddOrEditFun() {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
console.log(this.contractImageList, 'contractImageList')
|
||||
const status = this.checkFormStatus()
|
||||
|
||||
const params = {
|
||||
...this.contractInfoForm,
|
||||
// 1. 提前声明并初始化params
|
||||
let params = {
|
||||
...this.salaryCardInfoForm,
|
||||
workerId: this.workerId,
|
||||
}
|
||||
|
||||
// 判断是否为重新上传(修改)
|
||||
// 提前处理「重新上传」的ID参数
|
||||
if (this.queryDetailsId) {
|
||||
params.id = this.queryDetailsId
|
||||
}
|
||||
|
||||
const formData = new FormData()
|
||||
formData.append('params', JSON.stringify(params))
|
||||
formData.append('files', JSON.stringify(this.contractImageList))
|
||||
// 部分填写:提示错误并终止
|
||||
if (status === 'partial') {
|
||||
this.$modal.msgError(
|
||||
'请完善合同见证中的必填信息(除附件外)后再提交',
|
||||
)
|
||||
return reject(new Error('合同信息未完善'))
|
||||
}
|
||||
|
||||
const res = await uploadContractAPI(formData)
|
||||
console.log(res, 'res 合同上传')
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess('合同上传成功')
|
||||
resolve()
|
||||
} else {
|
||||
this.$modal.msgError(res.msg)
|
||||
reject()
|
||||
// 全空:弹窗确认,处理后阻断后续代码
|
||||
if (status === 'all_empty') {
|
||||
await new Promise((innerResolve, innerReject) => {
|
||||
this.$confirm(
|
||||
'当前合同信息为空,确定后将关闭该上传页面',
|
||||
'温馨提示',
|
||||
)
|
||||
.then(() => innerResolve())
|
||||
.catch(() => innerReject())
|
||||
})
|
||||
.then(() => resolve('isClose'))
|
||||
.catch(() => reject())
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// 非全空情况:执行文件上传逻辑(all_filled分支会走到这里)
|
||||
const filesList = []
|
||||
const formData = new FormData()
|
||||
|
||||
this.contractImageList.forEach((item) => {
|
||||
item.fileList.forEach((file) => {
|
||||
filesList.push({ type: item.type, name: 'contract' })
|
||||
formData.append('files', file.raw)
|
||||
})
|
||||
})
|
||||
formData.append('params', JSON.stringify(params))
|
||||
formData.append('fileMsg', JSON.stringify(filesList))
|
||||
|
||||
// 3. 捕获API调用异常,避免未处理的reject
|
||||
try {
|
||||
const res = await uploadContractAPI(formData)
|
||||
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess('合同上传成功')
|
||||
resolve()
|
||||
} else {
|
||||
this.$modal.msgError(res.msg)
|
||||
reject()
|
||||
}
|
||||
} catch (err) {
|
||||
this.$modal.msgError('合同上传失败,请重试')
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue