我管理的模块修改,差数据和几个功能和权限分配

This commit is contained in:
“XCYH” 2024-04-18 23:55:48 +08:00
parent b30cc287e8
commit a4f4b16881
8 changed files with 393 additions and 223 deletions

View File

@ -117,7 +117,7 @@ export const getManageProjectList = (token) => {
/** /**
* 获取我管理的页面的子模块项目列表(接口没数据) * 获取我管理的页面的子模块项目列表
* *
* @param token 访问令牌 * @param token 访问令牌
* @returns {Promise<AxiosResponse<any>> | *} * @returns {Promise<AxiosResponse<any>> | *}
@ -134,6 +134,63 @@ export const getProjectList = (token) => {
}) })
} }
/**
* 获取我管理的页面的子系统项目列表
* @param projectId 项目id
* @param token 访问令牌
* @returns {Promise<AxiosResponse<any>> | *}
*/
export const getProjectSysList = (projectId,token) => {
return axios({
url: api +"/module/get?projectId=" + projectId ,
method: "get",
headers: {
'Authorization': 'Bearer ' + token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 获取我管理的页面的子模块项目列表(接口没数据)
* @param sysId 子系统id
* @param token 访问令牌
* @returns {Promise<AxiosResponse<any>> | *}
*/
export const getProjectModList = (sysId,token) => {
return axios({
url: api +"/module/get/min?sysId=" + sysId ,
method: "get",
headers: {
'Authorization': 'Bearer ' + token,
'Timestamp': getCurrentTimestamp()
}
})
}
/**
* 获取我管理的页面的子模块详细信息
* @param id 子模块id
* @param token 访问令牌
* @returns {Promise<AxiosResponse<any>> | *}
*/
export const getProjectModDetail = (id,token) => {
return axios({
url: api +"/project/module/id?id=" + id ,
method: "get",
headers: {
'Authorization': 'Bearer ' + token,
'Timestamp': getCurrentTimestamp()
}
})
}

View File

@ -1,7 +1,7 @@
<template> <template>
<div style=" width:100%"> <div style=" width:100%">
<el-card style="max-width: 100vw;margin: 1.5vw;"> <el-card style="max-width: 100vw;margin: 1.5vw;">
<template #header><strong>项目1</strong></template> <template #header><strong>项目{{ projectId }}</strong></template>
<div style="display:flex;flex-direction:row;justify-content: space-around "> <div style="display:flex;flex-direction:row;justify-content: space-around ">
<div> <div>
名称 名称
@ -25,17 +25,22 @@
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" />--> <!-- <el-table-column type="selection" width="55" />-->
<el-table-column label="序号" width="120"> <el-table-column label="序号" width="120">
<template #default="scope">{{ scope.row.date }}</template> <template #default="{row}">{{ row.id }}</template>
</el-table-column> </el-table-column>
<el-table-column property="name" label="子系统名称" width="120" /> <el-table-column property="name" label="子系统名称" width="120" />
<el-table-column property="cycle" label="工作量" show-overflow-tooltip /> <el-table-column property="cycle" label="工作量" show-overflow-tooltip />
<el-table-column property="address" label="周期" /> <el-table-column property="workLoad" label="周期" />
<el-table-column property="address" label="负责人" /> <el-table-column property="address" label="负责人" />
<el-table-column property="isFinish" label="状态" /> <el-table-column property="isFinish" label="状态" />
<el-table-column property="description" label="子系统简介" /> <el-table-column property="description" label="子系统简介" >
<el-table-column property="address" label="截止时间" /> <template #default="{row}">
<el-table-column property="address" label="操作"> <span >{{ row.description.description }}</span>
<el-button link style="color:deepskyblue" @click="toChildModel">查看详情</el-button> </template>
</el-table-column>
<el-table-column property="createdAt" label="截止时间" />
<el-table-column property="address" label="操作" #default="{row}">
<el-button link style="color:deepskyblue" @click="toChildModel(row.id)">查看详情</el-button>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination larger background layout="prev, pager, next" :total="50" class="mt-4" <el-pagination larger background layout="prev, pager, next" :total="50" class="mt-4"
@ -51,30 +56,29 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { ElTable } from 'element-plus'; import { ElTable } from 'element-plus';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
// import { searchModel } from '@/api/manage.js'; import { useRoute } from 'vue-router';
// import { getToken } from '@/utils/auth'; import { getToken } from '@/utils/auth';
import { getProjectSysList } from '@/api/manage';
// //
const router = useRouter(); const router = useRouter();
const toChildModel = () => { const toChildModel = (id) => {
router.push({ name: 'ChildModManage' }) router.push({ name: 'ChildModManage' , query: { id: id } })
}; };
const input = ref(''); const input = ref('');
interface User { interface User {
cycle:number id: number
description:string
isDelete:number
isFinish:number
name:string
principalId: number principalId: number
projectId: number projectId: number
status:boolean name: string
type:number cycle: number
workLoad: number workLoad: number
id:number description: { description: string }
isDelete: number
createdAt: string
} }
const multipleTableRef = ref<InstanceType<typeof ElTable>>(); const multipleTableRef = ref<InstanceType<typeof ElTable>>();
@ -84,52 +88,61 @@ const handleSelectionChange = (val: User[]) => {
multipleSelection.value = val; multipleSelection.value = val;
}; };
//
//
// console.log(searchSys); // console.log(searchSys);
const tableData = ref<User[]>([ const tableData = ref<User[]>([
{
id: 1,
cycle: 1,
description: '子系统1',
isDelete: 0,
isFinish: 1,
name: '子系统1',
principalId: 1,
projectId: 1,
status: true,
type: 1,
workLoad: 1
}
]); ]);
const initialTableData = ref<User[]>([]);
// projectid
const route = useRoute();
const projectId = route.query.id;
//
const parseData = (data)=>{
const description = JSON.parse(data.description);
return{
id: data.id,
cycle: data.cycle,
description: description,
isDelete: data.isDelete,
name: data.name,
principalId: data.principalId,
projectId: data.projectId,
workLoad: data.workLoad,
createdAt: data.createdAt
}
}
const fetchData = () => {
const project = getProjectSysList(projectId,getToken());
// //
// searchSys.then(res => { project.then(res=>{
// const data = res.data.data; const data = res.data.data
// console.log(data);
// if (data) { // console.log(data)
// tableData.value = data.map(item =>{ if(data){
// const addproject: User = { const newData = data.map(item=>parseData(item))
// id: item.id, console.log(newData);
// cycle: item.cycle,
// description: item.description,
// isDelete: item.isDelete,
// isFinish: item.isFinish,
// name: item.name,
// principalId: item.principalId,
// projectId: item.projectId,
// status: item.status,
// type: item.type,
// workLoad: item.workLoad
// };
// tableData.value.push(addproject); tableData.value = [...newData,...tableData.value];
initialTableData.value = tableData.value.slice(); // tableDatainitialTableData
// }) }
})
}
fetchData();
@ -137,16 +150,6 @@ const tableData = ref<User[]>([
// }else{
// console.log("");
// }
// console.log(tableData.value);
// }).catch(err => {
// console.log(err);
// });

View File

@ -37,7 +37,7 @@
<span>{{ row.description.description }}</span> <span>{{ row.description.description }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="createdAt" label="创建时间" /> <el-table-column property="deadLine" label="截止时间" />
<el-table-column property="address" label="操作" #default="{row}"> <el-table-column property="address" label="操作" #default="{row}">
<el-button link style="color:deepskyblue" @click="toChildModel(row.id)">查看详情</el-button> <el-button link style="color:deepskyblue" @click="toChildModel(row.id)">查看详情</el-button>
</el-table-column> </el-table-column>
@ -76,12 +76,13 @@ const toChildModel = (SysId: number) => {
interface User { interface User {
id: number id: number
createdAt: string
cycle: number cycle: number
description: { description: string } description: { description: string }
isDeleted: number isDeleted: number
name: string name: string
principalId: number principalId: number
deadLine: string
projectId: number projectId: number
workLoad: number workLoad: number
status: string status: string
@ -98,12 +99,10 @@ const handleSelectionChange = (val: User[]) => {
const tableData = ref<User[]>([ const tableData = ref<User[]>([
{ {
id: 1, id: 1,
createdAt: '2022-01-01', deadLine: '2022-01-01',
cycle: 1, cycle: 1,
description: { description: '子系统1的简介' }, description: { description: '子系统1的简介' },
isDeleted: 0, isDeleted: 0,
name: '子系统1', name: '子系统1',
principalId: 1, principalId: 1,
projectId: 1, projectId: 1,
@ -122,7 +121,7 @@ const parseData = (data) => {
return { return {
id: data.id, id: data.id,
createdAt: data.createdAt, deadLine: data.deadLine,
cycle: data.cycle, cycle: data.cycle,
description: description, description: description,
isDeleted: data.isDeleted, isDeleted: data.isDeleted,

View File

@ -1,7 +1,7 @@
<template> <template>
<div style=" width:100%"> <div style=" width:100%">
<el-card style="max-width: 100vw;margin: 1.5vw;"> <el-card style="max-width: 100vw;margin: 1.5vw;">
<template #header><strong >子系统1</strong></template> <template #header><strong>子系统{{ id }}</strong></template>
<div style="display:flex;flex-direction:row;justify-content: space-around "> <div style="display:flex;flex-direction:row;justify-content: space-around ">
<div> <div>
名称 名称
@ -19,51 +19,33 @@
</el-card> </el-card>
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw"> <el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
<div style="display:flex;flex-direction: row;justify-content: space-between"> <div style="display:flex;flex-direction: row;justify-content: space-between">
<el-button <el-button text type=''>子模块列表</el-button>
text
type=''
>子模块列表</el-button
>
<div> <div>
<el-button type="primary" style="width:80px">新增</el-button> <el-button type="primary" style="width:80px">新增</el-button>
<el-button style="width:80px ;background-color: #bd3124;color: azure;">删除</el-button> <el-button style="width:80px ;background-color: #bd3124;color: azure;">删除</el-button>
</div> </div>
</div> </div>
<el-table <el-table ref="multipleTableRef" :data="tableData" style="max-width: 100vw;"
ref="multipleTableRef" @selection-change="handleSelectionChange">
:data="tableData"
style="max-width: 100vw;"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="序号" width="120"> <el-table-column label="序号" width="120">
<template #default="scope">{{ scope.row.date }}</template> <template #default="{row}">{{row.id }}</template>
</el-table-column> </el-table-column>
<el-table-column property="name" label="子模块名称" width="120" /> <el-table-column property="name" label="子模块名称" width="120" />
<el-table-column property="address" label="工作量" show-overflow-tooltip /> <el-table-column property="address" label="工作量" show-overflow-tooltip />
<el-table-column property="address" label="周期" /> <el-table-column property="address" label="周期" />
<el-table-column property="address" label="负责人" /> <el-table-column property="principalUser" label="负责人" />
<el-table-column property="address" label="状态" /> <el-table-column property="address" label="状态" />
<el-table-column property="address" label="子系统简介" /> <el-table-column property="address" label="子模块简介" #default="{row}" >
<span>{{row.description.description}}</span>
</el-table-column>
<el-table-column property="address" label="截止时间" /> <el-table-column property="address" label="截止时间" />
<el-table-column property="address" label="操作" > <el-table-column property="address" label="操作" #default="{row}">
<el-button <el-button link style="color:deepskyblue" @click="toDetail(row.id)">查看详情</el-button>
link
style="color:deepskyblue"
@click="toDetail"
>查看详情</el-button
>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination larger background layout="prev, pager, next" :total="50" class="mt-4"
larger style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh" />
background
layout="prev, pager, next"
:total="50"
class="mt-4"
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh"
/>
</el-card> </el-card>
<router-view /> <router-view />
</div> </div>
@ -72,21 +54,27 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { ElTable } from 'element-plus'; import { ElTable } from 'element-plus';
import { getProjectModList } from '@/api/manage';
import { useRouter ,useRoute} from 'vue-router';
import { getToken } from '@/utils/auth';
import { useRouter } from 'vue-router';
const router = useRouter(); const router = useRouter();
// //
const toDetail = () => { const toDetail = (id) => {
router.push({ name: 'ManageDetail' }); // router.push({ name: 'ManageDetail' ,query: { id: id } }); //
}; };
interface User { interface User {
date: string id: number
name: string name: string
address: string principalId: number
principalUser:string
workLoad: number
description: { description: string }
status: boolean
} }
const multipleTableRef = ref<InstanceType<typeof ElTable>>(); const multipleTableRef = ref<InstanceType<typeof ElTable>>();
@ -98,29 +86,60 @@
const input = ref(''); const input = ref('');
const tableData: User[] = [ const initialTableData = ref<User[]>([]);
{ const tableData = ref<User[]>([
date: '2016-05-03',
name: 'Tom', ]) ;
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-02',
name: 'Tom', //
address: 'No. 189, Grove St, Los Angeles' const route = useRoute();
}, const id = route.query.id;
{
date: '2016-05-04',
name: 'Tom', //
address: 'No. 189, Grove St, Los Angeles' const parseData = (data) => {
}, const description = JSON.parse(data.description);
{
date: '2016-05-01',
name: 'Tom', return{
address: 'No. 189, Grove St, Los Angeles' id: data.id,
name: data.name,
principalId: data.principalId,
principalUser: data.principalUser,
workLoad: data.workLoad,
description: description,
status: data.status
} }
]; }
//
const fetchData = ()=>{
//
const project = getProjectModList(3,getToken());
console.log(project);
//
project.then(res=>{
const data = res.data.data;
if(data){
const newData = data.map(item=>parseData(item))
// console.log(newData);
tableData.value = [...newData,...tableData.value];
initialTableData.value = tableData.value.slice(); // tableDatainitialTableData
}
}).catch(err=>{
console.log(err);
})
}
fetchData();
</script> </script>
@ -129,14 +148,17 @@
line-height: normal; line-height: normal;
padding: 7px; padding: 7px;
} }
.my-autocomplete li .name { .my-autocomplete li .name {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow: hidden; overflow: hidden;
} }
.my-autocomplete li .addr { .my-autocomplete li .addr {
font-size: 12px; font-size: 12px;
color: #b4b4b4; color: #b4b4b4;
} }
.my-autocomplete li .highlighted .addr { .my-autocomplete li .highlighted .addr {
color: #ddd; color: #ddd;
} }

View File

@ -30,7 +30,7 @@
</el-table-column> </el-table-column>
<el-table-column property="name" label="子模块名称" width="120" /> <el-table-column property="name" label="子模块名称" width="120" />
<el-table-column property="workLoad" label="工作量" show-overflow-tooltip /> <el-table-column property="workLoad" label="工作量" show-overflow-tooltip />
<el-table-column property="address" label="周期" /> <el-table-column property="cycle" label="周期" />
<el-table-column property="principalUser" label="负责人" /> <el-table-column property="principalUser" label="负责人" />
<el-table-column property="status" label="状态" /> <el-table-column property="status" label="状态" />
<el-table-column property="description" label="子模块简介" #default="{ row }"> <el-table-column property="description" label="子模块简介" #default="{ row }">
@ -96,7 +96,28 @@ const handleSelectionChange = (val: User[]) => {
// //
const tableData = ref<User[]>([]); const tableData = ref<User[]>([
{
beginTime: '2021-11-11',
childSystemName: '子系统1',
completeTime: '2021-11-11',
cycle: "10tian",
description: { description: '子系统1描述' },
id: 1,
isDelete: 0,
isFinishi: '否',
name: '子模块1',
pid: '1',
principalId: 1,
principalUser: '负责人1',
projectId: 1,
status: '待完成',
type: '子系统',
workLoad: 10
}
]);
const initialTableData = ref<User[]>([]); const initialTableData = ref<User[]>([]);
const parseData = (data) => { const parseData = (data) => {
const descripation = JSON.parse(data.description); const descripation = JSON.parse(data.description);

View File

@ -1,7 +1,7 @@
<template> <template>
<div style=" width:100%;"> <div style=" width:100%;">
<el-card style="max-width: 100vw;"> <el-card style="max-width: 100vw;">
<template #header><strong>子模块1</strong></template> <template #header><strong>子模块{{ projectId }}</strong></template>
</el-card> </el-card>
@ -52,6 +52,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { getProjectModDetail } from '@/api/manage';
import { getToken } from '@/utils/auth';
const projectItems = ref([ const projectItems = ref([
{ label: '01.模块名称', value: '项目名称1' }, { label: '01.模块名称', value: '项目名称1' },
@ -65,6 +68,56 @@ const projectItems = ref([
const selectedStatus = ref('进行中'); const selectedStatus = ref('进行中');
const route = useRoute();
const projectId = route.query.id;
//
function renderTime(date) {
var dateee = new Date(date).toJSON();
return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')
}
//
//
const parseData = (data) => {
projectItems.value.forEach(item => {
if (item.label === '01.模块名称') {
item.value = data.name;
} else if (item.label === '02.模块周期') {
item.value = data.cycle ? data.cycle : '未知';
} else if (item.label === '03.工作量') {
item.value = data.workLoad + "人/天";
} else if (item.label === '04.负责人') {
item.value = data.principalUser;
} else if (item.label === '05.状态') {
item.value = data.status ? data.status : '未知';
} else if (item.label === '06.时间') {
item.value = renderTime(data.deadLine) ? data.deadLine : '2024-01-01 12:00:00';
} else if (item.label === '07.简介') {
item.value = data.description;
}
})
}
//
const fetchData = () => {
const project = getProjectModDetail(projectId, getToken());
project.then(res => {
const data = res.data.data;
console.log(data);
if (data) {
parseData(data);
}
})
}
fetchData();

View File

@ -37,6 +37,9 @@
</el-row> </el-row>
</el-card> </el-card>
<div style="display: flex;justify-content: center;">
<el-button style="width: 80px;background-color: #409eff;color: azure" @click="toBack" >完成</el-button>
</div>
@ -113,7 +116,10 @@ const fetchData = () => {
} }
fetchData(); fetchData();
//
const toBack = () => {
window.history.go(-1);
}

View File

@ -16,11 +16,18 @@
<el-button style="width:80px">重置</el-button> <el-button style="width:80px">重置</el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw"> <el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
<div style="display:flex;flex-direction: row;justify-content: space-between"> <div style="display:flex;flex-direction: row;justify-content: space-between">
<el-button text type=''>项目列表</el-button> <el-button text type=''>项目列表</el-button>
<div style="text-align: right;">
<el-button type="primary" style="width:80px">新增</el-button>
<el-button style="width:80px ;background-color: #bd3124;color: azure;">删除</el-button>
</div> </div>
</div>
<el-table ref="multipleTableRef" :data="tableData" style="max-width: 100vw;" <el-table ref="multipleTableRef" :data="tableData" style="max-width: 100vw;"
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" />--> <!-- <el-table-column type="selection" width="55" />-->
@ -49,8 +56,8 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column property="dateline" label="截止时间" /> <el-table-column property="dateline" label="截止时间" />
<el-table-column property="name" label="操作"> <el-table-column property="name" label="操作" #default="{row}">
<el-button link style="color:deepskyblue" @click="toChildSystem">查看详情</el-button> <el-button link style="color:deepskyblue" @click="toChildSystem(row.id)">查看详情</el-button>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination larger background layout="prev, pager, next" :total="40" class="mt-4" <el-pagination larger background layout="prev, pager, next" :total="40" class="mt-4"
@ -76,8 +83,8 @@ import { getManageList } from '@/api/manage.js';
const router = useRouter(); const router = useRouter();
// //
const toChildSystem = () => { const toChildSystem = (id) => {
router.push({ name: 'ChildSysManage' }); // router.push({ name: 'ChildSysManage' ,query: { id: id } }); //
}; };
// //
@ -110,7 +117,7 @@ interface User {
} }
//
@ -122,7 +129,9 @@ const input2 = ref('');
const multipleTableRef = ref<InstanceType<typeof ElTable>>(); const multipleTableRef = ref<InstanceType<typeof ElTable>>();
const multipleSelection = ref<User[]>([]); const multipleSelection = ref<User[]>([
]);
const handleSelectionChange = (val: User[]) => { const handleSelectionChange = (val: User[]) => {
multipleSelection.value = val; multipleSelection.value = val;