2025-10-30 19:30:06 +08:00
|
|
|
|
<template>
|
2025-11-06 11:46:47 +08:00
|
|
|
|
<!-- 新增待办 -->
|
2025-12-09 20:44:10 +08:00
|
|
|
|
<div class="gl-page-content-full">
|
2025-10-30 19:30:06 +08:00
|
|
|
|
<demandTable
|
|
|
|
|
|
showIndex
|
|
|
|
|
|
ref="tableRef"
|
|
|
|
|
|
tableName="SIMULATION_TASK_DEMAND_CREATE"
|
2026-01-15 09:20:10 +08:00
|
|
|
|
:params="demandParams"
|
2025-10-30 19:30:06 +08:00
|
|
|
|
:api="demandListApi"
|
2026-02-03 21:41:12 +08:00
|
|
|
|
:searchAttrs="{
|
|
|
|
|
|
projectId: {
|
|
|
|
|
|
auth: false,
|
|
|
|
|
|
},
|
|
|
|
|
|
}"
|
2025-11-26 17:12:24 +08:00
|
|
|
|
exportFileName="新增待办需求"
|
2025-12-30 10:27:47 +08:00
|
|
|
|
:actionList="actionList"
|
2026-01-12 19:50:26 +08:00
|
|
|
|
@show="showTaskDetailFun"
|
2026-01-16 16:53:43 +08:00
|
|
|
|
:name-click="false"
|
2025-10-30 19:30:06 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #leftOptions>
|
2025-12-22 15:03:37 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
v-if="enableConfigByTenant([TENANT_ENUM.LYRIC])"
|
|
|
|
|
|
icon="Refresh"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
@click="syncDemandList"
|
|
|
|
|
|
>同步</el-button
|
|
|
|
|
|
>
|
2026-01-28 15:51:29 +08:00
|
|
|
|
<el-button
|
|
|
|
|
|
icon="plus"
|
|
|
|
|
|
type="primary"
|
|
|
|
|
|
v-permission="'demand_add_demand'"
|
|
|
|
|
|
@click="visibleDialog(true)"
|
|
|
|
|
|
>创建需求</el-button
|
|
|
|
|
|
>
|
2025-10-30 19:30:06 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</demandTable>
|
|
|
|
|
|
<Dialog
|
|
|
|
|
|
v-model="formVisible"
|
|
|
|
|
|
:loading="loadingInterface"
|
2025-12-05 09:12:47 +08:00
|
|
|
|
:diaTitle="isCreateDialog ? '创建需求' : '编辑需求'"
|
2025-12-08 09:41:16 +08:00
|
|
|
|
:width="800"
|
2026-01-21 09:42:18 +08:00
|
|
|
|
:height="650"
|
2025-10-30 19:30:06 +08:00
|
|
|
|
@close="closeFun"
|
|
|
|
|
|
show-footer
|
|
|
|
|
|
>
|
2026-02-03 17:52:38 +08:00
|
|
|
|
<div class="tabs">
|
|
|
|
|
|
<el-tabs @tab-change="changeSimulationType" v-model="simulationType" type="card">
|
|
|
|
|
|
<el-tab-pane
|
|
|
|
|
|
v-for="item in simulationTypeList"
|
|
|
|
|
|
:label="item.label + '待办'"
|
|
|
|
|
|
:name="item.value"
|
|
|
|
|
|
:key="item.value"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-tabs>
|
|
|
|
|
|
</div>
|
2026-02-04 10:23:08 +08:00
|
|
|
|
<PlanningInformation :data="{ name: simulationType }"></PlanningInformation>
|
2026-02-03 17:52:38 +08:00
|
|
|
|
<!-- <div class="message-info">
|
|
|
|
|
|
<div v-if="simulationType === SIMULATION_TYPE.FINITE_ELEMENT" class="message-item">
|
|
|
|
|
|
1、有限元仿真登记提醒: 若不清楚本待办需求如何填写,请看<span class="down-file"
|
|
|
|
|
|
>《填写指导书》</span
|
|
|
|
|
|
>。
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div> -->
|
2025-10-30 19:30:06 +08:00
|
|
|
|
<TableForm
|
|
|
|
|
|
ref="tableFormRef"
|
|
|
|
|
|
tableName="SIMULATION_TASK_DEMAND_CREATE"
|
2026-02-03 21:41:12 +08:00
|
|
|
|
:formAttrs="{
|
|
|
|
|
|
projectId: {
|
|
|
|
|
|
auth: false,
|
|
|
|
|
|
},
|
|
|
|
|
|
}"
|
2025-11-28 14:05:05 +08:00
|
|
|
|
:colNum="2"
|
2026-01-21 10:44:04 +08:00
|
|
|
|
:hideKeys="hideKeys.concat(formHideKeys)"
|
2026-01-21 11:30:22 +08:00
|
|
|
|
v-model:data="editFormInfo"
|
2026-02-03 21:41:12 +08:00
|
|
|
|
@change="changeFun($event, 'form')"
|
|
|
|
|
|
@load="loadTableForm"
|
2025-10-30 19:30:06 +08:00
|
|
|
|
>
|
2026-01-10 13:48:26 +08:00
|
|
|
|
<template #form-pMemberList>
|
|
|
|
|
|
<el-select v-model="editFormInfo.pMemberList" filterable placeholder="请选择">
|
|
|
|
|
|
<el-option
|
|
|
|
|
|
v-for="item in deptOptions"
|
|
|
|
|
|
:key="item.value"
|
2026-01-30 11:20:34 +08:00
|
|
|
|
:label="item.label + '(' + item.userName + ')'"
|
2026-01-10 13:48:26 +08:00
|
|
|
|
:value="item.value"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</el-select>
|
2025-12-02 19:45:37 +08:00
|
|
|
|
</template>
|
2025-10-30 19:30:06 +08:00
|
|
|
|
</TableForm>
|
2025-11-04 09:56:26 +08:00
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<el-button @click="closeFun">取消</el-button>
|
|
|
|
|
|
<el-button :loading="loadingInterface" type="primary" @click="confirmFun">确认</el-button>
|
|
|
|
|
|
</div>
|
2025-10-30 19:30:06 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</Dialog>
|
|
|
|
|
|
</div>
|
2025-12-05 09:12:47 +08:00
|
|
|
|
<attachments :demandId="demandInfo.uuid" v-model:visible="attachmentsVisible"></attachments>
|
2025-10-30 19:30:06 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
|
import { nextTick, reactive, ref } from 'vue';
|
|
|
|
|
|
import Dialog from '@/components/common/dialog/index.vue';
|
|
|
|
|
|
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';
|
2026-01-22 15:46:15 +08:00
|
|
|
|
// import { upload } from '@/api/request';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
import { CommonStore } from '@/stores/common';
|
|
|
|
|
|
import attachments from '@/views/task/simulationTask/components/attachments.vue';
|
2026-01-22 15:46:15 +08:00
|
|
|
|
// import { FILE_TYPE } from '@/utils/enum/file';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
import { ElMessage } from 'element-plus';
|
2026-01-22 15:46:15 +08:00
|
|
|
|
import { batchAddFileInfoApi, dataDelFileApi, dataQueryDirApi } from '@/api/data/data';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
import demandTable from '../components/demandTable.vue';
|
2025-11-24 15:03:50 +08:00
|
|
|
|
import { getMemberListIds } from '@/utils/task';
|
2025-12-22 15:03:37 +08:00
|
|
|
|
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
|
2025-12-25 17:43:02 +08:00
|
|
|
|
import { syncDemandList } from '../taskPage';
|
2025-12-31 14:09:48 +08:00
|
|
|
|
import { getChildrenNodeListApi } from '@/api/project/node';
|
2026-01-21 09:42:18 +08:00
|
|
|
|
import { listDeptApi } from '@/api/system/departMent';
|
2026-01-22 15:46:15 +08:00
|
|
|
|
import { uploadBigFile } from '@/utils/file';
|
2026-02-03 17:52:38 +08:00
|
|
|
|
import { getDemandHideKeys } from '@/tenants/lyric/views/task/lyricTask';
|
2026-02-04 10:23:08 +08:00
|
|
|
|
import PlanningInformation from '@/tenants/lyric/views/task/components/planningInformation.vue';
|
2026-01-22 15:46:15 +08:00
|
|
|
|
// import emitter from '@/utils/eventBus';
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
2026-01-22 15:46:15 +08:00
|
|
|
|
// const env = import.meta.env;
|
|
|
|
|
|
// const PREFIX = env.VITE_API_PREFIX_PROJECT;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
2025-12-02 19:45:37 +08:00
|
|
|
|
defineProps({
|
2025-12-15 11:46:59 +08:00
|
|
|
|
hideKeys: {
|
2025-12-02 19:45:37 +08:00
|
|
|
|
type: Array,
|
|
|
|
|
|
default: () => [],
|
|
|
|
|
|
},
|
2026-01-10 13:48:26 +08:00
|
|
|
|
deptOptions: {
|
2026-01-30 11:20:34 +08:00
|
|
|
|
type: Array<any>,
|
2026-01-10 13:48:26 +08:00
|
|
|
|
default: () => [],
|
|
|
|
|
|
},
|
2025-12-02 19:45:37 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2025-12-15 11:46:59 +08:00
|
|
|
|
const emits = defineEmits(['visibleDialog', 'loadTableForm', 'changeForm']);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
|
2026-02-04 10:23:08 +08:00
|
|
|
|
// enum SIMULATION_TYPE {
|
|
|
|
|
|
// /** 有限元仿真待办 */
|
|
|
|
|
|
// FINITE_ELEMENT = 'finiteElement',
|
|
|
|
|
|
// /** 机器人仿真待办 */
|
|
|
|
|
|
// ROBOT = 'robot',
|
|
|
|
|
|
// /** 动画仿真待办 */
|
|
|
|
|
|
// DYNAMIC = 'dynamic',
|
|
|
|
|
|
// /** 外观设计待办 */
|
|
|
|
|
|
// INDUSTRIAL_DESIGN = 'industrialDesign',
|
|
|
|
|
|
// }
|
2026-02-03 17:52:38 +08:00
|
|
|
|
|
2026-01-15 09:20:10 +08:00
|
|
|
|
const demandParams = ref({ type: 0 });
|
|
|
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
|
const commonStore = CommonStore();
|
|
|
|
|
|
|
2026-01-12 19:50:26 +08:00
|
|
|
|
const showTaskDetailFun = (row: any) => {
|
2026-01-15 09:34:35 +08:00
|
|
|
|
// showTaskDetailDialog.value = true;
|
|
|
|
|
|
// currentTaskInfo.value = row;
|
|
|
|
|
|
|
|
|
|
|
|
visibleDialog(false, row);
|
2026-01-12 19:50:26 +08:00
|
|
|
|
};
|
2025-12-30 10:27:47 +08:00
|
|
|
|
const actionList = ref([
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '编辑',
|
|
|
|
|
|
type: 'primary',
|
|
|
|
|
|
click: (row: any) => {
|
|
|
|
|
|
visibleDialog(false, row);
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '删除',
|
|
|
|
|
|
type: 'danger',
|
|
|
|
|
|
needConfirm: true,
|
|
|
|
|
|
confirmTip: '确认删除吗?',
|
|
|
|
|
|
click: (row: any) => {
|
|
|
|
|
|
deleteDemandFun(row.uuid);
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
|
const loadingInterface = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
const formVisible = ref(false);
|
|
|
|
|
|
const closeFun = () => {
|
2026-02-04 10:23:08 +08:00
|
|
|
|
tableFormRef.value.resetFun();
|
2025-10-30 19:30:06 +08:00
|
|
|
|
formVisible.value = false;
|
|
|
|
|
|
attachmentsVisible.value = false;
|
|
|
|
|
|
// 清空删除的文件
|
|
|
|
|
|
deleteFileList.value = [];
|
2026-01-29 16:37:49 +08:00
|
|
|
|
tableFormRef.value?.resetFun();
|
2025-10-30 19:30:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const attachmentsVisible = ref(false);
|
|
|
|
|
|
|
|
|
|
|
|
const tableRef = ref();
|
|
|
|
|
|
|
|
|
|
|
|
const tableFormRef = ref();
|
|
|
|
|
|
|
|
|
|
|
|
const demandInfo = reactive({
|
|
|
|
|
|
id: 0,
|
|
|
|
|
|
uuid: '',
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const isCreateDialog = ref(true);
|
|
|
|
|
|
|
2026-01-10 13:48:26 +08:00
|
|
|
|
const editFormInfo = ref<any>({});
|
2025-12-30 13:54:57 +08:00
|
|
|
|
|
2025-12-15 11:46:59 +08:00
|
|
|
|
const visibleDialog = async (isCreate: boolean, row?: any) => {
|
2025-10-30 19:30:06 +08:00
|
|
|
|
formVisible.value = true;
|
2025-12-15 11:46:59 +08:00
|
|
|
|
isCreateDialog.value = isCreate;
|
2026-01-21 09:42:18 +08:00
|
|
|
|
loadingInterface.value = true;
|
2026-02-04 10:23:08 +08:00
|
|
|
|
// if (isCreate) {
|
|
|
|
|
|
// nextTick(() => {
|
|
|
|
|
|
// tableFormRef.value.resetFun();
|
|
|
|
|
|
// });
|
|
|
|
|
|
// }
|
2026-02-03 17:52:38 +08:00
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
changeSimulationType(simulationType.value);
|
|
|
|
|
|
});
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (!isCreateDialog.value) {
|
2026-02-03 17:52:38 +08:00
|
|
|
|
// if (row?.isMoldMaking === 'Y') {
|
|
|
|
|
|
// formHideKeys.value = [];
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// formHideKeys.value = ['materialNo'];
|
|
|
|
|
|
// }
|
2025-12-11 10:33:33 +08:00
|
|
|
|
const res: any = await dataQueryDirApi({ uuid: row.uuid, current: 1, size: 99 });
|
2025-12-05 09:12:47 +08:00
|
|
|
|
row.attachments =
|
|
|
|
|
|
res.data?.data?.map((item: { originalName: any; fileSize: any; id: number }) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
name: item.originalName,
|
|
|
|
|
|
size: item.fileSize,
|
|
|
|
|
|
id: item.id,
|
|
|
|
|
|
};
|
|
|
|
|
|
}) || [];
|
2025-12-12 17:14:26 +08:00
|
|
|
|
oldAttachments.value = [...row.attachments];
|
2025-10-30 19:30:06 +08:00
|
|
|
|
let phaseList = [];
|
|
|
|
|
|
if (row.phaseId) {
|
2025-12-05 09:12:47 +08:00
|
|
|
|
phaseList = await getChildrenNodeList(NODE_TYPE.PHASE, row.projectId);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
phaseList = phaseList.map((item: any) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
label: item.nodeName,
|
|
|
|
|
|
value: item.uuid,
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2026-01-20 14:13:32 +08:00
|
|
|
|
let workspaceList = [];
|
|
|
|
|
|
if (row.workspace && row.phaseId) {
|
|
|
|
|
|
workspaceList = await getChildrenNodeList(NODE_TYPE.WORKSPACE, row.phaseId);
|
|
|
|
|
|
workspaceList = workspaceList.map((item: any) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
label: item.nodeName,
|
|
|
|
|
|
value: item.uuid,
|
2026-01-31 16:55:37 +08:00
|
|
|
|
parentId: item.parentId,
|
2026-01-20 14:13:32 +08:00
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2025-12-05 09:12:47 +08:00
|
|
|
|
let simList: any;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (row.simType) {
|
2025-11-13 16:20:11 +08:00
|
|
|
|
simList = commonStore.getDictData(row.demandType);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
2025-12-12 17:14:26 +08:00
|
|
|
|
row.planTime = [row.beginTime, row.endTime];
|
|
|
|
|
|
|
2025-10-30 19:30:06 +08:00
|
|
|
|
nextTick(() => {
|
|
|
|
|
|
tableFormRef.value.setOptionsFun('phaseId', phaseList);
|
2026-01-20 14:13:32 +08:00
|
|
|
|
tableFormRef.value.setOptionsFun('workspace', workspaceList);
|
2025-12-08 09:41:16 +08:00
|
|
|
|
if (simList?.A) {
|
|
|
|
|
|
tableFormRef.value.setOptionsFun('simType', simList.A);
|
|
|
|
|
|
}
|
2025-10-30 19:30:06 +08:00
|
|
|
|
let pMemberList = '';
|
|
|
|
|
|
if (row.pMemberList) {
|
2025-11-24 15:03:50 +08:00
|
|
|
|
pMemberList = getMemberListIds(row.pMemberList);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
2025-12-12 15:32:37 +08:00
|
|
|
|
let tMemberList = '';
|
|
|
|
|
|
if (row.tMemberList) {
|
|
|
|
|
|
tMemberList = getMemberListIds(row.tMemberList);
|
|
|
|
|
|
}
|
|
|
|
|
|
let aMemberList = '';
|
|
|
|
|
|
if (row.aMemberList) {
|
|
|
|
|
|
aMemberList = getMemberListIds(row.aMemberList);
|
|
|
|
|
|
}
|
2026-01-20 14:13:32 +08:00
|
|
|
|
editFormInfo.value = {
|
|
|
|
|
|
...row,
|
|
|
|
|
|
pMemberList,
|
|
|
|
|
|
tMemberList,
|
|
|
|
|
|
aMemberList,
|
|
|
|
|
|
};
|
2025-12-30 13:54:57 +08:00
|
|
|
|
// tableFormRef.value.setFormDataFun({ ...row, pMemberList, tMemberList, aMemberList });
|
2025-10-30 19:30:06 +08:00
|
|
|
|
});
|
|
|
|
|
|
} else {
|
2025-12-30 13:54:57 +08:00
|
|
|
|
editFormInfo.value = {};
|
|
|
|
|
|
// nextTick(() => {
|
|
|
|
|
|
// tableFormRef.value.resetFun();
|
|
|
|
|
|
// });
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
2025-12-15 11:46:59 +08:00
|
|
|
|
emits('visibleDialog', { isCreate, row });
|
2026-01-21 09:42:18 +08:00
|
|
|
|
loadingInterface.value = false;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const deleteDemandFun = async (uuid: number) => {
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const res: any = await deleteDemandApi({ deleteNodeIdList: [uuid] });
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
ElMessage.success('删除成功');
|
|
|
|
|
|
tableRef.value.tableRef.resetFun();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const confirmFun = async () => {
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (await tableFormRef.value.validateFun()) {
|
|
|
|
|
|
loadingInterface.value = true;
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const fromData: any = tableFormRef.value.getFormDataFun();
|
2025-11-14 10:22:06 +08:00
|
|
|
|
if (fromData.planTime) {
|
|
|
|
|
|
fromData.beginTime = fromData.planTime[0];
|
|
|
|
|
|
fromData.endTime = fromData.planTime[1];
|
|
|
|
|
|
}
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (isCreateDialog.value) {
|
|
|
|
|
|
const demandId = await createDemandApiFun(fromData);
|
|
|
|
|
|
// 没有demandId就是创建需求失败
|
|
|
|
|
|
if (demandId && fromData.attachments?.length > 0) {
|
2026-01-22 20:55:42 +08:00
|
|
|
|
// for (let index = 0; index < fromData.attachments.length; index++) {
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
// }
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
2026-01-31 16:55:37 +08:00
|
|
|
|
const files = fromData.attachments.filter((item: any) => item.raw);
|
|
|
|
|
|
if (files.length > 0) {
|
|
|
|
|
|
const params = {
|
|
|
|
|
|
fileList: files, // 文件列表
|
|
|
|
|
|
// dirId: demandId, // 文件目录id
|
|
|
|
|
|
projectId: fromData.projectId, // 项目id
|
|
|
|
|
|
callbackFlag: '/task/sponsor', // 回调标识
|
|
|
|
|
|
uuid: demandId,
|
|
|
|
|
|
};
|
|
|
|
|
|
await uploadBigFile(params, batchAddFileInfoApi);
|
|
|
|
|
|
}
|
2026-01-22 15:46:15 +08:00
|
|
|
|
// batchUploadFile(fromData.attachments, fromData.projectId, demandId);
|
|
|
|
|
|
formVisible.value = false;
|
2025-10-30 19:30:06 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
await editDemandApiFun(fromData);
|
|
|
|
|
|
}
|
|
|
|
|
|
loadingInterface.value = false;
|
|
|
|
|
|
tableRef.value.tableRef.resetFun();
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const createDemandApiFun = async (fromData: any) => {
|
2025-10-30 19:30:06 +08:00
|
|
|
|
const params = {
|
2025-12-05 09:12:47 +08:00
|
|
|
|
pid: fromData.nodeId,
|
2025-12-08 09:41:16 +08:00
|
|
|
|
// 'demandName': fromData.demandName,
|
|
|
|
|
|
// 'demandCode': fromData.demandCode,
|
|
|
|
|
|
// demandType: fromData.demandType,
|
|
|
|
|
|
// simType: fromData.simType,
|
|
|
|
|
|
// 'beginTime': fromData.beginTime,
|
|
|
|
|
|
// 'endTime': fromData.endTime,
|
|
|
|
|
|
// 'pMemberList': fromData.pMemberList,
|
2025-10-30 19:30:06 +08:00
|
|
|
|
eMemberList: '',
|
2025-12-08 09:41:16 +08:00
|
|
|
|
// 'projectId': fromData.projectId,
|
|
|
|
|
|
// 'phaseId': fromData.phaseId,
|
|
|
|
|
|
// 'nodeId': fromData.nodeId,
|
|
|
|
|
|
...fromData,
|
2025-12-12 15:32:37 +08:00
|
|
|
|
|
2025-12-08 09:41:16 +08:00
|
|
|
|
demandStatus: '0',
|
2026-01-31 16:55:37 +08:00
|
|
|
|
|
|
|
|
|
|
machineId: fromData.machineId,
|
|
|
|
|
|
workspaceId: fromData.workspace,
|
|
|
|
|
|
|
2026-02-03 17:52:38 +08:00
|
|
|
|
// 待办所属类型
|
|
|
|
|
|
demandType: simulationType.value,
|
|
|
|
|
|
|
2026-01-29 17:51:00 +08:00
|
|
|
|
// 是否走利元亨创建需求直接创建任务逻辑
|
|
|
|
|
|
isLyric: enableConfigByTenant([TENANT_ENUM.LYRIC]),
|
2025-10-30 19:30:06 +08:00
|
|
|
|
};
|
2026-01-31 16:55:37 +08:00
|
|
|
|
// console.log('params', params, editFormInfo.value);
|
|
|
|
|
|
// return;
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const res: any = await addDemandApi(params);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (res.code === 200) {
|
2025-11-28 14:05:05 +08:00
|
|
|
|
formVisible.value = false;
|
|
|
|
|
|
ElMessage.success('创建成功');
|
2025-10-30 19:30:06 +08:00
|
|
|
|
return res.data;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const editDemandApiFun = async (fromData: any) => {
|
2025-10-30 19:30:06 +08:00
|
|
|
|
// let addFileList = [];
|
|
|
|
|
|
// let deleteFileList = [];
|
|
|
|
|
|
// formData.attachments.forEach((item: any) => {
|
|
|
|
|
|
// if(item?.raw) {
|
|
|
|
|
|
// const form = new FormData();
|
|
|
|
|
|
// form.append('fileType', String(FILE_TYPE.DEMAND_ATTACHMENTS));
|
|
|
|
|
|
// form.append('nodeId ', String(demandInfo.id));
|
|
|
|
|
|
// form.append('fileName ', item.name);
|
|
|
|
|
|
// form.append('file ', item.raw);
|
|
|
|
|
|
// upload(`${PREFIX}data/uploadFiles`, form);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// })
|
|
|
|
|
|
// oldAttachments.value.forEach((item: any) => {
|
|
|
|
|
|
// formData.attachments.some((item2: any) => item2.name ===)
|
|
|
|
|
|
// })
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const res: any = await editDemandApi({
|
|
|
|
|
|
...fromData,
|
|
|
|
|
|
pMemberList: fromData.pMemberList,
|
|
|
|
|
|
eMemberList: '',
|
2026-01-31 16:55:37 +08:00
|
|
|
|
machineId: fromData.machineId,
|
|
|
|
|
|
workspaceId: fromData.workspace,
|
2025-12-05 09:12:47 +08:00
|
|
|
|
});
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
ElMessage.success('修改成功');
|
|
|
|
|
|
formVisible.value = false;
|
|
|
|
|
|
if (fromData.attachments.length > 0) {
|
2026-01-22 15:46:15 +08:00
|
|
|
|
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,
|
|
|
|
|
|
};
|
|
|
|
|
|
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);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// });
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
2025-12-12 15:32:37 +08:00
|
|
|
|
oldAttachments.value.forEach((item: any) => {
|
|
|
|
|
|
if (
|
|
|
|
|
|
!fromData.attachments.some((item2: any) => {
|
|
|
|
|
|
if (item2.name === item.name) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
) {
|
|
|
|
|
|
dataDelFileApi({ delFileId: item.id });
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const deleteFileList = ref<number[]>([]);
|
|
|
|
|
|
|
2025-12-12 15:32:37 +08:00
|
|
|
|
const oldAttachments = ref<any[]>([]);
|
|
|
|
|
|
|
2026-02-03 17:52:38 +08:00
|
|
|
|
const formHideKeys = ref<any[]>([]);
|
2026-01-21 10:44:04 +08:00
|
|
|
|
|
2026-01-30 11:20:34 +08:00
|
|
|
|
const currentProjectUndertaker = ref('');
|
|
|
|
|
|
|
2026-02-03 17:52:38 +08:00
|
|
|
|
const simulationTypeList = ref(commonStore.getDictData('SIMULATION_TYPE').A);
|
|
|
|
|
|
const simulationType = ref(simulationTypeList.value[0].value);
|
|
|
|
|
|
|
|
|
|
|
|
const changeSimulationType = (val: string) => {
|
|
|
|
|
|
let simTypeList = [];
|
|
|
|
|
|
simTypeList = commonStore.getDictData(val).A;
|
|
|
|
|
|
tableFormRef.value.setOptionsFun('simType', simTypeList);
|
|
|
|
|
|
formHideKeys.value = getDemandHideKeys(val);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const changeFun = async (val: any, type: string) => {
|
2025-12-30 17:58:29 +08:00
|
|
|
|
const formData = tableFormRef.value.getFormDataFun();
|
2026-01-21 09:42:18 +08:00
|
|
|
|
// editFormInfo.value = { ...formData };
|
2025-10-30 19:30:06 +08:00
|
|
|
|
if (val.key === 'projectId') {
|
|
|
|
|
|
let nodeType = '';
|
|
|
|
|
|
let nextKey = '';
|
|
|
|
|
|
let nodeId = '';
|
|
|
|
|
|
if (val.key === 'projectId') {
|
|
|
|
|
|
nodeType = NODE_TYPE.PHASE;
|
|
|
|
|
|
nextKey = 'phaseId';
|
|
|
|
|
|
nodeId = val.data.projectId;
|
2026-01-30 11:20:34 +08:00
|
|
|
|
currentProjectUndertaker.value = '';
|
2026-01-22 15:46:15 +08:00
|
|
|
|
for (let index = 0; index < val.val.extras.length; index++) {
|
2026-01-21 09:42:18 +08:00
|
|
|
|
if (val.val.extras[index]?.propertyName === 'projectUndertaker') {
|
2026-01-30 11:20:34 +08:00
|
|
|
|
currentProjectUndertaker.value = val.val.extras[index].propertyValue;
|
2026-01-21 09:42:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-30 11:20:34 +08:00
|
|
|
|
if (formData.simType) {
|
|
|
|
|
|
formData.pMemberList = await disposeDeptMember();
|
|
|
|
|
|
}
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
2026-01-13 17:58:19 +08:00
|
|
|
|
if (nodeId) {
|
|
|
|
|
|
const optionList = await getPhaseList(nodeType, nodeId);
|
|
|
|
|
|
tableFormRef.value.setOptionsFun(nextKey, optionList);
|
|
|
|
|
|
if (nextKey === 'phaseId' && optionList.length > 0) {
|
|
|
|
|
|
formData.phaseId = optionList[0].value;
|
2026-01-21 09:42:18 +08:00
|
|
|
|
const workspaceInfo = await getWorkSpaceList(formData.phaseId);
|
|
|
|
|
|
formData.workspace = workspaceInfo.value;
|
2026-01-31 16:55:37 +08:00
|
|
|
|
formData.machineId = workspaceInfo.parentId;
|
2026-01-21 09:42:18 +08:00
|
|
|
|
formData.workspaceName = workspaceInfo.label;
|
2026-01-20 14:13:32 +08:00
|
|
|
|
formData.extras = setWorkSpaceValue(
|
|
|
|
|
|
formData.extras,
|
|
|
|
|
|
formData.workspace,
|
|
|
|
|
|
formData.workspaceName
|
|
|
|
|
|
);
|
2026-01-13 17:58:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (optionList.length === 0) {
|
|
|
|
|
|
formData.phaseId = '';
|
2026-01-31 14:52:00 +08:00
|
|
|
|
// 清空工位数据
|
|
|
|
|
|
formData.extras = setWorkSpaceValue(formData.extras, '', '');
|
|
|
|
|
|
tableFormRef.value.setOptionsFun(NODE_TYPE.WORKSPACE, []);
|
2026-01-13 17:58:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
tableFormRef.value.setOptionsFun(nextKey, []);
|
2026-01-04 17:13:04 +08:00
|
|
|
|
formData.phaseId = '';
|
2026-01-13 17:58:19 +08:00
|
|
|
|
formData.workspace = '';
|
2026-01-20 14:13:32 +08:00
|
|
|
|
formData.workspaceName = '';
|
|
|
|
|
|
formData.extras = setWorkSpaceValue(formData.extras, '', '');
|
2026-01-04 17:13:04 +08:00
|
|
|
|
}
|
2025-12-30 17:58:29 +08:00
|
|
|
|
// const formData = tableFormRef.value.getFormDataFun();
|
2025-12-30 13:54:57 +08:00
|
|
|
|
// tableFormRef.value.setFormDataFun({ ...formData, phaseId: '' });
|
2026-01-04 17:13:04 +08:00
|
|
|
|
editFormInfo.value = { ...formData };
|
2025-10-30 19:30:06 +08:00
|
|
|
|
}
|
2026-01-04 17:13:04 +08:00
|
|
|
|
|
2025-12-31 14:09:48 +08:00
|
|
|
|
if (val.key === 'phaseId') {
|
2026-01-13 17:58:19 +08:00
|
|
|
|
if (formData.phaseId) {
|
2026-01-21 09:42:18 +08:00
|
|
|
|
const workspaceInfo = await getWorkSpaceList(formData.phaseId);
|
2026-01-31 16:55:37 +08:00
|
|
|
|
formData.machineId = workspaceInfo.parentId;
|
2026-01-21 09:42:18 +08:00
|
|
|
|
formData.workspace = workspaceInfo.value;
|
|
|
|
|
|
formData.workspaceName = workspaceInfo.label;
|
2026-01-20 14:13:32 +08:00
|
|
|
|
formData.extras = setWorkSpaceValue(
|
|
|
|
|
|
formData.extras,
|
|
|
|
|
|
formData.workspace,
|
|
|
|
|
|
formData.workspaceName
|
|
|
|
|
|
);
|
2026-01-13 17:58:19 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
formData.workspace = '';
|
2026-01-20 14:13:32 +08:00
|
|
|
|
formData.workspaceName = '';
|
|
|
|
|
|
formData.extras = setWorkSpaceValue(
|
|
|
|
|
|
formData.extras,
|
|
|
|
|
|
formData.workspace,
|
|
|
|
|
|
formData.workspaceName
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
editFormInfo.value = { ...formData };
|
|
|
|
|
|
}
|
|
|
|
|
|
if (val.key === 'workspace') {
|
|
|
|
|
|
if (formData.workspace) {
|
2026-01-31 16:55:37 +08:00
|
|
|
|
formData.machineId = val.val.parentId;
|
2026-01-21 09:42:18 +08:00
|
|
|
|
formData.workspace = val.val.value;
|
|
|
|
|
|
formData.workspaceName = val.val.label;
|
2026-01-20 14:13:32 +08:00
|
|
|
|
formData.extras = setWorkSpaceValue(
|
|
|
|
|
|
formData.extras,
|
|
|
|
|
|
formData.workspace,
|
|
|
|
|
|
formData.workspaceName
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
2026-01-31 16:55:37 +08:00
|
|
|
|
formData.machineId = '';
|
2026-01-20 14:13:32 +08:00
|
|
|
|
formData.workspace = '';
|
|
|
|
|
|
formData.workspaceName = '';
|
|
|
|
|
|
formData.extras = setWorkSpaceValue(
|
|
|
|
|
|
formData.extras,
|
|
|
|
|
|
formData.workspace,
|
|
|
|
|
|
formData.workspaceName
|
|
|
|
|
|
);
|
2025-12-31 14:09:48 +08:00
|
|
|
|
}
|
2026-01-13 17:58:19 +08:00
|
|
|
|
editFormInfo.value = { ...formData };
|
2025-12-31 14:09:48 +08:00
|
|
|
|
}
|
2026-01-30 11:20:34 +08:00
|
|
|
|
if (val.key === 'simType') {
|
|
|
|
|
|
if (formData.projectId) {
|
|
|
|
|
|
formData.pMemberList = await disposeDeptMember();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-03 17:52:38 +08:00
|
|
|
|
// if (val.key === 'isMoldMaking') {
|
|
|
|
|
|
// if (val.val?.value === 'Y') {
|
|
|
|
|
|
// formHideKeys.value = [];
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// formHideKeys.value = ['materialNo'];
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2025-12-15 11:46:59 +08:00
|
|
|
|
emits('changeForm', { val, type });
|
2025-10-30 19:30:06 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-30 11:20:34 +08:00
|
|
|
|
const deptList = ref<any[]>([]);
|
|
|
|
|
|
const disposeDeptMember = async () => {
|
|
|
|
|
|
let pMemberId = '';
|
|
|
|
|
|
if (deptList.value.length === 0) {
|
|
|
|
|
|
const res = await listDeptApi({ current: 1, size: 999 });
|
|
|
|
|
|
deptList.value = res.data.data;
|
|
|
|
|
|
}
|
|
|
|
|
|
const matchingDeptList = deptList.value.filter((item: any) => {
|
|
|
|
|
|
return item.deptName.indexOf(currentProjectUndertaker.value) !== -1;
|
|
|
|
|
|
});
|
|
|
|
|
|
if (matchingDeptList.length > 0) {
|
|
|
|
|
|
if (matchingDeptList.length === 1) {
|
|
|
|
|
|
pMemberId = matchingDeptList[0].userId;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
const machDept = matchingDeptList.find((item: any) => {
|
|
|
|
|
|
return item.deptName.indexOf(editFormInfo.value.simType) !== -1;
|
|
|
|
|
|
});
|
|
|
|
|
|
if (machDept) {
|
|
|
|
|
|
pMemberId = machDept.userId;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return pMemberId;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-20 14:13:32 +08:00
|
|
|
|
const setWorkSpaceValue = (extras: any, workspace: string, workspaceName: string) => {
|
2026-01-13 17:58:19 +08:00
|
|
|
|
return extras.map((item: any) => {
|
|
|
|
|
|
if (item.propertyName === NODE_TYPE.WORKSPACE) {
|
|
|
|
|
|
item.propertyValue = workspace;
|
|
|
|
|
|
}
|
2026-01-20 14:13:32 +08:00
|
|
|
|
if (item.propertyName === NODE_TYPE.WORKSPACE + 'Name') {
|
|
|
|
|
|
item.propertyValue = workspaceName;
|
|
|
|
|
|
}
|
2026-01-13 17:58:19 +08:00
|
|
|
|
return {
|
|
|
|
|
|
...item,
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const getWorkSpaceList = async (phaseId: string) => {
|
|
|
|
|
|
const res: any = await getChildrenNodeListApi({
|
|
|
|
|
|
current: 1,
|
|
|
|
|
|
size: 999,
|
|
|
|
|
|
nodeId: phaseId,
|
|
|
|
|
|
nodeType: NODE_TYPE.WORKSPACE,
|
|
|
|
|
|
});
|
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
if (res.data.length === 0) {
|
|
|
|
|
|
ElMessage.warning('该阶段下没有工位,请先做仿真策划!');
|
2026-01-31 14:52:00 +08:00
|
|
|
|
// 清空工位数据
|
2026-01-31 14:40:32 +08:00
|
|
|
|
tableFormRef.value.setOptionsFun(NODE_TYPE.WORKSPACE, []);
|
2026-01-13 17:58:19 +08:00
|
|
|
|
} else {
|
2026-01-31 16:55:37 +08:00
|
|
|
|
const optionList = res.data.map((item: any) => {
|
2026-01-13 17:58:19 +08:00
|
|
|
|
return {
|
|
|
|
|
|
label: item.nodeName,
|
|
|
|
|
|
value: item.uuid,
|
2026-01-31 16:55:37 +08:00
|
|
|
|
parentId: item.parentId,
|
2026-01-13 17:58:19 +08:00
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
tableFormRef.value.setOptionsFun(NODE_TYPE.WORKSPACE, optionList);
|
|
|
|
|
|
if (optionList.length > 0) {
|
2026-01-20 14:13:32 +08:00
|
|
|
|
return optionList[0];
|
2026-01-13 17:58:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-20 14:13:32 +08:00
|
|
|
|
return {
|
|
|
|
|
|
label: '',
|
|
|
|
|
|
value: '',
|
2026-01-31 16:55:37 +08:00
|
|
|
|
parentId: '',
|
2026-01-20 14:13:32 +08:00
|
|
|
|
};
|
2026-01-13 17:58:19 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-05 09:12:47 +08:00
|
|
|
|
const getPhaseList = async (nodeType: string, projectUuid: string) => {
|
|
|
|
|
|
let optionList = await getChildrenNodeList(nodeType, projectUuid);
|
2025-10-30 19:30:06 +08:00
|
|
|
|
optionList = optionList.map((item: any) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
label: item.nodeName,
|
|
|
|
|
|
value: item.uuid,
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
return optionList;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const loadTableForm = () => {
|
|
|
|
|
|
emits('loadTableForm');
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// const searchChange = async (val: any) => {
|
|
|
|
|
|
// const optionList = await getPhaseList(nodeType, nodeId);
|
|
|
|
|
|
// tableFormRef.value.setOptionsFun(nextKey, optionList);
|
|
|
|
|
|
// };
|
|
|
|
|
|
defineExpose({
|
|
|
|
|
|
tableFormRef,
|
2026-01-04 17:13:04 +08:00
|
|
|
|
editFormInfo,
|
2025-10-30 19:30:06 +08:00
|
|
|
|
});
|
|
|
|
|
|
</script>
|