<template>
|
<div class="page_dynamic">
|
<v-header
|
title="组织社区共建"
|
search
|
:bar="bar"
|
@on-search="onSearch"
|
></v-header>
|
<div class="add">
|
<el-button v-if="isZuZhibuUser" type="primary" size="small" @click="add"
|
>新增项目</el-button
|
>
|
</div>
|
<div class="tab">
|
<v-tool-table :trs="trs" :tds="tds">
|
<template v-slot:btn="item">
|
<div class="table_flex">
|
<!-- {{item.scope.id}} -->
|
<span
|
class="col_primary"
|
v-if="item.scope.status == 2 && isZuZhibuUser"
|
@click="detail(item.scope)"
|
>更新进度</span
|
>
|
<span
|
class="col_primary"
|
v-if="item.scope.status == 1 && isZuZhibuUser"
|
@click="edit(item.scope)"
|
>编辑</span
|
>
|
<span
|
v-if="isZuZhibuUser"
|
class="col_primary"
|
@click="del(item.scope)"
|
>删除</span
|
>
|
</div>
|
</template>
|
<template v-slot:time="item">
|
<b>{{ time(item.scope.createAt) }}</b>
|
</template>
|
<template v-slot:status="item">
|
<b>{{ ["已发布", "进行中", "已完成"][item.scope.status * 1 - 1] }}</b>
|
</template>
|
</v-tool-table>
|
</div>
|
<v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
|
|
<el-dialog
|
:title="'更新进度'"
|
:modal="false"
|
destroy-on-close
|
:close-on-click-modal="false"
|
:visible.sync="centerDialogVisible"
|
width="800px"
|
center
|
>
|
<div class="dialog-box">
|
<div class="list" v-for="(item, index) in planList">
|
<div class="titleView flex-sb">
|
<div class="flex-start">
|
<div class="title">{{ item.agreementPlan }}</div>
|
<div class="title">完工节点 {{ item.completionTime }}</div>
|
</div>
|
<!-- accomplish -->
|
<el-button v-if="item.accomplish == 1" type="info">
|
已完成
|
</el-button>
|
<el-button v-else type="primary" @click="confirm(item)">
|
确认完成
|
</el-button>
|
</div>
|
<div class="content">
|
{{ item.planContent }}
|
</div>
|
</div>
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="centerDialogVisible = false">取 消</el-button>
|
<el-button type="primary" @click="centerDialogVisible = false"
|
>确 定</el-button
|
>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { mapState } from "vuex";
|
export default {
|
props: {},
|
components: {},
|
data() {
|
return {
|
bar: [
|
{ title: "关键词", name: "itemTitle" },
|
{
|
title: "项目状态",
|
name: "status",
|
type: "select",
|
list: [
|
{ value: "1", label: "已发布" },
|
{ value: "2", label: "进行中" },
|
{ value: "3", label: "已完成" }
|
]
|
},
|
{
|
title: "共建社区",
|
name: "communityId",
|
type: "cascaders",
|
list: [],
|
props: {
|
checkStrictly: false,
|
children: "children",
|
label: "value",
|
value: "communityId"
|
}
|
},
|
{
|
title: "创建时间",
|
name: "time",
|
type: "times",
|
types: "datetimerange"
|
}
|
],
|
trs: [
|
{ text: "序号", val: "id", width: "80px" },
|
{ text: "共建标题", val: "itemTitle" },
|
{ text: "共建社区", val: "communityName" },
|
{ text: "项目状态", val: "btn", slot: "status" },
|
{ text: "创建时间", val: "creationTime" },
|
{ text: "操作", val: "btn" }
|
],
|
tds: [],
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
search: {},
|
list: [{}, {}, {}, {}],
|
os: {
|
communityId: 0,
|
content: "",
|
cover: "",
|
createAt: "",
|
createBy: 0,
|
createByName: "",
|
id: 0,
|
pageNum: 0,
|
pageSize: 0,
|
publishAt: "",
|
publishAtBegin: "",
|
publishAtEnd: "",
|
readingVolume: 0,
|
status: 0,
|
title: "",
|
type: 0
|
},
|
centerDialogVisible: false,
|
planList: [],
|
projectId: "",
|
isZuZhibuUser: false
|
};
|
},
|
watch: {
|
vuex_page: {
|
handler(n) {
|
if (n.page === this.$route.path) {
|
this.paged.page = 1;
|
this.init();
|
}
|
},
|
deep: true
|
}
|
},
|
computed: {
|
...mapState({ vuex_page: "pageReset" })
|
},
|
methods: {
|
// 时间转化
|
time(v) {
|
if (!v) return "";
|
return demo.timeout(new Date(v).getTime(), "alls", "-");
|
},
|
// 查看
|
detail(v) {
|
this.centerDialogVisible = true;
|
this.projectId = v.id;
|
// StriveFor/getProjectPlanList
|
this.getPlanList();
|
},
|
getPlanList() {
|
this.$api.get(
|
"StriveFor/getProjectPlanList",
|
{ projectId: this.projectId, pageNum: 1, pageSize: 100 },
|
res => {
|
this.planList = res.records;
|
}
|
);
|
},
|
confirm(item) {
|
this.$js.model("提示", "确认完成?", res => {
|
if (res) {
|
this.$api.get(
|
"StriveFor/editProjectPlanAccomplish",
|
{ id: item.id },
|
() => {
|
this.getPlanList();
|
this.init();
|
}
|
);
|
}
|
});
|
},
|
// 编辑
|
edit(v) {
|
this.$router.push(this.$nav.url("/orgCommunityBuild_edit/" + v.id));
|
},
|
// 获取区域列表
|
getAreaRequestList() {
|
this.$api.get("comAreaTownCommunity/areaTownCommunityNew", {}, res => {
|
this.bar[2].list = res;
|
});
|
},
|
// 删除
|
del(v) {
|
this.$js.model("删除", "是否删除?", res => {
|
if (res) {
|
this.$api.del(
|
"StriveFor/expurgateNewFightCommunityData?id=" + v.id,
|
{},
|
() => {
|
demo.toast("删除成功");
|
this.init();
|
}
|
);
|
}
|
});
|
},
|
// 分页点击
|
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();
|
},
|
// 搜索
|
onSearch(v) {
|
this.search = demo.copy(v);
|
if (v.time && v.time.length) {
|
this.search.publishAtBegin = v.time[0];
|
this.search.publishAtEnd = v.time[1];
|
} else {
|
this.search.publishAtBegin = "";
|
this.search.publishAtEnd = "";
|
}
|
delete this.search.time;
|
this.paged.page = 1;
|
this.init();
|
},
|
// 新增
|
add() {
|
this.$router.push(this.$nav.url("/orgCommunityBuild_add"));
|
},
|
init() {
|
let v = demo.copy(Object.assign(this.search));
|
v.pageNum = this.paged.page;
|
v.pageSize = this.paged.limit;
|
let user = demo.$session.get("user");
|
if (user.communityId * 1 > 0) {
|
v.communityId = user.communityId;
|
}
|
this.$api.get("StriveFor/getNewFightCommunityList", v, e => {
|
this.paged.total = e.total;
|
this.paged.r++;
|
this.tds = e.records || [{}];
|
});
|
}
|
},
|
mounted() {
|
this.getAreaRequestList();
|
},
|
created() {
|
this.isZuZhibuUser = demo.$session.get("user").account == "zuzhibu";
|
}
|
};
|
</script>
|
<style lang="less" scoped>
|
.page_dynamic {
|
overflow-y: auto;
|
.tab,
|
.add {
|
margin-bottom: 10px;
|
}
|
.dialog-box {
|
.list {
|
padding: 15px;
|
border-bottom: 1px solid #eee;
|
.titleView {
|
height: 40px;
|
line-height: 40px;
|
|
.title {
|
font-size: 18px;
|
font-weight: 500;
|
min-width: 150px;
|
}
|
}
|
.content {
|
margin-top: 10px;
|
font-size: 14px;
|
color: #666;
|
}
|
}
|
}
|
}
|
|
.flex-start {
|
display: flex;
|
justify-content: flex-start;
|
align-items: center;
|
}
|
|
.flex-sb {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
</style>
|