Commit 5b362a60 by Tianqing Liu

feat: 批量操作功能,批量操作只有当前组的文字改变

1 parent afdb080b
......@@ -142,7 +142,7 @@
<!--批量操作-->
<div class="multiple-operation">
<el-button type="text" @click="handleMutipleOperation(person)">
{{mutipleOperationText}}
{{mutipleOperationText(person)}}
<i class="el-icon-arrow-right el-icon--right"></i>
</el-button>
<!--批量子操作-->
......@@ -609,19 +609,40 @@ export default {
const isMultipleOperation = ref(false)
const currentMultipleGroupId = ref('') // 当前批量操作的组id
const handleMutipleOperation = (person) => {
isMultipleOperation.value = !isMultipleOperation.value
if (!isMultipleOperation.value) {
selectedPersonList.value = []
currentMultipleGroupId.value = ''
if (currentMultipleGroupId.value === person.person_unid) {
// 在当前组操作,批量按钮
if (isMultipleOperation.value) {
// 已经是多选状态
isMultipleOperation.value = false
selectedPersonList.value = []
currentMultipleGroupId.value = ''
} else {
// 非多选状态
currentMultipleGroupId.value = person.person_unid
isMultipleOperation.value = true
}
} else {
// 在其它组操作,批量按钮。此时,必定是非多选状态
isMultipleOperation.value = true
currentMultipleGroupId.value = person.person_unid
selectedPersonList.value = []
}
}
const mutipleOperationText = computed(() => {
return isMultipleOperation.value ? '取消操作' : '批量操作'
})
const mutipleOperationText = (person) => {
if (isMultipleOperation.value && isCurrentGroup(person)) {
return '取消操作'
} else {
return '批量操作'
}
}
const isCurrentGroup = (data) => {
return currentMultipleGroupId.value === data.person_unid
}
const mutipleOperationDisabled = computed(() => {
return !(isMultipleOperation.value && selectedPersonList.value.length > 0)
return !(
isMultipleOperation.value
&& selectedPersonList.value.length > 0
)
})
const isSelectedPerson = (id) => {
return selectedPersonList.value.some(item => item.id === id)
......@@ -933,6 +954,7 @@ export default {
mutipleOperationDisabled,
deleteRealPersonRecord,
currentMultipleGroupId,
isCurrentGroup,
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!