This commit is contained in:
2025-09-08 20:00:59 +08:00
parent 8eac9bce6c
commit cf2b805770
16 changed files with 292 additions and 424 deletions

View File

@ -192,12 +192,12 @@ async function handleDeptChange(value: number | string) {
];
}
const submitForm = () => {
const submitForm = (cb) => {
userFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
form.value.userId ? await api.updateUser(form.value) : await api.addUser(form.value);
proxy?.$modal.msgSuccess('操作成功');
proxy?.$emit('submit', false);
// form.value.userId ? await api.updateUser(form.value) : await api.addUser(form.value);
// proxy?.$modal.msgSuccess('操作成功');
cb();
}
});
};
@ -243,7 +243,7 @@ const getInfoForm = () => {
onMounted(() => {
getDeptTree();
});
defineExpose({ open, getInfoForm });
defineExpose({ open, getInfoForm, submitForm });
</script>
<style lang="scss" scoped>
.editInfo {

View File

@ -219,10 +219,22 @@ const removeProject = (projectId: number | string) => {
// 提交表单
const submitForm = async () => {
// 整理项目角色数据
console.log(selectedProjects.value);
if (selectedProjects.value.length == 0) {
proxy?.$modal.msgWarning('请选择项目角色');
return;
}
let flag = false;
selectedProjects.value.forEach((project) => {
if (project.appRoles.length > 0 || project.webRoles.length > 0) {
flag = true;
}
});
if (!flag) {
proxy?.$modal.msgWarning('请选择项目角色');
return;
}
form.value.projectRoles = selectedProjects.value.map((project) => ({
projectId: project.id,
roleIds: [...new Set(project.webRoles), ...new Set(project.appRoles)]

View File

@ -154,15 +154,24 @@
</el-row>
<!-- 添加或修改用户配置对话框 -->
<el-dialog draggable ref="formDialogRef" style="background: rgb(249,250,251);" v-model="dialog.visible" :title="dialog.title" width="1300px" append-to-body @close="closeDialog">
<el-dialog
draggable
ref="formDialogRef"
style="background: rgb(249, 250, 251)"
v-model="dialog.visible"
:title="dialog.title"
width="1300px"
append-to-body
@close="closeDialog"
>
<div class="boxDetial">
<div class="tab_info">
<div class="tab_item" @click="onTab(1)" :class="{ active: type == 1 }">
<Avatar style="width: 1em; height: 1em; margin-right: 8px" :style="{color: type == 1 ? '#1890ff' : '#000'}" />
<Avatar style="width: 1em; height: 1em; margin-right: 8px" :style="{ color: type == 1 ? '#1890ff' : '#000' }" />
<span>基本资料</span>
</div>
<div class="tab_item" @click="onTab(2)" :class="{ active: type == 2 }">
<Key style="width: 1em; height: 1em; margin-right: 8px" :style="{color: type == 2 ? '#1890ff' : '#000'}" />
<Key style="width: 1em; height: 1em; margin-right: 8px" :style="{ color: type == 2 ? '#1890ff' : '#000' }" />
<span>角色信息</span>
</div>
</div>
@ -698,13 +707,20 @@ const uploadCert = async () => {
proxy?.$modal.msgSuccess('上传证书目录成功');
};
const onTab = (val: number) => {
type.value = val;
if (val == 2) {
let obj = editInfoRef.value?.getInfoForm();
form.value = obj;
nextTick(() => {
roleInfoRef.value?.open(form.value, deptIdRole.value);
// 查看基本信息
editInfoRef.value?.submitForm((res) => {
type.value = val;
let obj = editInfoRef.value?.getInfoForm();
form.value = obj;
console.log(obj);
nextTick(() => {
roleInfoRef.value?.open(form.value, deptIdRole.value);
});
});
} else {
type.value = val;
}
};
</script>