修改 上传多个文件
This commit is contained in:
@@ -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) => {
|
||||
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) {
|
||||
const subForm = JSON.parse(JSON.stringify(form.value))
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user