😎1、调整优化账号角色分配相关代码 2、更新接口请求文件 3、升级依赖

This commit is contained in:
zuohuaijun 2024-09-30 20:14:37 +08:00
parent 120a544001
commit 954a8adb24
14 changed files with 262 additions and 108 deletions

View File

@ -17,7 +17,7 @@
<PackageReference Include="AngleSharp" Version="1.1.2" /> <PackageReference Include="AngleSharp" Version="1.1.2" />
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" /> <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.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.Authentication.JwtBearer" Version="4.9.5.13" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" 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" /> <PackageReference Include="Furion.Pure" Version="4.9.5.13" />

View File

@ -49,11 +49,12 @@ public class PageRoleOutput : SysRole
public class GrantRoleOutput public class GrantRoleOutput
{ {
/// <summary> /// <summary>
/// 分配 /// 已经分配
/// </summary> /// </summary>
public IEnumerable<RoleOutput> Granted { get; set; } public IEnumerable<RoleOutput> GrantedRoles { get; set; }
/// <summary> /// <summary>
/// 可分配 /// 可分配
/// </summary> /// </summary>
public IEnumerable<RoleOutput> Available { get; set; } public IEnumerable<RoleOutput> AvailableRoles { get; set; }
} }

View File

@ -358,15 +358,15 @@ public class SysUserService : IDynamicApiController, ITransient
[DisplayName("获取用户拥有角色集合")] [DisplayName("获取用户拥有角色集合")]
public async Task<GrantRoleOutput> GetOwnRoleList(long userId) public async Task<GrantRoleOutput> GetOwnRoleList(long userId)
{ {
// 获取当前分配用户的角色 // 获取当前用户已分配角色
var granted = (await _sysUserRoleService.GetUserRoleInfoList(userId)); var grantedRoles = (await _sysUserRoleService.GetUserRoleInfoList(userId));
// 获取当前用户的角色 // 获取当前用户可用的角色
var available = await _sysRoleService.GetList(); var availableRoles = await _sysRoleService.GetList();
// 改变分配用户的角色可分配状态 // 改变用户分配的角色可分配状态
granted.ForEach(u => u.Disabled = !available.Any(e => e.Id == u.Id)); grantedRoles.ForEach(u => u.Disabled = !availableRoles.Any(u => u.Id == u.Id));
// 排除已分配的角色 // 排除已分配的角色
available = available.ExceptBy(granted.Select(e => e.Id), e => e.Id).ToList(); availableRoles = availableRoles.ExceptBy(grantedRoles.Select(u => u.Id), u => u.Id).ToList();
return new GrantRoleOutput { Granted = granted, Available = available }; return new GrantRoleOutput { GrantedRoles = grantedRoles, AvailableRoles = availableRoles };
} }
/// <summary> /// <summary>

View File

@ -70,7 +70,7 @@
"vue-router": "^4.4.5", "vue-router": "^4.4.5",
"vue-signature-pad": "^3.0.2", "vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.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": "^4.7.59",
"vxe-table-plugin-element": "^4.0.4", "vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.6", "vxe-table-plugin-export-xlsx": "^4.0.6",

View File

