music-list.tsx 27 KB

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