修改 上传多个文件

This commit is contained in:
GGJ
2024-08-20 16:22:46 +08:00
parent c952a2fc70
commit a6ab528220
7 changed files with 152 additions and 78 deletions

View File

@@ -386,7 +386,9 @@ body,
.bjs-powered-by {
display: none;
}
.el-select__wrapper{
height: 32px !important;
}
@font-face {
font-family: 'AlimamaFangYuanTiVF';
src: url('../assets/font/ali/AlimamaFangYuanTiVF-Thin.woff') format('woff'),

View File

@@ -74,6 +74,22 @@
</template>
</el-upload>
</el-form-item>
<el-form-item for="-" class="uploadFile" label="其他报告:">
<el-upload
ref="upload1Ref"
v-model:file-list="form.otherReport"
action=""
:accept="acceptType"
:on-exceed="handleExceed1"
:on-change="event => choose(event, 'otherReport')"
:auto-upload="false"
:on-progress="uploadFileName('otherReport')"
>
<template #trigger>
<el-button type="primary">上传文件</el-button>
</template>
</el-upload>
</el-form-item>
<el-form-item
style="width: 100%"
@@ -128,6 +144,7 @@ const form: any = ref({
completeTime: '',
completeBy: '',
testReport: [],
otherReport: [],
supervisionReport: [],
problemDetail: '', //测试问题
problemFlag: 0 //是否有问题
@@ -159,6 +176,7 @@ const open = async (text: string, id: string, addFlag: boolean) => {
form.value.completeTime = ''
form.value.completeBy = ''
form.value.testReport = []
form.value.otherReport = []
form.value.supervisionReport = []
form.value.problemDetail = ''
form.value.problemFlag = 0
@@ -187,9 +205,31 @@ const open = async (text: string, id: string, addFlag: boolean) => {
name: res.data.supervisionReport.split('/')[2]
}
],
// otherReport:
// res.data.otherReport == null
// ? []
// : [
// {
// name: res.data.otherReport.split('/')[2]
// }
// ],
problemDetail: res.data.problemDetail
}
form.value.otherReport = []
if (res.data.otherReport != null) {
console.log("🚀 ~ awaitgetTestById ~ form.value:", form.value)
for (let i = 0; i < res.data.otherReport.split(',').length.length; i++) {
form.value.otherReport.push({
name: res.data.otherReport.split(',')[i]
})
}
}
testReport.value = res.data.testReport
otherReport.value = res.data.otherReport
supervisionReport.value = res.data.supervisionReport
}
})
@@ -199,6 +239,7 @@ const open = async (text: string, id: string, addFlag: boolean) => {
//处理成效报告
const testReport = ref('')
const otherReport = ref('')
const supervisionReport = ref('')
const formRef = ref()
@@ -206,6 +247,7 @@ const rules = {
completeTime: [{ required: true, message: '选择实际完成时间 ', trigger: 'change' }],
completeBy: [{ required: true, message: '请输入测试负责人', trigger: 'blur' }],
testReport: [{ required: true, message: '请上传文件', trigger: 'change' }],
otherReport: [{ required: true, message: '请上传文件', trigger: 'change' }],
supervisionReport: [{ required: true, message: '请上传文件', trigger: 'change' }],
problemFlag: [{ required: true, message: '请选择测试是否有问题', trigger: 'change' }],
problemDetail: [{ required: true, message: '请输入测试问题', trigger: 'blur' }]
@@ -217,9 +259,19 @@ const cancelFn = () => {
// 提交
const submitFn = (flag: boolean) => {
if (flag) {
const subForm = JSON.parse(JSON.stringify(form.value))
subForm.otherReport = ''
if (form.value.otherReport.length > 0) {
form.value.otherReport.forEach((item: any) => {
// + '/supervision/'
subForm.otherReport = subForm.otherReport + item.name + ','
})
}
if (flag) {
subForm.testReport = testReport.value
// subForm.otherReport = otherReport.value
subForm.supervisionReport = supervisionReport.value
subForm.saveOrCheckflag = '1'
@@ -238,6 +290,7 @@ const submitFn = (flag: boolean) => {
type: 'warning'
})
}
if (!supervisionReport.value) {
return ElMessage({
message: '请上传技术监督报告!',
@@ -245,8 +298,8 @@ const submitFn = (flag: boolean) => {
})
}
if (valid) {
const subForm = JSON.parse(JSON.stringify(form.value))
subForm.testReport = testReport.value
// subForm.otherReport = otherReport.value
subForm.supervisionReport = supervisionReport.value
subForm.saveOrCheckflag = '2'
if (addFlagRef.value) {
@@ -292,6 +345,11 @@ const choose = (e: any, text: string) => {
uploadFile(e.raw, '/supervision/').then(res => {
testReport.value = res.data.name
})
}
if (text == 'otherReport') {
uploadFile(e.raw, '/supervision/').then(res => {
otherReport.value = res.data.name
})
} else {
uploadFile(e.raw, '/supervision/').then(res => {
supervisionReport.value = res.data.name

View File

@@ -59,6 +59,12 @@
</el-icon>
<a :href="detailData.testReport" target="_blank">{{ detailData.testReportName }}</a>
</el-descriptions-item>
<el-descriptions-item :span="2" label="其他报告">
<el-icon class="elView" v-if="detailData?.otherReportName">
<View @click="openFile(detailData?.otherReportName)" />
</el-icon>
<a :href="detailData.otherReport" target="_blank">{{ detailData.otherReportName }}</a>
</el-descriptions-item>
<!-- <el-descriptions-item label="流程状态" >
<el-tag :type="getDeviceStatusType(detailData?.status)">
@@ -108,6 +114,10 @@ const getFileData = async () => {
detailData.value.testReport = res.data.url
detailData.value.testReportName = res.data.fileName
})
await getFileNameAndFilePath({ filePath: detailData.value.otherReport }).then(res => {
detailData.value.otherReport = res.data.url
detailData.value.otherReportName = res.data.fileName
})
await getFileNameAndFilePath({ filePath: detailData.value.supervisionReport }).then(res => {
detailData.value.supervisionReport = res.data.url
detailData.value.supervisionReportName = res.data.fileName

View File

@@ -1544,4 +1544,5 @@ defineExpose({ open, filterUsers })
width: 250px;
text-align: left;
}
</style>

View File

@@ -1375,6 +1375,7 @@ const uploadFileName = val => {
const removeFile = (file: any, uploadFiles: any) => {
console.log(file, uploadFiles)
}
// 终端台账信息
const deviceFilePath = ref('')
//验收检验报告单
@@ -1431,12 +1432,12 @@ const choose = (e: any) => {
const disabledDate = time => {
return time.getTime() < Date.now() - 8.64e7 // 8.64e7 毫秒数代表一天
}
const importType = ref(0)
const importType = ref(null)
const resendId = ref('')
const open = async (row: any) => {
console.log("🚀 ~ open ~ row:", row.row)
console.log('🚀 ~ open ~ row:', row.row)
let flag = row.row ? true : false
importType.value = 0
importType.value = null
if (!flag) await getPowerCompanyList(false)
title.value = row.title
dialogFormVisible.value = true
@@ -1517,6 +1518,7 @@ const confirmForm = async (flag: boolean) => {
confirmFormData.saveOrCheckflag = '1'
confirmFormData.reporter = adminInfo.$state.id
confirmFormData.orgId = adminInfo.$state.deptId
confirmFormData.importType = importType.value
confirmFormData.supervisionTempDeviceReportParam.commissioningTime =
confirmFormData?.supervisionTempDeviceReportParam?.commissioningTime?.replace('T', ' ') || ''
@@ -1564,6 +1566,7 @@ const confirmForm = async (flag: boolean) => {
otherAttachments: form.value.otherAttachments.length == 0 ? '' : otherAttachments?.value //其他附件
}
confirmFormData.saveOrCheckflag = '2'
confirmFormData.importType = importType.value
if (title.value == '终端信息') {
addTerminalFormData(confirmFormData).then((res: any) => {
if (res.code == 'A0000') {

View File

@@ -191,59 +191,85 @@
<el-descriptions-item label="合同号">
{{ detailData.supervisionTempDeviceReport?.contractNumber }}
</el-descriptions-item>
<el-descriptions-item label="信息安全检测报告" v-if="detailData?.informationSecurityTestReport">
<el-descriptions-item label="信息安全检测报告">
<el-icon class="elView" v-if="detailData?.informationSecurityTestReport?.name">
<View @click="openFile(detailData?.informationSecurityTestReport?.name)" />
</el-icon>
<a target="_blank" :href="detailData?.informationSecurityTestReport.url">
<a
target="_blank"
:href="detailData?.informationSecurityTestReport?.url"
v-if="detailData?.informationSecurityTestReport?.name"
>
{{ detailData?.informationSecurityTestReport.name }}
</a>
</el-descriptions-item>
<el-descriptions-item label="验收检验报告单" v-if="detailData?.acceptanceInspectionReportSingle">
<el-descriptions-item label="验收检验报告单">
<el-icon class="elView" v-if="detailData?.acceptanceInspectionReportSingle?.name">
<View @click="openFile(detailData?.acceptanceInspectionReportSingle?.name)" />
</el-icon>
<a target="_blank" :href="detailData?.acceptanceInspectionReportSingle.url">
{{ detailData?.acceptanceInspectionReportSingle.name }}
<a
target="_blank"
:href="detailData?.acceptanceInspectionReportSingle?.url"
v-if="detailData?.acceptanceInspectionReportSingle?.name"
>
{{ detailData?.acceptanceInspectionReportSingle?.name }}
</a>
</el-descriptions-item>
<el-descriptions-item label="验收检验报告" v-if="detailData?.acceptanceInspectionReport">
<el-descriptions-item label="验收检验报告">
<el-icon class="elView" v-if="detailData?.acceptanceInspectionReport?.name">
<View @click="openFile(detailData?.acceptanceInspectionReport?.name)" />
</el-icon>
<a target="_blank" :href="detailData?.acceptanceInspectionReport.url">
{{ detailData?.acceptanceInspectionReport.name }}
<a
target="_blank"
:href="detailData?.acceptanceInspectionReport?.url"
v-if="detailData?.acceptanceInspectionReport?.name"
>
{{ detailData?.acceptanceInspectionReport?.name }}
</a>
</el-descriptions-item>
<el-descriptions-item label="型式实验报告" v-if="detailData?.typeExperimentReport">
<el-icon class="elView" v-if="detailData?.typeExperimentReport.name">
<View @click="openFile(detailData?.typeExperimentReport.name)" />
<el-descriptions-item label="型式实验报告">
<el-icon class="elView" v-if="detailData?.typeExperimentReport?.name">
<View @click="openFile(detailData?.typeExperimentReport?.name)" />
</el-icon>
<a target="_blank" :href="detailData?.typeExperimentReport.url">
{{ detailData?.typeExperimentReport.name }}
<a
target="_blank"
v-if="detailData?.typeExperimentReport?.name"
:href="detailData?.typeExperimentReport?.url"
>
{{ detailData?.typeExperimentReport?.name }}
</a>
</el-descriptions-item>
<el-descriptions-item label="出厂检验报告" v-if="detailData?.factoryInspectionReport">
<el-icon class="elView" v-if="detailData?.factoryInspectionReport.name">
<View @click="openFile(detailData?.factoryInspectionReport.name)" />
<el-descriptions-item label="出厂检验报告">
<el-icon class="elView" v-if="detailData?.factoryInspectionReport?.name">
<View @click="openFile(detailData?.factoryInspectionReport?.name)" />
</el-icon>
<a target="_blank" :href="detailData?.factoryInspectionReport.url">
{{ detailData?.factoryInspectionReport.name }}
<a
target="_blank"
:href="detailData?.factoryInspectionReport?.url"
v-if="detailData?.factoryInspectionReport?.name"
>
{{ detailData?.factoryInspectionReport?.name }}
</a>
</el-descriptions-item>
<el-descriptions-item label="性能检测报告" v-if="detailData?.performanceTestReport">
<el-icon class="elView" v-if="detailData?.performanceTestReport.name">
<View @click="openFile(detailData?.performanceTestReport.name)" />
<el-descriptions-item label="性能检测报告">
<el-icon class="elView" v-if="detailData?.performanceTestReport?.name">
<View @click="openFile(detailData?.performanceTestReport?.name)" />
</el-icon>
<a target="_blank" :href="detailData?.performanceTestReport.url">
{{ detailData?.performanceTestReport.name }}
<a
target="_blank"
:href="detailData?.performanceTestReport?.url"
v-if="detailData?.performanceTestReport?.name"
>
{{ detailData?.performanceTestReport?.name }}
</a>
</el-descriptions-item>
<el-descriptions-item label="其他附件" v-if="detailData?.otherAttachments">
<el-icon class="elView" v-if="detailData?.otherAttachments.name">
<View @click="openFile(detailData?.otherAttachments.name)" />
<el-descriptions-item label="其他附件">
<el-icon class="elView" v-if="detailData?.otherAttachments?.name">
<View @click="openFile(detailData?.otherAttachments?.name)" />
</el-icon>
<a target="_blank" :href="detailData?.otherAttachments.url">{{ detailData?.otherAttachments.name }}</a>
<a target="_blank" :href="detailData?.otherAttachments?.url" v-if="detailData?.otherAttachments?.name">
{{ detailData?.otherAttachments?.name }}
</a>
</el-descriptions-item>
</el-descriptions>
</template>

View File

@@ -122,43 +122,6 @@ const tableStore = new TableStore({
4: '已取消'
}
},
// { field: 'substation', title: '所属变电站', minWidth: 170 },
// {
// field: 'userType',
// title: '用户性质',
// minWidth: 150,
// formatter: (obj: any) => {
// const userType = obj.row.userType
// return getUserTypeName(userType)
// }
// },
// { field: 'informationSecurityTestReport', title: '信息安全检测报告', minWidth: 170 },
// { field: 'otherAttachments', title: '其他附件', minWidth: 170 },
// { field: 'orgName', title: '填报部门名称'},
// { field: 'performanceTestReport', title: '性能检测报告', minWidth: 170 },
// {
// field: 'userStatus',
// title: '用户状态',
// minWidth: 100,
// render: 'tag',
// custom: {
// 0: 'primary',
// 1: 'primary',
// 2: 'success',
// 3: 'warning'
// },
// replaceValue: {
// 0: '可研',
// 1: '建设',
// 2: '运行',
// 3: '退运'
// }
// },
// { field: 'substation', title: '变电站', minWidth: 100 },
// { field: 'createTime', title: '开始时间', minWidth: 170 },
{
title: '操作',
minWidth: 150,
@@ -172,18 +135,29 @@ const tableStore = new TableStore({
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return row.importType == 1 ? false : !row.processInstanceId
return row.importType != null || !row.processInstanceId
},
click: row => {
if (row.importType == 1) {
userId.value = row.id
dialogShow.value = true
} else {
flag.value = true
handleAudit(row.processInstanceId, row.historyInstanceId)
}
},
{
name: 'productSetting',
title: '详情',
type: 'primary',
icon: 'el-icon-EditPen',
render: 'basicButton',
disabled: row => {
return row.importType != 1
},
click: row => {
userId.value = row.id
dialogShow.value = true
}
},
{
name: 'edit',
title: '编辑',