<template>
|
<div>
|
<div class="one" v-if="level !== 1">
|
<h1>所属一级项目</h1>
|
<div class="tab mr-b-10">
|
<v-tool-table :trs="trsOne" :tds="tdsOne">
|
<template v-slot:status="{ scope }">
|
<span>{{ statusLevel[scope.status] }}</span>
|
</template>
|
<!-- <template v-slot:btn="{ scope }">
|
<el-button @click="clickHandle('edit', scope)" type="text"
|
>编辑</el-button
|
>
|
<el-button @click="clickHandle('details', scope)" type="text"
|
>查看</el-button
|
>
|
<el-button @click="clickHandle('delete', scope)" type="text"
|
>删除</el-button
|
>
|
</template> -->
|
</v-tool-table>
|
</div>
|
</div>
|
<div class="one" v-if="level !== 1 && level !== 2">
|
<h1>所属二级项目</h1>
|
<div class="tab mr-b-10">
|
<v-tool-table :trs="trsTwo" :tds="tdsTwo">
|
<template v-slot:status="{ scope }">
|
<span>{{ statusLevel[scope.status] }}</span>
|
</template>
|
<!-- <template v-slot:btn="{ scope }">
|
<el-button @click="clickHandle('edit', scope)" type="text"
|
>编辑</el-button
|
>
|
<el-button @click="clickHandle('details', scope)" type="text"
|
>查看</el-button
|
>
|
<el-button @click="clickHandle('delete', scope)" type="text"
|
>删除</el-button
|
>
|
</template> -->
|
</v-tool-table>
|
</div>
|
</div>
|
<div class="two" v-if="level != 3 && newVal.status !== 4">
|
子项目<el-button
|
size="small"
|
v-if="this.userType !== 3"
|
@click="addChilren()"
|
>创建子项目</el-button
|
>
|
<div class="tab">
|
<v-tool-table :trs="trs" :tds="tds">
|
<template v-slot:status="{ scope }">
|
<span>{{ statusLevel[scope.status] }}</span>
|
</template>
|
<template v-slot:btn="{ scope }">
|
<el-button @click="clickHandle('edit', scope)" type="text"
|
>编辑</el-button
|
>
|
<el-button @click="clickHandle('details', scope)" type="text"
|
>查看</el-button
|
>
|
<el-button @click="clickHandle('delete', scope)" type="text"
|
>删除</el-button
|
>
|
</template>
|
</v-tool-table>
|
</div>
|
<v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
props: {
|
item: { type: Object },
|
level: { type: Number },
|
},
|
mounted() {
|
this.userType = demo.$session.get("user").userType;
|
},
|
data() {
|
return {
|
userType: null,
|
trs: [
|
{ text: "序号", val: "index", width: "50px" },
|
{ text: "项目名称", val: "name" },
|
{ text: "责任方", val: "responsibility" },
|
{ text: "一级分类", val: "columnName" },
|
{ text: "二级分类", val: "secondColumnName" },
|
{ text: "项目状态", val: "btn", slot: "status" },
|
{ text: "创建时间", val: "createTime" },
|
{ text: "操作", val: "btn", slot: "btn", width: "160px" },
|
],
|
trsOne: [
|
{ text: "项目名称", val: "name" },
|
{ text: "责任方", val: "responsibility" },
|
{ text: "一级分类", val: "columnName" },
|
{ text: "二级分类", val: "secondColumnName" },
|
{ text: "项目状态", val: "btn", slot: "status" },
|
{ text: "创建时间", val: "createTime" },
|
// { text: "操作", val: "btn", slot: "btn" },
|
],
|
trsTwo: [
|
{ text: "项目名称", val: "name" },
|
{ text: "责任方", val: "responsibility" },
|
{ text: "一级分类", val: "columnName" },
|
{ text: "二级分类", val: "secondColumnName" },
|
{ text: "项目状态", val: "btn", slot: "status" },
|
{ text: "创建时间", val: "createTime" },
|
// { text: "操作", val: "btn", slot: "btn" },
|
],
|
tds: [],
|
tdsOne: [], //所属一级项目
|
tdsTwo: [], //所属二级项目
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
statusLevel: ["", "初创项目", "公开发布", "运作中", "已结束"],
|
newVal: {},
|
};
|
},
|
watch: {
|
item(val) {
|
this.newVal = val;
|
this.init();
|
},
|
},
|
methods: {
|
// 分页点击
|
onPage(v) {
|
if (v.page === this.paged.page && v.page && !v.reset) {
|
return 0;
|
}
|
this.paged.page = v.page;
|
this.paged.limit = v.limit;
|
this.init();
|
},
|
// 获取数据
|
init() {
|
let v = {
|
page: this.paged.page,
|
size: this.paged.limit,
|
paramId: this.$route.query.id,
|
// paramId:this.newVal.id,
|
level: this.newVal.level + 1, //创建子项目的等级
|
};
|
this.$api.post("comActSocialProject/getRelation", v, (e) => {
|
e.socialProjectVOIPage.records.map((item, index) => {
|
item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
|
});
|
this.paged.total = e.socialProjectVOIPage.total;
|
this.tds = e.socialProjectVOIPage.records || [];
|
this.tdsOne = Array(e.fatherProjectLevelOne);
|
this.tdsTwo = Array(e.fatherProjectLevelTwo);
|
});
|
},
|
//创建子项目
|
addChilren() {
|
let a = this.level + 1;
|
this.$router.push(`/addProject?level=${a}&id=${this.item.id}`);
|
},
|
// 页面操作
|
clickHandle(type, row) {
|
switch (type) {
|
case "edit": {
|
this.$router.push(
|
`/addProject?level=${this.level + 1}&id=${row.id}&isedit=1`
|
);
|
break;
|
}
|
case "details": {
|
this.$emit("detailsSuccess", row.id);
|
this.$router.push("/projectDetails?id=" + row.id);
|
break;
|
}
|
case "delete": {
|
this.$confirm("此操作将删除该数据, 是否继续?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
}).then(() => {
|
this.$api.get("comActSocialProject/del", { id: row.id }, (e) => {
|
demo.toast("删除成功");
|
this.init();
|
});
|
return;
|
});
|
break;
|
}
|
default: {
|
break;
|
}
|
}
|
},
|
},
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.tab {
|
padding-top: 20px;
|
}
|
.two {
|
padding-top: 20px;
|
}
|
</style>
|