069379e4 by chentao

no message

1 parent a10a140e
......@@ -43,6 +43,14 @@ export function displayCourse(id) {
})
}
// 批量显示
export function batchDisplayCourse(ids) {
return request({
url: `/core/course/batch/display/${ids}`,
method: 'put',
})
}
// 隐藏
export function hideCourse(id) {
return request({
......@@ -50,3 +58,11 @@ export function hideCourse(id) {
method: 'put',
})
}
// 批量隐藏
export function batchHideCourse(ids) {
return request({
url: `/core/course/batch/hide/${ids}`,
method: 'put',
})
}
......
......@@ -15,7 +15,7 @@
/>
</el-form-item>
<el-form-item label="">
<el-button type="success" icon="Edit" :disabled="multiple" @click="handleBatchDisplay">批量显示</el-button>
<el-button type="primary" icon="Plus" :disabled="multiple" @click="handleBatchDisplay">批量显示</el-button>
</el-form-item>
<el-form-item label="">
<el-button type="success" icon="Edit" :disabled="multiple" @click="handleBatchHide">批量隐藏</el-button>
......@@ -44,6 +44,7 @@
:header-cell-style="{textAlign:'center'}"
:cell-style="{textAlign:'center'}"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection"
width="50"
......@@ -62,7 +63,7 @@
></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('course.visibleName')" prop="isVisible" />
<el-table-column :label="$t('course.visibleName')" prop="display" />
<el-table-column :label="$t('course.tableControlsName')" class-name="small-padding fixed-width">
<template #default="{ row }">
<el-button
......@@ -79,13 +80,13 @@
link
type="text"
@click="handleDisplay(row)"
v-if="row.isVisible === 0"
v-if="!row.visible"
>{{ $t('course.controlsDisplayName') }}</el-button>
<el-button
link
type="text"
@click="handleHide(row)"
v-if="row.isVisible === 1"
v-if="row.visible"
>{{ $t('course.controlsHideName') }}</el-button>
</template>
</el-table-column>
......@@ -196,7 +197,7 @@
<script setup name="ruleManager">
import { useTableHeight } from '@/hooks/useTableHeight'
// 导入api接口
import { getCourseList, addCourse, editCourse, delCourse, displayCourse, hideCourse} from '@/api/legao/course'
import { getCourseList, addCourse, editCourse, delCourse, displayCourse, batchDisplayCourse, hideCourse, batchHideCourse } from '@/api/legao/course'
import { getEntiretyists } from '@/api/legao/kit'
import { reactive, toRefs } from 'vue';
const { windowSize } = useTableHeight('max-height')
......@@ -238,7 +239,9 @@ const data = reactive({
ossId: [{ required: true, message: "课程图片不能为空", trigger: "blur" }]
}
})
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const { status, queryParams, total, list, showForm, rules, entiretyLists } = toRefs(data)
......@@ -321,6 +324,13 @@ function handleDel(row) {
});
}
/** 选择条数 */
function handleSelectionChange (selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
function handleDisplay(row) {
proxy.$modal.confirm(`确认显示该课程吗?`).then(() => {
return displayCourse(row.id);
......@@ -332,6 +342,18 @@ function handleDisplay(row) {
});
}
function handleBatchDisplay(row) {
const courseIds = row.id || ids.value;
proxy.$modal.confirm(`确认显示这些课程吗?`).then(() => {
return batchDisplayCourse(courseIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess(res.msg);
}).finally(() => {
});
}
function handleHide(row) {
proxy.$modal.confirm(`确认隐藏该课程吗?隐藏后APP端将不可见。`).then(() => {
return hideCourse(row.id);
......@@ -343,6 +365,18 @@ function handleHide(row) {
});
}
function handleBatchHide(row) {
const courseIds = row.id || ids.value;
proxy.$modal.confirm(`确认隐藏这些课程吗?隐藏后APP端将不可见。`).then(() => {
return batchHideCourse(courseIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess(res.msg);
}).finally(() => {
});
}
function submitForm(type) {
const data = {
...showForm.value.form,
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!