<template>
|
<div class='man_bui_other'>
|
<v-header
|
title="其他建筑管理"
|
:bar="bar"
|
search
|
@on-search="onSearch"
|
></v-header>
|
<div class="add">
|
<el-button
|
type="primary"
|
size="small"
|
@click.stop="$router.push('/man_bui_other_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"
|
@click="onEdit(item.scope)"
|
>编辑</span>
|
<span
|
class="col_primary"
|
@click="onDel(item.scope)"
|
>删除</span>
|
</div>
|
</template>
|
<template v-slot:time="item">
|
<b>{{is_time(item.scope.createAt)}}</b>
|
</template>
|
<template v-slot:state="item">
|
<b>{{+item.scope.state===1?'建筑中':'使用中'}}</b>
|
</template>
|
<template v-slot:square="item">
|
<b>{{item.scope.square?item.scope.square+'平方米':''}}</b>
|
</template>
|
</v-tool-table>
|
</div>
|
<v-tool-page
|
:item="paged"
|
@on-page="onPage"
|
></v-tool-page>
|
</div>
|
</template>
|
|
<script>
|
import { mapState } from "vuex";
|
export default {
|
props: {},
|
components: {},
|
data() {
|
return {
|
bar: [{ title: "建筑名称", name: "name" }],
|
trs: [
|
{ text: "序号", val: "id", width: "60px" },
|
{ text: "建筑名称", val: "name" },
|
{ text: "建筑类型", val: "buileTypeName" },
|
{ text: "建筑面积", val: "btn", slot: "square" },
|
{ text: "建筑地址", val: "address" },
|
{ text: "建筑状态", val: "btn", slot: "state" },
|
{ text: "楼层类型", val: "layerType" },
|
{ text: "创建时间", val: "btn", slot: "time" },
|
{ text: "操作", val: "btn" },
|
],
|
tds: [],
|
paged: { page: 0, total: 0, r: 0, limit: 10 },
|
os: {},
|
search: {},
|
};
|
},
|
computed: {
|
...mapState({ vuex_page: "pageReset" }),
|
},
|
watch: {
|
vuex_page: {
|
handler(n) {
|
if (n.page === this.$route.path) {
|
this.init();
|
}
|
},
|
deep: true,
|
},
|
},
|
methods: {
|
is_time(v) {
|
return demo.timeout(new Date(v).getTime(), "all", "-");
|
},
|
onEdit(v) {
|
this.$router.push(this.$nav.url("/man_bui_other_edit/" + v.id));
|
},
|
onDel(v) {
|
this.$js.model("", "是否删除", (res) => {
|
if (res) {
|
this.$api.del("communitymanager/otherbuild?id="+v.id, '', () => {
|
demo.toast("删除成功");
|
this.init();
|
});
|
}
|
});
|
},
|
onSearch(v) {
|
// if (v.time && v.time.length && v.time[1]) {
|
// v.createBegin = v.time[0];
|
// v.createEnd = v.time[1];
|
// }
|
this.search = demo.copy(v);
|
// delete this.search.time;
|
this.paged.page = 1;
|
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();
|
},
|
// 获取数据
|
init() {
|
let v = demo.copy(
|
Object.assign(this.os, this.search, {
|
pageNum: this.paged.page,
|
pageSize: this.paged.limit,
|
})
|
);
|
this.$api.post("communitymanager/pageotherbuild", v, (e) => {
|
this.paged.total = e.total;
|
this.paged.r++;
|
this.tds = e.records || [];
|
});
|
},
|
},
|
mounted() {},
|
};
|
</script>
|
<style lang='less' scoped>
|
.man_bui_other {
|
overflow-y: auto;
|
.add,
|
.tab {
|
margin-bottom: 10px;
|
}
|
}
|
</style>
|