index.tsx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import {NTabPane, NTabs} from 'naive-ui'
  2. import {defineComponent, reactive} from 'vue'
  3. import MusicList from './component/music-list'
  4. import {useRoute} from 'vue-router'
  5. import {getTabsCache, setTabsCaches} from '@/hooks/use-async'
  6. import MusicSheetCategoriesList from "@views/music-library/music-sheet/component/music-sheet-categories-list";
  7. export default defineComponent({
  8. name: 'music-sheet',
  9. setup() {
  10. const state = reactive({
  11. tabName: 'MusicList' as 'MusicList' | 'TagList' | 'CategroryList',
  12. searchId: null,
  13. musicCategoryId: null,
  14. })
  15. const route = useRoute()
  16. getTabsCache((val: any) => {
  17. if (val.form.tabName) {
  18. state.tabName = val.form.tabName
  19. }
  20. })
  21. const setTabName = (val: any) => {
  22. console.log('setTabName', val)
  23. state.tabName = val.tabName
  24. state.searchId = val.id
  25. }
  26. const setTabs = (val: any) => {
  27. setTabsCaches(val, 'tabName', route)
  28. }
  29. return () => {
  30. return (
  31. <div class="system-menu-container">
  32. <div class={['section-container']} style="padding-top: 0">
  33. <NTabs
  34. type="line"
  35. size="large"
  36. v-model:value={state.tabName}
  37. onUpdate:value={(val: any) => setTabs(val)}
  38. >
  39. <NTabPane name="MusicList" tab="曲目列表"
  40. //v-auth="musicSheet/page1602301588206350338"
  41. >
  42. <MusicList searchId={state.searchId} musicCategoryId ={state.musicCategoryId}/>
  43. </NTabPane>
  44. <NTabPane
  45. name="CategroryList"
  46. tab="曲目分类管理"
  47. //v-auth="/musicCategrory1607664813521346561"
  48. >
  49. <MusicSheetCategoriesList
  50. onSetTabName={setTabName}
  51. onJump={(param: any) => {
  52. state.tabName = param.tabName
  53. state.musicCategoryId = param.musicCategoryId
  54. }}
  55. />
  56. {/*<TagList />*/}
  57. </NTabPane>
  58. </NTabs>
  59. </div>
  60. </div>
  61. )
  62. }
  63. }
  64. })