import { defineComponent, onMounted, reactive, ref } from 'vue'; import styles from '../index.module.less'; import { NButton, NDataTable, NForm, NFormItem, NInput, NInputNumber, NModal, NSpace, NTag } from 'naive-ui'; // import { useECharts } from '@/hooks/web/useECharts'; import Pagination from '/src/components/pagination'; import { getPracticeRecordList } from '../api'; import { getNowDateAndMonday, getNowDateAndSunday, getTimes } from '/src/utils/dateFormat'; import { vaildMusicScoreUrl } from '@/utils/urlUtils'; import CDatePicker from '/src/components/CDatePicker'; import { useUserStore } from '/src/store/modules/users'; import TheEmpty from '/src/components/TheEmpty'; import { initCache, setCache } from '/src/hooks/use-async'; import { iframeDislableKeyboard } from '/src/utils'; import { modalClickMask } from '/src/state'; // import SearchInput from '/src/components/searchInput'; import CSelect from '/src/components/CSelect'; import { evaluateDifficultArray } from '/src/utils/searchArray'; export default defineComponent({ name: 'student-practiceData', props: { studentId: { type: String, default: '' }, classGroupId: { type: String, default: '' } }, setup(props) { const userStore = useUserStore(); const chartRef = ref(null); // const { setOptions } = useECharts(chartRef as Ref); // const practiceFlag = ref(true); const payForm = reactive({ height: '360px', width: '100%', practiceDurationAvg: 0, practiceDays: 0, practiceDurationTotal: 0, dateList: [], timeList: [], detailVisiable: false }); const reportSrc = ref(''); const state = reactive({ loading: false, pagination: { page: 1, rows: 10, pageTotal: 4 }, searchForm: { musicSheetName: '', heardLevel: null, // userMusicFlag: null, // 是否生成作品 minScore: null, maxScore: null, musicStartTime: [] }, tableList: [] as any, goCourseVisiable: false }); const timer = ref<[number, number]>([ getNowDateAndMonday(new Date().getTime()), getNowDateAndSunday(new Date().getTime()) ]); const columns = () => { return [ { title: '时间', key: 'createTime' }, { title: '评测曲目', key: 'musicSheetName', render(row: any) { return {row.musicSheetName}; } }, // 入门:BEGINNER/进阶:ADVANCED/大师:PERFORMER" { title: '评测难度', key: 'heardLevel', render(row: any) { return ( <> {row.heardLevel == null ? -- : null} {row.heardLevel == 'BEGINNER' ? ( 入门级 ) : null} {row.heardLevel == 'ADVANCED' ? ( 进阶级 ) : null} {row.heardLevel == 'PERFORMER' ? ( 大师级 ) : null} ); } }, { title: '评测分数', key: 'score', render(row: any) { return {row.score}; } }, { title: '音准', key: 'intonation', render(row: any) { return {row.intonation}; } }, { title: '节奏', key: 'cadence', render(row: any) { return {row.cadence}; } }, { title: '完整度', key: 'integrity', render(row: any) { return {row.integrity}; } }, { title: '生成作品', key: 'integrity', render(row: any) { return {row.userMusicFlag ? '是' : '否'}; } }, { title: '生成时间', key: 'userMusicTime', render(row: any) { return {row.userMusicTime || '--'}; } }, { title: '操作', key: 'id', render(row: any) { return ( { gotoRecode(row); }}> 评测报告 ); } } ]; }; const getList = async () => { const { musicStartTime, ...temp } = state.searchForm; const res = await getPracticeRecordList({ userId: props.studentId, ...state.pagination, ...temp, ...getTimes( musicStartTime, ['userMusicStartTime', 'userMusicEndTime'], 'YYYY-MM-DD' ), classGroupId: props.classGroupId, feature: 'EVALUATION', ...getTimes(timer.value, ['startTime', 'endTime'], 'YYYY-MM-DD') }); state.tableList = res.data.rows; state.pagination.pageTotal = res.data.total; }; const gotoRecode = (row: any) => { const token = userStore.getToken; reportSrc.value = vaildMusicScoreUrl() + `/instrument/?v=${+new Date()}#/evaluat-report?v=${+new Date()}&id=${ row.id }&platform=webTeacher&Authorization=${token}`; payForm.detailVisiable = true; }; const search = () => { state.pagination.page = 1; getList(); setCache({ current: { timer: timer.value }, saveKey: 'classStudentRecordEvaluationRecords' }); }; const onReset = () => { timer.value = [ getNowDateAndMonday(new Date().getTime()), getNowDateAndSunday(new Date().getTime()) ]; state.searchForm = { musicSheetName: '', heardLevel: null, // userMusicFlag: null, // 是否生成作品 minScore: null, maxScore: null, musicStartTime: [] }; search(); setCache({ current: { timer: timer.value }, saveKey: 'classStudentRecordEvaluationRecords' }); }; initCache({ current: { timer: timer.value }, saveKey: 'classStudentRecordEvaluationRecords', callBack: (active: any) => { timer.value = active.timer; } }); const iframeRef = ref(); onMounted(() => { getList(); }); return () => ( <> {/* v-model:value={state.searchForm.keyword} */} {/* // (state.searchForm.keyword = val) // } > */}
-
搜索 重置
}} class={styles.classTable} loading={state.loading} columns={columns()} data={state.tableList}>
); } });