Add other translations

pull/436/head
Lorenzo 2025-06-27 00:39:00 +02:00
parent 0b3472d227
commit adc3ab7e0a
12 changed files with 2167 additions and 1929 deletions

View File

@ -344,4 +344,107 @@ export default {
openApi: "Open API", openApi: "Open API",
contentPart2: " request testing", contentPart2: " request testing",
}, },
pending_cname_setup: "Pending CNAME setup",
validating: "Validating",
validation_successful: "Validation successful",
validation_failed: "Validation failed",
validation_timed_out: "Validation timed out",
proxied_domain: "Proxied Domain",
host_record: "Host Record",
please_set_cname: "Please set CNAME",
cname_service: "CNAME Service",
default_public_cname: "Default public CNAME service, you can also ",
customize_cname: "Customize CNAME Service",
public_cname: "Public CNAME",
custom_cname: "Custom CNAME",
validate: "Validate",
validation_started: "Validation started, please wait patiently",
click_to_validate: "Click to Validate",
all: "All",
cname_feature_guide: "CNAME feature principle and usage guide",
batch_delete: "Batch Delete",
confirm_delete_count: "Are you sure to delete these {count} records in batch?",
delete_successful: "Delete successful",
please_select_records: "Please select records first",
edit_notification: "Edit Notification",
other_notification_method: "Other Notification Method",
trigger_time: "Trigger Time",
start_time: "At Start",
success_time: "On Success",
fail_to_success_time: "Fail to Success",
fail_time: "On Failure",
helper_suggest_fail_only: "It is recommended to select only 'On Failure' and 'Fail to Success'",
notification_config: "Notification Configuration",
please_select_notification: "Please select a notification method",
please_select_type: "Please select type",
please_select_trigger_time: "Please select notification trigger time",
please_select_notification_config: "Please select notification configuration",
confirm_delete_trigger: "Are you sure you want to delete this trigger?",
gift_package: "Gift Package",
package_name: "Package Name",
click_to_select: "Click to select",
please_select_package: "Please select a package",
package: "Package",
addon_package: "Addon Package",
domain_count: "Domain Count",
unit_count: "pcs",
field_required: "This field is required",
pipeline_count: "Pipeline Count",
unit_item: "items",
deploy_count: "Deploy Count",
unit_times: "times",
monitor_count: "Certificate Monitor Count",
duration: "Duration",
status: "Status",
active_time: "Activation Time",
expires_time: "Expiration Time",
is_present: "Is Present",
is_present_yes: "Yes",
is_present_no: "No",
basicInfo: "Basic Information",
titlea: "Title",
disabled: "Disabled",
ordera: "Order",
supportBuy: "Support Purchase",
intro: "Introduction",
packageContent: "Package Content",
maxDomainCount: "Max Domain Count",
maxPipelineCount: "Max Pipeline Count",
maxDeployCount: "Max Deploy Count",
maxMonitorCount: "Max Monitor Count",
price: "Price",
durationPrices: "Duration Prices",
packageName: "Package Name",
addon: "Addon",
typeHelper: "Suite: Only the most recently purchased one is active at a time\nAddon: Multiple can be purchased, effective immediately without affecting the suite\nThe quantities of suite and addon can be accumulated",
domainCount: "Domain Count",
pipelineCount: "Pipeline Count",
unitPipeline: "pipelines",
deployCount: "Deployment Count",
unitDeploy: "times",
monitorCount: "Certificate Monitor Count",
unitCount: "pcs",
durationPriceTitle: "Duration and Price",
selectDuration: "Select Duration",
supportPurchase: "Support Purchase",
cannotPurchase: "Cannot Purchase",
shelfStatus: "Shelf Status",
onShelf: "On Shelf",
offShelf: "Off Shelf",
orderHelper: "Smaller values appear first",
description: "Description",
createTime: "Creation Time",
updateTime: "Update Time",
edit: "Edit",
groupName: "Group Name",
enterGroupName: "Please enter group name",
subdomainHosting: "Subdomain Hosting",
subdomainHostingHint: "When your domain has subdomain hosting set, you need to create records here, otherwise certificate application will fail",
batchDeleteConfirm: "Are you sure to batch delete these {count} records?",
selectRecordFirst: "Please select records first",
subdomainHosted: "Hosted Subdomain",
subdomainHelpText: "If you don't understand what subdomain hosting is, please refer to the documentation ",
subdomainManagement: "Subdomain Management",
isDisabled: "Is Disabled",
enabled: "Enabled",
}; };

View File

@ -350,4 +350,107 @@ export default {
openApi: "开放接口", openApi: "开放接口",
contentPart2: "请求测试", contentPart2: "请求测试",
}, },
pending_cname_setup: "待设置CNAME",
validating: "验证中",
validation_successful: "验证成功",
validation_failed: "验证失败",
validation_timed_out: "验证超时",
proxied_domain: "被代理域名",
host_record: "主机记录",
please_set_cname: "请设置CNAME",
cname_service: "CNAME服务",
default_public_cname: "默认提供公共CNAME服务您还可以",
customize_cname: "自定义CNAME服务",
public_cname: "公共CNAME",
custom_cname: "自定义CNAME",
validate: "验证",
validation_started: "开始验证,请耐心等待",
click_to_validate: "点击验证",
all: "全部",
cname_feature_guide: "CNAME功能原理及使用说明",
batch_delete: "批量删除",
confirm_delete_count: "确定要批量删除这{count}条记录吗",
delete_successful: "删除成功",
please_select_records: "请先勾选记录",
edit_notification: "编辑通知",
other_notification_method: "其他通知方式",
trigger_time: "触发时机",
start_time: "开始时",
success_time: "成功时",
fail_to_success_time: "失败转成功时",
fail_time: "失败时",
helper_suggest_fail_only: "建议仅选择'失败时'和'失败转成功'两种即可",
notification_config: "通知配置",
please_select_notification: "请选择通知方式",
please_select_type: "请选择类型",
please_select_trigger_time: "请选择通知时机",
please_select_notification_config: "请选择通知配置",
confirm_delete_trigger: "确定要删除此触发器吗?",
gift_package: "赠送套餐",
package_name: "套餐名称",
click_to_select: "点击选择",
please_select_package: "请选择套餐",
package: "套餐",
addon_package: "加量包",
domain_count: "域名数量",
unit_count: "个",
field_required: "此项必填",
pipeline_count: "流水线数量",
unit_item: "条",
deploy_count: "部署次数",
unit_times: "次",
monitor_count: "证书监控数量",
duration: "时长",
status: "状态",
active_time: "激活时间",
expires_time: "过期时间",
is_present: "是否赠送",
is_present_yes: "是",
is_present_no: "否",
basicInfo: "基础信息",
titlea: "名称",
disabled: "是否禁用",
ordera: "排序",
supportBuy: "支持购买",
intro: "介绍",
packageContent: "套餐内容",
maxDomainCount: "最大域名数",
maxPipelineCount: "最大流水线数",
maxDeployCount: "最大部署数",
maxMonitorCount: "最大监控数",
price: "价格",
durationPrices: "时长价格",
packageName: "套餐名称",
addon: "加量包",
typeHelper: "套餐:同一时间只有最新购买的一个生效\n加量包可购买多个购买后立即生效不影响套餐\n套餐和加量包数量可叠加",
domainCount: "域名数量",
pipelineCount: "流水线数量",
unitPipeline: "条",
deployCount: "部署次数",
unitDeploy: "次",
monitorCount: "证书监控数量",
unitCount: "个",
durationPriceTitle: "时长及价格",
selectDuration: "选择时长",
supportPurchase: "支持购买",
cannotPurchase: "不能购买",
shelfStatus: "上下架",
onShelf: "上架",
offShelf: "下架",
orderHelper: "越小越靠前",
description: "说明",
createTime: "创建时间",
updateTime: "更新时间",
edit: "编辑",
groupName: "分组名称",
enterGroupName: "请输入分组名称",
subdomainHosting: "子域名托管",
subdomainHostingHint: "当你的域名设置了子域名托管,需要在此处创建记录,否则申请证书将失败",
batchDeleteConfirm: "确定要批量删除这{count}条记录吗",
selectRecordFirst: "请先勾选记录",
subdomainHosted: "托管的子域名",
subdomainHelpText: "如果您不理解什么是子域托管,可以参考文档",
subdomainManagement: "子域管理",
isDisabled: "是否禁用",
enabled: "启用",
}; };

View File

