From c36d1a1bbdaa28476298d4ed8bd3c36b4fcd6682 Mon Sep 17 00:00:00 2001 From: BianLzhaoMin <11485688+bianliangzhaomin123@user.noreply.gitee.com> Date: Tue, 10 Dec 2024 16:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/workPlan/dayPlan/sub-user/index.vue | 93 +++++++++++++++++------ 1 file changed, 70 insertions(+), 23 deletions(-) diff --git a/pages/workPlan/dayPlan/sub-user/index.vue b/pages/workPlan/dayPlan/sub-user/index.vue index 33b08d7..c44b4bb 100644 --- a/pages/workPlan/dayPlan/sub-user/index.vue +++ b/pages/workPlan/dayPlan/sub-user/index.vue @@ -247,7 +247,7 @@ export default { // this.subUserListTemp tempArray.forEach(e => { this.subUserListAll.forEach(j => { - if (!e.includes(j.idNumber)) { + if (e.length > 0 && !e.includes(j.idNumber)) { // this.subUserList.push(j) tempPersonList.push(JSON.parse(JSON.stringify(j))) // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) @@ -309,7 +309,7 @@ export default { // this.subUserListTemp tempArray.forEach(e => { this.subUserListAll.forEach(j => { - if (!e.includes(j.idNumber)) { + if (e.length > 0 && !e.includes(j.idNumber)) { // this.subUserList.push(j) tempPersonList.push(JSON.parse(JSON.stringify(j))) // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) @@ -333,7 +333,7 @@ export default { // this.subUserListTemp tempArray.forEach(e => { this.subUserListAll.forEach(j => { - if (!e.includes(j.idNumber)) { + if (e.length > 0 && !e.includes(j.idNumber)) { // this.subUserList.push(j) tempPersonList.push(JSON.parse(JSON.stringify(j))) // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) @@ -361,30 +361,73 @@ export default { if (this.subUserListTemp.length == 0 && !this.isSearch) { if (this.personList.length > 0) { this.subUserListAll.forEach(e => { - if (this.personList[this.currentIndex].includes(e.idNumber)) { + if ( + this.personList[this.currentIndex].length > 0 && + this.personList[this.currentIndex].includes(e.idNumber) + ) { e.isChecked = true this.subUserListTemp.push(JSON.parse(JSON.stringify(e))) } }) let tempArray = this.personList.filter((e, index) => index != this.currentIndex) + let tempPersonList = [] if (tempArray.length > 0) { this.subUserList = [] // this.subUserListTemp + tempArray.forEach(e => { - if (e.length > 1) { - this.subUserListAll.forEach(j => { - if (!e.includes(j.idNumber)) { - // this.subUserList.push(j) - this.subUserList.push(JSON.parse(JSON.stringify(j))) - // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) - } - }) - } + this.subUserListAll.forEach(j => { + if (e.length > 0 && e.includes(j.idNumber)) { + // this.subUserList.push(j) + tempPersonList.push(JSON.parse(JSON.stringify(j))) + // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) + } + }) }) - if (this.subUserList.length == 0) { + if (tempPersonList.length === 0) { this.subUserList = JSON.parse(JSON.stringify(this.subUserListAll)) + } else { + console.log('进入这里面') + let tempPersonStr = '' + + tempPersonList.forEach(e => { + tempPersonStr = tempPersonStr + '@' + e.idNumber + }) + + this.subUserListAll.forEach(e => { + console.log(tempPersonStr, '---') + if (!tempPersonStr.includes(e.idNumber)) { + this.subUserList.push(e) + } + }) + + // this.subUserListAll.forEach(e => { + // console.log('进入一个神奇的循环') + // tempPersonList.forEach(j => { + // console.log('进入一个神奇的循环99999', j) + // if (!j.idNumber.includes(e.idNumber)) { + // this.subUserList.push(e) + // } + // }) + // }) } + + // tempArray.forEach(e => { + // if (e.length > 0) { + // this.subUserListAll.forEach(j => { + // if (!e.includes(j.idNumber)) { + // // this.subUserList.push(j) + // this.subUserList.push(JSON.parse(JSON.stringify(j))) + // // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) + // } + // }) + // } + // }) + + // if (this.subUserList.length == 0) { + // this.subUserList = JSON.parse(JSON.stringify(this.subUserListAll)) + // } } else { this.subUserList = JSON.parse(JSON.stringify(this.subUserListAll)) // this.subUserListTemp = JSON.parse(JSON.stringify(this.subUserListAll)) @@ -400,7 +443,7 @@ export default { // this.subUserListTemp tempArray.forEach(e => { this.subUserListAll.forEach(j => { - if (!e.includes(j.idNumber)) { + if (e.length > 0 && !e.includes(j.idNumber)) { // this.subUserList.push(j) tempPersonList.push(JSON.parse(JSON.stringify(j))) // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) @@ -442,7 +485,7 @@ export default { // this.subUserListTemp tempArray.forEach(e => { this.subUserListAll.forEach(j => { - if (!e.includes(j.idNumber)) { + if (e.length > 0 && !e.includes(j.idNumber)) { // this.subUserList.push(j) tempPersonList.push(JSON.parse(JSON.stringify(j))) // this.subUserListTemp.push(JSON.parse(JSON.stringify(j))) @@ -604,8 +647,12 @@ export default { // 全选 onCheckBoxChangeAll(isAllChecked) { console.log(isAllChecked, 'isAllChecked') + this.subUserListTemp = [] this.subUserList.forEach(e => { e.isChecked = !isAllChecked + if (e.isChecked) { + this.subUserListTemp.push(e) + } // this.subUserListAll.forEach(j => { // if (e.idNumber == j.idNumber) { @@ -614,11 +661,11 @@ export default { // }) }) - if (this.subUserList.every(e => e.isChecked == true)) { - this.subUserListTemp = JSON.parse(JSON.stringify(this.subUserList)) - } else { - this.subUserListTemp = [] - } + // if (this.subUserList.every(e => e.isChecked == true)) { + // this.subUserListTemp = JSON.parse(JSON.stringify(this.subUserList)) + // } else { + // this.subUserListTemp = [] + // } // this.subUserListTemp.forEach(e => { // e.isChecked = !e.isChecked @@ -650,12 +697,12 @@ export default { // }) // } - if (this.subUserList.length > 0) return this.subUserList.filter(e => e.isChecked == true).length + return this.subUserList.filter(e => e.isChecked === true).length // return amount }, isAllChecked() { let isCheckedAll = false - if (this.subUserList.length > 0) return this.subUserList.every(e => e.isChecked === true) + return this.subUserList.every(e => e.isChecked === true) // if (this.subUserList.length > 0) { // isCheckedAll = this.subUserList.every(e => e.isChecked === true)