<template>
|
<div class="page_status">
|
<v-header
|
title="设备列表"
|
:bar="bar"
|
search
|
@on-search="onSearch"
|
></v-header>
|
<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="onCheck(item.scope.id)"
|
>查看</span
|
>
|
</div>
|
</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: "设备ID", name: "title" },
|
{ title: "用户姓名", name: "time" }
|
],
|
trs: [
|
{ text: "序号", val: "index", width: "50px" },
|
{ text: "绑定日期", val: "name" },
|
{ text: "设备编号", val: "age" },
|
{ text: "设备状态", val: "sex" },
|
{ text: "设备电量", val: "btn", slot: "status" },
|
{ text: "绑定用户", val: "btn", slot: "zd" }
|
],
|
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.paged.page = 1;
|
this.init();
|
}
|
},
|
deep: true
|
}
|
},
|
methods: {
|
// 置顶
|
onSearch(v) {
|
if (v.time && v.time.length && v.time[1]) {
|
v.publishAtBegin = v.time[0];
|
v.publishAtEnd = v.time[1];
|
} else {
|
v.publishAtBegin = "";
|
v.publishAtEnd = "";
|
}
|
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,
|
category: "10" // 1.社区动态 3.基务公开
|
})
|
);
|
this.$api.post("communityactivity/pagedynamic", v, e => {
|
this.paged.total = e.total;
|
this.paged.r++;
|
this.tds = e.records || [];
|
e.records.map((item, index) => {
|
item.index = (this.paged.page - 1) * this.paged.limit + index + 1;
|
});
|
});
|
},
|
onCheck(id) {
|
this.$router.push({
|
path: "/jh_OldManWristband_Detail",
|
query: { id: "10", type: id }
|
});
|
}
|
},
|
mounted() {
|
//查询动态分类列表
|
// this.queryDynamic();
|
}
|
};
|
</script>
|
|
<style lang="less" scoped>
|
.page_status {
|
overflow-y: auto;
|
.add,
|
.tab {
|
margin-bottom: 10px;
|
}
|
}
|
</style>
|