|
|
|
|
@ -181,19 +181,6 @@ const getUserSelectList = async () => {
|
|
|
|
|
userList.value = res.data || [];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** 根据当前 ID 从 userList 同步流程变量用的姓名字段;下拉未包含该用户时保留表单已有姓名 */
|
|
|
|
|
const syncPersonNamesFromIds = () => {
|
|
|
|
|
const nick = (id: string | number | undefined, fallback: string | undefined) => {
|
|
|
|
|
if (id === undefined || id === null || id === '') return '';
|
|
|
|
|
const u = userList.value.find((x) => String(x.userId) === String(id));
|
|
|
|
|
if (u) return String(u.nickName || u.userName || '').trim();
|
|
|
|
|
return String(fallback ?? '').trim();
|
|
|
|
|
};
|
|
|
|
|
form.value.projectManagerName = nick(form.value.managerId, form.value.projectManagerName) as any;
|
|
|
|
|
form.value.chargeName = nick(form.value.chargeId, form.value.chargeName) as any;
|
|
|
|
|
form.value.deputyName = nick(form.value.deputyId, form.value.deputyName) as any;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const rules = {
|
|
|
|
|
projectName: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
|
|
|
|
|
projectCode: [{ required: true, message: '项目号不能为空', trigger: 'blur' }],
|
|
|
|
|
@ -253,14 +240,12 @@ const onProjectChange = async (val: any) => {
|
|
|
|
|
const { data } = await prepareProjectAcceptanceByProjectId(val);
|
|
|
|
|
Object.assign(form.value, data);
|
|
|
|
|
form.value.projectId = val;
|
|
|
|
|
syncPersonNamesFromIds();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const loadDetail = async () => {
|
|
|
|
|
if (!routeParams.value.id) return;
|
|
|
|
|
const res = await getProjectAcceptance(routeParams.value.id);
|
|
|
|
|
Object.assign(form.value, res.data);
|
|
|
|
|
syncPersonNamesFromIds();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const submitForm = (status: string, mode: boolean) => {
|
|
|
|
|
@ -386,11 +371,3 @@ onMounted(async () => {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.card-title {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
color: #303133;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|