优化创建需求

This commit is contained in:
weibl
2026-02-05 09:13:24 +08:00
parent 67cfb7c789
commit 08438203b9
3 changed files with 26 additions and 7 deletions

View File

@@ -15,6 +15,7 @@ export const getDemandHideKeys = (key: string) => {
'deviceMessage',
'materialAndCraftsmanship',
'robotNum',
'colorRequirements',
];
let keys: string[] = [];
if (key.indexOf('有限元') !== -1 || key.indexOf('DISCIPLINE_TYPE') !== -1) {
@@ -30,6 +31,7 @@ export const getDemandHideKeys = (key: string) => {
'viewRequirements',
'referenceData',
'deviceMessage',
'colorRequirements',
'materialAndCraftsmanship',
];
keys = allKeys.filter((item) => !industrialKeys.includes(item));

View File

@@ -49,7 +49,7 @@
<el-link type="primary" @click="seeAttachments(row.uuid)">查看附件</el-link>
</template>
<template #demandType="{ row }">
{{ DEMAND_TYPE.O[row.demandType] }}
{{ SIMULATION_TYPE.O[row.demandType] }}
</template>
<template #simType="{ row }">
{{ disposeSimType(row.demandType, row.simType) }}
@@ -147,7 +147,7 @@ defineProps({
const commonStore = CommonStore();
const { DEMAND_TYPE, IS_MOLD_MARKING } = useDict('DEMAND_TYPE', 'IS_MOLD_MARKING');
const { SIMULATION_TYPE, IS_MOLD_MARKING } = useDict('SIMULATION_TYPE', 'IS_MOLD_MARKING');
const emits = defineEmits(['show']);
const attachmentsVisible = ref(false);

View File

@@ -79,9 +79,9 @@
<el-select v-model="editFormInfo.pMemberList" filterable placeholder="请选择">
<el-option
v-for="item in deptOptions"
:key="item.value"
:key="item.value + item.label"
:label="item.label + '(' + item.userName + ')'"
:value="item.value"
:value="item.value + '-' + item.label"
/>
</el-select>
</template>
@@ -217,6 +217,7 @@ const visibleDialog = async (isCreate: boolean, row?: any) => {
changeSimulationType(simulationType.value);
});
if (!isCreateDialog.value) {
simulationType.value = row.demandType;
// if (row?.isMoldMaking === 'Y') {
// formHideKeys.value = [];
// } else {
@@ -346,6 +347,15 @@ const confirmFun = async () => {
}
};
const getPMemberId = () => {
const pMemberIdArr = editFormInfo.value.pMemberList.split('-');
let pMemberId = '';
if (pMemberIdArr.length > 0) {
pMemberId = pMemberIdArr[0];
}
return pMemberId;
};
const createDemandApiFun = async (fromData: any) => {
const params = {
pid: fromData.nodeId,
@@ -361,6 +371,7 @@ const createDemandApiFun = async (fromData: any) => {
// 'phaseId': fromData.phaseId,
// 'nodeId': fromData.nodeId,
...fromData,
pMemberList: getPMemberId(),
demandStatus: '0',
@@ -403,7 +414,7 @@ const editDemandApiFun = async (fromData: any) => {
// })
const res: any = await editDemandApi({
...fromData,
pMemberList: fromData.pMemberList,
pMemberList: getPMemberId(),
eMemberList: '',
machineId: fromData.machineId,
workspaceId: fromData.workspace,
@@ -492,7 +503,8 @@ const changeFun = async (val: any, type: string) => {
}
}
if (formData.simType) {
formData.pMemberList = await disposeDeptMember();
await disposeDeptMember();
// formData.pMemberList = await disposeDeptMember();
}
}
if (nodeId) {
@@ -574,7 +586,8 @@ const changeFun = async (val: any, type: string) => {
}
if (val.key === 'simType') {
if (formData.projectId) {
formData.pMemberList = await disposeDeptMember();
await disposeDeptMember();
// formData.pMemberList = await disposeDeptMember();
}
}
@@ -591,6 +604,7 @@ const changeFun = async (val: any, type: string) => {
const deptList = ref<any[]>([]);
const disposeDeptMember = async () => {
let pMemberId = '';
editFormInfo.value.pMemberList = '';
if (deptList.value.length === 0) {
const res = await listDeptApi({ current: 1, size: 999 });
deptList.value = res.data.data;
@@ -601,12 +615,15 @@ const disposeDeptMember = async () => {
if (matchingDeptList.length > 0) {
if (matchingDeptList.length === 1) {
pMemberId = matchingDeptList[0].userId;
editFormInfo.value.pMemberList =
matchingDeptList[0].userId + '-' + matchingDeptList[0].deptName;
} else {
const machDept = matchingDeptList.find((item: any) => {
return item.deptName.indexOf(editFormInfo.value.simType) !== -1;
});
if (machDept) {
pMemberId = machDept.userId;
editFormInfo.value.pMemberList = machDept.userId + '-' + machDept.deptName;
}
}
}