no message
Showing
2 changed files
with
56 additions
and
6 deletions
| ... | @@ -43,6 +43,14 @@ export function displayCourse(id) { | ... | @@ -43,6 +43,14 @@ export function displayCourse(id) { |
| 43 | }) | 43 | }) |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | // 批量显示 | ||
| 47 | export function batchDisplayCourse(ids) { | ||
| 48 | return request({ | ||
| 49 | url: `/core/course/batch/display/${ids}`, | ||
| 50 | method: 'put', | ||
| 51 | }) | ||
| 52 | } | ||
| 53 | |||
| 46 | // 隐藏 | 54 | // 隐藏 |
| 47 | export function hideCourse(id) { | 55 | export function hideCourse(id) { |
| 48 | return request({ | 56 | return request({ |
| ... | @@ -50,3 +58,11 @@ export function hideCourse(id) { | ... | @@ -50,3 +58,11 @@ export function hideCourse(id) { |
| 50 | method: 'put', | 58 | method: 'put', |
| 51 | }) | 59 | }) |
| 52 | } | 60 | } |
| 61 | |||
| 62 | // 批量隐藏 | ||
| 63 | export function batchHideCourse(ids) { | ||
| 64 | return request({ | ||
| 65 | url: `/core/course/batch/hide/${ids}`, | ||
| 66 | method: 'put', | ||
| 67 | }) | ||
| 68 | } | ... | ... |
| ... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
| 15 | /> | 15 | /> |
| 16 | </el-form-item> | 16 | </el-form-item> |
| 17 | <el-form-item label=""> | 17 | <el-form-item label=""> |
| 18 | <el-button type="success" icon="Edit" :disabled="multiple" @click="handleBatchDisplay">批量显示</el-button> | 18 | <el-button type="primary" icon="Plus" :disabled="multiple" @click="handleBatchDisplay">批量显示</el-button> |
| 19 | </el-form-item> | 19 | </el-form-item> |
| 20 | <el-form-item label=""> | 20 | <el-form-item label=""> |
| 21 | <el-button type="success" icon="Edit" :disabled="multiple" @click="handleBatchHide">批量隐藏</el-button> | 21 | <el-button type="success" icon="Edit" :disabled="multiple" @click="handleBatchHide">批量隐藏</el-button> |
| ... | @@ -44,6 +44,7 @@ | ... | @@ -44,6 +44,7 @@ |
| 44 | :header-cell-style="{textAlign:'center'}" | 44 | :header-cell-style="{textAlign:'center'}" |
| 45 | :cell-style="{textAlign:'center'}" | 45 | :cell-style="{textAlign:'center'}" |
| 46 | border | 46 | border |
| 47 | @selection-change="handleSelectionChange" | ||
| 47 | > | 48 | > |
| 48 | <el-table-column type="selection" | 49 | <el-table-column type="selection" |
| 49 | width="50" | 50 | width="50" |
| ... | @@ -62,7 +63,7 @@ | ... | @@ -62,7 +63,7 @@ |
| 62 | ></dict-tag> | 63 | ></dict-tag> |
| 63 | </template> | 64 | </template> |
| 64 | </el-table-column> | 65 | </el-table-column> |
| 65 | <el-table-column :label="$t('course.visibleName')" prop="isVisible" /> | 66 | <el-table-column :label="$t('course.visibleName')" prop="display" /> |
| 66 | <el-table-column :label="$t('course.tableControlsName')" class-name="small-padding fixed-width"> | 67 | <el-table-column :label="$t('course.tableControlsName')" class-name="small-padding fixed-width"> |
| 67 | <template #default="{ row }"> | 68 | <template #default="{ row }"> |
| 68 | <el-button | 69 | <el-button |
| ... | @@ -79,13 +80,13 @@ | ... | @@ -79,13 +80,13 @@ |
| 79 | link | 80 | link |
| 80 | type="text" | 81 | type="text" |
| 81 | @click="handleDisplay(row)" | 82 | @click="handleDisplay(row)" |
| 82 | v-if="row.isVisible === 0" | 83 | v-if="!row.visible" |
| 83 | >{{ $t('course.controlsDisplayName') }}</el-button> | 84 | >{{ $t('course.controlsDisplayName') }}</el-button> |
| 84 | <el-button | 85 | <el-button |
| 85 | link | 86 | link |
| 86 | type="text" | 87 | type="text" |
| 87 | @click="handleHide(row)" | 88 | @click="handleHide(row)" |
| 88 | v-if="row.isVisible === 1" | 89 | v-if="row.visible" |
| 89 | >{{ $t('course.controlsHideName') }}</el-button> | 90 | >{{ $t('course.controlsHideName') }}</el-button> |
| 90 | </template> | 91 | </template> |
| 91 | </el-table-column> | 92 | </el-table-column> |
| ... | @@ -196,7 +197,7 @@ | ... | @@ -196,7 +197,7 @@ |
| 196 | <script setup name="ruleManager"> | 197 | <script setup name="ruleManager"> |
| 197 | import { useTableHeight } from '@/hooks/useTableHeight' | 198 | import { useTableHeight } from '@/hooks/useTableHeight' |
| 198 | // 导入api接口 | 199 | // 导入api接口 |
| 199 | import { getCourseList, addCourse, editCourse, delCourse, displayCourse, hideCourse} from '@/api/legao/course' | 200 | import { getCourseList, addCourse, editCourse, delCourse, displayCourse, batchDisplayCourse, hideCourse, batchHideCourse } from '@/api/legao/course' |
| 200 | import { getEntiretyists } from '@/api/legao/kit' | 201 | import { getEntiretyists } from '@/api/legao/kit' |
| 201 | import { reactive, toRefs } from 'vue'; | 202 | import { reactive, toRefs } from 'vue'; |
| 202 | const { windowSize } = useTableHeight('max-height') | 203 | const { windowSize } = useTableHeight('max-height') |
| ... | @@ -238,7 +239,9 @@ const data = reactive({ | ... | @@ -238,7 +239,9 @@ const data = reactive({ |
| 238 | ossId: [{ required: true, message: "课程图片不能为空", trigger: "blur" }] | 239 | ossId: [{ required: true, message: "课程图片不能为空", trigger: "blur" }] |
| 239 | } | 240 | } |
| 240 | }) | 241 | }) |
| 241 | 242 | const ids = ref([]); | |
| 243 | const single = ref(true); | ||
| 244 | const multiple = ref(true); | ||
| 242 | const { status, queryParams, total, list, showForm, rules, entiretyLists } = toRefs(data) | 245 | const { status, queryParams, total, list, showForm, rules, entiretyLists } = toRefs(data) |
| 243 | 246 | ||
| 244 | 247 | ||
| ... | @@ -321,6 +324,13 @@ function handleDel(row) { | ... | @@ -321,6 +324,13 @@ function handleDel(row) { |
| 321 | }); | 324 | }); |
| 322 | } | 325 | } |
| 323 | 326 | ||
| 327 | /** 选择条数 */ | ||
| 328 | function handleSelectionChange (selection) { | ||
| 329 | ids.value = selection.map(item => item.id); | ||
| 330 | single.value = selection.length != 1; | ||
| 331 | multiple.value = !selection.length; | ||
| 332 | } | ||
| 333 | |||
| 324 | function handleDisplay(row) { | 334 | function handleDisplay(row) { |
| 325 | proxy.$modal.confirm(`确认显示该课程吗?`).then(() => { | 335 | proxy.$modal.confirm(`确认显示该课程吗?`).then(() => { |
| 326 | return displayCourse(row.id); | 336 | return displayCourse(row.id); |
| ... | @@ -332,6 +342,18 @@ function handleDisplay(row) { | ... | @@ -332,6 +342,18 @@ function handleDisplay(row) { |
| 332 | }); | 342 | }); |
| 333 | } | 343 | } |
| 334 | 344 | ||
| 345 | function handleBatchDisplay(row) { | ||
| 346 | const courseIds = row.id || ids.value; | ||
| 347 | proxy.$modal.confirm(`确认显示这些课程吗?`).then(() => { | ||
| 348 | return batchDisplayCourse(courseIds); | ||
| 349 | }).then(() => { | ||
| 350 | getList(); | ||
| 351 | proxy.$modal.msgSuccess(res.msg); | ||
| 352 | }).finally(() => { | ||
| 353 | |||
| 354 | }); | ||
| 355 | } | ||
| 356 | |||
| 335 | function handleHide(row) { | 357 | function handleHide(row) { |
| 336 | proxy.$modal.confirm(`确认隐藏该课程吗?隐藏后APP端将不可见。`).then(() => { | 358 | proxy.$modal.confirm(`确认隐藏该课程吗?隐藏后APP端将不可见。`).then(() => { |
| 337 | return hideCourse(row.id); | 359 | return hideCourse(row.id); |
| ... | @@ -343,6 +365,18 @@ function handleHide(row) { | ... | @@ -343,6 +365,18 @@ function handleHide(row) { |
| 343 | }); | 365 | }); |
| 344 | } | 366 | } |
| 345 | 367 | ||
| 368 | function handleBatchHide(row) { | ||
| 369 | const courseIds = row.id || ids.value; | ||
| 370 | proxy.$modal.confirm(`确认隐藏这些课程吗?隐藏后APP端将不可见。`).then(() => { | ||
| 371 | return batchHideCourse(courseIds); | ||
| 372 | }).then(() => { | ||
| 373 | getList(); | ||
| 374 | proxy.$modal.msgSuccess(res.msg); | ||
| 375 | }).finally(() => { | ||
| 376 | |||
| 377 | }); | ||
| 378 | } | ||
| 379 | |||
| 346 | function submitForm(type) { | 380 | function submitForm(type) { |
| 347 | const data = { | 381 | const data = { |
| 348 | ...showForm.value.form, | 382 | ...showForm.value.form, | ... | ... |
-
Please register or sign in to post a comment