feat : "需求上报, 项目立项, 项目验收, 阶段变更, 专项资金" 上传文件旁边加上模板下载功能
This commit is contained in:
@@ -94,3 +94,13 @@ export const getRequirementStatePerm = () => {
|
||||
method: "get"
|
||||
});
|
||||
};
|
||||
export const downloadTemplate = (type) => {
|
||||
return request({
|
||||
url: '/workflow/mosr/attachment/download/template',
|
||||
method: "get",
|
||||
responseType:'blob',
|
||||
params:{
|
||||
type:type
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
<el-col :span="24">
|
||||
<el-form-item :label="label" prop="" required>
|
||||
<file-upload @getFile="getOtherFile"/>
|
||||
<el-button color="#DED0B2" v-if="templateDownloadBtnShow" @click="handleImportTemplateDownload"
|
||||
style="margin-left: 10px">模板下载
|
||||
</el-button>
|
||||
<fvTable style="width: 100%;max-height: 160px;" v-if="showTable" height="160" :tableConfig="tableConfig"
|
||||
:data="allFileList" :isSettingCol="false" :pagination="false">
|
||||
<template #empty>
|
||||
@@ -34,13 +37,14 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<file-preview ref="filePreviewRef" v-if="filePreviewShow" :fileName="filePreviewParam.fileName" :fileUrl="filePreviewParam.fileUrl"
|
||||
<file-preview ref="filePreviewRef" v-if="filePreviewShow" :fileName="filePreviewParam.fileName"
|
||||
:fileUrl="filePreviewParam.fileUrl"
|
||||
:fileType="filePreviewParam.fileType"/>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import FileUpload from '@/components/FileUpload.vue'
|
||||
import {deleteFile, downloadFile} from "@/api/project-demand";
|
||||
import {deleteFile, downloadFile, downloadTemplate} from "@/api/project-demand";
|
||||
import {ElMessageBox, ElNotification} from "element-plus";
|
||||
|
||||
|
||||
@@ -65,6 +69,16 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
//是否显示模板下载按钮
|
||||
templateDownloadBtnShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
//模板下载时的文件名
|
||||
templateName: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
singleList: {
|
||||
type: Array,
|
||||
default: []
|
||||
@@ -103,7 +117,8 @@ const baseTableConf = reactive(
|
||||
align: 'center',
|
||||
width: 400,
|
||||
currentRender: ({row, index}) => (
|
||||
<div style="color: #2a99ff;cursor: pointer;" onClick={() => clickToPreview(row)}>{row.originalFileName}</div>)
|
||||
<div style="color: #2a99ff;cursor: pointer;"
|
||||
onClick={() => clickToPreview(row)}>{row.originalFileName}</div>)
|
||||
},
|
||||
{
|
||||
prop: 'tag',
|
||||
@@ -340,6 +355,26 @@ watch(() => isHaveOneFile.value, (newVal) => {
|
||||
// }, {deep: true})
|
||||
|
||||
|
||||
const handleImportTemplateDownload = () => {
|
||||
console.info("🚀 ~method:handleImportTemplateDownload -----", props.tag)
|
||||
let templateType = ''
|
||||
if (props.tag === '需求上报') {
|
||||
templateType = '2'
|
||||
} else if (props.tag === '项目立项') {
|
||||
templateType = '5'
|
||||
} else if (props.tag === '项目验收') {
|
||||
templateType = '7'
|
||||
}else if (props.tag === '阶段变更') {
|
||||
templateType = '8'
|
||||
}
|
||||
downloadTemplate(templateType).then(res => {
|
||||
const blob = new Blob([res])
|
||||
let a = document.createElement('a')
|
||||
a.href = URL.createObjectURL(blob)
|
||||
a.download = props.templateName + ".docx"
|
||||
a.click()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const clickToPreview = (row) => {
|
||||
@@ -357,7 +392,6 @@ const clickToPreview = (row) => {
|
||||
}
|
||||
|
||||
|
||||
|
||||
const handleDelete = (row, type) => {
|
||||
deleteFile(row.fileId).then(res => {
|
||||
ElNotification({
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
</el-form>
|
||||
<!-- v-if="showAttachment"-->
|
||||
<AttachmentUpload ref="attachment" :label="getTitleName(title)+'附件'" :showTable="showTable"
|
||||
v-model:otherFileList="otherFileList" :tag="getTitleName(props.title)"
|
||||
v-model:otherFileList="otherFileList" :tag="getTitleName(props.title)" :templateName="getTemplateName(props.title)" :templateDownloadBtnShow="props.title==='apply'?true:props.title==='check'"
|
||||
@getAttachment="getAttachment" v-model:singleList="singleList" :showSingleTable="showSingleTable"
|
||||
@getOtherFile="getOtherFile" :showFileList="true" :formData="localFormData"
|
||||
:preview="mode == 'resubmit'"/>
|
||||
@@ -250,6 +250,16 @@ const filePreviewParam = ref({
|
||||
fileType: 'pdf'
|
||||
})
|
||||
const filePreviewShow = ref(false)
|
||||
|
||||
const getTemplateName=(type)=>{
|
||||
switch (type) {
|
||||
case 'apply':
|
||||
return '科技创新项目立项申请表'
|
||||
case 'check':
|
||||
return '科技创新项目验收申请表'
|
||||
}
|
||||
}
|
||||
|
||||
const handleShowOptionalChargeLeadershipPicker = () => {
|
||||
optionalChargeLeadershipPickerRef.value.showUserPicker()
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@
|
||||
<baseTitle title="附件文件"></baseTitle>
|
||||
<div :style="{marginRight:!formData.isSpecialFund?'20px':'80px'}">
|
||||
<AttachmentUpload ref="attachment" label="需求申请书附件"
|
||||
:showTable="showTable"
|
||||
:showTable="showTable" templateName="科技创新项目需求申请书" :templateDownloadBtnShow="true"
|
||||
v-model:otherFileList="otherFileList"
|
||||
@getOtherFile="getOtherFile"
|
||||
:showSingleTable="showSingleTable" @getAttachment="getAttachment"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</el-form>
|
||||
<user-picker :multiple="true" ref="userPicker" title="请选择抄送人员" v-model:value="userList"
|
||||
@ok="ccPersonPickerOkOrCancel" @cancelOrClear="ccPersonPickerOkOrCancel"/>
|
||||
<AttachmentUpload ref="attachment" label="阶段变更附件" :showTable="showTable" v-model:otherFileList="otherFileList"
|
||||
<AttachmentUpload ref="attachment" label="阶段变更附件" :showTable="showTable" v-model:otherFileList="otherFileList" templateName="科技创新项目变更申请表" :templateDownloadBtnShow="true"
|
||||
@getAttachment="getAttachment" v-model:singleList="singleList" :showSingleTable="showSingleTable"
|
||||
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" tag="阶段变更"
|
||||
:preview="name === 'Phase/edit'"/>
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
</el-row>
|
||||
</el-form>
|
||||
<baseTitle title="附件文件" style="margin-right: 10px"></baseTitle>
|
||||
<div style="display:flex;">
|
||||
<file-upload @getFile="getFile"/>
|
||||
<el-button color="#DED0B2" @click="handleImportTemplateDownload" style="margin-left: 10px">模板下载</el-button>
|
||||
</div>
|
||||
|
||||
<fvTable style="width: 100%;max-height: 160px;" v-if="showTable"
|
||||
:tableConfig="tableConfig" height="160" :data="formData.files"
|
||||
@@ -84,7 +87,7 @@ import {addFund, resubmitFund, getFundDetail, getFundDetailProcess, getFundProce
|
||||
import {useRouter} from "vue-router";
|
||||
import {useTagsView} from '@/stores/tagsview.js'
|
||||
import {useProcessStore} from '@/stores/processStore.js';
|
||||
import {downloadFile, deleteFile} from "@/api/project-demand";
|
||||
import {downloadFile, deleteFile,downloadTemplate} from "@/api/project-demand";
|
||||
|
||||
const changeDiagram = ref(false)
|
||||
const tagsViewStore = useTagsView()
|
||||
@@ -161,6 +164,18 @@ const filePreviewParam = ref({
|
||||
fileType: 'pdf'
|
||||
})
|
||||
const filePreviewShow = ref(false)
|
||||
|
||||
|
||||
const handleImportTemplateDownload=()=>{
|
||||
downloadTemplate('13').then(res => {
|
||||
const blob = new Blob([res])
|
||||
let a = document.createElement('a')
|
||||
a.href = URL.createObjectURL(blob)
|
||||
a.download = '科技创新项目专项资金任务书.docx'
|
||||
a.click()
|
||||
})
|
||||
}
|
||||
|
||||
const clickToPreview = (row) => {
|
||||
filePreviewShow.value = false
|
||||
filePreviewParam.value = {
|
||||
|
||||
Reference in New Issue
Block a user