update:关注/取关项目

This commit is contained in:
2026-02-13 11:53:50 +08:00
parent ca3e53cdfd
commit e2da22afd3
6 changed files with 99 additions and 14 deletions

View File

@@ -217,3 +217,11 @@ export const batchUpdateWorkspaceExtraApi = (params: any) => {
export const modifyWithApproveAPi = (params: any) => {
return post(`${PREFIX}project/modifyWithApprove`, params);
};
// 关注项目
export const followProjectApi = (params: any) => {
return post(`${PREFIX}node/followProject`, params);
};
// 取消关注项目
export const unFollowProjectApi = (params: any) => {
return post(`${PREFIX}node/unFollowProject`, params);
};

View File

@@ -20,17 +20,19 @@
</span>
</div>
<el-dropdown class="options-dropdown" :teleported="false">
<el-dropdown class="options-dropdown">
<div class="options-btn" @click.stop>
<el-icon :size="18"><MoreFilled /></el-icon>
</div>
<template #dropdown>
<el-dropdown-menu @click.stop>
<el-dropdown-item v-for="(action, aIndex) in actionList" :key="aIndex">
<el-link :type="action.type" @click.stop="actionClickFun(action)">
{{ action.title }}
</el-link>
</el-dropdown-item>
<template v-for="(action, aIndex) in actionList" :key="aIndex">
<el-dropdown-item v-if="!(action.hide && action.hide(project))">
<el-link :type="action.type" @click.stop="actionClickFun(action)">
{{ action.title }}
</el-link>
</el-dropdown-item>
</template>
</el-dropdown-menu>
</template>
</el-dropdown>

View File

@@ -1,18 +1,64 @@
<template>
<ProjectList :expandAction="actionList" />
<ProjectList ref="ProjectListRef" :expandAction="actionList" :projectType="0" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { followProjectApi, unFollowProjectApi } from '@/api/project/node';
import ProjectList from './components/projectList.vue';
import { ElMessage } from 'element-plus';
const ProjectListRef = ref<any>();
const editData = ref<any>({});
const actionList = ref<any>([
{
title: '关注',
type: 'primary',
click: (row: any) => {
console.log('关注', row);
followFun(row);
},
hide: (row: any) => {
return row.attentionFlag === 1;
},
},
{
title: '取关',
type: 'danger',
needConfirm: true,
confirmTip: '确定取消关注吗?',
click: (row: any) => {
unFollowFun(row);
},
hide: (row: any) => {
return row.attentionFlag === 0;
},
},
]);
// 关注项目
const followFun = (data: any) => {
const params = {
nodeId: data.uuid,
};
followProjectApi(params).then((res: any) => {
if (res.code === 200) {
ElMessage.success('关注成功');
// 不刷新列表直接修改attentionFlag状态
editData.value = data;
editData.value.attentionFlag = 1;
}
});
};
// 取消关注项目
const unFollowFun = (data: any) => {
const params = {
nodeId: data.uuid,
};
unFollowProjectApi(params).then((res: any) => {
if (res.code === 200) {
ElMessage.success('取消关注成功');
ProjectListRef.value?.resetFun();
}
});
};
</script>

View File

@@ -1,5 +1,5 @@
<template>
<ProjectList />
<ProjectList ref="ProjectListRef" :projectType="2" />
</template>
<script setup lang="ts">

View File

@@ -4,6 +4,7 @@
<BaseTable
listTitle="项目数据"
v-model:viewType="viewType"
:params="searchParams"
showIndex
showCheckbox
ref="baseTableRef"
@@ -138,10 +139,12 @@ import LyricProjectCard from '@/tenants/lyric/views/project/projectCard.vue';
interface Props {
expandAction?: any;
projectType: number;
}
const props = withDefaults(defineProps<Props>(), {
expandAction: [],
projectType: 0, // 0所有 1我关注的 2我负责的
});
export interface IUserInfo {
@@ -194,6 +197,7 @@ const actionList = ref<any>([
return !hasPermission('project_list_edit_project');
},
},
...props.expandAction,
{
title: '删除',
type: 'danger',
@@ -207,7 +211,6 @@ const actionList = ref<any>([
return !hasPermission('project_list_delete_project');
},
},
...props.expandAction,
]);
// 卡片布局
const cardActionList = computed(() => {
@@ -249,7 +252,9 @@ const currentProjectBaseInfo = reactive<any>({
});
const viewType = ref('card');
const searchParams = ref({
type: props.projectType,
});
const currentRow = ref();
const openProjectInfoDiaFun = (tag: string, row?: IProjectInfo) => {
@@ -405,6 +410,14 @@ const shwoProjectsFun = () => {
ElMessage.warning('请选择一个或多个项目查看项目内容');
}
};
const resetFun = () => {
baseTableRef.value?.resetFun();
};
defineExpose({
resetFun,
});
</script>
<style lang="scss" scoped>

View File

@@ -1,20 +1,36 @@
<template>
<ProjectList :expandAction="actionList" />
<ProjectList ref="ProjectListRef" :expandAction="actionList" :projectType="1" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { unFollowProjectApi } from '@/api/project/node';
import ProjectList from './components/projectList.vue';
import { ElMessage } from 'element-plus';
const ProjectListRef = ref<any>();
const actionList = ref<any>([
{
title: '取消关注',
title: '取',
type: 'danger',
needConfirm: true,
confirmTip: '确定取消关注吗?',
click: (row: any) => {
console.log('取消关注', row);
unFollowFun(row);
},
},
]);
// 取消关注项目
const unFollowFun = (data: any) => {
const params = {
nodeId: data.uuid,
};
unFollowProjectApi(params).then((res: any) => {
if (res.code === 200) {
ElMessage.success('取消关注成功');
ProjectListRef.value?.resetFun();
}
});
};
</script>