南昌市物联网技防平台-前端
zengh
2021-03-22 19dfca44c5e47323fdd2f321b5bba3a1a04c0fb7
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
        <template slot="menuLeft">
          <el-button
            v-bind:class="activeClass == 0 ? 'btn-color' : ''"
            size="medium "
            @click="getHealthcodeData(0)"
            >本日
          </el-button>
          <el-button
            v-bind:class="activeClass == 1 ? 'btn-color' : ''"
            size="medium "
            @click="getHealthcodeData(1)"
            >本周
          </el-button>
          <el-button
            v-bind:class="activeClass == 2 ? 'btn-color' : ''"
            size="medium "
            @click="getHealthcodeData(2)"
            >本月
          </el-button>
        </template>
      
    </avue-crud>
  </basic-container>
</template>
 
<script>
  import {getList} from "@/api/healthcode/healthcode";
  import {mapGetters} from "vuex";
 
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          menu:false,
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          activeClass: 3,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          labelWidth:120,
          dialogClickModal: false,
          headerAlign: 'center',
          align: 'center',
          column: [
            {
              label: '坐标',
              prop: 'test',
              hide: true,
              span: 24,
              component: "avueMap",
              clickChild: (obj) => {
                this.form.jd = obj.latitude
                this.form.wd = obj.longitude
              },
            },
            {
              label: "检测时间",
              prop: "dtime"
            },
            {
              label: '性别',
              prop: 'sex'
            },
            {
              label: "检测时间",
              prop: "dateTime",
              type: "datetime",
              format: "yyyy-MM-dd",
              valueFormat: "yyyy-MM-dd",
              searchRange: true,
              searchSpan: 5,
              hide: true,
              addDisplay: false,
              editDisplay: false,
              viewDisplay: false,
              search: true,
              rules: [
                {
                  required: true,
                  message: "请输入时间",
                  trigger: "blur"
                }
              ]
            },
            {
              label: '省份',
              prop: 'province',
              search: true,
              searchSpan: 3,
              type: 'select',
              props: {
                label: 'name',
                value: 'name'
              },
              cascaderItem: ['city', 'district'],
              dicUrl: '/api/blade-system/region/select',
              span: 6,
            },
            {
              label: '地市',
              prop: 'city',
              type: 'select',
              searchSpan: 3,
              search: true,
              props: {
                label: 'name',
                value: 'name'
              },
              dicUrl: '/api/blade-system/region/select?code={{key}}',
              span: 6,
            },
            {
              label: '区县',
              searchSpan: 3,
              search: true,
              prop: 'district',
              type: 'select',
              props: {
                label: 'name',
                value: 'name'
              },
              dicUrl: '/api/blade-system/region/select?code={{key}}',
              span: 6,
            },
            {
              label: "健康码颜色",
              search: true,
              searchLabelWidth:100,
              prop: "type",
              searchSpan: 3,
              width:210,
              type: "select",
              dicData: [
                {
                  label: "绿色",
                  value: "1"
                },
                {
                  label: "黄色",
                  value: "2"
                },
                {
                  label: "红色",
                  value: "3"
                }
              ],
            }
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(null, false),
          viewBtn: this.vaildData(null, false),
          delBtn: this.vaildData(null, false),
          editBtn: this.vaildData(null, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    methods: {
      beforeOpen(done, type) {
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      getHealthcodeData(e) {
        this.activeClass = e;
        //status 0:本日  1:本月  2:本年   type: 1:绿色   2:黄色  3:红色
        var params = {
          status: e
        };
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        if (this.$route.query.status && this.$route.query != undefined && this.$route.query != null && this.$route.query != "" ) {
            if (this.$route.query.type != undefined && this.$route.query.type != null && this.$route.query.type == "" ) {
              this.activeClass = this.$route.query.status;
              this.page.currentPage = 1;
              params = {
                status:this.$route.query.status,
                type:this.$route.query.type
              }
            } else {
              this.activeClass = 0;
              this.page.currentPage = 1;
              params = {
                type:this.$route.query.status
              };
            }
        }else{
            params = {
                status:this.$route.query.status,
                type:this.$route.query.type
            }
        }
 
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
</script>