This commit is contained in:
六如
2024-10-17 09:41:34 +08:00
parent 35b3e6489d
commit 17bc2d5ca8
15 changed files with 330 additions and 98 deletions

View File

@@ -1,11 +1,11 @@
export type Result = {
export interface Result {
success: boolean;
data: object;
msg: "";
code: "";
};
}
export type PageResult = {
export interface PageResult {
success: boolean;
msg: "";
code: "";
@@ -13,4 +13,4 @@ export type PageResult = {
total: 0;
list: Array<any>;
};
};
}

View File

@@ -1,8 +1,7 @@
import { computed, type Ref, ref } from "vue";
import { ref } from "vue";
import {
type ButtonsCallBackParams,
type FieldValues,
type OptionsRow,
type PageInfo,
type PlusColumn,
useTable
@@ -10,6 +9,7 @@ import {
import { ElMessage } from "element-plus";
import { KeyFormatEnum, StatusEnum } from "@/model/enums";
import { api } from "@/api/isvList";
import { settingKeys } from "@/views/isv/list/isvKeys";
const isAdd = ref(false);
@@ -17,10 +17,8 @@ const isAdd = ref(false);
// 查询表单对象
export const searchFormData = ref({
id: "",
appId: "",
status: "",
remark: "",
pageIndex: 1,
pageSize: 10
});
@@ -121,7 +119,6 @@ actionButtons.value = [
props: {
type: "primary"
},
show: computed(() => true),
onClick(params: ButtonsCallBackParams) {
isAdd.value = false;
editFormData.value = Object.assign({}, params.row);
@@ -129,6 +126,16 @@ actionButtons.value = [
dlgShow.value = true;
}
},
{
text: "设置秘钥",
code: "edit",
props: {
type: "primary"
},
onClick(params: ButtonsCallBackParams) {
settingKeys(params.row);
}
},
{
// 启用/禁用
text: row => (row.status === StatusEnum.ENABLE ? "禁用" : "启用"),
@@ -177,15 +184,6 @@ const editFormDataGen = () => {
export const editFormData = ref<FieldValues>(editFormDataGen());
export const editFormRules = {};
// options推荐写法
// 1. 定义一个 `ref`数组
const roleList: Ref<OptionsRow[]> = ref([]);
// 2. 异步函数获取到值赋值到 `ref`
const loadRole = async () => {
//
};
loadRole();
// 表单内容
export const editFormColumns: PlusColumn[] = [
{
@@ -197,29 +195,29 @@ export const editFormColumns: PlusColumn[] = [
placeholder: "自动生成"
}
},
{
label: "秘钥格式",
prop: "keyFormat",
valueType: "radio",
options: [
{
label: "PKCS8(Java适用)",
value: KeyFormatEnum.PKCS8
},
{
label: "PKCS1(非Java适用)",
value: KeyFormatEnum.PKCS1
}
]
},
{
label: "角色",
prop: "roleCodes",
valueType: "checkbox",
// options推荐写法
// 3. 用 computed 返回 ref 的 value
options: computed(() => roleList.value)
},
// {
// label: "秘钥格式",
// prop: "keyFormat",
// valueType: "radio",
// options: [
// {
// label: "PKCS8(Java适用)",
// value: KeyFormatEnum.PKCS8
// },
// {
// label: "PKCS1(非Java适用)",
// value: KeyFormatEnum.PKCS1
// }
// ]
// },
// {
// label: "角色",
// prop: "roleCodes",
// valueType: "checkbox",
// // options推荐写法
// // 3. 用 computed 返回 ref 的 value
// options: computed(() => roleList.value)
// },
{
label: "状态",
prop: "status",

View File

@@ -23,6 +23,11 @@ import {
showKeysFormData,
viewKeys
} from "./showKeys";
import {
dlgKeysSetting,
settingKeysFormColumns,
settingKeysFormData
} from "@/views/isv/list/isvKeys";
</script>
<template>
<el-card shadow="never">
@@ -39,7 +44,7 @@ import {
<PlusTable
:columns="tableColumns"
:table-data="tableData"
:action-bar="{ buttons: actionButtons, width: 120 }"
:action-bar="{ buttons: actionButtons, width: 190 }"
:pagination="{
total,
modelValue: pageInfo,
@@ -52,7 +57,14 @@ import {
<el-button type="primary" @click="handleAdd">新增</el-button>
</template>
<template #plus-cell-keys="scoped">
<el-link type="primary" @click="viewKeys(scoped.row)">查看</el-link>
<el-link
v-if="scoped.row.hasKeys"
type="primary"
@click="viewKeys(scoped.row)"
>
查看
</el-link>
<span v-else>未设置</span>
</template>
</PlusTable>
<PlusDialogForm
@@ -68,12 +80,40 @@ import {
}"
@confirm="handleSave"
/>
<!-- 查看秘钥 -->
<PlusDialogForm
v-model:visible="dlgKeysShow"
v-model="showKeysFormData"
:dialog="{ title: '秘钥' }"
: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 }">
<el-button type="primary" @click="handleCancel">关闭</el-button>
</template>
</PlusDialogForm>
<!-- 设置秘钥 -->
<PlusDialogForm
v-model:visible="dlgKeysSetting"
v-model="settingKeysFormData"
:dialog="{ title: '秘钥' }"
:form="{ group: settingKeysFormColumns, 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 }">
<el-button type="primary" @click="handleCancel">关闭</el-button>
</template>

View File

@@ -0,0 +1,12 @@
// options推荐写法
// 1. 定义一个 `ref`数组
import { type Ref, ref } from "vue";
import { type OptionsRow } from "plus-pro-components";
const groupList: Ref<OptionsRow[]> = ref([]);
// 2. 异步函数获取到值赋值到 `ref`
const loadGroup = async () => {
//
console.log(groupList);
};
loadGroup();

View File

@@ -0,0 +1,83 @@
import { ref } from "vue";
import type { PlusFormGroupRow } from "plus-pro-components";
import { CreditCard } from "@element-plus/icons-vue";
import { api } from "@/api/isvList";
// 弹窗显示
export const dlgKeysSetting = ref(false);
export const settingKeysFormData = ref<any>({
publicKeyIsv: "",
privateKeyIsv: "",
publicKeyPlatform: "",
privateKeyPlatform: ""
});
// 表单内容
export const settingKeysFormColumns: PlusFormGroupRow[] = [
{
title: "ISV公私钥 - 标识☆分配给开发者",
icon: CreditCard,
columns: [
{
label: "ISV公钥",
prop: "publicKeyIsv",
valueType: "textarea",
labelWidth: 100,
fieldProps: {
showWordLimit: false,
placeholder: "",
readonly: true,
autosize: { minRows: 2, maxRows: 4 }
}
},
{
label: "☆ISV私钥",
prop: "privateKeyIsv",
valueType: "textarea",
labelWidth: 100,
fieldProps: {
showWordLimit: false,
placeholder: "",
autosize: { minRows: 2, maxRows: 4 }
}
}
]
},
{
title: "平台公私钥 - 标识☆分配给开发者",
icon: CreditCard,
columns: [
{
label: "☆平台公钥",
prop: "publicKeyPlatform",
valueType: "textarea",
labelWidth: 100,
fieldProps: {
showWordLimit: false,
placeholder: "",
autosize: { minRows: 2, maxRows: 4 }
}
},
{
label: "平台私钥",
prop: "privateKeyPlatform",
valueType: "textarea",
labelWidth: 100,
fieldProps: {
showWordLimit: false,
placeholder: "",
autosize: { minRows: 2, maxRows: 4 }
}
}
]
}
];
export const settingKeys = (row: any) => {
const params = {
isvId: row.id
};
api.viewKeys(params).then(resp => {
settingKeysFormData.value = resp.data;
dlgKeysSetting.value = true;
});
};

View File

@@ -5,7 +5,7 @@ import { api } from "@/api/isvList";
// 弹窗显示
export const dlgKeysShow = ref(false);
export const showKeysFormData = ref<object>({
export const showKeysFormData = ref<any>({
publicKeyIsv: "",
privateKeyIsv: "",
publicKeyPlatform: "",