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-col :span="24">
<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-col>
<el-col :span="24">
<el-form-item label="其他文件">
<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"
:data="otherFileList" :isSettingCol="false" :pagination="false">
:data="allFileList" :isSettingCol="false" :pagination="false">
<template #empty>
<el-empty :image-size="90" description="暂无数据" style="padding: 0"/>
</template>
@@ -75,6 +80,8 @@ const rules = reactive({
attachment: [{required: true, message: '请上传附件', trigger: ['blur','change']}],
})
const applyForm=ref()
const singleFile=ref()
const allFileList=ref([])
const props = defineProps({
showFileList: {
type: Boolean,
@@ -85,16 +92,32 @@ const props = defineProps({
}, showTable: {
type: Boolean,
default: true
}, preview: {
type: Boolean,
default: false
},otherFileList: {
type: Array,
default: []
},formData: {
type: Array,
default: []
}
})
watch(() => props.showTable, (newVal) => {
props.showTable = newVal
}, {deep: true})
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})
const getAttachment = (val) => {
emit('getAttachment', val)
@@ -140,7 +163,9 @@ defineExpose({
},
clearValidate(){
return applyForm.value.clearValidate()
}
},
allFileList,
singleFile
})
</script>

View File

@@ -4,13 +4,13 @@
<baseTitle title="各流程信息"></baseTitle>
<div class="steps-box">
<el-steps :active="localActive" finish-status="success">
<el-step
v-for="(item, index) in localSteps"
:key="item.key"
:title="item.title"
<el-step
v-for="(item, index) in localSteps"
:key="item.key"
:title="item.title"
:class="stepClass(index)"
@click="handleStep(item.key, index)"
@click="handleStep(item.key, index)"
/>
</el-steps>
</div>
@@ -91,7 +91,7 @@ const schema = computed(()=>{
colProps: {
span: 12
}
// component:
// component:
},
{
label: '征集类型',
@@ -99,7 +99,7 @@ const schema = computed(()=>{
colProps: {
span: 12
}
// component:
// component:
},
{
label: '截止时间',
@@ -107,7 +107,7 @@ const schema = computed(()=>{
colProps: {
span: 12
}
// component:
// component:
},
{
label: '需求名称',
@@ -115,7 +115,7 @@ const schema = computed(()=>{
colProps: {
span: 12
}
// component:
// component:
},
]
})
@@ -236,6 +236,7 @@ getBaseInfo()
watchEffect(() => {
console.log(props.active, 'props.active');
localActive.value = props.active
getBaseInfo()
})
</script>
@@ -251,4 +252,4 @@ watchEffect(() => {
.step-error {
cursor: not-allowed;
}
</style>
</style>

View File

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

View File

@@ -24,9 +24,17 @@ export const getProcessInfo = () => {
method: "post"
});
};
export const getDetail = (requirementId) => {
export const getDetail = (projectId) => {
return request({
url: `/workflow/mosr/requirement/collect/info/${requirementId}`,
url: `/workflow/mosr/requirement/collect/info/${projectId}`,
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>
<steps :active="active" @setDetail="setDetail" @stepChange="stepChange">
<template #content>
<span v-show="showActive == '00'">需求征集</span>
<summary-detail v-show="showActive == '10'" :formData="summaryData.formData" :data="summaryData" :processViewer="summaryProcessViewer"/>
<collection-detail v-show="showActive == '00'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer" :companyOption="companyOption" @getInfo="getDemandCollectionInfo"/>
<summary-detail v-show="showActive == '10'" :formData="summaryData.formData" :data="summaryData"
:processViewer="summaryProcessViewer"/>
</template>
</steps>
</template>
<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 {getDetail} from "./api";
import { markRaw, reactive, ref, shallowRef } from 'vue';
import { getMapProjectStateInfo } from '../../../components/steps/api';
import {markRaw, reactive, ref, shallowRef} from 'vue';
import {getMapProjectStateInfo} from '@/components/steps/api';
import CollectionDetail from "@/components/DetailComponent/CollectionDetail.vue";
const route = useRoute()
const summaryData = ref({})
const summaryProcessViewer = ref(true)
const processStore = useProcessStore()
const active = route.query.state
const active = ref(route.query.state)
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 projectId = route.query.projectId
const { code, data } = await getMapProjectStateInfo(projectId, state)
const {code, data} = await getMapProjectStateInfo(projectId, state)
summaryProcessViewer.value = false
summaryData.value = data;
processStore.setDesign(data)
processStore.runningList.value = data.runningList;
@@ -58,6 +43,7 @@ const getInfo = async (state) => {
}
const setDetail = (active) => {
console.log('active', active)
showActive.value = active
getInfo(active)
}
@@ -65,6 +51,7 @@ const setDetail = (active) => {
const stepChange = (data) => {
console.log(data)
showActive.value = data.active
getInfo(data.active)
}
const summaryDetailRef = ref()

View File

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

View File

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

View File

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

View File

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

View File

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