|
158 | 158 | </el-scrollbar> |
159 | 159 | </div> |
160 | 160 | </div> |
161 | | - </LayoutContainer> |
162 | | - |
163 | | - <div class="mul-operation border-t w-full flex align-center" v-if="isBatch === true"> |
164 | | - <el-button :disabled="multipleSelection.length === 0" @click="openGenerateDialog()"> |
165 | | - {{ $t('views.document.generateQuestion.title') }} |
166 | | - </el-button> |
167 | | - <el-button :disabled="multipleSelection.length === 0" @click="openSelectDocumentDialog()"> |
168 | | - {{ $t('views.document.setting.migration') }} |
169 | | - </el-button> |
| 161 | + <div class="mul-operation border-t w-full" v-if="isBatch === true"> |
| 162 | + <div class="flex align-center" style="max-width: 1000px; margin: auto; flex-grow: 1"> |
| 163 | + <el-checkbox |
| 164 | + v-model="checkAll" |
| 165 | + :indeterminate="isIndeterminate" |
| 166 | + @change="handleCheckAllChange" |
| 167 | + > |
| 168 | + {{ $t('common.allCheck') }} |
| 169 | + </el-checkbox> |
| 170 | + <el-button |
| 171 | + class="ml-16" |
| 172 | + :disabled="multipleSelection.length === 0" |
| 173 | + @click="openGenerateDialog()" |
| 174 | + > |
| 175 | + {{ $t('views.document.generateQuestion.title') }} |
| 176 | + </el-button> |
| 177 | + <el-button |
| 178 | + :disabled="multipleSelection.length === 0" |
| 179 | + @click="openSelectDocumentDialog()" |
| 180 | + > |
| 181 | + {{ $t('views.document.setting.migration') }} |
| 182 | + </el-button> |
170 | 183 |
|
171 | | - <el-button :disabled="multipleSelection.length === 0" @click="deleteMulParagraph"> |
172 | | - {{ $t('common.delete') }} |
173 | | - </el-button> |
174 | | - <span class="color-secondary ml-24 mr-16"> |
175 | | - {{ $t('common.selected') }} {{ multipleSelection.length }} |
176 | | - {{ $t('views.document.items') }} |
177 | | - </span> |
178 | | - <el-button |
179 | | - link |
180 | | - type="primary" |
181 | | - v-if="multipleSelection.length > 0" |
182 | | - @click="multipleSelection = []" |
183 | | - > |
184 | | - {{ $t('common.clear') }} |
185 | | - </el-button> |
186 | | - </div> |
| 184 | + <el-button :disabled="multipleSelection.length === 0" @click="deleteMulParagraph"> |
| 185 | + {{ $t('common.delete') }} |
| 186 | + </el-button> |
| 187 | + <span class="color-secondary ml-24 mr-16"> |
| 188 | + {{ $t('common.selected') }} {{ multipleSelection.length }} |
| 189 | + {{ $t('views.document.items') }} |
| 190 | + </span> |
| 191 | + <span class="color-secondary mr-16"> |
| 192 | + {{ $t('common.total') }} {{ paginationConfig.total }} |
| 193 | + {{ $t('views.document.items') }} |
| 194 | + </span> |
| 195 | + <el-button |
| 196 | + link |
| 197 | + type="primary" |
| 198 | + v-if="multipleSelection.length > 0" |
| 199 | + @click="multipleSelection = []" |
| 200 | + > |
| 201 | + {{ $t('common.clear') }} |
| 202 | + </el-button> |
| 203 | + </div> |
| 204 | + </div> |
| 205 | + </LayoutContainer> |
187 | 206 | </el-card> |
188 | 207 | <ParagraphDialog |
189 | 208 | ref="ParagraphDialogRef" |
|
203 | 222 | <script setup lang="ts"> |
204 | 223 | import { reactive, ref, onMounted, computed, watch } from 'vue' |
205 | 224 | import { useRoute } from 'vue-router' |
| 225 | +import type { CheckboxValueType } from 'element-plus' |
206 | 226 | import ParagraphDialog from './component/ParagraphDialog.vue' |
207 | 227 | import ParagraphCard from './component/ParagraphCard.vue' |
208 | 228 | import SelectDocumentDialog from './component/SelectDocumentDialog.vue' |
@@ -275,6 +295,17 @@ const handleClick = (e: MouseEvent, ele: any) => { |
275 | 295 | // 批量操作 |
276 | 296 | const isBatch = ref(false) |
277 | 297 | const multipleSelection = ref<any[]>([]) |
| 298 | +const checkAll = ref(false) |
| 299 | +const isIndeterminate = computed(() => { |
| 300 | + return ( |
| 301 | + multipleSelection.value.length > 0 && |
| 302 | + multipleSelection.value.length < paragraphDetail.value.length |
| 303 | + ) |
| 304 | +}) |
| 305 | +const handleCheckAllChange = (val: CheckboxValueType) => { |
| 306 | + multipleSelection.value = val ? paragraphDetail.value.map((v) => v.id) : [] |
| 307 | + checkAll.value = val as boolean |
| 308 | +} |
278 | 309 |
|
279 | 310 | function toggleSelect(id: number) { |
280 | 311 | const index = multipleSelection.value.indexOf(id) |
@@ -472,11 +503,6 @@ onMounted(() => { |
472 | 503 | box-sizing: border-box; |
473 | 504 | .mul-operation { |
474 | 505 | position: absolute; |
475 | | - bottom: 0; |
476 | | - left: 0; |
477 | | - padding: 16px 24px; |
478 | | - box-sizing: border-box; |
479 | | - background: #ffffff; |
480 | 506 | } |
481 | 507 | } |
482 | 508 | .paragraph-card { |
|
0 commit comments