fix : 修复页面细节功能及附件上传组件

This commit is contained in:
2024-05-20 00:29:31 +08:00
parent 1f4389eb5e
commit 9661cdbb2b
10 changed files with 268 additions and 157 deletions

View File

@@ -3,15 +3,20 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item :label="label" prop="attachment"> <el-form-item :label="label" prop="attachment">
<file-upload @getFile="getAttachment" :showFileList="showFileList" @delete="deleteAttachment"/> <template v-if="preview">
<el-button type="primary" link @click="handleDownload(singleFile)" style="font-size: 18px">{{ singleFile?.originalFileName }}</el-button>
</template>
<template v-else>
<file-upload @getFile="getAttachment" :showFileList="showFileList" :maxSize="0" @delete="deleteAttachment"/>
</template>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="其他文件"> <el-form-item label="其他文件">
<el-card style="width: 100%"> <el-card style="width: 100%">
<file-upload @getFile="getOtherFile" :showFileList="false"/> <file-upload @getFile="getOtherFile"/>
<fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig" <fvTable style="width: 100%;max-height: 250px;height: 250px" v-if="showTable" :tableConfig="tableConfig"
:data="otherFileList" :isSettingCol="false" :pagination="false"> :data="allFileList" :isSettingCol="false" :pagination="false">
<template #empty> <template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/> <el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template> </template>
@@ -75,6 +80,8 @@ const rules = reactive({
attachment: [{required: true, message: '请上传附件', trigger: ['blur','change']}], attachment: [{required: true, message: '请上传附件', trigger: ['blur','change']}],
}) })
const applyForm=ref() const applyForm=ref()
const singleFile=ref()
const allFileList=ref([])
const props = defineProps({ const props = defineProps({
showFileList: { showFileList: {
type: Boolean, type: Boolean,
@@ -85,16 +92,32 @@ const props = defineProps({
}, showTable: { }, showTable: {
type: Boolean, type: Boolean,
default: true default: true
}, preview: {
type: Boolean,
default: false
},otherFileList: { },otherFileList: {
type: Array, type: Array,
default: [] default: []
},formData: {
type: Array,
default: []
} }
}) })
watch(() => props.showTable, (newVal) => { watch(() => props.showTable, (newVal) => {
props.showTable = newVal props.showTable = newVal
}, {deep: true}) }, {deep: true})
watch(() => props.otherFileList, (newVal) => { watch(() => props.otherFileList, (newVal) => {
props.otherFileList = newVal newVal.forEach(item=>{
allFileList.value.push(item)
})
}, {deep: true})
watch(() => props.formData.fileList, (newVal) => {
newVal.forEach(item=>{
allFileList.value.push(item)
})
}, {deep: true})
watch(() => props.formData.singleFile, (newVal) => {
singleFile.value = newVal
}, {deep: true}) }, {deep: true})
const getAttachment = (val) => { const getAttachment = (val) => {
emit('getAttachment', val) emit('getAttachment', val)
@@ -140,7 +163,9 @@ defineExpose({
}, },
clearValidate(){ clearValidate(){
return applyForm.value.clearValidate() return applyForm.value.clearValidate()
} },
allFileList,
singleFile
}) })
</script> </script>

View File

@@ -236,6 +236,7 @@ getBaseInfo()
watchEffect(() => { watchEffect(() => {
console.log(props.active, 'props.active'); console.log(props.active, 'props.active');
localActive.value = props.active localActive.value = props.active
getBaseInfo()
}) })
</script> </script>

View File

