This commit is contained in:
parent
a89853b4ac
commit
43bfac24de
|
|
@ -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)
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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('请完善关键信息表单')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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: [
|
||||
|
|
|
|||
|
|
@ -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. 捕获API调用异常,避免未处理的reject
|
||||
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. 捕获API调用异常,避免未处理的reject
|
||||
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)
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue