import { Ref, defineComponent, onMounted, reactive, ref } from 'vue'; import styles from '../index.module.less'; import { NButton, NDataTable, NForm, NFormItem, NModal, NNumberAnimation, NSpace, NTag } from 'naive-ui'; import numeral from 'numeral'; 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 { vaildUrl } from '@/utils/urlUtils'; import CDatePicker from '/src/components/CDatePicker'; import { useUserStore } from '/src/store/modules/users'; 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 }, 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: 'id', render(row: any) { return ( { gotoRecode(row); }}> 评测报告 ); } } ]; }; const getList = async () => { const res = await getPracticeRecordList({ userId: props.studentId, ...state.pagination, classGroupId: props.classGroupId, feature: 'EVALUATION', ...getTimes(timer.value, ['startTime', 'endTime'], 'YYYY-MM-DD') }); state.tableList = res.data.rows; console.log(state.tableList, 'state.tableList '); state.pagination.pageTotal = res.data.total; }; const gotoRecode = (row: any) => { console.log(row.id, 'gotoRecode'); const tockn = userStore.getToken; reportSrc.value = vaildUrl() + `/instrument/#/evaluat-report?id=${row.id}&Authorization=${tockn}`; payForm.detailVisiable = true; }; const search = () => { getList(); }; const onReset = () => { timer.value = [ getNowDateAndMonday(new Date().getTime()), getNowDateAndSunday(new Date().getTime()) ]; search(); }; onMounted(() => { getList(); console.log(props.studentId); }); return () => ( <> 搜索 重置
}} class={styles.classTable} loading={state.loading} columns={columns()} data={state.tableList}>
); } });