|
@@ -0,0 +1,196 @@
|
|
|
+import { defineComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import styles from '../index.module.less';
|
|
|
+import {
|
|
|
+ NButton,
|
|
|
+ NDataTable,
|
|
|
+ NForm,
|
|
|
+ NFormItem,
|
|
|
+ NImage,
|
|
|
+ NSelect,
|
|
|
+ NSpace
|
|
|
+} from 'naive-ui';
|
|
|
+import SearchInput from '@/components/searchInput';
|
|
|
+import CSelect from '@/components/CSelect';
|
|
|
+import Pagination from '@/components/pagination';
|
|
|
+import { getStudentList } from '../api';
|
|
|
+import add from './images/add.png';
|
|
|
+import { useRoute } from 'vue-router';
|
|
|
+import CBreadcrumb from '/src/components/CBreadcrumb';
|
|
|
+export default defineComponent({
|
|
|
+ name: 'student-studentList',
|
|
|
+ setup(props, { emit }) {
|
|
|
+ const state = reactive({
|
|
|
+ searchForm: { keyword: '', status: null as any },
|
|
|
+ loading: false,
|
|
|
+ pagination: {
|
|
|
+ page: 1,
|
|
|
+ rows: 10,
|
|
|
+ pageTotal: 4
|
|
|
+ },
|
|
|
+ tableList: [] as any
|
|
|
+ });
|
|
|
+ const route = useRoute();
|
|
|
+ const routerList = ref([
|
|
|
+ { name: '班级管理', path: '/classList' },
|
|
|
+ { name: route.query.name, path: '/classDetail' },
|
|
|
+ { name: route.query.teacherName, path: '/afterWorkDetail' }
|
|
|
+ ] as any);
|
|
|
+
|
|
|
+ const search = () => {
|
|
|
+ state.pagination.page = 1;
|
|
|
+ getList();
|
|
|
+ console.log('search', state);
|
|
|
+ };
|
|
|
+
|
|
|
+ const onReset = () => {
|
|
|
+ state.searchForm = { keyword: '', status: null as any };
|
|
|
+ search();
|
|
|
+ };
|
|
|
+ const getList = async () => {
|
|
|
+ state.loading = true;
|
|
|
+ try {
|
|
|
+ const res = await getStudentList({
|
|
|
+ classGroupId: route.query.id,
|
|
|
+ ...state.searchForm,
|
|
|
+ ...state.pagination
|
|
|
+ });
|
|
|
+
|
|
|
+ state.tableList = res.data.rows;
|
|
|
+
|
|
|
+ state.pagination.pageTotal = res.data.total;
|
|
|
+ state.loading = false;
|
|
|
+ } catch (e) {
|
|
|
+ state.loading = false;
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ onMounted(() => {
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ const columns = () => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ title: '学生姓名',
|
|
|
+ key: 'nickname'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '手机号',
|
|
|
+ key: 'phone'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '性别',
|
|
|
+ key: 'sex',
|
|
|
+ render(row: any) {
|
|
|
+ return <>{row.sex == '0' ? '女' : '男'}</>;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // {
|
|
|
+ // title: '学生类型',
|
|
|
+ // key: 'studentType',
|
|
|
+ // render(row: any) {
|
|
|
+ // return <>{row.studentType == 'member' ? '会员' : '普通'}</>;
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ key: 'id',
|
|
|
+ render(row: any) {
|
|
|
+ return (
|
|
|
+ <NButton text type="primary">
|
|
|
+ 详情
|
|
|
+ </NButton>
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ };
|
|
|
+ return () => (
|
|
|
+ <div>
|
|
|
+ <CBreadcrumb list={routerList.value}></CBreadcrumb>
|
|
|
+ <div class={styles.listWrap}>
|
|
|
+ <div class={styles.teacherList}>{/* <div class={}> </div> */}</div>
|
|
|
+ <div class={styles.searchList}>
|
|
|
+ <NForm label-placement="left" inline>
|
|
|
+ <NFormItem>
|
|
|
+ <SearchInput
|
|
|
+ {...{ placeholder: '请输入学生姓名' }}
|
|
|
+ class={styles.searchInput}
|
|
|
+ searchWord={state.searchForm.keyword}
|
|
|
+ onChangeValue={(val: string) =>
|
|
|
+ (state.searchForm.keyword = val)
|
|
|
+ }></SearchInput>
|
|
|
+ </NFormItem>
|
|
|
+
|
|
|
+ <NFormItem>
|
|
|
+ <CSelect
|
|
|
+ {...({
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: '训练状态',
|
|
|
+ value: null
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '已结束',
|
|
|
+ value: 1
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '进行中',
|
|
|
+ value: 0
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ placeholder: '训练状态',
|
|
|
+ clearable: true,
|
|
|
+ inline: true
|
|
|
+ } as any)}
|
|
|
+ v-model:value={state.searchForm.status}></CSelect>
|
|
|
+ </NFormItem>
|
|
|
+
|
|
|
+ <NFormItem>
|
|
|
+ <NSpace justify="end">
|
|
|
+ <NButton type="primary" class="searchBtn" onClick={search}>
|
|
|
+ 搜索
|
|
|
+ </NButton>
|
|
|
+ <NButton
|
|
|
+ type="primary"
|
|
|
+ ghost
|
|
|
+ class="resetBtn"
|
|
|
+ onClick={onReset}>
|
|
|
+ 重置
|
|
|
+ </NButton>
|
|
|
+ </NSpace>
|
|
|
+ </NFormItem>
|
|
|
+ </NForm>
|
|
|
+ </div>
|
|
|
+ {/* <NButton
|
|
|
+ class={styles.addBtn}
|
|
|
+ type="primary"
|
|
|
+ v-slots={{
|
|
|
+ icon: () => (
|
|
|
+ <>
|
|
|
+ <NImage class={styles.addBtnIcon} src={add}></NImage>
|
|
|
+ </>
|
|
|
+ )
|
|
|
+ }}>
|
|
|
+ 新增学生
|
|
|
+ </NButton> */}
|
|
|
+ <div class={styles.tableWrap}>
|
|
|
+ <NDataTable
|
|
|
+ class={styles.classTable}
|
|
|
+ loading={state.loading}
|
|
|
+ columns={columns()}
|
|
|
+ data={state.tableList}></NDataTable>
|
|
|
+ <Pagination
|
|
|
+ v-model:page={state.pagination.page}
|
|
|
+ v-model:pageSize={state.pagination.rows}
|
|
|
+ v-model:pageTotal={state.pagination.pageTotal}
|
|
|
+ onList={getList}
|
|
|
+ sync
|
|
|
+ saveKey="orchestraRegistration-key"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+});
|