Commit 5b362a60 by Tianqing Liu

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

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