mirror of
https://github.com/certd/certd.git
synced 2026-07-26 13:57:46 +08:00
perf: 商业版支持自定义插件的参数配置
This commit is contained in:
@@ -4,54 +4,67 @@ import { useI18n } from "/@/locales";
|
||||
import { Modal, notification } from "ant-design-vue";
|
||||
import ConfigEditor from "./config-editor.vue";
|
||||
import { useModal } from "/@/use/use-modal";
|
||||
import { ref } from "vue";
|
||||
export function usePluginConfig() {
|
||||
const { openCrudFormDialog } = useFormWrapper();
|
||||
const { t } = useI18n();
|
||||
|
||||
const modal = useModal();
|
||||
async function openConfigDialog({ row, crudExpose }) {
|
||||
// function createCrudOptions() {
|
||||
// return {
|
||||
// crudOptions: {
|
||||
// columns: {},
|
||||
// form: {
|
||||
// wrapper: {
|
||||
// width: "80%",
|
||||
// title: "插件元数据配置",
|
||||
// saveRemind: false,
|
||||
// slots: {
|
||||
// "form-body-top": () => {
|
||||
// return (
|
||||
// <div>
|
||||
// <ConfigEditor plugin={row}></ConfigEditor>
|
||||
// </div>
|
||||
// );
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// afterSubmit() {
|
||||
// notification.success({ message: t("certd.operationSuccess") });
|
||||
// crudExpose.doRefresh();
|
||||
// },
|
||||
// async doSubmit({ form }: any) {
|
||||
// return await api.ImportPlugin({
|
||||
// ...form,
|
||||
// });
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
// const { crudOptions } = createCrudOptions();
|
||||
// await openCrudFormDialog({ crudOptions });
|
||||
const configEditorRef = ref();
|
||||
function createCrudOptions() {
|
||||
return {
|
||||
crudOptions: {
|
||||
columns: {},
|
||||
form: {
|
||||
wrapper: {
|
||||
width: "80%",
|
||||
title: "插件元数据配置",
|
||||
saveRemind: false,
|
||||
slots: {
|
||||
"form-body-top": () => {
|
||||
return (
|
||||
<div>
|
||||
<ConfigEditor ref={configEditorRef} plugin={row}></ConfigEditor>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
},
|
||||
afterSubmit() {
|
||||
notification.success({ message: t("certd.operationSuccess") });
|
||||
crudExpose.doRefresh();
|
||||
},
|
||||
async doSubmit({}: any) {
|
||||
const form = configEditorRef.value.getForm();
|
||||
const newForm: any = {};
|
||||
for (const key in form) {
|
||||
const value = form[key];
|
||||
if (value && Object.keys(value).length > 0) {
|
||||
newForm[key] = value;
|
||||
}
|
||||
}
|
||||
return await api.savePluginSetting({
|
||||
name: row.name,
|
||||
sysSetting: {
|
||||
metadata: newForm,
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
const { crudOptions } = createCrudOptions();
|
||||
await openCrudFormDialog({ crudOptions });
|
||||
|
||||
modal.confirm({
|
||||
title: "插件元数据配置",
|
||||
width: "80%",
|
||||
content: () => {
|
||||
return <ConfigEditor plugin={row}></ConfigEditor>;
|
||||
},
|
||||
});
|
||||
// modal.confirm({
|
||||
// title: "插件元数据配置",
|
||||
// width: "80%",
|
||||
// content: () => {
|
||||
// return <ConfigEditor plugin={row}></ConfigEditor>;
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user