update:新增代办

This commit is contained in:
2026-04-10 15:37:14 +08:00
parent a067084d95
commit 1fbdfd09e8
11 changed files with 177 additions and 31 deletions

View File

@@ -23,3 +23,7 @@ export const addDeptApi = (params: any) => {
export const delDeptApi = (params: any) => {
return post(`${PREFIX}dept/deleteDept`, params);
};
export const queryByDeptAndDisciplineApi = (params: any) => {
return get(`${PREFIX}dept/queryByDeptAndDiscipline`, params);
};

View File

@@ -200,11 +200,15 @@ const saveFun = (download: boolean) => {
api = editReportAndDownloadApi;
}
loading.value = true;
api(params).then(() => {
console.warn('reportContent:', data);
ElMessage.success('操作成功');
closeFun();
});
api(params)
.then(() => {
console.warn('reportContent:', data);
ElMessage.success('操作成功');
closeFun();
})
.finally(() => {
loading.value = false;
});
};
const resetFun = () => {

View File

@@ -119,7 +119,7 @@ import { DIR_TYPE } from '@/utils/enum/data.ts';
import { useI18n } from 'vue-i18n';
import { useTaskStore } from '@/stores/taskPool';
import { useReportStore } from '@/stores/reportTemplate';
import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
// import { enableConfigByTenant, TENANT_ENUM } from '@/tenants/tenant';
const taskStore = useTaskStore();
const reportStore = useReportStore();

View File

@@ -17,18 +17,49 @@
<Dialog
v-model="dialogVisible"
:diaTitle="isEditDialog ? '编辑' : '新增'"
:width="500"
:height="300"
:width="400"
show-confirm-button
show-cancel-button
show-footer
@close="closeFun"
>
<div class="content">
<TableForm ref="tableFormRef" tableName="DEPARTMENT_USER" v-model:data="editRowInfo" />
<TableForm
ref="tableFormRef"
tableName="DEPARTMENT_USER"
v-model:data="editRowInfo"
:itemNum="4"
>
<template #form-simulationType>
<el-select v-model="editRowInfo.simulationType" multiple placeholder="请选择">
<el-option
v-for="item in SIMULATION_TYPE.A"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<template #form-discipline>
<el-select
v-model="editRowInfo.discipline"
:disabled="!editRowInfo.simulationType?.length"
multiple
placeholder="请先选择仿真类型"
>
<el-option
v-for="item in disciplineList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</TableForm>
</div>
<template #footer>
<div>
<el-button @click="dialogVisible = false">取消</el-button>
<el-button @click="closeFun">取消</el-button>
<el-button type="primary" @click="confirmFun">确定</el-button>
</div>
</template>
@@ -38,11 +69,14 @@
<script lang="ts" setup>
import BaseTable from '@/components/common/table/baseTable.vue';
import Dialog from '@/components/common/dialog/index.vue';
import { ref } from 'vue';
import { ref, watch } from 'vue';
import TableForm from '@/components/common/table/tableForm.vue';
import { ElMessage } from 'element-plus';
import { addDeptApi, delDeptApi, editDeptApi, listDeptApi } from '@/api/system/departMent';
import { disposeMemberList } from '@/views/task/projectDetail/components/project';
import { useDict } from '@/utils/useDict';
const { SIMULATION_TYPE } = useDict('SIMULATION_TYPE');
const isEditDialog = ref(false);
const dialogVisible = ref(false);
@@ -71,48 +105,81 @@ const actionList = ref<any>([
},
]);
const editRowInfo = ref({});
const editRowInfo = ref<any>({});
const openDialog = (type: string, row?: any) => {
isEditDialog.value = type === 'edit';
dialogVisible.value = true;
// nextTick(() => {
if (type === 'edit' && row) {
row.fileType = String(row.fileType);
row.files = [{ name: row.originalName }];
// tableFormRef.value.setFormDataFun(row);
editRowInfo.value = row;
} else if (type === 'add') {
editRowInfo.value = {};
// tableFormRef.value.resetFun();
editRowInfo.value = {
stage: '设计',
};
}
// });
};
// 动态的字典
const disciplineList = ref<any>([]);
watch(
() => editRowInfo.value.simulationType,
(val) => {
if (val && val.length) {
disciplineList.value = [];
let list = [];
if (!Array.isArray(val)) {
list = [val];
} else {
list = val;
}
list.forEach((item: any) => {
const dictResult = useDict(item);
disciplineList.value = disciplineList.value.concat(dictResult[item]?.value.A || []);
});
// 过滤出不在 disciplineList.value中的数据
editRowInfo.value.discipline =
editRowInfo.value.discipline?.filter((item: any) => {
return disciplineList.value.some((discipline: any) => discipline.value === item);
}) || [];
} else {
disciplineList.value = [];
editRowInfo.value.discipline = [];
}
}
);
const tableFormRef = ref();
const tableRef = ref();
const confirmFun = async () => {
const valid = await tableFormRef.value.validateFun();
if (valid) {
const fromData = tableFormRef.value.getFormDataFun();
const fromData = { ...editRowInfo.value };
fromData.discipline = fromData.discipline?.join(',') || '';
fromData.simulationType = fromData.simulationType?.join(',') || '';
if (isEditDialog.value) {
const res: any = await editDeptApi(fromData);
if (res.code === 200) {
ElMessage.success('操作成功');
tableRef.value.resetFun();
dialogVisible.value = false;
closeFun();
}
} else {
const res: any = await addDeptApi(fromData);
if (res.code === 200) {
ElMessage.success('操作成功');
tableRef.value.resetFun();
dialogVisible.value = false;
closeFun();
}
}
tableRef.value.resetFun();
dialogVisible.value = false;
closeFun();
}
};
const closeFun = () => {
tableRef.value?.resetFun();
tableFormRef.value?.resetFun();
dialogVisible.value = false;
};
</script>