@ -3,159 +3,159 @@ import * as api from "./api.plugin";
import { DynamicType, FormItemProps } from "@fast-crud/fast-crud"; import { DynamicType, FormItemProps } from "@fast-crud/fast-crud";
interface PluginState { interface PluginState {
group?: PluginGroups; group?: PluginGroups;
} }
export type PluginGroup = { export type PluginGroup = {
key: string; key: string;
title: string; title: string;
desc?: string; desc?: string;
order: number; order: number;
icon: string; icon: string;
plugins: any[]; plugins: any[];
}; };
export type PluginDefine = { export type PluginDefine = {
name: string; name: string;
title: string; title: string;
desc?: string; desc?: string;
shortcut: any; shortcut: any;
input: { input: {
[key: string]: DynamicType<FormItemProps>; [key: string]: DynamicType<FormItemProps>;
}; };
output: { output: {
[key: string]: any; [key: string]: any;
}; };
}; };
export class PluginGroups { export class PluginGroups {
groups!: { [key: string]: PluginGroup }; groups!: { [key: string]: PluginGroup };
map!: { [key: string]: PluginDefine }; map!: { [key: string]: PluginDefine };
constructor(groups: { [key: string]: PluginGroup }) { constructor(groups: { [key: string]: PluginGroup }) {
this.groups = groups; this.groups = groups;
this.initGroup(groups); this.initGroup(groups);
this.initMap(); this.initMap();
} }
private initGroup(groups: { [p: string]: PluginGroup }) { private initGroup(groups: { [p: string]: PluginGroup }) {
const all: PluginGroup = { const all: PluginGroup = {
key: "all", key: "all",
title: "全部", title: t('certd.all'),
order: 0, order: 0,
plugins: [], plugins: [],
icon: "material-symbols:border-all-rounded", icon: "material-symbols:border-all-rounded",
}; };
for (const key in groups) { for (const key in groups) {
all.plugins.push(...groups[key].plugins); all.plugins.push(...groups[key].plugins);
} }
this.groups = { this.groups = {
all, all,
...groups, ...groups,
}; };
} }
initMap() { initMap() {
const map: { [key: string]: PluginDefine } = {}; const map: { [key: string]: PluginDefine } = {};
for (const key in this.groups) { for (const key in this.groups) {
const group = this.groups[key]; const group = this.groups[key];
for (const plugin of group.plugins) { for (const plugin of group.plugins) {
map[plugin.name] = plugin; map[plugin.name] = plugin;
} }
} }
this.map = map; this.map = map;
} }
getGroups() { getGroups() {
return this.groups; return this.groups;
} }
get(name: string) { get(name: string) {
return this.map[name]; return this.map[name];
} }
getPreStepOutputOptions({ pipeline, currentStageIndex, currentTaskIndex, currentStepIndex, currentTask }: any) { getPreStepOutputOptions({ pipeline, currentStageIndex, currentTaskIndex, currentStepIndex, currentTask }: any) {
const steps = this.collectionPreStepOutputs({ const steps = this.collectionPreStepOutputs({
pipeline, pipeline,
currentStageIndex, currentStageIndex,
currentTaskIndex, currentTaskIndex,
currentStepIndex, currentStepIndex,
currentTask, currentTask,
}); });
const options: any[] = []; const options: any[] = [];
for (const step of steps) { for (const step of steps) {
const stepDefine = this.get(step.type); const stepDefine = this.get(step.type);
for (const key in stepDefine?.output) { for (const key in stepDefine?.output) {
options.push({ options.push({
value: `step.${step.id}.${key}`, value: `step.${step.id}.${key}`,
label: `${stepDefine.output[key].title}【from${step.title}`, label: `${stepDefine.output[key].title}【from${step.title}`,
type: step.type, type: step.type,
}); });
} }
} }
return options; return options;
} }
collectionPreStepOutputs({ pipeline, currentStageIndex, currentTaskIndex, currentStepIndex, currentTask }: any) { collectionPreStepOutputs({ pipeline, currentStageIndex, currentTaskIndex, currentStepIndex, currentTask }: any) {
const steps: any[] = []; const steps: any[] = [];
// 开始放step // 开始放step
for (let i = 0; i < currentStageIndex; i++) { for (let i = 0; i < currentStageIndex; i++) {
const stage = pipeline.stages[i]; const stage = pipeline.stages[i];
for (const task of stage.tasks) { for (const task of stage.tasks) {
for (const step of task.steps) { for (const step of task.steps) {
steps.push(step); steps.push(step);
} }
} }
} }
//当前阶段之前的task //当前阶段之前的task
const currentStage = pipeline.stages[currentStageIndex]; const currentStage = pipeline.stages[currentStageIndex];
for (let i = 0; i < currentTaskIndex; i++) { for (let i = 0; i < currentTaskIndex; i++) {
const task = currentStage.tasks[i]; const task = currentStage.tasks[i];
for (const step of task.steps) { for (const step of task.steps) {
steps.push(step); steps.push(step);
} }
} }
//放当前任务下的step //放当前任务下的step
for (let i = 0; i < currentStepIndex; i++) { for (let i = 0; i < currentStepIndex; i++) {
const step = currentTask.steps[i]; const step = currentTask.steps[i];
steps.push(step); steps.push(step);
} }
return steps; return steps;
} }
} }
export const usePluginStore = defineStore({ export const usePluginStore = defineStore({
id: "app.plugin", id: "app.plugin",
state: (): PluginState => ({ state: (): PluginState => ({
group: null, group: null,
}), }),
actions: { actions: {
async reload() { async reload() {
const groups = await api.GetGroups({}); const groups = await api.GetGroups({});
this.group = new PluginGroups(groups); this.group = new PluginGroups(groups);
}, },
async init() { async init() {
if (!this.group) { if (!this.group) {
await this.reload(); await this.reload();
} }
return this.group; return this.group;
}, },
async getGroups(): Promise<PluginGroups> { async getGroups(): Promise<PluginGroups> {
await this.init(); await this.init();
return this.group as PluginGroups; return this.group as PluginGroups;
}, },
async clear() { async clear() {
this.group = null; this.group = null;
}, },
async getList(): Promise<PluginDefine[]> { async getList(): Promise<PluginDefine[]> {
await this.init(); await this.init();
return this.group.groups.all.plugins; return this.group.groups.all.plugins;
}, },
async getPluginDefine(name: string): Promise<PluginDefine> { async getPluginDefine(name: string): Promise<PluginDefine> {
await this.init(); await this.init();
return this.group.get(name); return this.group.get(name);
}, },
async getPluginConfig(query: any) { async getPluginConfig(query: any) {
return await api.GetPluginConfig(query); return await api.GetPluginConfig(query);
}, },
}, },
}); });

View File

@ -8,271 +8,272 @@ import { useSettingStore } from "/@/store/settings";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import CnameTip from "/@/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue"; import CnameTip from "/@/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter(); const router = useRouter();
const { t } = useI18n(); const { t } = useI18n();
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query); return await api.GetList(query);
}; };
const editRequest = async ({ form, row }: EditReq) => { const editRequest = async ({ form, row }: EditReq) => {
form.id = row.id; form.id = row.id;
const res = await api.UpdateObj(form); const res = await api.UpdateObj(form);
return res; return res;
}; };
const delRequest = async ({ row }: DelReq) => { const delRequest = async ({ row }: DelReq) => {
return await api.DelObj(row.id); return await api.DelObj(row.id);
}; };
const addRequest = async ({ form }: AddReq) => { const addRequest = async ({ form }: AddReq) => {
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };
const userStore = useUserStore(); const userStore = useUserStore();
const settingStore = useSettingStore(); const settingStore = useSettingStore();
const selectedRowKeys: Ref<any[]> = ref([]); const selectedRowKeys: Ref<any[]> = ref([]);
context.selectedRowKeys = selectedRowKeys; context.selectedRowKeys = selectedRowKeys;
const dictRef = dict({ const dictRef = dict({
data: [ data: [
{ label: "待设置CNAME", value: "cname", color: "warning" }, { label: t('certd.pending_cname_setup'), value: "cname", color: "warning" },
{ label: "验证中", value: "validating", color: "blue" }, { label: t('certd.validating'), value: "validating", color: "blue" },
{ label: "验证成功", value: "valid", color: "green" }, { label: t('certd.validation_successful'), value: "valid", color: "green" },
{ label: "验证失败", value: "failed", color: "red" }, { label: t('certd.validation_failed'), value: "failed", color: "red" },
{ label: "验证超时", value: "timeout", color: "red" }, { label: t('certd.validation_timed_out'), value: "timeout", color: "red" },
], ],
}); });
return { return {
crudOptions: { crudOptions: {
settings: { settings: {
plugins: { plugins: {
//这里使用行选择插件生成行选择crudOptions配置最终会与crudOptions合并 //这里使用行选择插件生成行选择crudOptions配置最终会与crudOptions合并
rowSelection: { rowSelection: {
enabled: true, enabled: true,
order: -2, order: -2,
before: true, before: true,
// handle: (pluginProps,useCrudProps)=>CrudOptions, // handle: (pluginProps,useCrudProps)=>CrudOptions,
props: { props: {
multiple: true, multiple: true,
crossPage: true, crossPage: true,
selectedRowKeys, selectedRowKeys,
}, },
}, },
}, },
}, },
request: { request: {
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest, delRequest,
}, },
tabs: { tabs: {
name: "status", name: "status",
show: true, show: true,
}, },
rowHandle: { rowHandle: {
minWidth: 200, minWidth: 200,
fixed: "right", fixed: "right",
}, },
columns: { columns: {
id: { id: {
title: "ID", title: "ID",
key: "id", key: "id",
type: "number", type: "number",
column: { column: {
width: 80, width: 80,
}, },
form: { form: {
show: false, show: false,
}, },
}, },
domain: { domain: {
title: "被代理域名", title: t('certd.proxied_domain'),
type: "text", type: "text",
search: { search: {
show: true, show: true,
}, },
editForm: { editForm: {
component: { component: {
disabled: true, disabled: true,
}, },
}, },
}, },
hostRecord: { hostRecord: {
title: "主机记录", title: t('certd.host_record'),
type: "text", type: "text",
form: { form: {
show: false, show: false,
}, },
column: { column: {
width: 250, width: 250,
cellRender: ({ value }) => { cellRender: ({ value }) => {
return <fs-copyable v-model={value} />; return <fs-copyable v-model={value} />;
}, },
}, },
}, },
recordValue: { recordValue: {
title: "请设置CNAME", title: t('certd.please_set_cname'),
type: "copyable", type: "copyable",
form: { form: {
show: false, show: false,
}, },
column: { column: {
width: 500, width: 500,
}, },
}, },
cnameProviderId: { cnameProviderId: {
title: "CNAME服务", title: t('certd.cname_service'),
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
url: "/cname/provider/list", url: "/cname/provider/list",
value: "id", value: "id",
label: "domain", label: "domain",
}), }),
form: { form: {
component: { component: {
onDictChange: ({ form, dict }: any) => { onDictChange: ({ form, dict }: any) => {
if (!form.cnameProviderId) { if (!form.cnameProviderId) {
const list = dict.data.filter((item: any) => { const list = dict.data.filter((item: any) => {
return !item.disabled; return !item.disabled;
}); });
let item = list.find((item: any) => item.isDefault); let item = list.find((item: any) => item.isDefault);
if (!item && list.length > 0) { if (!item && list.length > 0) {
item = list[0]; item = list[0];
} }
if (item) { if (item) {
form.cnameProviderId = item.id; form.cnameProviderId = item.id;
} }
} }
}, },
renderLabel(item: any) { renderLabel(item: any) {
if (item.title) { if (item.title) {
return `${item.domain}<${item.title}>`; return `${item.domain}<${item.title}>`;
} else { } else {
return item.domain; return item.domain;
} }
}, },
}, },
helper: { helper: {
render() { render() {
const closeForm = () => { const closeForm = () => {
crudExpose.getFormWrapperRef().close(); crudExpose.getFormWrapperRef().close();
}; };
return ( return (
<div> <div>
CNAME {t('certd.default_public_cname')}
<router-link to={"/sys/cname/provider"} onClick={closeForm}> <router-link to={"/sys/cname/provider"} onClick={closeForm}>
CNAME {t('certd.customize_cname')}
</router-link> </router-link>
</div> </div>
); );
}, },
}, },
}, },
column: { column: {
width: 120, width: 120,
align: "center", align: "center",
cellRender({ value }) { cellRender({ value }) {
if (value < 0) { if (value < 0) {
return <a-tag color={"green"}>CNAME</a-tag>; return <a-tag color={"green"}>{t('certd.public_cname')}</a-tag>;
} else { } else {
return <a-tag color={"blue"}>CNAME</a-tag>; return <a-tag color={"blue"}>{t('certd.custom_cname')}</a-tag>;
} }
}, },
}, },
}, },
status: { status: {
title: "状态", title: t('certd.fields.status'),
type: "dict-select", type: "dict-select",
dict: dictRef, dict: dictRef,
addForm: { addForm: {
show: false, show: false,
}, },
column: { column: {
width: 120, width: 120,
align: "center", align: "center",
cellRender({ value, row }) { cellRender({ value, row }) {
return ( return (
<div class={"flex flex-center"}> <div class={"flex flex-center"}>
<fs-values-format modelValue={value} dict={dictRef}></fs-values-format> <fs-values-format modelValue={value} dict={dictRef}></fs-values-format>
{row.error && ( {row.error && (
<a-tooltip title={row.error}> <a-tooltip title={row.error}>
<fs-icon class={"ml-5 color-red"} icon="ion:warning-outline"></fs-icon> <fs-icon class={"ml-5 color-red"} icon="ion:warning-outline"></fs-icon>
</a-tooltip> </a-tooltip>
)} )}
</div> </div>
); );
}, },
}, },
}, },
triggerValidate: { triggerValidate: {
title: "验证", title: t('certd.validate'),
type: "text", type: "text",
form: { form: {
show: false, show: false,
}, },
column: { column: {
conditionalRenderDisabled: true, conditionalRenderDisabled: true,
width: 130, width: 130,
align: "center", align: "center",
cellRender({ row, value }) { cellRender({ row, value }) {
if (row.status === "valid") { if (row.status === "valid") {
return "-"; return "-";
} }
async function doVerify() { async function doVerify() {
row._validating_ = true; row._validating_ = true;
try { try {
const res = await api.DoVerify(row.id); const res = await api.DoVerify(row.id);
if (res === true) { if (res === true) {
message.success("验证成功"); message.success(t('certd.validation_successful'));
row.status = "valid"; row.status = "valid";
} else if (res === false) { } else if (res === false) {
message.success("验证超时"); message.success(t('certd.validation_timed_out'));
row.status = "timeout"; row.status = "timeout";
} else { } else {
message.success("开始验证,请耐心等待"); message.success(t('certd.validation_started'));
} }
await crudExpose.doRefresh(); await crudExpose.doRefresh();
} catch (e: any) { } catch (e: any) {
console.error(e); console.error(e);
message.error(e.message); message.error(e.message);
} finally { } finally {
row._validating_ = false; row._validating_ = false;
} }
} }
return (
<div> return (
<a-button onClick={doVerify} loading={row._validating_} size={"small"} type={"primary"}> <div>
<a-button onClick={doVerify} loading={row._validating_} size={"small"} type={"primary"}>
</a-button> {t('certd.click_to_validate')}
<CnameTip record={row} /> </a-button>
</div> <CnameTip record={row} />
); </div>
}, );
}, },
}, },
createTime: { },
title: "创建时间", createTime: {
type: "datetime", title: t('certd.create_time'),
form: { type: "datetime",
show: false, form: {
}, show: false,
column: { },
sorter: true, column: {
width: 160, sorter: true,
align: "center", width: 160,
}, align: "center",
}, },
updateTime: { },
title: "更新时间", updateTime: {
type: "datetime", title: t('certd.update_time'),
form: { type: "datetime",
show: false, form: {
}, show: false,
column: { },
show: true, column: {
}, show: true,
}, },
}, },
}, },
}; },
};
} }

