139 lines
3.6 KiB
Vue
139 lines
3.6 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-col :span="24">
|
|
<el-form-item label="项目验收附件" prop="attachment">
|
|
<file-upload @getFile="getAttachment" :showFileList="true"/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="24">
|
|
<el-form-item label="其他文件">
|
|
<el-card style="width: 100%">
|
|
<file-upload @getFile="getOtherFile" :showFileList="true"/>
|
|
<fvTable style="width: 100%;max-height: 250px" v-if="showTable" :tableConfig="tableConfig"
|
|
:data="otherFileList" :isSettingCol="false" :pagination="false">
|
|
<template #empty>
|
|
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
|
|
</template>
|
|
</fvTable>
|
|
</el-card>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<div class="oper-page-btn">
|
|
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="jsx">
|
|
import FileUpload from "@/components/FileUpload.vue";
|
|
|
|
const formData = ref({})
|
|
const rules = reactive({
|
|
attachment: [{required: true, message: '请上传项目立项附件', trigger: 'blur'}],
|
|
})
|
|
const fileList = ref(null)
|
|
const applyForm = ref()
|
|
const showTable = ref(true)
|
|
const otherFileList = ref([])
|
|
const tableConfig = reactive({
|
|
columns: [
|
|
{
|
|
prop: 'index',
|
|
type: 'index',
|
|
label: '序号',
|
|
align: 'center',
|
|
width: '80',
|
|
},
|
|
{
|
|
prop: 'originalFileName',
|
|
label: '文件名',
|
|
align: 'center',
|
|
},
|
|
{
|
|
prop: 'tag',
|
|
label: '标签',
|
|
align: 'center'
|
|
},
|
|
{
|
|
prop: 'size',
|
|
label: '文件大小',
|
|
align: 'center',
|
|
currentRender: ({row, index}) => (parseInt(row.size / 1024) + 'KB')
|
|
},
|
|
{
|
|
prop: 'oper',
|
|
label: '操作',
|
|
align: 'center',
|
|
currentRender: ({row, index}) => {
|
|
return (
|
|
<div>
|
|
<a style="cursor: pointer;font-size: 14px;color: #2a99ff;" href={row.url}>下载</a>
|
|
<el-button type="primary" size="large" link onClick={() => beforeRemove(row)}>删除</el-button>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
]
|
|
})
|
|
|
|
const compositeParam = (item) => {
|
|
return {
|
|
fileId: item.id,
|
|
size: item.size,
|
|
originalFileName: item.originalFilename,
|
|
fileType: item.fileType,
|
|
url: item.url,
|
|
processNodeTag: null,
|
|
tag: formData.value.collectType
|
|
}
|
|
}
|
|
const getAttachment = (val) => {
|
|
console.log('上传文件', val)
|
|
showTable.value = false
|
|
nextTick(() => {
|
|
showTable.value = true
|
|
})
|
|
let fileObj = {}
|
|
let newFileArray = []
|
|
if (route.query.isAdd === undefined) {
|
|
val.forEach(item => {
|
|
fileObj = compositeParam(item)
|
|
newFileArray.push(fileObj)
|
|
formData.value.fileList.push(fileObj)
|
|
})
|
|
fileList.value = formData.value.fileList
|
|
} else {
|
|
val.forEach(item => {
|
|
fileObj = compositeParam(item)
|
|
newFileArray.push(fileObj)
|
|
})
|
|
formData.value.fileList = newFileArray
|
|
fileList.value = newFileArray
|
|
}
|
|
}
|
|
const getOtherFile = () => {
|
|
|
|
}
|
|
const handleSubmit = (instance) => {
|
|
if (!instance) return
|
|
instance.validate(async (valid) => {
|
|
if (!valid) return
|
|
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style>
|