|
@@ -1,8 +1,11 @@
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, reactive } from "vue";
|
|
|
+import { ref, reactive, nextTick } from "vue";
|
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
import { postUpdateUserInfo } from "@/api/userSetting";
|
|
|
import type { DrawerProps, FormItemProps, FormProps } from "element-plus";
|
|
|
+import { postListTree } from "@/api/department";
|
|
|
+import dayjs from "dayjs";
|
|
|
+import { selectRank } from "@/api/select";
|
|
|
// const itemLabelPosition = ref<FormItemProps["labelPosition"]>("");
|
|
|
const drawer = ref(false);
|
|
|
const formRef = ref();
|
|
@@ -15,12 +18,14 @@ const formLabelAlign = reactive({
|
|
|
userCode: "",
|
|
|
userName: "",
|
|
|
phone: "",
|
|
|
+ gender: "",
|
|
|
+ birth: null,
|
|
|
remark: "",
|
|
|
headUrl: "",
|
|
|
token: "",
|
|
|
menuRole: "",
|
|
|
columnRole: "",
|
|
|
- dept: "",
|
|
|
+ deptCode: "",
|
|
|
group: "",
|
|
|
jobTitle: ""
|
|
|
});
|
|
@@ -70,10 +75,10 @@ const postUpdateUserInfoApi = async () => {
|
|
|
};
|
|
|
const open = (row, postOrganizationUserPageApi) => {
|
|
|
drawer.value = true;
|
|
|
- console.log("111", row);
|
|
|
postOrganizationUserPage.value = postOrganizationUserPageApi;
|
|
|
Object.assign(formLabelAlign, row);
|
|
|
- console.log("formLabelAlign", formLabelAlign);
|
|
|
+ dayBirth.value = row.birth ? dayjs(row.birth).format("YYYY-MM-DD") : "";
|
|
|
+ postListTreeApi();
|
|
|
};
|
|
|
const editShow = ref(true);
|
|
|
// 编辑
|
|
@@ -84,7 +89,57 @@ const editClick = () => {
|
|
|
defineExpose({
|
|
|
open
|
|
|
});
|
|
|
-const timer = ref("");
|
|
|
+
|
|
|
+// 部门
|
|
|
+const treeSelectRef = ref(null);
|
|
|
+const openTreeFocus = async () => {
|
|
|
+ nextTick(() => {
|
|
|
+ if (formLabelAlign.deptCode && treeSelectRef.value) {
|
|
|
+ const node = treeSelectRef.value.getNode(formLabelAlign.deptCode); // 获取节点
|
|
|
+ if (node) {
|
|
|
+ treeSelectRef.value.setCurrentKey(formLabelAlign.deptCode); // 选中节点
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+const deptTree = ref([]);
|
|
|
+const postListTreeApi = async () => {
|
|
|
+ const { code, data } = await postListTree();
|
|
|
+ if (code == 200) {
|
|
|
+ deptTree.value = data;
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+// 出生日期
|
|
|
+const dayBirth = ref("");
|
|
|
+const birthChange = day => {
|
|
|
+ formLabelAlign.birth = dayjs(day).valueOf();
|
|
|
+};
|
|
|
+
|
|
|
+// 校验
|
|
|
+const rules = reactive({
|
|
|
+ realName: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请填写姓名",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ hospitalCode: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请填写工号",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ deptCode: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "请选择部门",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -104,43 +159,70 @@ const timer = ref("");
|
|
|
label-position="top"
|
|
|
label-width="auto"
|
|
|
:model="formLabelAlign"
|
|
|
+ :rules="rules"
|
|
|
>
|
|
|
- <el-form-item label="姓名" label-position="top">
|
|
|
+ <el-form-item label="姓名" prop="realName" label-position="top">
|
|
|
<el-input
|
|
|
v-model="formLabelAlign.realName"
|
|
|
:disabled="disabledValue"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="工号" label-position="top">
|
|
|
+ <el-form-item label="工号" prop="hospitalCode" label-position="top">
|
|
|
<el-input
|
|
|
v-model="formLabelAlign.hospitalCode"
|
|
|
:disabled="disabledValue"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="员工ID" label-position="top">
|
|
|
- <el-input :disabled="disabledValue" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="部门" label-position="top">
|
|
|
- <el-input
|
|
|
- v-model="formLabelAlign.dept"
|
|
|
+ <el-form-item label="部门" prop="deptCode" label-position="top">
|
|
|
+ <el-tree-select
|
|
|
+ ref="treeSelectRef"
|
|
|
+ v-model="formLabelAlign.deptCode"
|
|
|
+ :data="deptTree"
|
|
|
:disabled="disabledValue"
|
|
|
+ :props="{
|
|
|
+ label: 'deptName',
|
|
|
+ value: 'deptCode',
|
|
|
+ children: 'childrenRes'
|
|
|
+ }"
|
|
|
+ filterable
|
|
|
+ check-strictly
|
|
|
+ :render-after-expand="false"
|
|
|
+ node-key="deptCode"
|
|
|
+ @focus="openTreeFocus"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="性别" label-position="top">
|
|
|
- <el-input :disabled="disabledValue" />
|
|
|
+ <el-select
|
|
|
+ v-model="formLabelAlign.gender"
|
|
|
+ placeholder="请选择性别"
|
|
|
+ :disabled="disabledValue"
|
|
|
+ >
|
|
|
+ <el-option label="男" value="男" />
|
|
|
+ <el-option label="女" value="女" />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <!-- <el-form-item label="年龄" label-position="top">
|
|
|
+ <el-form-item label="出生日期" label-position="top">
|
|
|
<el-date-picker
|
|
|
+ v-model="dayBirth"
|
|
|
type="date"
|
|
|
- placeholder="请选择出生年月"
|
|
|
:disabled="disabledValue"
|
|
|
+ placeholder="请选择出生日期"
|
|
|
+ @change="birthChange"
|
|
|
/>
|
|
|
- </el-form-item> -->
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="职称" label-position="top">
|
|
|
- <el-input
|
|
|
+ <el-select
|
|
|
v-model="formLabelAlign.jobTitle"
|
|
|
+ placeholder="请选择职称"
|
|
|
:disabled="disabledValue"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in selectRank"
|
|
|
+ :key="index"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="手机号" label-position="top">
|
|
|
<el-input
|