View File

@ -1,59 +1,66 @@
<template> <template>
<fs-page class="page-cert"> <fs-page class="page-cert">
<template #header> <template #header>
<div class="title"> <div class="title">
CNAME记录管理 {{ t('certd.cnameRecord') }}
<span class="sub"> <span class="sub">
<a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">CNAME功能原理及使用说明</a> <a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">
</span> {{ t('certd.cname_feature_guide') }}
</div> </a>
</template> </span>
<fs-crud ref="crudRef" v-bind="crudBinding"> </div>
<template #pagination-left> </template>
<a-tooltip title="批量删除"> <fs-crud ref="crudRef" v-bind="crudBinding">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button> <template #pagination-left>
</a-tooltip> <a-tooltip :title="t('certd.batch_delete')">
</template> <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</fs-crud> </a-tooltip>
</fs-page> </template>
</fs-crud>
</fs-page>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onActivated, onMounted } from "vue"; import { onActivated, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "CnameRecord", name: "CnameRecord",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions }); const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
if (selectedRowKeys.value?.length > 0) { if (selectedRowKeys.value?.length > 0) {
Modal.confirm({ Modal.confirm({
title: "确认", title: t('certd.confirm'),
content: `确定要批量删除这${selectedRowKeys.value.length}条记录吗`, content: t('certd.confirm_delete_count', { count: selectedRowKeys.value.length }),
async onOk() { async onOk() {
await DeleteBatch(selectedRowKeys.value); await DeleteBatch(selectedRowKeys.value);
message.info("删除成功"); message.info(t('certd.delete_successful'));
crudExpose.doRefresh(); crudExpose.doRefresh();
selectedRowKeys.value = []; selectedRowKeys.value = [];
}, },
}); });
} else { } else {
message.error("请先勾选记录"); message.error(t('certd.please_select_records'));
} }
}; };
// //
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
}); });
onActivated(async () => { onActivated(async () => {
await crudExpose.doRefresh(); await crudExpose.doRefresh();
}); });
</script> </script>
<style lang="less"></style> <style lang="less"></style>

View File

@ -5,130 +5,131 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
import { pipelineGroupApi } from "./api"; import { pipelineGroupApi } from "./api";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const api = pipelineGroupApi; const { t } = useI18n();
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const api = pipelineGroupApi;
return await api.GetList(query); const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
}; return await api.GetList(query);
const editRequest = async (req: EditReq) => { };
const { form, row } = req; const editRequest = async (req: EditReq) => {
form.id = row.id; const { form, row } = req;
const res = await api.UpdateObj(form); form.id = row.id;
return res; const res = await api.UpdateObj(form);
}; return res;
const delRequest = async (req: DelReq) => { };
const { row } = req; const delRequest = async (req: DelReq) => {
return await api.DelObj(row.id); const { row } = req;
}; return await api.DelObj(row.id);
};
const addRequest = async (req: AddReq) => { const addRequest = async (req: AddReq) => {
const { form } = req; const { form } = req;
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };
return { return {
crudOptions: { crudOptions: {
settings: { settings: {
plugins: { plugins: {
mobile: { mobile: {
props: { props: {
rowHandle: { rowHandle: {
width: 160, width: 160,
}, },
}, },
}, },
}, },
}, },
request: { request: {
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest, delRequest,
}, },
form: { form: {
labelCol: { labelCol: {
//固定label宽度 //固定label宽度
span: null, span: null,
style: { style: {
width: "100px", width: "100px",
}, },
}, },
col: { col: {
span: 22, span: 22,
}, },
wrapper: { wrapper: {
width: 600, width: 600,
}, },
}, },
rowHandle: { rowHandle: {
width: 200, width: 200,
group: { group: {
editable: { editable: {
edit: { edit: {
text: "编辑", text: t('certd.edit'),
order: -1, order: -1,
type: "primary", type: "primary",
click({ row, index }) { click({ row, index }) {
crudExpose.openEdit({ crudExpose.openEdit({
index, index,
row, row,
}); });
}, },
}, },
}, },
}, },
}, },
table: { table: {
editable: { editable: {
enabled: true, enabled: true,
mode: "cell", mode: "cell",
exclusive: true, exclusive: true,
//排他式激活效果,将其他行的编辑状态触发保存 //排他式激活效果,将其他行的编辑状态触发保存
exclusiveEffect: "save", //自动保存其他行编辑状态cancel = 自动关闭其他行编辑状态 exclusiveEffect: "save", //自动保存其他行编辑状态cancel = 自动关闭其他行编辑状态
async updateCell(opts) { async updateCell(opts) {
const { row, key, value } = opts; const { row, key, value } = opts;
//如果是添加,需要返回{[rowKey]:xxx},比如:{id:2} //如果是添加,需要返回{[rowKey]:xxx},比如:{id:2}
return await api.UpdateObj({ id: row.id, [key]: value }); return await api.UpdateObj({ id: row.id, [key]: value });
}, },
}, },
}, },
columns: { columns: {
id: { id: {
title: "ID", title: "ID",
key: "id", key: "id",
type: "number", type: "number",
search: { search: {
show: true, show: true,
}, },
column: { column: {
width: 100, width: 100,
editable: { editable: {
disabled: true, disabled: true,
}, },
}, },
form: { form: {
show: false, show: false,
}, },
}, },
name: { name: {
title: "分组名称", title: t('certd.groupName'),
search: { search: {
show: true, show: true,
}, },
type: "text", type: "text",
form: { form: {
rules: [ rules: [
{ {
required: true, required: true,
message: "请输入分组名称", message: t('certd.enterGroupName'),
}, },
], ],
}, },
column: { column: {
width: 400, width: 400,
}, },
}, }
}, },
}, },
}; };
} }

