附件上传优化,项目承接主体字段功能优化
This commit is contained in:
@@ -96,15 +96,6 @@ const addOrEditProject = async () => {
|
||||
if (await tableFormRef.value.validateFun()) {
|
||||
loadingInterface.value = true;
|
||||
const projectForm = tableFormRef.value.getFormDataFun();
|
||||
// EP的项目主体字段 放到拓展字段
|
||||
projectForm.extras = projectForm.extras.map((item: any) => {
|
||||
if (item.propertyName === 'projectUndertaker') {
|
||||
item.propertyValue = editRowInfo.value.projectUndertaker;
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
};
|
||||
});
|
||||
|
||||
let result;
|
||||
if (projectForm.planTime) {
|
||||
@@ -210,6 +201,16 @@ const epProjectSelectFun = (row: any) => {
|
||||
// EP的项目主体字段 放到拓展字段
|
||||
projectUndertaker: row.projectUndertaker,
|
||||
};
|
||||
|
||||
// EP的项目主体字段 放到拓展字段
|
||||
editRowInfo.value.extras = editRowInfo.value.extras.map((item: any) => {
|
||||
if (item.propertyName === 'projectUndertaker') {
|
||||
item.propertyValue = editRowInfo.value.projectUndertaker;
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
};
|
||||
});
|
||||
// tableFormRef.value.setFormDataFun({
|
||||
// ...tableFormRef.value.getFormDataFun(),
|
||||
// nodeCode: row.projectNum,
|
||||
|
||||
@@ -73,12 +73,12 @@ import TableForm from '@/components/common/table/tableForm.vue';
|
||||
import { addDemandApi, deleteDemandApi, demandListApi, editDemandApi } from '@/api/project/demand';
|
||||
import { getChildrenNodeList } from '../../projectDetail/components/projectApi';
|
||||
import { NODE_TYPE } from '@/utils/enum/node';
|
||||
import { upload } from '@/api/request';
|
||||
// import { upload } from '@/api/request';
|
||||
import { CommonStore } from '@/stores/common';
|
||||
import attachments from '@/views/task/simulationTask/components/attachments.vue';
|
||||
import { FILE_TYPE } from '@/utils/enum/file';
|
||||
// import { FILE_TYPE } from '@/utils/enum/file';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { dataDelFileApi, dataQueryDirApi } from '@/api/data/data';
|
||||
import { batchAddFileInfoApi, dataDelFileApi, dataQueryDirApi } from '@/api/data/data';
|
||||
import demandTable from '../components/demandTable.vue';
|
||||
import { getMemberListIds } from '@/utils/task';
|
||||
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
|
||||
@@ -86,9 +86,11 @@ import { syncDemandList } from '../taskPage';
|
||||
import { getChildrenNodeListApi } from '@/api/project/node';
|
||||
import type { Options } from '@/types';
|
||||
import { listDeptApi } from '@/api/system/departMent';
|
||||
import { uploadBigFile } from '@/utils/file';
|
||||
// import emitter from '@/utils/eventBus';
|
||||
|
||||
const env = import.meta.env;
|
||||
const PREFIX = env.VITE_API_PREFIX_PROJECT;
|
||||
// const env = import.meta.env;
|
||||
// const PREFIX = env.VITE_API_PREFIX_PROJECT;
|
||||
|
||||
defineProps({
|
||||
hideKeys: {
|
||||
@@ -266,18 +268,25 @@ const confirmFun = async () => {
|
||||
// 没有demandId就是创建需求失败
|
||||
if (demandId && fromData.attachments?.length > 0) {
|
||||
for (let index = 0; index < fromData.attachments.length; index++) {
|
||||
const form = new FormData();
|
||||
form.append('fileType', String(FILE_TYPE.DEMAND_ATTACHMENTS));
|
||||
// form.append('nodeId ', demandId);
|
||||
// form.append('dirId ', demandId);
|
||||
form.append('uuid ', demandId);
|
||||
form.append('fileName ', fromData.attachments[index].name);
|
||||
form.append('file ', fromData.attachments[index].raw);
|
||||
form.append('projectId ', String(fromData.projectId));
|
||||
upload(`${PREFIX}demand/uploadDemandFiles`, form);
|
||||
// const form = new FormData();
|
||||
// form.append('fileType', String(FILE_TYPE.DEMAND_ATTACHMENTS));
|
||||
// form.append('uuid ', demandId);
|
||||
// form.append('fileName ', fromData.attachments[index].name);
|
||||
// form.append('file ', fromData.attachments[index].raw);
|
||||
// form.append('projectId ', String(fromData.projectId));
|
||||
// upload(`${PREFIX}demand/uploadDemandFiles`, form);
|
||||
}
|
||||
formVisible.value = false;
|
||||
}
|
||||
const params = {
|
||||
fileList: fromData.attachments.filter((item: any) => item.raw), // 文件列表
|
||||
// dirId: demandId, // 文件目录id
|
||||
projectId: fromData.projectId, // 项目id
|
||||
callbackFlag: '/task/sponsor', // 回调标识
|
||||
uuid: demandId,
|
||||
};
|
||||
await uploadBigFile(params, batchAddFileInfoApi);
|
||||
// batchUploadFile(fromData.attachments, fromData.projectId, demandId);
|
||||
formVisible.value = false;
|
||||
} else {
|
||||
await editDemandApiFun(fromData);
|
||||
}
|
||||
@@ -286,6 +295,42 @@ const confirmFun = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// const batchUploadFile = async (files: any[], projectUuid: string, uuid: string) => {
|
||||
// const sourceFiles = [];
|
||||
// for (let index = 0; index < files.length; index++) {
|
||||
// sourceFiles.push({
|
||||
// fileName: files[index].name,
|
||||
// size: files[index].size,
|
||||
// fileType: await fileUploadAllocationTypeFun(files[index].name),
|
||||
// });
|
||||
// }
|
||||
// if (sourceFiles.length > 0) {
|
||||
// const params = {
|
||||
// sourceFiles,
|
||||
// uploadTaskId: new Date().getTime(),
|
||||
// projectId: projectUuid,
|
||||
// uuid: uuid,
|
||||
// type: 0,
|
||||
// remarks: '',
|
||||
// };
|
||||
// batchAddFileInfoApi(params).then((res: any) => {
|
||||
// if (res.code === 200) {
|
||||
// res.data.forEach((item: any, index: number) => {
|
||||
// emitter.emit('ADD_UPLOAD_FILE', {
|
||||
// file: files[index]?.raw,
|
||||
// data: {
|
||||
// ...item,
|
||||
// isApprove: 0,
|
||||
// taskType: 5,
|
||||
// callbackFlag: '/task/sponsor',
|
||||
// },
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// };
|
||||
|
||||
const createDemandApiFun = async (fromData: any) => {
|
||||
const params = {
|
||||
pid: fromData.nodeId,
|
||||
@@ -339,18 +384,36 @@ const editDemandApiFun = async (fromData: any) => {
|
||||
ElMessage.success('修改成功');
|
||||
formVisible.value = false;
|
||||
if (fromData.attachments.length > 0) {
|
||||
fromData.attachments.forEach((item: any) => {
|
||||
if (item.raw) {
|
||||
const form = new FormData();
|
||||
form.append('fileType', String(FILE_TYPE.DEMAND_ATTACHMENTS));
|
||||
form.append('nodeId ', fromData.id);
|
||||
form.append('uuid ', fromData.uuid);
|
||||
form.append('fileName ', item.name);
|
||||
form.append('file ', item.raw);
|
||||
form.append('projectId ', String(fromData.projectId));
|
||||
upload(`${PREFIX}demand/uploadDemandFiles`, form);
|
||||
}
|
||||
});
|
||||
const files = fromData.attachments.filter((item: any) => item.raw);
|
||||
const params = {
|
||||
fileList: files, // 文件列表
|
||||
// dirId: fromData.uuid, // 文件目录id
|
||||
projectId: fromData.projectId, // 项目id
|
||||
callbackFlag: '/task/sponsor', // 回调标识
|
||||
// isApprove: 0, // 0不需要审批 1需要审批 默认0
|
||||
// type: 0,
|
||||
uuid: fromData.uuid,
|
||||
};
|
||||
console.log('params', params);
|
||||
await uploadBigFile(params, batchAddFileInfoApi);
|
||||
|
||||
// batchUploadFile(
|
||||
// fromData.attachments.filter((item: any) => item.raw),
|
||||
// fromData.projectId,
|
||||
// fromData.uuid
|
||||
// );
|
||||
// fromData.attachments.forEach((item: any) => {
|
||||
// if (item.raw) {
|
||||
// const form = new FormData();
|
||||
// form.append('fileType', String(FILE_TYPE.DEMAND_ATTACHMENTS));
|
||||
// form.append('nodeId ', fromData.id);
|
||||
// form.append('uuid ', fromData.uuid);
|
||||
// form.append('fileName ', item.name);
|
||||
// form.append('file ', item.raw);
|
||||
// form.append('projectId ', String(fromData.projectId));
|
||||
// upload(`${PREFIX}demand/uploadDemandFiles`, form);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
oldAttachments.value.forEach((item: any) => {
|
||||
if (
|
||||
@@ -384,7 +447,7 @@ const changeFun = async (val: any, type: string) => {
|
||||
nextKey = 'phaseId';
|
||||
nodeId = val.data.projectId;
|
||||
let pMemberId = '';
|
||||
for (let index = 0; index < val.data.extras.length; index++) {
|
||||
for (let index = 0; index < val.val.extras.length; index++) {
|
||||
if (val.val.extras[index]?.propertyName === 'projectUndertaker') {
|
||||
const deptList = await listDeptApi({ current: 1, size: 999 });
|
||||
const dept = deptList.data.data.find((item: any) => {
|
||||
|
||||
Reference in New Issue
Block a user