新建项目

This commit is contained in:
WindowBird 2025-11-17 16:58:11 +08:00
parent cdf5c8d837
commit 7101e6006b
4 changed files with 1135 additions and 9 deletions

View File

@ -100,3 +100,29 @@ export const getProjectDetail = (id) => {
});
};
/**
* 创建项目
* @param {Object} data 项目数据
* @returns {Promise} 创建结果
*/
export const createProject = (data) => {
return uni.$uv.http.post('bst/project', data, {
custom: {
auth: true
}
});
};
/**
* 更新项目
* @param {Object} data 项目数据需包含 id
* @returns {Promise} 更新结果
*/
export const updateProject = (data) => {
return uni.$uv.http.put('bst/project', data, {
custom: {
auth: true
}
});
};

View File

@ -138,6 +138,13 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/project/form/index",
"style": {
"navigationBarTitleText": "项目编辑",
"navigationStyle": "custom"
}
},
{
"path": "pages/project/list/index",
"style": {

1071
pages/project/form/index.vue Normal file

File diff suppressed because it is too large Load Diff

View File

@ -98,6 +98,9 @@
<uv-button size="small" @click="handleReset">
<text>重置</text>
</uv-button>
<uv-button type="success" size="small" @click="goToCreateProject">
<text>新增项目</text>
</uv-button>
</view>
</view>
@ -198,7 +201,7 @@
</template>
<script setup>
import { ref, computed, watch, onMounted, nextTick } from 'vue';
import { ref, computed, watch, onMounted, nextTick, onUnmounted } from 'vue';
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { getProjectList, getUserList } from '@/api';
import { usePagination } from '@/composables';
@ -472,8 +475,7 @@ const handleCardMenu = (project) => {
itemList: ['修改', '删除', '+ 新增任务', '√ 开始开发'],
success: (res) => {
if (res.tapIndex === 0) {
//
uni.showToast({ title: '修改功能开发中', icon: 'none' });
goToEditProject(project);
} else if (res.tapIndex === 1) {
//
uni.showToast({ title: '删除功能开发中', icon: 'none' });
@ -488,6 +490,25 @@ const handleCardMenu = (project) => {
});
};
const goToCreateProject = () => {
uni.navigateTo({
url: '/pages/project/form/index?mode=add'
});
};
const goToEditProject = (project) => {
if (!project?.id) {
uni.showToast({
title: '缺少项目ID',
icon: 'none'
});
return;
}
uni.navigateTo({
url: `/pages/project/form/index?mode=edit&id=${project.id}`
});
};
//
const handleStatusTabClick = (value) => {
activeStatusTab.value = value;
@ -579,12 +600,15 @@ watch(() => userStore.privateView, () => {
});
onMounted(() => {
//
if (!dictStore.isLoaded) {
dictStore.loadDictData();
}
//
loadMemberList();
uni.$on('projectListRefresh', handleSearch);
});
onUnmounted(() => {
uni.$off('projectListRefresh', handleSearch);
});
onLoad(() => {
@ -725,7 +749,7 @@ onLoad(() => {
/* 移动端适配 */
@media (max-width: 768px) {
.project-container {
//grid-template-columns: repeat(2, 1fr);
grid-template-columns: repeat(2, 1fr);
gap: 12px;
padding: 12px;
}
@ -733,9 +757,7 @@ onLoad(() => {
@media (max-width: 480px) {
.project-container {
//grid-template-columns: 1fr;
grid-template-columns: 1fr;
}
}