View File

@ -1,84 +1,78 @@
<template> <template>
<a-drawer v-model:open="notificationDrawerVisible" placement="right" :closable="true" width="600px" class="pi-notification-form" @after-open-change="notificationDrawerOnAfterVisibleChange"> <a-drawer v-model:open="notificationDrawerVisible" placement="right" :closable="true" width="600px"
<template #title> class="pi-notification-form" @after-open-change="notificationDrawerOnAfterVisibleChange">
<div> <template #title>
编辑通知 <div>
<a-button v-if="mode === 'edit'" @click="notificationDelete()"> {{ t('certd.edit_notification') }}
<template #icon><DeleteOutlined /></template> <a-button v-if="mode === 'edit'" @click="notificationDelete()">
</a-button> <template #icon>
</div> <DeleteOutlined />
</template> </template>
<template v-if="currentNotification"> </a-button>
<pi-container> </div>
<a-form ref="notificationFormRef" class="notification-form" :model="currentNotification" :label-col="labelCol" :wrapper-col="wrapperCol"> </template>
<fs-form-item <template v-if="currentNotification">
v-if="currentNotification.type === 'email'" <pi-container>
v-model="currentNotification.type" <a-form ref="notificationFormRef" class="notification-form" :model="currentNotification"
:item="{ :label-col="labelCol" :wrapper-col="wrapperCol">
title: '类型', <fs-form-item v-if="currentNotification.type === 'email'" v-model="currentNotification.type" :item="{
key: 'type', title: t('certd.type'),
value: 'email', key: 'type',
component: { value: 'email',
name: 'a-select', component: {
vModel: 'value', name: 'a-select',
disabled: !editMode, vModel: 'value',
options: [ disabled: !editMode,
{ value: 'email', label: '邮件' }, options: [
{ value: 'other', label: '其他通知方式' }, { value: 'email', label: t('certd.email') },
], { value: 'other', label: t('certd.other_notification_method') },
}, ],
rules: [{ required: true, message: '此项必填' }], },
}" rules: [{ required: true, message: t('certd.required') }],
/> }" />
<fs-form-item <fs-form-item v-model="currentNotification.when" :item="{
v-model="currentNotification.when" title: t('certd.trigger_time'),
:item="{ key: 'when',
title: '触发时机', value: ['error'],
key: 'when', component: {
value: ['error'], name: 'a-select',
component: { vModel: 'value',
name: 'a-select', disabled: !editMode,
vModel: 'value', mode: 'multiple',
disabled: !editMode, options: [
mode: 'multiple', { value: 'start', label: t('certd.start_time') },
options: [ { value: 'success', label: t('certd.success_time') },
{ value: 'start', label: '开始时' }, { value: 'turnToSuccess', label: t('certd.fail_to_success_time') },
{ value: 'success', label: '成功时' }, { value: 'error', label: t('certd.fail_time') },
{ value: 'turnToSuccess', label: '失败转成功时' }, ],
{ value: 'error', label: '失败时' }, },
], helper: t('certd.helper_suggest_fail_only'),
}, rules: [{ required: true, message: t('certd.required') }],
helper: `建议仅选择'失败时'和'失败转成功'两种即可`, }" />
rules: [{ required: true, message: '此项必填' }], <pi-notification-form-email v-if="currentNotification.type === 'email'" ref="optionsRef"
}" v-model:options="currentNotification.options"></pi-notification-form-email>
/>
<pi-notification-form-email v-if="currentNotification.type === 'email'" ref="optionsRef" v-model:options="currentNotification.options"></pi-notification-form-email>
<fs-form-item <fs-form-item v-else v-model="currentNotification.notificationId" :item="{
v-else title: t('certd.notification_config'),
v-model="currentNotification.notificationId" key: 'notificationId',
:item="{ component: {
title: '通知配置', disabled: !editMode,
key: 'notificationId', name: NotificationSelector,
component: { onSelectedChange,
disabled: !editMode, },
name: NotificationSelector, helper: t('certd.please_select_notification'),
onSelectedChange, rules: [{ required: true, message: t('certd.required') }],
}, }" />
helper: '请选择通知方式', </a-form>
rules: [{ required: true, message: '此项必填' }],
}"
/>
</a-form>
<template #footer> <template #footer>
<a-form-item v-if="editMode" :wrapper-col="{ span: 14, offset: 4 }"> <a-form-item v-if="editMode" :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="notificationSave"> </a-button> <a-button type="primary" @click="notificationSave"> {{ t('certd.confirm') }} </a-button>
</a-form-item> </a-form-item>
</template> </template>
</pi-container> </pi-container>
</template> </template>
</a-drawer> </a-drawer>
</template> </template>
<script lang="ts"> <script lang="ts">
@ -88,159 +82,161 @@ import * as _ from "lodash-es";
import { nanoid } from "nanoid"; import { nanoid } from "nanoid";
import PiNotificationFormEmail from "./pi-notification-form-email.vue"; import PiNotificationFormEmail from "./pi-notification-form-email.vue";
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue"; import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
export default { export default {
name: "PiNotificationForm", name: "PiNotificationForm",
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
components: { NotificationSelector, PiNotificationFormEmail }, components: { NotificationSelector, PiNotificationFormEmail },
props: { props: {
editMode: { editMode: {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
}, },
emits: ["update"], emits: ["update"],
setup(props: any, context: any) { setup(props: any, context: any) {
/** /**
* notification drawer * notification drawer
* @returns * @returns
*/ */
function useNotificationForm() { function useNotificationForm() {
const mode = ref("add"); const mode = ref("add");
const callback = ref(); const callback = ref();
const currentNotification: Ref<any> = ref({ type: undefined, when: [], options: {}, notificationId: undefined, title: "" }); const currentNotification: Ref<any> = ref({ type: undefined, when: [], options: {}, notificationId: undefined, title: "" });
const currentPlugin = ref({}); const currentPlugin = ref({});
const notificationFormRef = ref(null); const notificationFormRef = ref(null);
const notificationDrawerVisible = ref(false); const notificationDrawerVisible = ref(false);
const optionsRef = ref(); const optionsRef = ref();
const rules = ref({ const rules = ref({
type: [ type: [
{ {
type: "string", type: "string",
required: true, required: true,
message: "请选择类型", message: t('certd.please_select_type'),
}, },
], ],
when: [ when: [
{ {
type: "string", type: "string",
required: true, required: true,
message: "请选择通知时机", message: t('certd.please_select_trigger_time'),
}, },
], ],
notificationId: [ notificationId: [
{ {
type: "number", type: "number",
required: true, required: true,
message: "请选择通知配置", message: t('certd.please_select_notification_config'),
}, },
], ],
}); });
const notificationDrawerShow = () => {
notificationDrawerVisible.value = true;
};
const notificationDrawerClose = () => {
notificationDrawerVisible.value = false;
};
const notificationDrawerShow = () => { const notificationDrawerOnAfterVisibleChange = (val: any) => {
notificationDrawerVisible.value = true; console.log("notificationDrawerOnAfterVisibleChange", val);
}; };
const notificationDrawerClose = () => {
notificationDrawerVisible.value = false;
};
const notificationDrawerOnAfterVisibleChange = (val: any) => { const notificationOpen = (notification: any, emit: any) => {
console.log("notificationDrawerOnAfterVisibleChange", val); callback.value = emit;
}; currentNotification.value = _.cloneDeep(notification);
console.log("currentNotificationOpen", currentNotification.value);
notificationDrawerShow();
};
const notificationOpen = (notification: any, emit: any) => { const notificationAdd = (emit: any) => {
callback.value = emit; mode.value = "add";
currentNotification.value = _.cloneDeep(notification); const notification = { id: nanoid(), type: "custom", when: ["error", "turnToSuccess"] };
console.log("currentNotificationOpen", currentNotification.value); notificationOpen(notification, emit);
notificationDrawerShow(); };
};
const notificationAdd = (emit: any) => { const notificationEdit = (notification: any, emit: any) => {
mode.value = "add"; mode.value = "edit";
const notification = { id: nanoid(), type: "custom", when: ["error", "turnToSuccess"] }; notificationOpen(notification, emit);
notificationOpen(notification, emit); };
};
const notificationEdit = (notification: any, emit: any) => { const notificationView = (notification: any, emit: any) => {
mode.value = "edit"; mode.value = "view";
notificationOpen(notification, emit); notificationOpen(notification, emit);
}; };
const notificationView = (notification: any, emit: any) => { const notificationSave = async (e: any) => {
mode.value = "view"; if (optionsRef.value) {
notificationOpen(notification, emit); currentNotification.value.options = await optionsRef.value.getValue();
}; }
const notificationSave = async (e: any) => { console.log("currentNotificationSave", currentNotification.value);
if (optionsRef.value) { try {
currentNotification.value.options = await optionsRef.value.getValue(); await notificationFormRef.value.validate();
} } catch (e) {
console.error("表单验证失败:", e);
return;
}
console.log("currentNotificationSave", currentNotification.value); callback.value("save", currentNotification.value);
try { notificationDrawerClose();
await notificationFormRef.value.validate(); };
} catch (e) {
console.error("表单验证失败:", e);
return;
}
callback.value("save", currentNotification.value); const notificationDelete = () => {
notificationDrawerClose(); Modal.confirm({
}; title: t('certd.confirm'),
content: t('certd.confirm_delete_trigger'),
async onOk() {
callback.value("delete");
notificationDrawerClose();
},
});
};
const notificationDelete = () => {
Modal.confirm({
title: "确认",
content: `确定要删除此触发器吗?`,
async onOk() {
callback.value("delete");
notificationDrawerClose();
},
});
};
const blankFn = () => { const blankFn = () => {
return {}; return {};
}; };
function onSelectedChange(node: any) { function onSelectedChange(node: any) {
currentNotification.value.title = node?.name || null; currentNotification.value.title = node?.name || null;
} }
return { return {
notificationFormRef, notificationFormRef,
onSelectedChange, onSelectedChange,
mode, mode,
notificationAdd, notificationAdd,
notificationEdit, notificationEdit,
notificationView, notificationView,
notificationDrawerShow, notificationDrawerShow,
notificationDrawerVisible, notificationDrawerVisible,
notificationDrawerOnAfterVisibleChange, notificationDrawerOnAfterVisibleChange,
currentNotification, currentNotification,
currentPlugin, currentPlugin,
notificationSave, notificationSave,
notificationDelete, notificationDelete,
rules, rules,
blankFn, blankFn,
optionsRef, optionsRef,
}; };
} }
return { return {
...useNotificationForm(), ...useNotificationForm(),
labelCol: { span: 6 }, labelCol: { span: 6 },
wrapperCol: { span: 16 }, wrapperCol: { span: 16 },
}; };
}, },
computed: { computed: {
NotificationSelector() { NotificationSelector() {
return NotificationSelector; return NotificationSelector;
}, },
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
.pi-notification-form { .pi-notification-form {}
}
</style> </style>

View File

@ -1,137 +1,139 @@
import * as api from "./api"; import * as api from "./api";
import { Ref, ref } from "vue"; import { Ref, ref } from "vue";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { useI18n } from "vue-i18n";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const { t } = useI18n();
return await api.GetList(query); const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
}; return await api.GetList(query);
const editRequest = async ({ form, row }: EditReq) => { };
form.id = row.id; const editRequest = async ({ form, row }: EditReq) => {
const res = await api.UpdateObj(form); form.id = row.id;
return res; const res = await api.UpdateObj(form);
}; return res;
const delRequest = async ({ row }: DelReq) => { };
return await api.DelObj(row.id); const delRequest = async ({ row }: DelReq) => {
}; return await api.DelObj(row.id);
};
const addRequest = async ({ form }: AddReq) => { const addRequest = async ({ form }: AddReq) => {
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };
const selectedRowKeys: Ref<any[]> = ref([]); const selectedRowKeys: Ref<any[]> = ref([]);
context.selectedRowKeys = selectedRowKeys; context.selectedRowKeys = selectedRowKeys;
return { return {
crudOptions: { crudOptions: {
settings: { settings: {
plugins: { plugins: {
//这里使用行选择插件生成行选择crudOptions配置最终会与crudOptions合并 //这里使用行选择插件生成行选择crudOptions配置最终会与crudOptions合并
rowSelection: { rowSelection: {
enabled: true, enabled: true,
order: -2, order: -2,
before: true, before: true,
// handle: (pluginProps,useCrudProps)=>CrudOptions, // handle: (pluginProps,useCrudProps)=>CrudOptions,
props: { props: {
multiple: true, multiple: true,
crossPage: true, crossPage: true,
selectedRowKeys, selectedRowKeys,
}, },
}, },
}, },
}, },
request: { request: {
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest, delRequest,
}, },
// tabs: { // tabs: {
// name: "status", // name: "status",
// show: true, // show: true,
// }, // },
rowHandle: { rowHandle: {
minWidth: 200, minWidth: 200,
fixed: "right", fixed: "right",
}, },
columns: { columns: {
id: { id: {
title: "ID", title: "ID",
key: "id", key: "id",
type: "number", type: "number",
column: { column: {
width: 80, width: 80,
}, },
form: { form: {
show: false, show: false,
}, },
}, },
domain: { domain: {
title: "托管的子域名", title: t('certd.subdomainHosted'),
type: "text", type: "text",
search: { search: {
show: true, show: true,
}, },
form: { form: {
helper: { helper: {
render() { render() {
return ( return (
<div> <div>
{t('certd.subdomainHelpText')}
<a href={"https://help.aliyun.com/zh/dns/subdomain-management"} target={"_blank"}> <a href={"https://help.aliyun.com/zh/dns/subdomain-management"} target={"_blank"}>
{t('certd.subdomainManagement')}
</a> </a>
</div> </div>
); );
}, },
}, },
}, },
editForm: { editForm: {
component: { component: {
disabled: true, disabled: true,
}, },
}, },
}, },
disabled: { disabled: {
title: "是否禁用", title: t('certd.isDisabled'),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ value: false, label: "启用", color: "green" }, { value: false, label: t('certd.enabled'), color: "green" },
{ value: true, label: "禁用", color: "gray" }, { value: true, label: t('certd.disabled'), color: "gray" },
], ],
}), }),
search: { search: {
show: true, show: true,
}, },
form: { form: {
value: false, value: false,
}, },
}, },
createTime: { createTime: {
title: "创建时间", title: t('certd.createTime'),
type: "datetime", type: "datetime",
form: { form: {
show: false, show: false,
}, },
column: { column: {
sorter: true, sorter: true,
width: 160, width: 160,
align: "center", align: "center",
}, },
}, },
updateTime: { updateTime: {
title: "更新时间", title: t('certd.updateTime'),
type: "datetime", type: "datetime",
form: { form: {
show: false, show: false,
}, },
column: { column: {
show: true, show: true,
}, },
}, },
}, },
}, },
}; };
} }

