【需求】增加试模报告、认可报告功能

pull/6/head
zengchenxi 7 months ago
parent e2fef42584
commit 43af697a73

@ -23,6 +23,9 @@ public class FilePageReqVO extends PageParam {
@Schema(description = "业务类型 用于业务关联", example = "1")
private String businessType;
@Schema(description = "业务文件类型", example = "1")
private String businessFileType;
@Schema(description = "业务id", example = "18052")
private Long businessId;

@ -19,6 +19,7 @@ public interface FileMapper extends BaseMapperX<FileDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<FileDO>()
.eqIfPresent(FileDO::getConfigId, reqVO.getConfigId())
.eqIfPresent(FileDO::getBusinessType, reqVO.getBusinessType())
.eqIfPresent(FileDO::getBusinessFileType, reqVO.getBusinessFileType())
.eqIfPresent(FileDO::getBusinessId, reqVO.getBusinessId())
.likeIfPresent(FileDO::getName, reqVO.getName())
.eqIfPresent(FileDO::getPath, reqVO.getPath())

@ -154,9 +154,11 @@
打印开发项目启动单
</el-dropdown-item>
<el-dropdown-item v-if="scope.row.orderStatus == 32" command="alter"></el-dropdown-item>
<el-dropdown-item v-if="scope.row.orderStatus == 32 && scope.row.deliveryStatus != 3" command="alter"></el-dropdown-item>
<el-dropdown-item command="viewArchive">查看归档日志</el-dropdown-item>
<el-dropdown-item v-if="scope.row.orderStatus == 32 && scope.row.deliveryStatus != 3" command="delivery"></el-dropdown-item>
<el-dropdown-item v-if="scope.row.deliveryStatus == 3" command="trialReport"></el-dropdown-item>
<el-dropdown-item v-if="scope.row.deliveryStatus == 3" command="confirmReport"></el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
@ -171,6 +173,13 @@
</el-card>
<!-- 打印启动单 - 弹框-->
<Print ref="printRef" />
<ReportDialog ref="reportRef"
:key="dialogKey"
:type="reportBusinessType"
:file-type="reportBusinessFileType"
:id="reportBusinessId"
:title="reportBusinessTitle" />
</template>
<script setup lang="ts">
@ -180,12 +189,14 @@ import download from '@/utils/download'
import * as ProjectOrderApi from '@/api/heli/projectorder'
import Print from './startprint.vue' //
import { ref } from 'vue'
import {useCommonStore} from "@/store/modules/common";
defineOptions({ name: 'ProjectOrder' })
const message = useMessage() //
const { t } = useI18n() //
const router = useRouter()
const commonStore = useCommonStore()
const loading = ref(true) //
const list = ref([]) //
@ -229,6 +240,18 @@ const queryParams = reactive({
const queryFormRef = ref() //
const exportLoading = ref(false) //
const reportRef = ref()
const reportBusinessType = ref('PROJECT_ORDER_REPORT')
const reportBusinessFileType = ref('')
const reportBusinessId = ref()
const reportBusinessTitle = ref('')
const reportKey = ref(0)
const dialogKey = ref(0)
const openReport = () => {
reportRef.value.open()
}
/** 查询列表 */
const getList = async () => {
loading.value = true
@ -321,6 +344,20 @@ const handleCommand = async (command, id, code) => {
}
})
break
case 'trialReport':
reportKey.value++
reportBusinessFileType.value = 'TRIAL_REPORT'
reportBusinessId.value = id
reportBusinessTitle.value = '试模报告'
openReport()
break
case 'confirmReport':
reportKey.value++
reportBusinessFileType.value = 'CONFIRM_REPORT'
reportBusinessId.value = id
reportBusinessTitle.value = '认可报告'
openReport()
break
}
}

