<template>
|
<div class="box-content">
|
<v-header title="物业宣传管理" search :bar="bar" @on-search="onSearch"></v-header>
|
<div class="add fl-sb" v-if="propertyShen == 1">
|
<div>
|
<el-button type="primary" size="small" @click.stop="clickHandle('add')">新增</el-button>
|
</div>
|
</div>
|
<div class="tab">
|
<el-table :data="tableList" border ref="multipleTable" size="mini">
|
<el-table-column label="序号" align="center" width="50" type="index"></el-table-column>
|
<el-table-column label="物业公司" align="center">
|
<template slot-scope="scope">{{ scope.row.propertyName || "-" }}</template>
|
</el-table-column>
|
<el-table-column label="所属小区" align="center">
|
<template slot-scope="scope">{{ scope.row.villageName || "-" }}</template>
|
</el-table-column>
|
<el-table-column label="宣传标题" align="center">
|
<template slot-scope="scope">{{ scope.row.title || "-" }}</template>
|
</el-table-column>
|
<el-table-column label="宣传类型" align="center">
|
<template slot-scope="scope">
|
<span v-if="scope.row.publicityType != 0">{{ reText(scope.row.publicityType) }}</span>
|
<span v-else>{{ scope.row.other }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="发布时间" align="center">
|
<template slot-scope="scope">{{ reTime(scope.row.createdAt) || "-" }}</template>
|
</el-table-column>
|
<el-table-column label="浏览量" align="center">
|
<template slot-scope="scope">{{ scope.row.viewNum }}</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" fixed="right" width="150">
|
<template slot-scope="scope">
|
<el-button
|
size="small"
|
type="text"
|
style="padding: 0"
|
@click="clickHandle('edit', scope.row)"
|
>编辑</el-button>
|
<el-button
|
@click="clickHandle('delete', scope.row)"
|
size="small"
|
type="text"
|
style="padding: 0"
|
>删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
<v-tool-page :item="paged" @on-page="onPage"></v-tool-page>
|
</div>
|
</template>
|
|
<script>
|
import { mapState } from "vuex";
|
import { propertyType, dateTime } from "../../../utils/common";
|
const propertyData = propertyType();
|
export default {
|
data() {
|
return {
|
dialogVisible: false,
|
dialogTitle: "新增",
|
bar: [],
|
tableList: [],
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
search: {},
|
btnloading: false,
|
communityList: [],
|
propertyList: [],
|
propertyShen: 0
|
};
|
},
|
computed: {
|
...mapState({ vuex_page: "pageReset" }),
|
},
|
watch: {
|
vuex_page: {
|
handler(n) {
|
if (n.page === this.$route.path) {
|
this.paged.page = 1;
|
this.getTable();
|
}
|
},
|
deep: true,
|
},
|
},
|
mounted() {
|
this.propertyShen = demo.$session.get("user").isPropertyWorker;
|
if (this.propertyShen !== 1) {
|
this.bar = [
|
{ title: "宣传标题关键词", name: "keyword" },
|
{
|
title: "物业公司",
|
name: "propertyId",
|
type: "select",
|
list: [
|
{ value: 1, label: "城镇" },
|
{ value: 2, label: "农村" },
|
{ value: 3, label: "未知" },
|
],
|
},
|
{
|
title: "所属小区",
|
name: "villageId",
|
type: "select",
|
list: [],
|
},
|
{
|
title: "宣传类型",
|
name: "publicityType",
|
type: "select",
|
list: propertyData,
|
},
|
]
|
} else {
|
this.bar = [
|
{ title: "宣传标题关键词", name: "keyword" },
|
{
|
title: "宣传类型",
|
name: "publicityType",
|
type: "select",
|
list: propertyData,
|
},
|
]
|
}
|
if (this.propertyShen != 1) {
|
this.$api.get("property/publicity/list/property", {}, (e) => {
|
e.forEach((item) => {
|
item.value = item.id;
|
item.label = item.name;
|
});
|
this.bar[1].list = e;
|
});
|
this.$api.post("villagemanager/pagevillage", {}, (e) => {
|
e = e.data.records;
|
e.forEach((item) => {
|
item.value = item.villageId;
|
item.label = item.address;
|
});
|
this.bar[2].list = e;
|
});
|
}
|
},
|
methods: {
|
reText(type) {
|
let text = '-'
|
propertyData.forEach(item => {
|
if (item.value === type) {
|
text = item.label
|
}
|
})
|
return text;
|
},
|
reTime(t) {
|
return dateTime(t);
|
},
|
onSearch(v) {
|
this.search = demo.copy(v);
|
this.paged.page = 1;
|
this.getTable();
|
},
|
// 分页点击
|
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.getTable();
|
},
|
// 获取数据
|
getTable() {
|
let v = demo.copy(
|
Object.assign(this.search, {
|
pageNum: this.paged.page,
|
pageSize: this.paged.limit,
|
type: 3,
|
})
|
);
|
this.$api.post("property/publicity/page", v, (e) => {
|
this.paged.total = e.total;
|
this.paged.r++;
|
this.tableList = e.records || [];
|
});
|
},
|
clickHandle(type, row) {
|
switch (type) {
|
case "add": {
|
this.$router.push("/addDynamic");
|
break;
|
}
|
case "edit": {
|
this.$router.push("/addDynamic?id=" + row.id);
|
break;
|
}
|
case "delete": {
|
this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
}).then(() => {
|
this.$api.del("property/publicity/delete?id=" + row.id, {}, () => {
|
demo.toast("删除成功");
|
this.getTable();
|
});
|
});
|
break;
|
}
|
default: {
|
break;
|
}
|
}
|
},
|
},
|
};
|
</script>
|
<style>
|
.el-table .cell {
|
font-size: 14px;
|
color: #444;
|
}
|
.el-dialog {
|
width: 800px !important;
|
}
|
</style>
|
<style lang='less' scoped>
|
.box-content {
|
overflow-y: auto;
|
.tab,
|
.add {
|
margin-bottom: 10px;
|
}
|
}
|
.input-width {
|
width: 250px;
|
}
|
.textarea-width {
|
width: 350px;
|
}
|
.uopload-text {
|
width: 100px;
|
height: 100px;
|
border: 1px dashed #999;
|
}
|
.label-text {
|
width: 120px;
|
text-align: right;
|
}
|
.content-text {
|
width: 400px;
|
}
|
.l-15 {
|
line-height: 1.5;
|
}
|
.goods-box {
|
width: 400px;
|
}
|
</style>
|