mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
chore: project member
This commit is contained in:
@@ -883,4 +883,7 @@ export default {
|
|||||||
enterpriseMode: "企业模式",
|
enterpriseMode: "企业模式",
|
||||||
saasMode: "SaaS模式",
|
saasMode: "SaaS模式",
|
||||||
},
|
},
|
||||||
|
ent: {
|
||||||
|
projectName: "项目名称",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -215,10 +215,10 @@ export const sysResources = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "certd.sysResources.projectUserManager",
|
title: "certd.sysResources.projectMemberManager",
|
||||||
name: "ProjectUserManager",
|
name: "ProjectMemberManager",
|
||||||
path: "/sys/enterprise/project/user",
|
path: "/sys/enterprise/project/member",
|
||||||
component: "/sys/enterprise/project/user/index.vue",
|
component: "/sys/enterprise/project/member/index.vue",
|
||||||
meta: {
|
meta: {
|
||||||
isMenu: false,
|
isMenu: false,
|
||||||
show: true,
|
show: true,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { request } from "/src/api/service";
|
import { request } from "/src/api/service";
|
||||||
|
|
||||||
const apiPrefix = "/sys/project/provider";
|
const apiPrefix = "/sys/enterprise/project";
|
||||||
|
const userApiPrefix = "/sys/authority/user";
|
||||||
|
|
||||||
export async function GetList(query: any) {
|
export async function GetList(query: any) {
|
||||||
return await request({
|
return await request({
|
||||||
@@ -58,14 +59,6 @@ export async function DeleteBatch(ids: any[]) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function SetDefault(id: any) {
|
|
||||||
return await request({
|
|
||||||
url: apiPrefix + "/setDefault",
|
|
||||||
method: "post",
|
|
||||||
data: { id },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function SetDisabled(id: any, disabled: boolean) {
|
export async function SetDisabled(id: any, disabled: boolean) {
|
||||||
return await request({
|
return await request({
|
||||||
url: apiPrefix + "/setDisabled",
|
url: apiPrefix + "/setDisabled",
|
||||||
|
|||||||
@@ -72,128 +72,21 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
|||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
domain: {
|
name: {
|
||||||
title: t("certd.cnameDomain"),
|
title: t("certd.ent.projectName"),
|
||||||
type: "text",
|
type: "text",
|
||||||
editForm: {
|
|
||||||
component: {
|
|
||||||
disabled: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
search: {
|
search: {
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
component: {
|
component: {},
|
||||||
placeholder: t("certd.cnameDomainPlaceholder"),
|
helper: t("certd.ent.projectNameHelper"),
|
||||||
},
|
rules: [{ required: true, message: t("certd.requiredField") }],
|
||||||
helper: t("certd.cnameDomainHelper"),
|
|
||||||
rules: [
|
|
||||||
{ required: true, message: t("certd.requiredField") },
|
|
||||||
{ pattern: /^[^*]+$/, message: t("certd.cnameDomainPattern") },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
column: {
|
column: {
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dnsProviderType: {
|
|
||||||
title: t("certd.dnsProvider"),
|
|
||||||
type: "dict-select",
|
|
||||||
search: {
|
|
||||||
show: true,
|
|
||||||
},
|
|
||||||
dict: dict({
|
|
||||||
url: "pi/dnsProvider/list",
|
|
||||||
value: "key",
|
|
||||||
label: "title",
|
|
||||||
}),
|
|
||||||
form: {
|
|
||||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
|
||||||
},
|
|
||||||
column: {
|
|
||||||
width: 150,
|
|
||||||
component: {
|
|
||||||
color: "auto",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
accessId: {
|
|
||||||
title: t("certd.dnsProviderAuthorization"),
|
|
||||||
type: "dict-select",
|
|
||||||
dict: dict({
|
|
||||||
url: "/pi/access/list",
|
|
||||||
value: "id",
|
|
||||||
label: "name",
|
|
||||||
}),
|
|
||||||
form: {
|
|
||||||
component: {
|
|
||||||
name: "access-selector",
|
|
||||||
vModel: "modelValue",
|
|
||||||
type: compute(({ form }) => {
|
|
||||||
return form.dnsProviderType;
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
rules: [{ required: true, message: t("certd.requiredField") }],
|
|
||||||
},
|
|
||||||
column: {
|
|
||||||
width: 150,
|
|
||||||
component: {
|
|
||||||
color: "auto",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
isDefault: {
|
|
||||||
title: t("certd.isDefault"),
|
|
||||||
type: "dict-switch",
|
|
||||||
dict: dict({
|
|
||||||
data: [
|
|
||||||
{ label: t("certd.yes"), value: true, color: "success" },
|
|
||||||
{ label: t("certd.no"), value: false, color: "default" },
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
form: {
|
|
||||||
value: false,
|
|
||||||
rules: [{ required: true, message: t("certd.selectIsDefault") }],
|
|
||||||
},
|
|
||||||
column: {
|
|
||||||
align: "center",
|
|
||||||
width: 100,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
setDefault: {
|
|
||||||
title: t("certd.setDefault"),
|
|
||||||
type: "text",
|
|
||||||
form: {
|
|
||||||
show: false,
|
|
||||||
},
|
|
||||||
column: {
|
|
||||||
width: 100,
|
|
||||||
align: "center",
|
|
||||||
conditionalRenderDisabled: true,
|
|
||||||
cellRender: ({ row }) => {
|
|
||||||
if (row.isDefault) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const onClick = async () => {
|
|
||||||
Modal.confirm({
|
|
||||||
title: t("certd.prompt"),
|
|
||||||
content: t("certd.confirmSetDefault"),
|
|
||||||
onOk: async () => {
|
|
||||||
await api.SetDefault(row.id);
|
|
||||||
await crudExpose.doRefresh();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<a-button type={"link"} size={"small"} onClick={onClick}>
|
|
||||||
{t("certd.setAsDefault")}
|
|
||||||
</a-button>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
disabled: {
|
disabled: {
|
||||||
title: t("certd.disabled"),
|
title: t("certd.disabled"),
|
||||||
type: "dict-switch",
|
type: "dict-switch",
|
||||||
|
|||||||
@@ -2,13 +2,7 @@
|
|||||||
<fs-page class="page-cert">
|
<fs-page class="page-cert">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="title">
|
<div class="title">
|
||||||
{{ t("certd.cnameTitle") }}
|
{{ t("certd.sysResources.projectManager") }}
|
||||||
<span class="sub">
|
|
||||||
{{ t("certd.cnameDescription") }}
|
|
||||||
<a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">
|
|
||||||
{{ t("certd.cnameLinkText") }}
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||||
@@ -32,7 +26,7 @@ import { useI18n } from "/src/locales";
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: "CnameProvider",
|
name: "ProjectManager",
|
||||||
});
|
});
|
||||||
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
|
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
import { request } from "/src/api/service";
|
||||||
|
|
||||||
|
const apiPrefix = "/sys/enterprise/projectMember";
|
||||||
|
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,155 @@
|
|||||||
|
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";
|
||||||
|
|
||||||
|
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 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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
projectId: {
|
||||||
|
title: "项目ID",
|
||||||
|
type: "text",
|
||||||
|
search: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
column: {
|
||||||
|
width: 200,
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
title: "用户ID",
|
||||||
|
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,
|
||||||
|
}),
|
||||||
|
search: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
column: {
|
||||||
|
width: 200,
|
||||||
|
show: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
permission: {
|
||||||
|
title: t("certd.ent.projectPermission"),
|
||||||
|
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" },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
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,54 @@
|
|||||||
|
<template>
|
||||||
|
<fs-page class="page-project-member">
|
||||||
|
<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";
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: "ProjectMemberManager",
|
||||||
|
});
|
||||||
|
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>
|
||||||
@@ -28,7 +28,7 @@ export class UserController extends CrudController<UserService> {
|
|||||||
return this.service;
|
return this.service;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('/getSimpleUserByIds', {summary: 'sys:auth:user:add'})
|
@Post('/getSimpleUserByIds', {summary: 'sys:auth:user:view'})
|
||||||
async getSimpleUserByIds(@Body('ids') ids: number[]) {
|
async getSimpleUserByIds(@Body('ids') ids: number[]) {
|
||||||
const users = await this.service.find({
|
const users = await this.service.find({
|
||||||
select: {
|
select: {
|
||||||
@@ -46,6 +46,21 @@ export class UserController extends CrudController<UserService> {
|
|||||||
return this.ok(users);
|
return this.ok(users);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Post('/getSimpleUsers', {summary: 'sys:auth:user:view'})
|
||||||
|
async getSimpleUsers() {
|
||||||
|
const users = await this.service.find({
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
username: true,
|
||||||
|
nickName: true,
|
||||||
|
mobile: true,
|
||||||
|
phoneCode: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
return this.ok(users);
|
||||||
|
}
|
||||||
|
|
||||||
@Post('/page', {summary: 'sys:auth:user:view'})
|
@Post('/page', {summary: 'sys:auth:user:view'})
|
||||||
async page(
|
async page(
|
||||||
@Body(ALL)
|
@Body(ALL)
|
||||||
@@ -153,4 +168,6 @@ export class UserController extends CrudController<UserService> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -1,16 +1,16 @@
|
|||||||
import { CrudController, SysSettingsService } from "@certd/lib-server";
|
import { CrudController, SysSettingsService } from "@certd/lib-server";
|
||||||
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
|
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
|
||||||
import { ProjectUserEntity } from "../../../modules/sys/enterprise/entity/project-user.js";
|
import { ProjectMemberEntity } from "../../../modules/sys/enterprise/entity/project-member.js";
|
||||||
import { ProjectUserService } from "../../../modules/sys/enterprise/service/project-user-service.js";
|
import { ProjectMemberService } from "../../../modules/sys/enterprise/service/project-member-service.js";
|
||||||
import { merge } from "lodash-es";
|
import { merge } from "lodash-es";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@Provide()
|
@Provide()
|
||||||
@Controller("/api/sys/enterprise/projectUser")
|
@Controller("/api/sys/enterprise/projectMember")
|
||||||
export class SysProjectUserController extends CrudController<ProjectUserEntity> {
|
export class SysProjectMemberController extends CrudController<ProjectMemberEntity> {
|
||||||
@Inject()
|
@Inject()
|
||||||
service: ProjectUserService;
|
service: ProjectMemberService;
|
||||||
|
|
||||||
@Inject()
|
@Inject()
|
||||||
sysSettingsService: SysSettingsService;
|
sysSettingsService: SysSettingsService;
|
||||||
+3
-3
@@ -2,8 +2,8 @@ import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@Entity('cd_project_user')
|
@Entity('cd_project_member')
|
||||||
export class ProjectUserEntity {
|
export class ProjectMemberEntity {
|
||||||
@PrimaryGeneratedColumn()
|
@PrimaryGeneratedColumn()
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ export class ProjectUserEntity {
|
|||||||
projectId: number;
|
projectId: number;
|
||||||
|
|
||||||
@Column({ name: 'permission', comment: '权限' })
|
@Column({ name: 'permission', comment: '权限' })
|
||||||
permission: string; // read / write
|
permission: string; // read / write / admin
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
name: 'create_time',
|
name: 'create_time',
|
||||||
+5
-5
@@ -2,13 +2,13 @@ import {Inject, Provide, Scope, ScopeEnum} from '@midwayjs/core';
|
|||||||
import {BaseService, SysSettingsService} from '@certd/lib-server';
|
import {BaseService, SysSettingsService} from '@certd/lib-server';
|
||||||
import {InjectEntityModel} from '@midwayjs/typeorm';
|
import {InjectEntityModel} from '@midwayjs/typeorm';
|
||||||
import {Repository} from 'typeorm';
|
import {Repository} from 'typeorm';
|
||||||
import { ProjectUserEntity } from '../entity/project-user.js';
|
import { ProjectMemberEntity } from '../entity/project-member.js';
|
||||||
|
|
||||||
@Provide()
|
@Provide()
|
||||||
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
@Scope(ScopeEnum.Request, { allowDowngrade: true })
|
||||||
export class ProjectUserService extends BaseService<ProjectUserEntity> {
|
export class ProjectMemberService extends BaseService<ProjectMemberEntity> {
|
||||||
@InjectEntityModel(ProjectUserEntity)
|
@InjectEntityModel(ProjectMemberEntity)
|
||||||
repository: Repository<ProjectUserEntity>;
|
repository: Repository<ProjectMemberEntity>;
|
||||||
|
|
||||||
@Inject()
|
@Inject()
|
||||||
sysSettingsService: SysSettingsService;
|
sysSettingsService: SysSettingsService;
|
||||||
@@ -18,7 +18,7 @@ export class ProjectUserService extends BaseService<ProjectUserEntity> {
|
|||||||
return this.repository;
|
return this.repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
async add(bean: ProjectUserEntity) {
|
async add(bean: ProjectMemberEntity) {
|
||||||
const {projectId, userId} = bean;
|
const {projectId, userId} = bean;
|
||||||
if (!projectId) {
|
if (!projectId) {
|
||||||
throw new Error('项目ID不能为空');
|
throw new Error('项目ID不能为空');
|
||||||
Reference in New Issue
Block a user