This commit is contained in:
parent
4d894bb3cf
commit
fc3e8a9bfa
|
|
@ -30,7 +30,16 @@ export const getLotLotProjectListAPI = (data) => {
|
|||
// 标段工程完工操作
|
||||
export const completeLotLotProjectAPI = (data) => {
|
||||
return request({
|
||||
url: '/project/***',
|
||||
url: '/bmw/pmProject/getPeoNum',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 获取标段工程人员数量
|
||||
export const getLotLotProjectPeoNumAPI = (data) => {
|
||||
return request({
|
||||
url: '/bmw/pmProject/getPeoNum',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ import { formLabel, columnsList, dialogConfig } from './config'
|
|||
import {
|
||||
deleteLotLotProjectAPI,
|
||||
getLotLotProjectListAPI,
|
||||
completeLotLotProjectAPI,
|
||||
getLotLotProjectPeoNumAPI,
|
||||
addAndEditLotLotProjectAPI,
|
||||
} from '@/api/basic-manage/project-manage/lot-project'
|
||||
|
||||
import {
|
||||
|
|
@ -189,46 +190,62 @@ export default {
|
|||
|
||||
// 完工
|
||||
onHandleCompleteAllProject(data) {
|
||||
const h = this.$createElement
|
||||
this.$msgbox({
|
||||
title: '完工确认',
|
||||
message: h('p', null, [
|
||||
h(
|
||||
'h3',
|
||||
{
|
||||
style: 'font-weight: bold; display: flex; align-items: center;',
|
||||
},
|
||||
[
|
||||
h('i', {
|
||||
class: 'el-icon-warning-outline', // 使用Element UI的警告图标
|
||||
style: 'color: #E6A23C; margin-right: 8px; font-size: 18px;',
|
||||
}),
|
||||
'是否确定完工?',
|
||||
],
|
||||
),
|
||||
h(
|
||||
'p',
|
||||
{
|
||||
style: 'text-indent: 2em;',
|
||||
},
|
||||
'完工后,会解绑分包合同,项目人员全部出场,请确认后再操作此项。',
|
||||
),
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await completeLotLotProjectAPI(data.id)
|
||||
getLotLotProjectPeoNumAPI({
|
||||
proId: data.id,
|
||||
}).then((res) => {
|
||||
console.log(res, 'res数量')
|
||||
const { perNum } = res.data
|
||||
|
||||
if (res.code === 200) {
|
||||
this.$msgSuccess('完工成功')
|
||||
this.$refs.allProjectTableRef.getTableList() // 更新列表
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// console.log('取消')
|
||||
})
|
||||
if (perNum > 0) {
|
||||
this.$modal.msgError(
|
||||
`该标段工程下还有 ${perNum} 人未出场,请先将人员全部出场后,再操作此项。`,
|
||||
)
|
||||
return
|
||||
} else {
|
||||
const h = this.$createElement
|
||||
this.$msgbox({
|
||||
title: '完工确认',
|
||||
message: h('p', null, [
|
||||
h(
|
||||
'h3',
|
||||
{
|
||||
style: 'font-weight: bold; display: flex; align-items: center;',
|
||||
},
|
||||
[
|
||||
h('i', {
|
||||
class: 'el-icon-warning-outline', // 使用Element UI的警告图标
|
||||
style: 'color: #E6A23C; margin-right: 8px; font-size: 18px;',
|
||||
}),
|
||||
'是否确定完工?',
|
||||
],
|
||||
),
|
||||
h(
|
||||
'p',
|
||||
{
|
||||
style: 'text-indent: 2em;',
|
||||
},
|
||||
'完工后,会解绑分包合同,项目人员全部出场,请确认后再操作此项。',
|
||||
),
|
||||
]),
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
})
|
||||
.then(async () => {
|
||||
const res = await addAndEditLotLotProjectAPI({
|
||||
id: data.id,
|
||||
proStatus: '4',
|
||||
})
|
||||
if (res.code === 200) {
|
||||
this.$msgSuccess('完工成功')
|
||||
this.$refs.lotProjectTableRef.getTableList() // 更新列表
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// console.log('取消')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 初始化工程类型
|
||||
|
|
|
|||
|
|
@ -596,6 +596,9 @@ export default {
|
|||
},
|
||||
data() {
|
||||
const validateContractStartDate = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback()
|
||||
}
|
||||
if (value >= this.contractInfoForm.contractStopDate) {
|
||||
callback(new Error('合同签订日期不能大于合同终止日期'))
|
||||
}
|
||||
|
|
@ -603,11 +606,28 @@ export default {
|
|||
}
|
||||
|
||||
const validateContractStopDate = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback()
|
||||
}
|
||||
if (value <= this.contractInfoForm.contractStartDate) {
|
||||
callback(new Error('合同终止日期不能小于合同签订日期'))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
|
||||
const validateStartTime = (rule, value, callback) => {
|
||||
if (value >= this.idCardInfoForm.endTime) {
|
||||
callback(new Error('生效日期不能大于失效日期'))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
|
||||
const validateEndTime = (rule, value, callback) => {
|
||||
if (value <= this.idCardInfoForm.startTime) {
|
||||
callback(new Error('失效日期不能小于生效日期'))
|
||||
}
|
||||
callback()
|
||||
}
|
||||
return {
|
||||
// 身份证读卡器表单
|
||||
idCardReaderForm: {
|
||||
|
|
@ -645,8 +665,8 @@ export default {
|
|||
contractInfoForm: {
|
||||
contractCode: '', // 合同编号
|
||||
contractTermType: '以完成一定工作为期限的合同', // 合同期限类型
|
||||
contractStartDate: '', // 合同签订日期
|
||||
contractStopDate: '', // 合同终止日期
|
||||
contractStartDate: null, // 合同签订日期
|
||||
contractStopDate: null, // 合同终止日期
|
||||
wageApprovedWay: '天', // 工资核定方式
|
||||
wageCriterion: '', // 工资核定标准
|
||||
},
|
||||
|
|
@ -802,6 +822,10 @@ export default {
|
|||
trigger: 'change',
|
||||
message: '请选择生效日期',
|
||||
},
|
||||
{
|
||||
validator: validateStartTime,
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
endTime: [
|
||||
{
|
||||
|
|
@ -809,6 +833,10 @@ export default {
|
|||
trigger: 'change',
|
||||
message: '请选择失效日期',
|
||||
},
|
||||
{
|
||||
validator: validateEndTime,
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
address: [
|
||||
{
|
||||
|
|
@ -873,12 +901,18 @@ export default {
|
|||
// 合同信息表单校验
|
||||
contractInfoFormRules: {
|
||||
contractStartDate: [
|
||||
{
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
validator: validateContractStartDate,
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
contractStopDate: [
|
||||
{
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
validator: validateContractStopDate,
|
||||
trigger: 'blur',
|
||||
|
|
@ -972,171 +1006,213 @@ export default {
|
|||
// 2. 身份证表单验证通过后,验证关键信息表单
|
||||
this.$refs.keyInfoFormRef.validate(async (valid2) => {
|
||||
if (valid2) {
|
||||
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.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,
|
||||
)
|
||||
|
||||
// 组装参数
|
||||
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) => {
|
||||
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)
|
||||
// 人脸图片
|
||||
faceImg.forEach((item) => {
|
||||
if (!item.id) {
|
||||
formData.append(
|
||||
'files',
|
||||
item.raw,
|
||||
)
|
||||
fileMsg.push({
|
||||
type: 1,
|
||||
name: 'faceImg',
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
if (reserveFileList.length > 0) {
|
||||
fileIdList = this.editUploadFileList
|
||||
.filter(
|
||||
(item) =>
|
||||
!reserveFileList.includes(
|
||||
item.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,
|
||||
})
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
.map((j) => j.id)
|
||||
|
||||
if (fileIdList.length > 0) {
|
||||
params.bmWorkerWageCard.delIds =
|
||||
fileIdList.join(',')
|
||||
}
|
||||
|
||||
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),
|
||||
)
|
||||
|
||||
const API = this.queryDetailsId
|
||||
? editEntryPersonAPI
|
||||
: addEntryPersonAPI
|
||||
|
||||
const res = await API(formData)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess(
|
||||
this.queryDetailsId
|
||||
? '修改人员成功'
|
||||
: '新增人员成功',
|
||||
)
|
||||
resolve()
|
||||
} else {
|
||||
this.$modal.msgError(res.msg)
|
||||
reject(new Error(res.msg))
|
||||
}
|
||||
} else {
|
||||
reject(
|
||||
new Error('合同信息表单验证失败'),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
this.bankImageList.forEach((item) => {
|
||||
item.fileList.forEach((j) => {
|
||||
if (!j.id) {
|
||||
formData.append('files', j.raw)
|
||||
fileMsg.push({
|
||||
type: item.type,
|
||||
name: item.name,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
this.$refs.contractInfoFormRef.validate(
|
||||
(valid) => {
|
||||
if (!valid) {
|
||||
reject(new Error('合同信息未完善'))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
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))
|
||||
|
||||
const API = this.queryDetailsId
|
||||
? editEntryPersonAPI
|
||||
: addEntryPersonAPI
|
||||
|
||||
const res = await API(formData)
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess(
|
||||
this.queryDetailsId
|
||||
? '修改人员成功'
|
||||
: '新增人员成功',
|
||||
)
|
||||
resolve()
|
||||
} else {
|
||||
this.$modal.msgError(res.msg)
|
||||
reject(new Error(res.msg))
|
||||
}
|
||||
},
|
||||
)
|
||||
} else {
|
||||
// 关键信息表单验证失败
|
||||
reject(new Error('关键信息表单验证失败'))
|
||||
|
|
|
|||
Loading…
Reference in New Issue