部分代码修改
This commit is contained in:
parent
8680c52ad9
commit
d39f6079c3
1
auto-imports.d.ts
vendored
1
auto-imports.d.ts
vendored
@ -2,5 +2,4 @@
|
||||
export {}
|
||||
declare global {
|
||||
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
||||
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
<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"
|
||||
<el-pagination larger background layout="prev, pager, next" :total="5" class="mt-4"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh" />
|
||||
</el-card>
|
||||
<el-alert >
|
||||
|
@ -44,7 +44,7 @@
|
||||
<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"
|
||||
<el-pagination larger background layout="prev, pager, next" :total="5" class="mt-4"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh" />
|
||||
</el-card>
|
||||
|
||||
@ -67,6 +67,7 @@ const projectid = route.query.projectId ? route.query.projectId : 1 ;
|
||||
|
||||
|
||||
|
||||
|
||||
//跳转到子模块
|
||||
const router = useRouter();
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
<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"
|
||||
<el-pagination larger background layout="prev, pager, next" :total="5" class="mt-4"
|
||||
style="display: flex;flex-direction: row;justify-content: center;margin-top:5vh" />
|
||||
</el-card>
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<el-col :span="12">
|
||||
<el-row v-for="item in projectItems" :key="item.label">
|
||||
<el-col :span="24">
|
||||
<div v-if="item.label !== '07.简介'" style="margin-top: 10%;">
|
||||
<div v-if="item.label !== '07.简介'" style="margin-top: 11%;">
|
||||
<template v-if="editMode">
|
||||
<input v-model="item.value" />
|
||||
</template>
|
||||
@ -24,7 +24,7 @@
|
||||
{{ item.value }}
|
||||
</template>
|
||||
</div>
|
||||
<textarea v-if="item.label === '07.简介'" style="resize: none; margin-top: 10%; width: 100%;"
|
||||
<textarea v-if="item.label === '07.简介'" style="resize: none; margin-top: 15%; width: 100%;"
|
||||
v-model="item.value" :disabled="!editMode" rows="4" cols="50">
|
||||
</textarea>
|
||||
</el-col>
|
||||
@ -52,13 +52,14 @@ import { ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { getProjectModDetail, editModule, deleteModule } from '@/api/manage';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
|
||||
|
||||
const projectItems = ref([
|
||||
{ label: '01.模块名称', value: '项目名称1' },
|
||||
{ label: '02.模块周期', value: '3个月' },
|
||||
{ label: '03.工作量', value: '100小时' },
|
||||
{ label: '04.负责人', value: '张三' },
|
||||
{ label: '04.负责人ID', value: '张三' },
|
||||
{ label: '05.状态', value: '进行中' },
|
||||
{ label: '06.时间', value: '2024-01-01 12:00:00' },
|
||||
{ label: '07.简介', value: '大王iu大概iudg拍高端屁股的怕耽搁u对爬过文档爬过无' },
|
||||
@ -87,10 +88,10 @@ const parseData = (data) => {
|
||||
item.value = data.workLoad;
|
||||
} else if (item.label === '03.工作量') {
|
||||
item.value = data.workLoad ;
|
||||
} else if (item.label === '04.负责人') {
|
||||
} else if (item.label === '04.负责人ID') {
|
||||
item.value = "1";
|
||||
} else if (item.label === '05.状态') {
|
||||
item.value = data.workLoad.toString();
|
||||
item.value = data.status.toString();
|
||||
} else if (item.label === '06.时间') {
|
||||
item.value = new Date(data.deadLine).toLocaleDateString();
|
||||
} else if (item.label === '07.简介') {
|
||||
@ -197,12 +198,16 @@ const deleteModuleClick = () => {
|
||||
const confirm = ElMessageBox.confirm('确认删除吗?');
|
||||
confirm.then(() => {
|
||||
const res = deleteModule(projectId, getToken());
|
||||
console.log(res);
|
||||
|
||||
res.then(response => {
|
||||
if (response.data.code === 200) {
|
||||
ElMessage.success('删除成功!');
|
||||
//返回上一级页面
|
||||
window.history.go(-1);
|
||||
} else {
|
||||
} else if(response.data.code === 40019) {
|
||||
ElMessage.error('删除失败!没有权限');
|
||||
}else{
|
||||
ElMessage.error('删除失败!');
|
||||
}
|
||||
}).catch(error => {
|
||||
|
@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<div style=" width:100%;">
|
||||
<el-card style="max-width: 100vw;">
|
||||
<template #header><strong>子模块{{ id }}</strong></template>
|
||||
|
||||
|
||||
<template #header><strong>子模块{{ projectId }}</strong></template>
|
||||
</el-card>
|
||||
|
||||
<el-card class="card">
|
||||
@ -11,69 +9,72 @@
|
||||
<el-col :span="12">
|
||||
<el-row v-for="item in projectItems" :key="item.label">
|
||||
<el-col :span="24">
|
||||
<div style="margin-top: 10%;"><strong>{{ item.label }}</strong> </div>
|
||||
<div style="margin-top: 10%;"><strong>{{ item.label }}</strong></div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-row v-for="item in projectItems" :key="item.label">
|
||||
<el-col :span="24">
|
||||
<div v-if="item.label !== '05.状态' && item.label !== '07.简介'" style="margin-top: 10%;">{{
|
||||
item.value
|
||||
}}</div>
|
||||
<el-select v-if="item.label === '05.状态'" v-model="selectedStatus" placeholder="请选择状态"
|
||||
style="width: 150px ;margin-top: 10%">
|
||||
<el-option label="未开始" value="未开始"></el-option>
|
||||
<el-option label="进行中" value="进行中"></el-option>
|
||||
<el-option label="已完成" value="已完成"></el-option>
|
||||
<el-option label="未知" value="未知"></el-option>
|
||||
<el-option label="异常暂停" value="异常暂停"></el-option>
|
||||
</el-select>
|
||||
<textarea style="resize: none;margin-top: 10%;width: 150px;" v-if="item.label === '07.简介'"
|
||||
v-model="item.value" rows="4" cols="50"></textarea>
|
||||
<div v-if="item.label !== '07.简介'" style="margin-top: 11%;">
|
||||
<template v-if="editMode">
|
||||
<input v-model="item.value" />
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ item.value }}
|
||||
</template>
|
||||
</div>
|
||||
<textarea v-if="item.label === '07.简介'" style="resize: none; margin-top: 15%; width: 100%;"
|
||||
v-model="item.value" :disabled="!editMode" rows="4" cols="50">
|
||||
</textarea>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<el-alert>
|
||||
<router-view />
|
||||
</el-alert>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { ref } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { getParticipateDetail } from '@/api/participate';
|
||||
|
||||
import { getProjectModDetail} from '@/api/manage';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
|
||||
const projectItems = ref([
|
||||
{ label: '01.模块名称', value: '名称1' },
|
||||
{ label: '01.模块名称', value: '项目名称1' },
|
||||
{ label: '02.模块周期', value: '3个月' },
|
||||
{ label: '03.工作量', value: '100小时' },
|
||||
{ label: '04.负责人', value: '张三' },
|
||||
{ label: '04.负责人ID', value: '张三' },
|
||||
{ label: '05.状态', value: '进行中' },
|
||||
{ label: '06.时间', value: '2024-01-01 12:00:00' },
|
||||
{ label: '07.简介', value: '测试ing' },
|
||||
{ label: '07.简介', value: '大王iu大概iudg拍高端屁股的怕耽搁u对爬过文档爬过无' },
|
||||
]);
|
||||
|
||||
const selectedStatus = ref('进行中');
|
||||
const editMode = ref(false); // 编辑模式状态
|
||||
|
||||
|
||||
|
||||
|
||||
//获取id
|
||||
const route = useRoute();
|
||||
const id = route.query.ModId;
|
||||
const projectId = Number(route.query.id);
|
||||
|
||||
|
||||
|
||||
//加载数据
|
||||
//修改表单内数据
|
||||
const parseData = (data) => {
|
||||
|
||||
@ -82,13 +83,13 @@ const parseData = (data) => {
|
||||
if (item.label === '01.模块名称') {
|
||||
item.value = data.name;
|
||||
} else if (item.label === '02.模块周期') {
|
||||
item.value = data.cycle ? data.cycle : '未知';
|
||||
item.value = data.workLoad;
|
||||
} else if (item.label === '03.工作量') {
|
||||
item.value = data.workLoad + "人/天";
|
||||
} else if (item.label === '04.负责人') {
|
||||
item.value = data.principalUser;
|
||||
item.value = data.workLoad ;
|
||||
} else if (item.label === '04.负责人ID') {
|
||||
item.value = "1";
|
||||
} else if (item.label === '05.状态') {
|
||||
item.value = data.status ? data.status : '未知';
|
||||
item.value = data.status.toString();
|
||||
} else if (item.label === '06.时间') {
|
||||
item.value = new Date(data.deadLine).toLocaleDateString();
|
||||
} else if (item.label === '07.简介') {
|
||||
@ -97,25 +98,17 @@ const parseData = (data) => {
|
||||
})
|
||||
}
|
||||
|
||||
//获取数据方法
|
||||
const fetchData = async () => {
|
||||
const res = await getProjectModDetail(projectId, getToken());
|
||||
console.log(res.data);
|
||||
if (res.data.data) {
|
||||
parseData(res.data.data); // 解析数据
|
||||
ElMessage.success('加载成功!');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//接收接口数据
|
||||
|
||||
const fetchData = () => {
|
||||
const project = getParticipateDetail(id, getToken());
|
||||
|
||||
|
||||
project.then(res => {
|
||||
const data = res.data.data;
|
||||
console.log(data);
|
||||
if (data) {
|
||||
parseData(data);
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
fetchData();
|
||||
|
||||
//完成返回上一级
|
||||
const toBack = () => {
|
||||
window.history.go(-1);
|
||||
@ -123,6 +116,11 @@ const toBack = () => {
|
||||
|
||||
|
||||
|
||||
fetchData();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -124,6 +124,8 @@ const parseData = (data) => {
|
||||
// 处理接口数据
|
||||
const fetchData = () => {
|
||||
const project = getParticipateProjectList(getToken());
|
||||
console.log(project);
|
||||
|
||||
project.then(res => {
|
||||
const data = res.data.data.list;
|
||||
const dataTotal = res.data.data.total;
|
||||
|
Loading…
x
Reference in New Issue
Block a user