View File

@ -1,19 +1,19 @@
<template> <template>
<fs-page class="page-cert"> <fs-page class="page-cert">
<template #header> <template #header>
<div class="title"> <div class="title">
子域名托管 {{ t('certd.subdomainHosting') }}
<span class="sub"> 当你的域名设置了子域名托管需要在此处创建记录否则申请证书将失败 </span> <span class="sub">{{ t('certd.subdomainHostingHint') }}</span>
</div> </div>
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #pagination-left> <template #pagination-left>
<a-tooltip title="批量删除"> <a-tooltip :title="t('certd.batchDelete')">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button> <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</a-tooltip> </a-tooltip>
</template> </template>
</fs-crud> </fs-crud>
</fs-page> </fs-page>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -22,36 +22,40 @@ import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "CnameRecord", name: "CnameRecord",
}); });
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions }); const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
const selectedRowKeys = context.selectedRowKeys; const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
if (selectedRowKeys.value?.length > 0) { if (selectedRowKeys.value?.length > 0) {
Modal.confirm({ Modal.confirm({
title: "确认", title: t('certd.confirm'),
content: `确定要批量删除这${selectedRowKeys.value.length}条记录吗`, content: t('certd.batchDeleteConfirm', { count: selectedRowKeys.value.length }),
async onOk() { async onOk() {
await DeleteBatch(selectedRowKeys.value); await DeleteBatch(selectedRowKeys.value);
message.info("删除成功"); message.info(t('certd.deleteSuccess'));
crudExpose.doRefresh(); crudExpose.doRefresh();
selectedRowKeys.value = []; selectedRowKeys.value = [];
}, },
}); });
} else { } else {
message.error("请先勾选记录"); message.error(t('certd.selectRecordFirst'));
} }
}; };
// //
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
}); });
onActivated(async () => { onActivated(async () => {
await crudExpose.doRefresh(); await crudExpose.doRefresh();
}); });
</script> </script>
<style lang="less"></style> <style lang="less"></style>

View File