@ -0,0 +1,180 @@
<template>
<Dialog :title="dialogTitle" width="80%" v-model="dialogVisible" @closed="beforeClose" center>
<el-card class="hl-card-info">
<el-row>
<el-col>
<el-card class="hl-incard">
<el-col>
<el-upload ref="uploadRef" :file-list="uploadFiles" multiple :action="uploadUrl" :headers="{
Authorization: 'Bearer ' + getAccessToken(),
'tenant-id': getTenantId()
}" name="files" :show-file-list="false" :auto-upload="false" :data="uploadData" :on-change="uploadChange" :on-error="handleError" :on-success="handleSuccess" :before-upload="before" class="upload-file-uploader">
<el-button type="primary">
<Icon icon="ep:upload-filled" />上传
</el-button>
</el-upload>
</el-col>
<el-table :data="formData.attachments" v-loading="tableLoading" class="hl-table">
<el-table-column fixed type="index" width="100" label="序号" align="center" />
<el-table-column prop="name" label="文件名称" align="center" />
<el-table-column prop="createTime" align="center" label="上传时间" :formatter="dateFormatter" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button link type="danger" size="small" @click="handleDeleteAttachment(scope.$index)">
删除
</el-button>
<el-button v-if="!!scope.row.id" link type="primary" size="small" @click="downloadAttachment(scope.row.name, scope.row.url)">
下载
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
</el-card>
<template #footer>
<el-button @click="dialogVisible=false" size="large"> </el-button>
<el-button @click="submitForm" type="success" size="large"> </el-button>
</template>
</Dialog>
</template>
<script setup lang="ts">
import {ref, toRefs} from "vue";
import {ElTable, UploadUserFile} from 'element-plus'
import {deleteFileLogic, downloadFile, getFilePage} from "@/api/infra/file";
import {getAccessToken, getTenantId} from "@/utils/auth";
import download from "@/utils/download";
import {dateFormatter} from "@/utils/formatTime";
const message = useMessage() //
const { t } = useI18n() //
const router = useRouter()
const dialogVisible = ref(false) //
const tableLoading = ref(false)
const loading = ref(true) //
const list = ref([]) //
const total = ref(0) //
const props = defineProps({
title: String,
id: Number,
type: String,
fileType: String
})
const businessId = toRefs(props).id
const businessType = toRefs(props).type
const businessFileType = toRefs(props).fileType
const dialogTitle = toRefs(props).title
watch(props, (newProps) => {
handleQuery()
})
const formData = ref({
attachments: []
})
const reset = () => {
formData.value = {
attachments: []
}
}
const uploading = ref(false)
const uploadUrl = ref(import.meta.env.VITE_UPLOAD_BATCH_URL)
const uploadRef = ref()
const uploadFiles = ref<UploadUserFile[]>([])
const uploadData = ref({
businessType: businessType?.value,
businessId: businessId?.value,
businessFileType: businessFileType?.value
})
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
if(uploadFiles.value.length > 0){
uploadData.value.businessId = businessId?.value
uploadData.value.businessFileType = businessFileType?.value
await uploadRef.value!.submit()
message.success(t('cropper.uploadSuccess'))
}
dialogVisible.value = false
}
//
const downloadAttachment = async (name, url) => {
const data = await downloadFile(url)
download.any(data, name)
}
const uploadChange = (file, files) => {
uploadFiles.value = files
refreshAttachments(files)
}
const refreshAttachments = (files) => {
formData.value.attachments = formData.value.attachments.filter((value, index, array) => {
return value.id
})
for (let i = 0; i < files.length; i++) {
let file = files[i]
file.businessFileType = businessFileType?.value
file.createTime = new Date()
formData.value.attachments.push(file)
}
//
formData.value.attachments.sort((v1, v2) => v1.createTime - v2.createTime)
}
//
const handleDeleteAttachment = async (index) => {
const deletedAttachments = formData.value.attachments.splice(index, 1)
for (let i = 0; i < deletedAttachments.length; i++) {
const attachment = deletedAttachments[i]
if (attachment.id) {
//
await deleteFileLogic(attachment.id)
}
//
uploadFiles.value = uploadFiles.value.filter((file1) => {
return file1.name != attachment.name
})
}
}
const handleQuery = async () => {
tableLoading.value = true
reset()
try {
//
let attParams = {
pageNo: 1,
pageSize: 99,
businessId: businessId?.value,
businessType: businessType?.value,
businessFileType: businessFileType?.value
}
formData.value.attachments = (await getFilePage(attParams)).list
}finally {
tableLoading.value = false
}
}
const beforeClose = () => {
}
/** 打开弹窗 */
const open = async () => {
dialogVisible.value = true
handleQuery()
}
defineExpose({ open }) // open
</script>
Loading…
Cancel
Save