@ -18,6 +18,7 @@ import { Configuration } from '../configuration';
// @ts-ignore // @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import { AdminResultBoolean } from '../models'; import { AdminResultBoolean } from '../models';
import { AliyunSendSmsTemplateInput } from '../models';
import { SmsVerifyCodeInput } from '../models'; import { SmsVerifyCodeInput } from '../models';
/** /**
* SysSmsApi - axios parameter creator * SysSmsApi - axios parameter creator
@ -77,22 +78,12 @@ export const SysSmsApiAxiosParamCreator = function (configuration?: Configuratio
/** /**
* *
* @summary * @summary
* @param {any} body * @param {AliyunSendSmsTemplateInput} [body]
* @param {string} phoneNumber
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
apiSysSmsAliyunSendSmsTemplatePhoneNumberPost: async (body: any, phoneNumber: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => { apiSysSmsAliyunSendSmsTemplatePost: async (body?: AliyunSendSmsTemplateInput, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'body' is not null or undefined const localVarPath = `/api/sysSms/aliyunSendSmsTemplate`;
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)));
// use dummy base URL string because the URL constructor only accepts absolute URLs. // use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com'); const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions; let baseOptions;
@ -304,13 +295,12 @@ export const SysSmsApiFp = function(configuration?: Configuration) {
/** /**
* *
* @summary * @summary
* @param {any} body * @param {AliyunSendSmsTemplateInput} [body]
* @param {string} phoneNumber
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body: any, phoneNumber: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> { async apiSysSmsAliyunSendSmsTemplatePost(body?: AliyunSendSmsTemplateInput, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise<AxiosResponse<void>>> {
const localVarAxiosArgs = await SysSmsApiAxiosParamCreator(configuration).apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body, phoneNumber, options); const localVarAxiosArgs = await SysSmsApiAxiosParamCreator(configuration).apiSysSmsAliyunSendSmsTemplatePost(body, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs); return axios.request(axiosRequestArgs);
@ -380,13 +370,12 @@ export const SysSmsApiFactory = function (configuration?: Configuration, basePat
/** /**
* *
* @summary * @summary
* @param {any} body * @param {AliyunSendSmsTemplateInput} [body]
* @param {string} phoneNumber
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
*/ */
async apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body: any, phoneNumber: string, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> { async apiSysSmsAliyunSendSmsTemplatePost(body?: AliyunSendSmsTemplateInput, options?: AxiosRequestConfig): Promise<AxiosResponse<void>> {
return SysSmsApiFp(configuration).apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body, phoneNumber, options).then((request) => request(axios, basePath)); return SysSmsApiFp(configuration).apiSysSmsAliyunSendSmsTemplatePost(body, options).then((request) => request(axios, basePath));
}, },
/** /**
* *
@ -442,14 +431,13 @@ export class SysSmsApi extends BaseAPI {
/** /**
* *
* @summary * @summary
* @param {any} body * @param {AliyunSendSmsTemplateInput} [body]
* @param {string} phoneNumber
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @throws {RequiredError}
* @memberof SysSmsApi * @memberof SysSmsApi
*/ */
public async apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body: any, phoneNumber: string, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> { public async apiSysSmsAliyunSendSmsTemplatePost(body?: AliyunSendSmsTemplateInput, options?: AxiosRequestConfig) : Promise<AxiosResponse<void>> {
return SysSmsApiFp(this.configuration).apiSysSmsAliyunSendSmsTemplatePhoneNumberPost(body, phoneNumber, options).then((request) => request(this.axios, this.basePath)); return SysSmsApiFp(this.configuration).apiSysSmsAliyunSendSmsTemplatePost(body, options).then((request) => request(this.axios, this.basePath));
} }
/** /**
* *

View File

@ -18,9 +18,9 @@ import { Configuration } from '../configuration';
// @ts-ignore // @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
import { AddUserInput } from '../models'; import { AddUserInput } from '../models';
import { AdminResultGrantRoleOutput } from '../models';
import { AdminResultInt32 } from '../models'; import { AdminResultInt32 } from '../models';
import { AdminResultInt64 } from '../models'; import { AdminResultInt64 } from '../models';
import { AdminResultListInt64 } from '../models';
import { AdminResultListSysUserExtOrg } from '../models'; import { AdminResultListSysUserExtOrg } from '../models';
import { AdminResultSqlSugarPagedListUserOutput } from '../models'; import { AdminResultSqlSugarPagedListUserOutput } from '../models';
import { AdminResultString } from '../models'; import { AdminResultString } from '../models';
@ -774,7 +774,7 @@ export const SysUserApiFp = function(configuration?: Configuration) {
* @param {*} [options] Override http request option. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @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); const localVarAxiosArgs = await SysUserApiAxiosParamCreator(configuration).apiSysUserOwnRoleListUserIdGet(userId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; 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. * @param {*} [options] Override http request option.
* @throws {RequiredError} * @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)); return SysUserApiFp(configuration).apiSysUserOwnRoleListUserIdGet(userId, options).then((request) => request(axios, basePath));
}, },
/** /**
@ -1083,7 +1083,7 @@ export class SysUserApi extends BaseAPI {
* @throws {RequiredError} * @throws {RequiredError}
* @memberof SysUserApi * @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)); return SysUserApiFp(this.configuration).apiSysUserOwnRoleListUserIdGet(userId, options).then((request) => request(this.axios, this.basePath));
} }
/** /**

View File

@ -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;
/**
* successwarningerror
*
* @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;
}

View File

@ -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;
}

View 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;
}

View File

@ -28,6 +28,7 @@ export * from './admin-result-data-table';
export * from './admin-result-dictionary-string-string'; export * from './admin-result-dictionary-string-string';
export * from './admin-result-generate-qrimage-output'; export * from './admin-result-generate-qrimage-output';
export * from './admin-result-get-refund-domestic-refund-by-out-refund-number-response'; 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-iaction-result';
export * from './admin-result-idisposable'; export * from './admin-result-idisposable';
export * from './admin-result-int32'; 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-wechat-pay-output';
export * from './admin-result-wx-open-id-output'; export * from './admin-result-wx-open-id-output';
export * from './admin-result-wx-phone-output'; export * from './admin-result-wx-phone-output';
export * from './aliyun-send-sms-template-input';
export * from './amount'; export * from './amount';
export * from './api-output'; export * from './api-output';
export * from './assembly'; export * from './assembly';
@ -213,6 +215,7 @@ export * from './generate-signature-input';
export * from './generic-parameter-attributes'; export * from './generic-parameter-attributes';
export * from './get-refund-domestic-refund-by-out-refund-number-response'; export * from './get-refund-domestic-refund-by-out-refund-number-response';
export * from './goods-detail'; export * from './goods-detail';
export * from './grant-role-output';
export * from './http-method-enum'; export * from './http-method-enum';
export * from './iaction-result'; export * from './iaction-result';
export * from './icomponent'; export * from './icomponent';

View File

@ -43,4 +43,12 @@ export interface RoleOutput {
* @memberof RoleOutput * @memberof RoleOutput
*/ */
code?: string | null; code?: string | null;
/**
*
*
* @type {boolean}
* @memberof RoleOutput
*/
disabled?: boolean;
} }

