| | |
| | | :rules="rules" |
| | | label-position="top" |
| | | > |
| | | <BasicInfoSection :form="form" :operation-type="operationType" /> |
| | | <BasicInfoSection |
| | | :form="form" |
| | | :operation-type="operationType" |
| | | :role-options="roleOptions" |
| | | /> |
| | | <JobInfoSection |
| | | :form="form" |
| | | :post-options="postOptions" |
| | |
| | | } from "vue"; |
| | | import FormDialog from "@/components/Dialog/FormDialog.vue"; |
| | | import { findPostOptions } from "@/api/system/post.js"; |
| | | import { deptTreeSelect } from "@/api/system/user.js"; |
| | | import { deptTreeSelect, getUser } from "@/api/system/user.js"; |
| | | import { |
| | | staffOnJobInfo, |
| | | createStaffOnJob, |
| | |
| | | emergencyContacts: [createEmptyEmergency()], |
| | | emergencyContact: "", |
| | | emergencyContactPhone: "", |
| | | // 角色 |
| | | roleIds: [], |
| | | // 材料附件(仅前端展示) |
| | | attachments: [], |
| | | }); |
| | |
| | | sysDeptId: [ |
| | | { required: true, message: "请选择部门", trigger: "change" }, |
| | | ], |
| | | roleIds: [ |
| | | { |
| | | required: true, |
| | | type: "array", |
| | | min: 1, |
| | | message: "请至少选择一个角色", |
| | | trigger: "change", |
| | | }, |
| | | ], |
| | | }, |
| | | postOptions: [], |
| | | deptOptions: [], |
| | | }); |
| | | |
| | | const { form, rules, postOptions, deptOptions } = toRefs(state); |
| | | const roleOptions = ref([]); |
| | | |
| | | const resetForm = () => { |
| | | Object.assign(form.value, createDefaultForm()); |
| | |
| | | deptOptions.value = filterDisabledDept( |
| | | JSON.parse(JSON.stringify(response.data || [])) |
| | | ); |
| | | }); |
| | | }; |
| | | |
| | | const fetchRoleOptions = () => { |
| | | getUser().then((res) => { |
| | | roleOptions.value = res.roles || []; |
| | | }); |
| | | }; |
| | | |
| | |
| | | dialogFormVisible.value = true; |
| | | fetchPostOptions(); |
| | | fetchDeptOptions(); |
| | | fetchRoleOptions(); |
| | | resetForm(); |
| | | if (type === "edit" && row?.id) { |
| | | id.value = row.id; |