mirror of
https://github.com/certd/certd.git
synced 2026-05-15 04:27:31 +08:00
chore: code format
This commit is contained in:
@@ -4,7 +4,7 @@ export async function PreBindUser(userId: number) {
|
||||
await request({
|
||||
url: "/sys/account/preBindUser",
|
||||
method: "post",
|
||||
data: { userId }
|
||||
data: { userId },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export async function BindUser(userId: number) {
|
||||
await request({
|
||||
url: "/sys/account/bindUser",
|
||||
method: "post",
|
||||
data: { userId }
|
||||
data: { userId },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function UnbindUser(userId: number) {
|
||||
await request({
|
||||
url: "/sys/account/unbindUser",
|
||||
method: "post",
|
||||
data: { userId }
|
||||
data: { userId },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ export async function UpdateLicense(data: any) {
|
||||
await request({
|
||||
url: "/sys/account/updateLicense",
|
||||
method: "post",
|
||||
data
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetTree() {
|
||||
return await request({
|
||||
url: apiPrefix + "/tree",
|
||||
method: "post"
|
||||
method: "post",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ export async function GetObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,150 +3,149 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
const list = await api.GetTree();
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
const list = await api.GetTree();
|
||||
|
||||
return {
|
||||
offset: 0,
|
||||
records: list,
|
||||
total: 10000,
|
||||
limit: 10000
|
||||
};
|
||||
};
|
||||
return {
|
||||
offset: 0,
|
||||
records: list,
|
||||
total: 10000,
|
||||
limit: 10000,
|
||||
};
|
||||
};
|
||||
|
||||
async function afterChange() {
|
||||
await permissionTreeDict.reloadDict();
|
||||
}
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
const ret = await api.UpdateObj(form);
|
||||
await afterChange();
|
||||
return ret;
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
const ret = await api.DelObj(row.id);
|
||||
await afterChange();
|
||||
return ret;
|
||||
};
|
||||
async function afterChange() {
|
||||
await permissionTreeDict.reloadDict();
|
||||
}
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
const ret = await api.UpdateObj(form);
|
||||
await afterChange();
|
||||
return ret;
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
const ret = await api.DelObj(row.id);
|
||||
await afterChange();
|
||||
return ret;
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
const ret = await api.AddObj(form);
|
||||
await afterChange();
|
||||
return ret;
|
||||
};
|
||||
const permissionTreeDict = dict({
|
||||
url: "/sys/authority/permission/tree",
|
||||
isTree: true,
|
||||
value: "id",
|
||||
label: "title",
|
||||
async onReady({ dict }: any) {
|
||||
dict.setData([{ id: -1, title: t("certd.rootNode"), children: dict.data }]);
|
||||
}
|
||||
});
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
actionbar: {
|
||||
show: false
|
||||
},
|
||||
toolbar: {
|
||||
show: false
|
||||
},
|
||||
table: {
|
||||
show: false
|
||||
// scroll: { fixed: true }
|
||||
},
|
||||
rowHandle: {
|
||||
fixed: "right"
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
pagination: {
|
||||
show: false,
|
||||
pageSize: 100000
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "id",
|
||||
type: "number",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 120,
|
||||
sortable: "custom"
|
||||
}
|
||||
},
|
||||
title: {
|
||||
title: t("certd.permissionName"),
|
||||
type: "text",
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterPermissionName") },
|
||||
{ max: 50, message: t("certd.max50Chars") }
|
||||
],
|
||||
component: {
|
||||
placeholder: t("certd.permissionName")
|
||||
}
|
||||
},
|
||||
column: {
|
||||
width: 200
|
||||
}
|
||||
},
|
||||
permission: {
|
||||
title: t("certd.permissionCode"),
|
||||
type: "text",
|
||||
column: {
|
||||
width: 170
|
||||
},
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterPermissionCode") },
|
||||
{ max: 100, message: t("certd.max100Chars") }
|
||||
],
|
||||
component: {
|
||||
placeholder: t("certd.examplePermissionCode")
|
||||
}
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
title: t("certd.sortOrder"),
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100
|
||||
},
|
||||
form: {
|
||||
value: 100,
|
||||
rules: [{ required: true, type: "number", message: t("certd.sortRequired") }]
|
||||
}
|
||||
},
|
||||
parentId: {
|
||||
title: t("certd.parentNode"),
|
||||
type: "dict-tree",
|
||||
column: {
|
||||
width: 100
|
||||
},
|
||||
dict: permissionTreeDict,
|
||||
form: {
|
||||
value: -1,
|
||||
component: {
|
||||
multiple: false,
|
||||
defaultExpandAll: true,
|
||||
dict: { cache: false },
|
||||
fieldNames: {
|
||||
value: "id",
|
||||
label: "title"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
const ret = await api.AddObj(form);
|
||||
await afterChange();
|
||||
return ret;
|
||||
};
|
||||
const permissionTreeDict = dict({
|
||||
url: "/sys/authority/permission/tree",
|
||||
isTree: true,
|
||||
value: "id",
|
||||
label: "title",
|
||||
async onReady({ dict }: any) {
|
||||
dict.setData([{ id: -1, title: t("certd.rootNode"), children: dict.data }]);
|
||||
},
|
||||
});
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
actionbar: {
|
||||
show: false,
|
||||
},
|
||||
toolbar: {
|
||||
show: false,
|
||||
},
|
||||
table: {
|
||||
show: false,
|
||||
// scroll: { fixed: true }
|
||||
},
|
||||
rowHandle: {
|
||||
fixed: "right",
|
||||
},
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
pagination: {
|
||||
show: false,
|
||||
pageSize: 100000,
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "id",
|
||||
type: "number",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 120,
|
||||
sortable: "custom",
|
||||
},
|
||||
},
|
||||
title: {
|
||||
title: t("certd.permissionName"),
|
||||
type: "text",
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterPermissionName") },
|
||||
{ max: 50, message: t("certd.max50Chars") },
|
||||
],
|
||||
component: {
|
||||
placeholder: t("certd.permissionName"),
|
||||
},
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
permission: {
|
||||
title: t("certd.permissionCode"),
|
||||
type: "text",
|
||||
column: {
|
||||
width: 170,
|
||||
},
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterPermissionCode") },
|
||||
{ max: 100, message: t("certd.max100Chars") },
|
||||
],
|
||||
component: {
|
||||
placeholder: t("certd.examplePermissionCode"),
|
||||
},
|
||||
},
|
||||
},
|
||||
sort: {
|
||||
title: t("certd.sortOrder"),
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100,
|
||||
},
|
||||
form: {
|
||||
value: 100,
|
||||
rules: [{ required: true, type: "number", message: t("certd.sortRequired") }],
|
||||
},
|
||||
},
|
||||
parentId: {
|
||||
title: t("certd.parentNode"),
|
||||
type: "dict-tree",
|
||||
column: {
|
||||
width: 100,
|
||||
},
|
||||
dict: permissionTreeDict,
|
||||
form: {
|
||||
value: -1,
|
||||
component: {
|
||||
multiple: false,
|
||||
defaultExpandAll: true,
|
||||
dict: { cache: false },
|
||||
fieldNames: {
|
||||
value: "id",
|
||||
label: "title",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
+174
-168
@@ -1,20 +1,27 @@
|
||||
<template>
|
||||
<a-tree v-if="computedTree" ref="treeRef" class="fs-permission-tree" :class="{ 'is-editable': editable }"
|
||||
:selectable="false" show-line :show-icon="false" :default-expand-all="true" :tree-data="computedTree"
|
||||
@check="onChecked">
|
||||
<template #title="scope">
|
||||
<div class="node-title-pane">
|
||||
<div class="node-title">{{ scope.title }}</div>
|
||||
<div v-if="editable === true" class="node-suffix">
|
||||
<fs-icon v-if="actions.add !== false" :icon="$fsui.icons.add" @click.stop="add(scope)" />
|
||||
<fs-icon v-if="actions.edit !== false && scope.id !== -1" :icon="$fsui.icons.edit"
|
||||
@click.stop="edit(scope)" />
|
||||
<fs-icon v-if="actions.remove !== false && scope.id !== -1" :icon="$fsui.icons.remove"
|
||||
@click.stop="remove(scope)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</a-tree>
|
||||
<a-tree
|
||||
v-if="computedTree"
|
||||
ref="treeRef"
|
||||
class="fs-permission-tree"
|
||||
:class="{ 'is-editable': editable }"
|
||||
:selectable="false"
|
||||
show-line
|
||||
:show-icon="false"
|
||||
:default-expand-all="true"
|
||||
:tree-data="computedTree"
|
||||
@check="onChecked"
|
||||
>
|
||||
<template #title="scope">
|
||||
<div class="node-title-pane">
|
||||
<div class="node-title">{{ scope.title }}</div>
|
||||
<div v-if="editable === true" class="node-suffix">
|
||||
<fs-icon v-if="actions.add !== false" :icon="$fsui.icons.add" @click.stop="add(scope)" />
|
||||
<fs-icon v-if="actions.edit !== false && scope.id !== -1" :icon="$fsui.icons.edit" @click.stop="edit(scope)" />
|
||||
<fs-icon v-if="actions.remove !== false && scope.id !== -1" :icon="$fsui.icons.remove" @click.stop="remove(scope)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</a-tree>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -24,171 +31,170 @@ import { computed, defineComponent, ref } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FsPermissionTree",
|
||||
props: {
|
||||
/**
|
||||
* 树形数据
|
||||
* */
|
||||
tree: {},
|
||||
/**
|
||||
* 是否可编辑
|
||||
*/
|
||||
editable: {
|
||||
default: true
|
||||
},
|
||||
actions: {
|
||||
default: {}
|
||||
}
|
||||
} as any,
|
||||
emits: ["add", "edit", "remove"],
|
||||
setup(props: any, ctx) {
|
||||
const { t } = useI18n();
|
||||
const treeRef = ref();
|
||||
const computedTree = computed(() => {
|
||||
if (props.tree == null) {
|
||||
return null;
|
||||
}
|
||||
const clone = cloneDeep(props.tree);
|
||||
utils.deepdash.forEachDeep(clone, (value: any, key: any, pNode: any, context: any) => {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if (!(value instanceof Object) || value instanceof Array) {
|
||||
return;
|
||||
}
|
||||
if (value.class === "is-leaf") {
|
||||
//处理过,无需再次处理
|
||||
return;
|
||||
}
|
||||
value.class = "is-twig";
|
||||
if (value.children != null && value.children.length > 0) {
|
||||
return;
|
||||
}
|
||||
const parents = context.parents;
|
||||
if (parents.length < 2) {
|
||||
return;
|
||||
}
|
||||
const parent = parents[parents.length - 2].value;
|
||||
//看parent下面的children,是否全部都没有children
|
||||
for (const child of parent.children) {
|
||||
if (child.children != null && child.children.length > 0) {
|
||||
//存在child有children
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 所有的子节点都没有children
|
||||
parent.class = "is-twig"; // 连接叶子节点的末梢枝杈节点
|
||||
let i = 0;
|
||||
for (const child of parent.children) {
|
||||
child.class = "is-leaf";
|
||||
if (i !== 0) {
|
||||
child.class += " leaf-after";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
});
|
||||
return [
|
||||
{
|
||||
title: t("certd.rootNode"),
|
||||
id: -1,
|
||||
children: clone
|
||||
}
|
||||
];
|
||||
});
|
||||
function add(scope: any) {
|
||||
ctx.emit("add", scope.dataRef);
|
||||
}
|
||||
function edit(scope: any) {
|
||||
ctx.emit("edit", scope.dataRef);
|
||||
}
|
||||
function remove(scope: any) {
|
||||
ctx.emit("remove", scope.dataRef);
|
||||
}
|
||||
function onChecked(a: any, b: any, c: any) {
|
||||
utils.logger.info("chedcked", a, b, c);
|
||||
}
|
||||
function getChecked() {
|
||||
const checked = treeRef.value.checkedKeys;
|
||||
const halfChecked = treeRef.value.halfCheckedKeys;
|
||||
return {
|
||||
checked,
|
||||
halfChecked
|
||||
};
|
||||
}
|
||||
return {
|
||||
computedTree,
|
||||
add,
|
||||
edit,
|
||||
remove,
|
||||
treeRef,
|
||||
onChecked,
|
||||
getChecked,
|
||||
t
|
||||
};
|
||||
}
|
||||
name: "FsPermissionTree",
|
||||
props: {
|
||||
/**
|
||||
* 树形数据
|
||||
* */
|
||||
tree: {},
|
||||
/**
|
||||
* 是否可编辑
|
||||
*/
|
||||
editable: {
|
||||
default: true,
|
||||
},
|
||||
actions: {
|
||||
default: {},
|
||||
},
|
||||
} as any,
|
||||
emits: ["add", "edit", "remove"],
|
||||
setup(props: any, ctx) {
|
||||
const { t } = useI18n();
|
||||
const treeRef = ref();
|
||||
const computedTree = computed(() => {
|
||||
if (props.tree == null) {
|
||||
return null;
|
||||
}
|
||||
const clone = cloneDeep(props.tree);
|
||||
utils.deepdash.forEachDeep(clone, (value: any, key: any, pNode: any, context: any) => {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
if (!(value instanceof Object) || value instanceof Array) {
|
||||
return;
|
||||
}
|
||||
if (value.class === "is-leaf") {
|
||||
//处理过,无需再次处理
|
||||
return;
|
||||
}
|
||||
value.class = "is-twig";
|
||||
if (value.children != null && value.children.length > 0) {
|
||||
return;
|
||||
}
|
||||
const parents = context.parents;
|
||||
if (parents.length < 2) {
|
||||
return;
|
||||
}
|
||||
const parent = parents[parents.length - 2].value;
|
||||
//看parent下面的children,是否全部都没有children
|
||||
for (const child of parent.children) {
|
||||
if (child.children != null && child.children.length > 0) {
|
||||
//存在child有children
|
||||
return;
|
||||
}
|
||||
}
|
||||
// 所有的子节点都没有children
|
||||
parent.class = "is-twig"; // 连接叶子节点的末梢枝杈节点
|
||||
let i = 0;
|
||||
for (const child of parent.children) {
|
||||
child.class = "is-leaf";
|
||||
if (i !== 0) {
|
||||
child.class += " leaf-after";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
});
|
||||
return [
|
||||
{
|
||||
title: t("certd.rootNode"),
|
||||
id: -1,
|
||||
children: clone,
|
||||
},
|
||||
];
|
||||
});
|
||||
function add(scope: any) {
|
||||
ctx.emit("add", scope.dataRef);
|
||||
}
|
||||
function edit(scope: any) {
|
||||
ctx.emit("edit", scope.dataRef);
|
||||
}
|
||||
function remove(scope: any) {
|
||||
ctx.emit("remove", scope.dataRef);
|
||||
}
|
||||
function onChecked(a: any, b: any, c: any) {
|
||||
utils.logger.info("chedcked", a, b, c);
|
||||
}
|
||||
function getChecked() {
|
||||
const checked = treeRef.value.checkedKeys;
|
||||
const halfChecked = treeRef.value.halfCheckedKeys;
|
||||
return {
|
||||
checked,
|
||||
halfChecked,
|
||||
};
|
||||
}
|
||||
return {
|
||||
computedTree,
|
||||
add,
|
||||
edit,
|
||||
remove,
|
||||
treeRef,
|
||||
onChecked,
|
||||
getChecked,
|
||||
t,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.fs-permission-tree {
|
||||
.ant-tree-list-holder-inner {
|
||||
flex-direction: row !important;
|
||||
flex-wrap: wrap;
|
||||
.ant-tree-list-holder-inner {
|
||||
flex-direction: row !important;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.is-twig {
|
||||
width: 100%;
|
||||
}
|
||||
.is-twig {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.is-leaf {
|
||||
.is-leaf {
|
||||
//border-bottom: 1px solid #ddd;
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
//border-bottom: 1px solid #ddd;
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
&.leaf-after {
|
||||
.ant-tree-indent-unit {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
&.leaf-after {
|
||||
.ant-tree-indent-unit {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.node-title-pane {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.node-title-pane {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
}
|
||||
}
|
||||
//.is-twig ul {
|
||||
// display: flex;
|
||||
// flex-wrap: wrap;
|
||||
//}
|
||||
.node-title-pane {
|
||||
display: flex;
|
||||
|
||||
//.is-twig ul {
|
||||
// display: flex;
|
||||
// flex-wrap: wrap;
|
||||
//}
|
||||
.node-title-pane {
|
||||
display: flex;
|
||||
.node-title {
|
||||
width: 110px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.node-title {
|
||||
width: 110px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
&.is-editable {
|
||||
.ant-tree-title {
|
||||
&:hover {
|
||||
.node-suffix {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.is-editable {
|
||||
.ant-tree-title {
|
||||
&:hover {
|
||||
.node-suffix {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
.node-suffix {
|
||||
visibility: hidden;
|
||||
|
||||
.node-suffix {
|
||||
visibility: hidden;
|
||||
|
||||
>* {
|
||||
margin-left: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
> * {
|
||||
margin-left: 3px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
<template>
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">{{ t("certd.permissionManagement") }}</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<a-button v-permission="'1sys:auth:per:add'" style="margin-left: 20px" @click="addHandle({})">
|
||||
<fs-icon :icon="ui.icons.add"></fs-icon>
|
||||
{{ t("certd.adda") }}
|
||||
</a-button>
|
||||
<fs-permission-tree class="permission-tree mt-10" :tree="crudBinding.data" :checkable="false"
|
||||
:actions="permission" @add="addHandle" @edit="editHandle" @remove="removeHandle"></fs-permission-tree>
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">{{ t("certd.permissionManagement") }}</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<a-button v-permission="'1sys:auth:per:add'" style="margin-left: 20px" @click="addHandle({})">
|
||||
<fs-icon :icon="ui.icons.add"></fs-icon>
|
||||
{{ t("certd.adda") }}
|
||||
</a-button>
|
||||
<fs-permission-tree class="permission-tree mt-10" :tree="crudBinding.data" :checkable="false" :actions="permission" @add="addHandle" @edit="editHandle" @remove="removeHandle"></fs-permission-tree>
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onActivated, onMounted, ref } from "vue";
|
||||
import createCrudOptions from "./crud.js";
|
||||
@@ -24,58 +22,58 @@ import { useFs, useUi } from "@fast-crud/fast-crud";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
export default defineComponent({
|
||||
name: "AuthorityManager",
|
||||
components: { FsPermissionTree },
|
||||
setup() {
|
||||
// 此处传入permission进行通用按钮权限设置,会通过commonOptions去设置actionbar和rowHandle的按钮的show属性
|
||||
// 更多关于按钮权限的源代码设置,请参考 ./src/plugin/fast-crud/index.js (75-77行)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: "sys:auth:per" } });
|
||||
const { t } = useI18n();
|
||||
name: "AuthorityManager",
|
||||
components: { FsPermissionTree },
|
||||
setup() {
|
||||
// 此处传入permission进行通用按钮权限设置,会通过commonOptions去设置actionbar和rowHandle的按钮的show属性
|
||||
// 更多关于按钮权限的源代码设置,请参考 ./src/plugin/fast-crud/index.js (75-77行)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: "sys:auth:per" } });
|
||||
const { t } = useI18n();
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
const { ui } = useUi();
|
||||
const { ui } = useUi();
|
||||
|
||||
//用户业务代码
|
||||
//用户业务代码
|
||||
|
||||
async function addHandle(item: any) {
|
||||
await crudExpose.openAdd({ row: { parentId: item?.id ?? -1 } });
|
||||
}
|
||||
async function editHandle(item: any) {
|
||||
await crudExpose.openEdit({ row: item });
|
||||
}
|
||||
async function removeHandle(item: any) {
|
||||
await crudExpose.doRemove({ row: { id: item.id }, index: null });
|
||||
}
|
||||
async function addHandle(item: any) {
|
||||
await crudExpose.openAdd({ row: { parentId: item?.id ?? -1 } });
|
||||
}
|
||||
async function editHandle(item: any) {
|
||||
await crudExpose.openEdit({ row: item });
|
||||
}
|
||||
async function removeHandle(item: any) {
|
||||
await crudExpose.doRemove({ row: { id: item.id }, index: null });
|
||||
}
|
||||
|
||||
const { hasPermissions } = usePermission();
|
||||
const permission = ref({
|
||||
add: hasPermissions("1sys:auth:per:add"),
|
||||
edit: hasPermissions("1sys:auth:per:edit"),
|
||||
remove: hasPermissions("1sys:auth:per:remove"),
|
||||
});
|
||||
const { hasPermissions } = usePermission();
|
||||
const permission = ref({
|
||||
add: hasPermissions("1sys:auth:per:add"),
|
||||
edit: hasPermissions("1sys:auth:per:edit"),
|
||||
remove: hasPermissions("1sys:auth:per:remove"),
|
||||
});
|
||||
|
||||
return {
|
||||
ui,
|
||||
crudBinding,
|
||||
crudRef,
|
||||
addHandle,
|
||||
editHandle,
|
||||
removeHandle,
|
||||
permission,
|
||||
t
|
||||
};
|
||||
},
|
||||
return {
|
||||
ui,
|
||||
crudBinding,
|
||||
crudRef,
|
||||
addHandle,
|
||||
editHandle,
|
||||
removeHandle,
|
||||
permission,
|
||||
t,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="less">
|
||||
.permission-tree {
|
||||
margin-left: 20px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,7 +4,7 @@ export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ export async function GetObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export async function getPermissionIds(roleId: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/getPermissionIds",
|
||||
method: "post",
|
||||
params: { id: roleId }
|
||||
params: { id: roleId },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,6 +65,6 @@ export async function DoAuthz(roleId: any, permissionIds: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/authz",
|
||||
method: "post",
|
||||
data: { roleId, permissionIds }
|
||||
data: { roleId, permissionIds },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,84 +3,84 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq,
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
rowHandle: {
|
||||
width: 300,
|
||||
buttons: {
|
||||
authz: {
|
||||
type: "link",
|
||||
text: "授权",
|
||||
async click(context) {
|
||||
await authz.authzOpen(context.record.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "id",
|
||||
type: "text",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 70,
|
||||
sorter: true
|
||||
}
|
||||
},
|
||||
name: {
|
||||
title: t("certd.roleName"),
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterRoleName") },
|
||||
{ max: 50, message: t("certd.max50Chars") }
|
||||
]
|
||||
}, // 表单配置
|
||||
column: {
|
||||
sorter: true
|
||||
}
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
column: {
|
||||
sorter: true
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.updateTime"),
|
||||
type: "datetime",
|
||||
column: {
|
||||
sorter: true
|
||||
},
|
||||
form: { show: false } // 表单配置
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
rowHandle: {
|
||||
width: 300,
|
||||
buttons: {
|
||||
authz: {
|
||||
type: "link",
|
||||
text: "授权",
|
||||
async click(context) {
|
||||
await authz.authzOpen(context.record.id);
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "id",
|
||||
type: "text",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 70,
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
name: {
|
||||
title: t("certd.roleName"),
|
||||
type: "text",
|
||||
search: { show: true },
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterRoleName") },
|
||||
{ max: 50, message: t("certd.max50Chars") },
|
||||
],
|
||||
}, // 表单配置
|
||||
column: {
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
column: {
|
||||
sorter: true,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.updateTime"),
|
||||
type: "datetime",
|
||||
column: {
|
||||
sorter: true,
|
||||
},
|
||||
form: { show: false }, // 表单配置
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
<template>
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">{{ t("certd.roleManagement") }}</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding" />
|
||||
<a-modal v-model:open="authzDialogVisible" width="860px" :title="t('certd.assignPermissions')"
|
||||
@ok="updatePermission">
|
||||
<fs-permission-tree ref="permissionTreeRef" v-model:checked-keys="checkedKeys" :tree="permissionTreeData"
|
||||
:editable="false" checkable :replace-fields="{ key: 'id', label: 'title' }"> </fs-permission-tree>
|
||||
</a-modal>
|
||||
</fs-page>
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">{{ t("certd.roleManagement") }}</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding" />
|
||||
<a-modal v-model:open="authzDialogVisible" width="860px" :title="t('certd.assignPermissions')" @ok="updatePermission">
|
||||
<fs-permission-tree ref="permissionTreeRef" v-model:checked-keys="checkedKeys" :tree="permissionTreeData" :editable="false" checkable :replace-fields="{ key: 'id', label: 'title' }"> </fs-permission-tree>
|
||||
</a-modal>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onActivated, onMounted, ref } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
@@ -25,103 +22,103 @@ import { UseCrudPermissionCompProps, UseCrudPermissionExtraProps } from "/@/plug
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
function useAuthz() {
|
||||
const checkedKeys = ref();
|
||||
const checkedKeys = ref();
|
||||
|
||||
const permissionTreeData = ref();
|
||||
const permissionTreeData = ref();
|
||||
|
||||
const permissionTreeRef = ref();
|
||||
const authzDialogVisible = ref(false);
|
||||
const permissionTreeRef = ref();
|
||||
const authzDialogVisible = ref(false);
|
||||
|
||||
const currentRoleId = ref();
|
||||
const currentRoleId = ref();
|
||||
|
||||
// 如果勾选节点中存在非叶子节点,tree组件会将其所有子节点全部勾选
|
||||
// 所以要找出所有叶子节点,仅勾选叶子节点,tree组件会将父节点同步勾选
|
||||
function getAllCheckedLeafNodeId(tree: any, checkedIds: any, temp: any) {
|
||||
for (let i = 0; i < tree.length; i++) {
|
||||
const item = tree[i];
|
||||
if (item.children && item.children.length !== 0) {
|
||||
getAllCheckedLeafNodeId(item.children, checkedIds, temp);
|
||||
} else {
|
||||
if (checkedIds.indexOf(item.id) !== -1) {
|
||||
temp.push(item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
function authzClose() {
|
||||
authzDialogVisible.value = false;
|
||||
}
|
||||
async function authzOpen(roleId: any) {
|
||||
permissionTreeData.value = await permissionApi.GetTree();
|
||||
checkedKeys.value = [];
|
||||
currentRoleId.value = roleId;
|
||||
// this.treeData = ret.data
|
||||
await updateChecked(roleId);
|
||||
authzDialogVisible.value = true;
|
||||
}
|
||||
async function updateChecked(roleId: any) {
|
||||
let checkedIds = await api.getPermissionIds(roleId);
|
||||
// 找出所有的叶子节点
|
||||
checkedIds = getAllCheckedLeafNodeId(permissionTreeData.value, checkedIds, []);
|
||||
checkedKeys.value = checkedIds;
|
||||
}
|
||||
async function updatePermission() {
|
||||
const roleId = currentRoleId.value;
|
||||
const { checked, halfChecked } = permissionTreeRef.value.getChecked();
|
||||
const allChecked = [...checked, ...halfChecked];
|
||||
await api.DoAuthz(roleId, allChecked);
|
||||
authzClose();
|
||||
//await updateChecked(roleId);
|
||||
// 如果勾选节点中存在非叶子节点,tree组件会将其所有子节点全部勾选
|
||||
// 所以要找出所有叶子节点,仅勾选叶子节点,tree组件会将父节点同步勾选
|
||||
function getAllCheckedLeafNodeId(tree: any, checkedIds: any, temp: any) {
|
||||
for (let i = 0; i < tree.length; i++) {
|
||||
const item = tree[i];
|
||||
if (item.children && item.children.length !== 0) {
|
||||
getAllCheckedLeafNodeId(item.children, checkedIds, temp);
|
||||
} else {
|
||||
if (checkedIds.indexOf(item.id) !== -1) {
|
||||
temp.push(item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
function authzClose() {
|
||||
authzDialogVisible.value = false;
|
||||
}
|
||||
async function authzOpen(roleId: any) {
|
||||
permissionTreeData.value = await permissionApi.GetTree();
|
||||
checkedKeys.value = [];
|
||||
currentRoleId.value = roleId;
|
||||
// this.treeData = ret.data
|
||||
await updateChecked(roleId);
|
||||
authzDialogVisible.value = true;
|
||||
}
|
||||
async function updateChecked(roleId: any) {
|
||||
let checkedIds = await api.getPermissionIds(roleId);
|
||||
// 找出所有的叶子节点
|
||||
checkedIds = getAllCheckedLeafNodeId(permissionTreeData.value, checkedIds, []);
|
||||
checkedKeys.value = checkedIds;
|
||||
}
|
||||
async function updatePermission() {
|
||||
const roleId = currentRoleId.value;
|
||||
const { checked, halfChecked } = permissionTreeRef.value.getChecked();
|
||||
const allChecked = [...checked, ...halfChecked];
|
||||
await api.DoAuthz(roleId, allChecked);
|
||||
authzClose();
|
||||
//await updateChecked(roleId);
|
||||
|
||||
message.success("授权成功");
|
||||
}
|
||||
message.success("授权成功");
|
||||
}
|
||||
|
||||
return {
|
||||
authzOpen,
|
||||
updatePermission,
|
||||
authzDialogVisible,
|
||||
permissionTreeData,
|
||||
checkedKeys,
|
||||
permissionTreeRef,
|
||||
};
|
||||
return {
|
||||
authzOpen,
|
||||
updatePermission,
|
||||
authzDialogVisible,
|
||||
permissionTreeData,
|
||||
checkedKeys,
|
||||
permissionTreeRef,
|
||||
};
|
||||
}
|
||||
|
||||
export default defineComponent({
|
||||
name: "RoleManager",
|
||||
components: { FsPermissionTree },
|
||||
setup() {
|
||||
//授权配置
|
||||
const { t } = useI18n();
|
||||
const authz = useAuthz();
|
||||
const permission: UseCrudPermissionCompProps = {
|
||||
prefix: "sys:auth:role", //权限代码前缀
|
||||
extra: ({ hasActionPermission }: UseCrudPermissionExtraProps): any => {
|
||||
//额外按钮权限控制
|
||||
return { rowHandle: { buttons: { authz: { show: hasActionPermission("authz") } } } };
|
||||
},
|
||||
};
|
||||
name: "RoleManager",
|
||||
components: { FsPermissionTree },
|
||||
setup() {
|
||||
//授权配置
|
||||
const { t } = useI18n();
|
||||
const authz = useAuthz();
|
||||
const permission: UseCrudPermissionCompProps = {
|
||||
prefix: "sys:auth:role", //权限代码前缀
|
||||
extra: ({ hasActionPermission }: UseCrudPermissionExtraProps): any => {
|
||||
//额外按钮权限控制
|
||||
return { rowHandle: { buttons: { authz: { show: hasActionPermission("authz") } } } };
|
||||
},
|
||||
};
|
||||
|
||||
// 初始化crud配置
|
||||
// 此处传入permission进行通用按钮权限设置,会通过commonOptions去设置actionbar和rowHandle的按钮的show属性
|
||||
// 更多关于按钮权限的源代码设置,请参考 ./src/plugin/fast-crud/index.js (75-77行)
|
||||
// 初始化crud配置
|
||||
// 此处传入permission进行通用按钮权限设置,会通过commonOptions去设置actionbar和rowHandle的按钮的show属性
|
||||
// 更多关于按钮权限的源代码设置,请参考 ./src/plugin/fast-crud/index.js (75-77行)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { authz, permission } });
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { authz, permission } });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
...authz,
|
||||
t
|
||||
};
|
||||
},
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
...authz,
|
||||
t,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -6,282 +6,281 @@ import dayjs from "dayjs";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
const userStore = useUserStore();
|
||||
const userStore = useUserStore();
|
||||
|
||||
const settingStore = useSettingStore();
|
||||
const userValidTimeEnabled = compute(() => {
|
||||
return settingStore.sysPublic.userValidTimeEnabled === true;
|
||||
});
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
rowHandle: {
|
||||
fixed: "right",
|
||||
buttons: {
|
||||
unlock: {
|
||||
title: t("certd.unlockLogin"),
|
||||
text: null,
|
||||
type: "link",
|
||||
icon: "ion:lock-open-outline",
|
||||
click: async ({ row }) => {
|
||||
Modal.confirm({
|
||||
title: t("certd.notice"),
|
||||
content: t("certd.confirmUnlock"),
|
||||
onOk: async () => {
|
||||
await api.Unlock(row.id);
|
||||
notification.success({
|
||||
message: t("certd.unlockSuccess"),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
table: {
|
||||
scroll: {
|
||||
//使用固定列时需要设置此值,并且大于等于列宽度之和的值
|
||||
x: 1400,
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "id",
|
||||
type: "text",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 100,
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 180,
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
// updateTime: {
|
||||
// title: "修改时间",
|
||||
// type: "datetime",
|
||||
// form: { show: false }, // 表单配置
|
||||
// column: {
|
||||
// sortable: "update_time",
|
||||
// width: 180
|
||||
// }
|
||||
// },
|
||||
username: {
|
||||
title: t("certd.username"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterUsername") },
|
||||
{ max: 50, message: t("certd.max50Chars") },
|
||||
],
|
||||
},
|
||||
editForm: { component: { disabled: false } },
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
password: {
|
||||
title: t("certd.password"),
|
||||
type: "text",
|
||||
key: "password",
|
||||
column: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
component: {
|
||||
showPassword: true,
|
||||
},
|
||||
helper: t("certd.modifyPasswordIfFilled"),
|
||||
},
|
||||
},
|
||||
nickName: {
|
||||
title: t("certd.nickName"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
email: {
|
||||
title: t("certd.emaila"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
mobile: {
|
||||
title: t("certd.mobile"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 130,
|
||||
},
|
||||
},
|
||||
avatar: {
|
||||
title: t("certd.avatar"),
|
||||
type: "cropper-uploader",
|
||||
column: {
|
||||
width: 70,
|
||||
component: {
|
||||
style: {
|
||||
height: "30px",
|
||||
width: "auto",
|
||||
},
|
||||
buildUrl(key: string) {
|
||||
return `api/basic/file/download?&key=` + key;
|
||||
},
|
||||
},
|
||||
},
|
||||
form: {
|
||||
component: {
|
||||
vModel: "modelValue",
|
||||
valueType: "key",
|
||||
cropper: {
|
||||
aspectRatio: 1,
|
||||
autoCropArea: 1,
|
||||
viewMode: 0,
|
||||
},
|
||||
onReady: null,
|
||||
uploader: {
|
||||
type: "form",
|
||||
action: "/basic/file/upload",
|
||||
name: "file",
|
||||
headers: {
|
||||
Authorization: "Bearer " + userStore.getToken,
|
||||
},
|
||||
successHandle(res: any) {
|
||||
return res;
|
||||
},
|
||||
},
|
||||
buildUrl(key: string) {
|
||||
return `api/basic/file/download?&key=` + key;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
status: {
|
||||
title: t("certd.status"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.enabled"), value: 1, color: "green" },
|
||||
{ label: t("certd.disabled"), value: 0, color: "red" },
|
||||
],
|
||||
}),
|
||||
column: {
|
||||
align: "center",
|
||||
sorter: true,
|
||||
width: 100,
|
||||
},
|
||||
},
|
||||
validTime: {
|
||||
title: t("certd.validTime"),
|
||||
type: "date",
|
||||
form: {
|
||||
show: userValidTimeEnabled,
|
||||
},
|
||||
column: {
|
||||
align: "center",
|
||||
sorter: true,
|
||||
width: 100,
|
||||
show: userValidTimeEnabled,
|
||||
cellRender({ value }) {
|
||||
if (value == null || value === 0) {
|
||||
return "";
|
||||
}
|
||||
if (value < dayjs().valueOf()) {
|
||||
return <a-tag color={"red"}>{t("certd.expired")}</a-tag>;
|
||||
}
|
||||
const date = dayjs(value).format("YYYY-MM-DD");
|
||||
return (
|
||||
<a-tag color={"green"} title={date}>
|
||||
<fs-time-humanize modelValue={value} options={{ largest: 1, units: ["y", "d", "h"] }} useFormatGreater={30000000000} />
|
||||
</a-tag>
|
||||
);
|
||||
},
|
||||
},
|
||||
valueBuilder({ value, row, key }) {
|
||||
if (value != null) {
|
||||
row[key] = dayjs(value);
|
||||
}
|
||||
},
|
||||
valueResolve({ value, row, key }) {
|
||||
if (value != null) {
|
||||
row[key] = value.valueOf();
|
||||
}
|
||||
},
|
||||
},
|
||||
remark: {
|
||||
title: t("certd.remark"),
|
||||
type: "text",
|
||||
column: {
|
||||
sorter: true,
|
||||
},
|
||||
form: {
|
||||
rules: [{ max: 100, message: t("certd.max100Chars") }],
|
||||
},
|
||||
},
|
||||
roles: {
|
||||
title: t("certd.roles"),
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
url: "/sys/authority/role/list",
|
||||
value: "id",
|
||||
label: "name",
|
||||
}), // 数据字典
|
||||
form: {
|
||||
component: { mode: "multiple" },
|
||||
},
|
||||
column: {
|
||||
width: 250,
|
||||
sortable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
const settingStore = useSettingStore();
|
||||
const userValidTimeEnabled = compute(() => {
|
||||
return settingStore.sysPublic.userValidTimeEnabled === true;
|
||||
});
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
rowHandle: {
|
||||
fixed: "right",
|
||||
buttons: {
|
||||
unlock: {
|
||||
title: t("certd.unlockLogin"),
|
||||
text: null,
|
||||
type: "link",
|
||||
icon: "ion:lock-open-outline",
|
||||
click: async ({ row }) => {
|
||||
Modal.confirm({
|
||||
title: t("certd.notice"),
|
||||
content: t("certd.confirmUnlock"),
|
||||
onOk: async () => {
|
||||
await api.Unlock(row.id);
|
||||
notification.success({
|
||||
message: t("certd.unlockSuccess"),
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
table: {
|
||||
scroll: {
|
||||
//使用固定列时需要设置此值,并且大于等于列宽度之和的值
|
||||
x: 1400,
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "id",
|
||||
type: "text",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 100,
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
form: { show: false }, // 表单配置
|
||||
column: {
|
||||
width: 180,
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
// updateTime: {
|
||||
// title: "修改时间",
|
||||
// type: "datetime",
|
||||
// form: { show: false }, // 表单配置
|
||||
// column: {
|
||||
// sortable: "update_time",
|
||||
// width: 180
|
||||
// }
|
||||
// },
|
||||
username: {
|
||||
title: t("certd.username"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [
|
||||
{ required: true, message: t("certd.enterUsername") },
|
||||
{ max: 50, message: t("certd.max50Chars") },
|
||||
],
|
||||
},
|
||||
editForm: { component: { disabled: false } },
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
password: {
|
||||
title: t("certd.password"),
|
||||
type: "text",
|
||||
key: "password",
|
||||
column: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
component: {
|
||||
showPassword: true,
|
||||
},
|
||||
helper: t("certd.modifyPasswordIfFilled"),
|
||||
},
|
||||
},
|
||||
nickName: {
|
||||
title: t("certd.nickName"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
email: {
|
||||
title: t("certd.emaila"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
mobile: {
|
||||
title: t("certd.mobile"),
|
||||
type: "text",
|
||||
search: { show: true }, // 开启查询
|
||||
form: {
|
||||
rules: [{ max: 50, message: t("certd.max50Chars") }],
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 130,
|
||||
},
|
||||
},
|
||||
avatar: {
|
||||
title: t("certd.avatar"),
|
||||
type: "cropper-uploader",
|
||||
column: {
|
||||
width: 70,
|
||||
component: {
|
||||
style: {
|
||||
height: "30px",
|
||||
width: "auto",
|
||||
},
|
||||
buildUrl(key: string) {
|
||||
return `api/basic/file/download?&key=` + key;
|
||||
},
|
||||
},
|
||||
},
|
||||
form: {
|
||||
component: {
|
||||
vModel: "modelValue",
|
||||
valueType: "key",
|
||||
cropper: {
|
||||
aspectRatio: 1,
|
||||
autoCropArea: 1,
|
||||
viewMode: 0,
|
||||
},
|
||||
onReady: null,
|
||||
uploader: {
|
||||
type: "form",
|
||||
action: "/basic/file/upload",
|
||||
name: "file",
|
||||
headers: {
|
||||
Authorization: "Bearer " + userStore.getToken,
|
||||
},
|
||||
successHandle(res: any) {
|
||||
return res;
|
||||
},
|
||||
},
|
||||
buildUrl(key: string) {
|
||||
return `api/basic/file/download?&key=` + key;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
status: {
|
||||
title: t("certd.status"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.enabled"), value: 1, color: "green" },
|
||||
{ label: t("certd.disabled"), value: 0, color: "red" },
|
||||
],
|
||||
}),
|
||||
column: {
|
||||
align: "center",
|
||||
sorter: true,
|
||||
width: 100,
|
||||
},
|
||||
},
|
||||
validTime: {
|
||||
title: t("certd.validTime"),
|
||||
type: "date",
|
||||
form: {
|
||||
show: userValidTimeEnabled,
|
||||
},
|
||||
column: {
|
||||
align: "center",
|
||||
sorter: true,
|
||||
width: 100,
|
||||
show: userValidTimeEnabled,
|
||||
cellRender({ value }) {
|
||||
if (value == null || value === 0) {
|
||||
return "";
|
||||
}
|
||||
if (value < dayjs().valueOf()) {
|
||||
return <a-tag color={"red"}>{t("certd.expired")}</a-tag>;
|
||||
}
|
||||
const date = dayjs(value).format("YYYY-MM-DD");
|
||||
return (
|
||||
<a-tag color={"green"} title={date}>
|
||||
<fs-time-humanize modelValue={value} options={{ largest: 1, units: ["y", "d", "h"] }} useFormatGreater={30000000000} />
|
||||
</a-tag>
|
||||
);
|
||||
},
|
||||
},
|
||||
valueBuilder({ value, row, key }) {
|
||||
if (value != null) {
|
||||
row[key] = dayjs(value);
|
||||
}
|
||||
},
|
||||
valueResolve({ value, row, key }) {
|
||||
if (value != null) {
|
||||
row[key] = value.valueOf();
|
||||
}
|
||||
},
|
||||
},
|
||||
remark: {
|
||||
title: t("certd.remark"),
|
||||
type: "text",
|
||||
column: {
|
||||
sorter: true,
|
||||
},
|
||||
form: {
|
||||
rules: [{ max: 100, message: t("certd.max100Chars") }],
|
||||
},
|
||||
},
|
||||
roles: {
|
||||
title: t("certd.roles"),
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
url: "/sys/authority/role/list",
|
||||
value: "id",
|
||||
label: "name",
|
||||
}), // 数据字典
|
||||
form: {
|
||||
component: { mode: "multiple" },
|
||||
},
|
||||
column: {
|
||||
width: 250,
|
||||
sortable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export async function GetObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export async function GetDetail(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/detail",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export async function DeleteBatch(ids: any[]) {
|
||||
return await request({
|
||||
url: apiPrefix + "/deleteByIds",
|
||||
method: "post",
|
||||
data: { ids }
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export async function SetDefault(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/setDefault",
|
||||
method: "post",
|
||||
data: { id }
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,6 +70,6 @@ export async function SetDisabled(id: any, disabled: boolean) {
|
||||
return await request({
|
||||
url: apiPrefix + "/setDisabled",
|
||||
method: "post",
|
||||
data: { id, disabled }
|
||||
data: { id, disabled },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,244 +8,244 @@ import { useSettingStore } from "/@/store/settings";
|
||||
import { Modal } from "ant-design-vue";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
const userStore = useUserStore();
|
||||
const settingStore = useSettingStore();
|
||||
const selectedRowKeys: Ref<any[]> = ref([]);
|
||||
context.selectedRowKeys = selectedRowKeys;
|
||||
const userStore = useUserStore();
|
||||
const settingStore = useSettingStore();
|
||||
const selectedRowKeys: Ref<any[]> = ref([]);
|
||||
context.selectedRowKeys = selectedRowKeys;
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
settings: {
|
||||
plugins: {
|
||||
//这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
|
||||
rowSelection: {
|
||||
enabled: true,
|
||||
order: -2,
|
||||
before: true,
|
||||
// handle: (pluginProps,useCrudProps)=>CrudOptions,
|
||||
props: {
|
||||
multiple: true,
|
||||
crossPage: true,
|
||||
selectedRowKeys
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
rowHandle: {
|
||||
minWidth: 200,
|
||||
fixed: "right"
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
domain: {
|
||||
title: t("certd.cnameDomain"),
|
||||
type: "text",
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
component: {
|
||||
placeholder: t("certd.cnameDomainPlaceholder"),
|
||||
},
|
||||
helper: t("certd.cnameDomainHelper"),
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
dnsProviderType: {
|
||||
title: t("certd.dnsProvider"),
|
||||
type: "dict-select",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
dict: dict({
|
||||
url: "pi/dnsProvider/list",
|
||||
value: "key",
|
||||
label: "title",
|
||||
}),
|
||||
form: {
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 150,
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
accessId: {
|
||||
title: t("certd.dnsProviderAuthorization"),
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
url: "/pi/access/list",
|
||||
value: "id",
|
||||
label: "name",
|
||||
}),
|
||||
form: {
|
||||
component: {
|
||||
name: "access-selector",
|
||||
vModel: "modelValue",
|
||||
type: compute(({ form }) => {
|
||||
return form.dnsProviderType;
|
||||
}),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 150,
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
isDefault: {
|
||||
title: t("certd.isDefault"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.yes"), value: true, color: "success" },
|
||||
{ label: t("certd.no"), value: false, color: "default" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
rules: [{ required: true, message: t("certd.selectIsDefault") }],
|
||||
},
|
||||
column: {
|
||||
align: "center",
|
||||
width: 100,
|
||||
},
|
||||
},
|
||||
setDefault: {
|
||||
title: t("certd.setDefault"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
conditionalRenderDisabled: true,
|
||||
cellRender: ({ row }) => {
|
||||
if (row.isDefault) {
|
||||
return;
|
||||
}
|
||||
const onClick = async () => {
|
||||
Modal.confirm({
|
||||
title: t("certd.prompt"),
|
||||
content: t("certd.confirmSetDefault"),
|
||||
onOk: async () => {
|
||||
await api.SetDefault(row.id);
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
};
|
||||
return {
|
||||
crudOptions: {
|
||||
settings: {
|
||||
plugins: {
|
||||
//这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
|
||||
rowSelection: {
|
||||
enabled: true,
|
||||
order: -2,
|
||||
before: true,
|
||||
// handle: (pluginProps,useCrudProps)=>CrudOptions,
|
||||
props: {
|
||||
multiple: true,
|
||||
crossPage: true,
|
||||
selectedRowKeys,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
rowHandle: {
|
||||
minWidth: 200,
|
||||
fixed: "right",
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
domain: {
|
||||
title: t("certd.cnameDomain"),
|
||||
type: "text",
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
component: {
|
||||
placeholder: t("certd.cnameDomainPlaceholder"),
|
||||
},
|
||||
helper: t("certd.cnameDomainHelper"),
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
dnsProviderType: {
|
||||
title: t("certd.dnsProvider"),
|
||||
type: "dict-select",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
dict: dict({
|
||||
url: "pi/dnsProvider/list",
|
||||
value: "key",
|
||||
label: "title",
|
||||
}),
|
||||
form: {
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 150,
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
accessId: {
|
||||
title: t("certd.dnsProviderAuthorization"),
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
url: "/pi/access/list",
|
||||
value: "id",
|
||||
label: "name",
|
||||
}),
|
||||
form: {
|
||||
component: {
|
||||
name: "access-selector",
|
||||
vModel: "modelValue",
|
||||
type: compute(({ form }) => {
|
||||
return form.dnsProviderType;
|
||||
}),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 150,
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
},
|
||||
},
|
||||
isDefault: {
|
||||
title: t("certd.isDefault"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.yes"), value: true, color: "success" },
|
||||
{ label: t("certd.no"), value: false, color: "default" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
rules: [{ required: true, message: t("certd.selectIsDefault") }],
|
||||
},
|
||||
column: {
|
||||
align: "center",
|
||||
width: 100,
|
||||
},
|
||||
},
|
||||
setDefault: {
|
||||
title: t("certd.setDefault"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
conditionalRenderDisabled: true,
|
||||
cellRender: ({ row }) => {
|
||||
if (row.isDefault) {
|
||||
return;
|
||||
}
|
||||
const onClick = async () => {
|
||||
Modal.confirm({
|
||||
title: t("certd.prompt"),
|
||||
content: t("certd.confirmSetDefault"),
|
||||
onOk: async () => {
|
||||
await api.SetDefault(row.id);
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<a-button type={"link"} size={"small"} onClick={onClick}>
|
||||
{t("certd.setAsDefault")}
|
||||
</a-button>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
disabled: {
|
||||
title: t("certd.disabled"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.enabled"), value: false, color: "success" },
|
||||
{ label: t("certd.disabledLabel"), value: true, color: "error" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
title: t("certd.clickToToggle"),
|
||||
on: {
|
||||
async click({ value, row }) {
|
||||
Modal.confirm({
|
||||
title: t("certd.prompt"),
|
||||
content: t("certd.confirmToggleStatus", { action: !value ? t("certd.disable") : t("certd.enable") }),
|
||||
onOk: async () => {
|
||||
await api.SetDisabled(row.id, !value);
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.updateTime"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
show: true,
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
return (
|
||||
<a-button type={"link"} size={"small"} onClick={onClick}>
|
||||
{t("certd.setAsDefault")}
|
||||
</a-button>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
disabled: {
|
||||
title: t("certd.disabled"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.enabled"), value: false, color: "success" },
|
||||
{ label: t("certd.disabledLabel"), value: true, color: "error" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
title: t("certd.clickToToggle"),
|
||||
on: {
|
||||
async click({ value, row }) {
|
||||
Modal.confirm({
|
||||
title: t("certd.prompt"),
|
||||
content: t("certd.confirmToggleStatus", { action: !value ? t("certd.disable") : t("certd.enable") }),
|
||||
onOk: async () => {
|
||||
await api.SetDisabled(row.id, !value);
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.updateTime"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
show: true,
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
<template>
|
||||
<fs-page class="page-cert">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.cnameTitle") }}
|
||||
<span class="sub">
|
||||
{{ t("certd.cnameDescription") }}
|
||||
<a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">
|
||||
{{ t("certd.cnameLinkText") }}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<template #pagination-left>
|
||||
<a-tooltip :title="t('certd.batchDelete')">
|
||||
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
<fs-page class="page-cert">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.cnameTitle") }}
|
||||
<span class="sub">
|
||||
{{ t("certd.cnameDescription") }}
|
||||
<a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">
|
||||
{{ t("certd.cnameLinkText") }}
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<template #pagination-left>
|
||||
<a-tooltip :title="t('certd.batchDelete')">
|
||||
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
@@ -33,35 +32,34 @@ import { useI18n } from "vue-i18n";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "CnameProvider",
|
||||
name: "CnameProvider",
|
||||
});
|
||||
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
|
||||
|
||||
const selectedRowKeys = context.selectedRowKeys;
|
||||
const handleBatchDelete = () => {
|
||||
if (selectedRowKeys.value?.length > 0) {
|
||||
Modal.confirm({
|
||||
title: t("certd.confirmTitle"),
|
||||
content: t("certd.confirmDeleteBatch", { count: selectedRowKeys.value.length }),
|
||||
async onOk() {
|
||||
await DeleteBatch(selectedRowKeys.value);
|
||||
message.info(t("certd.deleteSuccess"));
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
},
|
||||
});
|
||||
} else {
|
||||
message.error(t("certd.selectRecordsFirst"));
|
||||
}
|
||||
if (selectedRowKeys.value?.length > 0) {
|
||||
Modal.confirm({
|
||||
title: t("certd.confirmTitle"),
|
||||
content: t("certd.confirmDeleteBatch", { count: selectedRowKeys.value.length }),
|
||||
async onOk() {
|
||||
await DeleteBatch(selectedRowKeys.value);
|
||||
message.info(t("certd.deleteSuccess"));
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
},
|
||||
});
|
||||
} else {
|
||||
message.error(t("certd.selectRecordsFirst"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
|
||||
@@ -3,6 +3,6 @@ import { request } from "/@/api/service";
|
||||
export async function GetStatisticCount() {
|
||||
return await request({
|
||||
url: "/sys/statistic/count",
|
||||
method: "POST"
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ import { GetStatisticCount } from "./api";
|
||||
const count: Ref = ref({});
|
||||
|
||||
function transformCountPerDayToChartData(key: string) {
|
||||
count.value[key] = count.value[key].map((item:any) => {
|
||||
count.value[key] = count.value[key].map((item: any) => {
|
||||
return {
|
||||
name: item.date,
|
||||
value: item.count,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ script: |
|
||||
accessKeyId = '';
|
||||
secretAccessKey = '';
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
AliyunClient
|
||||
}
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
<template>
|
||||
<fs-page class="page-cert">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.pluginManagement") }}
|
||||
<span class="sub">{{ t("certd.pluginBetaWarning") }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<!-- <template #pagination-left>-->
|
||||
<!-- <a-tooltip :title="t('certd.batchDelete')">-->
|
||||
<!-- <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>-->
|
||||
<!-- </a-tooltip>-->
|
||||
<!-- </template>-->
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
<fs-page class="page-cert">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.pluginManagement") }}
|
||||
<span class="sub">{{ t("certd.pluginBetaWarning") }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<!-- <template #pagination-left>-->
|
||||
<!-- <a-tooltip :title="t('certd.batchDelete')">-->
|
||||
<!-- <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>-->
|
||||
<!-- </a-tooltip>-->
|
||||
<!-- </template>-->
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
@@ -28,36 +27,35 @@ import { useI18n } from "vue-i18n";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "SysPlugin",
|
||||
name: "SysPlugin",
|
||||
});
|
||||
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
|
||||
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
const selectedRowKeys = context.selectedRowKeys;
|
||||
const handleBatchDelete = () => {
|
||||
if (selectedRowKeys.value?.length > 0) {
|
||||
Modal.confirm({
|
||||
title: t("certd.confirm"),
|
||||
content: t("certd.batchDeleteConfirm", { count: selectedRowKeys.value.length }),
|
||||
async onOk() {
|
||||
await DeleteBatch(selectedRowKeys.value);
|
||||
message.info(t("certd.deleteSuccess"));
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
},
|
||||
});
|
||||
} else {
|
||||
message.error(t("certd.pleaseSelectRecord"));
|
||||
}
|
||||
if (selectedRowKeys.value?.length > 0) {
|
||||
Modal.confirm({
|
||||
title: t("certd.confirm"),
|
||||
content: t("certd.batchDeleteConfirm", { count: selectedRowKeys.value.length }),
|
||||
async onOk() {
|
||||
await DeleteBatch(selectedRowKeys.value);
|
||||
message.info(t("certd.deleteSuccess"));
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
},
|
||||
});
|
||||
} else {
|
||||
message.error(t("certd.pleaseSelectRecord"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
|
||||
@@ -103,4 +103,3 @@ export async function GetSmsTypeDefine(type: string) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export async function TestSend(receiver: string) {
|
||||
url: apiPrefix + "/test",
|
||||
method: "post",
|
||||
data: {
|
||||
receiver
|
||||
}
|
||||
receiver,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,86 +1,75 @@
|
||||
<template>
|
||||
<fs-page class="page-setting-email">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t('certd.emailServerSettings') }}
|
||||
<span class="sub">{{ t('certd.setEmailSendingServer') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<fs-page class="page-setting-email">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.emailServerSettings") }}
|
||||
<span class="sub">{{ t("certd.setEmailSendingServer") }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="flex-o">
|
||||
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
|
||||
autocomplete="off" class="email-form-box" @finish="onFinish" @finish-failed="onFinishFailed">
|
||||
<div v-if="!formState.usePlus" class="email-form">
|
||||
<a-form-item :label="t('certd.useCustomEmailServer')"> </a-form-item>
|
||||
<a-form-item :label="t('certd.smtpDomain')" name="host"
|
||||
:rules="[{ required: true, message: t('certd.pleaseEnterSmtpDomain') }]">
|
||||
<a-input v-model:value="formState.host" />
|
||||
</a-form-item>
|
||||
<div class="flex-o">
|
||||
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" class="email-form-box" @finish="onFinish" @finish-failed="onFinishFailed">
|
||||
<div v-if="!formState.usePlus" class="email-form">
|
||||
<a-form-item :label="t('certd.useCustomEmailServer')"> </a-form-item>
|
||||
<a-form-item :label="t('certd.smtpDomain')" name="host" :rules="[{ required: true, message: t('certd.pleaseEnterSmtpDomain') }]">
|
||||
<a-input v-model:value="formState.host" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.smtpPort')" name="port"
|
||||
:rules="[{ required: true, message: t('certd.pleaseEnterSmtpPort') }]">
|
||||
<a-input v-model:value="formState.port" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.smtpPort')" name="port" :rules="[{ required: true, message: t('certd.pleaseEnterSmtpPort') }]">
|
||||
<a-input v-model:value="formState.port" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.username')" :name="['auth', 'user']"
|
||||
:rules="[{ required: true, message: t('certd.pleaseEnterUsername') }]">
|
||||
<a-input v-model:value="formState.auth.user" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.password')" :name="['auth', 'pass']"
|
||||
:rules="[{ required: true, message: t('certd.pleaseEnterPassword') }]">
|
||||
<a-input-password v-model:value="formState.auth.pass" />
|
||||
<div class="helper">{{ t('certd.qqEmailAuthCodeHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.senderEmail')" name="sender"
|
||||
:rules="[{ required: true, message: t('certd.pleaseEnterSenderEmail') }]">
|
||||
<a-input v-model:value="formState.sender" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.useSsl')" name="secure">
|
||||
<a-switch v-model:checked="formState.secure" />
|
||||
<div class="helper">{{ t('certd.sslPortNote') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.ignoreCertValidation')" :name="['tls', 'rejectUnauthorized']">
|
||||
<a-switch v-model:checked="formState.tls.rejectUnauthorized" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.username')" :name="['auth', 'user']" :rules="[{ required: true, message: t('certd.pleaseEnterUsername') }]">
|
||||
<a-input v-model:value="formState.auth.user" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.password')" :name="['auth', 'pass']" :rules="[{ required: true, message: t('certd.pleaseEnterPassword') }]">
|
||||
<a-input-password v-model:value="formState.auth.pass" />
|
||||
<div class="helper">{{ t("certd.qqEmailAuthCodeHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.senderEmail')" name="sender" :rules="[{ required: true, message: t('certd.pleaseEnterSenderEmail') }]">
|
||||
<a-input v-model:value="formState.sender" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.useSsl')" name="secure">
|
||||
<a-switch v-model:checked="formState.secure" />
|
||||
<div class="helper">{{ t("certd.sslPortNote") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.ignoreCertValidation')" :name="['tls', 'rejectUnauthorized']">
|
||||
<a-switch v-model:checked="formState.tls.rejectUnauthorized" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||
<a-button type="primary" html-type="submit">{{ t('certd.save') }}</a-button>
|
||||
</a-form-item>
|
||||
</div>
|
||||
<div class="email-form">
|
||||
<a-form-item :label="t('certd.useOfficialEmailServer')" name="usePlus">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.usePlus" :disabled="!settingStore.isPlus"
|
||||
@change="onUsePlusChanged" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
<div class="helper">{{ t('certd.useOfficialEmailServerHelper') }}</div>
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</div>
|
||||
<div class="email-form">
|
||||
<a-form :model="testFormState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
|
||||
autocomplete="off" @finish="onTestSend">
|
||||
<a-form-item :label="t('certd.testReceiverEmail')" name="receiver"
|
||||
:rules="[{ required: true, message: t('certd.pleaseEnterTestReceiverEmail') }]">
|
||||
<a-input v-model:value="testFormState.receiver" />
|
||||
<div class="helper">{{ t('certd.saveBeforeTest') }}</div>
|
||||
<div class="helper">{{ t('certd.sendFailHelpDoc') }}<a
|
||||
href="https://certd.docmirror.cn/guide/use/email/" target="_blank">{{
|
||||
t('certd.emailConfigHelpDoc') }}</a></div>
|
||||
<div class="helper">{{ t('certd.tryOfficialEmailServer') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||
<a-button type="primary" :loading="testFormState.loading" html-type="submit">{{ t('certd.test')
|
||||
}}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</fs-page>
|
||||
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||
<a-button type="primary" html-type="submit">{{ t("certd.save") }}</a-button>
|
||||
</a-form-item>
|
||||
</div>
|
||||
<div class="email-form">
|
||||
<a-form-item :label="t('certd.useOfficialEmailServer')" name="usePlus">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.usePlus" :disabled="!settingStore.isPlus" @change="onUsePlusChanged" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.useOfficialEmailServerHelper") }}</div>
|
||||
</a-form-item>
|
||||
</div>
|
||||
</a-form>
|
||||
</div>
|
||||
<div class="email-form">
|
||||
<a-form :model="testFormState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onTestSend">
|
||||
<a-form-item :label="t('certd.testReceiverEmail')" name="receiver" :rules="[{ required: true, message: t('certd.pleaseEnterTestReceiverEmail') }]">
|
||||
<a-input v-model:value="testFormState.receiver" />
|
||||
<div class="helper">{{ t("certd.saveBeforeTest") }}</div>
|
||||
<div class="helper">
|
||||
{{ t("certd.sendFailHelpDoc") }}<a href="https://certd.docmirror.cn/guide/use/email/" target="_blank">{{ t("certd.emailConfigHelpDoc") }}</a>
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.tryOfficialEmailServer") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||
<a-button type="primary" :loading="testFormState.loading" html-type="submit">{{ t("certd.test") }}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from "vue";
|
||||
import * as api from "../api";
|
||||
@@ -92,98 +81,96 @@ import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
defineOptions({
|
||||
name: "EmailSetting",
|
||||
name: "EmailSetting",
|
||||
});
|
||||
|
||||
interface FormState {
|
||||
host: string;
|
||||
port: number;
|
||||
auth: {
|
||||
user: string;
|
||||
pass: string;
|
||||
};
|
||||
secure: boolean; // use TLS
|
||||
tls: {
|
||||
// do not fail on invalid certs
|
||||
rejectUnauthorized?: boolean;
|
||||
};
|
||||
sender: string;
|
||||
usePlus: boolean;
|
||||
host: string;
|
||||
port: number;
|
||||
auth: {
|
||||
user: string;
|
||||
pass: string;
|
||||
};
|
||||
secure: boolean; // use TLS
|
||||
tls: {
|
||||
// do not fail on invalid certs
|
||||
rejectUnauthorized?: boolean;
|
||||
};
|
||||
sender: string;
|
||||
usePlus: boolean;
|
||||
}
|
||||
|
||||
const formState = reactive<Partial<FormState>>({
|
||||
auth: {
|
||||
user: "",
|
||||
pass: "",
|
||||
},
|
||||
tls: {},
|
||||
usePlus: false,
|
||||
auth: {
|
||||
user: "",
|
||||
pass: "",
|
||||
},
|
||||
tls: {},
|
||||
usePlus: false,
|
||||
});
|
||||
|
||||
async function load() {
|
||||
const data: any = await api.EmailSettingsGet();
|
||||
_.merge(formState, data);
|
||||
const data: any = await api.EmailSettingsGet();
|
||||
_.merge(formState, data);
|
||||
}
|
||||
|
||||
load();
|
||||
|
||||
const onFinish = async (form: any) => {
|
||||
console.log("Success:", form);
|
||||
await api.EmailSettingsSave(form);
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
console.log("Success:", form);
|
||||
await api.EmailSettingsSave(form);
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const onFinishFailed = (errorInfo: any) => {
|
||||
// console.log("Failed:", errorInfo);
|
||||
// console.log("Failed:", errorInfo);
|
||||
};
|
||||
|
||||
async function onUsePlusChanged() {
|
||||
await api.EmailSettingsSave(formState);
|
||||
await api.EmailSettingsSave(formState);
|
||||
}
|
||||
|
||||
interface TestFormState {
|
||||
receiver: string;
|
||||
loading: boolean;
|
||||
receiver: string;
|
||||
loading: boolean;
|
||||
}
|
||||
const testFormState = reactive<TestFormState>({
|
||||
receiver: "",
|
||||
loading: false,
|
||||
receiver: "",
|
||||
loading: false,
|
||||
});
|
||||
async function onTestSend() {
|
||||
testFormState.loading = true;
|
||||
try {
|
||||
await emailApi.TestSend(testFormState.receiver);
|
||||
notification.success({
|
||||
message: t("certd.sendSuccess"),
|
||||
});
|
||||
} finally {
|
||||
testFormState.loading = false;
|
||||
}
|
||||
testFormState.loading = true;
|
||||
try {
|
||||
await emailApi.TestSend(testFormState.receiver);
|
||||
notification.success({
|
||||
message: t("certd.sendSuccess"),
|
||||
});
|
||||
} finally {
|
||||
testFormState.loading = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const settingStore = useSettingStore();
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.page-setting-email {
|
||||
.email-form-box {
|
||||
display: flex;
|
||||
}
|
||||
.email-form-box {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.email-form {
|
||||
width: 500px;
|
||||
margin: 20px;
|
||||
}
|
||||
.email-form {
|
||||
width: 500px;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
.helper {
|
||||
padding: 1px;
|
||||
margin: 0px;
|
||||
color: #999;
|
||||
font-size: 10px;
|
||||
}
|
||||
.helper {
|
||||
padding: 1px;
|
||||
margin: 0px;
|
||||
color: #999;
|
||||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -33,13 +33,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
records: records,
|
||||
total: records.length,
|
||||
limit: 9999999,
|
||||
offset: 0
|
||||
offset: 0,
|
||||
};
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
let found: any = undefined;
|
||||
utils.tree.eachTree(settingStore.headerMenus?.menus || [], (item) => {
|
||||
utils.tree.eachTree(settingStore.headerMenus?.menus || [], item => {
|
||||
if (item.id === row.id) {
|
||||
merge(item, form);
|
||||
found = item;
|
||||
@@ -49,7 +49,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
return found;
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
utils.tree.eachTree([{ children: settingStore.headerMenus?.menus }], (item) => {
|
||||
utils.tree.eachTree([{ children: settingStore.headerMenus?.menus }], item => {
|
||||
if (item.children) {
|
||||
remove(item.children, (child: any) => child.id === row.id);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
form.id = nanoid();
|
||||
if (form.parentId) {
|
||||
utils.tree.eachTree(settingStore.headerMenus?.menus || [], (item) => {
|
||||
utils.tree.eachTree(settingStore.headerMenus?.menus || [], item => {
|
||||
if (item.id === form.parentId) {
|
||||
if (!item.children) {
|
||||
item.children = [];
|
||||
@@ -81,10 +81,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
delRequest,
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
table: {
|
||||
expandRowByClick: true,
|
||||
@@ -92,7 +92,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
expandedRowKeys: expandedRowKeys,
|
||||
"onUpdate:expandedRowKeys": (val: string[]) => {
|
||||
expandedRowKeys.value = val;
|
||||
}
|
||||
},
|
||||
},
|
||||
pagination: { show: false, pageSize: 9999999 },
|
||||
rowHandle: {
|
||||
@@ -107,12 +107,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
click: ({ row }) => {
|
||||
crudExpose.openAdd({
|
||||
row: {
|
||||
parentId: row.id
|
||||
}
|
||||
parentId: row.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
@@ -121,26 +121,26 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "text",
|
||||
column: {
|
||||
width: 200,
|
||||
show: false
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
title: {
|
||||
title: "菜单标题",
|
||||
type: "text",
|
||||
column: {
|
||||
width: 300
|
||||
width: 300,
|
||||
},
|
||||
form: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入标题"
|
||||
}
|
||||
]
|
||||
}
|
||||
message: "请输入标题",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
icon: {
|
||||
title: "图标",
|
||||
@@ -149,34 +149,34 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
width: 300,
|
||||
cellRender: ({ row }) => {
|
||||
return <fs-icon class={"fs-16"} icon={row.icon}></fs-icon>;
|
||||
}
|
||||
},
|
||||
},
|
||||
form: {
|
||||
component: {
|
||||
placeholder: "ion:add-circle"
|
||||
}
|
||||
}
|
||||
placeholder: "ion:add-circle",
|
||||
},
|
||||
},
|
||||
},
|
||||
path: {
|
||||
title: "链接",
|
||||
type: "link",
|
||||
column: {
|
||||
width: 300
|
||||
width: 300,
|
||||
},
|
||||
form: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入链接"
|
||||
message: "请输入链接",
|
||||
},
|
||||
{
|
||||
type: "url",
|
||||
message: "请输入正确的链接"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
message: "请输入正确的链接",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,59 +1,54 @@
|
||||
<template>
|
||||
<div class="sys-settings-form sys-settings-base">
|
||||
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off"
|
||||
@finish="onFinish" @finish-failed="onFinishFailed">
|
||||
<a-form-item :label="t('certd.icpRegistrationNumber')" :name="['public', 'icpNo']">
|
||||
<a-input v-model:value="formState.public.icpNo" :placeholder="t('certd.icpPlaceholder')" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.publicSecurityRegistrationNumber')" :name="['public', 'mpsNo']">
|
||||
<a-input v-model:value="formState.public.mpsNo" :placeholder="t('certd.publicSecurityPlaceholder')" />
|
||||
</a-form-item>
|
||||
<div class="sys-settings-form sys-settings-base">
|
||||
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish" @finish-failed="onFinishFailed">
|
||||
<a-form-item :label="t('certd.icpRegistrationNumber')" :name="['public', 'icpNo']">
|
||||
<a-input v-model:value="formState.public.icpNo" :placeholder="t('certd.icpPlaceholder')" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.publicSecurityRegistrationNumber')" :name="['public', 'mpsNo']">
|
||||
<a-input v-model:value="formState.public.mpsNo" :placeholder="t('certd.publicSecurityPlaceholder')" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.enableAssistant')" :name="['public', 'aiChatEnabled']">
|
||||
<a-switch v-model:checked="formState.public.aiChatEnabled" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.allowCrawlers')" :name="['public', 'robots']">
|
||||
<a-switch v-model:checked="formState.public.robots" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableAssistant')" :name="['public', 'aiChatEnabled']">
|
||||
<a-switch v-model:checked="formState.public.aiChatEnabled" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.allowCrawlers')" :name="['public', 'robots']">
|
||||
<a-switch v-model:checked="formState.public.robots" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.httpProxy')" :name="['private', 'httpProxy']" :rules="urlRules">
|
||||
<a-input v-model:value="formState.private.httpProxy" :placeholder="t('certd.httpProxyPlaceholder')" />
|
||||
<div class="helper">{{ t('certd.httpProxyHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.httpProxy')" :name="['private', 'httpProxy']" :rules="urlRules">
|
||||
<a-input v-model:value="formState.private.httpProxy" :placeholder="t('certd.httpProxyPlaceholder')" />
|
||||
<div class="helper">{{ t("certd.httpProxyHelper") }}</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.httpsProxy')" :name="['private', 'httpsProxy']" :rules="urlRules">
|
||||
<div class="flex">
|
||||
<a-input v-model:value="formState.private.httpsProxy"
|
||||
:placeholder="t('certd.httpsProxyPlaceholder')" />
|
||||
<a-button class="ml-5" type="primary" :loading="testProxyLoading"
|
||||
:title="t('certd.saveThenTestTitle')" @click="testProxy">{{ t('certd.testButton') }}</a-button>
|
||||
</div>
|
||||
<div class="helper">{{ t('certd.httpsProxyHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.httpsProxy')" :name="['private', 'httpsProxy']" :rules="urlRules">
|
||||
<div class="flex">
|
||||
<a-input v-model:value="formState.private.httpsProxy" :placeholder="t('certd.httpsProxyPlaceholder')" />
|
||||
<a-button class="ml-5" type="primary" :loading="testProxyLoading" :title="t('certd.saveThenTestTitle')" @click="testProxy">{{ t("certd.testButton") }}</a-button>
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.httpsProxyHelper") }}</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.dualStackNetwork')" :name="['private', 'dnsResultOrder']">
|
||||
<a-select v-model:value="formState.private.dnsResultOrder">
|
||||
<a-select-option value="verbatim">{{ t('certd.default') }}</a-select-option>
|
||||
<a-select-option value="ipv4first">{{ t('certd.ipv4Priority') }}</a-select-option>
|
||||
<a-select-option value="ipv6first">{{ t('certd.ipv6Priority') }}</a-select-option>
|
||||
</a-select>
|
||||
<div class="helper">{{ t('certd.dualStackNetworkHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.dualStackNetwork')" :name="['private', 'dnsResultOrder']">
|
||||
<a-select v-model:value="formState.private.dnsResultOrder">
|
||||
<a-select-option value="verbatim">{{ t("certd.default") }}</a-select-option>
|
||||
<a-select-option value="ipv4first">{{ t("certd.ipv4Priority") }}</a-select-option>
|
||||
<a-select-option value="ipv6first">{{ t("certd.ipv6Priority") }}</a-select-option>
|
||||
</a-select>
|
||||
<div class="helper">{{ t("certd.dualStackNetworkHelper") }}</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.enableCommonCnameService')" :name="['private', 'commonCnameEnabled']">
|
||||
<a-switch v-model:checked="formState.private.commonCnameEnabled" />
|
||||
<div class="helper" v-html="t('certd.commonCnameHelper')"></div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableCommonCnameService')" :name="['private', 'commonCnameEnabled']">
|
||||
<a-switch v-model:checked="formState.private.commonCnameEnabled" />
|
||||
<div class="helper" v-html="t('certd.commonCnameHelper')"></div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
|
||||
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t('certd.saveButton')
|
||||
}}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
|
||||
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { reactive, ref } from "vue";
|
||||
import { SysSettings } from "/@/views/sys/settings/api";
|
||||
@@ -67,89 +62,92 @@ import { useI18n } from "vue-i18n";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "SettingBase",
|
||||
name: "SettingBase",
|
||||
});
|
||||
|
||||
const formState = reactive<Partial<SysSettings>>({
|
||||
public: {
|
||||
icpNo: "",
|
||||
mpsNo: "",
|
||||
},
|
||||
private: {},
|
||||
public: {
|
||||
icpNo: "",
|
||||
mpsNo: "",
|
||||
},
|
||||
private: {},
|
||||
});
|
||||
|
||||
const urlRules = ref({
|
||||
type: "url",
|
||||
message: "请输入正确的URL",
|
||||
type: "url",
|
||||
message: "请输入正确的URL",
|
||||
});
|
||||
|
||||
async function loadSysSettings() {
|
||||
const data: any = await api.SysSettingsGet();
|
||||
merge(formState, data);
|
||||
const data: any = await api.SysSettingsGet();
|
||||
merge(formState, data);
|
||||
}
|
||||
|
||||
const saveLoading = ref(false);
|
||||
loadSysSettings();
|
||||
const settingsStore = useSettingStore();
|
||||
const onFinish = async (form: any) => {
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
await api.SysSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
message: t('certd.saveSuccess'),
|
||||
});
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
await api.SysSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const onFinishFailed = (errorInfo: any) => {
|
||||
// console.log("Failed:", errorInfo);
|
||||
// console.log("Failed:", errorInfo);
|
||||
};
|
||||
|
||||
async function stopOtherUserTimer() {
|
||||
await api.stopOtherUserTimer();
|
||||
notification.success({
|
||||
message: t('certd.stopSuccess'),
|
||||
});
|
||||
await api.stopOtherUserTimer();
|
||||
notification.success({
|
||||
message: t("certd.stopSuccess"),
|
||||
});
|
||||
}
|
||||
|
||||
const testProxyLoading = ref(false);
|
||||
async function testProxy() {
|
||||
testProxyLoading.value = true;
|
||||
try {
|
||||
const res = await api.TestProxy();
|
||||
let success = true;
|
||||
if (res.google !== true || res.baidu !== true) {
|
||||
success = false;
|
||||
}
|
||||
const content = () => {
|
||||
return (
|
||||
<div>
|
||||
<div>{t('certd.google')}: {res.google === true ? t('certd.success') : util.maxLength(res.google)}</div>
|
||||
<div>{t('certd.baidu')}: {res.baidu === true ? t('certd.success') : util.maxLength(res.baidu)}</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
if (!success) {
|
||||
notification.error({
|
||||
message: t('certd.testFailed'),
|
||||
description: content,
|
||||
});
|
||||
return;
|
||||
}
|
||||
notification.success({
|
||||
message: t('certd.testCompleted'),
|
||||
description: content,
|
||||
});
|
||||
} finally {
|
||||
testProxyLoading.value = false;
|
||||
}
|
||||
testProxyLoading.value = true;
|
||||
try {
|
||||
const res = await api.TestProxy();
|
||||
let success = true;
|
||||
if (res.google !== true || res.baidu !== true) {
|
||||
success = false;
|
||||
}
|
||||
const content = () => {
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
{t("certd.google")}: {res.google === true ? t("certd.success") : util.maxLength(res.google)}
|
||||
</div>
|
||||
<div>
|
||||
{t("certd.baidu")}: {res.baidu === true ? t("certd.success") : util.maxLength(res.baidu)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
if (!success) {
|
||||
notification.error({
|
||||
message: t("certd.testFailed"),
|
||||
description: content,
|
||||
});
|
||||
return;
|
||||
}
|
||||
notification.success({
|
||||
message: t("certd.testCompleted"),
|
||||
description: content,
|
||||
});
|
||||
} finally {
|
||||
testProxyLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="less">
|
||||
.sys-settings-base {}
|
||||
.sys-settings-base {
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -42,23 +42,23 @@ import { notification } from "ant-design-vue";
|
||||
import { request } from "/@/api/service";
|
||||
|
||||
defineOptions({
|
||||
name: "SettingPayment"
|
||||
name: "SettingPayment",
|
||||
});
|
||||
|
||||
const api = {
|
||||
async SettingGet() {
|
||||
return await request({
|
||||
url: "/sys/settings/payment/get",
|
||||
method: "post"
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
async SettingSave(data: any) {
|
||||
return await request({
|
||||
url: "/sys/settings/payment/save",
|
||||
method: "post",
|
||||
data
|
||||
data,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const formRef = ref<any>(null);
|
||||
@@ -76,7 +76,7 @@ const formState = reactive<
|
||||
>({
|
||||
yizhifu: { enabled: false },
|
||||
alipay: { enabled: false },
|
||||
wxpay: { enabled: false }
|
||||
wxpay: { enabled: false },
|
||||
});
|
||||
|
||||
async function loadSettings() {
|
||||
@@ -90,7 +90,7 @@ const onClick = async () => {
|
||||
await api.SettingSave(form);
|
||||
await loadSettings();
|
||||
notification.success({
|
||||
message: "保存成功"
|
||||
message: "保存成功",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -1,78 +1,69 @@
|
||||
<template>
|
||||
<div class="sys-settings-form sys-settings-register">
|
||||
<a-form :model="formState" name="register" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
|
||||
autocomplete="off" @finish="onFinish">
|
||||
<a-form-item :label="t('certd.manageOtherUserPipeline')" :name="['public', 'managerOtherUserPipeline']">
|
||||
<a-switch v-model:checked="formState.public.managerOtherUserPipeline" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.limitUserPipelineCount')" :name="['public', 'limitUserPipelineCount']">
|
||||
<a-input-number v-model:value="formState.public.limitUserPipelineCount" />
|
||||
<div class="helper">{{ t('certd.limitUserPipelineCountHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableSelfRegistration')" :name="['public', 'registerEnabled']">
|
||||
<a-switch v-model:checked="formState.public.registerEnabled" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableUserValidityPeriod')" :name="['public', 'userValidTimeEnabled']">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.public.userValidTimeEnabled"
|
||||
:disabled="!settingsStore.isPlus" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
<div class="helper">{{ t('certd.userValidityPeriodHelper') }}</div>
|
||||
</a-form-item>
|
||||
<template v-if="formState.public.registerEnabled">
|
||||
<a-form-item :label="t('certd.enableUsernameRegistration')"
|
||||
:name="['public', 'usernameRegisterEnabled']">
|
||||
<a-switch v-model:checked="formState.public.usernameRegisterEnabled" />
|
||||
</a-form-item>
|
||||
<div class="sys-settings-form sys-settings-register">
|
||||
<a-form :model="formState" name="register" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish">
|
||||
<a-form-item :label="t('certd.manageOtherUserPipeline')" :name="['public', 'managerOtherUserPipeline']">
|
||||
<a-switch v-model:checked="formState.public.managerOtherUserPipeline" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.limitUserPipelineCount')" :name="['public', 'limitUserPipelineCount']">
|
||||
<a-input-number v-model:value="formState.public.limitUserPipelineCount" />
|
||||
<div class="helper">{{ t("certd.limitUserPipelineCountHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableSelfRegistration')" :name="['public', 'registerEnabled']">
|
||||
<a-switch v-model:checked="formState.public.registerEnabled" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableUserValidityPeriod')" :name="['public', 'userValidTimeEnabled']">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.public.userValidTimeEnabled" :disabled="!settingsStore.isPlus" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.userValidityPeriodHelper") }}</div>
|
||||
</a-form-item>
|
||||
<template v-if="formState.public.registerEnabled">
|
||||
<a-form-item :label="t('certd.enableUsernameRegistration')" :name="['public', 'usernameRegisterEnabled']">
|
||||
<a-switch v-model:checked="formState.public.usernameRegisterEnabled" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.enableEmailRegistration')" :name="['public', 'emailRegisterEnabled']">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.public.emailRegisterEnabled"
|
||||
:disabled="!settingsStore.isPlus" :title="t('certd.proFeature')" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
<div class="helper">
|
||||
<router-link to="/sys/settings/email">{{ t('certd.emailServerSetup') }}</router-link>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableSmsLoginRegister')" :name="['public', 'smsLoginEnabled']">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.public.smsLoginEnabled" :disabled="!settingsStore.isComm"
|
||||
:title="t('certd.commFeature')" />
|
||||
<vip-button class="ml-5" mode="comm"></vip-button>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<template v-if="formState.public.smsLoginEnabled">
|
||||
<a-form-item :label="t('certd.smsProvider')" :name="['private', 'sms', 'type']">
|
||||
<a-select v-model:value="formState.private.sms.type" @change="smsTypeChange">
|
||||
<a-select-option value="aliyun">{{ t('certd.aliyunSms') }}</a-select-option>
|
||||
<a-select-option value="yfysms">{{ t('certd.yfySms') }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<template v-for="item of smsTypeDefineInputs" :key="item.simpleKey">
|
||||
<fs-form-item v-model="formState.private.sms.config[item.simpleKey]"
|
||||
:path="'private.sms.config' + item.key" :item="item" />
|
||||
</template>
|
||||
<a-form-item :label="t('certd.enableEmailRegistration')" :name="['public', 'emailRegisterEnabled']">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.public.emailRegisterEnabled" :disabled="!settingsStore.isPlus" :title="t('certd.proFeature')" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
<div class="helper">
|
||||
<router-link to="/sys/settings/email">{{ t("certd.emailServerSetup") }}</router-link>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableSmsLoginRegister')" :name="['public', 'smsLoginEnabled']">
|
||||
<div class="flex-o">
|
||||
<a-switch v-model:checked="formState.public.smsLoginEnabled" :disabled="!settingsStore.isComm" :title="t('certd.commFeature')" />
|
||||
<vip-button class="ml-5" mode="comm"></vip-button>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<template v-if="formState.public.smsLoginEnabled">
|
||||
<a-form-item :label="t('certd.smsProvider')" :name="['private', 'sms', 'type']">
|
||||
<a-select v-model:value="formState.private.sms.type" @change="smsTypeChange">
|
||||
<a-select-option value="aliyun">{{ t("certd.aliyunSms") }}</a-select-option>
|
||||
<a-select-option value="yfysms">{{ t("certd.yfySms") }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<template v-for="item of smsTypeDefineInputs" :key="item.simpleKey">
|
||||
<fs-form-item v-model="formState.private.sms.config[item.simpleKey]" :path="'private.sms.config' + item.key" :item="item" />
|
||||
</template>
|
||||
|
||||
<a-form-item :label="t('certd.smsTest')">
|
||||
<div class="flex">
|
||||
<a-input v-model:value="testMobile" :placeholder="t('certd.testMobilePlaceholder')" />
|
||||
<loading-button class="ml-5" :title="t('certd.saveThenTest')" type="primary"
|
||||
:click="testSendSms">{{
|
||||
t('certd.testButton') }}</loading-button>
|
||||
</div>
|
||||
<div class="helper">{{ t('certd.saveThenTest') }}</div>
|
||||
</a-form-item>
|
||||
</template>
|
||||
</template>
|
||||
<a-form-item :label="t('certd.smsTest')">
|
||||
<div class="flex">
|
||||
<a-input v-model:value="testMobile" :placeholder="t('certd.testMobilePlaceholder')" />
|
||||
<loading-button class="ml-5" :title="t('certd.saveThenTest')" type="primary" :click="testSendSms">{{ t("certd.testButton") }}</loading-button>
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.saveThenTest") }}</div>
|
||||
</a-form-item>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
|
||||
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t('certd.saveButton')
|
||||
}}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
|
||||
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
@@ -87,122 +78,122 @@ import { useI18n } from "vue-i18n";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "SettingRegister",
|
||||
name: "SettingRegister",
|
||||
});
|
||||
|
||||
const testMobile = ref("");
|
||||
async function testSendSms() {
|
||||
if (!testMobile.value) {
|
||||
notification.error({
|
||||
message: t('certd.enterTestMobile'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
await api.TestSms({
|
||||
mobile: testMobile.value,
|
||||
});
|
||||
notification.success({
|
||||
message: t('certd.sendSuccess'),
|
||||
});
|
||||
if (!testMobile.value) {
|
||||
notification.error({
|
||||
message: t("certd.enterTestMobile"),
|
||||
});
|
||||
return;
|
||||
}
|
||||
await api.TestSms({
|
||||
mobile: testMobile.value,
|
||||
});
|
||||
notification.success({
|
||||
message: t("certd.sendSuccess"),
|
||||
});
|
||||
}
|
||||
|
||||
const formState = reactive<Partial<SysSettings>>({
|
||||
public: {
|
||||
registerEnabled: false,
|
||||
},
|
||||
private: {
|
||||
sms: {
|
||||
type: "aliyun",
|
||||
config: {},
|
||||
},
|
||||
},
|
||||
public: {
|
||||
registerEnabled: false,
|
||||
},
|
||||
private: {
|
||||
sms: {
|
||||
type: "aliyun",
|
||||
config: {},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const rules = {
|
||||
leastOneLogin: {
|
||||
validator: (rule: any, value: any) => {
|
||||
if (!formState.public.passwordLoginEnabled && !formState.public.smsLoginEnabled) {
|
||||
return Promise.reject(t('certd.atLeastOneLoginRequired'));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
},
|
||||
required: {
|
||||
required: true,
|
||||
trigger: "change",
|
||||
message: t('certd.fieldRequired'),
|
||||
},
|
||||
leastOneLogin: {
|
||||
validator: (rule: any, value: any) => {
|
||||
if (!formState.public.passwordLoginEnabled && !formState.public.smsLoginEnabled) {
|
||||
return Promise.reject(t("certd.atLeastOneLoginRequired"));
|
||||
}
|
||||
return Promise.resolve();
|
||||
},
|
||||
},
|
||||
required: {
|
||||
required: true,
|
||||
trigger: "change",
|
||||
message: t("certd.fieldRequired"),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
async function smsTypeChange(value: string) {
|
||||
if (formState.private?.sms?.config) {
|
||||
formState.private.sms.config = {};
|
||||
}
|
||||
if (formState.private?.sms?.config) {
|
||||
formState.private.sms.config = {};
|
||||
}
|
||||
|
||||
await loadTypeDefine(value);
|
||||
await loadTypeDefine(value);
|
||||
}
|
||||
const smsTypeDefineInputs: Ref = ref({});
|
||||
async function loadTypeDefine(type: string) {
|
||||
const define: any = await api.GetSmsTypeDefine(type);
|
||||
const keys = Object.keys(define.input);
|
||||
const inputs: any = {};
|
||||
keys.forEach(key => {
|
||||
const value = define.input[key];
|
||||
value.simpleKey = key;
|
||||
value.key = "private.sms.config." + key;
|
||||
if (!value.component) {
|
||||
value.component = {
|
||||
name: "a-input",
|
||||
};
|
||||
}
|
||||
if (!value.component.name) {
|
||||
value.component.vModel = "value";
|
||||
}
|
||||
if (!value.rules) {
|
||||
value.rules = [];
|
||||
}
|
||||
if (value.required) {
|
||||
value.rules.push(rules.required);
|
||||
}
|
||||
const define: any = await api.GetSmsTypeDefine(type);
|
||||
const keys = Object.keys(define.input);
|
||||
const inputs: any = {};
|
||||
keys.forEach(key => {
|
||||
const value = define.input[key];
|
||||
value.simpleKey = key;
|
||||
value.key = "private.sms.config." + key;
|
||||
if (!value.component) {
|
||||
value.component = {
|
||||
name: "a-input",
|
||||
};
|
||||
}
|
||||
if (!value.component.name) {
|
||||
value.component.vModel = "value";
|
||||
}
|
||||
if (!value.rules) {
|
||||
value.rules = [];
|
||||
}
|
||||
if (value.required) {
|
||||
value.rules.push(rules.required);
|
||||
}
|
||||
|
||||
inputs[key] = define.input[key];
|
||||
});
|
||||
smsTypeDefineInputs.value = inputs;
|
||||
inputs[key] = define.input[key];
|
||||
});
|
||||
smsTypeDefineInputs.value = inputs;
|
||||
}
|
||||
|
||||
async function loadSysSettings() {
|
||||
const data: any = await api.SysSettingsGet();
|
||||
merge(formState, data);
|
||||
if (data?.private.sms?.type) {
|
||||
await loadTypeDefine(data.private.sms.type);
|
||||
}
|
||||
if (!settingsStore.isPlus) {
|
||||
formState.public.userValidTimeEnabled = false;
|
||||
formState.public.emailRegisterEnabled = false;
|
||||
}
|
||||
const data: any = await api.SysSettingsGet();
|
||||
merge(formState, data);
|
||||
if (data?.private.sms?.type) {
|
||||
await loadTypeDefine(data.private.sms.type);
|
||||
}
|
||||
if (!settingsStore.isPlus) {
|
||||
formState.public.userValidTimeEnabled = false;
|
||||
formState.public.emailRegisterEnabled = false;
|
||||
}
|
||||
|
||||
if (!settingsStore.isComm) {
|
||||
formState.public.smsLoginEnabled = false;
|
||||
}
|
||||
if (!settingsStore.isComm) {
|
||||
formState.public.smsLoginEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
const saveLoading = ref(false);
|
||||
loadSysSettings();
|
||||
const settingsStore = useSettingStore();
|
||||
const onFinish = async (form: any) => {
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
await api.SysSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
message: t('certd.saveSuccess'),
|
||||
});
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
await api.SysSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less">
|
||||
.sys-settings-site {}
|
||||
.sys-settings-site {
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,63 +1,54 @@
|
||||
<template>
|
||||
<div class="sys-settings-form sys-settings-safe">
|
||||
<a-form ref="formRef" :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
|
||||
autocomplete="off">
|
||||
<h2>{{ t('certd.siteHide') }}</h2>
|
||||
<a-form-item :label="t('certd.enableSiteHide')" :name="['hidden', 'enabled']" :required="true">
|
||||
<div class="flex">
|
||||
<a-switch v-model:checked="formState.hidden.enabled" />
|
||||
</div>
|
||||
<div class="sys-settings-form sys-settings-safe">
|
||||
<a-form ref="formRef" :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off">
|
||||
<h2>{{ t("certd.siteHide") }}</h2>
|
||||
<a-form-item :label="t('certd.enableSiteHide')" :name="['hidden', 'enabled']" :required="true">
|
||||
<div class="flex">
|
||||
<a-switch v-model:checked="formState.hidden.enabled" />
|
||||
</div>
|
||||
|
||||
<div class="helper">
|
||||
{{ t('certd.siteHideDescription') }}
|
||||
<a href="https://certd.docmirror.cn/guide/feature/safe/hidden" class="flex items-center"
|
||||
target="_blank">
|
||||
<span>{{ t('certd.helpDoc') }}</span>
|
||||
<fs-icon class="ml-1" icon="mingcute:question-line"></fs-icon></a>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.randomAddress')"
|
||||
:name="['hidden', 'openPath']" :required="true">
|
||||
<a-input-search v-model:value="formState.hidden.openPath" :allow-clear="true" @search="changeOpenPath">
|
||||
<template #enterButton>
|
||||
<fs-icon icon="ion:refresh"></fs-icon>
|
||||
</template>
|
||||
</a-input-search>
|
||||
<div class="helper">{{ t('certd.siteHideUrlHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.fullUnlockUrl')"
|
||||
:name="['hidden', 'openPath']" :required="true">
|
||||
<div class="flex"><fs-copyable v-model="openUrl" class="flex-inline"></fs-copyable></div>
|
||||
<div class="helper red">{{ t('certd.saveThisUrl') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.unlockPassword')"
|
||||
:name="['hidden', 'openPassword']" :required="false">
|
||||
<a-input-password v-model:value="formState.hidden.openPassword" :allow-clear="true" />
|
||||
<div class="helper">{{ t('certd.unlockPasswordHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.autoHideTime')"
|
||||
:name="['hidden', 'autoHiddenTimes']" :required="true">
|
||||
<a-input-number v-model:value="formState.hidden.autoHiddenTimes" :allow-clear="true" />
|
||||
<div class="helper">{{ t('certd.autoHideTimeHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.hideOpenApi')"
|
||||
:name="['hidden', 'hiddenOpenApi']" :required="true">
|
||||
<a-switch v-model:checked="formState.hidden.hiddenOpenApi" />
|
||||
<div class="helper">{{ t('certd.hideOpenApiHelper') }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.hideSiteImmediately')">
|
||||
<loading-button class="ml-1" type="primary" html-type="button" :click="doHiddenImmediate">{{
|
||||
t('certd.hideImmediately') }}</loading-button>
|
||||
</a-form-item>
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
|
||||
<loading-button type="primary" html-type="button" :click="onClick">{{ t('certd.save')
|
||||
}}</loading-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
<div class="helper">
|
||||
{{ t("certd.siteHideDescription") }}
|
||||
<a href="https://certd.docmirror.cn/guide/feature/safe/hidden" class="flex items-center" target="_blank">
|
||||
<span>{{ t("certd.helpDoc") }}</span>
|
||||
<fs-icon class="ml-1" icon="mingcute:question-line"></fs-icon
|
||||
></a>
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.randomAddress')" :name="['hidden', 'openPath']" :required="true">
|
||||
<a-input-search v-model:value="formState.hidden.openPath" :allow-clear="true" @search="changeOpenPath">
|
||||
<template #enterButton>
|
||||
<fs-icon icon="ion:refresh"></fs-icon>
|
||||
</template>
|
||||
</a-input-search>
|
||||
<div class="helper">{{ t("certd.siteHideUrlHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.fullUnlockUrl')" :name="['hidden', 'openPath']" :required="true">
|
||||
<div class="flex"><fs-copyable v-model="openUrl" class="flex-inline"></fs-copyable></div>
|
||||
<div class="helper red">{{ t("certd.saveThisUrl") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.unlockPassword')" :name="['hidden', 'openPassword']" :required="false">
|
||||
<a-input-password v-model:value="formState.hidden.openPassword" :allow-clear="true" />
|
||||
<div class="helper">{{ t("certd.unlockPasswordHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.autoHideTime')" :name="['hidden', 'autoHiddenTimes']" :required="true">
|
||||
<a-input-number v-model:value="formState.hidden.autoHiddenTimes" :allow-clear="true" />
|
||||
<div class="helper">{{ t("certd.autoHideTimeHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.hideOpenApi')" :name="['hidden', 'hiddenOpenApi']" :required="true">
|
||||
<a-switch v-model:checked="formState.hidden.hiddenOpenApi" />
|
||||
<div class="helper">{{ t("certd.hideOpenApiHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.hidden.enabled" :label="t('certd.hideSiteImmediately')">
|
||||
<loading-button class="ml-1" type="primary" html-type="button" :click="doHiddenImmediate">{{ t("certd.hideImmediately") }}</loading-button>
|
||||
</a-form-item>
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
|
||||
<loading-button type="primary" html-type="button" :click="onClick">{{ t("certd.save") }}</loading-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { computed, reactive, ref } from "vue";
|
||||
import { merge } from "lodash-es";
|
||||
@@ -69,105 +60,105 @@ import { useI18n } from "vue-i18n";
|
||||
|
||||
const { t } = useI18n();
|
||||
defineOptions({
|
||||
name: "SettingSafe",
|
||||
name: "SettingSafe",
|
||||
});
|
||||
const settingsStore = useSettingStore();
|
||||
const api = {
|
||||
async SettingGet() {
|
||||
return await request({
|
||||
url: "/sys/settings/safe/get",
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
async SettingSave(data: any) {
|
||||
return await request({
|
||||
url: "/sys/settings/safe/save",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
},
|
||||
async HiddenImmediate() {
|
||||
return await request({
|
||||
url: "/sys/settings/safe/hidden",
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
async SettingGet() {
|
||||
return await request({
|
||||
url: "/sys/settings/safe/get",
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
async SettingSave(data: any) {
|
||||
return await request({
|
||||
url: "/sys/settings/safe/save",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
},
|
||||
async HiddenImmediate() {
|
||||
return await request({
|
||||
url: "/sys/settings/safe/hidden",
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const defaultState = {
|
||||
hidden: {
|
||||
enabled: false,
|
||||
autoHiddenTimes: 5,
|
||||
hiddenOpenApi: false,
|
||||
},
|
||||
hidden: {
|
||||
enabled: false,
|
||||
autoHiddenTimes: 5,
|
||||
hiddenOpenApi: false,
|
||||
},
|
||||
};
|
||||
const formRef = ref<any>(defaultState);
|
||||
type SiteHidden = {
|
||||
enabled: boolean;
|
||||
openPath?: string;
|
||||
autoHiddenTimes?: number;
|
||||
openPassword?: string;
|
||||
hiddenOpenApi?: boolean;
|
||||
enabled: boolean;
|
||||
openPath?: string;
|
||||
autoHiddenTimes?: number;
|
||||
openPassword?: string;
|
||||
hiddenOpenApi?: boolean;
|
||||
};
|
||||
|
||||
const formState = reactive<
|
||||
Partial<{
|
||||
hidden: SiteHidden;
|
||||
}>
|
||||
Partial<{
|
||||
hidden: SiteHidden;
|
||||
}>
|
||||
>({
|
||||
hidden: { enabled: false },
|
||||
hidden: { enabled: false },
|
||||
});
|
||||
|
||||
function changeOpenPath() {
|
||||
formState.hidden.openPath = util.randomString(16);
|
||||
formState.hidden.openPath = util.randomString(16);
|
||||
}
|
||||
|
||||
async function loadSettings() {
|
||||
const data: any = await api.SettingGet();
|
||||
merge(formState, defaultState, formState, data);
|
||||
if (!formState.hidden.openPath) {
|
||||
changeOpenPath();
|
||||
}
|
||||
const data: any = await api.SettingGet();
|
||||
merge(formState, defaultState, formState, data);
|
||||
if (!formState.hidden.openPath) {
|
||||
changeOpenPath();
|
||||
}
|
||||
}
|
||||
|
||||
loadSettings();
|
||||
|
||||
const openUrl = computed(() => {
|
||||
const url = new URL(window.location.href);
|
||||
url.pathname = `/api/unhidden/${formState.hidden?.openPath || ""}`;
|
||||
//@ts-ignore
|
||||
url.query = undefined;
|
||||
url.hash = "";
|
||||
return url.href;
|
||||
const url = new URL(window.location.href);
|
||||
url.pathname = `/api/unhidden/${formState.hidden?.openPath || ""}`;
|
||||
//@ts-ignore
|
||||
url.query = undefined;
|
||||
url.hash = "";
|
||||
return url.href;
|
||||
});
|
||||
|
||||
const onClick = async () => {
|
||||
const form = await formRef.value.validateFields();
|
||||
//密码md5
|
||||
// if (form.hidden?.openPassword) {
|
||||
// form.hidden.openPassword = util.hash.md5(form.hidden.openPassword);
|
||||
// }
|
||||
await api.SettingSave(form);
|
||||
await loadSettings();
|
||||
notification.success({
|
||||
message: t('certd.saveSuccess'),
|
||||
});
|
||||
const form = await formRef.value.validateFields();
|
||||
//密码md5
|
||||
// if (form.hidden?.openPassword) {
|
||||
// form.hidden.openPassword = util.hash.md5(form.hidden.openPassword);
|
||||
// }
|
||||
await api.SettingSave(form);
|
||||
await loadSettings();
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
};
|
||||
|
||||
async function doHiddenImmediate() {
|
||||
Modal.confirm({
|
||||
title: t('certd.confirmHideSiteTitle'),
|
||||
content: t('certd.confirmHideSiteContent'),
|
||||
async onOk() {
|
||||
await api.HiddenImmediate();
|
||||
notification.success({
|
||||
message: t('certd.siteHiddenSuccess'),
|
||||
});
|
||||
},
|
||||
});
|
||||
Modal.confirm({
|
||||
title: t("certd.confirmHideSiteTitle"),
|
||||
content: t("certd.confirmHideSiteContent"),
|
||||
async onOk() {
|
||||
await api.HiddenImmediate();
|
||||
notification.success({
|
||||
message: t("certd.siteHiddenSuccess"),
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="less">
|
||||
.sys-settings-base {}
|
||||
.sys-settings-base {
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -5,7 +5,7 @@ const apiPrefix = "/sys/site";
|
||||
export async function SettingsGet(key: string) {
|
||||
return await request({
|
||||
url: apiPrefix + "/get",
|
||||
method: "post"
|
||||
method: "post",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ export async function SettingsSave(setting: any) {
|
||||
await request({
|
||||
url: apiPrefix + "/save",
|
||||
method: "post",
|
||||
data: setting
|
||||
data: setting,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export async function GetObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ export async function GetDetail(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/detail",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export async function DeleteBatch(ids: any[]) {
|
||||
return await request({
|
||||
url: apiPrefix + "/deleteByIds",
|
||||
method: "post",
|
||||
data: { ids }
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export async function SetDefault(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/setDefault",
|
||||
method: "post",
|
||||
data: { id }
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -73,6 +73,6 @@ export async function SetDisabled(id: any, disabled: boolean) {
|
||||
return await request({
|
||||
url: apiPrefix + "/setDisabled",
|
||||
method: "post",
|
||||
data: { id, disabled }
|
||||
data: { id, disabled },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,330 +7,316 @@ import DurationPriceValue from "/@/views/sys/suite/product/duration-price-value.
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const emit = context.emit;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const { t } = useI18n();
|
||||
const emit = context.emit;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
table: {
|
||||
onRefreshed: () => {
|
||||
emit("refreshed");
|
||||
}
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
pagination: {
|
||||
show: false,
|
||||
pageSize: 999999
|
||||
},
|
||||
rowHandle: {
|
||||
minWidth: 200,
|
||||
fixed: "right"
|
||||
},
|
||||
form: {
|
||||
group: {
|
||||
groups: {
|
||||
base: {
|
||||
header: t('certd.basicInfo'),
|
||||
columns: [
|
||||
t('certd.titlea'),
|
||||
t('certd.type'),
|
||||
t('certd.disabled'),
|
||||
t('certd.ordera'),
|
||||
t('certd.supportBuy'),
|
||||
t('certd.intro')
|
||||
]
|
||||
},
|
||||
content: {
|
||||
header: t('certd.packageContent'),
|
||||
columns: [
|
||||
t('certd.maxDomainCount'),
|
||||
t('certd.maxPipelineCount'),
|
||||
t('certd.maxDeployCount'),
|
||||
t('certd.maxMonitorCount')
|
||||
]
|
||||
},
|
||||
price: {
|
||||
header: t('certd.price'),
|
||||
columns: [
|
||||
t('certd.durationPrices')
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
columns: {
|
||||
// id: {
|
||||
// title: "ID",
|
||||
// key: "id",
|
||||
// type: "number",
|
||||
// column: {
|
||||
// width: 100
|
||||
// },
|
||||
// form: {
|
||||
// show: false
|
||||
// }
|
||||
// },
|
||||
title: {
|
||||
title: t('certd.packageName'),
|
||||
type: "text",
|
||||
search: {
|
||||
show: true
|
||||
},
|
||||
form: {
|
||||
rules: [{ required: true, message: t('certd.requiredField') }]
|
||||
},
|
||||
column: {
|
||||
width: 200
|
||||
}
|
||||
},
|
||||
type: {
|
||||
title: t('certd.type'),
|
||||
type: "dict-select",
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t('certd.suite'), value: "suite" },
|
||||
{ label: t('certd.addon'), value: "addon" }
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
value: "suite",
|
||||
rules: [{ required: true, message: t('certd.requiredField') }],
|
||||
helper: t('certd.typeHelper')
|
||||
},
|
||||
column: {
|
||||
width: 80,
|
||||
align: "center"
|
||||
},
|
||||
valueBuilder: ({ row }) => {
|
||||
if (row.content) {
|
||||
row.content = JSON.parse(row.content);
|
||||
}
|
||||
if (row.durationPrices) {
|
||||
row.durationPrices = JSON.parse(row.durationPrices);
|
||||
}
|
||||
},
|
||||
valueResolve: ({ form }) => {
|
||||
if (form.content) {
|
||||
form.content = JSON.stringify(form.content);
|
||||
}
|
||||
if (form.durationPrices) {
|
||||
form.durationPrices = JSON.stringify(form.durationPrices);
|
||||
}
|
||||
}
|
||||
},
|
||||
"content.maxDomainCount": {
|
||||
title: t('certd.domainCount'),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxDomainCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitCount')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.requiredField') }]
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitCount')
|
||||
}
|
||||
}
|
||||
},
|
||||
"content.maxPipelineCount": {
|
||||
title: t('certd.pipelineCount'),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxPipelineCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitPipeline')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.requiredField') }]
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitPipeline')
|
||||
}
|
||||
}
|
||||
},
|
||||
"content.maxDeployCount": {
|
||||
title: t('certd.deployCount'),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxDeployCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitDeploy')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.requiredField') }]
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitDeploy')
|
||||
}
|
||||
}
|
||||
},
|
||||
"content.maxMonitorCount": {
|
||||
title: t('certd.monitorCount'),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxMonitorCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitCount')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.requiredField') }]
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unitCount')
|
||||
}
|
||||
}
|
||||
},
|
||||
durationPrices: {
|
||||
title: t('certd.durationPriceTitle'),
|
||||
type: "text",
|
||||
form: {
|
||||
title: t('certd.selectDuration'),
|
||||
component: {
|
||||
name: PriceEdit,
|
||||
vModel: "modelValue",
|
||||
edit: true,
|
||||
style: {
|
||||
minHeight: "120px"
|
||||
}
|
||||
},
|
||||
col: {
|
||||
span: 24
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.requiredField') }]
|
||||
},
|
||||
column: {
|
||||
component: {
|
||||
name: DurationPriceValue,
|
||||
vModel: "modelValue"
|
||||
},
|
||||
width: 350
|
||||
}
|
||||
},
|
||||
supportBuy: {
|
||||
title: t('certd.supportBuy'),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t('certd.supportPurchase'), value: true, color: "success" },
|
||||
{ label: t('certd.cannotPurchase'), value: false, color: "gray" }
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
value: true
|
||||
},
|
||||
column: {
|
||||
width: 120
|
||||
}
|
||||
},
|
||||
disabled: {
|
||||
title: t('certd.shelfStatus'),
|
||||
type: "dict-radio",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ value: false, label: t('certd.onShelf'), color: "green" },
|
||||
{ value: true, label: t('certd.offShelf'), color: "gray" }
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
value: false
|
||||
},
|
||||
column: {
|
||||
width: 100
|
||||
}
|
||||
},
|
||||
order: {
|
||||
title: t('certd.ordera'),
|
||||
type: "number",
|
||||
form: {
|
||||
helper: t('certd.orderHelper'),
|
||||
value: 0
|
||||
},
|
||||
column: {
|
||||
width: 100
|
||||
}
|
||||
},
|
||||
intro: {
|
||||
title: t('certd.description'),
|
||||
type: "textarea",
|
||||
column: {
|
||||
width: 200
|
||||
}
|
||||
},
|
||||
createTime: {
|
||||
title: t('certd.createTime'),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
updateTime: {
|
||||
title: t('certd.updateTime'),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
show: true,
|
||||
width: 160
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
return {
|
||||
crudOptions: {
|
||||
table: {
|
||||
onRefreshed: () => {
|
||||
emit("refreshed");
|
||||
},
|
||||
},
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
pagination: {
|
||||
show: false,
|
||||
pageSize: 999999,
|
||||
},
|
||||
rowHandle: {
|
||||
minWidth: 200,
|
||||
fixed: "right",
|
||||
},
|
||||
form: {
|
||||
group: {
|
||||
groups: {
|
||||
base: {
|
||||
header: t("certd.basicInfo"),
|
||||
columns: [t("certd.titlea"), t("certd.type"), t("certd.disabled"), t("certd.ordera"), t("certd.supportBuy"), t("certd.intro")],
|
||||
},
|
||||
content: {
|
||||
header: t("certd.packageContent"),
|
||||
columns: [t("certd.maxDomainCount"), t("certd.maxPipelineCount"), t("certd.maxDeployCount"), t("certd.maxMonitorCount")],
|
||||
},
|
||||
price: {
|
||||
header: t("certd.price"),
|
||||
columns: [t("certd.durationPrices")],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
// id: {
|
||||
// title: "ID",
|
||||
// key: "id",
|
||||
// type: "number",
|
||||
// column: {
|
||||
// width: 100
|
||||
// },
|
||||
// form: {
|
||||
// show: false
|
||||
// }
|
||||
// },
|
||||
title: {
|
||||
title: t("certd.packageName"),
|
||||
type: "text",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
type: {
|
||||
title: t("certd.type"),
|
||||
type: "dict-select",
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.suite"), value: "suite" },
|
||||
{ label: t("certd.addon"), value: "addon" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: "suite",
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
helper: t("certd.typeHelper"),
|
||||
},
|
||||
column: {
|
||||
width: 80,
|
||||
align: "center",
|
||||
},
|
||||
valueBuilder: ({ row }) => {
|
||||
if (row.content) {
|
||||
row.content = JSON.parse(row.content);
|
||||
}
|
||||
if (row.durationPrices) {
|
||||
row.durationPrices = JSON.parse(row.durationPrices);
|
||||
}
|
||||
},
|
||||
valueResolve: ({ form }) => {
|
||||
if (form.content) {
|
||||
form.content = JSON.stringify(form.content);
|
||||
}
|
||||
if (form.durationPrices) {
|
||||
form.durationPrices = JSON.stringify(form.durationPrices);
|
||||
}
|
||||
},
|
||||
},
|
||||
"content.maxDomainCount": {
|
||||
title: t("certd.domainCount"),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxDomainCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitCount"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitCount"),
|
||||
},
|
||||
},
|
||||
},
|
||||
"content.maxPipelineCount": {
|
||||
title: t("certd.pipelineCount"),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxPipelineCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitPipeline"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitPipeline"),
|
||||
},
|
||||
},
|
||||
},
|
||||
"content.maxDeployCount": {
|
||||
title: t("certd.deployCount"),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxDeployCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitDeploy"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitDeploy"),
|
||||
},
|
||||
},
|
||||
},
|
||||
"content.maxMonitorCount": {
|
||||
title: t("certd.monitorCount"),
|
||||
type: "text",
|
||||
form: {
|
||||
key: ["content", "maxMonitorCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitCount"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unitCount"),
|
||||
},
|
||||
},
|
||||
},
|
||||
durationPrices: {
|
||||
title: t("certd.durationPriceTitle"),
|
||||
type: "text",
|
||||
form: {
|
||||
title: t("certd.selectDuration"),
|
||||
component: {
|
||||
name: PriceEdit,
|
||||
vModel: "modelValue",
|
||||
edit: true,
|
||||
style: {
|
||||
minHeight: "120px",
|
||||
},
|
||||
},
|
||||
col: {
|
||||
span: 24,
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
component: {
|
||||
name: DurationPriceValue,
|
||||
vModel: "modelValue",
|
||||
},
|
||||
width: 350,
|
||||
},
|
||||
},
|
||||
supportBuy: {
|
||||
title: t("certd.supportBuy"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.supportPurchase"), value: true, color: "success" },
|
||||
{ label: t("certd.cannotPurchase"), value: false, color: "gray" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: true,
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
},
|
||||
},
|
||||
disabled: {
|
||||
title: t("certd.shelfStatus"),
|
||||
type: "dict-radio",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ value: false, label: t("certd.onShelf"), color: "green" },
|
||||
{ value: true, label: t("certd.offShelf"), color: "gray" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
title: t("certd.ordera"),
|
||||
type: "number",
|
||||
form: {
|
||||
helper: t("certd.orderHelper"),
|
||||
value: 0,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
},
|
||||
},
|
||||
intro: {
|
||||
title: t("certd.description"),
|
||||
type: "textarea",
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.updateTime"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
show: true,
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import PriceInput from "./price-input.vue";
|
||||
import { durationDict } from "../../../certd/suite/api";
|
||||
|
||||
defineOptions({
|
||||
name: "DurationPriceValue"
|
||||
name: "DurationPriceValue",
|
||||
});
|
||||
|
||||
const props = withDefaults(
|
||||
@@ -23,7 +23,7 @@ const props = withDefaults(
|
||||
{
|
||||
modelValue: () => {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { durationDict } from "/@/views/certd/suite/api";
|
||||
|
||||
defineOptions({
|
||||
name: "DurationValue"
|
||||
name: "DurationValue",
|
||||
});
|
||||
const props = defineProps<{
|
||||
modelValue: number;
|
||||
|
||||
@@ -27,7 +27,7 @@ const props = withDefaults(
|
||||
{
|
||||
modelValue: () => {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
@@ -41,14 +41,14 @@ function doEmit(value: PriceItem[]) {
|
||||
}
|
||||
|
||||
function isActive(item: any) {
|
||||
return props.modelValue.some((v) => v.duration === item.value);
|
||||
return props.modelValue.some(v => v.duration === item.value);
|
||||
}
|
||||
|
||||
function onDurationClicked(item: any) {
|
||||
const has = props.modelValue.some((v) => v.duration === item.value);
|
||||
const has = props.modelValue.some(v => v.duration === item.value);
|
||||
if (has) {
|
||||
// remove
|
||||
const newValue = props.modelValue.filter((v) => v.duration !== item.value);
|
||||
const newValue = props.modelValue.filter(v => v.duration !== item.value);
|
||||
doEmit(newValue);
|
||||
} else {
|
||||
// add
|
||||
@@ -72,7 +72,7 @@ function onDurationClicked(item: any) {
|
||||
.duration-item {
|
||||
border: 1px solid #eee;
|
||||
padding: 2px;
|
||||
width: 35px;
|
||||
width: 45px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@ const target = computed(() => {
|
||||
return {
|
||||
value: -1,
|
||||
label: "无限制",
|
||||
color: "green"
|
||||
color: "green",
|
||||
};
|
||||
} else if (props.modelValue === 0) {
|
||||
return {
|
||||
value: 0,
|
||||
label: "0" + (props.unit || ""),
|
||||
color: "red"
|
||||
color: "red",
|
||||
};
|
||||
} else {
|
||||
let color = "blue";
|
||||
@@ -40,7 +40,7 @@ const target = computed(() => {
|
||||
return {
|
||||
value: props.modelValue,
|
||||
label: props.modelValue + (props.unit || ""),
|
||||
color: color
|
||||
color: color,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,23 +49,23 @@ import ProductManager from "/@/views/sys/suite/product/index.vue";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
|
||||
defineOptions({
|
||||
name: "SettingsSuite"
|
||||
name: "SettingsSuite",
|
||||
});
|
||||
|
||||
const api = {
|
||||
async SuiteSettingGet() {
|
||||
return await request({
|
||||
url: "/sys/settings/suite/get",
|
||||
method: "post"
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
async SuiteSettingSave(data: any) {
|
||||
return await request({
|
||||
url: "/sys/settings/suite/save",
|
||||
method: "post",
|
||||
data
|
||||
data,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const formRef = ref<any>(null);
|
||||
@@ -93,7 +93,7 @@ const onClick = async () => {
|
||||
await loadSettings();
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
message: "保存成功"
|
||||
message: "保存成功",
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { dict } from "@fast-crud/fast-crud";
|
||||
import { request } from "/@/api/service";
|
||||
|
||||
defineOptions({
|
||||
name: "SuiteDurationSelector"
|
||||
name: "SuiteDurationSelector",
|
||||
});
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -22,13 +22,13 @@ const suiteDictRef = dict({
|
||||
async getData() {
|
||||
const res = await request({
|
||||
url: "/sys/suite/product/list",
|
||||
method: "post"
|
||||
method: "post",
|
||||
});
|
||||
const options: any = [
|
||||
{
|
||||
value: "",
|
||||
label: "不赠送"
|
||||
}
|
||||
label: "不赠送",
|
||||
},
|
||||
];
|
||||
res.forEach((item: any) => {
|
||||
const durationPrices = JSON.parse(item.durationPrices);
|
||||
@@ -39,13 +39,13 @@ const suiteDictRef = dict({
|
||||
value: value,
|
||||
target: {
|
||||
productId: item.id,
|
||||
duration: dp.duration
|
||||
}
|
||||
duration: dp.duration,
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
return options;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const selectedValue = ref();
|
||||
@@ -53,7 +53,7 @@ watch(
|
||||
() => {
|
||||
return props.modelValue;
|
||||
},
|
||||
(value) => {
|
||||
value => {
|
||||
if (value && value.productId && value.duration) {
|
||||
selectedValue.value = value.productId + "_" + value.duration;
|
||||
} else {
|
||||
@@ -61,7 +61,7 @@ watch(
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
immediate: true,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -75,14 +75,14 @@ const onSelectedChange = (value: any) => {
|
||||
const arr = value.value.split("_");
|
||||
emit("update:modelValue", {
|
||||
productId: parseInt(arr[0]),
|
||||
duration: parseInt(arr[1])
|
||||
duration: parseInt(arr[1]),
|
||||
});
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
refresh() {
|
||||
suiteDictRef.reloadDict();
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export async function GetObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export async function GetDetail(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/detail",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export async function DeleteBatch(ids: any[]) {
|
||||
return await request({
|
||||
url: apiPrefix + "/deleteByIds",
|
||||
method: "post",
|
||||
data: { ids }
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export async function UpdatePaid(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/updatePaid",
|
||||
method: "post",
|
||||
data: { id }
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,6 +70,6 @@ export async function SyncStatus(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/syncStatus",
|
||||
method: "post",
|
||||
data: { id }
|
||||
data: { id },
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export const sysUserSuiteApi = {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query
|
||||
data: query,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ export const sysUserSuiteApi = {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -22,7 +22,7 @@ export const sysUserSuiteApi = {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
data: obj,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -30,7 +30,7 @@ export const sysUserSuiteApi = {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
},
|
||||
|
||||
@@ -38,13 +38,13 @@ export const sysUserSuiteApi = {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id }
|
||||
params: { id },
|
||||
});
|
||||
},
|
||||
async ListAll() {
|
||||
return await request({
|
||||
url: apiPrefix + "/all",
|
||||
method: "post"
|
||||
method: "post",
|
||||
});
|
||||
},
|
||||
|
||||
@@ -52,14 +52,14 @@ export const sysUserSuiteApi = {
|
||||
return await request({
|
||||
url: "/sys/authority/user/getSimpleUserByIds",
|
||||
method: "post",
|
||||
data: { ids }
|
||||
data: { ids },
|
||||
});
|
||||
},
|
||||
async PresentSuite(form: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/presentSuite",
|
||||
method: "post",
|
||||
data: form
|
||||
data: form,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -8,397 +8,396 @@ import createCrudOptionsUser from "/@/views/sys/authority/user/crud";
|
||||
import UserSuiteStatus from "/@/views/certd/suite/mine/user-suite-status.vue";
|
||||
import SuiteDurationSelector from "../setting/suite-duration-selector.vue";
|
||||
import dayjs from "dayjs";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
import { useI18n } from "/src/locales";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const api = sysUserSuiteApi;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async (req: EditReq) => {
|
||||
const { form, row } = req;
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async (req: DelReq) => {
|
||||
const { row } = req;
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const { t } = useI18n();
|
||||
const api = sysUserSuiteApi;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async (req: EditReq) => {
|
||||
const { form, row } = req;
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async (req: DelReq) => {
|
||||
const { row } = req;
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async (req: AddReq) => {
|
||||
const { form } = req;
|
||||
const res = await api.PresentSuite(form);
|
||||
return res;
|
||||
};
|
||||
const addRequest = async (req: AddReq) => {
|
||||
const { form } = req;
|
||||
const res = await api.PresentSuite(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
const router = useRouter();
|
||||
const router = useRouter();
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
span: null,
|
||||
style: {
|
||||
width: "100px"
|
||||
}
|
||||
},
|
||||
col: {
|
||||
span: 22
|
||||
},
|
||||
wrapper: {
|
||||
width: 600
|
||||
}
|
||||
},
|
||||
actionbar: {
|
||||
buttons: {
|
||||
add: { text: t('certd.gift_package') }
|
||||
}
|
||||
},
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
span: null,
|
||||
style: {
|
||||
width: "100px",
|
||||
},
|
||||
},
|
||||
col: {
|
||||
span: 22,
|
||||
},
|
||||
wrapper: {
|
||||
width: 600,
|
||||
},
|
||||
},
|
||||
actionbar: {
|
||||
buttons: {
|
||||
add: { text: t("certd.gift_package") },
|
||||
},
|
||||
},
|
||||
|
||||
toolbar: { show: false },
|
||||
rowHandle: {
|
||||
width: 200,
|
||||
fixed: "right",
|
||||
buttons: {
|
||||
view: { show: true },
|
||||
copy: { show: false },
|
||||
edit: { show: false },
|
||||
remove: { show: true }
|
||||
// continue:{
|
||||
// text:"续期",
|
||||
// type:"link",
|
||||
// click(){
|
||||
// console.log("续期");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
editable: {
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
title: {
|
||||
title: t('certd.package_name'),
|
||||
type: "text",
|
||||
search: {
|
||||
show: true
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 200
|
||||
}
|
||||
},
|
||||
userId: {
|
||||
title: t('certd.usera'),
|
||||
type: "table-select",
|
||||
search: {
|
||||
show: true
|
||||
},
|
||||
dict: dict({
|
||||
async getNodesByValues(ids: number[]) {
|
||||
return await api.GetSimpleUserByIds(ids);
|
||||
},
|
||||
value: "id",
|
||||
label: "nickName"
|
||||
}),
|
||||
form: {
|
||||
component: {
|
||||
crossPage: true,
|
||||
multiple: false,
|
||||
select: {
|
||||
placeholder: t('certd.click_to_select')
|
||||
},
|
||||
createCrudOptions: createCrudOptionsUser
|
||||
// crudOptionsOverride: crudOptionsOverride
|
||||
}
|
||||
}
|
||||
},
|
||||
//赠送
|
||||
presentSuiteId: {
|
||||
title: t('certd.gift_package'),
|
||||
type: "dict-select",
|
||||
column: { show: false },
|
||||
addForm: {
|
||||
show: true,
|
||||
component: {
|
||||
name: SuiteDurationSelector,
|
||||
vModel: "modelValue"
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
validator: async (rule, value) => {
|
||||
if (value && value.productId) {
|
||||
return true;
|
||||
}
|
||||
throw new Error(t('certd.please_select_package'));
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
valueResolve({ form, value }) {
|
||||
if (value && value.productId) {
|
||||
form.productId = value.productId;
|
||||
form.duration = value.duration;
|
||||
}
|
||||
},
|
||||
form: { show: false }
|
||||
},
|
||||
productType: {
|
||||
title: t('certd.type'),
|
||||
type: "dict-select",
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t('certd.package'), value: "suite", color: "green" },
|
||||
{ label: t('certd.addon_package'), value: "addon", color: "blue" }
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 80,
|
||||
align: "center"
|
||||
},
|
||||
valueBuilder: ({ row }) => {
|
||||
if (row.content) {
|
||||
row.content = JSON.parse(row.content);
|
||||
}
|
||||
},
|
||||
valueResolve: ({ form }) => {
|
||||
if (form.content) {
|
||||
form.content = JSON.stringify(form.content);
|
||||
}
|
||||
}
|
||||
},
|
||||
"content.maxDomainCount": {
|
||||
title: t('certd.domain_count'),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxDomainCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_count')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.field_required') }]
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_count')
|
||||
},
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
"content.maxPipelineCount": {
|
||||
title: t('certd.pipeline_count'),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxPipelineCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_item')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.field_required') }]
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_item')
|
||||
},
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
"content.maxDeployCount": {
|
||||
title: t('certd.deploy_count'),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxDeployCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_times')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.field_required') }]
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_times'),
|
||||
used: compute(({ row }) => {
|
||||
return row.deployCountUsed;
|
||||
})
|
||||
},
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
"content.maxMonitorCount": {
|
||||
title: t('certd.monitor_count'),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxMonitorCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_count')
|
||||
},
|
||||
rules: [{ required: true, message: t('certd.field_required') }]
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t('certd.unit_count')
|
||||
},
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
duration: {
|
||||
title: t('certd.duration'),
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: {
|
||||
component: {
|
||||
name: DurationValue,
|
||||
vModel: "modelValue"
|
||||
},
|
||||
width: 100,
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
status: {
|
||||
title: t('certd.status'),
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
component: {
|
||||
name: UserSuiteStatus,
|
||||
userSuite: compute(({ row }) => {
|
||||
return row;
|
||||
})
|
||||
},
|
||||
conditionalRender: {
|
||||
match() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
activeTime: {
|
||||
title: t('certd.active_time'),
|
||||
type: "date",
|
||||
column: {
|
||||
width: 150
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
expiresTime: {
|
||||
title: t('certd.expires_time'),
|
||||
type: "date",
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 150,
|
||||
component: {
|
||||
name: "expires-time-text",
|
||||
vModel: "value",
|
||||
mode: "tag",
|
||||
title: compute(({ value }) => {
|
||||
return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
isPresent: {
|
||||
title: t('certd.is_present'),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t('certd.is_present_yes'), value: true, color: "success" },
|
||||
{ label: t('certd.is_present_no'), value: false, color: "blue" }
|
||||
]
|
||||
}),
|
||||
form: {
|
||||
value: true,
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
createTime: {
|
||||
title: t('certd.create_time'),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
align: "center"
|
||||
}
|
||||
},
|
||||
updateTime: {
|
||||
title: t('certd.update_time'),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false
|
||||
},
|
||||
column: {
|
||||
show: true,
|
||||
width: 160
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
toolbar: { show: false },
|
||||
rowHandle: {
|
||||
width: 200,
|
||||
fixed: "right",
|
||||
buttons: {
|
||||
view: { show: true },
|
||||
copy: { show: false },
|
||||
edit: { show: false },
|
||||
remove: { show: true },
|
||||
// continue:{
|
||||
// text:"续期",
|
||||
// type:"link",
|
||||
// click(){
|
||||
// console.log("续期");
|
||||
// }
|
||||
// }
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
editable: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
title: {
|
||||
title: t("certd.package_name"),
|
||||
type: "text",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
userId: {
|
||||
title: t("certd.usera"),
|
||||
type: "table-select",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
dict: dict({
|
||||
async getNodesByValues(ids: number[]) {
|
||||
return await api.GetSimpleUserByIds(ids);
|
||||
},
|
||||
value: "id",
|
||||
label: "nickName",
|
||||
}),
|
||||
form: {
|
||||
component: {
|
||||
crossPage: true,
|
||||
multiple: false,
|
||||
select: {
|
||||
placeholder: t("certd.click_to_select"),
|
||||
},
|
||||
createCrudOptions: createCrudOptionsUser,
|
||||
// crudOptionsOverride: crudOptionsOverride
|
||||
},
|
||||
},
|
||||
},
|
||||
//赠送
|
||||
presentSuiteId: {
|
||||
title: t("certd.gift_package"),
|
||||
type: "dict-select",
|
||||
column: { show: false },
|
||||
addForm: {
|
||||
show: true,
|
||||
component: {
|
||||
name: SuiteDurationSelector,
|
||||
vModel: "modelValue",
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
validator: async (rule, value) => {
|
||||
if (value && value.productId) {
|
||||
return true;
|
||||
}
|
||||
throw new Error(t("certd.please_select_package"));
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
valueResolve({ form, value }) {
|
||||
if (value && value.productId) {
|
||||
form.productId = value.productId;
|
||||
form.duration = value.duration;
|
||||
}
|
||||
},
|
||||
form: { show: false },
|
||||
},
|
||||
productType: {
|
||||
title: t("certd.type"),
|
||||
type: "dict-select",
|
||||
editForm: {
|
||||
component: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.package"), value: "suite", color: "green" },
|
||||
{ label: t("certd.addon_package"), value: "addon", color: "blue" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 80,
|
||||
align: "center",
|
||||
},
|
||||
valueBuilder: ({ row }) => {
|
||||
if (row.content) {
|
||||
row.content = JSON.parse(row.content);
|
||||
}
|
||||
},
|
||||
valueResolve: ({ form }) => {
|
||||
if (form.content) {
|
||||
form.content = JSON.stringify(form.content);
|
||||
}
|
||||
},
|
||||
},
|
||||
"content.maxDomainCount": {
|
||||
title: t("certd.domain_count"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxDomainCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_count"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.field_required") }],
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_count"),
|
||||
},
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
"content.maxPipelineCount": {
|
||||
title: t("certd.pipeline_count"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxPipelineCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_item"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.field_required") }],
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_item"),
|
||||
},
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
"content.maxDeployCount": {
|
||||
title: t("certd.deploy_count"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxDeployCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_times"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.field_required") }],
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_times"),
|
||||
used: compute(({ row }) => {
|
||||
return row.deployCountUsed;
|
||||
}),
|
||||
},
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
"content.maxMonitorCount": {
|
||||
title: t("certd.monitor_count"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
key: ["content", "maxMonitorCount"],
|
||||
component: {
|
||||
name: SuiteValueEdit,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_count"),
|
||||
},
|
||||
rules: [{ required: true, message: t("certd.field_required") }],
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
component: {
|
||||
name: SuiteValue,
|
||||
vModel: "modelValue",
|
||||
unit: t("certd.unit_count"),
|
||||
},
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
duration: {
|
||||
title: t("certd.duration"),
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: {
|
||||
component: {
|
||||
name: DurationValue,
|
||||
vModel: "modelValue",
|
||||
},
|
||||
width: 100,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
status: {
|
||||
title: t("certd.status"),
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
component: {
|
||||
name: UserSuiteStatus,
|
||||
userSuite: compute(({ row }) => {
|
||||
return row;
|
||||
}),
|
||||
},
|
||||
conditionalRender: {
|
||||
match() {
|
||||
return false;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
activeTime: {
|
||||
title: t("certd.active_time"),
|
||||
type: "date",
|
||||
column: {
|
||||
width: 150,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
expiresTime: {
|
||||
title: t("certd.expires_time"),
|
||||
type: "date",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 150,
|
||||
component: {
|
||||
name: "expires-time-text",
|
||||
vModel: "value",
|
||||
mode: "tag",
|
||||
title: compute(({ value }) => {
|
||||
return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
isPresent: {
|
||||
title: t("certd.is_present"),
|
||||
type: "dict-switch",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.is_present_yes"), value: true, color: "success" },
|
||||
{ label: t("certd.is_present_no"), value: false, color: "blue" },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
value: true,
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.create_time"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.update_time"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
show: true,
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user