😎1、调整优化账号角色分配相关代码 2、更新接口请求文件 3、升级依赖
This commit is contained in:
parent
120a544001
commit
954a8adb24
@ -17,7 +17,7 @@
|
||||
<PackageReference Include="AngleSharp" Version="1.1.2" />
|
||||
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
|
||||
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
|
||||
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.7" />
|
||||
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.8" />
|
||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.5.13" />
|
||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.5.13" />
|
||||
<PackageReference Include="Furion.Pure" Version="4.9.5.13" />
|
||||
|
||||
@ -49,11 +49,12 @@ public class PageRoleOutput : SysRole
|
||||
public class GrantRoleOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 以分配
|
||||
/// 已经分配
|
||||
/// </summary>
|
||||
public IEnumerable<RoleOutput> Granted { get; set; }
|
||||
public IEnumerable<RoleOutput> GrantedRoles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可分配
|
||||
/// 可用分配
|
||||
/// </summary>
|
||||
public IEnumerable<RoleOutput> Available { get; set; }
|
||||
public IEnumerable<RoleOutput> AvailableRoles { get; set; }
|
||||
}
|
||||
@ -358,15 +358,15 @@ public class SysUserService : IDynamicApiController, ITransient
|
||||
[DisplayName("获取用户拥有角色集合")]
|
||||
public async Task<GrantRoleOutput> GetOwnRoleList(long userId)
|
||||
{
|
||||
// 获取当前分配用户的角色
|
||||
var granted = (await _sysUserRoleService.GetUserRoleInfoList(userId));
|
||||
// 获取当前用户的角色
|
||||
var available = await _sysRoleService.GetList();
|
||||
// 改变分配用户的角色可分配状态
|
||||
granted.ForEach(u => u.Disabled = !available.Any(e => e.Id == u.Id));
|
||||
// 获取当前用户已分配角色
|
||||
var grantedRoles = (await _sysUserRoleService.GetUserRoleInfoList(userId));
|
||||
// 获取当前用户可用的角色
|
||||
var availableRoles = await _sysRoleService.GetList();
|
||||
// 改变用户分配的角色可分配状态
|
||||
grantedRoles.ForEach(u => u.Disabled = !availableRoles.Any(u => u.Id == u.Id));
|
||||
// 排除已分配的角色
|
||||
available = available.ExceptBy(granted.Select(e => e.Id), e => e.Id).ToList();
|
||||
return new GrantRoleOutput { Granted = granted, Available = available };
|
||||
availableRoles = availableRoles.ExceptBy(grantedRoles.Select(u => u.Id), u => u.Id).ToList();
|
||||
return new GrantRoleOutput { GrantedRoles = grantedRoles, AvailableRoles = availableRoles };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
"vue-router": "^4.4.5",
|
||||
"vue-signature-pad": "^3.0.2",
|
||||
"vue3-tree-org": "^4.2.2",
|
||||
"vxe-pc-ui": "^4.2.10",
|
||||
"vxe-pc-ui": "^4.2.11",
|
||||
"vxe-table": "^4.7.59",
|
||||
"vxe-table-plugin-element": "^4.0.4",
|
||||
"vxe-table-plugin-export-xlsx": "^4.0.6",
|
||||
|
||||
@ -18,6 +18,7 @@ import { Configuration } from '../configuration';
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
|
||||
import { AdminResultBoolean } from '../models';
|
||||
import { AliyunSendSmsTemplateInput } from '../models';
|
||||
import { SmsVerifyCodeInput } from '../models';
|
||||
/**
|
||||
* SysSmsApi - axios parameter creator
|
||||
@ -77,22 +78,12 @@ export const SysSmsApiAxiosParamCreator = function (configuration?: Configuratio
|
||||
/**
|
||||
*
|
||||
* @summary 发送短信模板
|
||||
* @param {any} body
|
||||
* @param {string} phoneNumber
|
||||
* @param {AliyunSendSmsTemplateInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
apiSysSmsAliyunSendSmsTemplatePhoneNumberPost: async (body: any, phoneNumber: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
// verify required parameter 'body' is not null or undefined
|
||||
if (body === null || body === undefined) {
|
||||
throw new RequiredError('body','Required parameter body was null or undefined when calling apiSysSmsAliyunSendSmsTemplatePhoneNumberPost.');
|
||||
}
|
||||
// verify required parameter 'phoneNumber' is not null or undefined
|
||||
if (phoneNumber === null || phoneNumber === undefined) {
|
||||
throw new RequiredError('phoneNumber','Required parameter phoneNumber was null or undefined when calling apiSysSmsAliyunSendSmsTemplatePhoneNumberPost.');
|
||||
}
|
||||
const localVarPath = `/api/sysSms/aliyunSendSmsTemplate/{phoneNumber}`
|
||||
.replace(`{${"phoneNumber"}}`, encodeURIComponent(String(phoneNumber)));
|
||||
apiSysSmsAliyunSendSmsTemplatePost: async (body?: AliyunSendSmsTemplateInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
|
||||
const localVarPath = `/api/sysSms/aliyunSendSmsTemplate`;
|
||||
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
||||
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
|
||||
let baseOptions;
|
||||
@ -304,13 +295,12 @@ export const SysSmsApiFp = function(configuration?: Configuration) {
|
||||
/**
|
||||
*
|
||||
* @summary 发送短信模板
|
||||
* @param {any} body
|
||||
* @param {string} phoneNumber
|
||||
* @param {AliyunSendSmsTemplateInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body: any, phoneNumber: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysSmsApiAxiosParamCreator(configuration).apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body, phoneNumber, options);
|
||||
async apiSysSmsAliyunSendSmsTemplatePost(body?: AliyunSendSmsTemplateInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
|
||||
const localVarAxiosArgs = await SysSmsApiAxiosParamCreator(configuration).apiSysSmsAliyunSendSmsTemplatePost(body, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
return axios.request(axiosRequestArgs);
|
||||
@ -380,13 +370,12 @@ export const SysSmsApiFactory = function (configuration?: Configuration, basePat
|
||||
/**
|
||||
*
|
||||
* @summary 发送短信模板
|
||||
* @param {any} body
|
||||
* @param {string} phoneNumber
|
||||
* @param {AliyunSendSmsTemplateInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body: any, phoneNumber: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysSmsApiFp(configuration).apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body, phoneNumber, options).then((request) => request(axios, basePath));
|
||||
async apiSysSmsAliyunSendSmsTemplatePost(body?: AliyunSendSmsTemplateInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
|
||||
return SysSmsApiFp(configuration).apiSysSmsAliyunSendSmsTemplatePost(body, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
*
|
||||
@ -442,14 +431,13 @@ export class SysSmsApi extends BaseAPI {
|
||||
/**
|
||||
*
|
||||
* @summary 发送短信模板
|
||||
* @param {any} body
|
||||
* @param {string} phoneNumber
|
||||
* @param {AliyunSendSmsTemplateInput} [body]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof SysSmsApi
|
||||
*/
|
||||
public async apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body: any, phoneNumber: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysSmsApiFp(this.configuration).apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body, phoneNumber, options).then((request) => request(this.axios, this.basePath));
|
||||
public async apiSysSmsAliyunSendSmsTemplatePost(body?: AliyunSendSmsTemplateInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
|
||||
return SysSmsApiFp(this.configuration).apiSysSmsAliyunSendSmsTemplatePost(body, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
*
|
||||
|
||||
@ -18,9 +18,9 @@ import { Configuration } from '../configuration';
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
|
||||
import { AddUserInput } from '../models';
|
||||
import { AdminResultGrantRoleOutput } from '../models';
|
||||
import { AdminResultInt32 } from '../models';
|
||||
import { AdminResultInt64 } from '../models';
|
||||
import { AdminResultListInt64 } from '../models';
|
||||
import { AdminResultListSysUserExtOrg } from '../models';
|
||||
import { AdminResultSqlSugarPagedListUserOutput } from '../models';
|
||||
import { AdminResultString } from '../models';
|
||||
@ -774,7 +774,7 @@ export const SysUserApiFp = function(configuration?: Configuration) {
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysUserOwnRoleListUserIdGet(userId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultListInt64>>> {
|
||||
async apiSysUserOwnRoleListUserIdGet(userId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<AdminResultGrantRoleOutput>>> {
|
||||
const localVarAxiosArgs = await SysUserApiAxiosParamCreator(configuration).apiSysUserOwnRoleListUserIdGet(userId, options);
|
||||
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
|
||||
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
|
||||
@ -936,7 +936,7 @@ export const SysUserApiFactory = function (configuration?: Configuration, basePa
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
*/
|
||||
async apiSysUserOwnRoleListUserIdGet(userId: number, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultListInt64>> {
|
||||
async apiSysUserOwnRoleListUserIdGet(userId: number, options?: AxiosRequestConfig): Promise<AxiosResponse<AdminResultGrantRoleOutput>> {
|
||||
return SysUserApiFp(configuration).apiSysUserOwnRoleListUserIdGet(userId, options).then((request) => request(axios, basePath));
|
||||
},
|
||||
/**
|
||||
@ -1083,7 +1083,7 @@ export class SysUserApi extends BaseAPI {
|
||||
* @throws {RequiredError}
|
||||
* @memberof SysUserApi
|
||||
*/
|
||||
public async apiSysUserOwnRoleListUserIdGet(userId: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultListInt64>> {
|
||||
public async apiSysUserOwnRoleListUserIdGet(userId: number, options?: AxiosRequestConfig) : Promise<AxiosResponse<AdminResultGrantRoleOutput>> {
|
||||
return SysUserApiFp(this.configuration).apiSysUserOwnRoleListUserIdGet(userId, options).then((request) => request(this.axios, this.basePath));
|
||||
}
|
||||
/**
|
||||
|
||||
@ -0,0 +1,69 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Admin.NET 通用权限开发平台
|
||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { GrantRoleOutput } from './grant-role-output';
|
||||
/**
|
||||
* 全局返回结果
|
||||
*
|
||||
* @export
|
||||
* @interface AdminResultGrantRoleOutput
|
||||
*/
|
||||
export interface AdminResultGrantRoleOutput {
|
||||
|
||||
/**
|
||||
* 状态码
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof AdminResultGrantRoleOutput
|
||||
*/
|
||||
code?: number;
|
||||
|
||||
/**
|
||||
* 类型success、warning、error
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AdminResultGrantRoleOutput
|
||||
*/
|
||||
type?: string | null;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AdminResultGrantRoleOutput
|
||||
*/
|
||||
message?: string | null;
|
||||
|
||||
/**
|
||||
* @type {GrantRoleOutput}
|
||||
* @memberof AdminResultGrantRoleOutput
|
||||
*/
|
||||
result?: GrantRoleOutput;
|
||||
|
||||
/**
|
||||
* 附加数据
|
||||
*
|
||||
* @type {any}
|
||||
* @memberof AdminResultGrantRoleOutput
|
||||
*/
|
||||
extras?: any | null;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*
|
||||
* @type {Date}
|
||||
* @memberof AdminResultGrantRoleOutput
|
||||
*/
|
||||
time?: Date;
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Admin.NET 通用权限开发平台
|
||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @export
|
||||
* @interface AliyunSendSmsTemplateInput
|
||||
*/
|
||||
export interface AliyunSendSmsTemplateInput {
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AliyunSendSmsTemplateInput
|
||||
*/
|
||||
phoneNumber: string;
|
||||
|
||||
/**
|
||||
* 短信模板Id
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AliyunSendSmsTemplateInput
|
||||
*/
|
||||
templateId: string;
|
||||
|
||||
/**
|
||||
* 短信内容
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof AliyunSendSmsTemplateInput
|
||||
*/
|
||||
templateParam: string;
|
||||
}
|
||||
39
Web/src/api-services/models/grant-role-output.ts
Normal file
39
Web/src/api-services/models/grant-role-output.ts
Normal file
@ -0,0 +1,39 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Admin.NET 通用权限开发平台
|
||||
* 让 .NET 开发更简单、更通用、更流行。整合最新技术,模块插件式开发,前后端分离,开箱即用。<br/><u><b><font color='FF0000'> 👮不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!</font></b></u>
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program.
|
||||
* https://github.com/swagger-api/swagger-codegen.git
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { RoleOutput } from './role-output';
|
||||
/**
|
||||
* 角色已分配可分配输出参数
|
||||
*
|
||||
* @export
|
||||
* @interface GrantRoleOutput
|
||||
*/
|
||||
export interface GrantRoleOutput {
|
||||
|
||||
/**
|
||||
* 已经分配
|
||||
*
|
||||
* @type {Array<RoleOutput>}
|
||||
* @memberof GrantRoleOutput
|
||||
*/
|
||||
grantedRoles?: Array<RoleOutput> | null;
|
||||
|
||||
/**
|
||||
* 可用分配
|
||||
*
|
||||
* @type {Array<RoleOutput>}
|
||||
* @memberof GrantRoleOutput
|
||||
*/
|
||||
availableRoles?: Array<RoleOutput> | null;
|
||||
}
|
||||
@ -28,6 +28,7 @@ export * from './admin-result-data-table';
|
||||
export * from './admin-result-dictionary-string-string';
|
||||
export * from './admin-result-generate-qrimage-output';
|
||||
export * from './admin-result-get-refund-domestic-refund-by-out-refund-number-response';
|
||||
export * from './admin-result-grant-role-output';
|
||||
export * from './admin-result-iaction-result';
|
||||
export * from './admin-result-idisposable';
|
||||
export * from './admin-result-int32';
|
||||
@ -116,6 +117,7 @@ export * from './admin-result-visual-db-table';
|
||||
export * from './admin-result-wechat-pay-output';
|
||||
export * from './admin-result-wx-open-id-output';
|
||||
export * from './admin-result-wx-phone-output';
|
||||
export * from './aliyun-send-sms-template-input';
|
||||
export * from './amount';
|
||||
export * from './api-output';
|
||||
export * from './assembly';
|
||||
@ -213,6 +215,7 @@ export * from './generate-signature-input';
|
||||
export * from './generic-parameter-attributes';
|
||||
export * from './get-refund-domestic-refund-by-out-refund-number-response';
|
||||
export * from './goods-detail';
|
||||
export * from './grant-role-output';
|
||||
export * from './http-method-enum';
|
||||
export * from './iaction-result';
|
||||
export * from './icomponent';
|
||||
|
||||
@ -43,4 +43,12 @@ export interface RoleOutput {
|
||||
* @memberof RoleOutput
|
||||
*/
|
||||
code?: string | null;
|
||||
|
||||
/**
|
||||
* 是否禁用
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof RoleOutput
|
||||
*/
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
@ -25,7 +25,6 @@ export interface SmsVerifyCodeInput {
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SmsVerifyCodeInput
|
||||
* @example admin
|
||||
*/
|
||||
phone: string;
|
||||
|
||||
@ -34,7 +33,6 @@ export interface SmsVerifyCodeInput {
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof SmsVerifyCodeInput
|
||||
* @example 123456
|
||||
*/
|
||||
code: string;
|
||||
}
|
||||
|
||||
@ -7,14 +7,14 @@
|
||||
<span>{{ state.leftChecked.length }}/{{ props.leftData.length }}</span>
|
||||
</p>
|
||||
<div class="transfer-panel__body">
|
||||
<el-input class="transfer-panel__filter" v-model="state.leftKeyword" placeholder="搜索" :prefix-icon="Search" clearable :validate-event="false" />
|
||||
<el-input class="transfer-panel__filter" v-model="state.leftKeyword" placeholder="搜索" prefix-icon="ele-Search" clearable :validate-event="false" />
|
||||
<el-checkbox-group v-show="true" v-model="state.leftChecked" :validate-event="false" class="transfer-panel__list">
|
||||
<el-checkbox
|
||||
v-for="(i, k) in leftFilterData"
|
||||
:key="k"
|
||||
:value="i[props.options.value]"
|
||||
:label="i[props.options.label]"
|
||||
:disabled="i[props.options.disabled]"
|
||||
v-for="(item, index) in leftFilterData"
|
||||
:key="index"
|
||||
:value="item[props.options.value]"
|
||||
:label="item[props.options.label]"
|
||||
:disabled="item[props.options.disabled]"
|
||||
:validate-event="false"
|
||||
class="transfer-panel__item"
|
||||
>
|
||||
@ -25,16 +25,16 @@
|
||||
</el-col>
|
||||
<el-col :span="4" class="transfer-buttons">
|
||||
<div class="transfer-buttons__item">
|
||||
<el-button type="primary" style="width: 100%" :icon="ArrowRight" @click="toRight">往右</el-button>
|
||||
<el-button type="primary" style="" icon="ele-ArrowRight" @click="toRight"></el-button>
|
||||
</div>
|
||||
<div class="transfer-buttons__item">
|
||||
<el-button type="primary" style="width: 100%" :icon="ArrowLeft" @click="toLeft">往左</el-button>
|
||||
<el-button type="primary" style="" icon="ele-ArrowLeft" @click="toLeft"></el-button>
|
||||
</div>
|
||||
<div class="transfer-buttons__item">
|
||||
<el-button type="primary" style="width: 100%" :icon="DArrowRight" @click="allToRight">全部往右</el-button>
|
||||
<el-button type="primary" style="" icon="ele-DArrowRight" @click="allToRight"></el-button>
|
||||
</div>
|
||||
<div class="transfer-buttons__item">
|
||||
<el-button type="primary" style="width: 100%" :icon="DArrowLeft" @click="allToLeft">全部往左</el-button>
|
||||
<el-button type="primary" style="" icon="ele-DArrowLeft" @click="allToLeft"></el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
@ -44,14 +44,14 @@
|
||||
<span>{{ state.rightChecked.length }}/{{ props.rightData.length }}</span>
|
||||
</p>
|
||||
<div class="transfer-panel__body">
|
||||
<el-input class="transfer-panel__filter" v-model="state.rightKeyword" placeholder="搜索" :prefix-icon="Search" clearable :validate-event="false" />
|
||||
<el-input class="transfer-panel__filter" v-model="state.rightKeyword" placeholder="搜索" prefix-icon="ele-Search" clearable :validate-event="false" />
|
||||
<el-checkbox-group v-show="true" v-model="state.rightChecked" :validate-event="false" class="transfer-panel__list">
|
||||
<el-checkbox
|
||||
v-for="(i, k) in rightFilterData"
|
||||
:key="k"
|
||||
:value="i[props.options.value]"
|
||||
:label="i[props.options.label]"
|
||||
:disabled="i[props.options.disabled]"
|
||||
v-for="(item, index) in rightFilterData"
|
||||
:key="index"
|
||||
:value="item[props.options.value]"
|
||||
:label="item[props.options.label]"
|
||||
:disabled="item[props.options.disabled]"
|
||||
:validate-event="false"
|
||||
class="transfer-panel__item"
|
||||
>
|
||||
@ -77,27 +77,27 @@ const props = defineProps({
|
||||
disabled: 'disabled',
|
||||
}),
|
||||
},
|
||||
leftData: { type: Array, default: () => [] }, //左边全部数据
|
||||
rightData: { type: Array, default: () => [] }, //右边全部数据
|
||||
leftData: { type: Array, default: () => [] }, // 左边全部数据
|
||||
rightData: { type: Array, default: () => [] }, // 右边全部数据
|
||||
});
|
||||
|
||||
const emits = defineEmits(['left', 'right', 'allLeft', 'allRight', 'update:leftData', 'update:rightData']);
|
||||
|
||||
const state = reactive({
|
||||
leftAllChecked: false, //左边是否全选
|
||||
leftKeyword: '', //左边搜索关键词
|
||||
leftChecked: [], //左边选中数据
|
||||
rightAllChecked: false, //右边是否全选
|
||||
rightKeyword: '', //右边搜索关键词
|
||||
rightChecked: [], //右边选中数据
|
||||
leftAllChecked: false, // 左边是否全选
|
||||
leftKeyword: '', // 左边搜索关键词
|
||||
leftChecked: [] as any, // 左边选中数据
|
||||
rightAllChecked: false, // 右边是否全选
|
||||
rightKeyword: '', // 右边搜索关键词
|
||||
rightChecked: [] as any, // 右边选中数据
|
||||
});
|
||||
|
||||
// 过滤左边数据
|
||||
const leftFilterData = computed(() => {
|
||||
let result = props.leftData.filter((e) => e[props.options.label].toLowerCase().includes(state.leftKeyword.toLowerCase()));
|
||||
const leftFilterData: any = computed(() => {
|
||||
let result = props.leftData.filter((e: any) => e[props.options.label].toLowerCase().includes(state.leftKeyword.toLowerCase()));
|
||||
if (state.leftChecked.length > 0) {
|
||||
for (let i = state.leftChecked.length - 1; i >= 0; i--) {
|
||||
const index = result.findIndex((e) => e[props.options.value] == state.leftChecked[i]);
|
||||
const index = result.findIndex((e: any) => e[props.options.value] == state.leftChecked[i]);
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
if (index == -1) state.leftChecked.splice(i, 1);
|
||||
}
|
||||
@ -107,29 +107,29 @@ const leftFilterData = computed(() => {
|
||||
|
||||
// 左边数据全选
|
||||
const handleLeftAllChecked = (value: any) => {
|
||||
state.leftChecked = value ? leftFilterData.value.filter((e) => e[props.options.disabled] == false).map((e) => e[props.options.value]) : [];
|
||||
state.leftChecked = value ? leftFilterData.value.filter((e: any) => e[props.options.disabled] == false).map((e: any) => e[props.options.value]) : [];
|
||||
};
|
||||
|
||||
// 左边数据半选状态
|
||||
const leftIndeterminate = computed(() => {
|
||||
const checkedLength = state.leftChecked.length;
|
||||
const result = checkedLength > 0 && checkedLength < leftFilterData.value.filter((e) => e[props.options.disabled] == false).length;
|
||||
const result = checkedLength > 0 && checkedLength < leftFilterData.value.filter((e: any) => e[props.options.disabled] == false).length;
|
||||
return result;
|
||||
});
|
||||
|
||||
watch(
|
||||
() => state.leftChecked,
|
||||
(val: any[]) => {
|
||||
state.leftAllChecked = val.length > 0 && val.length == leftFilterData.value.filter((e) => e[props.options.disabled] == false).length;
|
||||
state.leftAllChecked = val.length > 0 && val.length == leftFilterData.value.filter((e: any) => e[props.options.disabled] == false).length;
|
||||
}
|
||||
);
|
||||
|
||||
// 右边过滤数据
|
||||
const rightFilterData = computed(() => {
|
||||
let result = props.rightData.filter((e) => e[props.options.label].toLowerCase().includes(state.rightKeyword.toLowerCase()));
|
||||
const rightFilterData: any = computed(() => {
|
||||
let result = props.rightData.filter((e: any) => e[props.options.label].toLowerCase().includes(state.rightKeyword.toLowerCase()));
|
||||
if (state.rightChecked.length > 0) {
|
||||
for (let i = state.rightChecked.length - 1; i >= 0; i--) {
|
||||
const index = result.findIndex((e) => e[props.options.value] == state.rightChecked[i]);
|
||||
const index = result.findIndex((e: any) => e[props.options.value] == state.rightChecked[i]);
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
if (index == -1) state.rightChecked.splice(i, 1);
|
||||
}
|
||||
@ -139,20 +139,20 @@ const rightFilterData = computed(() => {
|
||||
|
||||
// 右边数据全选
|
||||
const handleRightAllChecked = (value: any) => {
|
||||
state.rightChecked = value ? rightFilterData.value.filter((e) => e[props.options.disabled] == false).map((e) => e[props.options.value]) : [];
|
||||
state.rightChecked = value ? rightFilterData.value.filter((e: any) => e[props.options.disabled] == false).map((e: any) => e[props.options.value]) : [];
|
||||
};
|
||||
|
||||
// 右边数据半选状态
|
||||
const rightIndeterminate = computed(() => {
|
||||
const checkedLength = state.rightChecked.length;
|
||||
const result = checkedLength > 0 && checkedLength < rightFilterData.value.filter((e) => e[props.options.disabled] == false).length;
|
||||
const result = checkedLength > 0 && checkedLength < rightFilterData.value.filter((e: any) => e[props.options.disabled] == false).length;
|
||||
return result;
|
||||
});
|
||||
|
||||
watch(
|
||||
() => state.rightChecked,
|
||||
(val: any[]) => {
|
||||
state.rightAllChecked = val.length > 0 && val.length == rightFilterData.value.filter((e) => e[props.options.disabled] == false).length;
|
||||
state.rightAllChecked = val.length > 0 && val.length == rightFilterData.value.filter((e: any) => e[props.options.disabled] == false).length;
|
||||
}
|
||||
);
|
||||
|
||||
@ -160,9 +160,9 @@ watch(
|
||||
const toRight = () => {
|
||||
if (state.leftChecked?.length > 0) {
|
||||
//取交集
|
||||
let adds = props.leftData.filter((e) => state.leftChecked.some((x) => x == e[props.options.value]));
|
||||
let adds = props.leftData.filter((e: any) => state.leftChecked.some((x: any) => x == e[props.options.value]));
|
||||
//取差集
|
||||
let cuts = props.leftData.filter((e) => state.leftChecked.every((x) => x != e[props.options.value]));
|
||||
let cuts = props.leftData.filter((e: any) => state.leftChecked.every((x: any) => x != e[props.options.value]));
|
||||
emits('update:leftData', cuts);
|
||||
emits('update:rightData', props.rightData.concat(adds));
|
||||
emits('right');
|
||||
@ -173,11 +173,11 @@ const toRight = () => {
|
||||
// 全部左边的变右边
|
||||
const allToRight = () => {
|
||||
if (leftFilterData.value?.length > 0) {
|
||||
let temp = leftFilterData.value.filter((e) => e[props.options.disabled] == false);
|
||||
let temp = leftFilterData.value.filter((e: any) => e[props.options.disabled] == false);
|
||||
//取交集
|
||||
let adds = props.leftData.filter((e) => temp.some((x) => x[props.options.value] == e[props.options.value]));
|
||||
let adds = props.leftData.filter((e: any) => temp.some((x: any) => x[props.options.value] == e[props.options.value]));
|
||||
//取差集
|
||||
let cuts = props.leftData.filter((e) => temp.every((x) => x[props.options.value] != e[props.options.value]));
|
||||
let cuts = props.leftData.filter((e: any) => temp.every((x: any) => x[props.options.value] != e[props.options.value]));
|
||||
emits('update:leftData', cuts);
|
||||
emits('update:rightData', props.rightData.concat(adds));
|
||||
emits('allRight');
|
||||
@ -189,9 +189,9 @@ const allToRight = () => {
|
||||
const toLeft = () => {
|
||||
if (state.rightChecked?.length > 0) {
|
||||
//取交集
|
||||
let adds = props.rightData.filter((e) => state.rightChecked.some((x) => x == e[props.options.value]));
|
||||
let adds = props.rightData.filter((e: any) => state.rightChecked.some((x: any) => x == e[props.options.value]));
|
||||
//取差集
|
||||
let cuts = props.rightData.filter((e) => state.rightChecked.every((x) => x != e[props.options.value]));
|
||||
let cuts = props.rightData.filter((e: any) => state.rightChecked.every((x: any) => x != e[props.options.value]));
|
||||
emits('update:leftData', props.leftData.concat(adds));
|
||||
emits('update:rightData', cuts);
|
||||
emits('left');
|
||||
@ -202,11 +202,11 @@ const toLeft = () => {
|
||||
// 全部右边的变左边
|
||||
const allToLeft = () => {
|
||||
if (rightFilterData.value?.length > 0) {
|
||||
let temp = rightFilterData.value.filter((e) => e[props.options.disabled] == false);
|
||||
let temp = rightFilterData.value.filter((e: any) => e[props.options.disabled] == false);
|
||||
//取交集
|
||||
let adds = props.rightData.filter((e) => temp.some((x) => x[props.options.value] == e[props.options.value]));
|
||||
let adds = props.rightData.filter((e: any) => temp.some((x: any) => x[props.options.value] == e[props.options.value]));
|
||||
//取差集
|
||||
let cuts = props.rightData.filter((e) => temp.every((x) => x[props.options.value] != e[props.options.value]));
|
||||
let cuts = props.rightData.filter((e: any) => temp.every((x: any) => x[props.options.value] != e[props.options.value]));
|
||||
emits('update:leftData', props.leftData.concat(adds));
|
||||
emits('update:rightData', cuts);
|
||||
emits('allLeft');
|
||||
@ -237,13 +237,14 @@ const allToLeft = () => {
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
}
|
||||
&__body {
|
||||
height: 300px;
|
||||
height: 400px;
|
||||
.transfer-panel__filter {
|
||||
padding: 6px;
|
||||
}
|
||||
.transfer-panel__list {
|
||||
overflow: auto;
|
||||
height: calc(100% - 36px);
|
||||
padding-top: 10px;
|
||||
.transfer-panel__item {
|
||||
display: block !important;
|
||||
padding-left: 6px;
|
||||
@ -256,6 +257,7 @@ const allToLeft = () => {
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
&__item {
|
||||
padding-top: 10px;
|
||||
width: 100%;
|
||||
|
||||
@ -45,6 +45,11 @@
|
||||
<el-input v-model="state.ruleForm.email" placeholder="邮箱" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="入职日期">
|
||||
<el-date-picker v-model="state.ruleForm.joinDate" type="date" placeholder="入职日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" class="w100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb5">
|
||||
<el-form-item label="排序">
|
||||
<el-input-number v-model="state.ruleForm.orderNo" placeholder="排序" class="w100" />
|
||||
@ -80,11 +85,6 @@
|
||||
<el-input v-model="state.ruleForm.domainAccount" placeholder="域账号" clearable />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||
<el-form-item label="入职日期">
|
||||
<el-date-picker v-model="state.ruleForm.joinDate" type="date" placeholder="入职日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" class="w100" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-divider border-style="dashed" content-position="center">
|
||||
<div style="color: #b1b3b8">附属机构</div>
|
||||
</el-divider>
|
||||
@ -124,7 +124,7 @@
|
||||
</el-form>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="角色授权" style="height: 550px; overflow-y: auto; overflow-x: hidden">
|
||||
<Transfer left-title="未授权" right-title="已授权" v-model:leftData="state.available" v-model:rightData="state.granted" />
|
||||
<Transfer left-title="未授权" right-title="已授权" v-model:leftData="state.availableRoles" v-model:rightData="state.grantedRoles" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="档案信息" style="height: 550px; overflow-y: auto; overflow-x: hidden">
|
||||
<el-form :model="state.ruleForm" label-width="auto">
|
||||
@ -244,14 +244,14 @@
|
||||
|
||||
<script lang="ts" setup name="sysEditUser">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useUserInfo } from '/@/stores/userInfo';
|
||||
import Transfer from '/@/components/transfer/index.vue';
|
||||
|
||||
import { getAPI } from '/@/utils/axios-utils';
|
||||
import { SysPosApi, SysRoleApi, SysUserApi } from '/@/api-services/api';
|
||||
import { SysOrg, PagePosOutput, UpdateUserInput } from '/@/api-services/models';
|
||||
import Transfer from '/@/components/transfer/index.vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
@ -267,8 +267,8 @@ const state = reactive({
|
||||
selectedTabName: '0', // 选中的 tab 页
|
||||
ruleForm: {} as UpdateUserInput,
|
||||
posData: [] as Array<PagePosOutput>, // 职位数据
|
||||
available: [], // 可授权角色
|
||||
granted: [], // 已授权角色
|
||||
availableRoles: [] as any, // 可授权角色
|
||||
grantedRoles: [] as any, // 已授权角色
|
||||
});
|
||||
// 级联选择器配置选项
|
||||
const cascaderProps = { checkStrictly: true, emitPath: false, value: 'id', label: 'name', expandTrigger: 'hover' };
|
||||
@ -289,15 +289,15 @@ const openDialog = async (row: any) => {
|
||||
state.ruleForm = JSON.parse(JSON.stringify(row));
|
||||
if (row.id != undefined) {
|
||||
const { data } = await getAPI(SysUserApi).apiSysUserOwnRoleListUserIdGet(row.id);
|
||||
state.available = data.result?.available;
|
||||
state.granted = data.result?.granted;
|
||||
state.availableRoles = data.result?.availableRoles;
|
||||
state.grantedRoles = data.result?.grantedRoles;
|
||||
var resExtOrg = await getAPI(SysUserApi).apiSysUserOwnExtOrgListUserIdGet(row.id);
|
||||
state.ruleForm.extOrgIdList = resExtOrg.data.result;
|
||||
} else {
|
||||
state.ruleForm.accountType = 777; // 默认普通账号类型
|
||||
const { data } = await getAPI(SysRoleApi).apiSysRoleListGet();
|
||||
state.available = data.result ?? [];
|
||||
state.granted = [];
|
||||
state.availableRoles = data.result ?? [];
|
||||
state.grantedRoles = [];
|
||||
}
|
||||
state.isShowDialog = true;
|
||||
};
|
||||
@ -317,9 +317,9 @@ const cancel = () => {
|
||||
const submit = () => {
|
||||
ruleFormRef.value.validate(async (valid: boolean) => {
|
||||
if (!valid) return;
|
||||
if (state.granted?.length > 0) state.ruleForm.roleIdList = state.granted.map((e) => e.id);
|
||||
if (state.grantedRoles?.length > 0) state.ruleForm.roleIdList = state.grantedRoles.map((e: any) => e.id);
|
||||
else {
|
||||
ElMessage.error(`角色尚未分配`);
|
||||
ElMessage.error(`请分配角色`);
|
||||
return;
|
||||
}
|
||||
if (state.ruleForm.id != undefined && state.ruleForm.id > 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user