批量选择人员及日期

This commit is contained in:
z 2025-03-01 10:00:20 +08:00
parent ec0eb01c00
commit d686bab61c

View File

@ -145,7 +145,12 @@
<el-card class="hl-incard">
<el-form ref="subFormRef" :model="formData.bomDetails" :rules="subFormRules" v-loading="formLoading" label-width="0" >
<el-table :row-class-name="tableRowClassName" :data="formData.bomDetails" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column type="selection" min-width="50px" >
<template #default="{ row}">
<el-checkbox v-model="row.chkboxEnable"/>
</template>
</el-table-column>
<!-- <el-table-column type="selection" width="55" />-->
<el-table-column label="序号" type="index" min-width="50px" />
<el-table-column label="变更次数" prop="bomEditStatus" max-width="60px" align="center">
<template #default="{ row}">
@ -224,10 +229,10 @@
<template #header><span class="hl-table_header">*</span>需求完成日期</template>
<template #default="{ row, $index }">
<el-form-item v-if="getDisable(row.bomEditStatus) == true" :prop="`${$index}.requireEndDate`" class="mb-0px!" >
<el-date-picker :disabled="getDisable(row.bomEditStatus)" class="!w-265px" v-model="row.requireEndDate" type="date" value-format="x" placeholder="需求完成日期" />
<el-date-picker :disabled="getDisable(row.bomEditStatus)" class="!w-265px" v-model="row.requireEndDate" type="date" @change="change2(row)" value-format="x" placeholder="需求完成日期" />
</el-form-item>
<el-form-item v-if="getDisable(row.bomEditStatus)==false" :prop="`${$index}.requireEndDate`" class="mb-0px!" :rules="subFormRules.requireEndDate">
<el-date-picker :disabled="getDisable(row.bomEditStatus)" class="!w-265px" v-model="row.requireEndDate" type="date" value-format="x" placeholder="需求完成日期" />
<el-date-picker :disabled="getDisable(row.bomEditStatus)" class="!w-265px" v-model="row.requireEndDate" type="date" @change="change2(row)" value-format="x" placeholder="需求完成日期" />
</el-form-item>
</template>
</el-table-column>
@ -340,34 +345,51 @@ const heliBomStatusOptions = ref<bomEditStatusEnum[]>([
]);
const change =(row:any)=>{
var bomDetails = formData.value.bomDetails;
if (row.chkboxEnable==1){
if (row.chkboxEnable){
for (let i = 0; i < bomDetails.length; i++) {
if (bomDetails[i].chkboxEnable==1&&bomDetails[i].bomEditStatus!=1){
if (bomDetails[i].chkboxEnable&&bomDetails[i].bomEditStatus!=1){
bomDetails[i].owner=row.owner
}
}
}
}
const change2 =(row:any)=>{
var bomDetails = formData.value.bomDetails;
if (row.chkboxEnable){
for (let i = 0; i < bomDetails.length; i++) {
if (bomDetails[i].chkboxEnable&&bomDetails[i].bomEditStatus!=1){
bomDetails[i].requireEndDate=row.requireEndDate
}
}
}
}
// const deselect =()=>{
// var bomDetails = formData.value.bomDetails;
// for (let i = 0; i < bomDetails.length; i++) {
// bomDetails[i].chkboxEnable=false
// }
// }
const handleSelectionChange = (row: any) => {
var bomDetails = formData.value.bomDetails;
if (row.length==0) {
for (let i = 0; i < bomDetails.length; i++) {
bomDetails[i].chkboxEnable=0
bomDetails[i].chkboxEnable=false
}
}else if (row.length==formData.value.bomDetails.length) {
}else if (row.length== bomDetails.length) {
for (let i = 0; i < bomDetails.length; i++) {
bomDetails[i].chkboxEnable=1
if ( bomDetails[i].owner=='' ||bomDetails[i].owner==null){
bomDetails[i].chkboxEnable=true
}
}
}else {
for (let i = 0; i < bomDetails.length; i++) {
for (let j = 0; j < row.length; j++) {
if (row[j].id==bomDetails[i].id){
bomDetails[i].chkboxEnable=1
bomDetails[i].chkboxEnable=true
break
}else {
bomDetails[i].chkboxEnable=0
bomDetails[i].chkboxEnable=false
}
}
}