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) => {
return request({
url: '/project/***',
url: '/bmw/pmProject/getPeoNum',
method: 'POST',
data,
})
}
// 获取标段工程人员数量
export const getLotLotProjectPeoNumAPI = (data) => {
return request({
url: '/bmw/pmProject/getPeoNum',
method: 'POST',
data,
})

View File

@ -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('')
})
}
})
},
//

View File

@ -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('关键信息表单验证失败'))