Merge branch 'master' of https://codeup.aliyun.com/61c0318acd8b75daa5a125f7/medical/openhis
This commit is contained in:
@@ -4,73 +4,35 @@
|
|||||||
<!--部门数据-->
|
<!--部门数据-->
|
||||||
<el-col :span="4" :xs="24">
|
<el-col :span="4" :xs="24">
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-input
|
<el-input v-model="deptName" placeholder="请输入部门名称" clearable prefix-icon="Search"
|
||||||
v-model="deptName"
|
style="margin-bottom: 20px" />
|
||||||
placeholder="请输入部门名称"
|
|
||||||
clearable
|
|
||||||
prefix-icon="Search"
|
|
||||||
style="margin-bottom: 20px"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-tree
|
<el-tree :data="deptOptions" :props="{ label: 'name', children: 'children' }" :expand-on-click-node="false"
|
||||||
:data="deptOptions"
|
:filter-node-method="filterNode" ref="deptTreeRef" node-key="id" highlight-current default-expand-all
|
||||||
:props="{ label: 'name', children: 'children' }"
|
@node-click="handleNodeClick" />
|
||||||
:expand-on-click-node="false"
|
|
||||||
:filter-node-method="filterNode"
|
|
||||||
ref="deptTreeRef"
|
|
||||||
node-key="id"
|
|
||||||
highlight-current
|
|
||||||
default-expand-all
|
|
||||||
@node-click="handleNodeClick"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!--用户数据-->
|
<!--用户数据-->
|
||||||
<el-col :span="20" :xs="24">
|
<el-col :span="20" :xs="24">
|
||||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="用户名称" prop="userName">
|
<el-form-item label="用户名称" prop="userName">
|
||||||
<el-input
|
<el-input v-model="queryParams.userName" placeholder="请输入用户名称" clearable style="width: 240px"
|
||||||
v-model="queryParams.userName"
|
@keyup.enter="handleQuery" />
|
||||||
placeholder="请输入用户名称"
|
|
||||||
clearable
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="手机号码" prop="phonenumber">
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
<el-input
|
<el-input v-model="queryParams.phonenumber" placeholder="请输入手机号码" clearable style="width: 240px"
|
||||||
v-model="queryParams.phonenumber"
|
@keyup.enter="handleQuery" />
|
||||||
placeholder="请输入手机号码"
|
|
||||||
clearable
|
|
||||||
style="width: 240px"
|
|
||||||
@keyup.enter="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
<el-form-item label="状态" prop="status">
|
||||||
<el-select
|
<el-select v-model="queryParams.status" placeholder="用户状态" clearable style="width: 240px">
|
||||||
v-model="queryParams.status"
|
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label"
|
||||||
placeholder="用户状态"
|
:value="dict.value" />
|
||||||
clearable
|
|
||||||
style="width: 240px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="dict in sys_normal_disable"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" style="width: 308px;">
|
<el-form-item label="创建时间" style="width: 308px;">
|
||||||
<el-date-picker
|
<el-date-picker v-model="dateRange" value-format="YYYY-MM-DD" type="daterange" range-separator="-"
|
||||||
v-model="dateRange"
|
start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
type="daterange"
|
|
||||||
range-separator="-"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
></el-date-picker>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
@@ -80,33 +42,16 @@
|
|||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||||
type="primary"
|
v-hasPermi="['system:user:add']">新增</el-button>
|
||||||
plain
|
|
||||||
icon="Plus"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['system:user:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||||
type="success"
|
v-hasPermi="['system:user:edit']">修改</el-button>
|
||||||
plain
|
|
||||||
icon="Edit"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['system:user:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||||
type="danger"
|
v-hasPermi="['system:user:remove']">删除</el-button>
|
||||||
plain
|
|
||||||
icon="Delete"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['system:user:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">
|
<!-- <el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
@@ -132,18 +77,18 @@
|
|||||||
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column type="selection" width="50" align="center" />
|
||||||
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
<el-table-column label="用户编号" align="center" key="userId" prop="userId" v-if="columns[0].visible" />
|
||||||
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
|
<el-table-column label="用户名称" align="center" key="userName" prop="userName" v-if="columns[1].visible"
|
||||||
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible" :show-overflow-tooltip="true" />
|
:show-overflow-tooltip="true" />
|
||||||
<el-table-column label="部门" align="center" key="orgId_dictText" prop="orgId_dictText" v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" v-if="columns[2].visible"
|
||||||
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible" width="120" />
|
:show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="部门" align="center" key="orgId_dictText" prop="orgId_dictText"
|
||||||
|
v-if="columns[3].visible" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" v-if="columns[4].visible"
|
||||||
|
width="120" />
|
||||||
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
<el-table-column label="状态" align="center" key="status" v-if="columns[5].visible">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-switch
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1"
|
||||||
v-model="scope.row.status"
|
@change="handleStatusChange(scope.row)"></el-switch>
|
||||||
active-value="0"
|
|
||||||
inactive-value="1"
|
|
||||||
@change="handleStatusChange(scope.row)"
|
|
||||||
></el-switch>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
<el-table-column label="创建时间" align="center" prop="createTime" v-if="columns[6].visible" width="160">
|
||||||
@@ -154,27 +99,26 @@
|
|||||||
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="修改" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:user:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="删除" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']"></el-button>
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:user:remove']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="重置密码" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="重置密码" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']"></el-button>
|
<el-button link type="primary" icon="Key" @click="handleResetPwd(scope.row)"
|
||||||
|
v-hasPermi="['system:user:resetPwd']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<el-tooltip content="分配角色" placement="top" v-if="scope.row.userId !== 1">
|
<el-tooltip content="分配角色" placement="top" v-if="scope.row.userId !== 1">
|
||||||
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)" v-hasPermi="['system:user:edit']"></el-button>
|
<el-button link type="primary" icon="CircleCheck" @click="handleAuthRole(scope.row)"
|
||||||
|
v-hasPermi="['system:user:edit']"></el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNo"
|
||||||
v-show="total > 0"
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
:total="total"
|
|
||||||
v-model:page="queryParams.pageNo"
|
|
||||||
v-model:limit="queryParams.pageSize"
|
|
||||||
@pagination="getList"
|
|
||||||
/>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@@ -190,16 +134,11 @@
|
|||||||
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
|
<el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="24">
|
||||||
<el-form-item label="归属部门" prop="orgId">
|
<el-form-item label="责任科室" prop="responsibilityOrgDtoList" style="width: 100%">
|
||||||
<el-tree-select
|
<el-tree-select style="width: 100%" multiple v-model="form.responsibilityOrgDtoListIds" @change="handleChange"
|
||||||
v-model="form.orgId"
|
:data="deptOptions" :props="{ value: 'id', label: 'name', children: 'children' }" value-key="id"
|
||||||
:data="deptOptions"
|
placeholder="请选择责任科室" check-strictly />
|
||||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
|
||||||
value-key="id"
|
|
||||||
placeholder="请选择归属部门"
|
|
||||||
check-strictly
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -223,7 +162,8 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
|
||||||
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password />
|
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20"
|
||||||
|
show-password />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -231,23 +171,16 @@
|
|||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="用户性别">
|
<el-form-item label="用户性别">
|
||||||
<el-select v-model="form.sex" placeholder="请选择">
|
<el-select v-model="form.sex" placeholder="请选择">
|
||||||
<el-option
|
<el-option v-for="dict in sys_user_sex" :key="dict.value" :label="dict.label"
|
||||||
v-for="dict in sys_user_sex"
|
:value="dict.value"></el-option>
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.label"
|
|
||||||
:value="dict.value"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-radio-group v-model="form.status">
|
<el-radio-group v-model="form.status">
|
||||||
<el-radio
|
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label
|
||||||
v-for="dict in sys_normal_disable"
|
}}</el-radio>
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>{{ dict.label }}</el-radio>
|
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -255,13 +188,8 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="出生日期">
|
<el-form-item label="出生日期">
|
||||||
<el-date-picker
|
<el-date-picker v-model="form.birthDate" type="date" placeholder="选择日期" format="YYYY-MM-DD"
|
||||||
v-model="form.birthDate"
|
value-format="YYYY-MM-DD" />
|
||||||
type="date"
|
|
||||||
placeholder="选择日期"
|
|
||||||
format="YYYY-MM-DD"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -276,59 +204,28 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="24">
|
||||||
<el-form-item label="角色">
|
<el-form-item label="角色" style="width: 100%;">
|
||||||
<el-select v-model="form.roleIds" multiple placeholder="请选择" @change="handleRoleChange">
|
<el-select v-model="form.practitionerRolesDtoListIds" multiple placeholder="请选择" @change="handleRoleChange"
|
||||||
<el-option
|
style="width: 100%;">
|
||||||
v-for="item in roleOptions"
|
<el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName"
|
||||||
:key="item.roleId"
|
:value="item.roleId" :disabled="item.status == 1"></el-option>
|
||||||
:label="item.roleName"
|
|
||||||
:value="item.roleId"
|
|
||||||
:disabled="item.status == 1"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
<el-col :span="24">
|
||||||
<div v-if="form.roleIds.length > 0" class="form-subtitle">
|
<el-form-item label="出诊科室" style="width: 100%;">
|
||||||
角色信息
|
<el-tree-select :disabled="doctorShow" multiple style="width: 100%;" v-model="form.doctorVisitOrgDtoListIds" @change="handleLOrgDtoChange"
|
||||||
</div>
|
:data="deptOptions" :props="{ value: 'id', label: 'name', children: 'children' }" value-key="id"
|
||||||
<el-row v-for="(item, index) in form.roleIds" :key="index">
|
placeholder="请选择出诊科室" check-strictly />
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="角色" :prop="`childList.${index}.roleCode`" :rules="data.rules.childList[index].roleCode">
|
|
||||||
<el-select v-model="form.childList[index].roleCode" placeholder="请选择">
|
|
||||||
<el-option
|
|
||||||
v-for="item in selectRole"
|
|
||||||
:key="item.roleKey"
|
|
||||||
:label="item.roleName"
|
|
||||||
:value="item.roleKey"
|
|
||||||
:disabled="item.status == 1"
|
|
||||||
></el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="24">
|
||||||
<el-form-item label="归属部门" :prop="`childList.${index}.orgId`" :rules="data.rules.childList[index].orgId">
|
<el-form-item label="管理库房" style="width: 100%;">
|
||||||
<el-tree-select
|
<el-tree-select :disabled="locationAdminShow" multiple style="width: 100%;" @change="handleLocationChange"
|
||||||
v-model="form.childList[index].orgId"
|
v-model="form.manageLocationDtoListIds" :data="locationOptions"
|
||||||
:data="deptOptions"
|
:props="{ value: 'id', label: 'name', children: 'children' }" value-key="id" placeholder="请选择管理库房"
|
||||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
check-strictly />
|
||||||
value-key="id"
|
|
||||||
placeholder="请选择归属部门"
|
|
||||||
check-strictly
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="位置" :prop="`childList.${index}.locationId`" :rules="data.rules.childList[index].locationId">
|
|
||||||
<el-tree-select
|
|
||||||
v-model="form.childList[index].locationId"
|
|
||||||
:data="locationOptions"
|
|
||||||
:props="{ value: 'id', label: 'name', children: 'children' }"
|
|
||||||
value-key="id"
|
|
||||||
placeholder="请选择位置"
|
|
||||||
check-strictly
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -353,18 +250,9 @@
|
|||||||
|
|
||||||
<!-- 用户导入对话框 -->
|
<!-- 用户导入对话框 -->
|
||||||
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
<el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
|
||||||
<el-upload
|
<el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
|
||||||
ref="uploadRef"
|
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
|
||||||
:limit="1"
|
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
|
||||||
accept=".xlsx, .xls"
|
|
||||||
:headers="upload.headers"
|
|
||||||
:action="upload.url + '?updateSupport=' + upload.updateSupport"
|
|
||||||
:disabled="upload.isUploading"
|
|
||||||
:on-progress="handleFileUploadProgress"
|
|
||||||
:on-success="handleFileSuccess"
|
|
||||||
:auto-upload="false"
|
|
||||||
drag
|
|
||||||
>
|
|
||||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||||
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
|
||||||
<template #tip>
|
<template #tip>
|
||||||
@@ -373,7 +261,8 @@
|
|||||||
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
|
||||||
</div>
|
</div>
|
||||||
<span>仅允许导入xls、xlsx格式文件。</span>
|
<span>仅允许导入xls、xlsx格式文件。</span>
|
||||||
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
|
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
|
||||||
|
@click="importTemplate">下载模板</el-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
@@ -390,6 +279,7 @@
|
|||||||
<script setup name="User">
|
<script setup name="User">
|
||||||
import { getToken } from "@/utils/auth";
|
import { getToken } from "@/utils/auth";
|
||||||
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, getRole, updateUser, addUser, deptTreeSelect, locationTreeSelect } from "@/api/system/user";
|
import { changeUserStatus, listUser, resetUserPwd, delUser, getUser, getRole, updateUser, addUser, deptTreeSelect, locationTreeSelect } from "@/api/system/user";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
@@ -411,338 +301,377 @@ const locationOptions = ref([]);
|
|||||||
const initPassword = ref(undefined);
|
const initPassword = ref(undefined);
|
||||||
const postOptions = ref([]);
|
const postOptions = ref([]);
|
||||||
const roleOptions = ref([]);
|
const roleOptions = ref([]);
|
||||||
const selectRole = ref([]);
|
const doctorShow = ref(true)
|
||||||
|
const locationAdminShow = ref(true)
|
||||||
/*** 用户导入参数 */
|
/*** 用户导入参数 */
|
||||||
const upload = reactive({
|
const upload = reactive({
|
||||||
// 是否显示弹出层(用户导入)
|
// 是否显示弹出层(用户导入)
|
||||||
open: false,
|
open: false,
|
||||||
// 弹出层标题(用户导入)
|
// 弹出层标题(用户导入)
|
||||||
title: "",
|
title: "",
|
||||||
// 是否禁用上传
|
// 是否禁用上传
|
||||||
isUploading: false,
|
isUploading: false,
|
||||||
// 是否更新已经存在的用户数据
|
// 是否更新已经存在的用户数据
|
||||||
updateSupport: 0,
|
updateSupport: 0,
|
||||||
// 设置上传的请求头部
|
// 设置上传的请求头部
|
||||||
headers: { Authorization: "Bearer " + getToken() },
|
headers: { Authorization: "Bearer " + getToken() },
|
||||||
// 上传的地址
|
// 上传的地址
|
||||||
url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
|
url: import.meta.env.VITE_APP_BASE_API + "/system/user/importData"
|
||||||
});
|
});
|
||||||
// 列显隐信息
|
// 列显隐信息
|
||||||
const columns = ref([
|
const columns = ref([
|
||||||
{ key: 0, label: `用户编号`, visible: true },
|
{ key: 0, label: `用户编号`, visible: true },
|
||||||
{ key: 1, label: `用户名称`, visible: true },
|
{ key: 1, label: `用户名称`, visible: true },
|
||||||
{ key: 2, label: `用户昵称`, visible: true },
|
{ key: 2, label: `用户昵称`, visible: true },
|
||||||
{ key: 3, label: `部门`, visible: true },
|
{ key: 3, label: `部门`, visible: true },
|
||||||
{ key: 4, label: `手机号码`, visible: true },
|
{ key: 4, label: `手机号码`, visible: true },
|
||||||
{ key: 5, label: `状态`, visible: true },
|
{ key: 5, label: `状态`, visible: true },
|
||||||
{ key: 6, label: `创建时间`, visible: true }
|
{ key: 6, label: `创建时间`, visible: true }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
userName: undefined,
|
userName: undefined,
|
||||||
phonenumber: undefined,
|
phonenumber: undefined,
|
||||||
status: undefined,
|
status: undefined,
|
||||||
orgId: undefined
|
orgId: undefined
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
userName: [{ required: true, message: "用户名称不能为空", trigger: "blur" }, { min: 2, max: 20, message: "用户名称长度必须介于 2 和 20 之间", trigger: "blur" }],
|
||||||
nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
nickName: [{ required: true, message: "用户昵称不能为空", trigger: "blur" }],
|
||||||
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }],
|
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }, { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }],
|
||||||
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
||||||
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }],
|
phonenumber: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }],
|
||||||
childList: []
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const { queryParams, form, rules } = toRefs(data);
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
/** 通过条件过滤节点 */
|
/** 通过条件过滤节点 */
|
||||||
const filterNode = (value, data) => {
|
const filterNode = (value, data) => {
|
||||||
if (!value) return true;
|
if (!value) return true;
|
||||||
return data.label.indexOf(value) !== -1;
|
return data.label.indexOf(value) !== -1;
|
||||||
};
|
};
|
||||||
/** 根据名称筛选部门树 */
|
/** 根据名称筛选部门树 */
|
||||||
watch(deptName, val => {
|
watch(deptName, val => {
|
||||||
proxy.$refs["deptTreeRef"].filter(val);
|
proxy.$refs["deptTreeRef"].filter(val);
|
||||||
});
|
});
|
||||||
/** 查询部门下拉树结构 */
|
/** 查询部门下拉树结构 */
|
||||||
function getDeptTree() {
|
function getDeptTree() {
|
||||||
deptTreeSelect().then(response => {
|
deptTreeSelect().then(response => {
|
||||||
deptOptions.value = response.data.records;
|
deptOptions.value = response.data.records;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/** 查询位置下拉树结构 */
|
/** 查询位置下拉树结构 */
|
||||||
function getLocationTree() {
|
function getLocationTree() {
|
||||||
locationTreeSelect().then(response => {
|
locationTreeSelect().then(response => {
|
||||||
locationOptions.value = response.data.records;
|
locationOptions.value = response.data.records;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/** 查询用户列表 */
|
/** 查询用户列表 */
|
||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
listUser(proxy.addDateRange(queryParams.value, dateRange.value)).then(res => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
userList.value = res.data.records
|
userList.value = res.data.records
|
||||||
total.value = res.data.total;
|
total.value = res.data.total;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/** 节点单击事件 */
|
/** 节点单击事件 */
|
||||||
function handleNodeClick(data) {
|
function handleNodeClick(data) {
|
||||||
queryParams.value.orgId = data.id;
|
queryParams.value.orgId = data.id;
|
||||||
handleQuery();
|
handleQuery();
|
||||||
};
|
};
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
queryParams.value.pageNo = 1;
|
queryParams.value.pageNo = 1;
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
dateRange.value = [];
|
dateRange.value = [];
|
||||||
proxy.resetForm("queryRef");
|
proxy.resetForm("queryRef");
|
||||||
queryParams.value.orgId = undefined;
|
queryParams.value.orgId = undefined;
|
||||||
proxy.$refs.deptTreeRef.setCurrentKey(null);
|
proxy.$refs.deptTreeRef.setCurrentKey(null);
|
||||||
handleQuery();
|
handleQuery();
|
||||||
};
|
};
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
function handleDelete(row) {
|
function handleDelete(row) {
|
||||||
const userIds = row.userId || ids.value;
|
const userIds = row.userId || ids.value;
|
||||||
proxy.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () {
|
proxy.$modal.confirm('是否确认删除用户编号为"' + userIds + '"的数据项?').then(function () {
|
||||||
return delUser(userIds);
|
return delUser(userIds);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
getList();
|
getList();
|
||||||
proxy.$modal.msgSuccess("删除成功");
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => { });
|
||||||
};
|
};
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download("system/user/export", {
|
proxy.download("system/user/export", {
|
||||||
...queryParams.value,
|
...queryParams.value,
|
||||||
},`user_${new Date().getTime()}.xlsx`);
|
}, `user_${new Date().getTime()}.xlsx`);
|
||||||
};
|
};
|
||||||
/** 用户状态修改 */
|
/** 用户状态修改 */
|
||||||
function handleStatusChange(row) {
|
function handleStatusChange(row) {
|
||||||
console.log(row)
|
console.log(row)
|
||||||
let text = row.status === "0" ? "启用" : "停用";
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
|
proxy.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function () {
|
||||||
return changeUserStatus(row.userId, row.status);
|
return changeUserStatus(row.userId, row.status);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
proxy.$modal.msgSuccess(text + "成功");
|
proxy.$modal.msgSuccess(text + "成功");
|
||||||
}).catch(function () {
|
}).catch(function () {
|
||||||
row.status = row.status === "0" ? "1" : "0";
|
row.status = row.status === "0" ? "1" : "0";
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/** 更多操作 */
|
/** 更多操作 */
|
||||||
function handleCommand(command, row) {
|
function handleCommand(command, row) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "handleResetPwd":
|
case "handleResetPwd":
|
||||||
handleResetPwd(row);
|
handleResetPwd(row);
|
||||||
break;
|
break;
|
||||||
case "handleAuthRole":
|
case "handleAuthRole":
|
||||||
handleAuthRole(row);
|
handleAuthRole(row);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/** 跳转角色分配 */
|
/** 跳转角色分配 */
|
||||||
function handleAuthRole(row) {
|
function handleAuthRole(row) {
|
||||||
const userId = row.userId;
|
const userId = row.userId;
|
||||||
router.push("/system/user-auth/role/" + userId);
|
router.push("/system/user-auth/role/" + userId);
|
||||||
};
|
};
|
||||||
/** 重置密码按钮操作 */
|
/** 重置密码按钮操作 */
|
||||||
function handleResetPwd(row) {
|
function handleResetPwd(row) {
|
||||||
proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
proxy.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
closeOnClickModal: false,
|
closeOnClickModal: false,
|
||||||
inputPattern: /^.{5,20}$/,
|
inputPattern: /^.{5,20}$/,
|
||||||
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
|
||||||
inputValidator: (value) => {
|
inputValidator: (value) => {
|
||||||
if (/<|>|"|'|\||\\/.test(value)) {
|
if (/<|>|"|'|\||\\/.test(value)) {
|
||||||
return "不能包含非法字符:< > \" ' \\\ |"
|
return "不能包含非法字符:< > \" ' \\\ |"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}).then(({ value }) => {
|
}).then(({ value }) => {
|
||||||
resetUserPwd(row.userId, value).then(response => {
|
resetUserPwd(row.userId, value).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
proxy.$modal.msgSuccess("修改成功,新密码是:" + value);
|
||||||
});
|
});
|
||||||
}).catch(() => {});
|
}).catch(() => { });
|
||||||
};
|
};
|
||||||
/** 选择条数 */
|
/** 选择条数 */
|
||||||
function handleSelectionChange(selection) {
|
function handleSelectionChange(selection) {
|
||||||
ids.value = selection.map(item => item.userId);
|
ids.value = selection.map(item => item.userId);
|
||||||
single.value = selection.length != 1;
|
single.value = selection.length != 1;
|
||||||
multiple.value = !selection.length;
|
multiple.value = !selection.length;
|
||||||
};
|
};
|
||||||
/** 导入按钮操作 */
|
/** 导入按钮操作 */
|
||||||
function handleImport() {
|
function handleImport() {
|
||||||
upload.title = "用户导入";
|
upload.title = "用户导入";
|
||||||
upload.open = true;
|
upload.open = true;
|
||||||
};
|
};
|
||||||
/** 下载模板操作 */
|
/** 下载模板操作 */
|
||||||
function importTemplate() {
|
function importTemplate() {
|
||||||
proxy.download("system/user/importTemplate", {
|
proxy.download("system/user/importTemplate", {
|
||||||
}, `user_template_${new Date().getTime()}.xlsx`);
|
}, `user_template_${new Date().getTime()}.xlsx`);
|
||||||
};
|
};
|
||||||
/**文件上传中处理 */
|
/**文件上传中处理 */
|
||||||
const handleFileUploadProgress = (event, file, fileList) => {
|
const handleFileUploadProgress = (event, file, fileList) => {
|
||||||
upload.isUploading = true;
|
upload.isUploading = true;
|
||||||
};
|
};
|
||||||
/** 文件上传成功处理 */
|
/** 文件上传成功处理 */
|
||||||
const handleFileSuccess = (response, file, fileList) => {
|
const handleFileSuccess = (response, file, fileList) => {
|
||||||
upload.open = false;
|
upload.open = false;
|
||||||
upload.isUploading = false;
|
upload.isUploading = false;
|
||||||
proxy.$refs["uploadRef"].handleRemove(file);
|
proxy.$refs["uploadRef"].handleRemove(file);
|
||||||
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
|
||||||
getList();
|
getList();
|
||||||
};
|
};
|
||||||
/** 提交上传文件 */
|
/** 提交上传文件 */
|
||||||
function submitFileForm() {
|
function submitFileForm() {
|
||||||
proxy.$refs["uploadRef"].submit();
|
proxy.$refs["uploadRef"].submit();
|
||||||
};
|
};
|
||||||
/** 重置操作表单 */
|
/** 重置操作表单 */
|
||||||
function reset() {
|
function reset() {
|
||||||
form.value = {
|
form.value = {
|
||||||
userId: undefined,
|
userId: undefined,
|
||||||
orgId: undefined,
|
orgId: undefined,
|
||||||
userName: undefined,
|
userName: undefined,
|
||||||
nickName: undefined,
|
nickName: undefined,
|
||||||
password: undefined,
|
password: undefined,
|
||||||
phonenumber: undefined,
|
phonenumber: undefined,
|
||||||
email: undefined,
|
email: undefined,
|
||||||
sex: undefined,
|
sex: undefined,
|
||||||
status: "0",
|
status: "0",
|
||||||
remark: undefined,
|
remark: undefined,
|
||||||
roleIds: [],
|
practitionerRolesDtoList: [],
|
||||||
childList:[]
|
responsibilityOrgDtoList: [],
|
||||||
};
|
manageLocationDtoList: [],
|
||||||
data.rules.childList = []; // 清空现有的校验规则
|
doctorVisitOrgDtoList: []
|
||||||
proxy.resetForm("userRef");
|
};
|
||||||
|
proxy.resetForm("userRef");
|
||||||
};
|
};
|
||||||
/** 取消按钮 */
|
/** 取消按钮 */
|
||||||
function cancel() {
|
function cancel() {
|
||||||
open.value = false;
|
open.value = false;
|
||||||
reset();
|
reset();
|
||||||
};
|
};
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
reset();
|
reset();
|
||||||
getRole().then(response => {
|
getRole().then(response => {
|
||||||
postOptions.value = response.posts;
|
postOptions.value = response.posts;
|
||||||
roleOptions.value = response.roles;
|
roleOptions.value = response.roles;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "添加用户";
|
// 默认设置为 true
|
||||||
form.value.password = initPassword.value;
|
doctorShow.value = true;
|
||||||
});
|
locationAdminShow.value = true;
|
||||||
|
title.value = "添加用户";
|
||||||
|
form.value.password = initPassword.value;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset();
|
reset();
|
||||||
const userId = row.userId || ids.value;
|
const userId = row.userId || ids.value;
|
||||||
getUser(userId).then(response => {
|
getUser(userId).then(response => {
|
||||||
selectRole.value = []
|
form.value = response.data;
|
||||||
form.value = response.data;
|
form.value.responsibilityOrgDtoListIds = response.data.responsibilityOrgDtoList.map(res => res.orgId);
|
||||||
form.value.roleIds = response.data.childList.map(res => res.roleId);
|
form.value.practitionerRolesDtoListIds = response.data.practitionerRolesDtoList.map(res => Number(res.roleId));
|
||||||
response.data.childList.forEach(res => {
|
form.value.manageLocationDtoListIds = response.data.manageLocationDtoList.map(res => res.orgId);
|
||||||
const role = roleOptions.value.find(role => role.roleId === res.roleId);
|
form.value.doctorVisitOrgDtoListIds = response.data.doctorVisitOrgDtoList.map(res => res.orgId);
|
||||||
if (role) {
|
// 检查 practitionerRolesDtoList 中是否有 roleCode 为 "doctor" 或 "locationAdmin"
|
||||||
// 将角色对象插入到 selectRole 数组中
|
const hasDoctorRole = response.data.practitionerRolesDtoList.some(role => role.roleCode === "doctor");
|
||||||
selectRole.value.push(role);
|
const hasLocationAdminRole = response.data.practitionerRolesDtoList.some(role => role.roleCode === "locationAdmin");
|
||||||
}
|
// 根据检查结果设置 doctorShow 和 locationAdminShow
|
||||||
})
|
doctorShow.value = !hasDoctorRole;
|
||||||
|
locationAdminShow.value = !hasLocationAdminRole;
|
||||||
data.rules.childList = form.value.childList.map((_, index) => ({
|
open.value = true;
|
||||||
roleCode: [
|
title.value = "修改用户";
|
||||||
{ required: true, message: "请选择角色", trigger: "change" },
|
form.password = "";
|
||||||
{ validator: validateUniqueRole, trigger: "change" }
|
console.log(form.value)
|
||||||
],
|
});
|
||||||
orgId: [
|
getRole().then(response => {
|
||||||
{ required: true, message: "请选择归属部门", trigger: "change" }
|
postOptions.value = response.posts;
|
||||||
],
|
roleOptions.value = response.roles;
|
||||||
locationId: [
|
});
|
||||||
{ required: true, message: "请选择位置", trigger: "change" }
|
|
||||||
]
|
|
||||||
}));
|
|
||||||
|
|
||||||
open.value = true;
|
|
||||||
title.value = "修改用户";
|
|
||||||
form.password = "";
|
|
||||||
});
|
|
||||||
getRole().then(response => {
|
|
||||||
postOptions.value = response.posts;
|
|
||||||
roleOptions.value = response.roles;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleRoleChange(e) {
|
function handleRoleChange(selectedRoleIds) {
|
||||||
selectRole.value = [];
|
form.value.practitionerRolesDtoList = []
|
||||||
form.value.childList = []
|
// 默认设置为 true
|
||||||
data.rules.childList = []; // 清空现有的校验规则
|
doctorShow.value = true;
|
||||||
console.log(e)
|
locationAdminShow.value = true;
|
||||||
|
|
||||||
// 遍历选中的角色 ID 数组
|
// 遍历选中的角色 ID 数组
|
||||||
e.forEach(roleId => {
|
selectedRoleIds.forEach(roleId => {
|
||||||
// 从 roleOptions 中找到对应的角色对象
|
// 从 roleOptions 中找到对应的角色对象
|
||||||
const role = roleOptions.value.find(role => role.roleId === roleId);
|
const role = roleOptions.value.find(role => role.roleId === roleId);
|
||||||
|
console.log(role)
|
||||||
|
form.value.practitionerRolesDtoList.push({ roleId: role.roleId,})
|
||||||
if (role) {
|
if (role) {
|
||||||
// 将角色对象插入到 selectRole 数组中
|
if (role.roleKey.includes("doctor")) {
|
||||||
selectRole.value.push(role);
|
doctorShow.value = false;
|
||||||
form.value.childList.push({
|
}
|
||||||
roleCode: '', // 确保 role 对象中有 roleCode 属性
|
if (role.roleKey.includes("locationAdmin")) {
|
||||||
orgId: undefined, // 初始化 orgId
|
locationAdminShow.value = false;
|
||||||
locationId: undefined // 初始化 locationId
|
}
|
||||||
});
|
}
|
||||||
data.rules.childList.push({
|
});
|
||||||
roleCode: [
|
// 循环结束后检查
|
||||||
{ required: true, message: "请选择角色", trigger: "change" },
|
if (doctorShow.value) {
|
||||||
{ validator: validateUniqueRole, trigger: "change" }
|
form.value.doctorVisitOrgDtoListIds = [];
|
||||||
],
|
form.value.doctorVisitOrgDtoList = [];
|
||||||
orgId: [
|
}
|
||||||
{ required: true, message: "请选择归属部门", trigger: "change" }
|
if (locationAdminShow.value) {
|
||||||
],
|
form.value.manageLocationDtoListIds = [];
|
||||||
locationId: [
|
form.value.manageLocationDtoList = [];
|
||||||
{ required: true, message: "请选择位置", trigger: "change" }
|
}
|
||||||
]
|
}
|
||||||
});
|
|
||||||
|
function handleLocationChange(e) {
|
||||||
|
form.value.manageLocationDtoList = []
|
||||||
|
e.forEach(id => {
|
||||||
|
// 使用递归函数查找节点
|
||||||
|
const location = findNodeById(locationOptions.value, id);
|
||||||
|
if (location) {
|
||||||
|
form.value.manageLocationDtoList.push({ orgId: location.id, locationId: location.organizationId });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleChange(e) {
|
||||||
|
form.value.responsibilityOrgDtoList = []
|
||||||
|
e.forEach(id => {
|
||||||
|
// 使用递归函数查找节点
|
||||||
|
const OrgDto = findNodeById(deptOptions.value, id);
|
||||||
|
if (OrgDto) {
|
||||||
|
form.value.responsibilityOrgDtoList.push({ orgId: OrgDto.id });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleLOrgDtoChange(e) {
|
||||||
|
form.value.doctorVisitOrgDtoList = []
|
||||||
|
e.forEach(id => {
|
||||||
|
// 使用递归函数查找节点
|
||||||
|
const OrgDto = findNodeById(deptOptions.value, id);
|
||||||
|
if (OrgDto) {
|
||||||
|
form.value.doctorVisitOrgDtoList.push({ orgId: OrgDto.id });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function findNodeById(tree, id) {
|
||||||
|
for (const node of tree) {
|
||||||
|
if (node.id === id) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
if (node.children) {
|
||||||
|
const result = findNodeById(node.children, id);
|
||||||
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// 自定义校验规则:确保 roleCode 不重复
|
// 自定义校验规则:确保 roleCode 不重复
|
||||||
function validateUniqueRole(rule, value, callback) {
|
function validateUniqueRole(rule, value, callback) {
|
||||||
const roleCodes = form.value.childList.map(child => child.roleCode);
|
const roleCodes = form.value.childList.map(child => child.roleCode);
|
||||||
const duplicates = roleCodes.filter((item, index) => roleCodes.indexOf(item) !== index);
|
const duplicates = roleCodes.filter((item, index) => roleCodes.indexOf(item) !== index);
|
||||||
if (duplicates.length > 0) {
|
if (duplicates.length > 0) {
|
||||||
callback(new Error("角色不能重复"));
|
callback(new Error("角色不能重复"));
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
proxy.$refs["userRef"].validate(valid => {
|
proxy.$refs["userRef"].validate(valid => {
|
||||||
console.log(form.value)
|
console.log(form.value)
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (form.value.userId != undefined) {
|
if (form.value.userId != undefined) {
|
||||||
updateUser(form.value).then(response => {
|
updateUser(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addUser(form.value).then(response => {
|
addUser(form.value).then(response => {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
getDeptTree();
|
getDeptTree();
|
||||||
@@ -752,9 +681,9 @@ getList();
|
|||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.form-subtitle {
|
.form-subtitle {
|
||||||
margin-bottom: 12px;
|
margin-bottom: 12px;
|
||||||
border-left: 5px solid #2969ff;
|
border-left: 5px solid #2969ff;
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user