This commit is contained in:
六如
2024-10-19 20:27:16 +08:00
parent 17bc2d5ca8
commit 0cbadbeda8
25 changed files with 487 additions and 118 deletions

View File

@@ -9,6 +9,7 @@ import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam; import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
import com.gitee.sop.adminbackend.common.resp.Result; import com.gitee.sop.adminbackend.common.resp.Result;
import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoAddParam; import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoAddParam;
import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoUpdateKeysParam;
import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoUpdateParam; import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoUpdateParam;
import com.gitee.sop.adminbackend.controller.isv.req.IsvKeysGenParam; import com.gitee.sop.adminbackend.controller.isv.req.IsvKeysGenParam;
import com.gitee.sop.adminbackend.dao.entity.IsvInfo; import com.gitee.sop.adminbackend.dao.entity.IsvInfo;
@@ -16,6 +17,7 @@ import com.gitee.sop.adminbackend.service.isv.IsvInfoService;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoAddDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoAddDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateKeysDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysDTO;
import com.gitee.sop.adminbackend.util.CopyUtil; import com.gitee.sop.adminbackend.util.CopyUtil;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -104,6 +106,18 @@ public class IsvInfoController {
return Result.ok(isvInfoService.update(isvInfoUpdateDTO)); return Result.ok(isvInfoService.update(isvInfoUpdateDTO));
} }
/**
* 修改秘钥
*
* @param param 表单数据
* @return 返回影响行数
*/
@PostMapping("/updateKeys")
public Result<Integer> updateKeys(@Validated @RequestBody IsvInfoUpdateKeysParam param) {
IsvInfoUpdateKeysDTO isvInfoUpdateKeysDTO = CopyUtil.copyBean(param, IsvInfoUpdateKeysDTO::new);
return Result.ok(isvInfoService.updateKeys(isvInfoUpdateKeysDTO));
}
/** /**
* 修改状态 * 修改状态
* *

View File

@@ -0,0 +1,47 @@
package com.gitee.sop.adminbackend.controller.isv.req;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author 六如
*/
@Data
public class IsvInfoUpdateKeysParam {
@NotNull
private Long isvId;
/**
* 秘钥格式1PKCS8(JAVA适用)2PKCS1(非JAVA适用)
*/
@NotNull
private Integer keyFormat;
/**
* 开发者生成的公钥, 数据库字段public_key_isv
*/
@NotBlank
private String publicKeyIsv;
/**
* 开发者生成的私钥(交给开发者), 数据库字段private_key_isv
*/
@NotBlank
private String privateKeyIsv;
/**
* 平台生成的公钥(交给开发者), 数据库字段public_key_platform
*/
@NotBlank
private String publicKeyPlatform;
/**
* 平台生成的私钥, 数据库字段private_key_platform
*/
@NotBlank
private String privateKeyPlatform;
}

View File

@@ -3,7 +3,6 @@ package com.gitee.sop.adminbackend.controller.serve;
import com.gitee.fastmybatis.core.PageInfo; import com.gitee.fastmybatis.core.PageInfo;
import com.gitee.fastmybatis.core.query.Query; import com.gitee.fastmybatis.core.query.Query;
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO; import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
import com.gitee.sop.adminbackend.common.req.IdParam;
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam; import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
import com.gitee.sop.adminbackend.common.resp.Result; import com.gitee.sop.adminbackend.common.resp.Result;
import com.gitee.sop.adminbackend.controller.serve.req.ApiInfoParam; import com.gitee.sop.adminbackend.controller.serve.req.ApiInfoParam;

View File

