diff --git a/api/index.js b/api/index.js index aa61f9b..74d9675 100644 --- a/api/index.js +++ b/api/index.js @@ -26,4 +26,7 @@ export * from './customer'; export * from './common'; // 导入审批相关 API -export * from './verify'; \ No newline at end of file +export * from './verify'; + +// 导入项目相关 API +export * from './project'; \ No newline at end of file diff --git a/api/project.js b/api/project.js new file mode 100644 index 0000000..a887eec --- /dev/null +++ b/api/project.js @@ -0,0 +1,102 @@ +/** + * 项目相关 API + */ + +/** + * 获取项目列表 + * @param {Object} params 请求参数 + * @param {number} params.pageNum 页码 + * @param {number} params.pageSize 每页数量 + * @param {string} params.orderByColumn 排序字段 + * @param {string} params.isAsc 排序方式(ascending/descending) + * @param {number[]} params.statusList 项目状态列表 + * @param {string} params.createId 创建人ID + * @param {string} params.ownerId 负责人ID + * @param {string[]} params.keys 搜索关键词数组 + * @returns {Promise} 返回项目列表 + */ +export const getProjectList = (params = {}) => { + const queryParams = []; + + // 分页参数 + if (params.pageNum !== undefined) { + queryParams.push(`pageNum=${params.pageNum}`); + } + if (params.pageSize !== undefined) { + queryParams.push(`pageSize=${params.pageSize}`); + } + + // 排序参数 + if (params.orderByColumn !== undefined && params.orderByColumn !== '') { + queryParams.push(`orderByColumn=${encodeURIComponent(params.orderByColumn)}`); + } + if (params.isAsc !== undefined && params.isAsc !== '') { + queryParams.push(`isAsc=${encodeURIComponent(params.isAsc)}`); + } + + // 状态列表 + if (params.statusList !== undefined && Array.isArray(params.statusList) && params.statusList.length > 0) { + params.statusList.forEach((status, index) => { + queryParams.push(`statusList=${status}`); + }); + } + + // 创建人ID + if (params.createId !== undefined && params.createId !== '') { + queryParams.push(`createId=${params.createId}`); + } + + // 负责人ID + if (params.ownerId !== undefined && params.ownerId !== '') { + queryParams.push(`ownerId=${params.ownerId}`); + } + + // 搜索关键词 + if (params.keys !== undefined && Array.isArray(params.keys) && params.keys.length > 0) { + params.keys.forEach((key, index) => { + queryParams.push(`keys[${index}]=${encodeURIComponent(key)}`); + }); + } + + // 项目名称搜索 + if (params.projectName !== undefined && params.projectName !== '') { + queryParams.push(`projectName=${encodeURIComponent(params.projectName)}`); + } + + // 项目编号搜索 + if (params.projectId !== undefined && params.projectId !== '') { + queryParams.push(`projectId=${encodeURIComponent(params.projectId)}`); + } + + // 客户名称搜索 + if (params.customerName !== undefined && params.customerName !== '') { + queryParams.push(`customerName=${encodeURIComponent(params.customerName)}`); + } + + // 成员ID搜索 + if (params.memberId !== undefined && params.memberId !== '') { + queryParams.push(`memberId=${params.memberId}`); + } + + const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : ''; + + return uni.$uv.http.get(`bst/project/list${queryString}`, { + custom: { + auth: true // 启用 token 认证 + } + }); +}; + +/** + * 获取项目详情 + * @param {string} id 项目ID + * @returns {Promise} 返回项目详情 + */ +export const getProjectDetail = (id) => { + return uni.$uv.http.get(`bst/project/${id}`, { + custom: { + auth: true + } + }); +}; + diff --git a/components/index/Workbench.vue b/components/index/Workbench.vue index e707423..61a8851 100644 --- a/components/index/Workbench.vue +++ b/components/index/Workbench.vue @@ -62,6 +62,12 @@ const handleClick = (item) => { uni.switchTab({ url: '/pages/index/index' }); return; } + if (item.key === 'project') { + uni.navigateTo({ + url: '/pages/project/list/index' + }); + return; + } // 其他入口占位 uni.showToast({ title: '开发中', icon: 'none' }); }; diff --git a/pages.json b/pages.json index c4d18d4..a06ec67 100644 --- a/pages.json +++ b/pages.json @@ -137,6 +137,12 @@ "navigationBarTitleText": "修改跟进记录", "navigationStyle": "custom" } + }, + { + "path": "pages/project/list/index", + "style": { + "navigationBarTitleText": "项目管理" + } } ], diff --git a/pages/project/list/index.vue b/pages/project/list/index.vue new file mode 100644 index 0000000..55a6a96 --- /dev/null +++ b/pages/project/list/index.vue @@ -0,0 +1,661 @@ + + + + + +