This commit is contained in:
BianLzhaoMin 2025-08-21 14:42:57 +08:00
parent a89853b4ac
commit 43bfac24de
4 changed files with 434 additions and 285 deletions

View File

@ -190,6 +190,31 @@ export default {
//
handleChange(file, fileList) {
console.log(file, fileList, 'file, fileList')
const isFormat = this.fileType.some((e) => file.name.endsWith(e))
if (!isFormat) {
this.$modal.msgError(
`文件格式不正确, 请上传${this.fileType.join(
'、',
)}格式的文件!`,
)
this.$emit(
'update:fileList',
fileList.filter((item) => item.uid !== file.uid),
)
return false
}
//
const isLt = file.size / 1024 / 1024 < this.fileSize
if (!isLt) {
this.$modal.msgError(`图片大小不能超过 ${this.fileSize} MB`)
this.$emit(
'update:fileList',
fileList.filter((item) => item.uid !== file.uid),
)
return false
}
this.$emit('update:fileList', fileList)
this.$emit('onUploadChange', fileList)
},

View File

@ -481,6 +481,7 @@
label-width="140px"
ref="salaryCardInfoFormRef"
:model="salaryCardInfoForm"
:rules="salaryCardInfoFormRules"
>
<TitleTip
titleText="工资卡见证"
@ -534,7 +535,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="银行名称" prop="bankName">
<el-form-item label="银行名称">
<el-input
clearable
maxlength="30"
@ -566,7 +567,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="银行支行名称" prop="bankBranchName">
<el-form-item label="银行支行名称">
<el-input
clearable
maxlength="50"
@ -946,8 +947,23 @@ export default {
required: false,
},
{
pattern: /^[1-9]\d*$/,
message: '请输入正确的工资核定标准',
trigger: 'blur',
pattern: /^[1-9]\d{0,5}$/,
message: '请输入1-999999之间的正整数',
},
],
},
//
salaryCardInfoFormRules: {
bankCardCode: [
{
required: false,
},
{
trigger: 'blur',
pattern: /^[1-9]\d{12,18}$/,
message: '请输入13-19位的正确银行卡号',
},
],
},
@ -1025,228 +1041,303 @@ export default {
if (!valid1) {
//
reject(new Error('身份证信息表单验证失败'))
this.$modal.msgError('请完善身份证信息表单')
return
}
// 2.
this.$refs.keyInfoFormRef.validate(async (valid2) => {
if (valid2) {
this.$refs.contractInfoFormRef.validate(
async (valid3) => {
if (valid3) {
const fieldsToCheck_1 = [
'contractCode', //
'wageCriterion', //
'contractStopDate', //
'contractStartDate', //
]
const fieldsToCheck_2 = [
'bankName', //
'bankCardCode', //
'bankBranchName', //
]
const status_1 = this.checkFormStatus(
fieldsToCheck_1,
this.contractImageList,
1,
)
const status_2 = this.checkFormStatus(
fieldsToCheck_2,
this.bankImageList,
2,
)
this.$refs.salaryCardInfoFormRef.validate(
async (valid4) => {
if (valid4) {
const fieldsToCheck_1 = [
'contractCode', //
'wageCriterion', //
'contractStopDate', //
'contractStartDate', //
]
const fieldsToCheck_2 = [
'bankName', //
'bankCardCode', //
'bankBranchName', //
]
const status_1 =
this.checkFormStatus(
fieldsToCheck_1,
this
.contractImageList,
1,
)
const status_2 =
this.checkFormStatus(
fieldsToCheck_2,
this.bankImageList,
2,
)
//
const params = {
...this.keyInfoForm,
...this.idCardInfoForm,
}
//
const params = {
...this.keyInfoForm,
...this.idCardInfoForm,
}
const { faceImg } = this.idCardInfoForm
const formData = new FormData()
const fileMsg = []
let fileIdList = []
const { faceImg } =
this.idCardInfoForm
const formData =
new FormData()
const fileMsg = []
let fileIdList = []
if (this.queryDetailsId) {
params.id = this.queryDetailsId
params.einStatus = this.einStatus
}
if (this.queryDetailsId) {
params.id =
this.queryDetailsId
params.einStatus =
this.einStatus
}
delete params.faceImg //
delete params.faceImg //
//
faceImg.forEach((item) => {
if (!item.id) {
formData.append(
'files',
item.raw,
)
fileMsg.push({
type: 1,
name: 'faceImg',
})
}
})
if (
status_1 === 'all_filled' &&
!this.isEditContract
) {
params.bmWorkerContract =
this.contractInfoForm
this.contractImageList.forEach(
(item) => {
item.fileList.forEach(
(j) => {
//
faceImg.forEach((item) => {
if (!item.id) {
formData.append(
'files',
j.raw,
item.raw,
)
fileMsg.push({
type: item.type,
name: item.name,
type: 1,
name: 'faceImg',
})
},
)
},
)
}
}
})
if (status_1 === 'partial') {
this.$modal.msgError(
'请完善合同见证中的必填信息(除附件外)后再提交',
)
return reject(
new Error('合同信息未完善'),
)
}
if (status_2 === 'all_filled') {
params.bmWorkerWageCard =
this.salaryCardInfoForm
if (this.queryDetailsId) {
let reserveFileList = []
this.bankImageList.forEach(
(item) => {
item.fileList.forEach(
(j) => {
if (j.id) {
reserveFileList.push(
j.id,
)
}
if (
status_1 ===
'all_filled' &&
!this.isEditContract
) {
params.bmWorkerContract =
this.contractInfoForm
this.contractImageList.forEach(
(item) => {
item.fileList.forEach(
(j) => {
formData.append(
'files',
j.raw,
)
fileMsg.push(
{
type: item.type,
name: item.name,
},
)
},
)
},
)
},
)
if (
reserveFileList.length > 0
) {
fileIdList =
this.editUploadFileList
.filter(
(item) =>
!reserveFileList.includes(
item.id,
),
)
.map((j) => j.id)
if (fileIdList.length > 0) {
params.bmWorkerWageCard.delIds =
fileIdList.join(',')
}
}
}
this.bankImageList.forEach(
(item) => {
item.fileList.forEach(
(j) => {
if (!j.id) {
formData.append(
'files',
j.raw,
)
fileMsg.push({
type: item.type,
name: item.name,
})
if (
status_1 === 'partial'
) {
this.$modal.msgError(
'请完善合同见证中的必填信息(除附件外)后再提交',
)
return reject(
new Error(
'合同信息未完善',
),
)
}
if (
status_2 ===
'all_filled'
) {
params.bmWorkerWageCard =
this.salaryCardInfoForm
if (
this.queryDetailsId
) {
let reserveFileList =
[]
this.bankImageList.forEach(
(item) => {
item.fileList.forEach(
(j) => {
if (
j.id
) {
reserveFileList.push(
j.id,
)
}
},
)
},
)
if (
reserveFileList.length >
0
) {
fileIdList =
this.editUploadFileList
.filter(
(
item,
) =>
!reserveFileList.includes(
item.id,
),
)
.map(
(
j,
) =>
j.id,
)
if (
fileIdList.length >
0
) {
params.bmWorkerWageCard.delIds =
fileIdList.join(
',',
)
}
}
},
}
this.bankImageList.forEach(
(item) => {
item.fileList.forEach(
(j) => {
if (
!j.id
) {
formData.append(
'files',
j.raw,
)
fileMsg.push(
{
type: item.type,
name: item.name,
},
)
}
},
)
},
)
}
if (
status_2 === 'partial'
) {
this.$modal.msgError(
'请完善工资卡见证中的必填信息(除附件外)后再提交',
)
return reject(
new Error(
'工资卡信息未完善',
),
)
}
if (
status_2 ===
'all_empty' &&
this.queryDetailsId
) {
if (
this
.editUploadFileList
.length > 0
) {
params.bmWorkerWageCard.delIds =
this.editUploadFileList
.map(
(j) =>
j.id,
)
.join(',')
}
}
formData.append(
'params',
JSON.stringify(params),
)
formData.append(
'fileMsg',
JSON.stringify(fileMsg),
)
},
)
}
if (status_2 === 'partial') {
this.$modal.msgError(
'请完善工资卡见证中的必填信息(除附件外)后再提交',
)
const API = this
.queryDetailsId
? editEntryPersonAPI
: addEntryPersonAPI
return reject(
new Error('工资卡信息未完善'),
)
}
const res = await API(
formData,
)
if (res.code === 200) {
this.$modal.msgSuccess(
this.queryDetailsId
? '修改人员成功'
: '新增人员成功',
)
if (
status_2 === 'all_empty' &&
this.queryDetailsId
) {
if (
this.editUploadFileList.length >
0
) {
params.bmWorkerWageCard.delIds =
this.editUploadFileList
.map((j) => j.id)
.join(',')
}
}
// 绿
const result =
await updatePersonLightStatusAPI(
this
.queryDetailsId
? this
.workerId
: res.data,
)
console.log(
result,
'result红绿灯状态更新结果',
)
formData.append(
'params',
JSON.stringify(params),
resolve()
} else {
this.$modal.msgError(
res.msg,
)
reject(
new Error(res.msg),
)
}
} else {
reject(
new Error(
'工资卡信息表单验证失败',
),
)
this.$modal.msgError(
'请完善工资卡信息表单',
)
}
},
)
formData.append(
'fileMsg',
JSON.stringify(fileMsg),
)
const API = this.queryDetailsId
? editEntryPersonAPI
: addEntryPersonAPI
const res = await API(formData)
if (res.code === 200) {
this.$modal.msgSuccess(
this.queryDetailsId
? '修改人员成功'
: '新增人员成功',
)
// 绿
const result =
await updatePersonLightStatusAPI(
this.queryDetailsId
? this.workerId
: res.data,
)
console.log(
result,
'result红绿灯状态更新结果',
)
resolve()
} else {
this.$modal.msgError(res.msg)
reject(new Error(res.msg))
}
} else {
reject(
new Error('合同信息表单验证失败'),
this.$modal.msgError(
'请完善合同信息表单',
),
)
}
},
@ -1254,6 +1345,7 @@ export default {
} else {
//
reject(new Error('关键信息表单验证失败'))
this.$modal.msgError('请完善关键信息表单')
}
})
})

View File

@ -66,7 +66,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="合同签订日期" prop="contractStartDate">
<el-form-item label="合同签订日期">
<el-date-picker
type="date"
style="width: 100%"
@ -77,7 +77,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同终止日期" prop="contractStopDate">
<el-form-item label="合同终止日期">
<el-date-picker
type="date"
style="width: 100%"
@ -90,7 +90,7 @@
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="工资核定方式" prop="wageApprovedWay">
<el-form-item label="工资核定方式">
<el-radio-group
size="mini"
v-model="contractInfoForm.wageApprovedWay"
@ -223,6 +223,16 @@ export default {
validator: validateContractStopDate,
},
],
wageCriterion: [
{
required: false,
},
{
trigger: 'blur',
pattern: /^[1-9]\d{0,5}$/,
message: '请输入1-999999之间的正整数',
},
],
},
contractImageList: [

View File

@ -6,6 +6,7 @@
label-width="140px"
ref="salaryCardInfoFormRef"
:model="salaryCardInfoForm"
:rules="salaryCardInfoFormRules"
>
<TitleTip
titleText="工资卡见证"
@ -60,7 +61,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="银行名称" prop="bankName">
<el-form-item label="银行名称">
<el-input
clearable
maxlength="50"
@ -92,7 +93,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="银行支行名称" prop="bankBranchName">
<el-form-item label="银行支行名称">
<el-input
clearable
maxlength="50"
@ -184,6 +185,19 @@ export default {
},
],
salaryCardInfoFormRules: {
bankCardCode: [
{
required: false,
},
{
trigger: 'blur',
pattern: /^[1-9]\d{12,18}$/,
message: '请输入13-19位的正确银行卡号',
},
],
},
editUploadFileList: [],
}
},
@ -238,105 +252,113 @@ export default {
//
onHandleConfirmAddOrEditFun() {
return new Promise(async (resolve, reject) => {
const status = this.checkFormStatus()
this.$refs.salaryCardInfoFormRef.validate(async (valid) => {
if (valid) {
const status = this.checkFormStatus()
// 1. params
let params = {
...this.salaryCardInfoForm,
workerId: this.workerId,
}
let fileIdList = []
const filesList = []
const formData = new FormData()
// 2.
//
if (status === 'partial') {
this.$modal.msgError(
'请完善工资卡见证中的必填信息(除附件外)后再提交',
)
return reject(new Error('工资卡信息未完善'))
}
//
if (status === 'all_empty') {
await new Promise((innerResolve, innerReject) => {
this.$confirm(
'当前工资卡信息为空,将不做任何上传逻辑,确定后将关闭该上传页面',
'温馨提示',
)
.then(() => innerResolve())
.catch(() => innerReject())
})
.then(() => resolve('isClose'))
.catch(() => reject())
return
}
if (status === 'all_filled') {
if (this.queryDetailsId) {
params.id = this.queryDetailsId
let reserveFileList = []
this.bankImageList.forEach((item) => {
item.fileList.forEach((j) => {
if (j.id) {
reserveFileList.push(j.id)
}
})
})
if (reserveFileList.length > 0) {
fileIdList = this.editUploadFileList
.filter(
(item) =>
!reserveFileList.includes(item.id),
)
.map((j) => j.id)
params.delIds = fileIdList.join(',')
// 1. params
let params = {
...this.salaryCardInfoForm,
workerId: this.workerId,
}
}
let fileIdList = []
const filesList = []
const formData = new FormData()
this.bankImageList.forEach((item) => {
item.fileList.forEach((file) => {
if (!file.id) {
filesList.push({
type: item.type,
name: 'wageCard',
// 2.
//
if (status === 'partial') {
this.$modal.msgError(
'请完善工资卡见证中的必填信息(除附件外)后再提交',
)
return reject(new Error('工资卡信息未完善'))
}
//
if (status === 'all_empty') {
await new Promise((innerResolve, innerReject) => {
this.$confirm(
'当前工资卡信息为空,将不做任何上传逻辑,确定后将关闭该上传页面',
'温馨提示',
)
.then(() => innerResolve())
.catch(() => innerReject())
})
.then(() => resolve('isClose'))
.catch(() => reject())
return
}
if (status === 'all_filled') {
if (this.queryDetailsId) {
params.id = this.queryDetailsId
let reserveFileList = []
this.bankImageList.forEach((item) => {
item.fileList.forEach((j) => {
if (j.id) {
reserveFileList.push(j.id)
}
})
})
formData.append('files', file.raw)
if (reserveFileList.length > 0) {
fileIdList = this.editUploadFileList
.filter(
(item) =>
!reserveFileList.includes(
item.id,
),
)
.map((j) => j.id)
params.delIds = fileIdList.join(',')
}
}
})
})
}
formData.append('params', JSON.stringify(params))
formData.append('fileMsg', JSON.stringify(filesList))
this.bankImageList.forEach((item) => {
item.fileList.forEach((file) => {
if (!file.id) {
filesList.push({
type: item.type,
name: 'wageCard',
})
formData.append('files', file.raw)
}
})
})
}
// 3. APIreject
try {
const res = await uploadWageCardAPI(formData)
formData.append('params', JSON.stringify(params))
formData.append('fileMsg', JSON.stringify(filesList))
if (res.code === 200) {
this.$modal.msgSuccess('工资卡信息上传成功')
// 3. APIreject
try {
const res = await uploadWageCardAPI(formData)
// 绿
const result = await updatePersonLightStatusAPI(
this.workerId,
)
console.log(result, 'result红绿灯状态更新结果')
if (res.code === 200) {
this.$modal.msgSuccess('工资卡信息上传成功')
resolve()
// 绿
const result = await updatePersonLightStatusAPI(
this.workerId,
)
console.log(result, 'result红绿灯状态更新结果')
resolve()
} else {
this.$modal.msgError(res.msg)
reject()
}
} catch (err) {
this.$modal.msgError('工资卡信息上传失败,请重试')
reject(err)
}
} else {
this.$modal.msgError(res.msg)
reject()
reject(new Error('工资卡信息表单验证失败'))
}
} catch (err) {
this.$modal.msgError('工资卡信息上传失败,请重试')
reject(err)
}
})
})
},