@ -7,310 +7,310 @@ import DurationValue from "/@/views/sys/suite/product/duration-value.vue";
import UserSuiteStatus from "/@/views/certd/suite/mine/user-suite-status.vue"; import UserSuiteStatus from "/@/views/certd/suite/mine/user-suite-status.vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query); return await api.GetList(query);
}; };
const editRequest = async (req: EditReq) => { const editRequest = async (req: EditReq) => {
const { form, row } = req; const { form, row } = req;
form.id = row.id; form.id = row.id;
const res = await api.UpdateObj(form); const res = await api.UpdateObj(form);
return res; return res;
}; };
const delRequest = async (req: DelReq) => { const delRequest = async (req: DelReq) => {
const { row } = req; const { row } = req;
return await api.DelObj(row.id); return await api.DelObj(row.id);
}; };
const addRequest = async (req: AddReq) => { const addRequest = async (req: AddReq) => {
const { form } = req; const { form } = req;
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };
const router = useRouter(); const router = useRouter();
return { return {
crudOptions: { crudOptions: {
request: { request: {
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest delRequest
}, },
form: { form: {
labelCol: { labelCol: {
//固定label宽度 //固定label宽度
span: null, span: null,
style: { style: {
width: "100px" width: "100px"
} }
}, },
col: { col: {
span: 22 span: 22
}, },
wrapper: { wrapper: {
width: 600 width: 600
} }
}, },
actionbar: { actionbar: {
buttons: { buttons: {
add: { show: false }, add: { show: false },
buy: { buy: {
text: "购买", text: "购买",
type: "primary", type: "primary",
click() { click() {
router.push({ router.push({
path: "/certd/suite/buy" path: "/certd/suite/buy"
}); });
} }
} }
} }
}, },
rowHandle: { rowHandle: {
width: 200, width: 200,
fixed: "right", fixed: "right",
buttons: { buttons: {
view: { show: false }, view: { show: false },
copy: { show: false }, copy: { show: false },
edit: { show: false }, edit: { show: false },
remove: { show: false } remove: { show: false }
// continue:{ // continue:{
// text:"续期", // text:"续期",
// type:"link", // type:"link",
// click(){ // click(){
// console.log("续期"); // console.log("续期");
// } // }
// } // }
} }
}, },
columns: { columns: {
id: { id: {
title: "ID", title: "ID",
key: "id", key: "id",
type: "number", type: "number",
search: { search: {
show: false show: false
}, },
column: { column: {
width: 100, width: 100,
editable: { editable: {
disabled: true disabled: true
} }
}, },
form: { form: {
show: false show: false
} }
}, },
title: { title: {
title: "套餐名称", title: "套餐名称",
type: "text", type: "text",
search: { search: {
show: true show: true
}, },
form: { form: {
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: "此项必填" }]
}, },
column: { column: {
width: 200 width: 200
} }
}, },
productType: { productType: {
title: "类型", title: "类型",
type: "dict-select", type: "dict-select",
editForm: { editForm: {
component: { component: {
disabled: true disabled: true
} }
}, },
dict: dict({ dict: dict({
data: [ data: [
{ label: "套餐", value: "suite", color: "green" }, { label: "套餐", value: "suite", color: "green" },
{ label: "加量包", value: "addon", color: "blue" } { label: "加量包", value: "addon", color: "blue" }
] ]
}), }),
form: { form: {
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: "此项必填" }]
}, },
column: { column: {
width: 80, width: 80,
align: "center" align: "center"
}, },
valueBuilder: ({ row }) => { valueBuilder: ({ row }) => {
if (row.content) { if (row.content) {
row.content = JSON.parse(row.content); row.content = JSON.parse(row.content);
} }
}, },
valueResolve: ({ form }) => { valueResolve: ({ form }) => {
if (form.content) { if (form.content) {
form.content = JSON.stringify(form.content); form.content = JSON.stringify(form.content);
} }
} }
}, },
"content.maxDomainCount": { "content.maxDomainCount": {
title: "域名数量", title: "域名数量",
type: "text", type: "text",
form: { form: {
key: ["content", "maxDomainCount"], key: ["content", "maxDomainCount"],
component: { component: {
name: SuiteValueEdit, name: SuiteValueEdit,
vModel: "modelValue", vModel: "modelValue",
unit: "个" unit: "个"
}, },
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: "此项必填" }]
}, },
column: { column: {
width: 100, width: 100,
component: { component: {
name: SuiteValue, name: SuiteValue,
vModel: "modelValue", vModel: "modelValue",
unit: "个" unit: "个"
}, },
align: "center" align: "center"
} }
}, },
"content.maxPipelineCount": { "content.maxPipelineCount": {
title: "流水线数量", title: "流水线数量",
type: "text", type: "text",
form: { form: {
key: ["content", "maxPipelineCount"], key: ["content", "maxPipelineCount"],
component: { component: {
name: SuiteValueEdit, name: SuiteValueEdit,
vModel: "modelValue", vModel: "modelValue",
unit: "条" unit: "条"
}, },
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: "此项必填" }]
}, },
column: { column: {
width: 100, width: 100,
component: { component: {
name: SuiteValue, name: SuiteValue,
vModel: "modelValue", vModel: "modelValue",
unit: "条" unit: "条"
}, },
align: "center" align: "center"
} }
}, },
"content.maxDeployCount": { "content.maxDeployCount": {
title: "部署次数", title: "部署次数",
type: "text", type: "text",
form: { form: {
key: ["content", "maxDeployCount"], key: ["content", "maxDeployCount"],
component: { component: {
name: SuiteValueEdit, name: SuiteValueEdit,
vModel: "modelValue", vModel: "modelValue",
unit: "次" unit: "次"
}, },
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: "此项必填" }]
}, },
column: { column: {
width: 100, width: 100,
component: { component: {
name: SuiteValue, name: SuiteValue,
vModel: "modelValue", vModel: "modelValue",
unit: "次", unit: "次",
used: compute(({ row }) => { used: compute(({ row }) => {
return row.deployCountUsed; return row.deployCountUsed;
}) })
}, },
align: "center" align: "center"
} }
}, },
"content.maxMonitorCount": { "content.maxMonitorCount": {
title: "证书监控数量", title: "证书监控数量",
type: "text", type: "text",
form: { form: {
key: ["content", "maxMonitorCount"], key: ["content", "maxMonitorCount"],
component: { component: {
name: SuiteValueEdit, name: SuiteValueEdit,
vModel: "modelValue", vModel: "modelValue",
unit: "个" unit: "个"
}, },
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: "此项必填" }]
}, },
column: { column: {
width: 120, width: 120,
component: { component: {
name: SuiteValue, name: SuiteValue,
vModel: "modelValue", vModel: "modelValue",
unit: "个" unit: "个"
}, },
align: "center" align: "center"
} }
}, },
duration: { duration: {
title: "时长", title: "时长",
type: "text", type: "text",
form: {}, form: {},
column: { column: {
component: { component: {
name: DurationValue, name: DurationValue,
vModel: "modelValue" vModel: "modelValue"
}, },
width: 100, width: 100,
align: "center" align: "center"
} }
}, },
status: { status: {
title: "状态", title: "状态",
type: "text", type: "text",
form: { show: false }, form: { show: false },
column: { column: {
width: 100, width: 100,
align: "center", align: "center",
component: { component: {
name: UserSuiteStatus, name: UserSuiteStatus,
userSuite: compute(({ row }) => { userSuite: compute(({ row }) => {
return row; return row;
}), }),
currentSuite: context.currentSuite currentSuite: context.currentSuite
}, },
conditionalRender: { conditionalRender: {
match() { match() {
return false; return false;
} }
} }
} }
}, },
activeTime: { activeTime: {
title: "激活时间", title: "激活时间",
type: "date", type: "date",
column: { column: {
width: 150 width: 150
} }
}, },
expiresTime: { expiresTime: {
title: "过期时间", title: "过期时间",
type: "date", type: "date",
column: { column: {
width: 150, width: 150,
component: { component: {
name: "expires-time-text", name: "expires-time-text",
vModel: "value", vModel: "value",
mode: "tag", mode: "tag",
title: compute(({ value }) => { title: compute(({ value }) => {
return dayjs(value).format("YYYY-MM-DD HH:mm:ss"); return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
}) })
} }
} }
}, },
isPresent: { isPresent: {
title: "是否赠送", title: "是否赠送",
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "是", value: true, color: "success" }, { label: "是", value: true, color: "success" },
{ label: "否", value: false, color: "blue" } { label: "否", value: false, color: "blue" }
] ]
}), }),
form: { form: {
value: true value: true
}, },
column: { column: {
width: 100, width: 100,
align: "center" align: "center"
} }
} }
} }
} }
}; };
} }

View File