@@ -202,7 +202,7 @@
<el-input v-model="formData.economicEstimate" clearable></el-input> <el-input v-model="formData.economicEstimate" clearable></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="12">
<el-form-item label="其中申请公司总部科技创新专项资金(万元)" prop="specialFundAmount"> <el-form-item label="其中申请公司总部科技创新专项资金(万元)" prop="specialFundAmount">
<el-input v-model="formData.specialFundAmount" clearable></el-input> <el-input v-model="formData.specialFundAmount" clearable></el-input>
</el-form-item> </el-form-item>
@@ -221,24 +221,27 @@
</el-form> </el-form>
<AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList" <AttachmentUpload ref="attachment" label="需求申请书附件" :showTable="showTable" :otherFileList="otherFileList"
@getAttachment="getAttachment" @getAttachment="getAttachment"
@getOtherFile="getOtherFile" :showFileList="true"/> @getOtherFile="getOtherFile" :showFileList="true" :formData="formData" :preview="router.currentRoute.value.name === 'Summary/edit'"/>
<!-- <fvForm :schema="schame" @getInstance="getInstance"></fvForm>--> <!-- <fvForm :schema="schame" @getInstance="getInstance"></fvForm>-->
<div class="oper-page-btn"> <div class="oper-page-btn">
<el-button type="primary" @click="staging">存为草稿</el-button> <el-button type="primary" @click="staging">存为草稿</el-button>
<el-button type="primary" @click="handleSubmit(summaryForm)">发布</el-button> <el-button type="primary" @click="handleSubmit(summaryForm)">发布</el-button>
<el-button color="#DED0B2" @click="handleResubmit">重新发布</el-button>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="jsx"> <script setup lang="jsx">
import {getProcessInfo, requirementReported} from "./api"; import {getDetail, getProcessInfo, requirementReported, resubmitReported} from "./api";
import {ElNotification} from "element-plus"; import {ElMessage, ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js' import {useTagsView} from '@/stores/tagsview.js'
import {useCacheStore} from '@/stores/cache.js' import {useCacheStore} from '@/stores/cache.js'
import {getSubCompOpt} from "../../../api/user/user"; import {getSubCompOpt} from "@/api/user/user";
const cacheStore = useCacheStore() const cacheStore = useCacheStore()
const router = useRouter() const router = useRouter()
const route = useRoute()
const name=ref(router.currentRoute.value.name)
const tagsViewStore = useTagsView() const tagsViewStore = useTagsView()
const companyOption = ref([]) const companyOption = ref([])
const summaryForm = ref() const summaryForm = ref()
@@ -246,10 +249,8 @@ const attachment = ref()
const deploymentId = ref() const deploymentId = ref()
const showTable = ref(true) const showTable = ref(true)
const otherFileList = ref([]) const otherFileList = ref([])
const fileList = ref([]) const file = ref({})
const formData = ref({ const formData = ref({})
specialFund: null
})
const rules = reactive({ const rules = reactive({
projectName: [{required: true, message: '请输入名称', trigger: 'blur'}], projectName: [{required: true, message: '请输入名称', trigger: 'blur'}],
specialFund: [{required: true, message: '请选择专项资金', trigger: 'blur'}], specialFund: [{required: true, message: '请选择专项资金', trigger: 'blur'}],
@@ -278,29 +279,29 @@ const rules = reactive({
}) })
const compositeParam = (item, type) => { const compositeParam = (item, type) => {
let tag = '' let tag = ''
if (router.currentRoute.value.name === 'Summary/add') { if ( name.value=== 'Summary/add'||name.value === 'Summary/edit') {
tag = '需求上报' tag = '需求上报'
} }
return { return {
fileId: item.id, fileId: item.id,
size: item.size, size: item.size,
type: type,
originalFileName: item.originalFilename, originalFileName: item.originalFilename,
fileType: item.fileType, fileType: item.fileType,
url: item.url, url: item.url,
processNodeTag: null,
tag: tag tag: tag
} }
} }
const getEditOtherFile=(val)=>{
console.log('getEditOtherFile',val)
}
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('上传文件getAttachment', val) console.log('上传文件getAttachment', val)
let fileObj = compositeParam(val, 1) file.value = compositeParam(val)
fileList.value.push(fileObj)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val) console.log('上传文件getOtherFile', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val, 2) let fileObj = compositeParam(val)
otherFileList.value.push(fileObj) otherFileList.value.push(fileObj)
nextTick(() => { nextTick(() => {
showTable.value = true showTable.value = true
@@ -308,14 +309,31 @@ const getOtherFile = (val) => {
} }
const getFileParam = (item) => { const getFileParam = (item) => {
return { return {
fileId: item.fileId, fileId: item.fileId
type: item.type
} }
} }
const handleSubmit = async (instance) => { const handleSubmit = async (instance) => {
// if (!instance) return
// instance.validate(async (valid, fields) => {
// if(JSON.stringify(file.value) == "{}"){
// attachment.value.validate()
// } else {
// attachment.value.clearValidate()
// }
// if (!valid) return
let singleFile = {}
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
let otherFiles = []
otherFileList.value.forEach(item => {
otherFiles.push(getFileParam(item))
})
let params = { let params = {
"specialFund": "2", "specialFund": "2",
"projectName": "3", "projectName": "重新提交全流程测试",
"startTime": "2024-05-24 00:00:00", "startTime": "2024-05-24 00:00:00",
"endTime": "2024-05-29 00:00:00", "endTime": "2024-05-29 00:00:00",
"projectType": "3", "projectType": "3",
@@ -338,65 +356,104 @@ const handleSubmit = async (instance) => {
"serviceDescription": "3", "serviceDescription": "3",
"contentDescription": "3", "contentDescription": "3",
"specialFundAmount": "3", "specialFundAmount": "3",
"deploymentId": "e75b2040-15b4-11ef-8cdf-f268fc747b04", deploymentId: deploymentId.value,
"files": [ "singleFile": singleFile,
{ "files": otherFiles,
"fileId": 207, // "requirementId":route.query.id,
"type": 1
},
],
"requirementId": 102 "requirementId": 102
} }
// if (!instance) return // ...formData.value,
// instance.validate(async (valid, fields) => { // deploymentId: deploymentId.value,
// if (fileList.value.length === 0) { // files: files,
// attachment.value.validate() // requirementId:102
// } else { // }
// attachment.value.clearValidate() let res = await requirementReported(params)
// } ElNotification({
// if (!valid) return title: '提示',
let files = [] message: res.msg,
fileList.value.forEach(item => { type: res.code === 1000 ? 'success' : 'error'
files.push(getFileParam(item)) })
if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
await router.push({
name: 'Summary'
}) })
otherFileList.value.forEach(item => { }
files.push(getFileParam(item)) // })
}) }
// ...formData.value, const handleResubmit = () => {
// deploymentId: deploymentId.value, let singleFile = {}
// files: files, let otherFiles = []
// requirementId:102 let fileArray
// } if(name.value === 'Summary/edit'){
let res = await requirementReported(params) singleFile = {
fileId: attachment.value.singleFile.fileId
}
fileArray=attachment.value.allFileList
}else {
if (file.value.fileId !== undefined) {
singleFile = {
fileId: file.value.fileId
}
}
fileArray=otherFileList.value
}
fileArray.forEach(item => {
otherFiles.push(getFileParam(item))
})
let params={
...formData.value,
deploymentId: deploymentId.value,
files: otherFiles,
singleFile: singleFile,
requirementId: 102
}
console.log('重新提交params',params)
resubmitReported(params).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg)
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Summary'
})
} else {
ElMessage.error(res.msg)
}
})
}
const getDetailInfo = async () => {
getDetail(route.query.projectId).then(res => {
ElNotification({ ElNotification({
title: '提示', title: '提示',
message: res.msg, message: res.msg,
type: res.code === 1000 ? 'success' : 'error' type: res.code === 1000 ? 'success' : 'error'
}) })
if (res.code === 1000) { if (res.code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path) formData.value = res.data.formData
await router.push({
name: 'Summary'
})
} }
// }) })
} }
const init = async () => { const init = async () => {
const res = await getSubCompOpt() const res = await getSubCompOpt()
companyOption.value = res.data companyOption.value = res.data
getProcessInfo().then(res => { getProcessInfo().then(res => {
ElNotification({ // ElNotification({
title: '提示', // title: '提示',
message: res.msg, // message: res.msg,
type: res.code === 1000 ? 'success' : 'error' // type: res.code === 1000 ? 'success' : 'error'
}) // })
if (res.code === 1000) { if (res.code === 1000) {
let data = res.data let data = res.data
deploymentId.value = data.deploymentId deploymentId.value = data.deploymentId
} }
}) })
} }
init() onMounted(async () => {
await init()
if (route.query.id) {
await getDetailInfo()
}
})
const staging = async () => { const staging = async () => {
} }
</script> </script>