@@ -14,15 +14,11 @@ import com.gitee.sop.adminbackend.dao.mapper.IsvInfoMapper;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoAddDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoAddDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateKeysDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysDTO;
import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysGenDTO; import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysGenDTO;
import com.gitee.sop.adminbackend.util.CopyUtil; import com.gitee.sop.adminbackend.util.CopyUtil;
import com.gitee.sop.adminbackend.util.IdGen; import com.gitee.sop.adminbackend.util.IdGen;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@@ -30,6 +26,11 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/** /**
@@ -44,6 +45,7 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
private PermIsvRoleService permIsvRoleService; private PermIsvRoleService permIsvRoleService;
public PageInfo<IsvInfoDTO> doPage(LambdaQuery<IsvInfo> query) { public PageInfo<IsvInfoDTO> doPage(LambdaQuery<IsvInfo> query) {
query.orderByDesc(IsvInfo::getId);
PageInfo<IsvInfo> page = this.page(query); PageInfo<IsvInfo> page = this.page(query);
List<IsvInfo> list = page.getList(); List<IsvInfo> list = page.getList();
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
@@ -106,6 +108,10 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
.update(); .update();
} }
public int updateKeys(IsvInfoUpdateKeysDTO isvInfoUpdateKeysDTO) {
return isvKeysService.saveKeys(isvInfoUpdateKeysDTO);
}
private void saveIsvRole(IsvInfo isvInfo, List<String> roleCodeList) { private void saveIsvRole(IsvInfo isvInfo, List<String> roleCodeList) {
Long isvId = isvInfo.getId(); Long isvId = isvInfo.getId();
@@ -145,6 +151,16 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
public IsvKeysDTO getKeys(Long isvId) { public IsvKeysDTO getKeys(Long isvId) {
IsvKeys isvKeys = isvKeysService.get(IsvKeys::getIsvId, isvId); IsvKeys isvKeys = isvKeysService.get(IsvKeys::getIsvId, isvId);
if (isvKeys == null) {
IsvKeysDTO isvKeysDTO = new IsvKeysDTO();
isvKeysDTO.setIsvId(isvId);
isvKeysDTO.setKeyFormat(RSATool.KeyFormat.PKCS8.getValue());
isvKeysDTO.setPublicKeyIsv("");
isvKeysDTO.setPrivateKeyIsv("");
isvKeysDTO.setPublicKeyPlatform("");
isvKeysDTO.setPrivateKeyPlatform("");
return isvKeysDTO;
}
return CopyUtil.copyBean(isvKeys, IsvKeysDTO::new); return CopyUtil.copyBean(isvKeys, IsvKeysDTO::new);
} }

View File

@@ -3,6 +3,8 @@ package com.gitee.sop.adminbackend.service.isv;
import com.gitee.fastmybatis.core.support.LambdaService; import com.gitee.fastmybatis.core.support.LambdaService;
import com.gitee.sop.adminbackend.dao.entity.IsvKeys; import com.gitee.sop.adminbackend.dao.entity.IsvKeys;
import com.gitee.sop.adminbackend.dao.mapper.IsvKeysMapper; import com.gitee.sop.adminbackend.dao.mapper.IsvKeysMapper;
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateKeysDTO;
import com.gitee.sop.adminbackend.util.CopyUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -12,4 +14,13 @@ import org.springframework.stereotype.Service;
@Service @Service
public class IsvKeysService implements LambdaService<IsvKeys, IsvKeysMapper> { public class IsvKeysService implements LambdaService<IsvKeys, IsvKeysMapper> {
public int saveKeys(IsvInfoUpdateKeysDTO isvInfoUpdateKeysDTO) {
IsvKeys isvKeys = this.get(IsvKeys::getIsvId, isvInfoUpdateKeysDTO.getIsvId());
if (isvKeys == null) {
isvKeys = new IsvKeys();
}
CopyUtil.copyPropertiesIgnoreNull(isvInfoUpdateKeysDTO, isvKeys);
return this.saveOrUpdate(isvKeys);
}
} }

View File

@@ -10,4 +10,5 @@ import lombok.EqualsAndHashCode;
@Data @Data
public class IsvInfoUpdateDTO extends IsvInfoAddDTO { public class IsvInfoUpdateDTO extends IsvInfoAddDTO {
private Long id; private Long id;
} }

View File

@@ -0,0 +1,38 @@
package com.gitee.sop.adminbackend.service.isv.dto;
import lombok.Data;
/**
* @author 六如
*/
@Data
public class IsvInfoUpdateKeysDTO {
private Long isvId;
/**
* 秘钥格式1PKCS8(JAVA适用)2PKCS1(非JAVA适用)
*/
private Integer keyFormat;
/**
* 开发者生成的公钥, 数据库字段public_key_isv
*/
private String publicKeyIsv;
/**
* 开发者生成的私钥(交给开发者), 数据库字段private_key_isv
*/
private String privateKeyIsv;
/**
* 平台生成的公钥(交给开发者), 数据库字段public_key_platform
*/
private String publicKeyPlatform;
/**
* 平台生成的私钥, 数据库字段private_key_platform
*/
private String privateKeyPlatform;
}

View File

