新增软件管理权限,包括申请,管理,删除,添加使用时间等
This commit is contained in:
@@ -65,7 +65,6 @@ export class TokenStorage {
|
||||
const request = objectStore.put({ id: 'token', value: token });
|
||||
|
||||
transaction.oncomplete = () => {
|
||||
console.log('Token saved');
|
||||
resolve();
|
||||
};
|
||||
|
||||
@@ -86,7 +85,6 @@ export class TokenStorage {
|
||||
request.onsuccess = (event) => {
|
||||
const result = (event.target as IDBRequest).result;
|
||||
if (result) {
|
||||
console.log('Token:', result.value);
|
||||
let claims: any = null;
|
||||
if (result.value) {
|
||||
const decodedToken = jwtDecode(result.value);
|
||||
@@ -100,7 +98,6 @@ export class TokenStorage {
|
||||
}
|
||||
resolve(claims);
|
||||
} else {
|
||||
console.log('Token not found');
|
||||
resolve(null);
|
||||
}
|
||||
};
|
||||
@@ -122,10 +119,8 @@ export class TokenStorage {
|
||||
request.onsuccess = (event) => {
|
||||
const result = (event.target as IDBRequest).result;
|
||||
if (result) {
|
||||
console.log('Token:', result.value);
|
||||
resolve(result.value);
|
||||
} else {
|
||||
console.log('Token not found');
|
||||
reject(new Error("Token not found"));
|
||||
}
|
||||
};
|
||||
@@ -145,7 +140,6 @@ export class TokenStorage {
|
||||
const request = objectStore.delete('token');
|
||||
|
||||
transaction.oncomplete = () => {
|
||||
console.log('Token deleted');
|
||||
resolve();
|
||||
};
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ async function QueryMachineList(tableParams: TableModel.TableParams, userParams:
|
||||
let res = await request<ApiResponse.SuccessItem<MachineModel.QueryMachineData>>(`/lms/Machine/QueryMachineCollection?${query}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
console.log(QueryMachineList, res)
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -59,7 +58,6 @@ async function GetMachineInfo(id: string): Promise<MachineModel.MachineInfo> {
|
||||
let res = await request<ApiResponse.SuccessItem<MachineModel.MachineInfo>>(`/lms/Machine/GetMachineDetail/${id}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
console.log("GetMachineInfo", res)
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -77,7 +75,6 @@ async function ModifyMachineData(id: string, params: MachineModel.ModifyMachineP
|
||||
...params,
|
||||
deactivationTime: deactivationTimeString
|
||||
}
|
||||
console.log("ModifyMachineData", params)
|
||||
let res = await request<ApiResponse.SuccessItem<null>>(`/lms/Machine/ModifyMachine/${id}`, {
|
||||
method: 'POST',
|
||||
data: data
|
||||
|
||||
@@ -99,7 +99,6 @@ export async function GetOptions(optionsKey: string): Promise<OptionModel.Option
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
});
|
||||
console.log("GetTTSOptions", res)
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -120,7 +119,6 @@ export async function SaveOptions(options: object): Promise<void> {
|
||||
data.push({ key: key, value: value.toString() });
|
||||
return "";
|
||||
}, {});
|
||||
console.log("SaveOptionsDataParams", data)
|
||||
|
||||
let res = await request<ApiResponse.SuccessItem<boolean>>('/lms/LaitoolOptions/ModifyOptions', {
|
||||
method: 'POST',
|
||||
|
||||
@@ -31,7 +31,6 @@ export async function GetPromptInfo(id: string): Promise<Prompt.PromptItem> {
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
console.log("GetPromptInfo", res.data);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
@@ -42,7 +41,6 @@ export async function GetPromptInfo(id: string): Promise<Prompt.PromptItem> {
|
||||
* @returns
|
||||
*/
|
||||
export async function AddPrompt(data: Prompt.PromptItem): Promise<string> {
|
||||
console.log("AddPrompt", data)
|
||||
let res = await request('/lms/Prompt/AddPrompt', {
|
||||
method: 'POST',
|
||||
data: {
|
||||
@@ -104,14 +102,12 @@ export async function DeletePrompt(id: string): Promise<void> {
|
||||
*/
|
||||
export async function QueryPromptypeCollection(param: Prompt.PromptTypeQueryCondition): Promise<Prompt.PromptTypeResponse> {
|
||||
let query = objectToQueryString(param)
|
||||
console.log("query", query)
|
||||
let res = await request<ApiResponse.SuccessItem<Prompt.PromptTypeResponse>>(`/lms/Prompt/QueryPromptypeCollection/?${query}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
console.log("QueryPromptypeCollection", res.data);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ export async function QueryRoleList(tableParams: TableModel.TableParams, rolePar
|
||||
let res = await request<ApiResponse.SuccessItem<RoleModel.QueryRoleData>>(`/lms/Role/QueryRoleCollection?${query}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
console.log("QueryRoleList", res);
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -35,7 +34,6 @@ export async function QueryRoleOption() {
|
||||
let res = await request<ApiResponse.SuccessItem<string[]>>(`/lms/Role/QueryRoleOption`, {
|
||||
method: 'GET',
|
||||
});
|
||||
console.log("QueryRoleOption", res);
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -49,11 +47,9 @@ export async function QueryRoleOption() {
|
||||
* @returns
|
||||
*/
|
||||
export async function GetRoleById(roleId: number): Promise<RoleModel.Collection> {
|
||||
console.log("GetRoleById", roleId);
|
||||
let res = await request<ApiResponse.SuccessItem<RoleModel.Collection>>(`/lms/Role/QueryRoleById/${roleId}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
console.log("GetRoleByIdRes", res);
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -74,7 +70,6 @@ export async function UpdeteRole(roleId: number, roleName: string, roleRemark: s
|
||||
remark: roleRemark
|
||||
}
|
||||
});
|
||||
console.log("UpdeteRole", res);
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -89,7 +84,6 @@ export async function DeleteRoleById(roleId: number): Promise<void> {
|
||||
let res = await request<ApiResponse.SuccessItem<void>>(`/lms/Role/DeleteRole/${roleId}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
console.log("DeleteRole", res);
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
@@ -111,7 +105,6 @@ export async function AddRole(roleNmae: string, roleRemark: string): Promise<voi
|
||||
remark: roleRemark
|
||||
}
|
||||
});
|
||||
console.log("AddRole", res);
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
|
||||
import { request } from '@umijs/max';
|
||||
import { objectToQueryString } from './common';
|
||||
|
||||
/**
|
||||
* 获取用户的软件控制权限数量
|
||||
* @param userId
|
||||
* @returns
|
||||
*/
|
||||
async function GetUserSoftwareControlCount(userId: number) {
|
||||
let res = await request<ApiResponse.SuccessItem<number>>(`/lms/SoftWare/GetUserSoftwareControlCount/${userId}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (res.code == 1) {
|
||||
return res.data;
|
||||
}
|
||||
throw new Error(res.message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请指定的用户的软件控制权限
|
||||
* @param userId
|
||||
* @returns
|
||||
*/
|
||||
async function ApplyUserSoftwareControl(userId: number) {
|
||||
let res = await request<ApiResponse.SuccessItem<boolean>>(`/lms/SoftWare/ApplySoftwareControl/${userId}`, {
|
||||
method: 'POST',
|
||||
});
|
||||
if (res.code == 1) {
|
||||
return res.data;
|
||||
}
|
||||
throw new Error(res.message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定用户的软件控制权限列表
|
||||
* @param tableParams 表数据参数
|
||||
* @param queryParams 查询参数
|
||||
* @returns
|
||||
*/
|
||||
async function GetUserSoftwareControlCollection(tableParams: TableModel.TableParams, queryParams: SoftwareModel.SoftwareControlQueryParams) {
|
||||
let data = {
|
||||
...queryParams,
|
||||
page: tableParams.pagination?.current,
|
||||
pageSize: tableParams.pagination?.pageSize,
|
||||
}
|
||||
let query = objectToQueryString(data)
|
||||
let res = await request<ApiResponse.SuccessItem<SoftwareModel.QuerySoftwareControlData>>(`/lms/SoftWare/GetSoftwareControlCollection?${query}`, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
return res.data;
|
||||
}
|
||||
|
||||
async function AddSoftwareControlExpirationTime(id: string, days: number, isForever: boolean) {
|
||||
let res = await request<ApiResponse.SuccessItem<null>>(`/lms/SoftWare/ModifySoftwareControlValidity/${id}`, {
|
||||
method: 'POST',
|
||||
data: {
|
||||
expirationTime: days,
|
||||
isForever: isForever
|
||||
}
|
||||
});
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
}
|
||||
|
||||
export const SoftwareControl = {
|
||||
GetUserSoftwareControlCount,
|
||||
ApplyUserSoftwareControl,
|
||||
GetUserSoftwareControlCollection,
|
||||
AddSoftwareControlExpirationTime
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取软件初始信息的集合
|
||||
* @returns
|
||||
*/
|
||||
async function GetSoftwareBaseCollection() {
|
||||
let res = await request<ApiResponse.SuccessItem<SoftwareModel.SoftwareBasicInfo[]>>(`/lms/SoftWare/GetSoftwareBaseCollection`, {
|
||||
method: 'GET',
|
||||
});
|
||||
if (res.code == 1) {
|
||||
return res.data;
|
||||
}
|
||||
throw new Error(res.message);
|
||||
}
|
||||
|
||||
export const Software = {
|
||||
GetSoftwareBaseCollection
|
||||
}
|
||||
@@ -74,7 +74,6 @@ async function QueryUserList(tableParams: TableModel.TableParams, userParams: Us
|
||||
if (res.code != 1) {
|
||||
throw new Error(res.message);
|
||||
}
|
||||
console.log("QueryUserList", res);
|
||||
return res.data;
|
||||
|
||||
}
|
||||
|
||||
Vendored
+11
-2
@@ -20,9 +20,9 @@ declare namespace AccessType {
|
||||
|
||||
//#region 软件配置项操作权限
|
||||
/** 是不是可以操作配置型 */
|
||||
canOptions : boolean;
|
||||
canOptions: boolean;
|
||||
/** 是不是可以操作软件配置项 */
|
||||
canLaitoolOptions : boolean;
|
||||
canLaitoolOptions: boolean;
|
||||
//#endregion
|
||||
|
||||
//#region 机器权限
|
||||
@@ -39,5 +39,14 @@ declare namespace AccessType {
|
||||
/** 是不是有停用机器码的权限 */
|
||||
canDisableMachine: boolean;
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region 软件控制权限
|
||||
|
||||
/** 是否可以同步用户软件控制权限 */
|
||||
canApplySoftwareControl: boolean;
|
||||
/** 是否可以查看软件控制管理 */
|
||||
canSofrwareControlManagement: boolean;
|
||||
//#endregion
|
||||
}
|
||||
}
|
||||
Vendored
+47
@@ -0,0 +1,47 @@
|
||||
declare namespace SoftwareModel {
|
||||
|
||||
interface SoftwareBasicInfo {
|
||||
id: string;
|
||||
softwareName: string;
|
||||
softwareCode: string;
|
||||
isUse: boolean;
|
||||
}
|
||||
|
||||
interface SoftwareBase {
|
||||
id: string;
|
||||
softwareName: string;
|
||||
softwareCode: string;
|
||||
createdUserId: number;
|
||||
updatedUserId: number;
|
||||
createdTime: Date;
|
||||
updatedTime: Date;
|
||||
remark: string;
|
||||
isUse: boolean;
|
||||
}
|
||||
|
||||
interface SoftwareControlBase {
|
||||
id: string;
|
||||
user: UserModel.UserBasic;
|
||||
software: SoftwareBase;
|
||||
createdUser: UserModel.UserBasic;
|
||||
createdTime: Date;
|
||||
updatedUser: UserModel.UserBasic;
|
||||
updatedTime: Date;
|
||||
remark: string;
|
||||
expirationTime: string;
|
||||
isForever: boolean;
|
||||
}
|
||||
|
||||
type SoftwareControlQueryParams = {
|
||||
userId?: number;
|
||||
softwareId?: string;
|
||||
isForever?: boolean;
|
||||
remark?: string
|
||||
};
|
||||
|
||||
type QuerySoftwareControlData = {
|
||||
collection: SoftwareControlBase[];
|
||||
current: number;
|
||||
total: number;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user