View File

@@ -192,7 +192,7 @@ const formatconfig = () => {
roleList.value.find((item: any) => item.roleCode === diaForm.value.role)?.roleName || '',
simulationTypeName: diaForm.value.simulationType.map((item: any) => {
const entries = Object.entries(SIMULATION_TYPE.value.O);
const res = entries.find(([k, value]) => k === item) || [];
const res = entries.find(([k]) => k === item) || [];
return res[1];
}),
disciplineNames: diaForm.value.discipline.map((item: any) => {

View File

@@ -40,7 +40,7 @@
v-for="item in deptOptions"
:key="item.value + item.label"
:label="item.label + '(' + item.userName + ')'"
:value="item.value + '-' + item.label"
:value="item.value"
/>
</el-select>
</template>
@@ -62,6 +62,7 @@ import {
setWorkspaceListByMachineId,
getSimTypeList,
toggleUrgencyDesc,
setPMemberName,
} from './lib';
interface Props {
@@ -147,6 +148,11 @@ const changeFun = async (cbData: any) => {
cbData,
});
}
if (key === 'simType') {
setPMemberName({
formData: editFormInfo.value,
});
}
if (key === 'endTime') {
hideKeys.value = toggleUrgencyDesc({
hideKeys: hideKeys.value,

View File

@@ -46,7 +46,7 @@
v-for="item in deptOptions"
:key="item.value + item.label"
:label="item.label + '(' + item.userName + ')'"
:value="item.value + '-' + item.label"
:value="item.value"
/>
</el-select>
</template>
@@ -87,6 +87,7 @@ import {
toggleUrgencyDesc,
toggleMaterialNo,
disposeFiniteElementDeptMember,
setPMemberName,
} from './lib';
interface Props {
@@ -183,6 +184,11 @@ const changeFun = async (cbData: any) => {
cbData,
});
}
if (key === 'simType') {
setPMemberName({
formData: editFormInfo.value,
});
}
if (key === 'endTime') {
editFormInfo.value.simulationPurpose = '';
finiteElementPurposeOptions.value = getPurposeList({

View File

@@ -1,6 +1,7 @@
import { listDeptApi } from '@/api/system/departMent';
import { getChildrenNodeListApi } from '@/api/project/node';
import { dataQueryDirApi } from '@/api/data/data';
import { queryByDeptAndDisciplineApi } from '@/api/system/departMent';
import { CommonStore } from '@/stores/common';
import { getMemberListIds } from '@/utils/task';
@@ -40,6 +41,27 @@ export const initDetailData = async (initData: any) => {
data.oldAttachments = [...data.attachments];
}
}
for (let index = 0; index < data.extras.length; index++) {
if (data.extras[index]?.propertyName === 'projectUndertaker') {
data.projectUndertaker = data.extras[index]?.propertyValue || '';
}
if (data.extras[index]?.propertyName === 'produceLine') {
data.produceLine = data.extras[index]?.propertyValue;
}
}
if (data.projectUndertaker && data.simType) {
const params = {
deptName: data.projectUndertaker,
discipline: data.simType,
};
const res = await queryByDeptAndDisciplineApi(params);
if (res.code === 200) {
if (res.data[0]) {
data.pMemberName = res.data[0]?.userResp?.nickname || '';
data.pMemberList = res.data[0]?.userId || '';
}
}
}
};
// 获取确认人列表
@@ -199,6 +221,26 @@ export const toggleMaterialNo = (data: any) => {
return newKeys;
};
// 设置确认人
export const setPMemberName = async (data: any) => {
const { formData = {} } = data;
const { projectUndertaker, simType } = formData;
const params = {
deptName: projectUndertaker,
discipline: simType,
};
const res = await queryByDeptAndDisciplineApi(params);
if (res.code === 200) {
if (res.data[0]) {
formData.pMemberName = res.data[0]?.userResp?.nickname || '';
formData.pMemberList = res.data[0]?.userId || '';
} else {
formData.pMemberName = '';
formData.pMemberList = '';
}
}
};
// 处理有限元的确认人
export const disposeFiniteElementDeptMember = async (editFormInfo: any, deptList: any[]) => {
let pMemberId = '';
@@ -230,7 +272,6 @@ export const disposeFiniteElementDeptMember = async (editFormInfo: any, deptList
editFormInfo.pMemberList = machDept.userId + '-' + machDept.deptName;
editFormInfo.pMemberName = machDept.userResp.nickname;
}
// }
}
return pMemberId;
};

View File

@@ -42,7 +42,7 @@
v-for="item in deptOptions"
:key="item.value + item.label"
:label="item.label + '(' + item.userName + ')'"
:value="item.value + '-' + item.label"
:value="item.value"
/>
</el-select>
</template>
@@ -64,6 +64,7 @@ import {
setWorkspaceListByMachineId,
getSimTypeList,
toggleUrgencyDesc,
setPMemberName,
} from './lib';
import dayjs from 'dayjs';
@@ -152,6 +153,11 @@ const changeFun = async (cbData: any) => {
cbData,
});
}
if (key === 'simType') {
setPMemberName({
formData: editFormInfo.value,
});
}
if (key === 'endTime') {
hideKeys.value = toggleUrgencyDesc({
hideKeys: hideKeys.value,

View File

@@ -40,7 +40,7 @@
v-for="item in deptOptions"
:key="item.value + item.label"
:label="item.label + '(' + item.userName + ')'"
:value="item.value + '-' + item.label"
:value="item.value"
/>
</el-select>
</template>
@@ -62,6 +62,7 @@ import {
setWorkspaceListByMachineId,
getSimTypeList,
toggleUrgencyDesc,
setPMemberName,
} from './lib';
interface Props {
@@ -154,6 +155,11 @@ const changeFun = async (cbData: any) => {
cbData,
});
}
if (key === 'simType') {
setPMemberName({
formData: editFormInfo.value,
});
}
if (key === 'endTime') {
hideKeys.value = toggleUrgencyDesc({
hideKeys: hideKeys.value,

View File

@@ -37,7 +37,7 @@
v-for="item in deptOptions"
:key="item.value + item.label"
:label="item.label + '(' + item.userName + ')'"
:value="item.value + '-' + item.label"
:value="item.value"
/>
</el-select>
</template>
@@ -59,6 +59,7 @@ import {
setWorkspaceListByMachineId,
getSimTypeList,
toggleUrgencyDesc,
setPMemberName,
} from './lib';
interface Props {
@@ -147,6 +148,11 @@ const changeFun = async (cbData: any) => {
cbData,
});
}
if (key === 'simType') {
setPMemberName({
formData: editFormInfo.value,
});
}
if (key === 'endTime') {
hideKeys.value = toggleUrgencyDesc({
hideKeys: hideKeys.value,