😎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="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" />

View File

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

View File

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

View File

@ -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",

View File

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

View File

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

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-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';

View File

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

View File

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

View File

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

View File

@ -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) {