fix : 修复编辑数据回显功能
This commit is contained in:
@@ -74,7 +74,7 @@
|
|||||||
<script setup lang="jsx">
|
<script setup lang="jsx">
|
||||||
import {useAuthStore} from '@/stores/userstore.js'
|
import {useAuthStore} from '@/stores/userstore.js'
|
||||||
import {useProcessStore} from '@/stores/processStore.js';
|
import {useProcessStore} from '@/stores/processStore.js';
|
||||||
import {getWorkflowInfo, addRequirement, getFormInfo,resubmit,deleteFile} from "@/api/project-demand/index.js";
|
import {getWorkflowInfo, addRequirement, getFormInfo, resubmit, deleteFile} from "@/api/project-demand/index.js";
|
||||||
import FileUpload from "@/components/FileUpload.vue";
|
import FileUpload from "@/components/FileUpload.vue";
|
||||||
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
|
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
|
||||||
import {ElMessage, ElMessageBox} from "element-plus";
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
@@ -122,41 +122,31 @@ const loading = ref(false)
|
|||||||
const processStore = useProcessStore()
|
const processStore = useProcessStore()
|
||||||
const processInstanceData = ref()
|
const processInstanceData = ref()
|
||||||
|
|
||||||
|
const compositeParam=(item)=>{
|
||||||
|
return {
|
||||||
|
fileId: item.id,
|
||||||
|
size: item.size,
|
||||||
|
fileName: item.fileName,
|
||||||
|
fileType: item.fileType,
|
||||||
|
url: item.url,
|
||||||
|
processNodeTag: null,
|
||||||
|
tag: formData.value.collectType,
|
||||||
|
userId: authStore.userinfo.userId
|
||||||
|
}
|
||||||
|
}
|
||||||
const getFile = (val) => {
|
const getFile = (val) => {
|
||||||
console.log('val', val, route.query.isAdd)
|
let fileObj = {}
|
||||||
if (route.query.isAdd == undefined) {
|
let newFileArray = []
|
||||||
// showTable.value = true
|
if (route.query.isAdd === undefined) {
|
||||||
let fileObj = {}
|
|
||||||
let newFileArray = []
|
|
||||||
val.forEach(item => {
|
val.forEach(item => {
|
||||||
fileObj = {
|
fileObj =compositeParam(item)
|
||||||
fileId: item.id,
|
|
||||||
size: item.size,
|
|
||||||
fileName: item.fileName,
|
|
||||||
fileType: item.fileType,
|
|
||||||
url: item.url,
|
|
||||||
processNodeTag: null,
|
|
||||||
tag: formData.value.collectType,
|
|
||||||
userId: authStore.userinfo.userId
|
|
||||||
}
|
|
||||||
newFileArray.push(fileObj)
|
newFileArray.push(fileObj)
|
||||||
formData.value.fileList.push(fileObj)
|
formData.value.fileList.push(fileObj)
|
||||||
})
|
})
|
||||||
fileList.value = formData.value.fileList
|
fileList.value = formData.value.fileList
|
||||||
} else {
|
} else {
|
||||||
let fileObj = {}
|
|
||||||
let newFileArray = []
|
|
||||||
val.forEach(item => {
|
val.forEach(item => {
|
||||||
fileObj = {
|
fileObj =compositeParam(item)
|
||||||
fileId: item.id,
|
|
||||||
size: item.size,
|
|
||||||
fileName: item.fileName,
|
|
||||||
fileType: item.fileType,
|
|
||||||
url: item.url,
|
|
||||||
processNodeTag: null,
|
|
||||||
tag: formData.value.collectType,
|
|
||||||
userId: authStore.userinfo.userId
|
|
||||||
}
|
|
||||||
newFileArray.push(fileObj)
|
newFileArray.push(fileObj)
|
||||||
})
|
})
|
||||||
formData.value.fileList = newFileArray
|
formData.value.fileList = newFileArray
|
||||||
@@ -164,7 +154,6 @@ const getFile = (val) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const init = async () => {
|
const init = async () => {
|
||||||
const res = await getSubCompOpt()
|
const res = await getSubCompOpt()
|
||||||
companyOption.value = res.data
|
companyOption.value = res.data
|
||||||
@@ -183,39 +172,26 @@ const init = async () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = async () => {
|
||||||
if (route.query.isAdd == undefined) {
|
let params = {
|
||||||
resubmit({
|
...formData.value,
|
||||||
...formData.value,
|
requirementId: 0,
|
||||||
requirementId: 0,
|
files: fileList.value,
|
||||||
files: fileList.value,
|
deploymentId: processInstanceData.value.deploymentId
|
||||||
deploymentId: processInstanceData.value.deploymentId
|
}
|
||||||
}).then(res => {
|
let res
|
||||||
if (res.code === 1000) {
|
if (route.query.isAdd === undefined) {
|
||||||
ElMessage.success(res.msg)
|
res = await resubmit(params)
|
||||||
router.push({
|
} else {
|
||||||
path: '/projectdemand/demandcollection'
|
res = await addRequirement(params)
|
||||||
})
|
}
|
||||||
} else {
|
if (res.code === 1000) {
|
||||||
ElMessage.error(res.msg)
|
ElMessage.success(res.msg)
|
||||||
}
|
await router.push({
|
||||||
})
|
path: '/projectdemand/demandcollection'
|
||||||
}else {
|
|
||||||
addRequirement({
|
|
||||||
...formData.value,
|
|
||||||
requirementId: 0,
|
|
||||||
files: fileList.value,
|
|
||||||
deploymentId: processInstanceData.value.deploymentId
|
|
||||||
}).then(res => {
|
|
||||||
if (res.code === 1000) {
|
|
||||||
ElMessage.success(res.msg)
|
|
||||||
router.push({
|
|
||||||
path: '/projectdemand/demandcollection'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
ElMessage.error(res.msg)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const getDetailInfo = async () => {
|
const getDetailInfo = async () => {
|
||||||
@@ -223,11 +199,7 @@ const getDetailInfo = async () => {
|
|||||||
if (res.code === 1000) {
|
if (res.code === 1000) {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
ElMessage.success(res.msg)
|
ElMessage.success(res.msg)
|
||||||
// formData.value = res.data
|
formData.value = res.data
|
||||||
formData.value = res.data.formData
|
|
||||||
// if (route.query.isAdd == undefined) {
|
|
||||||
// showTable.value = true
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
ElMessage.error(res.msg)
|
ElMessage.error(res.msg)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user