|
|
@@ -114,6 +114,7 @@ interface GroupItem {
|
|
|
}
|
|
|
|
|
|
interface Props {
|
|
|
+ refreshDetail?: () => void
|
|
|
otherReportList?: ReportItem[]
|
|
|
useOnline?: string
|
|
|
orderItemId?: string
|
|
|
@@ -123,11 +124,6 @@ const equipType = useConfigStore().getEquipType()
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
otherReportList: () => [],
|
|
|
})
|
|
|
-const emit = defineEmits<{
|
|
|
- edit: [item: ReportItem]
|
|
|
- viewDetail: [item: ReportItem]
|
|
|
- handleEditWorkInstruction: [item: ReportItem]
|
|
|
-}>()
|
|
|
|
|
|
const popupVisible = ref(false)
|
|
|
const cancelReason = ref('')
|
|
|
@@ -182,7 +178,7 @@ const handleSelectItem = (item: ReportItem) => {
|
|
|
selectedProjects.value.splice(index, 1)
|
|
|
}
|
|
|
|
|
|
- selectAll.value = selectedProjects.value.length === dataSource.value.length
|
|
|
+ selectAll.value = selectedProjects.value.length === (props.otherReportList || []).length
|
|
|
}
|
|
|
|
|
|
const handleSelectAll = () => {
|
|
|
@@ -229,9 +225,11 @@ const handlePopupConfirm = () => {
|
|
|
const handleDelReport = async (reason: string) => {
|
|
|
try {
|
|
|
uni.showLoading({ title: '作废中...' })
|
|
|
- const invalidItems = selectedProjects.value.filter((item) => item.status !== 0)
|
|
|
+ const invalidItems = selectedProjects.value.filter(
|
|
|
+ (item) => item.reportType === PressureReportType.WORKINSTRUCTION && item.status !== 0,
|
|
|
+ )
|
|
|
if (invalidItems.length) {
|
|
|
- uni.showToast({ title: '只能作废待提交的项目', icon: 'error' })
|
|
|
+ uni.showToast({ title: '只能作废待提交的操作指导书', icon: 'error' })
|
|
|
uni.hideLoading()
|
|
|
return
|
|
|
}
|
|
|
@@ -240,7 +238,11 @@ const handleDelReport = async (reason: string) => {
|
|
|
let result = null
|
|
|
|
|
|
if (props.useOnline === '1') {
|
|
|
- const fetchResult = await requestFunc(TaskOrderFuncName.BatchCancelReport, equipType, cancelReportReq)
|
|
|
+ const fetchResult = await requestFunc(
|
|
|
+ TaskOrderFuncName.BatchCancelReport,
|
|
|
+ equipType,
|
|
|
+ cancelReportReq,
|
|
|
+ )
|
|
|
result = fetchResult.data
|
|
|
} else {
|
|
|
uni.showToast({ title: '离线模式暂不支持作废', icon: 'none' })
|
|
|
@@ -254,6 +256,7 @@ const handleDelReport = async (reason: string) => {
|
|
|
eventBus.emit('RefreshOnlineData')
|
|
|
uni.showToast({ title: '作废成功', icon: 'success' })
|
|
|
initSelected()
|
|
|
+ props.refreshDetail?.()
|
|
|
} else {
|
|
|
uni.showToast({ title: '作废失败', icon: 'error' })
|
|
|
}
|
|
|
@@ -306,38 +309,48 @@ const canEdit = (item: ReportItem): boolean => {
|
|
|
}
|
|
|
|
|
|
const handleEdit = (item: ReportItem) => {
|
|
|
- emit('edit', item)
|
|
|
- emit('handleEditWorkInstruction', item)
|
|
|
+ switch (item.reportType) {
|
|
|
+ case PressureReportType.MAINQUESTION:
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/editor/mainQuestionEditor?templateId=${item?.templateId}&refId=${item?.id}`,
|
|
|
+ })
|
|
|
+ break
|
|
|
+ case PressureReportType.WORKINSTRUCTION:
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/editor/workInstructionEditor?templateId=${item?.templateId}&refId=${item?.id}`,
|
|
|
+ })
|
|
|
+ break
|
|
|
+ case PressureReportType.INSPECTIONPLAN:
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/editor/inspectionPlanEditor?templateId=${item?.templateId}&refId=${item?.id}`,
|
|
|
+ })
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ uni.showToast({ title: '不支持编辑该报告类型', icon: 'error' })
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const handleViewDetail = async (item: ReportItem) => {
|
|
|
- try {
|
|
|
- uni.showLoading({ title: '加载中...' })
|
|
|
-
|
|
|
- const { reportPreviewApi } = await import('@/api')
|
|
|
-
|
|
|
- const params = {
|
|
|
- reportId: item?.id,
|
|
|
- equipCode: item?.equipCode,
|
|
|
- type: 300,
|
|
|
- fileType: 200,
|
|
|
- isBase64: true,
|
|
|
- }
|
|
|
-
|
|
|
- const result = await reportPreviewApi(params)
|
|
|
-
|
|
|
- uni.hideLoading()
|
|
|
-
|
|
|
- if (result) {
|
|
|
- const pdfUrl = `data:application/pdf;base64,${result}`
|
|
|
+ switch (item.reportType) {
|
|
|
+ case PressureReportType.WORKINSTRUCTION:
|
|
|
uni.navigateTo({
|
|
|
- url: `/pages/preViewPdf/PreViewPdf?title=${encodeURIComponent(item.reportName)}&url=${encodeURIComponent(pdfUrl)}`,
|
|
|
+ url: `/pages/equipment/detail/workInstructionPreviewer?templateId=${item?.templateId}&id=${item?.id}`,
|
|
|
})
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- uni.hideLoading()
|
|
|
- console.error('获取报告预览失败:', error)
|
|
|
- uni.showToast({ title: '获取报告预览失败', icon: 'error' })
|
|
|
+ break
|
|
|
+ case PressureReportType.MAINQUESTION:
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/equipment/detail/mainQuestionPreviewer?templateId=${item?.templateId}&id=${item?.id}`,
|
|
|
+ })
|
|
|
+ break
|
|
|
+ case PressureReportType.INSPECTIONPLAN:
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `/pages/equipment/detail/inspectionPlanPreviewer?templateId=${item?.templateId}&id=${item?.id}`,
|
|
|
+ })
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ uni.showToast({ title: '不支持查看该报告类型', icon: 'error' })
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -628,6 +641,6 @@ const handleViewDetail = async (item: ReportItem) => {
|
|
|
|
|
|
.confirm-btn-text {
|
|
|
font-weight: 500;
|
|
|
- color: #4B8CD9;
|
|
|
+ color: #4b8cd9;
|
|
|
}
|
|
|
</style>
|