Skip to content

Commit 221d21b

Browse files
committed
fix: bug fix
1 parent cfea626 commit 221d21b

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

frontend/src/views/system/member/index.vue

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { ref, onMounted, reactive } from 'vue'
2+
import { ref, onMounted, reactive, nextTick } from 'vue'
33
import {
44
uwsOption,
55
workspaceUserList,
@@ -24,7 +24,7 @@ const workspaceForm = reactive({
2424
name: '',
2525
id: '',
2626
})
27-
const selectable = (row: any) => ![userStore.getUid].includes(row.id)
27+
const selectable = (row: any) => ![userStore.getUid].includes(row.id) && row.weight !== 1
2828
2929
onMounted(() => {
3030
search()
@@ -90,35 +90,42 @@ const deleteHandler = (row: any) => {
9090
})
9191
}
9292
const handleSelectionChange = (val: any[]) => {
93-
const ids = fieldList.value.map((ele: any) => ele.id)
93+
if (toggleRowLoading.value) return
94+
const arr = fieldList.value.filter(selectable)
95+
const ids = arr.map((ele: any) => ele.id)
9496
multipleSelectionAll.value = [
9597
...multipleSelectionAll.value.filter((ele) => !ids.includes(ele.id)),
9698
...val,
9799
]
98-
isIndeterminate.value = !(val.length === 0 || val.length === fieldList.value.length)
99-
checkAll.value = val.length === fieldList.value.length
100+
isIndeterminate.value = !(val.length === 0 || val.length === arr.length)
101+
checkAll.value = val.length === arr.length
100102
}
101103
const handleCheckAllChange = (val: any) => {
102104
isIndeterminate.value = false
103-
handleSelectionChange(val ? fieldList.value : [])
105+
handleSelectionChange(val ? fieldList.value.filter(selectable) : [])
104106
if (val) {
105107
handleToggleRowSelection()
106108
} else {
107109
multipleTableRef.value.clearSelection()
108110
}
109111
}
110112
113+
const toggleRowLoading = ref(false)
114+
111115
const handleToggleRowSelection = (check: boolean = true) => {
116+
toggleRowLoading.value = true
117+
const arr = fieldList.value.filter(selectable)
112118
let i = 0
113119
const ids = multipleSelectionAll.value.map((ele: any) => ele.id)
114-
for (const key in fieldList.value) {
115-
if (ids.includes((fieldList.value[key] as any).id)) {
120+
for (const key in arr) {
121+
if (ids.includes((arr[key] as any).id)) {
116122
i += 1
117-
multipleTableRef.value.toggleRowSelection(fieldList.value[key], check)
123+
multipleTableRef.value.toggleRowSelection(arr[key], check)
118124
}
119125
}
120-
checkAll.value = i === fieldList.value.length
121-
isIndeterminate.value = !(i === 0 || i === fieldList.value.length)
126+
toggleRowLoading.value = false
127+
checkAll.value = i === arr.length
128+
isIndeterminate.value = !(i === 0 || i === arr.length)
122129
}
123130
124131
const search = () => {
@@ -127,8 +134,12 @@ const search = () => {
127134
pageInfo.currentPage,
128135
pageInfo.pageSize
129136
).then((res) => {
137+
toggleRowLoading.value = true
130138
fieldList.value = res.items
131139
pageInfo.total = res.total
140+
nextTick(() => {
141+
handleToggleRowSelection()
142+
})
132143
})
133144
}
134145
@@ -220,11 +231,10 @@ const handleCurrentChange = (val: number) => {
220231
<el-table
221232
ref="multipleTableRef"
222233
:data="fieldList"
223-
:selectable="selectable"
224234
style="width: 100%"
225235
@selection-change="handleSelectionChange"
226236
>
227-
<el-table-column type="selection" width="55" />
237+
<el-table-column :selectable="selectable" type="selection" width="55" />
228238
<el-table-column prop="name" :label="$t('user.name')" width="160" />
229239
<el-table-column prop="account" :label="$t('user.account')" width="160" />
230240
<el-table-column prop="status" :label="$t('user.user_status')">
@@ -288,7 +298,7 @@ const handleCurrentChange = (val: number) => {
288298
</el-table>
289299
</div>
290300
</div>
291-
<div class="pagination-container">
301+
<div v-if="fieldList.length" class="pagination-container">
292302
<el-pagination
293303
v-model:current-page="pageInfo.currentPage"
294304
v-model:page-size="pageInfo.pageSize"

frontend/src/views/system/user/User.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
</template>
138138
</el-table>
139139
</div>
140-
<div class="pagination-container">
140+
<div v-if="state.tableData.length" class="pagination-container">
141141
<el-pagination
142142
v-model:current-page="state.pageInfo.currentPage"
143143
v-model:page-size="state.pageInfo.pageSize"

frontend/src/views/system/workspace/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ const handleCurrentChange = (val: number) => {
480480
</el-table>
481481
</div>
482482
</div>
483-
<div class="pagination-container">
483+
<div v-if="fieldListWithSearch.length" class="pagination-container">
484484
<el-pagination
485485
v-model:current-page="pageInfo.currentPage"
486486
v-model:page-size="pageInfo.pageSize"

0 commit comments

Comments
 (0)