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

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 访问令牌
* @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>
<div style=" width:100%">
<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>
名称
@ -25,17 +25,22 @@
@selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" />-->
<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 property="name" label="子系统名称" width="120" />
<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="isFinish" label="状态" />
<el-table-column property="description" label="子系统简介" />
<el-table-column property="address" label="截止时间" />
<el-table-column property="address" label="操作">
<el-button link style="color:deepskyblue" @click="toChildModel">查看详情</el-button>
<el-table-column property="description" label="子系统简介" >
<template #default="{row}">
<span >{{ row.description.description }}</span>
</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>
<el-pagination larger background layout="prev, pager, next" :total="50" class="mt-4"
@ -51,30 +56,29 @@
import { ref } from 'vue';
import { ElTable } from 'element-plus';
import { useRouter } from 'vue-router';
// import { searchModel } from '@/api/manage.js';
// import { getToken } from '@/utils/auth';
import { useRoute } from 'vue-router';
import { getToken } from '@/utils/auth';
import { getProjectSysList } from '@/api/manage';
//
const router = useRouter();
const toChildModel = () => {
router.push({ name: 'ChildModManage' })
const toChildModel = (id) => {
router.push({ name: 'ChildModManage' , query: { id: id } })
};
const input = ref('');
interface User {
cycle:number
description:string
isDelete:number
isFinish:number
name:string
principalId:number
projectId:number
status:boolean
type:number
workLoad:number
id:number
id: number
principalId: number
projectId: number
name: string
cycle: number
workLoad: number
description: { description: string }
isDelete: number
createdAt: string
}
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
@ -84,69 +88,68 @@ const handleSelectionChange = (val: User[]) => {
multipleSelection.value = val;
};
//
//
// console.log(searchSys);
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
}
]);
//
// searchSys.then(res => {
// const data = res.data.data;
// console.log(data);
// if (data) {
// tableData.value = data.map(item =>{
// const addproject: User = {
// id: item.id,
// 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
// };
const initialTableData = ref<User[]>([]);
// tableData.value.push(addproject);
// 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());
//
project.then(res=>{
const data = res.data.data
// console.log(data)
if(data){
const newData = data.map(item=>parseData(item))
console.log(newData);
tableData.value = [...newData,...tableData.value];
initialTableData.value = tableData.value.slice(); // tableDatainitialTableData
}
})
}
fetchData();
// }else{
// console.log("");
// }
// console.log(tableData.value);
// }).catch(err => {
// console.log(err);
// });

View File

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

View File

@ -1,143 +1,165 @@
<template>
<div style=" width:100%">
<el-card style="max-width: 100vw;margin: 1.5vw;">
<template #header><strong >子系统1</strong></template>
<div style="display:flex;flex-direction:row;justify-content: space-around ">
<div>
名称
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
</div>
<div>
状态
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
</div>
<div>
<el-button type="primary" style="width:80px">查询</el-button>
<el-button style="width:80px">重置</el-button>
</div>
</div>
</el-card>
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
<div style="display:flex;flex-direction: row;justify-content: space-between">
<el-button
text
type=''
>子模块列表</el-button
>
<div>
<el-button type="primary" style="width:80px">新增</el-button>
<el-button style="width:80px ;background-color: #bd3124;color: azure;">删除</el-button>
</div>
</div>
<el-table
ref="multipleTableRef"
:data="tableData"
style="max-width: 100vw;"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column label="序号" width="120">
<template #default="scope">{{ scope.row.date }}</template>
</el-table-column>
<el-table-column property="name" label="子模块名称" width="120" />
<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="address" label="子系统简介" />
<el-table-column property="address" label="截止时间" />
<el-table-column property="address" label="操作" >
<el-button
link
style="color:deepskyblue"
@click="toDetail"
>查看详情</el-button
>
</el-table-column>
</el-table>
<el-pagination
larger
background
layout="prev, pager, next"
:total="50"
class="mt-4"
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh"
/>
</el-card>
<router-view/>
<div style=" width:100%">
<el-card style="max-width: 100vw;margin: 1.5vw;">
<template #header><strong>子系统{{ id }}</strong></template>
<div style="display:flex;flex-direction:row;justify-content: space-around ">
<div>
名称
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
</div>
<div>
状态
<el-input v-model="input" style="width: 240px;margin-left:0.5vw" placeholder="请输入" />
</div>
<div>
<el-button type="primary" style="width:80px">查询</el-button>
<el-button style="width:80px">重置</el-button>
</div>
</div>
</template>
</el-card>
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
<div style="display:flex;flex-direction: row;justify-content: space-between">
<el-button text type=''>子模块列表</el-button>
<div>
<el-button type="primary" style="width:80px">新增</el-button>
<el-button style="width:80px ;background-color: #bd3124;color: azure;">删除</el-button>
</div>
</div>
<el-table ref="multipleTableRef" :data="tableData" style="max-width: 100vw;"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="序号" width="120">
<template #default="{row}">{{row.id }}</template>
</el-table-column>
<el-table-column property="name" label="子模块名称" width="120" />
<el-table-column property="address" label="工作量" show-overflow-tooltip />
<el-table-column property="address" label="周期" />
<el-table-column property="principalUser" 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="操作" #default="{row}">
<el-button link style="color:deepskyblue" @click="toDetail(row.id)">查看详情</el-button>
</el-table-column>
</el-table>
<el-pagination larger background layout="prev, pager, next" :total="50" class="mt-4"
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh" />
</el-card>
<router-view />
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { ElTable } from 'element-plus';
import { getProjectModList } from '@/api/manage';
import { useRouter ,useRoute} from 'vue-router';
import { getToken } from '@/utils/auth';
const router = useRouter();
//
const toDetail = (id) => {
router.push({ name: 'ManageDetail' ,query: { id: id } }); //
};
interface User {
id: number
name: string
principalId: number
principalUser:string
workLoad: number
description: { description: string }
status: boolean
}
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
const multipleSelection = ref<User[]>([]);
const handleSelectionChange = (val: User[]) => {
multipleSelection.value = val;
};
const input = ref('');
const initialTableData = ref<User[]>([]);
const tableData = ref<User[]>([
]) ;
<script lang="ts" setup>
import { ref } from 'vue';
import { ElTable } from 'element-plus';
import { useRouter } from 'vue-router';
const router = useRouter();
//
const toDetail = () => {
router.push({ name: 'ManageDetail' }); //
};
//
const route = useRoute();
const id = route.query.id;
interface User {
date: string
name: string
address: string
//
const parseData = (data) => {
const description = JSON.parse(data.description);
return{
id: data.id,
name: data.name,
principalId: data.principalId,
principalUser: data.principalUser,
workLoad: data.workLoad,
description: description,
status: data.status
}
const multipleTableRef = ref<InstanceType<typeof ElTable>>();
const multipleSelection = ref<User[]>([]);
const handleSelectionChange = (val: User[]) => {
multipleSelection.value = val;
};
const input = ref('');
}
//
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);
})
const tableData: 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'
},
{
date: '2016-05-04',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
},
{
date: '2016-05-01',
name: 'Tom',
address: 'No. 189, Grove St, Los Angeles'
}
];
</script>
<style>
.my-autocomplete li {
line-height: normal;
padding: 7px;
}
.my-autocomplete li .name {
text-overflow: ellipsis;
overflow: hidden;
}
.my-autocomplete li .addr {
font-size: 12px;
color: #b4b4b4;
}
.my-autocomplete li .highlighted .addr {
color: #ddd;
}
</style>
}
fetchData();
</script>
<style>
.my-autocomplete li {
line-height: normal;
padding: 7px;
}
.my-autocomplete li .name {
text-overflow: ellipsis;
overflow: hidden;
}
.my-autocomplete li .addr {
font-size: 12px;
color: #b4b4b4;
}
.my-autocomplete li .highlighted .addr {
color: #ddd;
}
</style>

