|
@@ -1,8 +1,11 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
-import { ref, reactive } from "vue";
|
|
|
|
|
|
+import { ref, reactive, nextTick } from "vue";
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
import { postUpdateUserInfo } from "@/api/userSetting";
|
|
import { postUpdateUserInfo } from "@/api/userSetting";
|
|
import type { DrawerProps, FormItemProps, FormProps } from "element-plus";
|
|
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 itemLabelPosition = ref<FormItemProps["labelPosition"]>("");
|
|
const drawer = ref(false);
|
|
const drawer = ref(false);
|
|
const formRef = ref();
|
|
const formRef = ref();
|
|
@@ -15,12 +18,14 @@ const formLabelAlign = reactive({
|
|
userCode: "",
|
|
userCode: "",
|
|
userName: "",
|
|
userName: "",
|
|
phone: "",
|
|
phone: "",
|
|
|
|
+ gender: "",
|
|
|
|
+ birth: null,
|
|
remark: "",
|
|
remark: "",
|
|
headUrl: "",
|
|
headUrl: "",
|
|
token: "",
|
|
token: "",
|
|
menuRole: "",
|
|
menuRole: "",
|
|
columnRole: "",
|
|
columnRole: "",
|
|
- dept: "",
|
|
|
|
|
|
+ deptCode: "",
|
|
group: "",
|
|
group: "",
|
|
jobTitle: ""
|
|
jobTitle: ""
|
|
});
|
|
});
|
|
@@ -70,10 +75,10 @@ const postUpdateUserInfoApi = async () => {
|
|
};
|
|
};
|
|
const open = (row, postOrganizationUserPageApi) => {
|
|
const open = (row, postOrganizationUserPageApi) => {
|
|
drawer.value = true;
|
|
drawer.value = true;
|
|
- console.log("111", row);
|
|
|
|
postOrganizationUserPage.value = postOrganizationUserPageApi;
|
|
postOrganizationUserPage.value = postOrganizationUserPageApi;
|
|
Object.assign(formLabelAlign, row);
|
|
Object.assign(formLabelAlign, row);
|
|
- console.log("formLabelAlign", formLabelAlign);
|
|
|
|
|
|
+ dayBirth.value = row.birth ? dayjs(row.birth).format("YYYY-MM-DD") : "";
|
|
|
|
+ postListTreeApi();
|
|
};
|
|
};
|
|
const editShow = ref(true);
|
|
const editShow = ref(true);
|
|
// 编辑
|
|
// 编辑
|
|
@@ -84,7 +89,57 @@ const editClick = () => {
|
|
defineExpose({
|
|
defineExpose({
|
|
open
|
|
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>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -104,43 +159,70 @@ const timer = ref("");
|
|
label-position="top"
|
|
label-position="top"
|
|
label-width="auto"
|
|
label-width="auto"
|
|
:model="formLabelAlign"
|
|
:model="formLabelAlign"
|
|
|
|
+ :rules="rules"
|
|
>
|
|
>
|
|
- <el-form-item label="姓名" label-position="top">
|
|
|
|
|
|
+ <el-form-item label="姓名" prop="realName" label-position="top">
|
|
<el-input
|
|
<el-input
|
|
v-model="formLabelAlign.realName"
|
|
v-model="formLabelAlign.realName"
|
|
:disabled="disabledValue"
|
|
:disabled="disabledValue"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="工号" label-position="top">
|
|
|
|
|
|
+ <el-form-item label="工号" prop="hospitalCode" label-position="top">
|
|
<el-input
|
|
<el-input
|
|
v-model="formLabelAlign.hospitalCode"
|
|
v-model="formLabelAlign.hospitalCode"
|
|
:disabled="disabledValue"
|
|
:disabled="disabledValue"
|
|
/>
|
|
/>
|
|
</el-form-item>
|
|
</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"
|
|
: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>
|
|
<el-form-item label="性别" label-position="top">
|
|
<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>
|
|
- <!-- <el-form-item label="年龄" label-position="top">
|
|
|
|
|
|
+ <el-form-item label="出生日期" label-position="top">
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
|
+ v-model="dayBirth"
|
|
type="date"
|
|
type="date"
|
|
- placeholder="请选择出生年月"
|
|
|
|
:disabled="disabledValue"
|
|
:disabled="disabledValue"
|
|
|
|
+ placeholder="请选择出生日期"
|
|
|
|
+ @change="birthChange"
|
|
/>
|
|
/>
|
|
- </el-form-item> -->
|
|
|
|
|
|
+ </el-form-item>
|
|
<el-form-item label="职称" label-position="top">
|
|
<el-form-item label="职称" label-position="top">
|
|
- <el-input
|
|
|
|
|
|
+ <el-select
|
|
v-model="formLabelAlign.jobTitle"
|
|
v-model="formLabelAlign.jobTitle"
|
|
|
|
+ placeholder="请选择职称"
|
|
:disabled="disabledValue"
|
|
: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>
|
|
<el-form-item label="手机号" label-position="top">
|
|
<el-form-item label="手机号" label-position="top">
|
|
<el-input
|
|
<el-input
|