add:新增验证视频可选上传功能
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ReloadOutlined } from '@ant-design/icons'
|
||||
import { ReloadOutlined, VideoCameraOutlined } from '@ant-design/icons'
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import {
|
||||
App,
|
||||
@@ -26,7 +26,12 @@ import {
|
||||
repayAdminAfterSalesCaseDebt,
|
||||
resolveAdminAfterSalesCase,
|
||||
} from '@/services/admin'
|
||||
import type { UploadedFile, WorkerAfterSalesCase, WorkOrder } from '@/types/worker-platform'
|
||||
import type {
|
||||
UploadedFile,
|
||||
WorkerAcceptanceVideo,
|
||||
WorkerAfterSalesCase,
|
||||
WorkOrder,
|
||||
} from '@/types/worker-platform'
|
||||
import { ADMIN_DEFAULT_PAGE_SIZE, buildAdminTablePagination } from '@/utils/admin-pagination'
|
||||
import { formatAdminDateTime } from '@/utils/admin-time'
|
||||
import { uniqueUploadedFiles } from '@/utils/image-identity'
|
||||
@@ -259,6 +264,15 @@ const AfterSalesPanel = forwardRef<AfterSalesPanelHandle>(function AfterSalesPan
|
||||
/>
|
||||
</Space>
|
||||
) : null}
|
||||
{getAfterSalesSnapshotVideo(item) ? (
|
||||
<a
|
||||
href={getAfterSalesSnapshotVideo(item)?.url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<VideoCameraOutlined /> 查看固化验收视频
|
||||
</a>
|
||||
) : null}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
@@ -570,4 +584,21 @@ function getAfterSalesSnapshotFiles(item: WorkerAfterSalesCase): UploadedFile[]
|
||||
)
|
||||
}
|
||||
|
||||
/** 售后固化快照里的验收视频(有则给出可点击链接)。 */
|
||||
function getAfterSalesSnapshotVideo(item: WorkerAfterSalesCase): WorkerAcceptanceVideo | null {
|
||||
const snapshot = asRecord(item.acceptanceSnapshot)
|
||||
const acceptance = asRecord(snapshot.acceptance)
|
||||
const video = asRecord(acceptance.video)
|
||||
const url = String(video.url || '').trim()
|
||||
if (!url) return null
|
||||
return {
|
||||
objectKey: String(video.objectKey || video.object_key || ''),
|
||||
url,
|
||||
filename: String(video.filename || ''),
|
||||
contentType: String(video.contentType || video.content_type || ''),
|
||||
size: Number(video.size || 0),
|
||||
durationSeconds: Number(video.durationSeconds || video.duration_seconds || 0),
|
||||
}
|
||||
}
|
||||
|
||||
export default AfterSalesPanel
|
||||
|
||||
Reference in New Issue
Block a user