|
@@ -1,6 +1,7 @@
|
|
import OHeader from '@/components/o-header'
|
|
import OHeader from '@/components/o-header'
|
|
import OSearch from '@/components/o-search'
|
|
import OSearch from '@/components/o-search'
|
|
import OSticky from '@/components/o-sticky'
|
|
import OSticky from '@/components/o-sticky'
|
|
|
|
+import OEmpty from '@/components/o-empty'
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
import {
|
|
import {
|
|
Cell,
|
|
Cell,
|
|
@@ -16,7 +17,8 @@ import {
|
|
showToast
|
|
showToast
|
|
} from 'vant'
|
|
} from 'vant'
|
|
import StudentItem from './modals/student-item'
|
|
import StudentItem from './modals/student-item'
|
|
-import { defineComponent, reactive, ref } from 'vue'
|
|
|
|
|
|
+import { defineComponent, reactive, ref, onMounted } from 'vue'
|
|
|
|
+import { state as globalState } from '@/state'
|
|
import { useRouter } from 'vue-router'
|
|
import { useRouter } from 'vue-router'
|
|
import styles from './index.module.less'
|
|
import styles from './index.module.less'
|
|
import request from '@/helpers/request'
|
|
import request from '@/helpers/request'
|
|
@@ -30,11 +32,8 @@ export default defineComponent({
|
|
showPopoverOrchestra: false,
|
|
showPopoverOrchestra: false,
|
|
showPopoverSubject: false,
|
|
showPopoverSubject: false,
|
|
showPopoverSort: false,
|
|
showPopoverSort: false,
|
|
- actions: [
|
|
|
|
- { text: '全部乐团', color: 'var(--van-primary-color)' },
|
|
|
|
- { text: '交付团' },
|
|
|
|
- { text: '晋升团' }
|
|
|
|
- ],
|
|
|
|
|
|
+ actions: [] as any,
|
|
|
|
+ subjects: [] as any,
|
|
actionSorts: [
|
|
actionSorts: [
|
|
{ text: '按天数', value: 'PRACTICE_DAY' },
|
|
{ text: '按天数', value: 'PRACTICE_DAY' },
|
|
{ text: '按时长', value: 'PRACTICE_TIMES' }
|
|
{ text: '按时长', value: 'PRACTICE_TIMES' }
|
|
@@ -45,9 +44,9 @@ export default defineComponent({
|
|
practiceMonth: state.currentDate[0] + '' + state.currentDate[1],
|
|
practiceMonth: state.currentDate[0] + '' + state.currentDate[1],
|
|
practiceMonthName: state.currentDate[0] + '年' + state.currentDate[1] + '月',
|
|
practiceMonthName: state.currentDate[0] + '年' + state.currentDate[1] + '月',
|
|
orchestraId: '',
|
|
orchestraId: '',
|
|
- orchestraName: '',
|
|
|
|
|
|
+ orchestraName: '全部乐团',
|
|
subjectId: '',
|
|
subjectId: '',
|
|
- subjectName: '',
|
|
|
|
|
|
+ subjectName: '全部声部',
|
|
sortType: '',
|
|
sortType: '',
|
|
sortTypeName: '',
|
|
sortTypeName: '',
|
|
page: 1,
|
|
page: 1,
|
|
@@ -61,32 +60,26 @@ export default defineComponent({
|
|
const finished = ref(false)
|
|
const finished = ref(false)
|
|
const showContact = ref(false)
|
|
const showContact = ref(false)
|
|
const list = ref([])
|
|
const list = ref([])
|
|
- const onDetail = (item: any) => {
|
|
|
|
- console.log(item)
|
|
|
|
- router.push({
|
|
|
|
- path: '/orchestra-detail',
|
|
|
|
- query: {
|
|
|
|
- id: item
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
loading.value = true
|
|
loading.value = true
|
|
try {
|
|
try {
|
|
- const res = await request.post('/api-school/student/page', {
|
|
|
|
- data: { ...forms }
|
|
|
|
- })
|
|
|
|
if (refreshing.value) {
|
|
if (refreshing.value) {
|
|
|
|
+ forms.page = 1
|
|
list.value = []
|
|
list.value = []
|
|
refreshing.value = false
|
|
refreshing.value = false
|
|
}
|
|
}
|
|
- if (list.value.length > 0 && res.data.pageNo === 1) {
|
|
|
|
|
|
+ const res = await request.post('/api-school/student/page', {
|
|
|
|
+ params: { ...forms }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ if (list.value.length > 0 && res.data.pages === 1) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
- showContact.value = list.value.length > 0
|
|
|
|
forms.page = res.data.current + 1
|
|
forms.page = res.data.current + 1
|
|
list.value = list.value.concat(res.data.rows || [])
|
|
list.value = list.value.concat(res.data.rows || [])
|
|
|
|
+ showContact.value = list.value.length > 0
|
|
|
|
+ console.log(showContact.value, ' showContact.value ')
|
|
loading.value = false
|
|
loading.value = false
|
|
|
|
|
|
finished.value = res.data.current >= res.data.pages
|
|
finished.value = res.data.current >= res.data.pages
|
|
@@ -98,22 +91,83 @@ export default defineComponent({
|
|
finished.value = true
|
|
finished.value = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ onMounted(() => {
|
|
|
|
+ getList()
|
|
|
|
+ getOrchestraList()
|
|
|
|
+ getSubjects()
|
|
|
|
+ })
|
|
|
|
+
|
|
const onBack = () => {
|
|
const onBack = () => {
|
|
console.log('返回')
|
|
console.log('返回')
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const checkSort = (val: any) => {
|
|
|
|
+ forms.sortType = val.value
|
|
|
|
+ forms.sortTypeName = val.text
|
|
|
|
+ refreshing.value = true
|
|
|
|
+ getList()
|
|
|
|
+ }
|
|
const checkTimer = (val: any) => {
|
|
const checkTimer = (val: any) => {
|
|
forms.practiceMonth = val.selectedValues[0] + val.selectedValues[1]
|
|
forms.practiceMonth = val.selectedValues[0] + val.selectedValues[1]
|
|
forms.practiceMonthName = val.selectedValues[0] + '年' + val.selectedValues[1] + '月'
|
|
forms.practiceMonthName = val.selectedValues[0] + '年' + val.selectedValues[1] + '月'
|
|
state.showPopoverTime = false
|
|
state.showPopoverTime = false
|
|
getList()
|
|
getList()
|
|
}
|
|
}
|
|
- const checkSort = (val: any) => {
|
|
|
|
- forms.sortType = val.value
|
|
|
|
- forms.sortTypeName = val.text
|
|
|
|
|
|
+ const checkOrchestra = (val: any) => {
|
|
|
|
+ forms.orchestraId = val.value
|
|
|
|
+ forms.orchestraName = val.name
|
|
|
|
+ state.showPopoverOrchestra = false
|
|
|
|
+ refreshing.value = true
|
|
getList()
|
|
getList()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const checkSubject = (val: any) => {
|
|
|
|
+ forms.subjectId = val.value
|
|
|
|
+ forms.subjectName = val.name
|
|
|
|
+ console.log(val, forms)
|
|
|
|
+ refreshing.value = true
|
|
|
|
+ getList()
|
|
|
|
+ }
|
|
|
|
+ const getOrchestraList = async () => {
|
|
|
|
+ const schoolId = globalState.user.data.schoolInfos
|
|
|
|
+ .map((item) => {
|
|
|
|
+ return item.id
|
|
|
|
+ })
|
|
|
|
+ .join(',')
|
|
|
|
+ try {
|
|
|
|
+ const res = await request.post('/api-school/orchestra/page', {
|
|
|
|
+ params: { page: 1, rows: 9999, schoolId }
|
|
|
|
+ })
|
|
|
|
+ state.actions = res.data.rows.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ name: item.name,
|
|
|
|
+ value: item.id as string
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ state.actions.unshift({ name: '全部乐团', value: '' })
|
|
|
|
+ } catch (e: any) {
|
|
|
|
+ const message = e.message
|
|
|
|
+ showToast(message)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const getSubjects = async () => {
|
|
|
|
+ try {
|
|
|
|
+ const res = await request.post('/api-school/subject/page', {
|
|
|
|
+ params: { page: 1, rows: 9999 }
|
|
|
|
+ })
|
|
|
|
+ state.subjects = res.data.rows.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ name: item.name,
|
|
|
|
+ value: item.id as string
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ state.subjects.unshift({ name: '全部声部', value: '' })
|
|
|
|
+ } catch (e: any) {
|
|
|
|
+ const message = e.message
|
|
|
|
+ showToast(message)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
const onRefresh = () => {
|
|
const onRefresh = () => {
|
|
finished.value = false
|
|
finished.value = false
|
|
// 重新加载数据
|
|
// 重新加载数据
|
|
@@ -121,11 +175,18 @@ export default defineComponent({
|
|
loading.value = true
|
|
loading.value = true
|
|
getList()
|
|
getList()
|
|
}
|
|
}
|
|
|
|
+
|
|
return () => (
|
|
return () => (
|
|
<>
|
|
<>
|
|
<OSticky position="top" background="#F8F8F8">
|
|
<OSticky position="top" background="#F8F8F8">
|
|
<OHeader isBack={true} onHeaderBack={onBack}></OHeader>
|
|
<OHeader isBack={true} onHeaderBack={onBack}></OHeader>
|
|
- <OSearch placeholder="学生编号" onSearch={getList}></OSearch>
|
|
|
|
|
|
+ <OSearch
|
|
|
|
+ placeholder="学生编号"
|
|
|
|
+ onSearch={() => {
|
|
|
|
+ refreshing.value = true
|
|
|
|
+ getList()
|
|
|
|
+ }}
|
|
|
|
+ ></OSearch>
|
|
<div class={styles.chioseWrap}>
|
|
<div class={styles.chioseWrap}>
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
<div
|
|
<div
|
|
@@ -140,40 +201,26 @@ export default defineComponent({
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
- <Popover
|
|
|
|
- v-model:show={state.showPopoverSubject}
|
|
|
|
- actions={state.actions}
|
|
|
|
- showArrow={false}
|
|
|
|
- placement="bottom-start"
|
|
|
|
- offset={[0, 12]}
|
|
|
|
- >
|
|
|
|
- {{
|
|
|
|
- reference: () => (
|
|
|
|
- <div class={styles.searchBand}>
|
|
|
|
- 全部乐团
|
|
|
|
- <Icon name={state.showPopoverSubject ? 'arrow-up' : 'arrow-down'} />
|
|
|
|
- </div>
|
|
|
|
- )
|
|
|
|
|
|
+ <div
|
|
|
|
+ class={styles.searchBand}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ state.showPopoverOrchestra = true
|
|
}}
|
|
}}
|
|
- </Popover>
|
|
|
|
|
|
+ >
|
|
|
|
+ {forms.orchestraName}
|
|
|
|
+ <Icon name={state.showPopoverOrchestra ? 'arrow-up' : 'arrow-down'} />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
- <Popover
|
|
|
|
- v-model:show={state.showPopoverSubject}
|
|
|
|
- actions={state.actions}
|
|
|
|
- showArrow={false}
|
|
|
|
- placement="bottom-start"
|
|
|
|
- offset={[0, 12]}
|
|
|
|
- >
|
|
|
|
- {{
|
|
|
|
- reference: () => (
|
|
|
|
- <div class={styles.searchBand}>
|
|
|
|
- 全部声部
|
|
|
|
- <Icon name={state.showPopoverSubject ? 'arrow-up' : 'arrow-down'} />
|
|
|
|
- </div>
|
|
|
|
- )
|
|
|
|
|
|
+ <div
|
|
|
|
+ class={styles.searchBand}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ state.showPopoverSubject = true
|
|
}}
|
|
}}
|
|
- </Popover>
|
|
|
|
|
|
+ >
|
|
|
|
+ {forms.subjectName}
|
|
|
|
+ <Icon name={state.showPopoverSubject ? 'arrow-up' : 'arrow-down'} />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
<div style={{ padding: '12px 13px', background: '#F8F8F8' }}>
|
|
@@ -197,18 +244,22 @@ export default defineComponent({
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</OSticky>
|
|
</OSticky>
|
|
- <PullRefresh v-model={refreshing.value} onRefresh={onRefresh}>
|
|
|
|
- <List
|
|
|
|
- v-model:loading={loading.value}
|
|
|
|
- finished={finished.value}
|
|
|
|
- finished-text="没有更多了"
|
|
|
|
- onLoad={getList}
|
|
|
|
- >
|
|
|
|
- {list.value.map((item: any) => (
|
|
|
|
- <StudentItem item={item} />
|
|
|
|
- ))}
|
|
|
|
- </List>
|
|
|
|
- </PullRefresh>
|
|
|
|
|
|
+ {showContact.value ? (
|
|
|
|
+ <PullRefresh v-model={refreshing.value} onRefresh={onRefresh}>
|
|
|
|
+ <List
|
|
|
|
+ v-model:loading={loading.value}
|
|
|
|
+ finished={finished.value}
|
|
|
|
+ finished-text="没有更多了"
|
|
|
|
+ onLoad={getList}
|
|
|
|
+ >
|
|
|
|
+ {list.value.map((item: any) => (
|
|
|
|
+ <StudentItem item={item} forms={forms} />
|
|
|
|
+ ))}
|
|
|
|
+ </List>
|
|
|
|
+ </PullRefresh>
|
|
|
|
+ ) : (
|
|
|
|
+ <OEmpty></OEmpty>
|
|
|
|
+ )}
|
|
|
|
|
|
<Popup v-model:show={state.showPopoverTime} position="bottom" style="{ height: '30%' }">
|
|
<Popup v-model:show={state.showPopoverTime} position="bottom" style="{ height: '30%' }">
|
|
<DatePicker
|
|
<DatePicker
|
|
@@ -223,6 +274,22 @@ export default defineComponent({
|
|
columnsType={columnsType.value}
|
|
columnsType={columnsType.value}
|
|
/>
|
|
/>
|
|
</Popup>
|
|
</Popup>
|
|
|
|
+
|
|
|
|
+ <ActionSheet
|
|
|
|
+ v-model:show={state.showPopoverOrchestra}
|
|
|
|
+ title="选择乐团"
|
|
|
|
+ actions={state.actions}
|
|
|
|
+ onSelect={checkOrchestra}
|
|
|
|
+ ></ActionSheet>
|
|
|
|
+
|
|
|
|
+ <ActionSheet
|
|
|
|
+ style={{ height: '40%' }}
|
|
|
|
+ close-on-click-action
|
|
|
|
+ v-model:show={state.showPopoverSubject}
|
|
|
|
+ title="选择声部"
|
|
|
|
+ actions={state.subjects}
|
|
|
|
+ onSelect={checkSubject}
|
|
|
|
+ ></ActionSheet>
|
|
</>
|
|
</>
|
|
)
|
|
)
|
|
}
|
|
}
|