|
@@ -8,6 +8,7 @@ import {
|
|
|
NScrollbar,
|
|
|
NSelect,
|
|
|
NSpace,
|
|
|
+ NSpin,
|
|
|
useDialog,
|
|
|
useMessage
|
|
|
} from 'naive-ui';
|
|
@@ -16,34 +17,46 @@ import AddTeaching, {
|
|
|
} from '/src/views/natural-resources/model/add-teaching';
|
|
|
import { lessonCoursewarePage, lessonCoursewareRemove } from '../../../api';
|
|
|
import iconUploadBg from '../images/icon-upload-bg.svg';
|
|
|
+import { useCatchStore } from '/src/store/modules/catchData';
|
|
|
+import { useThrottleFn } from '@vueuse/core';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'select-lessonware',
|
|
|
emits: ['close', 'confirm'],
|
|
|
setup(props, { emit }) {
|
|
|
+ const catchStore = useCatchStore();
|
|
|
const dialog = useDialog();
|
|
|
const message = useMessage();
|
|
|
const forms = reactive({
|
|
|
- currentGradeNum: null,
|
|
|
- bookType: null,
|
|
|
+ loading: false,
|
|
|
list: [] as any[],
|
|
|
teachingStatus: false,
|
|
|
- selectItem: {} as any
|
|
|
+ selectItem: {} as any,
|
|
|
+ bookVersionId: null,
|
|
|
+ keyword: null,
|
|
|
+ currentGradeNum: null,
|
|
|
+ bookType: null
|
|
|
});
|
|
|
|
|
|
const getLessonCourseware = async () => {
|
|
|
+ forms.loading = true;
|
|
|
try {
|
|
|
const { data } = await lessonCoursewarePage({
|
|
|
page: 1,
|
|
|
rows: 99,
|
|
|
type: 'COURSEWARE',
|
|
|
- enableFlag: 1
|
|
|
+ enableFlag: 1,
|
|
|
+ bookVersionId: forms.bookVersionId,
|
|
|
+ keyword: forms.keyword,
|
|
|
+ currentGradeNum: forms.currentGradeNum,
|
|
|
+ bookType: forms.bookType
|
|
|
});
|
|
|
|
|
|
forms.list = data.rows;
|
|
|
} catch {
|
|
|
//
|
|
|
}
|
|
|
+ forms.loading = false;
|
|
|
};
|
|
|
|
|
|
// 删除教材
|
|
@@ -64,35 +77,47 @@ export default defineComponent({
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ const throttledFn = useThrottleFn(() => getLessonCourseware(), 500);
|
|
|
+
|
|
|
const onDetail = (item: any) => {
|
|
|
emit('confirm', item);
|
|
|
emit('close');
|
|
|
};
|
|
|
|
|
|
- onMounted(() => {
|
|
|
+ onMounted(async () => {
|
|
|
+ // 获取教材分类列表
|
|
|
+ await catchStore.getMusicSheetCategory();
|
|
|
getLessonCourseware();
|
|
|
});
|
|
|
return () => (
|
|
|
<div class={styles.selectLessonware}>
|
|
|
<div class={styles.attendClassSearch}>
|
|
|
- <NInput placeholder="请输入班级名称" clearable>
|
|
|
+ <NInput
|
|
|
+ placeholder="请输入班级名称"
|
|
|
+ clearable
|
|
|
+ v-model:value={forms.keyword}
|
|
|
+ onKeyup={(e: KeyboardEvent) => {
|
|
|
+ if (e.code === 'Enter') {
|
|
|
+ throttledFn();
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ onClear={() => throttledFn()}>
|
|
|
{{
|
|
|
- prefix: () => <span class="icon-search-input"></span>
|
|
|
+ prefix: () => (
|
|
|
+ <span
|
|
|
+ class="icon-search-input"
|
|
|
+ onClick={() => throttledFn()}></span>
|
|
|
+ )
|
|
|
}}
|
|
|
</NInput>
|
|
|
<NSelect
|
|
|
placeholder="版本"
|
|
|
clearable
|
|
|
- options={[
|
|
|
- {
|
|
|
- label: '一年级',
|
|
|
- value: '1'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '二年级',
|
|
|
- value: '2'
|
|
|
- }
|
|
|
- ]}
|
|
|
+ options={catchStore.getMusicCategories}
|
|
|
+ labelField="name"
|
|
|
+ valueField="id"
|
|
|
+ v-model:value={forms.bookVersionId}
|
|
|
+ onUpdate:value={() => throttledFn()}
|
|
|
/>
|
|
|
<NSelect
|
|
|
placeholder="请选择年级"
|
|
@@ -100,16 +125,18 @@ export default defineComponent({
|
|
|
v-model:value={forms.currentGradeNum}
|
|
|
clearable
|
|
|
filterable
|
|
|
+ onUpdate:value={() => throttledFn()}
|
|
|
/>
|
|
|
<NSelect
|
|
|
placeholder="请选择册别"
|
|
|
options={BOOK_DATA.bookTypes}
|
|
|
v-model:value={forms.bookType}
|
|
|
clearable
|
|
|
+ onUpdate:value={() => throttledFn()}
|
|
|
/>
|
|
|
</div>
|
|
|
<NScrollbar class={styles.classList}>
|
|
|
- <div class={styles.content}>
|
|
|
+ <NSpin show={forms.loading} class={styles.content}>
|
|
|
<NSpace size={[50, 40]}>
|
|
|
<div
|
|
|
class={styles.item}
|
|
@@ -188,7 +215,7 @@ export default defineComponent({
|
|
|
);
|
|
|
})}
|
|
|
</NSpace>
|
|
|
- </div>
|
|
|
+ </NSpin>
|
|
|
</NScrollbar>
|
|
|
|
|
|
{/* 添加自定义教材 */}
|