|
@@ -3,6 +3,7 @@ import styles from './index.module.less';
|
|
|
import { NButton, NSpace, useMessage } from 'naive-ui';
|
|
|
import { useCatchStore } from '/src/store/modules/catchData';
|
|
|
import iconSelect from '../../images/icon-select.png';
|
|
|
+import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'subject-sync',
|
|
@@ -15,8 +16,10 @@ export default defineComponent({
|
|
|
emits: ['close', 'confirm'],
|
|
|
setup(props, { emit }) {
|
|
|
const catchStore = useCatchStore();
|
|
|
+ const prepareStore = usePrepareStore();
|
|
|
const message = useMessage();
|
|
|
const selectSubjectIds = ref([] as any);
|
|
|
+ const subjectList = ref([] as any);
|
|
|
|
|
|
const onSubmit = () => {
|
|
|
if (selectSubjectIds.value.length <= 0) {
|
|
@@ -30,6 +33,20 @@ export default defineComponent({
|
|
|
// 获取教材分类列表
|
|
|
await catchStore.getSubjects();
|
|
|
|
|
|
+ const baseAllSubjectList = catchStore.getSubjectList;
|
|
|
+ const teachingSubjectList = prepareStore.getSubjectList; // 教材自带声部;
|
|
|
+ const tempSubjectList: any = [];
|
|
|
+ baseAllSubjectList.forEach((subject: any) => {
|
|
|
+ const index = teachingSubjectList.findIndex(
|
|
|
+ (t: any) => t.id == subject.id
|
|
|
+ );
|
|
|
+ if (index != -1) {
|
|
|
+ tempSubjectList.push(subject);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ subjectList.value = tempSubjectList;
|
|
|
+
|
|
|
if (props.subjectId) {
|
|
|
selectSubjectIds.value = [Number(props.subjectId)];
|
|
|
}
|
|
@@ -42,7 +59,7 @@ export default defineComponent({
|
|
|
</div>
|
|
|
|
|
|
<div class={styles.subjectList}>
|
|
|
- {catchStore.getSubjectList.map((subject: any) => (
|
|
|
+ {subjectList.value.map((subject: any) => (
|
|
|
<div
|
|
|
class={[
|
|
|
styles.subjectItem,
|