chore: 支持仅查询其他用户的流水线

This commit is contained in:
xiaojunnuo
2025-12-16 22:52:07 +08:00
parent 3e2f2fc02e
commit 3f3ee3456e
2 changed files with 23 additions and 1 deletions

View File

@@ -145,6 +145,9 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
},
},
},
search: {
col: { span: 3 },
},
form: {
afterSubmit({ form, res, mode }) {
if (mode === "add") {
@@ -262,6 +265,7 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
type: "number",
search: {
show: true,
col: { span: 3 },
},
column: {
width: 100,
@@ -277,6 +281,7 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
show: computed(() => {
return userStore.isAdmin && settingStore.sysPublic.managerOtherUserPipeline;
}),
col: { span: 3 },
},
form: {
show: false,
@@ -297,6 +302,7 @@ export default function ({ crudExpose, context: { selectedRowKeys } }: CreateCru
component: {
name: "a-input",
},
col: { span: 3 },
},
form: {
rules: [{ required: true, message: t("certd.fields.required") }],

View File

@@ -33,7 +33,20 @@ export class PipelineController extends CrudController<PipelineService> {
async page(@Body(ALL) body) {
const isAdmin = await this.authService.isAdmin(this.ctx);
const publicSettings = await this.sysSettingsService.getPublicSettings();
if (!(publicSettings.managerOtherUserPipeline && isAdmin)) {
let onlyOther = false
if(isAdmin){
if(publicSettings.managerOtherUserPipeline){
//管理员管理 其他用户
if( body.query.userId === -1){
//如果只查询其他用户
onlyOther = true;
delete body.query.userId;
}
}else{
body.query.userId = this.getUserId();
}
}else{
body.query.userId = this.getUserId();
}
@@ -44,6 +57,9 @@ export class PipelineController extends CrudController<PipelineService> {
if (title) {
qb.andWhere('(title like :title or content like :content)', { title: `%${title}%`, content: `%${title}%` });
}
if(onlyOther){
qb.andWhere('user_id != :userId', { userId: this.getUserId() });
}
};
if (!body.sort || !body.sort?.prop) {
body.sort = { prop: 'order', asc: false };