mirror of
https://github.com/certd/certd.git
synced 2026-05-02 19:47:26 +08:00
Merge branch 'v2_admin_mode' of https://github.com/certd/certd into v2_admin_mode
This commit is contained in:
@@ -3,6 +3,7 @@ import { get } from "lodash-es";
|
||||
import { errorLog, errorCreate } from "./tools";
|
||||
import { env } from "/src/utils/util.env";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useProjectStore } from "../store/project";
|
||||
|
||||
export class CodeError extends Error {
|
||||
code: number;
|
||||
@@ -138,11 +139,17 @@ function createRequestFunction(service: any) {
|
||||
const configDefault = {
|
||||
headers: {
|
||||
"Content-Type": get(config, "headers.Content-Type", "application/json"),
|
||||
},
|
||||
} as any,
|
||||
timeout: 30000,
|
||||
baseURL: env.API,
|
||||
data: {},
|
||||
};
|
||||
const projectStore = useProjectStore();
|
||||
|
||||
if (projectStore.isEnterprise && !config.url.startsWith("/sys")) {
|
||||
configDefault.headers["project-id"] = projectStore.currentProjectId;
|
||||
}
|
||||
|
||||
const userStore = useUserStore();
|
||||
const token = userStore.getToken;
|
||||
if (token != null) {
|
||||
|
||||
@@ -16,6 +16,7 @@ import { defineAsyncComponent } from "vue";
|
||||
import NotificationSelector from "../views/certd/notification/notification-selector/index.vue";
|
||||
import EmailSelector from "./email-selector/index.vue";
|
||||
import ValidTimeFormat from "./valid-time-format.vue";
|
||||
import ProjectSelector from "./project-selector/index.vue";
|
||||
export default {
|
||||
install(app: any) {
|
||||
app.component(
|
||||
@@ -45,5 +46,6 @@ export default {
|
||||
app.component("ExpiresTimeText", ExpiresTimeText);
|
||||
app.use(vip);
|
||||
app.use(Plugins);
|
||||
app.component("ProjectSelector", ProjectSelector);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
:options="optionsRef"
|
||||
:value="value"
|
||||
v-bind="attrs"
|
||||
:open="openProp"
|
||||
@click="onClick"
|
||||
@update:value="emit('update:value', $event)"
|
||||
>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
export async function MyProjectList() {
|
||||
return await request({
|
||||
url: "/enterprise/project/list",
|
||||
method: "post",
|
||||
data: {},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<template>
|
||||
<a-dropdown class="project-selector">
|
||||
<template #overlay>
|
||||
<a-menu @click="handleMenuClick">
|
||||
<a-menu-item v-for="item in projectStore.myProjects" :key="item.id">
|
||||
{{ item.name }}
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
<div class="rounded pl-3 pr-3 px-2 py-1 flex-center flex pointer items-center bg-accent h-10 button-text">
|
||||
<fs-icon icon="ion:apps" class="mr-1"></fs-icon>
|
||||
{{ projectStore.currentProject?.name || "..." }}
|
||||
<fs-icon icon="ion:chevron-down-outline" class="ml-1"></fs-icon>
|
||||
</div>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted } from "vue";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
defineOptions({
|
||||
name: "ProjectSelector",
|
||||
});
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
onMounted(async () => {
|
||||
await projectStore.reload();
|
||||
});
|
||||
|
||||
function handleMenuClick({ key }: any) {
|
||||
projectStore.changeCurrentProject(key);
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.project-selector {
|
||||
&.button-text {
|
||||
min-width: 100px;
|
||||
max-width: 150px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -81,6 +81,11 @@ provide("fn:ai.open", openChat);
|
||||
|
||||
<template>
|
||||
<BasicLayout @clear-preferences-and-logout="handleLogout">
|
||||
<template #header-left-0>
|
||||
<div class="ml-1 mr-2">
|
||||
<project-selector class="flex-center header-btn" />
|
||||
</div>
|
||||
</template>
|
||||
<template #user-dropdown>
|
||||
<UserDropdown :avatar="avatar" :menus="menus" :text="userStore.userInfo?.nickName || userStore.userInfo?.username" description="" tag-text="" @logout="handleLogout" />
|
||||
</template>
|
||||
|
||||
@@ -160,6 +160,8 @@ export default {
|
||||
updateTime: "Update Time",
|
||||
triggerType: "Trigger Type",
|
||||
pipelineId: "Pipeline Id",
|
||||
projectName: "Project",
|
||||
adminId: "Admin",
|
||||
},
|
||||
|
||||
pi: {
|
||||
@@ -212,6 +214,8 @@ export default {
|
||||
enterpriseSetting: "Enterprise Settings",
|
||||
projectManager: "Project Management",
|
||||
projectUserManager: "Project User Management",
|
||||
myProjectManager: "My Projects",
|
||||
myProjectDetail: "Project Detail",
|
||||
},
|
||||
certificateRepo: {
|
||||
title: "Certificate Repository",
|
||||
@@ -790,6 +794,10 @@ export default {
|
||||
pipelineSetting: "Pipeline Settings",
|
||||
oauthSetting: "OAuth2 Settings",
|
||||
networkSetting: "Network Settings",
|
||||
adminModeSetting: "Admin Mode Settings",
|
||||
adminModeHelper: "enterprise mode : allow to create and manage pipelines, roles, users, etc.\n saas mode : only allow to create and manage pipelines",
|
||||
enterpriseMode: "Enterprise Mode",
|
||||
saasMode: "SaaS Mode",
|
||||
|
||||
showRunStrategy: "Show RunStrategy",
|
||||
showRunStrategyHelper: "Allow modify the run strategy of the task",
|
||||
@@ -868,12 +876,20 @@ export default {
|
||||
fromType: "From Type",
|
||||
expirationDate: "Expiration Date",
|
||||
},
|
||||
ent: {
|
||||
projectName: "Project Name",
|
||||
projectDescription: "Project Description",
|
||||
projectDetailManager: "Project Detail",
|
||||
projectDetailDescription: "Manage Project Members",
|
||||
projectPermission: "Permission",
|
||||
permission: {
|
||||
read: "Read",
|
||||
write: "Write",
|
||||
admin: "Admin",
|
||||
},
|
||||
},
|
||||
addonSelector: {
|
||||
select: "Select",
|
||||
placeholder: "select please",
|
||||
},
|
||||
adminMode: {
|
||||
enterpriseMode: "Enterprise Mode",
|
||||
saasMode: "SaaS Mode",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -167,6 +167,8 @@ export default {
|
||||
updateTime: "更新时间",
|
||||
triggerType: "触发类型",
|
||||
pipelineId: "流水线Id",
|
||||
projectName: "项目",
|
||||
adminId: "管理员",
|
||||
},
|
||||
pi: {
|
||||
validTime: "流水线有效期",
|
||||
@@ -214,9 +216,12 @@ export default {
|
||||
orderManager: "订单管理",
|
||||
userSuites: "用户套餐",
|
||||
netTest: "网络测试",
|
||||
enterpriseSetting: "企业管理设置",
|
||||
enterpriseManager: "企业管理设置",
|
||||
projectManager: "项目管理",
|
||||
projectUserManager: "项目用户管理",
|
||||
projectDetail: "项目详情",
|
||||
enterpriseSetting: "企业设置",
|
||||
myProjectManager: "我的项目",
|
||||
myProjectDetail: "项目详情",
|
||||
},
|
||||
certificateRepo: {
|
||||
title: "证书仓库",
|
||||
@@ -796,6 +801,12 @@ export default {
|
||||
pipelineSetting: "流水线设置",
|
||||
oauthSetting: "第三方登录",
|
||||
networkSetting: "网络设置",
|
||||
adminModeSetting: "管理模式",
|
||||
adminModeHelper: "企业管理模式: 企业内部使用,通过项目来隔离权限,流水线、授权数据属于项目。\nsaas模式:供外部用户注册使用,各个用户之间数据隔离,流水线、授权数据属于用户。",
|
||||
|
||||
adminMode: "管理模式",
|
||||
enterpriseMode: "企业模式",
|
||||
saasMode: "SaaS模式",
|
||||
|
||||
showRunStrategy: "显示运行策略选择",
|
||||
showRunStrategyHelper: "任务设置中是否允许选择运行策略",
|
||||
@@ -886,11 +897,16 @@ export default {
|
||||
select: "选择",
|
||||
placeholder: "请选择",
|
||||
},
|
||||
adminMode: {
|
||||
enterpriseMode: "企业模式",
|
||||
saasMode: "SaaS模式",
|
||||
},
|
||||
ent: {
|
||||
projectName: "项目名称",
|
||||
projectDescription: "项目描述",
|
||||
projectDetailManager: "项目详情",
|
||||
projectDetailDescription: "管理项目成员",
|
||||
projectPermission: "权限",
|
||||
permission: {
|
||||
read: "读取",
|
||||
write: "写入",
|
||||
admin: "管理员",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -14,6 +14,30 @@ export const certdResources = [
|
||||
order: 0,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
title: "certd.sysResources.myProjectManager",
|
||||
name: "MyProjectManager",
|
||||
path: "/certd/project",
|
||||
component: "/certd/project/index.vue",
|
||||
meta: {
|
||||
show: true,
|
||||
icon: "ion:apps",
|
||||
permission: "sys:settings:edit",
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.myProjectDetail",
|
||||
name: "MyProjectDetail",
|
||||
path: "/certd/project/detail",
|
||||
component: "/certd/project/detail/index.vue",
|
||||
meta: {
|
||||
isMenu: false,
|
||||
show: true,
|
||||
icon: "ion:apps",
|
||||
permission: "sys:settings:edit",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.pipeline",
|
||||
name: "PipelineManager",
|
||||
@@ -94,59 +118,6 @@ export const certdResources = [
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.enterpriseManager",
|
||||
name: "EnterpriseManager",
|
||||
path: "/sys/enterprise",
|
||||
redirect: "/sys/enterprise/project",
|
||||
meta: {
|
||||
icon: "ion:cart-outline",
|
||||
permission: "sys:settings:edit",
|
||||
show: () => {
|
||||
const settingStore = useSettingStore();
|
||||
return settingStore.isEnterprise;
|
||||
},
|
||||
keepAlive: true,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
title: "certd.sysResources.projectManager",
|
||||
name: "ProjectManager",
|
||||
path: "/sys/enterprise/project",
|
||||
component: "/sys/enterprise/project/index.vue",
|
||||
meta: {
|
||||
show: true,
|
||||
icon: "ion:cart",
|
||||
permission: "sys:settings:edit",
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.projectMemberManager",
|
||||
name: "ProjectMemberManager",
|
||||
path: "/sys/enterprise/project/member",
|
||||
component: "/sys/enterprise/project/member/index.vue",
|
||||
meta: {
|
||||
isMenu: false,
|
||||
show: true,
|
||||
icon: "ion:cart",
|
||||
permission: "sys:settings:edit",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.enterpriseSetting",
|
||||
name: "EnterpriseSetting",
|
||||
path: "/sys/enterprise/setting",
|
||||
redirect: "/sys/settings?tab=mode",
|
||||
meta: {
|
||||
isMenu: true,
|
||||
show: true,
|
||||
icon: "ion:cart",
|
||||
permission: "sys:settings:edit",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "certd.settings",
|
||||
name: "MineSetting",
|
||||
|
||||
@@ -40,6 +40,30 @@ export const sysResources = [
|
||||
permission: "sys:settings:view",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.projectManager",
|
||||
name: "ProjectManager",
|
||||
path: "/sys/enterprise/project",
|
||||
component: "/sys/enterprise/project/index.vue",
|
||||
meta: {
|
||||
show: true,
|
||||
icon: "ion:apps",
|
||||
permission: "sys:settings:edit",
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.projectDetail",
|
||||
name: "ProjectDetail",
|
||||
path: "/sys/enterprise/project/detail",
|
||||
component: "/sys/enterprise/project/detail/index.vue",
|
||||
meta: {
|
||||
isMenu: false,
|
||||
show: true,
|
||||
icon: "ion:apps",
|
||||
permission: "sys:settings:edit",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.cnameSetting",
|
||||
name: "CnameSetting",
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
export async function MyProjectList() {
|
||||
return await request({
|
||||
url: "/enterprise/project/list",
|
||||
method: "post",
|
||||
data: {},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { defineStore } from "pinia";
|
||||
import * as api from "./api";
|
||||
import { message } from "ant-design-vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { useSettingStore } from "../settings";
|
||||
import { LocalStorage } from "/@/utils/util.storage";
|
||||
|
||||
export type ProjectItem = {
|
||||
id: string;
|
||||
name: string;
|
||||
permission?: string;
|
||||
};
|
||||
|
||||
export const useProjectStore = defineStore("app.project", () => {
|
||||
const myProjects = ref([]);
|
||||
const lastProjectId = LocalStorage.get("currentProjectId");
|
||||
const currentProjectId = ref(lastProjectId); // 直接调用
|
||||
|
||||
const projects = computed(() => {
|
||||
return myProjects.value;
|
||||
});
|
||||
const currentProject = computed(() => {
|
||||
if (currentProjectId.value) {
|
||||
const project = projects.value.find(item => item.id === currentProjectId.value);
|
||||
if (project) {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
if (projects.value.length > 0) {
|
||||
return projects.value[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
const settingStore = useSettingStore();
|
||||
const isEnterprise = computed(() => {
|
||||
return settingStore.isEnterprise;
|
||||
});
|
||||
|
||||
function getSearchForm() {
|
||||
if (!currentProjectId.value || !isEnterprise.value) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
projectId: currentProjectId.value,
|
||||
};
|
||||
}
|
||||
async function loadMyProjects(): Promise<ProjectItem[]> {
|
||||
if (!isEnterprise.value) {
|
||||
return [];
|
||||
}
|
||||
const projects = await api.MyProjectList();
|
||||
myProjects.value = projects;
|
||||
}
|
||||
|
||||
function changeCurrentProject(id: string) {
|
||||
currentProjectId.value = id;
|
||||
LocalStorage.set("currentProjectId", id);
|
||||
message.success("切换项目成功");
|
||||
}
|
||||
|
||||
async function reload() {
|
||||
const projects = await api.MyProjectList();
|
||||
myProjects.value = projects;
|
||||
}
|
||||
|
||||
async function init() {
|
||||
if (!myProjects.value) {
|
||||
await reload();
|
||||
}
|
||||
return myProjects.value;
|
||||
}
|
||||
|
||||
return {
|
||||
projects,
|
||||
myProjects,
|
||||
currentProject,
|
||||
currentProjectId,
|
||||
isEnterprise,
|
||||
getSearchForm,
|
||||
loadMyProjects,
|
||||
changeCurrentProject,
|
||||
reload,
|
||||
init,
|
||||
};
|
||||
});
|
||||
@@ -3,6 +3,8 @@ import { ref } from "vue";
|
||||
import { getCommonColumnDefine } from "/@/views/certd/access/common";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { myProjectDict } from "../../../dicts";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
@@ -44,6 +46,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
context.typeRef = typeRef;
|
||||
const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api);
|
||||
commonColumnsDefine.type.form.component.disabled = true;
|
||||
const projectStore = useProjectStore();
|
||||
return {
|
||||
typeRef,
|
||||
crudOptions: {
|
||||
@@ -58,6 +61,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
search: {
|
||||
show: true,
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
form: {
|
||||
wrapper: {
|
||||
@@ -141,6 +147,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
...commonColumnsDefine,
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// @ts-ignore
|
||||
import { useI18n } from "/src/locales";
|
||||
import { ref } from "vue";
|
||||
import { getCommonColumnDefine } from "/@/views/certd/access/common";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
import { myProjectDict } from "../dicts";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { getCommonColumnDefine } from "/@/views/certd/access/common";
|
||||
import { useI18n } from "/src/locales";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
@@ -29,6 +31,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
|
||||
const typeRef = ref();
|
||||
const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api);
|
||||
const projectStore = useProjectStore();
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -42,6 +45,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
confirmMessage: "授权如果已经被使用,可能会导致流水线无法正常运行,请谨慎操作",
|
||||
},
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
rowHandle: {
|
||||
width: 200,
|
||||
buttons: {
|
||||
@@ -115,6 +123,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
...commonColumnsDefine,
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -17,6 +17,16 @@ export const projectPermissionDict = dict({
|
||||
],
|
||||
});
|
||||
|
||||
export const projectDict = dict({
|
||||
url: "/sys/enterprise/project/list",
|
||||
export const myProjectDict = dict({
|
||||
url: "/enterprise/project/list",
|
||||
});
|
||||
|
||||
export const userDict = dict({
|
||||
url: "/sys/authority/user/getSimpleUsers",
|
||||
value: "id",
|
||||
onReady: ({ dict }) => {
|
||||
for (const item of dict.data) {
|
||||
item.label = item.nickName || item.username || item.phoneCode + item.mobile;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -6,6 +6,8 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
|
||||
import { myProjectDict } from "../dicts";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
@@ -32,6 +34,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const selectedRowKeys: Ref<any[]> = ref([]);
|
||||
context.selectedRowKeys = selectedRowKeys;
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
settings: {
|
||||
@@ -64,6 +68,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
formItem: {
|
||||
labelCol: {
|
||||
style: {
|
||||
@@ -195,17 +202,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
align: "center",
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.fields.createTime"),
|
||||
type: "datetime",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 160,
|
||||
align: "center",
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.fields.updateTime"),
|
||||
|
||||
@@ -10,6 +10,8 @@ import { notification } from "ant-design-vue";
|
||||
import CertView from "/@/views/certd/pipeline/cert-view.vue";
|
||||
import { useCertUpload } from "/@/views/certd/pipeline/cert-upload/use";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { myProjectDict } from "../../dicts";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
@@ -36,7 +38,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const router = useRouter();
|
||||
|
||||
const settingStore = useSettingStore();
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
const model = useModal();
|
||||
const viewCert = async (row: any) => {
|
||||
const cert = await api.GetCert(row.id);
|
||||
@@ -63,6 +65,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const expireStatus = route?.query?.expireStatus as string;
|
||||
const searchInitForm = {
|
||||
expiresLeft: expireStatus,
|
||||
...projectStore.getSearchForm(),
|
||||
};
|
||||
return {
|
||||
crudOptions: {
|
||||
@@ -344,6 +347,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -13,6 +13,8 @@ import { useSiteImport } from "/@/views/certd/monitor/site/use";
|
||||
import { ref } from "vue";
|
||||
import GroupSelector from "../../basic/group/group-selector.vue";
|
||||
import { createGroupDictRef } from "../../basic/group/api";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { myProjectDict } from "../../dicts";
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const api = siteInfoApi;
|
||||
@@ -105,6 +107,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
return searchFrom.groupId;
|
||||
}
|
||||
}
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
return {
|
||||
id: "siteMonitorCrud",
|
||||
crudOptions: {
|
||||
@@ -289,6 +293,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
// name: "disabled",
|
||||
// show: true,
|
||||
// },
|
||||
search: {
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
@@ -800,6 +809,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -5,6 +5,8 @@ import { forEach, get, merge, set } from "lodash-es";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import { mitter } from "/@/utils/util.mitt";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { myProjectDict } from "../dicts";
|
||||
|
||||
export function notificationProvide(api: any) {
|
||||
provide("notificationApi", api);
|
||||
@@ -26,6 +28,8 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
},
|
||||
};
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
|
||||
provide("getCurrentPluginDefine", () => {
|
||||
return currentDefine;
|
||||
});
|
||||
@@ -247,5 +251,10 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
},
|
||||
},
|
||||
} as ColumnCompositionProps,
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ref } from "vue";
|
||||
import { getCommonColumnDefine } from "./common";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { createNotificationApi } from "/@/views/certd/notification/api";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
const api = createNotificationApi();
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
@@ -26,6 +27,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
|
||||
const typeRef = ref();
|
||||
const commonColumnsDefine = getCommonColumnDefine(crudExpose, typeRef, api);
|
||||
const projectStore = useProjectStore();
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -34,6 +36,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
|
||||
+5
@@ -2,6 +2,7 @@
|
||||
import { ref } from "vue";
|
||||
import { getCommonColumnDefine } from "../../common";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { crudBinding } = crudExpose;
|
||||
@@ -29,6 +30,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
return res;
|
||||
};
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
const selectedRowKey = ref([props.modelValue]);
|
||||
|
||||
const onSelectChange = (changed: any) => {
|
||||
@@ -54,6 +56,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
search: {
|
||||
show: false,
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
|
||||
@@ -3,6 +3,8 @@ import { useI18n } from "/src/locales";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { OPEN_API_DOC, openkeyApi } from "./api";
|
||||
import { useModal } from "/@/use/use-modal";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { myProjectDict } from "../../dicts";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
@@ -26,6 +28,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
const projectStore = useProjectStore();
|
||||
const model = useModal();
|
||||
return {
|
||||
crudOptions: {
|
||||
@@ -37,6 +40,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
search: {
|
||||
show: false,
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
@@ -163,6 +169,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.fields.createTime"),
|
||||
type: "datetime",
|
||||
|
||||
@@ -14,7 +14,8 @@ import GroupSelector from "/@/views/certd/pipeline/group/group-selector.vue";
|
||||
import { statusUtil } from "/@/views/certd/pipeline/pipeline/utils/util.status";
|
||||
import { useCertViewer } from "/@/views/certd/pipeline/use";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { projectDict } from "../dicts";
|
||||
import { myProjectDict } from "../dicts";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
|
||||
export default function ({ crudExpose, context: { selectedRowKeys, openCertApplyDialog } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
@@ -67,6 +68,8 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
|
||||
const userStore = useUserStore();
|
||||
const settingStore = useSettingStore();
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
|
||||
const DEFAULT_WILL_EXPIRE_DAYS = settingStore.sysPublic.defaultWillExpireDays || settingStore.sysPublic.defaultCertRenewDays || 15;
|
||||
|
||||
function onDialogOpen(opt: any) {
|
||||
@@ -148,7 +151,9 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
|
||||
},
|
||||
},
|
||||
search: {
|
||||
col: { span: 3 },
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
form: {
|
||||
afterSubmit({ form, res, mode }) {
|
||||
@@ -440,6 +445,7 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
|
||||
type: "dict-select",
|
||||
search: {
|
||||
show: true,
|
||||
col: { span: 2 },
|
||||
},
|
||||
dict: dict({
|
||||
data: statusUtil.getOptions(),
|
||||
@@ -532,6 +538,7 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
|
||||
type: "dict-select",
|
||||
search: {
|
||||
show: true,
|
||||
col: { span: 2 },
|
||||
},
|
||||
dict: dict({
|
||||
data: [
|
||||
@@ -631,8 +638,8 @@ export default function ({ crudExpose, context: { selectedRowKeys, openCertApply
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "number",
|
||||
dict: projectDict,
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
updateTime: {
|
||||
title: t("certd.fields.updateTime"),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useI18n } from "/src/locales";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { pipelineGroupApi } from "./api";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { myProjectDict } from "../../dicts";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
@@ -25,6 +27,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
return res;
|
||||
};
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
settings: {
|
||||
@@ -44,6 +48,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
@@ -127,6 +136,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
width: 400,
|
||||
},
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -6,6 +6,8 @@ import createCrudOptionsPipeline from "../crud";
|
||||
import * as pipelineApi from "../api";
|
||||
import { useTemplate } from "/@/views/certd/pipeline/template/use";
|
||||
import { useI18n } from "/@/locales";
|
||||
import { useProjectStore } from "/@/store/project";
|
||||
import { myProjectDict } from "../../dicts";
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const api = templateApi;
|
||||
const { t } = useI18n();
|
||||
@@ -28,6 +30,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
const projectStore = useProjectStore();
|
||||
const { openCrudFormDialog } = useFormWrapper();
|
||||
const router = useRouter();
|
||||
|
||||
@@ -48,6 +52,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
router.push({ path: "/certd/pipeline/template/edit", query: { templateId: res.id, editMode: "true" } });
|
||||
},
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
...projectStore.getSearchForm(),
|
||||
},
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
@@ -232,6 +241,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
},
|
||||
projectId: {
|
||||
title: t("certd.fields.projectName"),
|
||||
type: "dict-select",
|
||||
dict: myProjectDict,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
const apiPrefix = "/enterprise/project";
|
||||
|
||||
export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/list",
|
||||
method: "post",
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetPage(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetDetail(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/detail",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function DeleteBatch(ids: any[]) {
|
||||
return await request({
|
||||
url: apiPrefix + "/deleteByIds",
|
||||
method: "post",
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
export async function SetDisabled(id: any, disabled: boolean) {
|
||||
return await request({
|
||||
url: apiPrefix + "/setDisabled",
|
||||
method: "post",
|
||||
data: { id, disabled },
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
import * as api from "./api";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { computed, Ref, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, utils } from "@fast-crud/fast-crud";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import { userDict } from "../dicts";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
const list = await api.GetList(query);
|
||||
|
||||
return {
|
||||
records: list,
|
||||
total: list.length,
|
||||
offset: 0,
|
||||
limit: 999,
|
||||
};
|
||||
};
|
||||
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 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,
|
||||
},
|
||||
},
|
||||
name: {
|
||||
title: t("certd.ent.projectName"),
|
||||
type: "link",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
component: {},
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
cellRender({ row }) {
|
||||
return <router-link to={{ path: `/certd/project/detail`, query: { projectId: row.id } }}>{row.name}</router-link>;
|
||||
},
|
||||
},
|
||||
},
|
||||
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();
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
adminId: {
|
||||
title: t("certd.fields.adminId"),
|
||||
type: "dict-select",
|
||||
dict: userDict,
|
||||
column: {
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
const apiPrefix = "/enterprise/myProjectMember";
|
||||
const userApiPrefix = "/sys/authority/user";
|
||||
export async function GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
|
||||
export async function AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export async function UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
}
|
||||
|
||||
export async function DelObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetObj(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetDetail(id: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/detail",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
}
|
||||
|
||||
export async function DeleteBatch(ids: any[]) {
|
||||
return await request({
|
||||
url: apiPrefix + "/deleteByIds",
|
||||
method: "post",
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
export async function GetUserSimpleByIds(query: any) {
|
||||
return await request({
|
||||
url: userApiPrefix + "/getSimpleByIds",
|
||||
method: "post",
|
||||
data: query,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import { Ref, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import * as api from "./api";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { userDict } from "../../dicts";
|
||||
|
||||
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 addRequest = async ({ form }: AddReq) => {
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
const projectId = context.projectId;
|
||||
|
||||
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",
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
projectId,
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
projectId: {
|
||||
title: "项目ID",
|
||||
type: "text",
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
value: projectId,
|
||||
show: false,
|
||||
},
|
||||
editForm: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
userId: {
|
||||
title: "用户",
|
||||
type: "dict-select",
|
||||
dict: userDict,
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {},
|
||||
editForm: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
},
|
||||
},
|
||||
permission: {
|
||||
title: t("certd.ent.projectPermission"),
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.ent.permission.read"), value: "read", color: "cyan" },
|
||||
{ label: t("certd.ent.permission.write"), value: "write", color: "blue" },
|
||||
{ label: t("certd.ent.permission.admin"), value: "admin", color: "green" },
|
||||
],
|
||||
}),
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
show: true,
|
||||
},
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<fs-page class="page-project-detail">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.ent.projectDetailManager") }}
|
||||
<span class="sub">
|
||||
{{ t("certd.ent.projectDetailDescription") }}
|
||||
</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";
|
||||
import createCrudOptions from "./crud";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { DeleteBatch } from "./api";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "ProjectDetail",
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
const projectIdStr = route.query.projectId as string;
|
||||
const projectId = Number(projectIdStr);
|
||||
|
||||
const context: any = {
|
||||
projectId,
|
||||
};
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context });
|
||||
|
||||
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"));
|
||||
}
|
||||
};
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
@@ -0,0 +1,61 @@
|
||||
<template>
|
||||
<fs-page class="page-cert">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.sysResources.myProjectManager") }}
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<!-- <div v-if="crudBinding.data" class="project-list">
|
||||
<div v-for="item of crudBinding.data" :key="item.id" class="project-item">
|
||||
<a-card style="width: 300px">
|
||||
<p>{{ item.name }}</p>
|
||||
</a-card>
|
||||
</div>
|
||||
</div> -->
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { DeleteBatch } from "./api";
|
||||
import { useI18n } from "/src/locales";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "MyProjectManager",
|
||||
});
|
||||
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"));
|
||||
}
|
||||
};
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(async () => {
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
@@ -0,0 +1,11 @@
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
|
||||
export const userDict = dict({
|
||||
url: "/sys/authority/user/getSimpleUsers",
|
||||
value: "id",
|
||||
onReady: ({ dict }) => {
|
||||
for (const item of dict.data) {
|
||||
item.label = item.nickName || item.username || item.phoneCode + item.mobile;
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -6,6 +6,7 @@ import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq,
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { Modal } from "ant-design-vue";
|
||||
import { userDict } from "../dicts";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
@@ -80,17 +81,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
form: {
|
||||
component: {},
|
||||
helper: t("certd.ent.projectNameHelper"),
|
||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
cellRender({ row }) {
|
||||
return (
|
||||
<router-link to={`/sys/enterprise/project/detail`} query={{ projectId: row.id }}>
|
||||
{row.name}
|
||||
</router-link>
|
||||
);
|
||||
return <router-link to={{ path: `/sys/enterprise/project/detail`, query: { projectId: row.id } }}>{row.name}</router-link>;
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -125,6 +121,14 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
},
|
||||
adminId: {
|
||||
title: t("certd.fields.adminId"),
|
||||
type: "dict-select",
|
||||
dict: userDict,
|
||||
column: {
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
|
||||
@@ -6,6 +6,7 @@ import * as api from "./api";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { userDict } from "../../dicts";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
@@ -27,6 +28,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
return res;
|
||||
};
|
||||
|
||||
const projectId = context.projectId;
|
||||
|
||||
const userStore = useUserStore();
|
||||
const settingStore = useSettingStore();
|
||||
const selectedRowKeys: Ref<any[]> = ref([]);
|
||||
@@ -60,6 +63,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
minWidth: 200,
|
||||
fixed: "right",
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
projectId,
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
@@ -79,6 +87,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: false,
|
||||
},
|
||||
form: {
|
||||
value: projectId,
|
||||
show: false,
|
||||
},
|
||||
editForm: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
@@ -87,23 +99,18 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
userId: {
|
||||
title: "用户ID",
|
||||
title: "用户",
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
url: "/sys/authority/user/getSimpleUsers",
|
||||
value: "id",
|
||||
label: "nickName",
|
||||
labelBuilder: (item: any) => item.nickName || item.username || item.phoneCode + item.mobile,
|
||||
}),
|
||||
dict: userDict,
|
||||
search: {
|
||||
show: false,
|
||||
show: true,
|
||||
},
|
||||
form: {
|
||||
form: {},
|
||||
editForm: {
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
width: 200,
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
permission: {
|
||||
@@ -111,9 +118,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "dict-select",
|
||||
dict: dict({
|
||||
data: [
|
||||
{ label: t("certd.read"), value: "read", color: "cyan" },
|
||||
{ label: t("certd.write"), value: "write", color: "blue" },
|
||||
{ label: t("certd.admin"), value: "admin", color: "green" },
|
||||
{ label: t("certd.ent.permission.read"), value: "read", color: "cyan" },
|
||||
{ label: t("certd.ent.permission.write"), value: "write", color: "blue" },
|
||||
{ label: t("certd.ent.permission.admin"), value: "admin", color: "green" },
|
||||
],
|
||||
}),
|
||||
search: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<fs-page class="page-project-member">
|
||||
<fs-page class="page-project-detail">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
{{ t("certd.projectMemberManager") }}
|
||||
{{ t("certd.ent.projectDetailManager") }}
|
||||
<span class="sub">
|
||||
{{ t("certd.projectMemberDescription") }}
|
||||
{{ t("certd.ent.projectDetailDescription") }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
@@ -30,7 +30,7 @@ import { useRoute } from "vue-router";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "ProjectMemberManager",
|
||||
name: "ProjectDetail",
|
||||
});
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<a-tab-pane key="network" :tab="t('certd.sys.setting.networkSetting')">
|
||||
<SettingNetwork v-if="activeKey === 'network'" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="mode" :tab="t('certd.adminMode')">
|
||||
<a-tab-pane key="mode" :tab="t('certd.sys.setting.adminModeSetting')">
|
||||
<SettingMode v-if="activeKey === 'mode'" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<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">
|
||||
<a-form-item :label="t('certd.adminMode')" :name="['public', 'adminMode']">
|
||||
<a-form-item :label="t('certd.sys.setting.adminMode')" :name="['public', 'adminMode']">
|
||||
<fs-dict-radio v-model:value="formState.public.adminMode" :dict="adminModeDict" />
|
||||
</a-form-item>
|
||||
|
||||
@@ -30,11 +30,11 @@ defineOptions({
|
||||
const adminModeDict = dict({
|
||||
data: [
|
||||
{
|
||||
label: t("certd.adminMode.enterpriseMode"),
|
||||
label: t("certd.sys.setting.enterpriseMode"),
|
||||
value: "enterprise",
|
||||
},
|
||||
{
|
||||
label: t("certd.adminMode.saasMode"),
|
||||
label: t("certd.sys.setting.saasMode"),
|
||||
value: "saas",
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user