music-list.tsx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. import SaveForm from '@/components/save-form'
  2. import Pagination from '@/components/pagination'
  3. import {
  4. DataTableRowKey,
  5. NButton, NCascader,
  6. NDataTable, NDescriptions, NDescriptionsItem,
  7. NFormItem,
  8. NIcon,
  9. NImage,
  10. NInput,
  11. NModal,
  12. NSelect,
  13. NSpace,
  14. NTag,
  15. NTooltip,
  16. useDialog,
  17. useMessage
  18. } from 'naive-ui'
  19. import {defineComponent, onMounted, onUnmounted, reactive, ref, watch} from 'vue'
  20. import {
  21. musicSheetApplicationOwnerList,
  22. musicSheetPage,
  23. musicSheetRemove,
  24. musicSheetImg,
  25. musicSheetStatusList,
  26. musicTagPage, musicSheetCategoriesQueryTree
  27. } from '../../api'
  28. import MusicOperation from '../modal/music-operation'
  29. import {subjectPage} from '@/views/system-manage/api'
  30. import MusicPreView from '../modal/musicPreView'
  31. import UseProject from '@views/music-library/music-sheet/modal/use-project'
  32. import {getMapValueByKey} from '@/utils/filters'
  33. import {appKey, musicSheetSourceType, musicSheetType} from '@/utils/constant'
  34. import {getSelectDataFromObj} from '@/utils/objectUtil'
  35. import {sysApplicationPage} from '@views/menu-manage/api'
  36. import {getOwnerName} from '@views/music-library/musicUtil'
  37. import styles from './music-list.module.less'
  38. import MusicCreateImg from '../modal/music-create-img'
  39. import TheTooltip from "@components/TheTooltip";
  40. import { HelpCircleOutline } from '@vicons/ionicons5'
  41. export default defineComponent({
  42. name: 'music-list',
  43. props: ['searchId', 'musicCategoryId'],
  44. setup(props, {emit}) {
  45. const dialog = useDialog()
  46. const message = useMessage()
  47. const state = reactive({
  48. loading: false,
  49. pagination: {
  50. page: 1,
  51. rows: 10,
  52. pageTotal: 0
  53. },
  54. searchForm: {
  55. keyword: null,
  56. musicSheetType: null,
  57. subjectId: null, //声部ID
  58. sourceType: null, //来源类型/作者属性(PLATFORM: 平台; ORG: 机构; PERSON: 个人
  59. composer: null, //作曲人/音乐人
  60. userId: null, //所属人
  61. applicationId: null, //所属人项目ID
  62. useAppId: [] as any, //适用项目ID
  63. status: null, //曲目状态(0:停用,1:启用)
  64. appAuditFlag: null, //是否审核版本
  65. categoriesId: null, //是否审核版本
  66. musicCategoryId: null, //曲目分类
  67. dataCorrect: null // 数据修复
  68. },
  69. dataList: [] as any,
  70. subjectList: [] as any,
  71. tagList: [] as any,
  72. visiableMusic: false,
  73. musicOperation: 'add',
  74. musicData: {} as any,
  75. musicSheetCategories: [] as any,
  76. musicPreview: false,
  77. musicScore: null as any,
  78. showUseProject: false, // 适用项目
  79. useProjectData: [] as any, // 适用项目行数据
  80. showUseProjectId: null as any, // 适用项目行数据
  81. detailReadonly: false, // 新增、修改、详情是否可编辑
  82. userIdDisable: true, // 所属人
  83. userIdData: [] as any, // 所属人数据列表
  84. productOpen: false,
  85. productItem: {} as any
  86. })
  87. const columns = (): any => {
  88. return [
  89. {
  90. type: 'selection'
  91. },
  92. {
  93. title: '曲目名称',
  94. minWidth: '200px',
  95. key: 'id',
  96. render(row: any) {
  97. return (
  98. <NDescriptions labelPlacement="left" column={1}>
  99. <NDescriptionsItem label="名称">
  100. <TheTooltip content={row.name}/>
  101. </NDescriptionsItem>
  102. <NDescriptionsItem label="编号"><TheTooltip content={row.id}/></NDescriptionsItem>
  103. </NDescriptions>
  104. )
  105. }
  106. },
  107. {
  108. title: '封面图',
  109. key: 'titleImg',
  110. render(row: any): JSX.Element {
  111. return <NImage width={60} height={60} src={row.musicCover}/>
  112. }
  113. },
  114. {
  115. title: '曲目信息',
  116. minWidth: '200px',
  117. key: 'composer',
  118. render(row: any) {
  119. return (
  120. <NDescriptions labelPlacement="left" column={1}>
  121. <NDescriptionsItem label="音乐人">{row.composer}</NDescriptionsItem>
  122. <NDescriptionsItem label="多声轨渲染">{getMapValueByKey(row.musicSheetType, new Map(Object.entries(musicSheetType)))}</NDescriptionsItem>
  123. <NDescriptionsItem label="分类"><TheTooltip content={row.musicCategoryName}/></NDescriptionsItem>
  124. <NDescriptionsItem label="可用声部"><TheTooltip content={row.subjectNames}/></NDescriptionsItem>
  125. </NDescriptions>
  126. )
  127. }
  128. },
  129. {
  130. title: '作者属性',
  131. minWidth: '250px',
  132. key: 'sourceType',
  133. render(row: any) {
  134. return (
  135. <NDescriptions labelPlacement="left" column={1}>
  136. <NDescriptionsItem label="属性">{getMapValueByKey(row.sourceType, new Map(Object.entries(musicSheetSourceType)))}</NDescriptionsItem>
  137. <NDescriptionsItem label="所属人">{getOwnerName(row.musicSheetExtend, row.sourceType)}</NDescriptionsItem>
  138. </NDescriptions>
  139. )
  140. }
  141. },
  142. {
  143. title: '适用项目',
  144. key: 'projectName',
  145. render(row: any) {
  146. return (
  147. <NSpace>
  148. <NButton
  149. type="primary"
  150. size="small"
  151. text
  152. onClick={() => {
  153. state.showUseProject = true
  154. state.showUseProjectId = row.id
  155. }}
  156. >
  157. <TheTooltip content={row.musicSheetExtend && row.musicSheetExtend.useApplicationNames
  158. ? row.musicSheetExtend.useApplicationNames
  159. : ''}/>
  160. <NIcon size={15} style="padding-left: 9px">
  161. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
  162. <path d="M2 26h28v2H2z" fill="currentColor"></path>
  163. <path
  164. d="M25.4 9c.8-.8.8-2 0-2.8l-3.6-3.6c-.8-.8-2-.8-2.8 0l-15 15V24h6.4l15-15zm-5-5L24 7.6l-3 3L17.4 7l3-3zM6 22v-3.6l10-10l3.6 3.6l-10 10H6z"
  165. fill="currentColor"
  166. ></path>
  167. </svg>
  168. </NIcon>
  169. </NButton>
  170. </NSpace>
  171. )
  172. }
  173. },
  174. {
  175. title: '更新信息',
  176. minWidth: '250px',
  177. key: 'updateBy',
  178. render(row: any) {
  179. return (
  180. <NDescriptions labelPlacement="left" column={1}>
  181. <NDescriptionsItem label="更新人">{row.updateByName}</NDescriptionsItem>
  182. <NDescriptionsItem label="更新时间">{row.updateTime}</NDescriptionsItem>
  183. </NDescriptions>
  184. )
  185. }
  186. },
  187. {
  188. title: '审核版本',
  189. minWidth: '100px',
  190. key: 'appAuditFlag',
  191. render(row: any) {
  192. return <div>{row.appAuditFlag ? '是' : '否'}</div>
  193. }
  194. },
  195. {
  196. title: '状态',
  197. minWidth: '50px',
  198. key: 'status',
  199. render(row: any) {
  200. return (
  201. <NTag type={row.status ? 'primary' : 'default'}>{row.status ? '启用' : '停用'}</NTag>
  202. )
  203. }
  204. },
  205. {
  206. title: '操作',
  207. key: 'operation',
  208. fixed: 'right',
  209. width: '300px',
  210. render(row: any) {
  211. return (
  212. <NSpace>
  213. <NButton
  214. type="primary"
  215. size="small"
  216. text
  217. onClick={() => {
  218. state.musicPreview = true
  219. state.musicScore = row
  220. }}
  221. >
  222. 预览
  223. </NButton>
  224. <NButton
  225. type="primary"
  226. size="small"
  227. text
  228. v-auth="musicSheet/detail1751241103201271810"
  229. onClick={() => {
  230. state.visiableMusic = true
  231. state.musicOperation = 'preview'
  232. state.musicData = row
  233. state.detailReadonly = true
  234. }}
  235. >
  236. 查看
  237. </NButton>
  238. <NButton
  239. type="primary"
  240. size="small"
  241. text
  242. v-auth="musicSheet/save1751241178962984962"
  243. onClick={() => {
  244. state.visiableMusic = true
  245. state.musicOperation = 'edit'
  246. state.musicData = row
  247. state.detailReadonly = true
  248. }}
  249. >
  250. 修改
  251. </NButton>
  252. <NButton
  253. type="primary"
  254. size="small"
  255. text
  256. v-auth="musicSheet/statusList1751241653309407234"
  257. onClick={() => onChangeStatus(row)}
  258. >
  259. {row.status ? '停用' : '启用'}
  260. </NButton>
  261. <NButton
  262. type="primary"
  263. size="small"
  264. text
  265. v-auth="musicSheet/img1751240591299051522"
  266. onClick={() => {
  267. state.productOpen = true
  268. state.productItem = row
  269. // handleAutoProduct(row)
  270. }}
  271. >
  272. 生成图片
  273. </NButton>
  274. <NButton
  275. type="primary"
  276. size="small"
  277. text
  278. disabled={!!row.status}
  279. onClick={() => onRmove(row)}
  280. v-auth="musicSheet/save1751241178962984962"
  281. >
  282. 删除
  283. </NButton>
  284. </NSpace>
  285. )
  286. }
  287. }
  288. ]
  289. }
  290. const checkedRowKeysRef = ref<DataTableRowKey[]>([])
  291. const handleCheck = (rowKeys: DataTableRowKey[]) => {
  292. checkedRowKeysRef.value = rowKeys
  293. }
  294. const onChangeStatus = (row: any) => {
  295. const statusStr = row.status ? '停用' : '启用'
  296. dialog.warning({
  297. title: '提示',
  298. content: `是否${statusStr}?`,
  299. positiveText: '确定',
  300. negativeText: '取消',
  301. onPositiveClick: async () => {
  302. try {
  303. await musicSheetStatusList({
  304. ids: new Array(row.id),
  305. status: !row.status
  306. })
  307. getList()
  308. message.success(`${statusStr}成功`)
  309. } catch {}
  310. }
  311. })
  312. }
  313. const onBatchChangeStatus = (status: boolean) => {
  314. const length = checkedRowKeysRef.value.length
  315. if (length == 0) {
  316. message.warning('未选择数据')
  317. }
  318. const statusStr = !status ? '停用' : '启用'
  319. dialog.warning({
  320. title: '提示',
  321. content: `是否${statusStr}` + length + `条数据?`,
  322. positiveText: '确定',
  323. negativeText: '取消',
  324. onPositiveClick: async () => {
  325. try {
  326. await musicSheetStatusList({
  327. ids: checkedRowKeysRef.value,
  328. status: status
  329. })
  330. getList()
  331. message.success(`${statusStr}成功`)
  332. } catch {}
  333. }
  334. })
  335. }
  336. const updateUserIdData = async (sourceType: any) => {
  337. if (!state.searchForm.applicationId) {
  338. return
  339. }
  340. state.userIdData = []
  341. state.searchForm.userId = null
  342. if (sourceType && sourceType !== 'PLATFORM') {
  343. const { data } = await musicSheetApplicationOwnerList({
  344. page: 1,
  345. rows: 9999,
  346. sourceType: sourceType,
  347. applicationId: state.searchForm.applicationId
  348. })
  349. const temp = data.rows || []
  350. temp.forEach((next: any) => {
  351. state.userIdData.push({
  352. ...next,
  353. label: sourceType === 'PERSON' ? next.userName : next.organizationRole,
  354. value: sourceType === 'PERSON' ? next.userId : next.organizationRoleId
  355. })
  356. })
  357. }
  358. }
  359. const onRmove = (row: any): void => {
  360. dialog.warning({
  361. title: '提示',
  362. content: `删除"${row.name}",是否继续?`,
  363. positiveText: '确定',
  364. negativeText: '取消',
  365. onPositiveClick: async () => {
  366. try {
  367. await musicSheetRemove({ id: row.id })
  368. getList()
  369. message.success('删除成功')
  370. } catch {}
  371. }
  372. })
  373. }
  374. const getList = async () => {
  375. try {
  376. state.loading = true
  377. const sourceType = state.searchForm.sourceType;
  378. const userId = state.searchForm.userId
  379. let search = {
  380. ...state.searchForm,
  381. useAppId: state.searchForm.useAppId ? state.searchForm.useAppId.join(',') : state.searchForm.useAppId
  382. } as any
  383. if (sourceType) {
  384. if (sourceType == 'ORG') {
  385. search.organizationRoleId = userId
  386. search.userId = null
  387. }
  388. }
  389. const { data } = await musicSheetPage({ ...state.pagination, ...search})
  390. state.pagination.pageTotal = Number(data.total)
  391. state.dataList = data.rows || []
  392. } catch {}
  393. state.loading = false
  394. }
  395. // 获取标签
  396. const getTagList = async () => {
  397. try {
  398. const { data } = await musicTagPage({ page: 1, rows: 999 })
  399. const tempList = data.rows || []
  400. tempList.forEach((item: any) => {
  401. item.label = item.name
  402. item.value = item.id
  403. })
  404. state.tagList = tempList
  405. } catch {}
  406. }
  407. // 获取分类
  408. const getMusicSheetCategorieList = async () => {
  409. try {
  410. const { data } = await musicSheetCategoriesQueryTree({})
  411. // state.musicSheetCategories = filterPointCategory(data, 'musicSheetCategoriesList')
  412. state.musicSheetCategories = data || []
  413. } catch (e) {}
  414. }
  415. // 获取声部
  416. const initSubjectList = async () => {
  417. try {
  418. const { data } = await subjectPage({ page: 1, rows: 999 })
  419. const tempList = data.rows || []
  420. tempList.forEach((item: any) => {
  421. item.label = item.name
  422. item.value = item.id + ''
  423. })
  424. state.subjectList = tempList
  425. } catch {}
  426. }
  427. // app列表
  428. const initUseAppList = async () => {
  429. try {
  430. const appKeys = Object.keys(appKey)
  431. const { data } = await sysApplicationPage({ page: 1, rows: 999 })
  432. const tempList = data.rows || []
  433. state.useProjectData = []
  434. const filter = tempList.filter((next: any) => {
  435. return appKeys.includes(next.appKey)
  436. })
  437. filter.forEach((item: any) => {
  438. state.useProjectData.push({
  439. ...item,
  440. label: item.appName,
  441. value: item.id
  442. })
  443. })
  444. } catch {}
  445. }
  446. const saveForm = ref()
  447. const onSubmit = () => {
  448. state.pagination.page = 1
  449. getList()
  450. }
  451. watch(
  452. () => props.searchId,
  453. (val) => {
  454. console.log(val, 'searchId')
  455. }
  456. )
  457. const onSearch = () => {
  458. saveForm.value?.submit()
  459. }
  460. const onBtnReset = () => {
  461. saveForm.value?.reset()
  462. }
  463. onMounted(async () => {
  464. state.loading = true
  465. // getTagList()
  466. if (props.searchId) {
  467. state.searchForm.categoriesId = props.searchId || null
  468. }
  469. if (props.musicCategoryId) {
  470. state.searchForm.musicCategoryId = props.musicCategoryId || null
  471. }
  472. initSubjectList()
  473. initUseAppList()
  474. getMusicSheetCategorieList()
  475. getList()
  476. })
  477. return () => (
  478. <div class="system-menu-container">
  479. <SaveForm
  480. ref={saveForm}
  481. model={state.searchForm}
  482. onSubmit={onSubmit}
  483. saveKey="music-list"
  484. onSetModel={(val: any) => (state.searchForm = val)}
  485. >
  486. <NFormItem label="关键词" path="keyword">
  487. <NInput
  488. placeholder="曲目编号/名称"
  489. v-model:value={state.searchForm.keyword}
  490. clearable
  491. />
  492. </NFormItem>
  493. <NFormItem label="多声轨渲染" path="musicSheetType">
  494. <NSelect
  495. placeholder="请选择多声轨渲染"
  496. v-model:value={state.searchForm.musicSheetType}
  497. options={getSelectDataFromObj(musicSheetType)}
  498. clearable
  499. />
  500. </NFormItem>
  501. <NFormItem label="曲目分类" path="musicCategoryId">
  502. <NCascader
  503. valueField="id"
  504. labelField="name"
  505. children-field="musicSheetCategoriesList"
  506. placeholder="请选择曲目分类"
  507. v-model:value={state.searchForm.musicCategoryId}
  508. options={state.musicSheetCategories}
  509. clearable
  510. />
  511. </NFormItem>
  512. <NFormItem label="可用声部" path="musicSubject">
  513. <NSelect
  514. placeholder="请选择可用声部"
  515. v-model:value={state.searchForm.subjectId}
  516. options={state.subjectList}
  517. clearable
  518. />
  519. </NFormItem>
  520. <NFormItem label="音乐人" path="composer">
  521. <NInput
  522. placeholder="请选择音乐人"
  523. v-model:value={state.searchForm.composer}
  524. clearable
  525. />
  526. </NFormItem>
  527. <NFormItem label="作者属性" path="sourceType">
  528. <NSelect
  529. placeholder="请选择作者属性"
  530. v-model:value={state.searchForm.sourceType}
  531. options={getSelectDataFromObj(musicSheetSourceType)}
  532. onUpdateValue={async (value: any) => {
  533. state.userIdData = []
  534. state.searchForm.userId = null
  535. if (value && value !== 'PLATFORM') {
  536. await updateUserIdData(value)
  537. state.userIdDisable = !state.searchForm.applicationId
  538. } else {
  539. state.userIdDisable = true
  540. }
  541. }}
  542. clearable
  543. />
  544. </NFormItem>
  545. <NFormItem label="项目" path="applicationId">
  546. <NSelect
  547. placeholder="请选择项目"
  548. v-model:value={state.searchForm.applicationId}
  549. options={state.useProjectData}
  550. clearable
  551. onUpdateValue={async (value: any) => {
  552. state.searchForm.applicationId = value
  553. if (value) {
  554. await updateUserIdData(state.searchForm.sourceType)
  555. state.userIdDisable = !(
  556. state.searchForm.sourceType && state.searchForm.sourceType !== 'PLATFORM'
  557. )
  558. } else {
  559. state.searchForm.userId = null
  560. state.userIdDisable = true
  561. state.userIdData = []
  562. }
  563. }}
  564. />
  565. </NFormItem>
  566. <NFormItem label="所属人" path="userId">
  567. {{
  568. label: () =>
  569. <div>
  570. 所属人
  571. {/*<NTooltip style={"padding-left: 10px"}>*/}
  572. {/* {{*/}
  573. {/* default: () => '请选择作者属性和项目再选择所属人',*/}
  574. {/* trigger: () => (*/}
  575. {/* <span>*/}
  576. {/* <NIcon size="20">*/}
  577. {/* <HelpCircleOutline/>*/}
  578. {/* </NIcon>*/}
  579. {/* </span>*/}
  580. {/* )*/}
  581. {/* }}*/}
  582. {/*</NTooltip>*/}
  583. </div>
  584. ,
  585. default: () => (
  586. <NSelect
  587. filterable
  588. placeholder="请选择所属人"
  589. disabled={state.userIdDisable || (!state.searchForm.applicationId && !state.searchForm.sourceType)}
  590. v-model:value={state.searchForm.userId}
  591. options={state.userIdData}
  592. clearable
  593. ></NSelect>
  594. )
  595. }}
  596. </NFormItem>
  597. <NFormItem label="适用项目" path="useAppId">
  598. <NSelect
  599. placeholder="请选择适用项目"
  600. v-model:value={state.searchForm.useAppId}
  601. options={state.useProjectData}
  602. multiple
  603. maxTagCount={1}
  604. />
  605. </NFormItem>
  606. <NFormItem label="状态" path="status">
  607. <NSelect
  608. v-model={[state.searchForm.status, 'value']}
  609. placeholder="请选择状态"
  610. clearable
  611. options={
  612. [
  613. {
  614. label: '启用',
  615. value: true
  616. },
  617. {
  618. label: '停用',
  619. value: false
  620. }
  621. ] as any
  622. }
  623. />
  624. </NFormItem>
  625. <NFormItem label="审核版本" path="appAuditFlag">
  626. <NSelect
  627. v-model={[state.searchForm.appAuditFlag, 'value']}
  628. placeholder="请选择审核版本"
  629. clearable
  630. options={
  631. [
  632. {
  633. label: '是',
  634. value: 1
  635. },
  636. {
  637. label: '否',
  638. value: 0
  639. }
  640. ] as any
  641. }
  642. />
  643. </NFormItem>
  644. <NFormItem label="数据修复" path="dataCorrect">
  645. <NSelect
  646. v-model={[state.searchForm.dataCorrect, 'value']}
  647. placeholder="请选择数据修复"
  648. clearable
  649. options={
  650. [
  651. {
  652. label: '是',
  653. value: true
  654. },
  655. {
  656. label: '否',
  657. value: false
  658. }
  659. ] as any
  660. }
  661. />
  662. </NFormItem>
  663. <NFormItem>
  664. <NSpace>
  665. <NButton type="primary" onClick={onSearch}>
  666. 搜索
  667. </NButton>
  668. <NButton type="default" onClick={onBtnReset}>
  669. 重置
  670. </NButton>
  671. </NSpace>
  672. </NFormItem>
  673. </SaveForm>
  674. <div class={['section-container']}>
  675. <NSpace style={{ paddingBottom: '12px' }}>
  676. <NButton
  677. type="primary"
  678. v-auth="musicSheet/save1751241178962984962"
  679. onClick={() => {
  680. state.visiableMusic = true
  681. state.musicOperation = 'add'
  682. state.musicData = {}
  683. state.detailReadonly = true
  684. }}
  685. >
  686. 新增曲目
  687. </NButton>
  688. <NButton
  689. disabled={checkedRowKeysRef.value.length == 0}
  690. v-auth="musicSheet/statusList1751241653309407234"
  691. onClick={() => {
  692. onBatchChangeStatus(false)
  693. }}
  694. >
  695. 批量停用
  696. </NButton>
  697. <NButton
  698. disabled={checkedRowKeysRef.value.length == 0}
  699. v-auth="musicSheet/statusList1751241653309407234"
  700. onClick={() => {
  701. onBatchChangeStatus(true)
  702. }}
  703. >
  704. 批量启用
  705. </NButton>
  706. </NSpace>
  707. <NDataTable
  708. loading={state.loading}
  709. columns={columns()}
  710. data={state.dataList}
  711. rowKey={(row: any) => row.id}
  712. onUpdateCheckedRowKeys={handleCheck}
  713. scrollX={'1200'}
  714. ></NDataTable>
  715. <Pagination
  716. v-model:page={state.pagination.page}
  717. v-model:pageSize={state.pagination.rows}
  718. v-model:pageTotal={state.pagination.pageTotal}
  719. onList={getList}
  720. sync
  721. saveKey="music-list"
  722. ></Pagination>
  723. </div>
  724. <NModal
  725. v-model:show={state.visiableMusic}
  726. preset="dialog"
  727. showIcon={false}
  728. maskClosable={false}
  729. title={() => {
  730. if (state.musicOperation === 'add') {
  731. return '添加曲目'
  732. } else if (state.musicOperation === 'preview') {
  733. return '曲目详情'
  734. }
  735. return '修改曲目'
  736. }}
  737. style={{ width: '980px' }}
  738. >
  739. <MusicOperation
  740. type={state.musicOperation}
  741. data={state.musicData}
  742. subjectList={state.subjectList}
  743. // musicSheetCategories={state.musicSheetCategories}
  744. // tagList={state.tagList}
  745. onClose={() => (state.visiableMusic = false)}
  746. onGetList={getList}
  747. />
  748. </NModal>
  749. <NModal
  750. blockScroll={true}
  751. v-model:show={state.musicPreview}
  752. preset="dialog"
  753. showIcon={false}
  754. title={'曲目预览'}
  755. style={{ width: 'auto' }}
  756. >
  757. <MusicPreView item={state.musicScore} isMove={1}/>
  758. </NModal>
  759. <NModal
  760. blockScroll={true}
  761. v-model:show={state.showUseProject}
  762. preset="dialog"
  763. showIcon={false}
  764. title={'适用项目'}
  765. style={{ width: '500px' }}
  766. >
  767. <UseProject
  768. id={state.showUseProjectId}
  769. useProject={state.useProjectData}
  770. onClose={() => (state.showUseProject = false)}
  771. onGetList={getList}
  772. />
  773. </NModal>
  774. <NModal
  775. class={styles.productModal}
  776. title="自动生成曲谱图片"
  777. v-model:show={state.productOpen}
  778. preset="dialog"
  779. closeOnEsc={false}
  780. maskClosable={false}
  781. showIcon={false}
  782. >
  783. <MusicCreateImg
  784. xmlFileUrl={state.productItem.xmlFileUrl}
  785. onClose={() => (state.productOpen = false)}
  786. onConfirm={async (item: any) => {
  787. try {
  788. await musicSheetImg({
  789. ...item,
  790. id: state.productItem.id
  791. })
  792. } catch {}
  793. }}
  794. />
  795. </NModal>
  796. </div>
  797. )
  798. }
  799. })