Files
mosr-web/src/views/project-management/implementation/check.vue
2024-05-19 18:00:48 +08:00

105 lines
2.7 KiB
Vue

<template>
<div class="apply-block">
<el-form :model="formData" ref="applyForm" label-width="auto" :rules="rules">
<baseTitle title="项目验收"></baseTitle>
<el-row>
<el-col :span="12">
<el-form-item label="前置流程">
<el-input v-model="formData.requirementName" clearable></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<AttachmentUpload label="项目验收附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true"/>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
</div>
</div>
</template>
<script setup lang="jsx">
const formData = ref({})
const fileList = ref(null)
const applyForm = ref()
const showTable = ref(true)
const otherFileList = ref([])
const compositeParam = (item) => {
let tag=''
if(router.currentRoute.value.name==='Implementation/check'){
tag='项目验收'
}
return {
fileId: item.id,
size: item.size,
originalFileName: item.originalFilename,
fileType: item.fileType,
url: item.url,
processNodeTag: null,
tag: tag
}
}
const getAttachment = (val) => {
console.log('上传文件getAttachment', val)
let fileObj = compositeParam(val, 1)
fileList.value.push(fileObj)
}
const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val)
showTable.value = false
let fileObj = compositeParam(val, 2)
otherFileList.value.push(fileObj)
nextTick(() => {
showTable.value = true
})
}
const getFileParam = (item) => {
return {
fileId: item.fileId,
type: item.type
}
}
const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
if(fileList.value.length===0){
applyForm.value.validate()
}else {
applyForm.value.clearValidate()
}
if (!valid) return
let files = []
fileList.value.forEach(item => {
files.push(getFileParam(item))
})
otherFileList.value.forEach(item => {
files.push(getFileParam(item))
})
let params = {
// deploymentId: deploymentId.value,
files: files
}
console.log('params',params)
// let res = await requirementReported(params)
// ElNotification({
// title: '提示',
// message: res.msg,
// type: res.code === 1000 ? 'success' : 'error'
// })
// if (res.code === 1000) {
// tagsViewStore.delVisitedViews(router.currentRoute.value.path)
// await router.push({
// name: 'Summary'
// })
// }
})
}
</script>
<style scoped>
</style>