新建项目
This commit is contained in:
parent
cdf5c8d837
commit
7101e6006b
|
|
@ -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
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,13 @@
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/project/form/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "项目编辑",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/project/list/index",
|
"path": "pages/project/list/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|
|
||||||
1071
pages/project/form/index.vue
Normal file
1071
pages/project/form/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -98,6 +98,9 @@
|
||||||
<uv-button size="small" @click="handleReset">
|
<uv-button size="small" @click="handleReset">
|
||||||
<text>重置</text>
|
<text>重置</text>
|
||||||
</uv-button>
|
</uv-button>
|
||||||
|
<uv-button type="success" size="small" @click="goToCreateProject">
|
||||||
|
<text>新增项目</text>
|
||||||
|
</uv-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -198,7 +201,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<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 { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
import { getProjectList, getUserList } from '@/api';
|
import { getProjectList, getUserList } from '@/api';
|
||||||
import { usePagination } from '@/composables';
|
import { usePagination } from '@/composables';
|
||||||
|
|
@ -472,8 +475,7 @@ const handleCardMenu = (project) => {
|
||||||
itemList: ['修改', '删除', '+ 新增任务', '√ 开始开发'],
|
itemList: ['修改', '删除', '+ 新增任务', '√ 开始开发'],
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.tapIndex === 0) {
|
if (res.tapIndex === 0) {
|
||||||
// 修改
|
goToEditProject(project);
|
||||||
uni.showToast({ title: '修改功能开发中', icon: 'none' });
|
|
||||||
} else if (res.tapIndex === 1) {
|
} else if (res.tapIndex === 1) {
|
||||||
// 删除
|
// 删除
|
||||||
uni.showToast({ title: '删除功能开发中', icon: 'none' });
|
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) => {
|
const handleStatusTabClick = (value) => {
|
||||||
activeStatusTab.value = value;
|
activeStatusTab.value = value;
|
||||||
|
|
@ -579,12 +600,15 @@ watch(() => userStore.privateView, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 加载字典数据
|
|
||||||
if (!dictStore.isLoaded) {
|
if (!dictStore.isLoaded) {
|
||||||
dictStore.loadDictData();
|
dictStore.loadDictData();
|
||||||
}
|
}
|
||||||
// 加载成员列表
|
|
||||||
loadMemberList();
|
loadMemberList();
|
||||||
|
uni.$on('projectListRefresh', handleSearch);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
uni.$off('projectListRefresh', handleSearch);
|
||||||
});
|
});
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
|
@ -725,7 +749,7 @@ onLoad(() => {
|
||||||
/* 移动端适配 */
|
/* 移动端适配 */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.project-container {
|
.project-container {
|
||||||
//grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(2, 1fr);
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
}
|
}
|
||||||
|
|
@ -733,9 +757,7 @@ onLoad(() => {
|
||||||
|
|
||||||
@media (max-width: 480px) {
|
@media (max-width: 480px) {
|
||||||
.project-container {
|
.project-container {
|
||||||
//grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user