fix : 修复项目申请/验收/结项功能

This commit is contained in:
2024-05-19 20:39:54 +08:00
parent 4a90f4bc1e
commit 1f4389eb5e
10 changed files with 409 additions and 122 deletions

View File

@@ -2,26 +2,13 @@
<div class="apply-block">
<el-form :model="formData" ref="applyForm" label-width="auto" :rules="rules">
<baseTitle title="项目结项"></baseTitle>
<el-row>
<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>
<AttachmentUpload label="项目结项附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true"/>
<div class="approval-record">
<baseTitle title="流程"></baseTitle>
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
</div>
</el-form>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
@@ -30,17 +17,26 @@
</template>
<script setup lang="jsx">
import FileUpload from "@/components/FileUpload.vue";
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {downloadFile} from "@/api/project-demand";
import { ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js';
import {getProjectConclusionProcess, projectConclusion} from "@/api/project-manage";
const formData = ref({})
const rules = reactive({
attachment: [{required: true, message: '请上传项目结项附件', trigger: 'blur'}],
})
const fileList = ref(null)
const fileList = ref([])
const applyForm = ref()
const deploymentId = ref()
const showTable = ref(true)
const otherFileList = ref([])
const processInstanceData = ref()
const processDiagramViewer = ref(true)
const processStore = useProcessStore()
const router = useRouter()
const route = useRoute()
const tableConfig = reactive({
columns: [
{
@@ -66,31 +62,35 @@ const tableConfig = reactive({
align: 'center',
currentRender: ({row, index}) => (parseInt(row.size / 1024) + 'KB')
},
{
prop: 'oper',
label: '操作',
align: 'center',
currentRender: ({row, index}) => {
return (
<div>
<el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
<el-button type="primary" size="large" link onClick={() => beforeRemove(row)}>删除</el-button>
</div>
)
}
}
// {
// prop: 'oper',
// label: '操作',
// align: 'center',
// currentRender: ({row, index}) => {
// return (
// <div>
// <el-button type="primary" link onClick={() => handleDownload(row)}>下载</el-button>
// <el-button type="primary" size="large" link onClick={() => beforeRemove(row)}>删除</el-button>
// </div>
// )
// }
// }
]
})
const handleDownload = (row) => {
downloadFile(row.fileId).then(res => {
const blob = new Blob([res])
let a = document.createElement('a')
a.href=URL.createObjectURL(blob)
a.href = URL.createObjectURL(blob)
a.download = row.originalFileName
a.click()
})
}
const compositeParam = (item) => {
let tag = ''
if (router.currentRoute.value.name === 'Filing/conclusion') {
tag = '项目结项'
}
return {
fileId: item.id,
size: item.size,
@@ -98,43 +98,88 @@ const compositeParam = (item) => {
fileType: item.fileType,
url: item.url,
processNodeTag: null,
tag: formData.value.collectType
tag: tag
}
}
const getAttachment = (val) => {
console.log('上传文件', 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
})
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 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,
requirementId: route.query.id,
files: files,
projectId:route.query.projectId,
}
console.log('params', params)
let res = await projectConclusion(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: 'Filing'
})
}
})
}
const init = () => {
getProjectConclusionProcess().then(res => {
processDiagramViewer.value = false
if (res.code === 1000) {
let data = res.data
deploymentId.value=data.deploymentId
processInstanceData.value = data
processStore.setDesign(data)
processStore.runningList.value = data.runningList;
processStore.endList.value = data.endList;
processStore.noTakeList.value = data.noTakeList;
processStore.refuseList.value = data.refuseList;
processStore.passList.value = data.passList;
nextTick(() => {
processDiagramViewer.value = true
})
}
})
}
init()
</script>
<style scoped>

View File

@@ -93,12 +93,12 @@ const tableIns = ref()
const tableConfig = reactive({
columns: [
{
prop: 'name',
prop: 'projectName',
label: '名称',
align: 'center'
},
{
prop: 'company',
prop: 'affiliatedCompany',
label: '所属公司',
align: 'center'
},
@@ -108,31 +108,37 @@ const tableConfig = reactive({
align: 'center'
},
{
prop: 'productMainBody',
prop: 'rdSubject',
label: '研发主体',
align: 'center'
},
{
prop: 'projectEffect',
prop: 'projectImpact',
label: '项目影响',
align: 'center'
},
{
prop: 'survey',
label: '经概况',
prop: 'economicEstimate',
label: '经概况',
align: 'center'
},
{
prop: 'time',
prop: 'startTime',
label: '起止时间',
align: 'center'
},
{
prop: 'status',
prop: 'state',
label: '状态',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => (<Tag dictType={'process_state'} value={row.state}/>)
currentRender: ({row, index}) =>{
if (row.state !== null) {
return (<Tag dictType={'project_initiation'} value={row.state}/>)
} else {
return '--'
}
}
},
{
prop: 'oper',
@@ -140,11 +146,11 @@ const tableConfig = reactive({
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'}]
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'},{label: '结项', func: () => handleConclusion(row), type: 'primary'}]
if (row.state === '3') {
btn.push({label: '附件', func: () => handleCheck(row), type: 'primary'})
} else if (row.state === '4') {
btn.push({label: '结项', func: () => handleStandingBook(row), type: 'primary'})
btn.push({label: '结项', func: () => handleConclusion(row), type: 'primary'})
}
return (
<div style={{width: '100%'}}>
@@ -165,7 +171,7 @@ const tableConfig = reactive({
}
}
],
api: '',
api: '/workflow/mosr/project/filing',
params: {},
})
@@ -176,11 +182,19 @@ const search = (val) => {
const handleDetail = (row) => {
router.push({
name:'Implementation/detail',
name:'Filing/detail',
query: {
id: row.requirementId
}
})
}
const handleConclusion = (row) => {
router.push({
name:'Filing/conclusion',
query: {
id: row.requirementId,
projectId: row.projectId
}
})
}
</script>