View File

@@ -24,9 +24,17 @@ export const getProcessInfo = () => {
method: "post" method: "post"
}); });
}; };
export const getDetail = (requirementId) => { export const getDetail = (projectId) => {
return request({ return request({
url: `/workflow/mosr/requirement/collect/info/${requirementId}`, url: `/workflow/mosr/requirement/collect/info/${projectId}`,
method: "get" method: "get"
}); });
}; };
export const resubmitReported = (data) => {
return request({
url: '/workflow/mosr/requirement/collect/resubmit',
method: "post",
data: data
});
};

View File

@@ -1,47 +1,32 @@
<template> <template>
<steps :active="active" @setDetail="setDetail" @stepChange="stepChange"> <steps :active="active" @setDetail="setDetail" @stepChange="stepChange">
<template #content> <template #content>
<span v-show="showActive == '00'">需求征集</span> <collection-detail v-show="showActive == '00'" :formData="summaryData.formData" :data="summaryData"
<summary-detail v-show="showActive == '10'" :formData="summaryData.formData" :data="summaryData" :processViewer="summaryProcessViewer"/> :processViewer="summaryProcessViewer" :companyOption="companyOption" @getInfo="getDemandCollectionInfo"/>
<summary-detail v-show="showActive == '10'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer"/>
</template> </template>
</steps> </steps>
</template> </template>
<script setup lang="jsx"> <script setup lang="jsx">
import SummaryDetail from '../../../components/DetailComponent/SummaryDetail.vue'; import SummaryDetail from '@/components/DetailComponent/SummaryDetail.vue';
import {useProcessStore} from '@/stores/processStore.js'; import {useProcessStore} from '@/stores/processStore.js';
import {getDetail} from "./api"; import {getDetail} from "./api";
import { markRaw, reactive, ref, shallowRef } from 'vue'; import {markRaw, reactive, ref, shallowRef} from 'vue';
import { getMapProjectStateInfo } from '../../../components/steps/api'; import {getMapProjectStateInfo} from '@/components/steps/api';
import CollectionDetail from "@/components/DetailComponent/CollectionDetail.vue";
const route = useRoute() const route = useRoute()
const summaryData = ref({}) const summaryData = ref({})
const summaryProcessViewer = ref(true) const summaryProcessViewer = ref(true)
const processStore = useProcessStore() const processStore = useProcessStore()
const active = route.query.state const active = ref(route.query.state)
const showActive = ref() const showActive = ref()
const getDemandSummaryInfo = async () => {
if (!route.query.id) return
// await getCompanyOption()
summaryProcessViewer.value = false
getDetail(route.query.id).then(res => {
let data = res.data
summaryData.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(() => {
summaryProcessViewer.value = true
})
})
}
// getDemandSummaryInfo()
const getInfo = async (state) => { const getInfo = async (state) => {
const projectId = route.query.projectId const projectId = route.query.projectId
const { code, data } = await getMapProjectStateInfo(projectId, state) const {code, data} = await getMapProjectStateInfo(projectId, state)
summaryProcessViewer.value = false
summaryData.value = data; summaryData.value = data;
processStore.setDesign(data) processStore.setDesign(data)
processStore.runningList.value = data.runningList; processStore.runningList.value = data.runningList;
@@ -58,6 +43,7 @@ const getInfo = async (state) => {
} }
const setDetail = (active) => { const setDetail = (active) => {
console.log('active', active)
showActive.value = active showActive.value = active
getInfo(active) getInfo(active)
} }
@@ -65,6 +51,7 @@ const setDetail = (active) => {
const stepChange = (data) => { const stepChange = (data) => {
console.log(data) console.log(data)
showActive.value = data.active showActive.value = data.active
getInfo(data.active)
} }
const summaryDetailRef = ref() const summaryDetailRef = ref()

View File

@@ -121,12 +121,12 @@ const tableConfig = reactive({
align: 'center', align: 'center',
showOverflowTooltip: false, showOverflowTooltip: false,
currentRender: ({row, index}) => { currentRender: ({row, index}) => {
let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'}] let btn = [{label: '详情', func: () => handleDetail(row), type: 'primary'},{label: '编辑', func: () => handleEdit(row), type: 'primary'},{label: '上报', func: () => handleAdd(row), type: 'primary'}]
if (row.state === '3') { // if (row.state === '3') {
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'}) // btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
} else if (row.state === '0') { // } else if (row.state === '0') {
btn.push({label: '上报', func: () => handleAdd(row), type: 'primary'}) // btn.push({label: '上报', func: () => handleAdd(row), type: 'primary'})
} // }
return ( return (
<div style={{width: '100%'}}> <div style={{width: '100%'}}>
{ {
@@ -165,18 +165,22 @@ const search = (val) => {
tableIns.value.refresh() tableIns.value.refresh()
} }
const headBtnClick = (key) => { const handleAdd = (row) => {
switch (key) {
case 'add':
handleAdd()
break;
}
}
const handleAdd = () => {
router.push({ router.push({
name: 'Summary/add', name: 'Summary/add',
query: {} query: {
isAdd: 1,
id:row.requirementId
}
})
}
const handleEdit = (row) => {
router.push({
name: 'Summary/edit',
query: {
id:row.requirementId,
projectId:row.projectId
}
}) })
} }
const handleDetail = (row) => { const handleDetail = (row) => {

View File

@@ -17,17 +17,19 @@
</template> </template>
<script setup lang="jsx"> <script setup lang="jsx">
import {useTagsView} from '@/stores/tagsview.js'
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'; import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {downloadFile} from "@/api/project-demand"; import {downloadFile} from "@/api/project-demand";
import { ElNotification} from "element-plus"; import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js'; import {useProcessStore} from '@/stores/processStore.js';
import {getProjectConclusionProcess, projectConclusion} from "@/api/project-manage"; import {getProjectConclusionProcess, projectConclusion} from "@/api/project-manage";
const tagsViewStore = useTagsView()
const formData = ref({}) const formData = ref({})
const rules = reactive({ const rules = reactive({
attachment: [{required: true, message: '请上传项目结项附件', trigger: 'blur'}], attachment: [{required: true, message: '请上传项目结项附件', trigger: 'blur'}],
}) })
const fileList = ref([]) const file = ref({})
const applyForm = ref() const applyForm = ref()
const deploymentId = ref() const deploymentId = ref()
const showTable = ref(true) const showTable = ref(true)
@@ -103,13 +105,12 @@ const compositeParam = (item) => {
} }
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('上传文件getAttachment', val) console.log('上传文件getAttachment', val)
let fileObj = compositeParam(val, 1) file.value=compositeParam(val)
fileList.value.push(fileObj)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val) console.log('上传文件getOtherFile', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val, 2) let fileObj = compositeParam(val)
otherFileList.value.push(fileObj) otherFileList.value.push(fileObj)
nextTick(() => { nextTick(() => {
showTable.value = true showTable.value = true
@@ -126,16 +127,19 @@ const handleSubmit = (instance) => {
if (!instance) return if (!instance) return
instance.validate(async (valid) => { instance.validate(async (valid) => {
if (!valid) return if (!valid) return
if (fileList.value.length === 0) { // if(JSON.stringify(file.value) == "{}"){
applyForm.value.validate() // applyForm.value.validate()
} else { // } else {
applyForm.value.clearValidate() // applyForm.value.clearValidate()
} // }
if (!valid) return if (!valid) return
let files = [] let files = []
fileList.value.forEach(item => { let singleFile={}
files.push(getFileParam(item)) if(file.value.fileId!==undefined){
}) singleFile = {
fileId: file.value.fileId
}
}
otherFileList.value.forEach(item => { otherFileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
@@ -143,6 +147,7 @@ const handleSubmit = (instance) => {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
files: files, files: files,
singleFile: singleFile,
projectId:route.query.projectId, projectId:route.query.projectId,
} }
console.log('params', params) console.log('params', params)

View File

@@ -26,10 +26,12 @@
<script setup lang="jsx"> <script setup lang="jsx">
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'; import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {getProjectCheckProcess, projectCheck} from "@/api/project-manage"; import {getProjectCheckProcess, projectCheck} from "@/api/project-manage";
import { ElNotification} from "element-plus"; import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js'; import {useProcessStore} from '@/stores/processStore.js';
import {useTagsView} from '@/stores/tagsview.js'
const tagsViewStore = useTagsView()
const formData = ref({}) const formData = ref({})
const fileList = ref([]) const file = ref({})
const applyForm = ref() const applyForm = ref()
const deploymentId = ref() const deploymentId = ref()
const showTable = ref(true) const showTable = ref(true)
@@ -56,13 +58,12 @@ const compositeParam = (item) => {
} }
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('上传文件getAttachment', val) console.log('上传文件getAttachment', val)
let fileObj = compositeParam(val, 1) file.value=compositeParam(val)
fileList.value.push(fileObj)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val) console.log('上传文件getOtherFile', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val, 2) let fileObj = compositeParam(val)
otherFileList.value.push(fileObj) otherFileList.value.push(fileObj)
nextTick(() => { nextTick(() => {
showTable.value = true showTable.value = true
@@ -79,16 +80,19 @@ const handleSubmit = (instance) => {
if (!instance) return if (!instance) return
instance.validate(async (valid) => { instance.validate(async (valid) => {
if (!valid) return if (!valid) return
if(fileList.value.length===0){ // if(JSON.stringify(file.value) == "{}"){
applyForm.value.validate() // applyForm.value.validate()
}else { // }else {
applyForm.value.clearValidate() // applyForm.value.clearValidate()
} // }
if (!valid) return if (!valid) return
let files = [] let files = []
fileList.value.forEach(item => { let singleFile={}
files.push(getFileParam(item)) if(file.value.fileId!==undefined){
}) singleFile = {
fileId: file.value.fileId
}
}
otherFileList.value.forEach(item => { otherFileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
@@ -96,6 +100,7 @@ const handleSubmit = (instance) => {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
files: files, files: files,
singleFile: singleFile,
projectId:route.query.projectId, projectId:route.query.projectId,
} }
console.log('params',params) console.log('params',params)

View File

@@ -19,16 +19,18 @@
</div> </div>
<div class="oper-page-btn"> <div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button> <el-button color="#DED0B2" @click="handleSubmit(applyForm)">提交</el-button>
<el-button color="#DED0B2" @click="handleResubmit">重新提交</el-button>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="jsx"> <script setup lang="jsx">
import {useTagsView} from '@/stores/tagsview.js' import {useTagsView} from '@/stores/tagsview.js'
import {ElNotification} from "element-plus"; import {ElMessage, ElNotification} from "element-plus";
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'; import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {getProcessInfo,projectApply} from "@/api/project-manage"; import {getProcessInfo, projectApply} from "@/api/project-manage";
import {useProcessStore} from '@/stores/processStore.js'; import {useProcessStore} from '@/stores/processStore.js';
const tagsViewStore = useTagsView() const tagsViewStore = useTagsView()
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
@@ -38,7 +40,7 @@ const rules = reactive({
}) })
const processStore = useProcessStore() const processStore = useProcessStore()
const deploymentId = ref() const deploymentId = ref()
const fileList = ref([]) const file = ref({})
const applyForm = ref() const applyForm = ref()
const showTable = ref(true) const showTable = ref(true)
const otherFileList = ref([]) const otherFileList = ref([])
@@ -102,13 +104,12 @@ const compositeParam = (item, type) => {
} }
const getAttachment = (val) => { const getAttachment = (val) => {
console.log('上传文件getAttachment', val) console.log('上传文件getAttachment', val)
let fileObj = compositeParam(val, 1) file.value=compositeParam(val)
fileList.value.push(fileObj)
} }
const getOtherFile = (val) => { const getOtherFile = (val) => {
console.log('上传文件getOtherFile', val) console.log('上传文件getOtherFile', val)
showTable.value = false showTable.value = false
let fileObj = compositeParam(val, 2) let fileObj = compositeParam(val)
otherFileList.value.push(fileObj) otherFileList.value.push(fileObj)
nextTick(() => { nextTick(() => {
showTable.value = true showTable.value = true
@@ -123,16 +124,19 @@ const getFileParam = (item) => {
const handleSubmit = (instance) => { const handleSubmit = (instance) => {
if (!instance) return if (!instance) return
instance.validate(async (valid) => { instance.validate(async (valid) => {
if(fileList.value.length===0){ // if(JSON.stringify(file.value) == "{}"){
applyForm.value.validate() // applyForm.value.validate()
}else { // }else {
applyForm.value.clearValidate() // applyForm.value.clearValidate()
} // }
if (!valid) return if (!valid) return
let files = [] let files = []
fileList.value.forEach(item => { let singleFile={}
files.push(getFileParam(item)) if(file.value.fileId!==undefined){
}) singleFile = {
fileId: file.value.fileId
}
}
otherFileList.value.forEach(item => { otherFileList.value.forEach(item => {
files.push(getFileParam(item)) files.push(getFileParam(item))
}) })
@@ -140,6 +144,7 @@ const handleSubmit = (instance) => {
deploymentId: deploymentId.value, deploymentId: deploymentId.value,
requirementId: route.query.id, requirementId: route.query.id,
files: files, files: files,
singleFile: singleFile,
projectId:route.query.projectId, projectId:route.query.projectId,
} }
console.log('params',params) console.log('params',params)
@@ -157,6 +162,19 @@ const handleSubmit = (instance) => {
} }
}) })
} }
const handleResubmit = () => {
resubmit(submitParam(formData.value)).then(res => {
if (res.code === 1000) {
ElMessage.success(res.msg)
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Collection'
})
} else {
ElMessage.error(res.msg)
}
})
}
const init = () => { const init = () => {
getProcessInfo().then(res => { getProcessInfo().then(res => {
processDiagramViewer.value = false processDiagramViewer.value = false

View File

@@ -200,6 +200,7 @@ const handleApply = (row) => {
router.push({ router.push({
name:'Initiation/apply', name:'Initiation/apply',
query: { query: {
isAdd: 1,
id: row.requirementId, id: row.requirementId,
projectId: row.projectId projectId: row.projectId
} }