@ -4,317 +4,333 @@ import SuiteValue from "./suite-value.vue";
import SuiteValueEdit from "./suite-value-edit.vue"; import SuiteValueEdit from "./suite-value-edit.vue";
import PriceEdit from "./price-edit.vue"; import PriceEdit from "./price-edit.vue";
import DurationPriceValue from "/@/views/sys/suite/product/duration-price-value.vue"; import DurationPriceValue from "/@/views/sys/suite/product/duration-price-value.vue";
import { useI18n } from "vue-i18n";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const emit = context.emit; const { t } = useI18n();
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const emit = context.emit;
return await api.GetList(query); const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
}; return await api.GetList(query);
const editRequest = async ({ form, row }: EditReq) => { };
form.id = row.id; const editRequest = async ({ form, row }: EditReq) => {
const res = await api.UpdateObj(form); form.id = row.id;
return res; const res = await api.UpdateObj(form);
}; return res;
const delRequest = async ({ row }: DelReq) => { };
return await api.DelObj(row.id); const delRequest = async ({ row }: DelReq) => {
}; return await api.DelObj(row.id);
};
const addRequest = async ({ form }: AddReq) => { const addRequest = async ({ form }: AddReq) => {
const res = await api.AddObj(form); const res = await api.AddObj(form);
return res; return res;
}; };
return { return {
crudOptions: { crudOptions: {
table: { table: {
onRefreshed: () => { onRefreshed: () => {
emit("refreshed"); emit("refreshed");
} }
}, },
search: { search: {
show: false show: false
}, },
request: { request: {
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest delRequest
}, },
pagination: { pagination: {
show: false, show: false,
pageSize: 999999 pageSize: 999999
}, },
rowHandle: { rowHandle: {
minWidth: 200, minWidth: 200,
fixed: "right" fixed: "right"
}, },
form: { form: {
group: { group: {
groups: { groups: {
base: { base: {
header: "基础信息", header: t('certd.basicInfo'),
columns: ["title", "type", "disabled", "order", "supportBuy", "intro"] columns: [
}, t('certd.titlea'),
content: { t('certd.type'),
header: "套餐内容", t('certd.disabled'),
columns: ["content.maxDomainCount", "content.maxPipelineCount", "content.maxDeployCount", "content.maxMonitorCount"] t('certd.ordera'),
}, t('certd.supportBuy'),
price: { t('certd.intro')
header: "价格", ]
columns: ["durationPrices"] },
} content: {
} header: t('certd.packageContent'),
} columns: [
}, t('certd.maxDomainCount'),
columns: { t('certd.maxPipelineCount'),
// id: { t('certd.maxDeployCount'),
// title: "ID", t('certd.maxMonitorCount')
// key: "id", ]
// type: "number", },
// column: { price: {
// width: 100 header: t('certd.price'),
// }, columns: [
// form: { t('certd.durationPrices')
// show: false ]
// } }
// }, }
title: { }
title: "套餐名称", }
type: "text", columns: {
search: { // id: {
show: true // title: "ID",
}, // key: "id",
form: { // type: "number",
rules: [{ required: true, message: "此项必填" }] // column: {
}, // width: 100
column: { // },
width: 200 // form: {
} // show: false
}, // }
type: { // },
title: "类型", title: {
type: "dict-select", title: t('certd.packageName'),
editForm: { type: "text",
component: { search: {
disabled: true show: true
} },
}, form: {
dict: dict({ rules: [{ required: true, message: t('certd.requiredField') }]
data: [ },
{ label: "套餐", value: "suite" }, column: {
{ label: "加量包", value: "addon" } width: 200
] }
}), },
form: { type: {
value: "suite", title: t('certd.type'),
rules: [{ required: true, message: "此项必填" }], type: "dict-select",
helper: "套餐:同一时间只有最新购买的一个生效\n加量包可购买多个购买后立即生效不影响套餐\n套餐和加量包数量可叠加" editForm: {
}, component: {
column: { disabled: true
width: 80, }
align: "center" },
}, dict: dict({
valueBuilder: ({ row }) => { data: [
if (row.content) { { label: t('certd.suite'), value: "suite" },
row.content = JSON.parse(row.content); { label: t('certd.addon'), value: "addon" }
} ]
if (row.durationPrices) { }),
row.durationPrices = JSON.parse(row.durationPrices); form: {
} value: "suite",
}, rules: [{ required: true, message: t('certd.requiredField') }],
valueResolve: ({ form }) => { helper: t('certd.typeHelper')
if (form.content) { },
form.content = JSON.stringify(form.content); column: {
} width: 80,
if (form.durationPrices) { align: "center"
form.durationPrices = JSON.stringify(form.durationPrices); },
} valueBuilder: ({ row }) => {
} if (row.content) {
}, row.content = JSON.parse(row.content);
"content.maxDomainCount": { }
title: "域名数量", if (row.durationPrices) {
type: "text", row.durationPrices = JSON.parse(row.durationPrices);
form: { }
key: ["content", "maxDomainCount"], },
component: { valueResolve: ({ form }) => {
name: SuiteValueEdit, if (form.content) {
vModel: "modelValue", form.content = JSON.stringify(form.content);
unit: "个" }
}, if (form.durationPrices) {
rules: [{ required: true, message: "此项必填" }] form.durationPrices = JSON.stringify(form.durationPrices);
}, }
column: { }
width: 100, },
component: { "content.maxDomainCount": {
name: SuiteValue, title: t('certd.domainCount'),
vModel: "modelValue", type: "text",
unit: "个" form: {
} key: ["content", "maxDomainCount"],
} component: {
}, name: SuiteValueEdit,
"content.maxPipelineCount": { vModel: "modelValue",
title: "流水线数量", unit: t('certd.unitCount')
type: "text", },
form: { rules: [{ required: true, message: t('certd.requiredField') }]
key: ["content", "maxPipelineCount"], },
component: { column: {
name: SuiteValueEdit, width: 100,
vModel: "modelValue", component: {
unit: "条" name: SuiteValue,
}, vModel: "modelValue",
rules: [{ required: true, message: "此项必填" }] unit: t('certd.unitCount')
}, }
column: { }
width: 100, },
component: { "content.maxPipelineCount": {
name: SuiteValue, title: t('certd.pipelineCount'),
vModel: "modelValue", type: "text",
unit: "条" form: {
} key: ["content", "maxPipelineCount"],
} component: {
}, name: SuiteValueEdit,
"content.maxDeployCount": { vModel: "modelValue",
title: "部署次数", unit: t('certd.unitPipeline')
type: "text", },
form: { rules: [{ required: true, message: t('certd.requiredField') }]
key: ["content", "maxDeployCount"], },
component: { column: {
name: SuiteValueEdit, width: 100,
vModel: "modelValue", component: {
unit: "次" name: SuiteValue,
}, vModel: "modelValue",
rules: [{ required: true, message: "此项必填" }] unit: t('certd.unitPipeline')
}, }
column: { }
width: 100, },
component: { "content.maxDeployCount": {
name: SuiteValue, title: t('certd.deployCount'),
vModel: "modelValue", type: "text",
unit: "次" form: {
} key: ["content", "maxDeployCount"],
} component: {
}, name: SuiteValueEdit,
"content.maxMonitorCount": { vModel: "modelValue",
title: "证书监控数量", unit: t('certd.unitDeploy')
type: "text", },
form: { rules: [{ required: true, message: t('certd.requiredField') }]
key: ["content", "maxMonitorCount"], },
component: { column: {
name: SuiteValueEdit, width: 100,
vModel: "modelValue", component: {
unit: "个" name: SuiteValue,
}, vModel: "modelValue",
rules: [{ required: true, message: "此项必填" }] unit: t('certd.unitDeploy')
}, }
column: { }
width: 120, },
component: { "content.maxMonitorCount": {
name: SuiteValue, title: t('certd.monitorCount'),
vModel: "modelValue", type: "text",
unit: "个" form: {
} key: ["content", "maxMonitorCount"],
} component: {
}, name: SuiteValueEdit,
durationPrices: { vModel: "modelValue",
title: "时长及价格", unit: t('certd.unitCount')
type: "text", },
form: { rules: [{ required: true, message: t('certd.requiredField') }]
title: "选择时长", },
component: { column: {
name: PriceEdit, width: 120,
vModel: "modelValue", component: {
edit: true, name: SuiteValue,
style: { vModel: "modelValue",
minHeight: "120px" unit: t('certd.unitCount')
} }
}, }
col: { },
span: 24 durationPrices: {
}, title: t('certd.durationPriceTitle'),
rules: [{ required: true, message: "此项必填" }] type: "text",
}, form: {
column: { title: t('certd.selectDuration'),
component: { component: {
name: DurationPriceValue, name: PriceEdit,
vModel: "modelValue" vModel: "modelValue",
}, edit: true,
width: 350 style: {
} minHeight: "120px"
}, }
supportBuy: { },
title: "支持购买", col: {
type: "dict-switch", span: 24
dict: dict({ },
data: [ rules: [{ required: true, message: t('certd.requiredField') }]
{ label: "支持购买", value: true, color: "success" }, },
{ label: "不能购买", value: false, color: "gray" } column: {
] component: {
}), name: DurationPriceValue,
form: { vModel: "modelValue"
value: true },
}, width: 350
column: { }
width: 120 },
} supportBuy: {
}, title: t('certd.supportBuy'),
disabled: { type: "dict-switch",
title: "上下架", dict: dict({
type: "dict-radio", data: [
dict: dict({ { label: t('certd.supportPurchase'), value: true, color: "success" },
data: [ { label: t('certd.cannotPurchase'), value: false, color: "gray" }
{ value: false, label: "上架", color: "green" }, ]
{ value: true, label: "下架", color: "gray" } }),
] form: {
}), value: true
form: { },
value: false column: {
}, width: 120
column: { }
width: 100 },
} disabled: {
}, title: t('certd.shelfStatus'),
order: { type: "dict-radio",
title: "排序", dict: dict({
type: "number", data: [
form: { { value: false, label: t('certd.onShelf'), color: "green" },
helper: "越小越靠前", { value: true, label: t('certd.offShelf'), color: "gray" }
value: 0 ]
}, }),
column: { form: {
width: 100 value: false
} },
}, column: {
intro: { width: 100
title: "说明", }
type: "textarea", },
column: { order: {
width: 200 title: t('certd.ordera'),
} type: "number",
}, form: {
createTime: { helper: t('certd.orderHelper'),
title: "创建时间", value: 0
type: "datetime", },
form: { column: {
show: false width: 100
}, }
column: { },
sorter: true, intro: {
width: 160, title: t('certd.description'),
align: "center" type: "textarea",
} column: {
}, width: 200
updateTime: { }
title: "更新时间", },
type: "datetime", createTime: {
form: { title: t('certd.createTime'),
show: false type: "datetime",
}, form: {
column: { show: false
show: true, },
width: 160 column: {
} sorter: true,
} width: 160,
} align: "center"
} }
}; },
updateTime: {
title: t('certd.updateTime'),
type: "datetime",
form: {
show: false
},
column: {
show: true,
width: 160
}
}
}
}
};
} }

View File

@ -8,392 +8,397 @@ import createCrudOptionsUser from "/@/views/sys/authority/user/crud";
import UserSuiteStatus from "/@/views/certd/suite/mine/user-suite-status.vue"; import UserSuiteStatus from "/@/views/certd/suite/mine/user-suite-status.vue";
import SuiteDurationSelector from "../setting/suite-duration-selector.vue"; import SuiteDurationSelector from "../setting/suite-duration-selector.vue";
import dayjs from "dayjs"; import dayjs from "dayjs";
import { useI18n } from "vue-i18n";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const api = sysUserSuiteApi; const { t } = useI18n();
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const api = sysUserSuiteApi;
return await api.GetList(query); const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
}; return await api.GetList(query);
const editRequest = async (req: EditReq) => { };
const { form, row } = req; const editRequest = async (req: EditReq) => {
form.id = row.id; const { form, row } = req;
const res = await api.UpdateObj(form); form.id = row.id;
return res; const res = await api.UpdateObj(form);
}; return res;
const delRequest = async (req: DelReq) => { };
const { row } = req; const delRequest = async (req: DelReq) => {
return await api.DelObj(row.id); const { row } = req;
}; return await api.DelObj(row.id);
};
const addRequest = async (req: AddReq) => { const addRequest = async (req: AddReq) => {
const { form } = req; const { form } = req;
const res = await api.PresentSuite(form); const res = await api.PresentSuite(form);
return res; return res;
}; };
const router = useRouter(); const router = useRouter();
return { return {
crudOptions: { crudOptions: {
request: { request: {
pageRequest, pageRequest,
addRequest, addRequest,
editRequest, editRequest,
delRequest delRequest
}, },
form: { form: {
labelCol: { labelCol: {
//固定label宽度 //固定label宽度
span: null, span: null,
style: { style: {
width: "100px" width: "100px"
} }
}, },
col: { col: {
span: 22 span: 22
}, },
wrapper: { wrapper: {
width: 600 width: 600
} }
}, },
actionbar: { actionbar: {
buttons: { buttons: {
add: { text: "赠送套餐" } add: { text: t('certd.gift_package') }
} }
}, },
toolbar: { show: false },
rowHandle: { toolbar: { show: false },
width: 200, rowHandle: {
fixed: "right", width: 200,
buttons: { fixed: "right",
view: { show: true }, buttons: {
copy: { show: false }, view: { show: true },
edit: { show: false }, copy: { show: false },
remove: { show: true } edit: { show: false },
// continue:{ remove: { show: true }
// text:"续期", // continue:{
// type:"link", // text:"续期",
// click(){ // type:"link",
// console.log("续期"); // click(){
// } // console.log("续期");
// } // }
} // }
}, }
columns: { },
id: { columns: {
title: "ID", id: {
key: "id", title: "ID",
type: "number", key: "id",
search: { type: "number",
show: false search: {
}, show: false
column: { },
width: 100, column: {
editable: { width: 100,
disabled: true editable: {
} disabled: true
}, }
form: { },
show: false form: {
} show: false
}, }
title: { },
title: "套餐名称", title: {
type: "text", title: t('certd.package_name'),
search: { type: "text",
show: true search: {
}, show: true
form: { },
show: false form: {
}, show: false
column: { },
width: 200 column: {
} width: 200
}, }
userId: { },
title: "用户", userId: {
type: "table-select", title: t('certd.usera'),
search: { type: "table-select",
show: true search: {
}, show: true
dict: dict({ },
async getNodesByValues(ids: number[]) { dict: dict({
return await api.GetSimpleUserByIds(ids); async getNodesByValues(ids: number[]) {
}, return await api.GetSimpleUserByIds(ids);
value: "id", },
label: "nickName" value: "id",
}), label: "nickName"
form: { }),
component: { form: {
crossPage: true, component: {
multiple: false, crossPage: true,
select: { multiple: false,
placeholder: "点击选择" select: {
}, placeholder: t('certd.click_to_select')
createCrudOptions: createCrudOptionsUser },
// crudOptionsOverride: crudOptionsOverride createCrudOptions: createCrudOptionsUser
} // crudOptionsOverride: crudOptionsOverride
} }
}, }
//赠送 },
presentSuiteId: { //赠送
title: "赠送套餐", presentSuiteId: {
type: "dict-select", title: t('certd.gift_package'),
column: { show: false }, type: "dict-select",
addForm: { column: { show: false },
show: true, addForm: {
component: { show: true,
name: SuiteDurationSelector, component: {
vModel: "modelValue" name: SuiteDurationSelector,
}, vModel: "modelValue"
rules: [ },
{ rules: [
validator: async (rule, value) => { {
if (value && value.productId) { validator: async (rule, value) => {
return true; if (value && value.productId) {
} return true;
throw new Error("请选择套餐"); }
} throw new Error(t('certd.please_select_package'));
} }
] }
}, ]
valueResolve({ form, value }) { },
if (value && value.productId) { valueResolve({ form, value }) {
form.productId = value.productId; if (value && value.productId) {
form.duration = value.duration; form.productId = value.productId;
} form.duration = value.duration;
}, }
form: { show: false } },
}, form: { show: false }
productType: { },
title: "类型", productType: {
type: "dict-select", title: t('certd.type'),
editForm: { type: "dict-select",
component: { editForm: {
disabled: true component: {
} disabled: true
}, }
dict: dict({ },
data: [ dict: dict({
{ label: "套餐", value: "suite", color: "green" }, data: [
{ label: "加量包", value: "addon", color: "blue" } { label: t('certd.package'), value: "suite", color: "green" },
] { label: t('certd.addon_package'), value: "addon", color: "blue" }
}), ]
form: { }),
show: false form: {
}, show: false
column: { },
width: 80, column: {
align: "center" width: 80,
}, align: "center"
valueBuilder: ({ row }) => { },
if (row.content) { valueBuilder: ({ row }) => {
row.content = JSON.parse(row.content); if (row.content) {
} row.content = JSON.parse(row.content);
}, }
valueResolve: ({ form }) => { },
if (form.content) { valueResolve: ({ form }) => {
form.content = JSON.stringify(form.content); if (form.content) {
} form.content = JSON.stringify(form.content);
} }
}, }
"content.maxDomainCount": { },
title: "域名数量", "content.maxDomainCount": {
type: "text", title: t('certd.domain_count'),
form: { type: "text",
show: false, form: {
key: ["content", "maxDomainCount"], show: false,
component: { key: ["content", "maxDomainCount"],
name: SuiteValueEdit, component: {
vModel: "modelValue", name: SuiteValueEdit,
unit: "个" vModel: "modelValue",
}, unit: t('certd.unit_count')
rules: [{ required: true, message: "此项必填" }] },
}, rules: [{ required: true, message: t('certd.field_required') }]
column: { },
width: 100, column: {
component: { width: 100,
name: SuiteValue, component: {
vModel: "modelValue", name: SuiteValue,
unit: "个" vModel: "modelValue",
}, unit: t('certd.unit_count')
align: "center" },
} align: "center"
}, }
"content.maxPipelineCount": { },
title: "流水线数量", "content.maxPipelineCount": {
type: "text", title: t('certd.pipeline_count'),
form: { type: "text",
show: false, form: {
key: ["content", "maxPipelineCount"], show: false,
component: { key: ["content", "maxPipelineCount"],
name: SuiteValueEdit, component: {
vModel: "modelValue", name: SuiteValueEdit,
unit: "条" vModel: "modelValue",
}, unit: t('certd.unit_item')
rules: [{ required: true, message: "此项必填" }] },
}, rules: [{ required: true, message: t('certd.field_required') }]
column: { },
width: 100, column: {
component: { width: 100,
name: SuiteValue, component: {
vModel: "modelValue", name: SuiteValue,
unit: "条" vModel: "modelValue",
}, unit: t('certd.unit_item')
align: "center" },
} align: "center"
}, }
"content.maxDeployCount": { },
title: "部署次数", "content.maxDeployCount": {
type: "text", title: t('certd.deploy_count'),
form: { type: "text",
show: false, form: {
key: ["content", "maxDeployCount"], show: false,
component: { key: ["content", "maxDeployCount"],
name: SuiteValueEdit, component: {
vModel: "modelValue", name: SuiteValueEdit,
unit: "次" vModel: "modelValue",
}, unit: t('certd.unit_times')
rules: [{ required: true, message: "此项必填" }] },
}, rules: [{ required: true, message: t('certd.field_required') }]
column: { },
width: 100, column: {
component: { width: 100,
name: SuiteValue, component: {
vModel: "modelValue", name: SuiteValue,
unit: "次", vModel: "modelValue",
used: compute(({ row }) => { unit: t('certd.unit_times'),
return row.deployCountUsed; used: compute(({ row }) => {
}) return row.deployCountUsed;
}, })
align: "center" },
} align: "center"
}, }
"content.maxMonitorCount": { },
title: "证书监控数量", "content.maxMonitorCount": {
type: "text", title: t('certd.monitor_count'),
form: { type: "text",
show: false, form: {
key: ["content", "maxMonitorCount"], show: false,
component: { key: ["content", "maxMonitorCount"],
name: SuiteValueEdit, component: {
vModel: "modelValue", name: SuiteValueEdit,
unit: "个" vModel: "modelValue",
}, unit: t('certd.unit_count')
rules: [{ required: true, message: "此项必填" }] },
}, rules: [{ required: true, message: t('certd.field_required') }]
column: { },
width: 120, column: {
component: { width: 120,
name: SuiteValue, component: {
vModel: "modelValue", name: SuiteValue,
unit: "个" vModel: "modelValue",
}, unit: t('certd.unit_count')
align: "center" },
} align: "center"
}, }
duration: { },
title: "时长", duration: {
type: "text", title: t('certd.duration'),
form: { show: false }, type: "text",
column: { form: { show: false },
component: { column: {
name: DurationValue, component: {
vModel: "modelValue" name: DurationValue,
}, vModel: "modelValue"
width: 100, },
align: "center" width: 100,
} align: "center"
}, }
status: { },
title: "状态", status: {
type: "text", title: t('certd.status'),
form: { show: false }, type: "text",
column: { form: { show: false },
width: 100, column: {
align: "center", width: 100,
component: { align: "center",
name: UserSuiteStatus, component: {
userSuite: compute(({ row }) => { name: UserSuiteStatus,
return row; userSuite: compute(({ row }) => {
}) return row;
}, })
conditionalRender: { },
match() { conditionalRender: {
return false; match() {
} return false;
} }
} }
}, }
activeTime: { },
title: "激活时间", activeTime: {
type: "date", title: t('certd.active_time'),
column: { type: "date",
width: 150 column: {
}, width: 150
form: { },
show: false form: {
} show: false
}, }
expiresTime: { },
title: "过期时间", expiresTime: {
type: "date", title: t('certd.expires_time'),
form: { type: "date",
show: false form: {
}, show: false
column: { },
width: 150, column: {
component: { width: 150,
name: "expires-time-text", component: {
vModel: "value", name: "expires-time-text",
mode: "tag", vModel: "value",
title: compute(({ value }) => { mode: "tag",
return dayjs(value).format("YYYY-MM-DD HH:mm:ss"); title: compute(({ value }) => {
}) return dayjs(value).format("YYYY-MM-DD HH:mm:ss");
} })
} }
}, }
isPresent: { },
title: "是否赠送", isPresent: {
type: "dict-switch", title: t('certd.is_present'),
dict: dict({ type: "dict-switch",
data: [ dict: dict({
{ label: "是", value: true, color: "success" }, data: [
{ label: "否", value: false, color: "blue" } { label: t('certd.is_present_yes'), value: true, color: "success" },
] { label: t('certd.is_present_no'), value: false, color: "blue" }
}), ]
form: { }),
value: true, form: {
show: false value: true,
}, show: false
column: { },
width: 100, column: {
align: "center" width: 100,
} align: "center"
}, }
createTime: { },
title: "创建时间", createTime: {
type: "datetime", title: t('certd.create_time'),
form: { type: "datetime",
show: false form: {
}, show: false
column: { },
sorter: true, column: {
width: 160, sorter: true,
align: "center" width: 160,
} align: "center"
}, }
updateTime: { },
title: "更新时间", updateTime: {
type: "datetime", title: t('certd.update_time'),
form: { type: "datetime",
show: false form: {
}, show: false
column: { },
show: true, column: {
width: 160 show: true,
} width: 160
} }
} }
} }
}; }
};
} }