feat: 增加项目管理接口

This commit is contained in:
rd
2025-07-22 18:02:18 +08:00
parent fcb0f111c0
commit db00888ca9
8 changed files with 65 additions and 54 deletions

View File

@ -13,3 +13,8 @@ export const getCustomColumns = (params = {}) => {
export const updateCustomColumns = (params = {}) => { export const updateCustomColumns = (params = {}) => {
return Http.put('/v1/custom-columns', params); return Http.put('/v1/custom-columns', params);
}; };
// 获取企业用户列表
export const getUserList = (params = {}) => {
return Http.get('/v1/users/list', params);
};

View File

@ -371,3 +371,29 @@ export const deleteSyncStatus = (id: string) => {
export const getWorksList = (params = {}) => { export const getWorksList = (params = {}) => {
return Http.get('/v1/works/list', params); return Http.get('/v1/works/list', params);
}; };
// 项目管理-分页
export const getProjects = (params = {}) => {
return Http.get('/v1/projects', params);
};
// 项目管理-删除
export const deleteProject = (id: string) => {
return Http.delete(`/v1/projects/${id}`);
};
// 项目管理-添加
export const postAddProject = (params: {}) => {
return Http.post('/v1/projects', params);
};
// 项目管理-修改
export const putProject = (params = {}) => {
const { id, ...rest } = params as { id: string; [key: string]: any };
return Http.put(`/v1/projects/${id}`, rest);
};
// 项目管理-详情
export const getProjectDetail = (id: string) => {
return Http.get(`/v1/projects/${id}`);
};

View File

@ -36,7 +36,7 @@
@change="handleSearch" @change="handleSearch"
> >
<a-option v-for="(item, index) in uploaders" :key="index" :value="item.id" :label="item.name"> <a-option v-for="(item, index) in uploaders" :key="index" :value="item.id" :label="item.name">
{{ item.name }} {{ item.name || '-' }}
</a-option> </a-option>
</a-select> </a-select>
</div> </div>
@ -115,6 +115,8 @@
import { formatTableField, exactFormatTime } from '@/utils/tools'; import { formatTableField, exactFormatTime } from '@/utils/tools';
import { getPlacementAccountOperators, getWorksList } from '@/api/all/propertyMarketing'; import { getPlacementAccountOperators, getWorksList } from '@/api/all/propertyMarketing';
import { getUserList } from '@/api/all/common';
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination'; import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
const TABLE_COLUMNS = [ const TABLE_COLUMNS = [
@ -178,21 +180,19 @@ const handleSearch = () => {
}); });
}; };
// const getOperators = async () => { const getUsers = async () => {
// const { code, data } = await getPlacementAccountOperators(); const { code, data } = await getUserList();
// if (code === 200) { if (code === 200) {
// uploaders.value = data; uploaders.value = data;
// }
// }; console.log(uploaders.value);
}
};
const getTableData = async () => { const getTableData = async () => {
const { code, data } = await getWorksList(); const { code, data } = await getWorksList();
if (code === 200) { if (code === 200) {
allData.value = data ?? []; allData.value = data ?? [];
dataSource.value = data ?? []; dataSource.value = data ?? [];
uploaders.value = data.map( v => ({
id: v.uploader?.id,
name: v.uploader?.name,
}))
initSelect(); initSelect();
} }
}; };
@ -217,7 +217,7 @@ const onDelete = (item) => {
}; };
onMounted(() => { onMounted(() => {
// getOperators(); getUsers();
getTableData(); getTableData();
}); });
</script> </script>

View File

@ -10,7 +10,7 @@
<span class="label">项目名称</span> <span class="label">项目名称</span>
<a-space size="medium"> <a-space size="medium">
<a-input <a-input
v-model="query.search" v-model="query.name"
class="w-240px" class="w-240px"
placeholder="请搜索..." placeholder="请搜索..."
size="medium" size="medium"

View File

@ -11,23 +11,23 @@ export const TABLE_COLUMNS = [
}, },
{ {
title: '项目预算', title: '项目预算',
dataIndex: 'key1', dataIndex: 'budget',
width: 180, width: 180,
prefix: "¥" prefix: "¥"
}, },
{ {
title: '关联平台账号', title: '关联平台账号',
dataIndex: 'key2', dataIndex: 'media_account_count',
width: 180, width: 180,
}, },
{ {
title: '关联渠道账户', title: '关联渠道账户',
dataIndex: 'key3', dataIndex: 'placement_account_count',
width: 180, width: 180,
}, },
{ {
title: '关联内容稿件', title: '关联内容稿件',
dataIndex: 'key4', dataIndex: 'work_count',
width: 180, width: 180,
}, },
{ {

View File

@ -11,7 +11,7 @@
@sorter-change="handleSorterChange" @sorter-change="handleSorterChange"
> >
<template #empty> <template #empty>
<NoData /> <NoData text="暂无项目"/>
</template> </template>
<template #columns> <template #columns>
<a-table-column <a-table-column

View File

@ -1,5 +1,5 @@
export const INITIAL_QUERY = { export const INITIAL_QUERY = {
search: '', name: '',
column: '', sort_column: undefined,
order: '', sort_order: undefined,
}; };

View File

@ -45,6 +45,7 @@
<script setup> <script setup>
import { INITIAL_QUERY } from './constants'; import { INITIAL_QUERY } from './constants';
import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination'; import { useTableSelectionWithPagination } from '@/hooks/useTableSelectionWithPagination';
import { getProjects } from '@/api/all/propertyMarketing';
import FilterBlock from './components/filter-block'; import FilterBlock from './components/filter-block';
import ProjectTable from './components/project-table'; import ProjectTable from './components/project-table';
@ -66,37 +67,16 @@ const addProjectModalRef = ref(null);
const query = ref(cloneDeep(INITIAL_QUERY)); const query = ref(cloneDeep(INITIAL_QUERY));
const getData = async () => { const getData = async () => {
dataSource.value = [ const { page, page_size } = pageInfo.value;
{ const { code, data } = await getProjects({
id: 1, ...query.value,
name: '闲鱼用户增长投放规划', page,
key1: 500131, page_size,
key2: 4141, });
key3: 55, if (code === 200) {
key4: 12, dataSource.value = data?.data ?? [];
create_at: 1753069077, pageInfo.value.total = data.total;
}, }
{
id: 2,
name: '闲鱼用户增长投放规划',
key1: 500131,
key2: 4141,
key3: 55,
key4: 12,
create_at: 1753069077,
},
];
pageInfo.value.total = 2;
// const { page, page_size } = pageInfo.value;
// const { code, data } = await postSubAccount({
// ...query.value,
// page,
// page_size,
// });
// if (code === 200) {
// dataSource.value = data?.data ?? [];
// pageInfo.value.total = data.total;
// }
}; };
const handleSearch = () => { const handleSearch = () => {
reload(); reload();
@ -117,8 +97,8 @@ const handleOpenAddProjectModal = () => {
addProjectModalRef.value?.open(); addProjectModalRef.value?.open();
}; };
const handleSorterChange = (column, order) => { const handleSorterChange = (column, order) => {
query.value.column = column; query.value.sort_column = column;
query.value.order = order; query.value.sort_order = order;
reload(); reload();
}; };