View File

@ -25,7 +25,6 @@ export interface SmsVerifyCodeInput {
* *
* @type {string} * @type {string}
* @memberof SmsVerifyCodeInput * @memberof SmsVerifyCodeInput
* @example admin
*/ */
phone: string; phone: string;
@ -34,7 +33,6 @@ export interface SmsVerifyCodeInput {
* *
* @type {string} * @type {string}
* @memberof SmsVerifyCodeInput * @memberof SmsVerifyCodeInput
* @example 123456
*/ */
code: string; code: string;
} }

View File

@ -7,14 +7,14 @@
<span>{{ state.leftChecked.length }}/{{ props.leftData.length }}</span> <span>{{ state.leftChecked.length }}/{{ props.leftData.length }}</span>
</p> </p>
<div class="transfer-panel__body"> <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-group v-show="true" v-model="state.leftChecked" :validate-event="false" class="transfer-panel__list">
<el-checkbox <el-checkbox
v-for="(i, k) in leftFilterData" v-for="(item, index) in leftFilterData"
:key="k" :key="index"
:value="i[props.options.value]" :value="item[props.options.value]"
:label="i[props.options.label]" :label="item[props.options.label]"
:disabled="i[props.options.disabled]" :disabled="item[props.options.disabled]"
:validate-event="false" :validate-event="false"
class="transfer-panel__item" class="transfer-panel__item"
> >
@ -25,16 +25,16 @@
</el-col> </el-col>
<el-col :span="4" class="transfer-buttons"> <el-col :span="4" class="transfer-buttons">
<div class="transfer-buttons__item"> <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>
<div class="transfer-buttons__item"> <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>
<div class="transfer-buttons__item"> <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>
<div class="transfer-buttons__item"> <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> </div>
</el-col> </el-col>
<el-col :span="10"> <el-col :span="10">
@ -44,14 +44,14 @@
<span>{{ state.rightChecked.length }}/{{ props.rightData.length }}</span> <span>{{ state.rightChecked.length }}/{{ props.rightData.length }}</span>
</p> </p>
<div class="transfer-panel__body"> <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-group v-show="true" v-model="state.rightChecked" :validate-event="false" class="transfer-panel__list">
<el-checkbox <el-checkbox
v-for="(i, k) in rightFilterData" v-for="(item, index) in rightFilterData"
:key="k" :key="index"
:value="i[props.options.value]" :value="item[props.options.value]"
:label="i[props.options.label]" :label="item[props.options.label]"
:disabled="i[props.options.disabled]" :disabled="item[props.options.disabled]"
:validate-event="false" :validate-event="false"
class="transfer-panel__item" class="transfer-panel__item"
> >
@ -77,27 +77,27 @@ const props = defineProps({
disabled: 'disabled', disabled: 'disabled',
}), }),
}, },
leftData: { type: Array, default: () => [] }, // leftData: { type: Array, default: () => [] }, //
rightData: { type: Array, default: () => [] }, // rightData: { type: Array, default: () => [] }, //
}); });
const emits = defineEmits(['left', 'right', 'allLeft', 'allRight', 'update:leftData', 'update:rightData']); const emits = defineEmits(['left', 'right', 'allLeft', 'allRight', 'update:leftData', 'update:rightData']);
const state = reactive({ const state = reactive({
leftAllChecked: false, // leftAllChecked: false, //
leftKeyword: '', // leftKeyword: '', //
leftChecked: [], // leftChecked: [] as any, //
rightAllChecked: false, // rightAllChecked: false, //
rightKeyword: '', // rightKeyword: '', //
rightChecked: [], // rightChecked: [] as any, //
}); });
// //
const leftFilterData = computed(() => { const leftFilterData: any = computed(() => {
let result = props.leftData.filter((e) => e[props.options.label].toLowerCase().includes(state.leftKeyword.toLowerCase())); let result = props.leftData.filter((e: any) => e[props.options.label].toLowerCase().includes(state.leftKeyword.toLowerCase()));
if (state.leftChecked.length > 0) { if (state.leftChecked.length > 0) {
for (let i = state.leftChecked.length - 1; i >= 0; i--) { 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 // eslint-disable-next-line vue/no-side-effects-in-computed-properties
if (index == -1) state.leftChecked.splice(i, 1); if (index == -1) state.leftChecked.splice(i, 1);
} }
@ -107,29 +107,29 @@ const leftFilterData = computed(() => {
// //
const handleLeftAllChecked = (value: any) => { 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 leftIndeterminate = computed(() => {
const checkedLength = state.leftChecked.length; 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; return result;
}); });
watch( watch(
() => state.leftChecked, () => state.leftChecked,
(val: any[]) => { (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(() => { const rightFilterData: any = computed(() => {
let result = props.rightData.filter((e) => e[props.options.label].toLowerCase().includes(state.rightKeyword.toLowerCase())); let result = props.rightData.filter((e: any) => e[props.options.label].toLowerCase().includes(state.rightKeyword.toLowerCase()));
if (state.rightChecked.length > 0) { if (state.rightChecked.length > 0) {
for (let i = state.rightChecked.length - 1; i >= 0; i--) { 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 // eslint-disable-next-line vue/no-side-effects-in-computed-properties
if (index == -1) state.rightChecked.splice(i, 1); if (index == -1) state.rightChecked.splice(i, 1);
} }
@ -139,20 +139,20 @@ const rightFilterData = computed(() => {
// //
const handleRightAllChecked = (value: any) => { 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 rightIndeterminate = computed(() => {
const checkedLength = state.rightChecked.length; 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; return result;
}); });
watch( watch(
() => state.rightChecked, () => state.rightChecked,
(val: any[]) => { (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 = () => { const toRight = () => {
if (state.leftChecked?.length > 0) { 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:leftData', cuts);
emits('update:rightData', props.rightData.concat(adds)); emits('update:rightData', props.rightData.concat(adds));
emits('right'); emits('right');
@ -173,11 +173,11 @@ const toRight = () => {
// //
const allToRight = () => { const allToRight = () => {
if (leftFilterData.value?.length > 0) { 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:leftData', cuts);
emits('update:rightData', props.rightData.concat(adds)); emits('update:rightData', props.rightData.concat(adds));
emits('allRight'); emits('allRight');
@ -189,9 +189,9 @@ const allToRight = () => {
const toLeft = () => { const toLeft = () => {
if (state.rightChecked?.length > 0) { 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:leftData', props.leftData.concat(adds));
emits('update:rightData', cuts); emits('update:rightData', cuts);
emits('left'); emits('left');
@ -202,11 +202,11 @@ const toLeft = () => {
// //
const allToLeft = () => { const allToLeft = () => {
if (rightFilterData.value?.length > 0) { 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:leftData', props.leftData.concat(adds));
emits('update:rightData', cuts); emits('update:rightData', cuts);
emits('allLeft'); emits('allLeft');
@ -237,13 +237,14 @@ const allToLeft = () => {
border-bottom: 1px solid #ebeef5; border-bottom: 1px solid #ebeef5;
} }
&__body { &__body {
height: 300px; height: 400px;
.transfer-panel__filter { .transfer-panel__filter {
padding: 6px; padding: 6px;
} }
.transfer-panel__list { .transfer-panel__list {
overflow: auto; overflow: auto;
height: calc(100% - 36px); height: calc(100% - 36px);
padding-top: 10px;
.transfer-panel__item { .transfer-panel__item {
display: block !important; display: block !important;
padding-left: 6px; padding-left: 6px;
@ -256,6 +257,7 @@ const allToLeft = () => {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
text-align: center;
&__item { &__item {
padding-top: 10px; padding-top: 10px;
width: 100%; width: 100%;

View File

@ -45,6 +45,11 @@
<el-input v-model="state.ruleForm.email" placeholder="邮箱" clearable /> <el-input v-model="state.ruleForm.email" placeholder="邮箱" clearable />
</el-form-item> </el-form-item>
</el-col> </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-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb5">
<el-form-item label="排序"> <el-form-item label="排序">
<el-input-number v-model="state.ruleForm.orderNo" placeholder="排序" class="w100" /> <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-input v-model="state.ruleForm.domainAccount" placeholder="域账号" clearable />
</el-form-item> </el-form-item>
</el-col> </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"> <el-divider border-style="dashed" content-position="center">
<div style="color: #b1b3b8">附属机构</div> <div style="color: #b1b3b8">附属机构</div>
</el-divider> </el-divider>
@ -124,7 +124,7 @@
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="角色授权" style="height: 550px; overflow-y: auto; overflow-x: hidden"> <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>
<el-tab-pane label="档案信息" style="height: 550px; overflow-y: auto; overflow-x: hidden"> <el-tab-pane label="档案信息" style="height: 550px; overflow-y: auto; overflow-x: hidden">
<el-form :model="state.ruleForm" label-width="auto"> <el-form :model="state.ruleForm" label-width="auto">
@ -244,14 +244,14 @@
<script lang="ts" setup name="sysEditUser"> <script lang="ts" setup name="sysEditUser">
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import { ElMessage } from 'element-plus';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { useUserInfo } from '/@/stores/userInfo'; import { useUserInfo } from '/@/stores/userInfo';
import Transfer from '/@/components/transfer/index.vue';
import { getAPI } from '/@/utils/axios-utils'; import { getAPI } from '/@/utils/axios-utils';
import { SysPosApi, SysRoleApi, SysUserApi } from '/@/api-services/api'; import { SysPosApi, SysRoleApi, SysUserApi } from '/@/api-services/api';
import { SysOrg, PagePosOutput, UpdateUserInput } from '/@/api-services/models'; import { SysOrg, PagePosOutput, UpdateUserInput } from '/@/api-services/models';
import Transfer from '/@/components/transfer/index.vue';
import { ElMessage } from 'element-plus';
const props = defineProps({ const props = defineProps({
title: String, title: String,
@ -267,8 +267,8 @@ const state = reactive({
selectedTabName: '0', // tab selectedTabName: '0', // tab
ruleForm: {} as UpdateUserInput, ruleForm: {} as UpdateUserInput,
posData: [] as Array<PagePosOutput>, // posData: [] as Array<PagePosOutput>, //
available: [], // availableRoles: [] as any, //
granted: [], // grantedRoles: [] as any, //
}); });
// //
const cascaderProps = { checkStrictly: true, emitPath: false, value: 'id', label: 'name', expandTrigger: 'hover' }; 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)); state.ruleForm = JSON.parse(JSON.stringify(row));
if (row.id != undefined) { if (row.id != undefined) {
const { data } = await getAPI(SysUserApi).apiSysUserOwnRoleListUserIdGet(row.id); const { data } = await getAPI(SysUserApi).apiSysUserOwnRoleListUserIdGet(row.id);
state.available = data.result?.available; state.availableRoles = data.result?.availableRoles;
state.granted = data.result?.granted; state.grantedRoles = data.result?.grantedRoles;
var resExtOrg = await getAPI(SysUserApi).apiSysUserOwnExtOrgListUserIdGet(row.id); var resExtOrg = await getAPI(SysUserApi).apiSysUserOwnExtOrgListUserIdGet(row.id);
state.ruleForm.extOrgIdList = resExtOrg.data.result; state.ruleForm.extOrgIdList = resExtOrg.data.result;
} else { } else {
state.ruleForm.accountType = 777; // state.ruleForm.accountType = 777; //
const { data } = await getAPI(SysRoleApi).apiSysRoleListGet(); const { data } = await getAPI(SysRoleApi).apiSysRoleListGet();
state.available = data.result ?? []; state.availableRoles = data.result ?? [];
state.granted = []; state.grantedRoles = [];
} }
state.isShowDialog = true; state.isShowDialog = true;
}; };
@ -317,9 +317,9 @@ const cancel = () => {
const submit = () => { const submit = () => {
ruleFormRef.value.validate(async (valid: boolean) => { ruleFormRef.value.validate(async (valid: boolean) => {
if (!valid) return; 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 { else {
ElMessage.error(`角色尚未分配`); ElMessage.error(`请分配角色`);
return; return;
} }
if (state.ruleForm.id != undefined && state.ruleForm.id > 0) { if (state.ruleForm.id != undefined && state.ruleForm.id > 0) {