Merge pull request 'feat : 项目立项, 阶段变更zip下载' (#909) from dj into master
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/909
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
import request from '@/utils/request.js'
|
import request from '@/utils/request.js'
|
||||||
|
import axios from "axios";
|
||||||
|
import {getToken} from "@/utils/auth";
|
||||||
|
|
||||||
//需求征集
|
//需求征集
|
||||||
export const getDemandInfo = (param) => {
|
export const getDemandInfo = (param) => {
|
||||||
return request({
|
return request({
|
||||||
@@ -104,3 +107,22 @@ export const downloadTemplate = (type) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
export const downloadTemplateZip = (typeList) => {
|
||||||
|
return axios.get(
|
||||||
|
`${import.meta.env.VITE_BASE_URL}/workflow/mosr/attachment/download/pack?typeList=${typeList}`,
|
||||||
|
{
|
||||||
|
responseType: 'blob',
|
||||||
|
headers: {
|
||||||
|
Authorization: getToken()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// return request({
|
||||||
|
// url: '/workflow/mosr/attachment/download/pack',
|
||||||
|
// method: "get",
|
||||||
|
// responseType:'blob',
|
||||||
|
// params:{
|
||||||
|
// typeList:typeList
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
};
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
<script setup lang="jsx">
|
<script setup lang="jsx">
|
||||||
import FileUpload from '@/components/FileUpload.vue'
|
import FileUpload from '@/components/FileUpload.vue'
|
||||||
import {deleteFile, downloadFile, downloadTemplate} from "@/api/project-demand";
|
import {deleteFile, downloadFile, downloadTemplate, downloadTemplateZip} from "@/api/project-demand";
|
||||||
import {ElMessageBox, ElNotification} from "element-plus";
|
import {ElMessageBox, ElNotification} from "element-plus";
|
||||||
|
|
||||||
|
|
||||||
@@ -355,25 +355,42 @@ watch(() => isHaveOneFile.value, (newVal) => {
|
|||||||
// }, {deep: true})
|
// }, {deep: true})
|
||||||
|
|
||||||
|
|
||||||
const handleImportTemplateDownload = () => {
|
const handleImportTemplateDownload = async () => {
|
||||||
console.info("🚀 ~method:handleImportTemplateDownload -----", props.tag)
|
console.info("🚀 ~method:handleImportTemplateDownload -----", props.tag)
|
||||||
let templateType = ''
|
let templateType = ''
|
||||||
|
let templateTypeList = ''
|
||||||
|
let isZip = false
|
||||||
if (props.tag === '需求上报') {
|
if (props.tag === '需求上报') {
|
||||||
templateType = '2'
|
templateType = '2'
|
||||||
|
isZip = false
|
||||||
} else if (props.tag === '项目立项') {
|
} else if (props.tag === '项目立项') {
|
||||||
templateType = '5'
|
templateTypeList = '5,6'
|
||||||
|
isZip = true
|
||||||
} else if (props.tag === '项目验收') {
|
} else if (props.tag === '项目验收') {
|
||||||
templateType = '7'
|
templateType = '7'
|
||||||
}else if (props.tag === '阶段变更') {
|
isZip = false
|
||||||
templateType = '8'
|
} else if (props.tag === '阶段变更') {
|
||||||
|
templateTypeList = '8,9'
|
||||||
|
isZip = true
|
||||||
}
|
}
|
||||||
downloadTemplate(templateType).then(res => {
|
let res = ''
|
||||||
const blob = new Blob([res])
|
if (isZip) {
|
||||||
let a = document.createElement('a')
|
res = await downloadTemplateZip(templateTypeList)
|
||||||
a.href = URL.createObjectURL(blob)
|
let fileName = props.templateName +'.zip'
|
||||||
a.download = props.templateName + ".docx"
|
const blob = new Blob([res.data])
|
||||||
a.click()
|
let a = document.createElement('a')
|
||||||
})
|
a.href = URL.createObjectURL(blob)
|
||||||
|
a.download = fileName
|
||||||
|
a.click()
|
||||||
|
} else {
|
||||||
|
res = await downloadTemplate(templateType)
|
||||||
|
const blob = new Blob([res])
|
||||||
|
let a = document.createElement('a')
|
||||||
|
a.href = URL.createObjectURL(blob)
|
||||||
|
a.download = props.templateName + ".docx"
|
||||||
|
a.click()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ const filePreviewShow = ref(false)
|
|||||||
const getTemplateName=(type)=>{
|
const getTemplateName=(type)=>{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'apply':
|
case 'apply':
|
||||||
return '科技创新项目立项申请表'
|
return '科技创新项目立项模板'
|
||||||
case 'check':
|
case 'check':
|
||||||
return '科技创新项目验收申请表'
|
return '科技创新项目验收申请表'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<user-picker :multiple="true" ref="userPicker" title="请选择抄送人员" v-model:value="userList"
|
<user-picker :multiple="true" ref="userPicker" title="请选择抄送人员" v-model:value="userList"
|
||||||
@ok="ccPersonPickerOkOrCancel" @cancelOrClear="ccPersonPickerOkOrCancel"/>
|
@ok="ccPersonPickerOkOrCancel" @cancelOrClear="ccPersonPickerOkOrCancel"/>
|
||||||
<AttachmentUpload ref="attachment" label="阶段变更附件" :showTable="showTable" v-model:otherFileList="otherFileList" templateName="科技创新项目变更申请表" :templateDownloadBtnShow="true"
|
<AttachmentUpload ref="attachment" label="阶段变更附件" :showTable="showTable" v-model:otherFileList="otherFileList" templateName="科技创新项目变更模板" :templateDownloadBtnShow="true"
|
||||||
@getAttachment="getAttachment" v-model:singleList="singleList" :showSingleTable="showSingleTable"
|
@getAttachment="getAttachment" v-model:singleList="singleList" :showSingleTable="showSingleTable"
|
||||||
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" tag="阶段变更"
|
@getOtherFile="getOtherFile" :showFileList="true" :formData="formData" tag="阶段变更"
|
||||||
:preview="name === 'Phase/edit'"/>
|
:preview="name === 'Phase/edit'"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user