2026-02-04 15:49:01 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="sys-settings-form sys-settings-mode">
|
|
|
|
|
|
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish">
|
2026-02-10 01:57:11 +08:00
|
|
|
|
<a-form-item :label="t('certd.sys.setting.adminMode')" :name="['public', 'adminMode']">
|
2026-02-28 18:17:53 +08:00
|
|
|
|
<div class="w-full flex items-center">
|
|
|
|
|
|
<fs-dict-radio v-model:value="formState.public.adminMode" :disabled="!settingsStore.isPlus" :dict="adminModeDict" />
|
|
|
|
|
|
<vip-button class="ml-5" mode="button"></vip-button>
|
|
|
|
|
|
</div>
|
2026-03-03 23:31:42 +08:00
|
|
|
|
<div class="helper">SaaS模式:每个用户管理自己的流水线和授权资源,独立使用。</div>
|
|
|
|
|
|
<div class="helper">企业模式:通过项目合作管理流水线证书和授权资源,所有用户视为企业内部员工。</div>
|
|
|
|
|
|
<div class="helper text-red-500">建议在开始使用时固定一个合适的模式,之后就不要随意切换了。</div>
|
2026-03-08 00:48:29 +08:00
|
|
|
|
<div v-if="settingsStore.isComm" class="helper text-red-500">商业版不建议设置为企业模式,除非你确定要转成企业内部使用</div>
|
2026-03-03 23:31:42 +08:00
|
|
|
|
<div><a @click="adminModeIntroOpen = true"> 更多管理模式介绍</a></div>
|
2026-02-04 15:49:01 +08:00
|
|
|
|
</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>
|
2026-02-28 18:30:04 +08:00
|
|
|
|
|
|
|
|
|
|
<AdminModeIntro v-model:open="adminModeIntroOpen" fixed></AdminModeIntro>
|
2026-02-04 15:49:01 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="tsx">
|
|
|
|
|
|
import { reactive, ref } from "vue";
|
|
|
|
|
|
import { SysSettings } from "/@/views/sys/settings/api";
|
|
|
|
|
|
import * as api from "/@/views/sys/settings/api";
|
|
|
|
|
|
import { merge } from "lodash-es";
|
|
|
|
|
|
import { useSettingStore } from "/@/store/settings";
|
|
|
|
|
|
import { notification } from "ant-design-vue";
|
|
|
|
|
|
import { useI18n } from "/src/locales";
|
2026-02-05 19:01:03 +08:00
|
|
|
|
import { dict } from "@fast-crud/fast-crud";
|
2026-02-21 23:20:26 +08:00
|
|
|
|
import { useProjectStore } from "/@/store/project";
|
2026-02-28 18:30:04 +08:00
|
|
|
|
import AdminModeIntro from "/@/views/sys/enterprise/project/intro.vue";
|
2026-02-04 15:49:01 +08:00
|
|
|
|
const { t } = useI18n();
|
|
|
|
|
|
|
|
|
|
|
|
defineOptions({
|
|
|
|
|
|
name: "SettingMode",
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-02-28 18:30:04 +08:00
|
|
|
|
const adminModeIntroOpen = ref(false);
|
|
|
|
|
|
|
2026-02-05 19:01:03 +08:00
|
|
|
|
const adminModeDict = dict({
|
|
|
|
|
|
data: [
|
|
|
|
|
|
{
|
2026-02-10 01:57:11 +08:00
|
|
|
|
label: t("certd.sys.setting.saasMode"),
|
2026-02-05 19:01:03 +08:00
|
|
|
|
value: "saas",
|
|
|
|
|
|
},
|
2026-02-28 18:17:53 +08:00
|
|
|
|
{
|
|
|
|
|
|
label: t("certd.sys.setting.enterpriseMode"),
|
|
|
|
|
|
value: "enterprise",
|
|
|
|
|
|
},
|
2026-02-05 19:01:03 +08:00
|
|
|
|
],
|
|
|
|
|
|
});
|
2026-02-04 15:49:01 +08:00
|
|
|
|
|
|
|
|
|
|
const formState = reactive<Partial<SysSettings>>({
|
|
|
|
|
|
public: {},
|
|
|
|
|
|
private: {},
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
async function loadSysSettings() {
|
|
|
|
|
|
const data: any = await api.SysSettingsGet();
|
|
|
|
|
|
merge(formState, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const saveLoading = ref(false);
|
|
|
|
|
|
loadSysSettings();
|
|
|
|
|
|
const settingsStore = useSettingStore();
|
2026-02-21 23:20:26 +08:00
|
|
|
|
const projectStore = useProjectStore();
|
2026-02-04 15:49:01 +08:00
|
|
|
|
const onFinish = async (form: any) => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
saveLoading.value = true;
|
|
|
|
|
|
|
|
|
|
|
|
await api.SysSettingsSave(form);
|
|
|
|
|
|
await settingsStore.loadSysSettings();
|
2026-02-21 23:20:26 +08:00
|
|
|
|
await projectStore.reload();
|
2026-02-04 15:49:01 +08:00
|
|
|
|
notification.success({
|
|
|
|
|
|
message: t("certd.saveSuccess"),
|
|
|
|
|
|
});
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
saveLoading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<style lang="less"></style>
|