You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

818 lines
26 KiB

12 months ago
12 months ago
12 months ago
12 months ago
  1. import { useTranslation } from '@/i18n.ts'
  2. import { Badge, Button, DatePicker, Divider, Form, Image, Popconfirm, Space, Tooltip } from 'antd'
  3. import { useAtom, useAtomValue } from 'jotai'
  4. import { useEffect, useMemo, useState } from 'react'
  5. import Switch from '@/components/switch'
  6. import Action from '@/components/action/Action.tsx'
  7. import { BetaSchemaForm, ProColumns, ProFormColumnsType, ProTable } from '@ant-design/pro-components'
  8. import ListPageLayout from '@/layout/ListPageLayout.tsx'
  9. import {
  10. deleteVideoCloudAtom,
  11. saveOrUpdateVideoCloudAtom,
  12. videoCloudsAtom,
  13. videoCloudSearchAtom,
  14. videoCloudAtom,
  15. } from '@/store/cms/video_cloud.ts'
  16. import TagValue from '@/components/tag-value/TagValue.tsx'
  17. import dayjs from 'dayjs'
  18. import TagPro from '@/components/tag-pro/TagPro.tsx'
  19. import { useSetAtom } from 'jotai/index'
  20. import { categoriesAtom, categoryByIdAtom, categoryIdAtom } from '@/store/cms/category.ts'
  21. import { videoTypes } from '@/store/cms/video.ts'
  22. import { useStyle} from './style'
  23. import { getValueCount } from '@/utils'
  24. import { FilterOutlined } from '@ant-design/icons'
  25. const i18nPrefix = 'cms.videoCloud'
  26. const VideoCloud = () => {
  27. const { styles, cx } = useStyle()
  28. const { t } = useTranslation()
  29. const [ form ] = Form.useForm()
  30. const [ filterForm ] = Form.useForm()
  31. const { mutate: saveOrUpdate, isPending: isSubmitting, isSuccess } = useAtomValue(saveOrUpdateVideoCloudAtom)
  32. const [ search, setSearch ] = useAtom(videoCloudSearchAtom)
  33. const [ currentVideo, setVideo ] = useAtom(videoCloudAtom)
  34. const { data, isFetching, isLoading, refetch } = useAtomValue(videoCloudsAtom)
  35. const { mutate: deleteVideo, isPending: isDeleting } = useAtomValue(deleteVideoCloudAtom)
  36. const setCategoryId = useSetAtom(categoryIdAtom)
  37. const { data: categories, isLoading: isCateLoading } = useAtomValue(categoriesAtom)
  38. const { data: category, isLoading: isCategoryFetching } = useAtomValue(categoryByIdAtom)
  39. const [ open, setOpen ] = useState(false)
  40. const [ openFilter, setFilterOpen ] = useState(false)
  41. const [ searchKey, setSearchKey ] = useState(search?.title)
  42. const columns = useMemo(() => {
  43. return [
  44. {
  45. title: 'ID',
  46. dataIndex: 'id',
  47. hideInTable: true,
  48. hideInSearch: true,
  49. formItemProps: { hidden: true }
  50. },
  51. {
  52. 'title': t(`${i18nPrefix}.columns.collect_id`, 'CollectId'),
  53. 'dataIndex': 'collect_id',
  54. hideInTable: true,
  55. hideInSearch: true,
  56. hideInSetting: true,
  57. formItemProps: { hidden: true },
  58. },
  59. {
  60. 'title': t(`${i18nPrefix}.columns.title`, 'Title'),
  61. 'dataIndex': 'title',
  62. fixed: 'left',
  63. ellipsis: true,
  64. width: 250,
  65. fieldProps: {
  66. style: { width: '100%' }
  67. },
  68. colProps: {
  69. span: 12
  70. },
  71. render: (_text, record) => {
  72. //高亮搜索关键字, 从search.title中获取
  73. const title = record.title?.replace?.(new RegExp(`(${search?.title})`, 'ig'), '<span class="ant-pro-table-highlight">$1</span>')
  74. return <span dangerouslySetInnerHTML={{ __html: title }}></span>
  75. }
  76. },
  77. {
  78. 'title': t(`${i18nPrefix}.columns.title_sub`, 'TitleSub'),
  79. 'dataIndex': 'title_sub',
  80. ellipsis: true,
  81. width: 250,
  82. fieldProps: {
  83. style: { width: '100%' }
  84. },
  85. colProps: {
  86. span: 12
  87. }
  88. },
  89. {
  90. 'title': t(`${i18nPrefix}.columns.type_id`, 'TypeId'),
  91. 'dataIndex': 'type_id',
  92. valueType: 'select',
  93. fieldProps: {
  94. options: videoTypes,
  95. },
  96. hideInForm: true,
  97. render: (_dom, record) => {
  98. return t(`${i18nPrefix}.type_id.${record.type_id}`)
  99. },
  100. },
  101. {
  102. 'title': t(`${i18nPrefix}.columns.source_url`, 'SourceUrl'),
  103. 'dataIndex': 'source_url',
  104. ellipsis: true,
  105. copyable: true,
  106. width: 200,
  107. fieldProps: {
  108. style: { width: '100%' }
  109. },
  110. hideInSearch: true,
  111. },
  112. {
  113. 'title': t(`${i18nPrefix}.columns.letter`, 'Letter'),
  114. 'dataIndex': 'letter',
  115. colProps: {
  116. span: 4
  117. },
  118. hideInSearch: true,
  119. },
  120. {
  121. 'title': t(`${i18nPrefix}.columns.lock`, 'Lock'),
  122. 'dataIndex': 'lock',
  123. valueType: 'switch',
  124. render: (_dom, record) => {
  125. return <Switch value={record.lock} size={'small'}/>
  126. },
  127. colProps: {
  128. span: 4
  129. },
  130. hideInSearch: true,
  131. },
  132. {
  133. 'title': t(`${i18nPrefix}.columns.copyright`, 'Copyright'),
  134. 'dataIndex': 'copyright',
  135. valueType: 'switch',
  136. render: (_dom, record) => {
  137. return <Switch value={record.lock} size={'small'}/>
  138. },
  139. colProps: {
  140. span: 4
  141. },
  142. hideInSearch: true,
  143. },
  144. {
  145. 'title': t(`${i18nPrefix}.columns.is_end`, 'IsEnd'),
  146. 'dataIndex': 'is_end',
  147. valueType: 'switch',
  148. render: (_dom, record) => {
  149. return <Switch value={record.lock} size={'small'}/>
  150. },
  151. colProps: {
  152. span: 4
  153. },
  154. hideInSearch: true,
  155. },
  156. {
  157. 'title': t(`${i18nPrefix}.columns.status`, 'Status'),
  158. 'dataIndex': 'status',
  159. valueType: 'switch',
  160. render: (_dom, record) => {
  161. return <Switch value={record.lock} size={'small'}/>
  162. },
  163. colProps: {
  164. span: 4
  165. }
  166. },
  167. {
  168. 'title': t(`${i18nPrefix}.columns.pic_local`, 'PicLocal'),
  169. 'dataIndex': 'pic_local',
  170. hideInSearch: true,
  171. hideInSetting: true,
  172. formItemProps: { hidden: true },
  173. hideInTable: true,
  174. },
  175. {
  176. 'title': t(`${i18nPrefix}.columns.pic_status`, 'PicStatus'),
  177. 'dataIndex': 'pic_status',
  178. valueType: 'switch',
  179. render: (_dom, record) => {
  180. return <Switch value={record.lock} size={'small'}/>
  181. },
  182. colProps: {
  183. span: 4
  184. },
  185. hideInSearch: true,
  186. },
  187. {
  188. 'title': t(`${i18nPrefix}.columns.pic`, 'Pic'),
  189. 'dataIndex': 'pic',
  190. render: (_dom, record) => {
  191. return <Image src={record.pic} height={40}/>
  192. },
  193. colProps: {
  194. span: 20
  195. },
  196. hideInSearch: true,
  197. },
  198. {
  199. 'title': t(`${i18nPrefix}.columns.category_id`, 'CategoryId'),
  200. 'dataIndex': 'category_id',
  201. valueType: 'select',
  202. fieldProps: {
  203. loading: isCategoryFetching,
  204. options: categories?.rows ?? [],
  205. fieldNames: {
  206. label: 'name',
  207. value: 'id'
  208. }
  209. },
  210. render: (_dom, record) => {
  211. return <TagValue
  212. tags={categories?.rows.filter(item=>item.id === record.category_id).map(item=>{
  213. return {
  214. label: item.name,
  215. value: item.id
  216. }
  217. }) ?? []}
  218. wrap={currentVideo?.id === record.id}
  219. value={search?.category_id ?? []}
  220. onChange={(values) => {
  221. setSearch((prev: any) => {
  222. return {
  223. ...prev,
  224. category_id: values,
  225. }
  226. })
  227. setCategoryId(values[0])
  228. setFilterOpen(true)
  229. }}
  230. />
  231. },
  232. },
  233. {
  234. 'title': t(`${i18nPrefix}.columns.actor`, 'Actor'),
  235. 'dataIndex': 'actor',
  236. ellipsis: true,
  237. width: 200,
  238. fieldProps: {
  239. style: { width: '100%' }
  240. },
  241. render: (_dom, record) => {
  242. return <TagValue
  243. tags={record.actor?.split(',') ?? []}
  244. wrap={currentVideo?.id === record.id}
  245. value={search?.actor ?? []}
  246. onChange={(values) => {
  247. setSearch((prev: any) => {
  248. return {
  249. ...prev,
  250. actor: values,
  251. }
  252. })
  253. setFilterOpen(true)
  254. }}
  255. />
  256. },
  257. },
  258. {
  259. 'title': t(`${i18nPrefix}.columns.director`, 'Director'),
  260. 'dataIndex': 'director',
  261. width: 200,
  262. fieldProps: {
  263. style: { width: '100%' }
  264. },
  265. render: (_dom, record) => {
  266. return <TagValue
  267. tags={record.director?.split(',') ?? []}
  268. wrap={currentVideo?.id === record.id}
  269. value={search?.director ?? []}
  270. onChange={(values) => {
  271. setSearch((prev: any) => {
  272. return {
  273. ...prev,
  274. director: values,
  275. }
  276. })
  277. setFilterOpen(true)
  278. }}
  279. />
  280. },
  281. },
  282. {
  283. 'title': t(`${i18nPrefix}.columns.writer`, 'Writer'),
  284. 'dataIndex': 'writer',
  285. width: 200,
  286. fieldProps: {
  287. style: { width: '100%' }
  288. },
  289. render: (_dom, record) => {
  290. return <TagValue
  291. tags={record.writer?.split(',') ?? []}
  292. wrap={currentVideo?.id === record.id}
  293. value={search?.writer ?? []}
  294. onChange={(values) => {
  295. setSearch((prev: any) => {
  296. return {
  297. ...prev,
  298. writer: values,
  299. }
  300. })
  301. setFilterOpen(true)
  302. }}
  303. />
  304. },
  305. },
  306. {
  307. 'title': t(`${i18nPrefix}.columns.remarks`, 'Remarks'),
  308. 'dataIndex': 'remarks',
  309. hideInSearch: true,
  310. },
  311. /* {
  312. 'title': t(`${i18nPrefix}.columns.pubdate`, 'Pubdate'),
  313. 'dataIndex': 'pubdate',
  314. valueType: 'dateTime',
  315. colProps: {
  316. span: 4
  317. }
  318. },*/
  319. {
  320. 'title': t(`${i18nPrefix}.columns.total`, 'Total'),
  321. 'dataIndex': 'total',
  322. valueType: 'digit',
  323. colProps: {
  324. span: 4
  325. },
  326. hideInSearch: true,
  327. },
  328. {
  329. 'title': t(`${i18nPrefix}.columns.serial`, 'Serial'),
  330. 'dataIndex': 'serial',
  331. colProps: {
  332. span: 4
  333. },
  334. hideInSearch: true,
  335. },
  336. {
  337. 'title': t(`${i18nPrefix}.columns.duration`, 'Duration'),
  338. 'dataIndex': 'duration',
  339. colProps: {
  340. span: 4
  341. },
  342. hideInSearch: true,
  343. },
  344. {
  345. 'title': t(`${i18nPrefix}.columns.year`, 'Year'),
  346. 'dataIndex': 'year',
  347. valueType: 'dateYear',
  348. fieldProps:{
  349. style:{
  350. width: '100%'
  351. }
  352. },
  353. colProps: {
  354. span: openFilter? 12: 4,
  355. },
  356. render: (_dom, record) => {
  357. if (record.year === undefined || record.year === null || record.year === 0) {
  358. return null
  359. }
  360. return <TagValue
  361. tags={[ record.year ]}
  362. wrap={ currentVideo?.id === record.id}
  363. value={search?.year}
  364. single={true}
  365. onChange={(values) => {
  366. setSearch((prev: any) => {
  367. return {
  368. ...prev,
  369. year: values[0],
  370. }
  371. })
  372. setFilterOpen(true)
  373. }}
  374. />
  375. },
  376. renderFormItem: (_schema, config) => {
  377. const props = { ...config } as any
  378. delete props.mode
  379. const isForm = config.type === 'form'
  380. let value = isForm && config.value && config.value > 0 ? dayjs().set('year', config.value) : undefined
  381. if (config.value?.$isDayjsObject) {
  382. value = config.value as dayjs.Dayjs
  383. }
  384. return <DatePicker
  385. {..._schema.formItemProps}
  386. {...props}
  387. picker={'year'}
  388. value={value}
  389. />
  390. }
  391. },
  392. {
  393. 'title': t(`${i18nPrefix}.columns.tag`, 'Tag'),
  394. 'dataIndex': 'tag',
  395. valueType: 'textarea',
  396. ellipsis: true,
  397. renderFormItem: (schema, config) => {
  398. return <TagPro loading={isCategoryFetching}
  399. tags={category?.extend?.class?.split(',') ?? []} {...config} {...schema.fieldProps} />
  400. },
  401. width: 200,
  402. fieldProps: {
  403. style: { width: '100%' }
  404. },
  405. render: (_dom, record) => {
  406. return <TagValue
  407. tags={record.tag?.split(',') ?? []}
  408. wrap={currentVideo?.id === record.id}
  409. value={search?.tag ?? []}
  410. onChange={(values) => {
  411. setSearch((prev: any) => {
  412. return {
  413. ...prev,
  414. tag: values,
  415. }
  416. })
  417. setFilterOpen(true)
  418. }}
  419. />
  420. },
  421. },
  422. {
  423. 'title': t(`${i18nPrefix}.columns.area`, 'Area'),
  424. 'dataIndex': 'area',
  425. ellipsis: true,
  426. width: 200,
  427. fieldProps: {
  428. style: { width: '100%' }
  429. },
  430. render: (_dom, record) => {
  431. return <TagValue
  432. tags={record.area?.split(',') ?? []}
  433. wrap={currentVideo?.id === record.id}
  434. value={search?.area ?? []}
  435. onChange={(values) => {
  436. setSearch((prev: any) => {
  437. return {
  438. ...prev,
  439. area: values,
  440. }
  441. })
  442. setFilterOpen(true)
  443. }}
  444. />
  445. },
  446. renderFormItem: (schema, config) => {
  447. return <TagPro loading={isCategoryFetching}
  448. tags={category?.extend?.area?.split(',') ?? []} {...config} {...schema.fieldProps} />
  449. }
  450. },
  451. {
  452. 'title': t(`${i18nPrefix}.columns.lang`, 'Lang'),
  453. 'dataIndex': 'lang',
  454. ellipsis: true,
  455. width: 200,
  456. fieldProps: {
  457. style: { width: '100%' }
  458. },
  459. render: (_dom, record) => {
  460. return <TagValue
  461. tags={record.lang?.split(',') ?? []}
  462. wrap={currentVideo?.id === record.id}
  463. value={search?.lang ?? []}
  464. onChange={(values) => {
  465. setSearch((prev: any) => {
  466. return {
  467. ...prev,
  468. lang: values,
  469. }
  470. })
  471. setFilterOpen(true)
  472. }}
  473. />
  474. },
  475. renderFormItem: (schema, config) => {
  476. return <TagPro loading={isCategoryFetching}
  477. tags={category?.extend?.lang?.split(',') ?? []} {...config} {...schema.fieldProps} />
  478. }
  479. },
  480. {
  481. 'title': t(`${i18nPrefix}.columns.version`, 'Version'),
  482. 'dataIndex': 'version',
  483. width: 200,
  484. fieldProps: {
  485. style: { width: '100%' }
  486. },
  487. render: (_dom, record) => {
  488. return <TagValue
  489. tags={record.version?.split(',') ?? []}
  490. wrap={currentVideo?.id === record.id}
  491. value={search?.version ?? []}
  492. onChange={(values) => {
  493. setSearch((prev: any) => {
  494. return {
  495. ...prev,
  496. version: values,
  497. }
  498. })
  499. setFilterOpen(true)
  500. }}
  501. />
  502. },
  503. renderFormItem: (schema, config) => {
  504. return <TagPro loading={isCategoryFetching}
  505. tags={category?.extend?.version?.split(',') ?? []} {...config} {...schema.fieldProps} />
  506. }
  507. },
  508. {
  509. 'title': t(`${i18nPrefix}.columns.state`, 'State'),
  510. 'dataIndex': 'state',
  511. width: 200,
  512. fieldProps: {
  513. style: { width: '100%' }
  514. },
  515. render: (_dom, record) => {
  516. return <TagValue
  517. tags={record.state?.split(',') ?? []}
  518. wrap={currentVideo?.id === record.id}
  519. value={search?.state ?? []}
  520. onChange={(values) => {
  521. setSearch((prev: any) => {
  522. return {
  523. ...prev,
  524. state: values,
  525. }
  526. })
  527. setFilterOpen(true)
  528. }}
  529. />
  530. },
  531. renderFormItem: (schema, config) => {
  532. return <TagPro loading={isCategoryFetching}
  533. tags={category?.extend?.state?.split(',') ?? []} {...config} {...schema.fieldProps} />
  534. }
  535. },
  536. {
  537. 'title': t(`${i18nPrefix}.columns.douban_score`, 'DoubanScore'),
  538. 'dataIndex': 'douban_score',
  539. hideInSearch: true,
  540. hideInSetting: true,
  541. formItemProps: { hidden: true },
  542. hideInTable: true,
  543. },
  544. {
  545. 'title': t(`${i18nPrefix}.columns.douban_id`, 'DoubanId'),
  546. 'dataIndex': 'douban_id',
  547. hideInSearch: true,
  548. hideInSetting: true,
  549. formItemProps: { hidden: true },
  550. hideInTable: true,
  551. },
  552. {
  553. 'title': t(`${i18nPrefix}.columns.imdb_score`, 'ImdbScore'),
  554. 'dataIndex': 'imdb_score',
  555. hideInSearch: true,
  556. hideInSetting: true,
  557. formItemProps: { hidden: true },
  558. hideInTable: true,
  559. },
  560. {
  561. 'title': t(`${i18nPrefix}.columns.imdb_id`, 'ImdbId'),
  562. 'dataIndex': 'imdb_id',
  563. hideInSearch: true,
  564. hideInSetting: true,
  565. formItemProps: { hidden: true },
  566. hideInTable: true,
  567. },
  568. {
  569. 'title': t(`${i18nPrefix}.columns.content`, 'Content'),
  570. 'dataIndex': 'content',
  571. valueType: 'textarea',
  572. ellipsis: true,
  573. onHeaderCell: () => ({
  574. width: 200,
  575. }),
  576. hideInSearch: true,
  577. },
  578. {
  579. title: t(`${i18nPrefix}.columns.option`, '操作'),
  580. key: 'option',
  581. valueType: 'option',
  582. fixed: 'right',
  583. render: (_, record) => [
  584. <Action key="edit"
  585. as={'a'}
  586. onClick={() => {
  587. setCategoryId(record.category_id)
  588. form.setFieldsValue(record)
  589. setOpen(true)
  590. }}>{t('actions.edit')}</Action>,
  591. <Popconfirm
  592. key={'del_confirm'}
  593. disabled={isDeleting}
  594. onConfirm={() => {
  595. deleteVideo([ record.id ])
  596. }}
  597. title={t('message.deleteConfirm')}>
  598. <a key="del">
  599. {t('actions.delete', '删除')}
  600. </a>
  601. </Popconfirm>
  602. ]
  603. }
  604. ] as ProColumns[]
  605. }, [ isDeleting, category, isCategoryFetching, categories, isCateLoading, category, currentVideo, search, openFilter ])
  606. useEffect(() => {
  607. setSearchKey(search?.title)
  608. filterForm.setFieldsValue(search)
  609. }, [ search ])
  610. useEffect(() => {
  611. if (isSuccess) {
  612. setOpen(false)
  613. }
  614. }, [ isSuccess ])
  615. return (
  616. <ListPageLayout className={styles.container}>
  617. <ProTable
  618. rowKey="id"
  619. headerTitle={t(`${i18nPrefix}.title`, '云盘视频管理')}
  620. toolbar={{
  621. search: {
  622. loading: isFetching && !!search.key,
  623. onSearch: (value: string) => {
  624. setSearch(prev => ({
  625. ...prev,
  626. title: value
  627. }))
  628. },
  629. onChange: (e) => {
  630. setSearchKey(e.target?.value)
  631. },
  632. value: searchKey,
  633. allowClear: true,
  634. placeholder: t(`${i18nPrefix}.placeholder`, '输入云盘视频名称')
  635. },
  636. actions: [
  637. <Tooltip key={'filter'} title={t(`${i18nPrefix}.filter.tooltip`, '高级查询')}>
  638. <Badge count={getValueCount(search)}>
  639. <Button
  640. onClick={() => {
  641. setFilterOpen(true)
  642. }}
  643. icon={<FilterOutlined/>} shape={'circle'} size={'small'}/>
  644. </Badge>
  645. </Tooltip>,
  646. <Divider type={'vertical'} key={'divider'}/>,
  647. <Button
  648. onClick={() => {
  649. form.resetFields()
  650. form.setFieldsValue({
  651. id: 0,
  652. type_id: 2,
  653. })
  654. setOpen(true)
  655. }}
  656. type={'primary'}>{t(`${i18nPrefix}.add`, '添加')}</Button>
  657. ]
  658. }}
  659. scroll={{
  660. x: 3800, y: 'calc(100vh - 290px)'
  661. }}
  662. onRow={(record) => {
  663. return {
  664. className: cx({
  665. 'ant-table-row-selected': currentVideo?.id === record.id
  666. }),
  667. onClick: () => {
  668. setVideo(record)
  669. }
  670. }
  671. }}
  672. dateFormatter="string"
  673. loading={isLoading || isFetching}
  674. dataSource={data?.rows ?? []}
  675. columns={columns}
  676. search={false}
  677. options={{
  678. reload: () => {
  679. refetch()
  680. },
  681. }}
  682. pagination={{
  683. total: data?.total,
  684. pageSize: search.pageSize,
  685. current: search.page,
  686. onChange: (current, pageSize) => {
  687. setSearch(prev => {
  688. return {
  689. ...prev,
  690. page: current,
  691. pageSize: pageSize,
  692. }
  693. })
  694. },
  695. }}
  696. />
  697. <BetaSchemaForm
  698. grid={true}
  699. shouldUpdate={false}
  700. width={1000}
  701. form={form}
  702. layout={'vertical'}
  703. scrollToFirstError={true}
  704. title={t(`${i18nPrefix}.title_${form.getFieldValue('id') !== 0 ? 'edit' : 'add'}`, form.getFieldValue('id') !== 0 ? '云盘视频编辑' : '云盘视频添加')}
  705. // colProps={{ span: 24 }}
  706. // labelCol={{ span: 6 }}
  707. // wrapperCol={{ span: 14 }}
  708. layoutType={'DrawerForm'}
  709. open={open}
  710. drawerProps={{
  711. maskClosable: false,
  712. }}
  713. onOpenChange={(open) => {
  714. setOpen(open)
  715. }}
  716. loading={isSubmitting}
  717. onFinish={async (values) => {
  718. // console.log('values', values)
  719. saveOrUpdate(values)
  720. }}
  721. columns={columns as ProFormColumnsType[]}/>
  722. <BetaSchemaForm
  723. title={t(`${i18nPrefix}.filter.title`, '高级查询')}
  724. grid={true}
  725. shouldUpdate={false}
  726. width={500}
  727. name={'filterForm'}
  728. form={filterForm}
  729. open={openFilter}
  730. onOpenChange={open => {
  731. setFilterOpen(open)
  732. }}
  733. layout={'vertical'}
  734. scrollToFirstError={true}
  735. layoutType={'DrawerForm'}
  736. drawerProps={{
  737. maskClosable: false,
  738. mask: false,
  739. }}
  740. submitter={{
  741. searchConfig: {
  742. resetText: t(`${i18nPrefix}.filter.reset`, '清空'),
  743. submitText: t(`${i18nPrefix}.filter.submit`, '查询'),
  744. },
  745. onReset: () => {
  746. filterForm.resetFields()
  747. },
  748. render: (props,) => {
  749. return (
  750. <div style={{ textAlign: 'right' }}>
  751. <Space>
  752. <Button onClick={() => {
  753. props.reset()
  754. }}>{props.searchConfig?.resetText}</Button>
  755. <Button type="primary"
  756. onClick={() => {
  757. props.submit()
  758. }}
  759. >{props.searchConfig?.submitText}</Button>
  760. </Space>
  761. </div>
  762. )
  763. },
  764. }}
  765. onValuesChange={(values) => {
  766. if (values.category_id) {
  767. setCategoryId(values.category_id)
  768. }
  769. }}
  770. onFinish={async (values) => {
  771. // console.log('values', values)
  772. //处理,变成数组
  773. Object.keys(values).forEach(key => {
  774. if (typeof values[key] === 'string' && values[key].includes(',')) {
  775. values[key] = values[key].split(',')
  776. }
  777. })
  778. setSearch(values)
  779. }}
  780. columns={columns.filter(item => !item.hideInSearch) as ProFormColumnsType[]}/>
  781. </ListPageLayout>
  782. )
  783. }
  784. export default VideoCloud