|
@ -41,6 +41,7 @@ const Video = () => { |
|
|
const { data: category, isLoading: isCategoryFetching } = useAtomValue(categoryByIdAtom) |
|
|
const { data: category, isLoading: isCategoryFetching } = useAtomValue(categoryByIdAtom) |
|
|
const [ open, setOpen ] = useState(false) |
|
|
const [ open, setOpen ] = useState(false) |
|
|
const [ openFilter, setFilterOpen ] = useState(false) |
|
|
const [ openFilter, setFilterOpen ] = useState(false) |
|
|
|
|
|
const [ searchKey, setSearchKey ] = useState(search?.title) |
|
|
|
|
|
|
|
|
const columns = useMemo(() => { |
|
|
const columns = useMemo(() => { |
|
|
return [ |
|
|
return [ |
|
@ -69,6 +70,12 @@ const Video = () => { |
|
|
colProps: { |
|
|
colProps: { |
|
|
span: 8 |
|
|
span: 8 |
|
|
}, |
|
|
}, |
|
|
|
|
|
render: (_text, record) => { |
|
|
|
|
|
//高亮搜索关键字, 从search.title中获取
|
|
|
|
|
|
const title = record.title?.replace?.(new RegExp(`(${search?.title})`, 'ig'), '<span class="ant-pro-table-highlight">$1</span>') |
|
|
|
|
|
|
|
|
|
|
|
return <span dangerouslySetInnerHTML={{ __html: title }}></span> |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
'title': t(`${i18nPrefix}.columns.title_sub`, 'TitleSub'), |
|
|
'title': t(`${i18nPrefix}.columns.title_sub`, 'TitleSub'), |
|
@ -79,6 +86,12 @@ const Video = () => { |
|
|
}, |
|
|
}, |
|
|
colProps: { |
|
|
colProps: { |
|
|
span: 16 |
|
|
span: 16 |
|
|
|
|
|
}, |
|
|
|
|
|
render: (_text, record) => { |
|
|
|
|
|
//高亮搜索关键字, 从search.title中获取
|
|
|
|
|
|
const title = record.title_sub?.replace?.(new RegExp(`(${search?.title_sub})`, 'ig'), '<span class="ant-pro-table-highlight">$1</span>') |
|
|
|
|
|
|
|
|
|
|
|
return <span dangerouslySetInnerHTML={{ __html: title }}></span> |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
@ -158,7 +171,7 @@ const Video = () => { |
|
|
const props = { ...config } as any |
|
|
const props = { ...config } as any |
|
|
delete props.mode |
|
|
delete props.mode |
|
|
const isForm = config.type === 'form' |
|
|
const isForm = config.type === 'form' |
|
|
let value = isForm && config.value ? dayjs().set('year', config.value) : undefined |
|
|
|
|
|
|
|
|
let value = isForm && config.value ? dayjs().set('year', config.value) : undefined |
|
|
if (config.value?.$isDayjsObject) { |
|
|
if (config.value?.$isDayjsObject) { |
|
|
value = config.value as dayjs.Dayjs |
|
|
value = config.value as dayjs.Dayjs |
|
|
} |
|
|
} |
|
@ -558,6 +571,7 @@ const Video = () => { |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
|
|
|
|
|
|
|
|
|
setSearchKey(search?.title) |
|
|
filterForm.setFieldsValue(search) |
|
|
filterForm.setFieldsValue(search) |
|
|
|
|
|
|
|
|
}, [ search ]) |
|
|
}, [ search ]) |
|
@ -575,19 +589,23 @@ const Video = () => { |
|
|
headerTitle={t(`${i18nPrefix}.title`, '视频管理')} |
|
|
headerTitle={t(`${i18nPrefix}.title`, '视频管理')} |
|
|
toolbar={{ |
|
|
toolbar={{ |
|
|
search: { |
|
|
search: { |
|
|
loading: isFetching && !!search.key, |
|
|
|
|
|
|
|
|
loading: isFetching && !!search.title, |
|
|
onSearch: (value: string) => { |
|
|
onSearch: (value: string) => { |
|
|
setSearch(prev => ({ |
|
|
setSearch(prev => ({ |
|
|
...prev, |
|
|
...prev, |
|
|
key: value |
|
|
|
|
|
|
|
|
title: value |
|
|
})) |
|
|
})) |
|
|
}, |
|
|
}, |
|
|
allowClear: true, |
|
|
allowClear: true, |
|
|
|
|
|
onChange: (e) => { |
|
|
|
|
|
setSearchKey(e.target?.value) |
|
|
|
|
|
}, |
|
|
|
|
|
value: searchKey, |
|
|
placeholder: t(`${i18nPrefix}.placeholder`, '输入视频名称') |
|
|
placeholder: t(`${i18nPrefix}.placeholder`, '输入视频名称') |
|
|
}, |
|
|
}, |
|
|
actions: [ |
|
|
actions: [ |
|
|
<Tooltip key={'filter'} title={t(`${i18nPrefix}.filter.tooltip`, '高级查询')}> |
|
|
<Tooltip key={'filter'} title={t(`${i18nPrefix}.filter.tooltip`, '高级查询')}> |
|
|
<Badge count={ getValueCount(search) }> |
|
|
|
|
|
|
|
|
<Badge count={getValueCount(search)}> |
|
|
<Button |
|
|
<Button |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
setFilterOpen(true) |
|
|
setFilterOpen(true) |
|
@ -714,6 +732,7 @@ const Video = () => { |
|
|
<Space> |
|
|
<Space> |
|
|
<Button onClick={() => { |
|
|
<Button onClick={() => { |
|
|
props.reset() |
|
|
props.reset() |
|
|
|
|
|
|
|
|
}}>{props.searchConfig?.resetText}</Button> |
|
|
}}>{props.searchConfig?.resetText}</Button> |
|
|
<Button type="primary" |
|
|
<Button type="primary" |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
@ -745,16 +764,9 @@ const Video = () => { |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
if (Object.keys(values).length === 0) { |
|
|
|
|
|
setSearch({}) |
|
|
|
|
|
} else { |
|
|
|
|
|
setSearch(prev => { |
|
|
|
|
|
return { |
|
|
|
|
|
...prev, |
|
|
|
|
|
...values |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
setSearch(values) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}} |
|
|
}} |
|
|
columns={columns.filter(item => !item.hideInSearch) as ProFormColumnsType[]}/> |
|
|
columns={columns.filter(item => !item.hideInSearch) as ProFormColumnsType[]}/> |
|
|
</ListPageLayout> |
|
|
</ListPageLayout> |
|
|