This commit is contained in:
yannqing 2024-03-17 16:27:21 +08:00
parent c541964a08
commit 10420088e5
7 changed files with 184 additions and 79 deletions

View File

@ -736,7 +736,7 @@ const moduleDelete = (id ,token) =>{
} }
/** /**
* 获取模块信息 * 获取模块/子系统信息
* @param id * @param id
* @param token * @param token
* @returns {Promise<axios.AxiosResponse<any>> | *} * @returns {Promise<axios.AxiosResponse<any>> | *}

View File

@ -27,10 +27,24 @@ const router = createRouter({
name: 'WorkLoadPersonalInformation', name: 'WorkLoadPersonalInformation',
component: () => import('@/views/WorkLoadPage/PersonalInformation.vue') component: () => import('@/views/WorkLoadPage/PersonalInformation.vue')
}, },
/**
* 个人项目页面
*/
{ {
path: '/WorkLoad/PersonalProject', path: '/WorkLoad/PersonalProject',
name: 'WorkLoadPersonalProject', name: 'WorkLoadPersonalProject',
component: () => import('@/views/WorkLoadPage/PersonalProject.vue') component: () => import('@/views/WorkLoadPage/PersonalProject.vue'),
},
{
path: '/WorkLoad/PersonalProject/ChildSystem/:id',
name: 'WorkLoad/PersonalProject/ChildSystem',
component: () => import('@/views/WorkLoadPage/I_Manage_ChildSystem.vue')
},
{
path: '/WorkLoad/PersonalProject/ChildSystem/ChildModule/:id',
name: 'WorkLoad/PersonalProject/ChildSystem/ChildModule',
component: () => import('@/views/WorkLoadPage/ChildModule.vue')
}, },
{ {
path: '/WorkLoad/PersonalBelongings', path: '/WorkLoad/PersonalBelongings',
@ -91,7 +105,7 @@ const router = createRouter({
component: () => import('@/views/WorkLoadPage/AuthorityManageModule.vue') component: () => import('@/views/WorkLoadPage/AuthorityManageModule.vue')
}, },
{ {
path: '/WorkLoad/I_Manage/I_Manage_ChildSystem', path: '/WorkLoad/I_Manage/I_Manage_ChildSystem/:id',
name: 'WorkLoad/I_Manage/IChildSystem', name: 'WorkLoad/I_Manage/IChildSystem',
component: () => import('@/views/WorkLoadPage/I_Manage_ChildSystem.vue') component: () => import('@/views/WorkLoadPage/I_Manage_ChildSystem.vue')
}, },

View File

@ -6,7 +6,7 @@
<a-breadcrumb-item><a href="">子系统</a></a-breadcrumb-item> <a-breadcrumb-item><a href="">子系统</a></a-breadcrumb-item>
<a-breadcrumb-item><a href="">子模块</a></a-breadcrumb-item> <a-breadcrumb-item><a href="">子模块</a></a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
<div class="flex absolute right-8 space-x-4"> <div v-show="systemInfo.data.principalId === userId" class="flex absolute right-8 space-x-4">
<button class="rounded-lg bg-green-400 hover:bg-green-500 p-1.5 text-white">编辑</button> <button class="rounded-lg bg-green-400 hover:bg-green-500 p-1.5 text-white">编辑</button>
<button class="rounded-lg bg-red-500 hover:bg-red-600 p-1.5 text-white" @click="showAddModal">新增子模块</button> <button class="rounded-lg bg-red-500 hover:bg-red-600 p-1.5 text-white" @click="showAddModal">新增子模块</button>
</div> </div>
@ -17,7 +17,7 @@
<a-card class="relative w-4/5 bg-blue-400 lg:h-36 md:h-24 text-white rounded-xl"> <a-card class="relative w-4/5 bg-blue-400 lg:h-36 md:h-24 text-white rounded-xl">
<div class="flex space-x-9"> <div class="flex space-x-9">
<p class="absolute lg:left-4 md:left-0 top-4">{{ChildModule.name}}</p> <p class="absolute lg:left-4 md:left-0 top-4">{{ChildModule.name}}</p>
<p class="absolute right-4 top-4">负责人: {{ChildModule.principalId }}</p> <p class="absolute right-4 top-4">负责人: {{ChildModule.principalUser }}</p>
</div> </div>
<div class="flex flex-col mt-8"> <div class="flex flex-col mt-8">
<p class="text-green-100">剩余 3 </p> <p class="text-green-100">剩余 3 </p>
@ -48,30 +48,45 @@
</div> </div>
<!--新增子模块对话框--> <!--新增子模块对话框-->
<a-modal v-model:open="AddModule" :okButtonProps="{ style: { backgroundColor: '#347def',color: 'white'} }" cancel-text="取消" ok-text="确定" title="新增子模块"> <a-modal v-model:open="AddModule" @ok="addHandle" :okButtonProps="{ style: { backgroundColor: '#347def',color: 'white'} }" cancel-text="取消" ok-text="确定" title="新增子模块">
<a-form> <a-form>
<div class="flex space-x-5"> <div class="flex space-x-5">
<a-form-item class="my-4" label="子模块名称:"><a-input class="h-8 w-36 border-gray-300 rounded-md"/></a-form-item> <a-form-item class="my-4" label="子模块名称:"><a-input v-model:value="addForm.name" class="h-8 w-36 border-gray-300 rounded-md"/></a-form-item>
<a-form-item class="my-4" label="状态:"> <a-form-item class="my-4" label="状态:">
<a-select <a-select
ref="select" ref="select"
style="width: 145px;margin-left: 1.7vw" style="width: 145px;margin-left: 1.7vw"
@focus="focus" v-model:value="addForm.isFinish"
> >
<a-select-option value="jack">进行中</a-select-option> <a-select-option value="2">进行中</a-select-option>
<a-select-option value="lucy">未开始</a-select-option> <a-select-option value="0">未开始</a-select-option>
<a-select-option value="disabled">已完成</a-select-option> <a-select-option value="1">已完成</a-select-option>
<a-select-option value="-1">已暂停</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</div> </div>
<div class="flex space-x-5"> <div class="flex space-x-5">
<a-form-item class="my-4" label="周期:"><a-input class="ml-[43px] h-8 w-36 border-gray-300 rounded-md"/></a-form-item> <a-form-item class="my-4" label="周期:"><a-input v-model:value="addForm.cycle" class="ml-[43px] h-8 w-36 border-gray-300 rounded-md"/></a-form-item>
<a-form-item class="my-4" label="工作量:"><a-input class="ml-[15px] h-8 w-36 border-gray-300 rounded-md"/></a-form-item> <a-form-item class="my-4" label="工作量:"><a-input v-model:value="addForm.workLoad" class="ml-[15px] h-8 w-36 border-gray-300 rounded-md"/></a-form-item>
</div> </div>
<div class="flex space-x-5"> <div class="flex space-x-5">
<a-form-item class="my-4" label="负责人:"><a-input class="ml-[30px] h-8 w-36 border-gray-300 rounded-md"/></a-form-item> <a-form-item class="my-4" label="负责人:"><a-input v-model:value="addForm.principalId" class="ml-[30px] h-8 w-36 border-gray-300 rounded-md"/></a-form-item>
<a-form-item class="my-4" label="发布:">
<a-select
ref="select"
style="width: 145px;margin-left: 1.7vw"
v-model:value="addForm.status"
>
<a-select-option value="1"></a-select-option>
<a-select-option value="0"></a-select-option>
</a-select>
</a-form-item>
</div>
<div class="flex space-x-5">
<a-form-item class="my-4" label="系统描述:"> <a-form-item class="my-4" label="系统描述:">
<a-textarea :rows="1" class="w-36 h-8" /> <a-textarea v-model:value="addForm.description" :rows="1" class="w-80 h-4" />
</a-form-item> </a-form-item>
</div> </div>
@ -80,9 +95,10 @@
</template> </template>
<script setup> <script setup>
import {CaretUpOutlined, CheckOutlined} from '@ant-design/icons-vue'; import {CaretUpOutlined, CheckOutlined} from '@ant-design/icons-vue';
import {onMounted, ref} from 'vue'; import {onMounted, reactive, ref} from 'vue';
import request from "@/js/request.js"; import request from "@/js/request.js";
import {useRoute} from "vue-router"; import {useRoute} from "vue-router";
import {message} from "ant-design-vue";
const AddModule = ref(false) const AddModule = ref(false)
function showAddModal(){ function showAddModal(){
@ -94,20 +110,80 @@ const ChildModules = ref([]);
const route = useRoute() const route = useRoute()
const params = new URLSearchParams(window.location.search);
const sysId = route.params.id const sysId = route.params.id
const userId = ref()
//TODO: description{}bug
const description = ref('{}')
const addForm = reactive({
name:'',
cycle:'',
isFinish:'',
workLoad: '',
principalId: '',
description: '',
status: '',
//01
type: 1,
//id
pid: sysId,
projectId: ''
})
const systemInfo = reactive({
data:{}
})
onMounted(() => { onMounted(() => {
console.log(sysId) flush()
request.moduleGetBySysId(sysId, token).then((res) => {
console.log(sysId)
console.log("res:", res)
ChildModules.value = res.data.data
console.log("ChildModules:", ChildModules.value)
})
}) })
function flush() {
// console.log(sysId)
request.moduleGetBySysId(sysId, token).then((res) => {
// console.log(sysId)
// console.log("res:", res)
ChildModules.value = res.data.data
// console.log("ChildModules:", ChildModules.value)
})
//
request.getModuleInfo(sysId, token).then((res)=>{
addForm.projectId = res.data.data.projectId
systemInfo.data = res.data.data
console.log("system:",systemInfo.data)
})
//
request.userGetProfile(token).then((res)=>{
userId.value = res.data.data.id
console.log("userId:",userId.value)
})
}
function addHandle() {
// console.log("addForm",addForm)
//TODO: description{}bug
addForm.description = description.value
request.projectWorkAdd(addForm, token).then((res)=>{
if (res.data.code === 200) {
//
message.success("新增模块成功")
//
addForm.description = ''
addForm.name = ''
addForm.cycle = ''
addForm.status = ''
addForm.isFinish = ''
//
flush()
}else {
message.error("新增模块失败,请重试!")
}
//
AddModule.value = false
})
}
</script> </script>

View File

@ -105,6 +105,7 @@ onMounted(() => {
function GetManageProject() { function GetManageProject() {
request.projectWorkGet(data, token).then((res) => { request.projectWorkGet(data, token).then((res) => {
ChildProjects.value = res.data.data; ChildProjects.value = res.data.data;
console.log("projects:",ChildProjects.value)
}) })
} }

View File

@ -4,18 +4,18 @@
<a-breadcrumb-item><a href="/workLoad/PersonalProject">我的项目</a></a-breadcrumb-item> <a-breadcrumb-item><a href="/workLoad/PersonalProject">我的项目</a></a-breadcrumb-item>
<a-breadcrumb-item><a href="">子系统</a></a-breadcrumb-item> <a-breadcrumb-item><a href="">子系统</a></a-breadcrumb-item>
</a-breadcrumb> </a-breadcrumb>
<div class="flex absolute right-8 mt-6 space-x-4"> <div v-show="userProfile.id === ChildProjects.data.id" class="flex absolute right-8 mt-6 space-x-4">
<button class="rounded-lg bg-green-400 hover:bg-green-500 p-1.5 text-white" @click="toggleEditing">编辑</button> <button class="rounded-lg bg-green-400 hover:bg-green-500 p-1.5 text-white" @click="toggleEditing">编辑</button>
<button class="rounded-lg bg-red-500 hover:bg-red-600 p-1.5 text-white" @click="showAddModal">新增子系统</button> <button class="rounded-lg bg-red-500 hover:bg-red-600 p-1.5 text-white" @click="showAddModal">新增子系统</button>
</div> </div>
<div class="mt-12 ml-8 flex space-x-16 h-full" > <div class="mt-12 ml-8 flex space-x-16 h-full" >
<div class="flex flex-col space-y-6 border-r border-gray-200 w-80 h-full p-8" > <div class="flex flex-col space-y-6 border-r border-gray-200 w-80 h-full p-8" >
<p class="text-lg">项目名称{{ChildProjects.data[0].name}}</p> <p class="text-lg">项目名称{{ChildProjects.data.name}}</p>
<p>项目周期{{ChildProjects.data[0].cycle}} /</p> <p>项目周期{{ChildProjects.data.cycle}} </p>
<p>项目开始时间</p> <p>项目开始时间</p>
<p>项目完成时间</p> <p>项目完成时间</p>
<div class="space-y-2"> <div class="space-y-2">
<p>工作量{{ChildProjects.data[0].workLoad}}/</p> <p>工作量{{ChildProjects.data.workLoad}}/</p>
</div> </div>
<a-button >子系统文档</a-button> <a-button >子系统文档</a-button>
</div> </div>
@ -92,18 +92,21 @@
import {onMounted, reactive, ref, watch} from "vue"; import {onMounted, reactive, ref, watch} from "vue";
import request from "@/js/request.js"; import request from "@/js/request.js";
import router from "@/router/index.js"; import router from "@/router/index.js";
import {useRoute} from "vue-router";
import {CloseOutlined} from '@ant-design/icons-vue'; import {CloseOutlined} from '@ant-design/icons-vue';
const showButton = reactive([]); const showButton = reactive([]);
const AddModule = ref(false) const AddModule = ref(false)
const token = window.localStorage.getItem('token') const token = window.localStorage.getItem('token')
const id = window.localStorage.getItem('id') const route = useRoute()
const projectId = route.params.id
function showAddModal(){ function showAddModal(){
AddModule.value = true; AddModule.value = true;
} }
//
const ChildProjects = reactive({ const ChildProjects = reactive({
data:[{ data:{
name:'', name:'',
id:-1, id:-1,
isFinish:'', isFinish:'',
@ -111,38 +114,43 @@ const ChildProjects = reactive({
description:'', description:'',
cycle:'', cycle:'',
principalUser: '' principalUser: ''
}] }
}); // 使ref }); // 使ref
//
const ChildSystems = ref([ const ChildSystems = ref([
]); ]);
const data =reactive({ const data =reactive({
is:1, id: parseInt(projectId),
id:null,
tags:[], tags:[],
isFinish:[0,1,2,-1], isFinish:[0,1,2,-1],
editing:true editing:true
}) })
const userProfile = reactive({
id:''
})
onMounted(() => { onMounted(() => {
request.projectWorkGet(data, token).then((res) => { request.projectGetById(projectId, token).then((res) => {
console.log(res)
ChildProjects.data = res.data.data; ChildProjects.data = res.data.data;
console.log("res:",res) console.log('对应项目信息',ChildProjects.data)
console.log('对应项目信息',ChildProjects.data[0])
console.log(ChildProjects.data)
}) })
request.moduleGetByProjectId(id, token).then((res) => { request.moduleGetByProjectId(projectId, token).then((res) => {
console.log("childModules:", res) console.log("childModules:", res)
ChildSystems.value = res.data.data ChildSystems.value = res.data.data
}) })
request.userGetProfile(token).then((res)=>{
console.log("user:",res.data.data)
userProfile.id = res.data.data.id
})
}) })
function EnterChildModule(ChildSystem){ function EnterChildModule(ChildSystem){
console.log(ChildSystem.id) console.log(ChildSystem.id)
window.localStorage.setItem('id',ChildSystem.id) window.localStorage.setItem('id',ChildSystem.id)
router.push("/WorkLoad/IChildModule") router.push('/WorkLoad/PersonalProject/ChildSystem/ChildModule/' + ChildSystem.id)
} }
// add // add
watch(() => AddModule.value, () => { watch(() => AddModule.value, () => {
@ -171,9 +179,9 @@ const handleAdd = () => {
// console.log(2222) // console.log(2222)
formData.projectId = ChildProjects.data[0].id formData.projectId = ChildProjects.data[0].id
console.log("formData:",formData) console.log("formData:",formData)
// request.projectWorkAdd(formData,token).then((res)=>{ request.projectWorkAdd(formData,token).then((res)=>{
// console.log(res) console.log("Add result",res)
// }) })
// //
AddModule.value = false; AddModule.value = false;

View File

@ -31,30 +31,31 @@
</div> </div>
</div> </div>
<div class="flex flex-row flex-wrap justify-around"> <div class="flex flex-row flex-wrap justify-around">
<a-card hoverable <ProjectCard v-for="proj in projList" v-bind="proj"></ProjectCard>
v-for="proj in projList" <!-- <a-card hoverable-->
class="w-80 mb-4" <!-- v-for="proj in projList"-->
@click="handleCardClick(proj.id)" <!-- class="w-80 mb-4"-->
> <!-- @click="handleCardClick(proj.id)"-->
<template #cover> <!-- >-->
<img alt="example" class="h-40" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" /> <!-- <template #cover>-->
</template> <!-- <img alt="example" class="h-40" src="https://os.alipayobjects.com/rmsportal/QBnOOoLaAfKPirc.png" />-->
<a-card-meta :title="proj.name"> <!-- </template>-->
<!-- <a-card-meta :title="proj.name">-->
<template #description> <!-- <template #description>-->
<div class="flex flex-row justify-between"> <!-- <div class="flex flex-row justify-between">-->
<div> <!-- <div>-->
<p>周期: {{proj.cycle}}</p> <!-- <p>周期: {{proj.cycle}}</p>-->
<p>工作量: {{proj.workload}}</p> <!-- <p>工作量: {{proj.workload}}</p>-->
</div> <!-- </div>-->
<div> <!-- <div>-->
<p>状态: {{proj.isFinish}}</p> <!-- <p>状态: {{proj.isFinish}}</p>-->
<p>负责人: {{proj.principalId}}</p> <!-- <p>负责人: {{proj.principalId}}</p>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</template> <!-- </template>-->
</a-card-meta> <!-- </a-card-meta>-->
</a-card> <!-- </a-card>-->
</div> </div>
<a-tooltip title="添加" class="fixed bottom-0 right-0 m-16"> <a-tooltip title="添加" class="fixed bottom-0 right-0 m-16">
@ -126,12 +127,13 @@
</a-tooltip> </a-tooltip>
</template> </template>
<script setup> <script setup>
import { reactive, ref ,computed,onMounted} from 'vue'; import {onMounted, ref, watchEffect} from 'vue';
import { h,watchEffect } from 'vue'; import {PlusOutlined} from '@ant-design/icons-vue';
import { SearchOutlined,StarOutlined,PlusOutlined } from '@ant-design/icons-vue';
import {useRouter} from "vue-router"; import {useRouter} from "vue-router";
import request from '@/js/request'; import request from '@/js/request';
import ProjectCard from "@/views/ProjectPage/MainMessage/ProjectCard.vue";
const router=useRouter() const router=useRouter()
// //
@ -253,15 +255,21 @@ const setupProj=()=>{
const url = `?tags=${encodedTags}&status=${encoedStatus}` const url = `?tags=${encodedTags}&status=${encoedStatus}`
request.projectGet(token,url).then(res=>{ request.projectGet(token,url).then(res=>{
console.log(res) // console.log(res)
projList.value=res.data.data projList.value=res.data.data
for (let i = 0; i < projList.value.length; i++) {
if (projList.value[i].tags === undefined || projList.value[i].tags === '') {
continue
}
projList.value[i].tags = JSON.parse(projList.value[i].tags).tags
}
console.log("after:",projList.value)
}) })
} }
watchEffect(()=>{ // watchEffect(()=>{
setupProj() // setupProj()
}) // })
// tag // tag

View File

@ -173,9 +173,7 @@ function getMyselfProject(){
}) })
} }
function MainMessage(project) { function MainMessage(project) {
console.log(project.id) router.push('/WorkLoad/PersonalProject/ChildSystem/' + project.id)
window.localStorage.setItem('id',project.id)
router.push('/WorkLoad/I_Manage/I_Manage_ChildSystem')
} }