@@ -8,6 +8,13 @@ import lombok.Data;
@Data @Data
public class IsvKeysDTO { public class IsvKeysDTO {
private Long isvId;
/**
* 秘钥格式1PKCS8(JAVA适用)2PKCS1(非JAVA适用)
*/
private Integer keyFormat;
/** /**
* 开发者生成的公钥, 数据库字段public_key_isv * 开发者生成的公钥, 数据库字段public_key_isv
*/ */

View File

@@ -1,51 +1,35 @@
<h1>vue-pure-admin精简版国际化版本</h1> # SOP Admin 前端实现
[![license](https://img.shields.io/github/license/pure-admin/vue-pure-admin.svg)](LICENSE) ## 参考文档
**中文** | [English](./README.en-US.md) - 模板:https://pure-admin.github.io/pure-admin-doc/
- 表单表格组件:https://plus-pro-components.com/
## 介绍 ## 开发部署
精简版是基于 [vue-pure-admin](https://github.com/pure-admin/vue-pure-admin) 提炼出的架子,包含主体功能,更适合实际项目开发,打包后的大小在全局引入 [element-plus](https://element-plus.org) 的情况下仍然低于 `2.3MB`,并且会永久同步完整版的代码。开启 `brotli` 压缩和 `cdn` 替换本地库模式后,打包大小低于 `350kb` > 规定 node 版本应不小于 18.18.0
## 版本选择 - macOS用户在命令前面添加`sudo`
当前是国际化版本,如果您需要非国际化版本 [请点击](https://github.com/pure-admin/pure-admin-thin) ```shell
# 安装pnpm
npm install -g pnpm
## `js` 版本 # 安装依赖
pnpm install
[点我查看 js 版本](https://pure-admin.github.io/pure-admin-doc/pages/js/) # 启动
pnpm dev
```
## `max` 版本 打包:
[点我查看 max 版本](https://github.com/pure-admin/vue-pure-admin-max) `pnpm build`
## 配套视频 安装一个包:
[点我查看 UI 设计](https://www.bilibili.com/video/BV17g411T7rq) `pnpm add 包名`
[点我查看快速开发教程](https://www.bilibili.com/video/BV1kg411v7QT)
## 配套保姆级文档 卸载一个包:
[点我查看 vue-pure-admin 文档](https://pure-admin.github.io/pure-admin-doc) `pnpm remove 包名`
[点我查看 @pureadmin/utils 文档](https://pure-admin-utils.netlify.app)
## 优质服务、软件外包、赞助支持
[点我查看详情](https://pure-admin.github.io/pure-admin-doc/pages/service/)
## 预览
[查看预览](https://pure-admin-thin.netlify.app/#/login)
## 维护者
[xiaoxian521](https://github.com/xiaoxian521)
## ⚠️ 注意
精简版不接受任何 `issues``pr`,如果有问题请到完整版 [issues](https://github.com/pure-admin/vue-pure-admin/issues/new/choose) 去提,谢谢!
## 许可证
[MIT © 2020-present, pure-admin](./LICENSE)

View File

@@ -66,7 +66,7 @@
"path": "0.12.7", "path": "0.12.7",
"pinia": "2.2.2", "pinia": "2.2.2",
"pinyin-pro": "3.24.2", "pinyin-pro": "3.24.2",
"plus-pro-components": "0.1.16", "plus-pro-components": "0.1.17",
"qs": "6.13.0", "qs": "6.13.0",
"responsive-storage": "2.2.0", "responsive-storage": "2.2.0",
"sortablejs": "1.15.2", "sortablejs": "1.15.2",

View File

@@ -63,8 +63,8 @@ importers:
specifier: 3.24.2 specifier: 3.24.2
version: 3.24.2 version: 3.24.2
plus-pro-components: plus-pro-components:
specifier: 0.1.16 specifier: 0.1.17
version: 0.1.16(element-plus@2.8.0(vue@3.4.38(typescript@5.5.4)))(vue@3.4.38(typescript@5.5.4)) version: 0.1.17(element-plus@2.8.0(vue@3.4.38(typescript@5.5.4)))(vue@3.4.38(typescript@5.5.4))
qs: qs:
specifier: 6.13.0 specifier: 6.13.0
version: 6.13.0 version: 6.13.0
@@ -2797,8 +2797,8 @@ packages:
pkg-types@1.1.3: pkg-types@1.1.3:
resolution: {integrity: sha512-+JrgthZG6m3ckicaOB74TwQ+tBWsFl3qVQg7mN8ulwSOElJ7gBhKzj2VkCPnZ4NlF6kEquYU+RIYNVAvzd54UA==} resolution: {integrity: sha512-+JrgthZG6m3ckicaOB74TwQ+tBWsFl3qVQg7mN8ulwSOElJ7gBhKzj2VkCPnZ4NlF6kEquYU+RIYNVAvzd54UA==}
plus-pro-components@0.1.16: plus-pro-components@0.1.17:
resolution: {integrity: sha512-SVjqsnuBjn8wMQihA3ltoKUXx7iX4DtF0KHMYpJLgTNUZDfOzSvQb1vKnubSrFfUpaGFa3c6LSfFpFhzvVfT9Q==} resolution: {integrity: sha512-a4UaLJHAf+e1aph3iAjNceVFoyaPxmrX6gS7mWmTg8rfou3sPX7qL0IARKuj8P8oQih65AJRunIfaT+s9IZLvw==}
peerDependencies: peerDependencies:
element-plus: ^2.3.4 element-plus: ^2.3.4
vue: ^3.2.0 vue: ^3.2.0
@@ -6633,7 +6633,7 @@ snapshots:
mlly: 1.7.1 mlly: 1.7.1
pathe: 1.1.2 pathe: 1.1.2
plus-pro-components@0.1.16(element-plus@2.8.0(vue@3.4.38(typescript@5.5.4)))(vue@3.4.38(typescript@5.5.4)): plus-pro-components@0.1.17(element-plus@2.8.0(vue@3.4.38(typescript@5.5.4)))(vue@3.4.38(typescript@5.5.4)):
dependencies: dependencies:
'@element-plus/icons-vue': 2.3.1(vue@3.4.38(typescript@5.5.4)) '@element-plus/icons-vue': 2.3.1(vue@3.4.38(typescript@5.5.4))
element-plus: 2.8.0(vue@3.4.38(typescript@5.5.4)) element-plus: 2.8.0(vue@3.4.38(typescript@5.5.4))

View File

@@ -8,9 +8,20 @@ const apiUrl: any = createUrl({
update: "/isv/update", update: "/isv/update",
del: "/isv/delete", del: "/isv/delete",
getKeys: "/isv/getKeys", getKeys: "/isv/getKeys",
updateStatus: "/isv/updateStatus" updateStatus: "/isv/updateStatus",
createKeys: "/isv/createKeys",
updateKeys: "/isv/updateKeys"
}); });
/*
private String publicKey;
private String privateKey;
*/
export interface KeyStore {
publicKey: string;
privateKey: string;
}
/** /**
* 接口管理 * 接口管理
*/ */
@@ -27,34 +38,51 @@ export const api: any = {
* @param data 表单内容 * @param data 表单内容
*/ */
add(data: object) { add(data: object) {
return http.post<Result, any>(apiUrl.add, { data }); return http.post<Result<any>, any>(apiUrl.add, { data });
}, },
/** /**
* 修改 * 修改
* @param data 表单内容 * @param data 表单内容
*/ */
update(data: object) { update(data: object) {
return http.post<Result, any>(apiUrl.update, { data }); return http.post<Result<any>, any>(apiUrl.update, { data });
}, },
/** /**
* 删除 * 删除
* @param data 表单内容 * @param data 表单内容
*/ */
del(data: object) { del(data: object) {
return http.post<Result, any>(apiUrl.del, { data }); return http.post<Result<any>, any>(apiUrl.del, { data });
}, },
/** /**
* 查看秘钥 * 查看秘钥
* @param params * @param params
*/ */
viewKeys(params: object) { viewKeys(params: object) {
return http.get<Result, any>(apiUrl.getKeys, { params }); return http.get<Result<any>, any>(apiUrl.getKeys, { params });
}, },
/** /**
* 修改状态 * 修改状态
* @param data 表单内容 * @param data 表单内容
*/ */
updateStatus(data: object) { updateStatus(data: object) {
return http.post<Result, any>(apiUrl.updateStatus, { data }); return http.post<Result<any>, any>(apiUrl.updateStatus, { data });
},
/**
* 创建秘钥
* @param keyFormat 秘钥格式1PKCS8(JAVA适用)2PKCS1(非JAVA适用)
*/
createKeys(keyFormat): Promise<Result<KeyStore>> {
const data = {
keyFormat: keyFormat
};
return http.post<Result<KeyStore>, any>(apiUrl.createKeys, { data });
},
/**
* 修改秘钥
* @param data 表单内容
*/
updateKeys(data: object): Promise<Result<KeyStore>> {
return http.post<Result<any>, any>(apiUrl.updateKeys, { data });
} }
}; };

View File

@@ -26,27 +26,27 @@ export const api: any = {
* @param data 表单内容 * @param data 表单内容
*/ */
add(data: object) { add(data: object) {
return http.post<Result, any>(apiUrl.add, { data }); return http.post<Result<any>, any>(apiUrl.add, { data });
}, },
/** /**
* 修改 * 修改
* @param data 表单内容 * @param data 表单内容
*/ */
update(data: object) { update(data: object) {
return http.post<Result, any>(apiUrl.update, { data }); return http.post<Result<any>, any>(apiUrl.update, { data });
}, },
/** /**
* 删除 * 删除
* @param data 表单内容 * @param data 表单内容
*/ */
del(data: object) { del(data: object) {
return http.post<Result, any>(apiUrl.del, { data }); return http.post<Result<any>, any>(apiUrl.del, { data });
}, },
/** /**
* 修改状态 * 修改状态
* @param data 表单内容 * @param data 表单内容
*/ */
updateStatus(data: object) { updateStatus(data: object) {
return http.post<Result, any>(apiUrl.updateStatus, { data }); return http.post<Result<any>, any>(apiUrl.updateStatus, { data });
} }
}; };

View File

@@ -25,20 +25,20 @@ export const api: any = {
* @param data 表单内容 * @param data 表单内容
*/ */
add(data: object) { add(data: object) {
return http.post<Result, any>(apiUrl.add, { data }); return http.post<Result<any>, any>(apiUrl.add, { data });
}, },
/** /**
* 修改 * 修改
* @param data 表单内容 * @param data 表单内容
*/ */
update(data: object) { update(data: object) {
return http.post<Result, any>(apiUrl.update, { data }); return http.post<Result<any>, any>(apiUrl.update, { data });
}, },
/** /**
* 删除 * 删除
* @param data 表单内容 * @param data 表单内容
*/ */
del(data: object) { del(data: object) {
return http.post<Result, any>(apiUrl.del, { data }); return http.post<Result<any>, any>(apiUrl.del, { data });
} }
}; };

View File

@@ -1,3 +1,8 @@
export enum YesOrNoEnum {
NO = 0,
YES = 1
}
export enum StatusEnum { export enum StatusEnum {
ENABLE = 1, ENABLE = 1,
DISABLE = 2 DISABLE = 2
@@ -7,3 +12,8 @@ export enum KeyFormatEnum {
PKCS8 = 1, PKCS8 = 1,
PKCS1 = 2 PKCS1 = 2
} }
export enum RegSource {
SYS = 1,
CUSTOM = 2
}

View File

@@ -1,6 +1,6 @@
export interface Result { export interface Result<T> {
success: boolean; success: boolean;
data: object; data: T;
msg: ""; msg: "";
code: ""; code: "";
} }

View File

@@ -24,3 +24,14 @@
.html-weakness { .html-weakness {
filter: invert(80%); filter: invert(80%);
} }
.grow {
.el-card {
--el-card-padding: 18px !important;
border: 0 !important;
border-radius: 0;
}
.main-content {
margin: 0 !important;
}
}

View File

@@ -16,6 +16,9 @@ import { useUserStoreHook } from "@/store/modules/user";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
export const baseUrl = (url: string) => { export const baseUrl = (url: string) => {
if (!url) {
throw new Error("url不能为空");
}
if (url.startsWith("/")) { if (url.startsWith("/")) {
url = url.substring(1); url = url.substring(1);
} }

View File

@@ -56,6 +56,7 @@ import {
labelWidth: '100px', labelWidth: '100px',
labelPosition: 'right' labelPosition: 'right'
}" }"
:hasErrorTip="false"
@confirm="handleSave" @confirm="handleSave"
/> />
</el-card> </el-card>

View File

@@ -282,7 +282,7 @@ export const handlePaginationChange = (_pageInfo: PageInfo): void => {
}; };
// 查询 // 查询
const search = async () => { export const search = async () => {
try { try {
const { data } = await doSearch(); const { data } = await doSearch();
tableData.value = data.list; tableData.value = data.list;

View File

@@ -25,8 +25,14 @@ import {
} from "./showKeys"; } from "./showKeys";
import { import {
dlgKeysSetting, dlgKeysSetting,
handleUpdateKeys,
resetIsvKeys,
resetPlatformKeys,
restIsvKeysLoading,
resetPlatformKeysLoading,
settingKeysFormColumns, settingKeysFormColumns,
settingKeysFormData settingKeysFormData,
settingKeysFormRules
} from "@/views/isv/list/isvKeys"; } from "@/views/isv/list/isvKeys";
</script> </script>
<template> <template>
@@ -84,17 +90,9 @@ import {
<PlusDialogForm <PlusDialogForm
v-model:visible="dlgKeysShow" v-model:visible="dlgKeysShow"
v-model="showKeysFormData" v-model="showKeysFormData"
:dialog="{ title: '秘钥' }" :dialog="{ title: '秘钥 - 标识☆分配给开发者' }"
:form="{ group: showKeysFormColumns, labelPosition: 'right' }" :form="{ group: showKeysFormColumns, labelPosition: 'right' }"
> >
<template #plus-field-privateKeyIsv>
<el-input
v-model="showKeysFormData.privateKeyIsv"
readonly
placeholder=""
/>
<el-button style="margin-top: 20px">重置ISV秘钥</el-button>
</template>
<template #dialog-footer="{ handleCancel }"> <template #dialog-footer="{ handleCancel }">
<el-button type="primary" @click="handleCancel">关闭</el-button> <el-button type="primary" @click="handleCancel">关闭</el-button>
</template> </template>
@@ -103,19 +101,32 @@ import {
<PlusDialogForm <PlusDialogForm
v-model:visible="dlgKeysSetting" v-model:visible="dlgKeysSetting"
v-model="settingKeysFormData" v-model="settingKeysFormData"
:dialog="{ title: '秘钥' }" :dialog="{ title: '秘钥 - 标识☆分配给开发者' }"
:form="{ group: settingKeysFormColumns, labelPosition: 'right' }" :form="{
group: settingKeysFormColumns,
rules: settingKeysFormRules,
labelPosition: 'right'
}"
:hasErrorTip="false"
@confirm="handleUpdateKeys"
> >
<template #plus-field-privateKeyIsv> <template #plus-field-restIsvKeys>
<el-input <el-button
v-model="showKeysFormData.privateKeyIsv" type="primary"
readonly :loading="restIsvKeysLoading"
placeholder="" @click="resetIsvKeys"
/> >
<el-button style="margin-top: 20px">重置ISV秘钥</el-button> 重置ISV秘钥
</el-button>
</template> </template>
<template #dialog-footer="{ handleCancel }"> <template #plus-field-restPlatformKeys>
<el-button type="primary" @click="handleCancel">关闭</el-button> <el-button
type="primary"
:loading="resetPlatformKeysLoading"
@click="resetPlatformKeys"
>
重置平台秘钥
</el-button>
</template> </template>
</PlusDialogForm> </PlusDialogForm>
</el-card> </el-card>

View File

@@ -1,21 +1,51 @@
import { ref } from "vue"; import { ref } from "vue";
import type { PlusFormGroupRow } from "plus-pro-components"; import type { PlusFormGroupRow } from "plus-pro-components";
import { CreditCard } from "@element-plus/icons-vue";
import { api } from "@/api/isvList"; import { api } from "@/api/isvList";
import { KeyFormatEnum } from "@/model/enums";
import { ElMessage } from "element-plus";
import { search } from "./index";
// 弹窗显示 // 弹窗显示
export const dlgKeysSetting = ref(false); export const dlgKeysSetting = ref(false);
export const settingKeysFormData = ref<any>({ export const settingKeysFormData = ref<any>({
isvId: 0,
keyFormat: KeyFormatEnum.PKCS8,
publicKeyIsv: "", publicKeyIsv: "",
privateKeyIsv: "", privateKeyIsv: "",
publicKeyPlatform: "", publicKeyPlatform: "",
privateKeyPlatform: "" privateKeyPlatform: ""
}); });
export const settingKeysFormRules = {
publicKeyIsv: [{ required: true, message: "不能为空" }],
privateKeyIsv: [{ required: true, message: "不能为空" }],
publicKeyPlatform: [{ required: true, message: "不能为空" }],
privateKeyPlatform: [{ required: true, message: "不能为空" }]
};
// 表单内容 // 表单内容
export const settingKeysFormColumns: PlusFormGroupRow[] = [ export const settingKeysFormColumns: PlusFormGroupRow[] = [
{ {
title: "ISV公私钥 - 标识☆分配给开发者", title: "基本信息",
icon: CreditCard, columns: [
{
label: "秘钥格式",
prop: "keyFormat",
labelWidth: 100,
valueType: "radio",
options: [
{
label: "PKCS8(Java适用)",
value: KeyFormatEnum.PKCS8
},
{
label: "PKCS1(非Java适用)",
value: KeyFormatEnum.PKCS1
}
]
}
]
},
{
title: "ISV公私钥",
columns: [ columns: [
{ {
label: "ISV公钥", label: "ISV公钥",
@@ -39,12 +69,18 @@ export const settingKeysFormColumns: PlusFormGroupRow[] = [
placeholder: "", placeholder: "",
autosize: { minRows: 2, maxRows: 4 } autosize: { minRows: 2, maxRows: 4 }
} }
},
{
labelWidth: 100,
prop: "restIsvKeys",
renderLabel: () => {
return "";
}
} }
] ]
}, },
{ {
title: "平台公私钥 - 标识☆分配给开发者", title: "平台公私钥",
icon: CreditCard,
columns: [ columns: [
{ {
label: "☆平台公钥", label: "☆平台公钥",
@@ -67,6 +103,13 @@ export const settingKeysFormColumns: PlusFormGroupRow[] = [
placeholder: "", placeholder: "",
autosize: { minRows: 2, maxRows: 4 } autosize: { minRows: 2, maxRows: 4 }
} }
},
{
labelWidth: 100,
prop: "restPlatformKeys",
renderLabel: () => {
return "";
}
} }
] ]
} }
@@ -81,3 +124,36 @@ export const settingKeys = (row: any) => {
dlgKeysSetting.value = true; dlgKeysSetting.value = true;
}); });
}; };
export const restIsvKeysLoading = ref(false);
export const resetIsvKeys = () => {
restIsvKeysLoading.value = true;
api.createKeys(settingKeysFormData.value.keyFormat).then(resp => {
restIsvKeysLoading.value = false;
const data = resp.data;
settingKeysFormData.value.publicKeyIsv = data.publicKey;
settingKeysFormData.value.privateKeyIsv = data.privateKey;
});
};
export const resetPlatformKeysLoading = ref(false);
export const resetPlatformKeys = () => {
resetPlatformKeysLoading.value = true;
api.createKeys(settingKeysFormData.value.keyFormat).then(resp => {
resetPlatformKeysLoading.value = false;
const data = resp.data;
settingKeysFormData.value.publicKeyPlatform = data.publicKey;
settingKeysFormData.value.privateKeyPlatform = data.privateKey;
});
};
export const handleUpdateKeys = () => {
api.updateKeys(settingKeysFormData.value).then(() => {
ElMessage({
message: "保存成功",
type: "success"
});
dlgKeysSetting.value = false;
search();
});
};

View File

@@ -1,11 +1,12 @@
import { ref } from "vue"; import { ref } from "vue";
import type { PlusFormGroupRow } from "plus-pro-components"; import type { PlusFormGroupRow } from "plus-pro-components";
import { CreditCard } from "@element-plus/icons-vue";
import { api } from "@/api/isvList"; import { api } from "@/api/isvList";
import { KeyFormatEnum } from "@/model/enums";
// 弹窗显示 // 弹窗显示
export const dlgKeysShow = ref(false); export const dlgKeysShow = ref(false);
export const showKeysFormData = ref<any>({ export const showKeysFormData = ref<any>({
keyFormat: KeyFormatEnum.PKCS8,
publicKeyIsv: "", publicKeyIsv: "",
privateKeyIsv: "", privateKeyIsv: "",
publicKeyPlatform: "", publicKeyPlatform: "",
@@ -14,8 +15,31 @@ export const showKeysFormData = ref<any>({
// 表单内容 // 表单内容
export const showKeysFormColumns: PlusFormGroupRow[] = [ export const showKeysFormColumns: PlusFormGroupRow[] = [
{ {
title: "ISV公私钥 - 标识☆分配给开发者", title: "基本信息",
icon: CreditCard, columns: [
{
label: "秘钥格式",
prop: "keyFormat",
labelWidth: 100,
valueType: "radio",
options: [
{
label: "PKCS8(Java适用)",
value: KeyFormatEnum.PKCS8
},
{
label: "PKCS1(非Java适用)",
value: KeyFormatEnum.PKCS1
}
],
fieldProps: {
disabled: true
}
}
]
},
{
title: "ISV公私钥",
columns: [ columns: [
{ {
label: "ISV公钥", label: "ISV公钥",
@@ -44,8 +68,7 @@ export const showKeysFormColumns: PlusFormGroupRow[] = [
] ]
}, },
{ {
title: "平台公私钥 - 标识☆分配给开发者", title: "平台公私钥",
icon: CreditCard,
columns: [ columns: [
{ {
label: "☆平台公钥", label: "☆平台公钥",

View File

@@ -1,13 +1,12 @@
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { import {
type ButtonsCallBackParams, type ButtonsCallBackParams,
type FieldValues,
type PageInfo, type PageInfo,
type PlusColumn, type PlusColumn,
useTable useTable
} from "plus-pro-components"; } from "plus-pro-components";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { StatusEnum } from "@/model/enums"; import { RegSource, StatusEnum, YesOrNoEnum } from "@/model/enums";
import { api } from "@/api/serveApi"; import { api } from "@/api/serveApi";
const isAdd = ref(false); const isAdd = ref(false);
@@ -64,11 +63,17 @@ pageInfo.value.pageSize = 10;
export const tableColumns: PlusColumn[] = [ export const tableColumns: PlusColumn[] = [
{ {
label: "应用名称", label: "应用名称",
prop: "application" prop: "application",
tableColumnProps: {
showOverflowTooltip: true
}
}, },
{ {
label: "接口名称", label: "接口名称",
prop: "apiName" prop: "apiName",
tableColumnProps: {
showOverflowTooltip: true
}
}, },
{ {
label: "版本号", label: "版本号",
@@ -77,7 +82,17 @@ export const tableColumns: PlusColumn[] = [
}, },
{ {
label: "接口描述", label: "接口描述",
prop: "description" prop: "description",
tableColumnProps: {
showOverflowTooltip: true
}
},
{
label: "备注",
prop: "remark",
tableColumnProps: {
showOverflowTooltip: true
}
}, },
{ {
label: "需要授权", label: "需要授权",
@@ -87,8 +102,7 @@ export const tableColumns: PlusColumn[] = [
options: [ options: [
{ {
label: "否", label: "否",
value: 0, value: 0
color: "red"
}, },
{ {
label: "是", label: "是",
@@ -105,8 +119,7 @@ export const tableColumns: PlusColumn[] = [
options: [ options: [
{ {
label: "否", label: "否",
value: 0, value: 0
color: "red"
}, },
{ {
label: "是", label: "是",
@@ -115,6 +128,24 @@ export const tableColumns: PlusColumn[] = [
} }
] ]
}, },
{
label: "注册来源",
prop: "regSource",
width: 100,
valueType: "select",
options: [
{
label: "系统",
value: 1,
color: "blue"
},
{
label: "手动",
value: 2,
color: "green"
}
]
},
{ {
label: "状态", label: "状态",
prop: "status", prop: "status",
@@ -135,7 +166,13 @@ export const tableColumns: PlusColumn[] = [
}, },
{ {
label: "添加时间", label: "添加时间",
prop: "addTime" prop: "addTime",
width: 160
},
{
label: "修改时间",
prop: "updateTime",
width: 160
} }
]; ];
// 表格按钮定义 // 表格按钮定义
@@ -195,40 +232,48 @@ export const dlgTitle = ref("");
const editFormDataGen = () => { const editFormDataGen = () => {
return { return {
application: "", application: "",
apiName: "",
apiVersion: "",
status: 1, status: 1,
isPermission: 0, isPermission: 0,
description: "",
regSource: 1,
isNeedToken: 0 isNeedToken: 0
}; };
}; };
export const editFormData = ref<FieldValues>(editFormDataGen());
export const editFormData = ref<any>(editFormDataGen());
export const editFormRules = { export const editFormRules = {
application: [{ required: true, message: "请输入应用名称" }], application: [{ required: true, message: "请输入应用名称" }],
apiName: [{ required: true, message: "请输入接口名称" }], apiName: [{ required: true, message: "请输入接口名称" }],
apiVersion: [{ required: true, message: "请输入版本号" }], apiVersion: [{ required: true, message: "请输入版本号" }],
description: [{ required: true, message: "请输入接口描述" }] description: [{ required: true, message: "请输入接口描述" }]
}; };
export const isCustomRegSource = computed(() => {
return editFormData.value.regSource === RegSource.CUSTOM;
});
// 表单内容 // 表单内容
export const editFormColumns: PlusColumn[] = [ export const editFormColumns: PlusColumn[] = [
{ {
label: "应用名称", label: "应用名称",
prop: "application", prop: "application",
valueType: "copy" valueType: "text"
}, },
{ {
label: "接口名称", label: "接口名称",
prop: "apiName", prop: "apiName",
valueType: "copy" valueType: "text"
}, },
{ {
label: "版本号", label: "版本号",
prop: "apiVersion", prop: "apiVersion",
valueType: "copy" valueType: "text"
}, },
{ {
label: "接口描述", label: "接口描述",
prop: "description", prop: "description",
valueType: "copy" valueType: "text"
}, },
{ {
label: "备注", label: "备注",
@@ -247,12 +292,12 @@ export const editFormColumns: PlusColumn[] = [
options: [ options: [
{ {
label: "否", label: "否",
value: 0, value: YesOrNoEnum.NO,
color: "red" color: "red"
}, },
{ {
label: "是", label: "是",
value: 1, value: YesOrNoEnum.YES,
color: "green" color: "green"
} }
] ]
@@ -264,12 +309,12 @@ export const editFormColumns: PlusColumn[] = [
options: [ options: [
{ {
label: "否", label: "否",
value: 0, value: YesOrNoEnum.NO,
color: "red" color: "red"
}, },
{ {
label: "是", label: "是",
value: 1, value: YesOrNoEnum.YES,
color: "green" color: "green"
} }
] ]
@@ -281,12 +326,12 @@ export const editFormColumns: PlusColumn[] = [
options: [ options: [
{ {
label: "禁用", label: "禁用",
value: 0, value: StatusEnum.DISABLE,
color: "red" color: "red"
}, },
{ {
label: "启用", label: "启用",
value: 1, value: StatusEnum.ENABLE,
color: "green" color: "green"
} }
] ]

View File

@@ -10,6 +10,7 @@ import {
handlePaginationChange, handlePaginationChange,
handleSave, handleSave,
handleSearch, handleSearch,
isCustomRegSource,
pageInfo, pageInfo,
searchFormColumns, searchFormColumns,
searchFormData, searchFormData,
@@ -40,6 +41,7 @@ import {
pageSizeList: [10, 20, 50, 100], pageSizeList: [10, 20, 50, 100],
align: 'right' align: 'right'
}" }"
adaptive
@paginationChange="handlePaginationChange" @paginationChange="handlePaginationChange"
> >
<template #title> <template #title>
@@ -56,7 +58,49 @@ import {
labelWidth: '100px', labelWidth: '100px',
labelPosition: 'right' labelPosition: 'right'
}" }"
:hasErrorTip="false"
@confirm="handleSave" @confirm="handleSave"
/> >
<template #plus-field-application>
<el-input
v-if="isCustomRegSource"
v-model="editFormData.application"
placeholder="请输入所属应用"
/>
<span v-else>
{{ editFormData.application }}
</span>
</template>
<template #plus-field-apiName>
<el-input
v-if="isCustomRegSource"
v-model="editFormData.apiName"
placeholder="请输入接口名称,如:goods.get"
/>
<span v-else>
{{ editFormData.apiName }}
</span>
</template>
<template #plus-field-apiVersion>
<el-input
v-if="isCustomRegSource"
v-model="editFormData.apiVersion"
placeholder="请输入接口版本,如:1.0"
/>
<span v-else>
{{ editFormData.apiVersion }}
</span>
</template>
<template #plus-field-description>
<el-input
v-if="isCustomRegSource"
v-model="editFormData.description"
placeholder="请输入接口描述"
/>
<span v-else>
{{ editFormData.description }}
</span>
</template>
</PlusDialogForm>
</el-card> </el-card>
</template> </template>