fix: 修复某些情况下报无法修改通知的问题

This commit is contained in:
xiaojunnuo
2026-04-02 16:28:14 +08:00
parent 6ef34f95d5
commit d1a65922d7
3 changed files with 53 additions and 13 deletions

View File

@@ -21,7 +21,8 @@ import { defineComponent, reactive, ref, watch, inject } from "vue";
import CertAccessModal from "./access/index.vue";
import { createAccessApi } from "../api";
import { message } from "ant-design-vue";
import { useUserStore } from "/@/store/user";
import { useProjectStore } from "/@/store/project";
export default defineComponent({
name: "AccessSelector",
components: { CertAccessModal },
@@ -71,11 +72,27 @@ export default defineComponent({
emitValue(null);
}
const userStore = useUserStore();
const projectStore = useProjectStore();
async function emitValue(value) {
if (pipeline && pipeline?.value && target?.value && pipeline.value.userId !== target.value.userId) {
message.error("对不起,您不能修改他人流水线的授权");
return;
const userId = userStore.userInfo.id;
const isEnterprice = projectStore.isEnterprise;
if (pipeline.value) {
if (isEnterprice) {
const projectId = projectStore.currentProjectId;
if (pipeline.value.projectId !== projectId) {
message.error(`对不起,您不能修改其他项目流水线的授权`);
return;
}
} else {
if (pipeline?.value && pipeline.value.userId !== userId) {
message.error(`对不起,您不能修改他人流水线的授权`);
return;
}
}
}
if (value == null) {
selectedId.value = "";
target.value = null;

View File

@@ -48,6 +48,7 @@ import createCrudOptions from "../crud";
import { addonProvide } from "../common";
import { useUserStore } from "/@/store/user";
import { useI18n } from "/src/locales";
import { useProjectStore } from "/@/store/project";
const { t } = useI18n();
@@ -127,13 +128,24 @@ function clear() {
}
const userStore = useUserStore();
const projectStore = useProjectStore();
async function emitValue(value: any) {
// target.value = optionsDictRef.dataMap[value];
const userId = userStore.userInfo.id;
if (pipeline?.value && pipeline.value.userId !== userId) {
message.error(`对不起,您不能修改他人流水线的${props.addonType}设置`);
return;
if (pipeline.value) {
const userId = userStore.userInfo.id;
const isEnterprice = projectStore.isEnterprise;
if (isEnterprice) {
const projectId = projectStore.currentProjectId;
if (pipeline.value.projectId !== projectId) {
message.error(`对不起,您不能修改其他项目流水线的${props.addonType}设置`);
return;
}
} else {
if (pipeline?.value && pipeline.value.userId !== userId) {
message.error(`对不起,您不能修改他人流水线的${props.addonType}设置`);
return;
}
}
}
emit("change", value);
emit("update:modelValue", value);

View File

@@ -42,6 +42,7 @@ import createCrudOptions from "../crud";
import { notificationProvide } from "/@/views/certd/notification/common";
import { useUserStore } from "/@/store/user";
import { useI18n } from "/src/locales";
import { useProjectStore } from "/@/store/project";
const { t } = useI18n();
@@ -127,13 +128,23 @@ function clear() {
}
const userStore = useUserStore();
const projectStore = useProjectStore();
async function emitValue(value: any) {
// target.value = optionsDictRef.dataMap[value];
const userId = userStore.userInfo.id;
if (pipeline?.value && pipeline.value.userId !== userId) {
message.error("对不起,您不能修改他人流水线的通知");
return;
const isEnterprice = projectStore.isEnterprise;
if (isEnterprice) {
const projectId = projectStore.currentProjectId;
if (pipeline.value.projectId !== projectId) {
message.error("对不起,您不能修改其他项目流水线的通知");
return;
}
} else {
if (pipeline.value.userId !== userId) {
message.error("对不起,您不能修改他人流水线的通知");
return;
}
}
emit("change", value);
emit("update:modelValue", value);