1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
| <template>
| <div class="man_val_exam">
| <v-header
| title="设备管理"
| :bar="bar"
| search
| @on-search="onSearch"
| ></v-header>
| <div class="but">
| <el-button @click="add()" size="small" type="primary">新建</el-button>
| <el-button @click="toEarly" size="small" type="primary">异常预警配置</el-button>
| </div>
| <div class="tab mr-t-10">
| <v-tool-table :trs="trs" :tds="tds">
| <template v-slot:btn="item">
| <div class="table_flex">
| <span class="col_primary" @click="onShow(item.scope)">查看</span>
| <span class="col_primary" @click="editRow(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:type="item">
| <span v-if="item.scope.type === 1">一键呼叫器</span>
| <span v-if="item.scope.type === 2">红外报警器</span>
| <span v-if="item.scope.type === 3">社区工作人员</span>
| </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: "type",
| type: "select",
| list: [
| { label: "一键呼叫器", value: 1 },
| { label: "红外报警器", value: 2 },
| { label: "社区工作人员", value: 3 },
| ],
| },
| { title: " 设备名称", name: "name" },
| { title: "唯一标识", name: "serialNo" },
| { title: "所属地址", name: "address" },
| ],
| trs: [
| { text: "编号", val: "id", width: "50px" },
| { text: "设备名称", val: "name" },
| { text: "设备类型", val: "btn", slot: "type" },
| { text: "唯一标识", val: "serialNo" },
| { text: "居民名称", val: "username" },
| { text: "所属地址", val: "position" },
| { text: "操作", val: "btn", width: "150px" },
| ],
| 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(), "alls", "-");
| },
| onShow(v) {
| this.$router.push(`/deviceDetails?id=${v.id}`);
| },
| toEarly(v) {
| this.$router.push(`/earlyWarning`);
| },
| onDel(v) {
| this.$js.model("", "是否删除", (res) => {
| if (res) {
| this.$api.get("comPropertyEquipment/del?id=" + v.id, {}, (e) => {
| demo.toast("删除成功");
| this.init();
| });
| }
| });
| },
| onSearch(v) {
| this.search = demo.copy(v);
| 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, {
| page: this.paged.page,
| size: this.paged.limit,
| paramId: "",
| })
| );
| this.$api.post("comPropertyEquipment/queryAll", v, (e) => {
| this.paged.total = e.total;
| this.paged.r++;
| this.tds = e.records || [];
| });
| },
| add() {
| this.$router.push("/addDevice");
| },
| editRow(row) {
| this.$router.push("/addDevice?id=" + row.id);
| },
| },
| mounted() {},
| };
| </script>
|
|