View File

@ -30,7 +30,7 @@
</el-table-column>
<el-table-column property="name" label="子模块名称" width="120" />
<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="status" label="状态" />
<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 parseData = (data) => {
const descripation = JSON.parse(data.description);

View File

@ -1,7 +1,7 @@
<template>
<div style=" width:100%;">
<el-card style="max-width: 100vw;">
<template #header><strong>子模块1</strong></template>
<template #header><strong>子模块{{ projectId }}</strong></template>
</el-card>
@ -52,6 +52,9 @@
<script lang="ts" setup>
import { ref } from 'vue';
import { useRoute } from 'vue-router';
import { getProjectModDetail } from '@/api/manage';
import { getToken } from '@/utils/auth';
const projectItems = ref([
{ label: '01.模块名称', value: '项目名称1' },
@ -65,6 +68,56 @@ const projectItems = 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,7 +37,10 @@
</el-row>
</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();
//
const toBack = () => {
window.history.go(-1);
}

View File

@ -16,11 +16,18 @@
<el-button style="width:80px">重置</el-button>
</div>
</div>
</el-card>
<el-card style="max-width: 100vw;height:60vh;margin:1.3vw">
<div style="display:flex;flex-direction: row;justify-content: space-between">
<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>
<el-table ref="multipleTableRef" :data="tableData" style="max-width: 100vw;"
@selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" />-->
@ -43,14 +50,14 @@
<span v-for="(tag, index) in row.tags" :key="index">{{ tag.toString() }} </span>
</template>
</el-table-column>
<el-table-column property="description" label="项目简介" >
<template v-slot="{row}">
<el-table-column property="description" label="项目简介">
<template v-slot="{ row }">
<span v-for="(des, index) in row.description" :key="index">{{ des.toString() }} </span>
</template>
</el-table-column>
<el-table-column property="dateline" label="截止时间" />
<el-table-column property="name" label="操作">
<el-button link style="color:deepskyblue" @click="toChildSystem">查看详情</el-button>
<el-table-column property="name" label="操作" #default="{row}">
<el-button link style="color:deepskyblue" @click="toChildSystem(row.id)">查看详情</el-button>
</el-table-column>
</el-table>
<el-pagination larger background layout="prev, pager, next" :total="40" class="mt-4"
@ -64,7 +71,7 @@
</template>
<script lang="ts" setup>
import { ref ,onMounted} from 'vue';
import { ref, onMounted } from 'vue';
import { ElTable } from 'element-plus';
import { getManageListById } from '@/api/manage.js';
import { getToken } from '@/utils/auth';
@ -76,8 +83,8 @@ import { getManageList } from '@/api/manage.js';
const router = useRouter();
//
const toChildSystem = () => {
router.push({ name: 'ChildSysManage' }); //
const toChildSystem = (id) => {
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 multipleSelection = ref<User[]>([]);
const multipleSelection = ref<User[]>([
]);
const handleSelectionChange = (val: User[]) => {
multipleSelection.value = val;
@ -136,7 +145,7 @@ const parseData = (data) => {
return {
id: data.id,
total:20,
total: 20,
cycle: data.cycle,
name: data.name,
description: description,