This commit is contained in:
BianLzhaoMin 2025-08-18 18:06:23 +08:00
parent 4d894bb3cf
commit fc3e8a9bfa
3 changed files with 299 additions and 197 deletions

View File

@ -30,7 +30,16 @@ export const getLotLotProjectListAPI = (data) => {
// 标段工程完工操作 // 标段工程完工操作
export const completeLotLotProjectAPI = (data) => { export const completeLotLotProjectAPI = (data) => {
return request({ return request({
url: '/project/***', url: '/bmw/pmProject/getPeoNum',
method: 'POST',
data,
})
}
// 获取标段工程人员数量
export const getLotLotProjectPeoNumAPI = (data) => {
return request({
url: '/bmw/pmProject/getPeoNum',
method: 'POST', method: 'POST',
data, data,
}) })

View File

@ -114,7 +114,8 @@ import { formLabel, columnsList, dialogConfig } from './config'
import { import {
deleteLotLotProjectAPI, deleteLotLotProjectAPI,
getLotLotProjectListAPI, getLotLotProjectListAPI,
completeLotLotProjectAPI, getLotLotProjectPeoNumAPI,
addAndEditLotLotProjectAPI,
} from '@/api/basic-manage/project-manage/lot-project' } from '@/api/basic-manage/project-manage/lot-project'
import { import {
@ -189,46 +190,62 @@ export default {
// //
onHandleCompleteAllProject(data) { onHandleCompleteAllProject(data) {
const h = this.$createElement getLotLotProjectPeoNumAPI({
this.$msgbox({ proId: data.id,
title: '完工确认', }).then((res) => {
message: h('p', null, [ console.log(res, 'res数量')
h( const { perNum } = res.data
'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)
if (res.code === 200) { if (perNum > 0) {
this.$msgSuccess('完工成功') this.$modal.msgError(
this.$refs.allProjectTableRef.getTableList() // `该标段工程下还有 ${perNum} 人未出场,请先将人员全部出场后,再操作此项。`,
} )
}) return
.catch(() => { } else {
// console.log('') 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('')
})
}
})
}, },
// //

View File

@ -596,6 +596,9 @@ export default {
}, },
data() { data() {
const validateContractStartDate = (rule, value, callback) => { const validateContractStartDate = (rule, value, callback) => {
if (!value) {
return callback()
}
if (value >= this.contractInfoForm.contractStopDate) { if (value >= this.contractInfoForm.contractStopDate) {
callback(new Error('合同签订日期不能大于合同终止日期')) callback(new Error('合同签订日期不能大于合同终止日期'))
} }
@ -603,11 +606,28 @@ export default {
} }
const validateContractStopDate = (rule, value, callback) => { const validateContractStopDate = (rule, value, callback) => {
if (!value) {
return callback()
}
if (value <= this.contractInfoForm.contractStartDate) { if (value <= this.contractInfoForm.contractStartDate) {
callback(new Error('合同终止日期不能小于合同签订日期')) callback(new Error('合同终止日期不能小于合同签订日期'))
} }
callback() 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 { return {
// //
idCardReaderForm: { idCardReaderForm: {
@ -645,8 +665,8 @@ export default {
contractInfoForm: { contractInfoForm: {
contractCode: '', // contractCode: '', //
contractTermType: '以完成一定工作为期限的合同', // contractTermType: '以完成一定工作为期限的合同', //
contractStartDate: '', // contractStartDate: null, //
contractStopDate: '', // contractStopDate: null, //
wageApprovedWay: '天', // wageApprovedWay: '天', //
wageCriterion: '', // wageCriterion: '', //
}, },
@ -802,6 +822,10 @@ export default {
trigger: 'change', trigger: 'change',
message: '请选择生效日期', message: '请选择生效日期',
}, },
{
validator: validateStartTime,
trigger: 'blur',
},
], ],
endTime: [ endTime: [
{ {
@ -809,6 +833,10 @@ export default {
trigger: 'change', trigger: 'change',
message: '请选择失效日期', message: '请选择失效日期',
}, },
{
validator: validateEndTime,
trigger: 'blur',
},
], ],
address: [ address: [
{ {
@ -873,12 +901,18 @@ export default {
// //
contractInfoFormRules: { contractInfoFormRules: {
contractStartDate: [ contractStartDate: [
{
required: false,
},
{ {
validator: validateContractStartDate, validator: validateContractStartDate,
trigger: 'blur', trigger: 'blur',
}, },
], ],
contractStopDate: [ contractStopDate: [
{
required: false,
},
{ {
validator: validateContractStopDate, validator: validateContractStopDate,
trigger: 'blur', trigger: 'blur',
@ -972,171 +1006,213 @@ export default {
// 2. // 2.
this.$refs.keyInfoFormRef.validate(async (valid2) => { this.$refs.keyInfoFormRef.validate(async (valid2) => {
if (valid2) { if (valid2) {
const fieldsToCheck_1 = [ this.$refs.contractInfoFormRef.validate(
'contractCode', // async (valid3) => {
'wageCriterion', // if (valid3) {
'contractStopDate', // const fieldsToCheck_1 = [
'contractStartDate', // 'contractCode', //
] 'wageCriterion', //
const fieldsToCheck_2 = [ 'contractStopDate', //
'bankName', // 'contractStartDate', //
'bankCardCode', // ]
'bankBranchName', // const fieldsToCheck_2 = [
] 'bankName', //
const status_1 = this.checkFormStatus( 'bankCardCode', //
fieldsToCheck_1, 'bankBranchName', //
this.contractImageList, ]
1, const status_1 = this.checkFormStatus(
) fieldsToCheck_1,
const status_2 = this.checkFormStatus( this.contractImageList,
fieldsToCheck_2, 1,
this.bankImageList, )
2, const status_2 = this.checkFormStatus(
) fieldsToCheck_2,
this.bankImageList,
2,
)
// //
const params = { const params = {
...this.keyInfoForm, ...this.keyInfoForm,
...this.idCardInfoForm, ...this.idCardInfoForm,
} }
const { faceImg } = this.idCardInfoForm const { faceImg } = this.idCardInfoForm
const formData = new FormData() const formData = new FormData()
const fileMsg = [] const fileMsg = []
let fileIdList = [] let fileIdList = []
if (this.queryDetailsId) { if (this.queryDetailsId) {
params.id = this.queryDetailsId params.id = this.queryDetailsId
params.einStatus = this.einStatus params.einStatus = this.einStatus
} }
delete params.faceImg // delete params.faceImg //
// //
faceImg.forEach((item) => { faceImg.forEach((item) => {
if (!item.id) { if (!item.id) {
formData.append('files', item.raw) formData.append(
fileMsg.push({ 'files',
type: 1, item.raw,
name: 'faceImg', )
}) 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)
} }
}) })
})
if (reserveFileList.length > 0) { if (
fileIdList = this.editUploadFileList status_1 === 'all_filled' &&
.filter( !this.isEditContract
(item) => ) {
!reserveFileList.includes( params.bmWorkerContract =
item.id, 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 { } else {
// //
reject(new Error('关键信息表单验证失败')) reject(new Error('关键信息表单验证失败'))