weiximei 6 years ago
parent
commit
ec0b08c88c

+ 50
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/RoleController.java View File

@@ -0,0 +1,50 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.common.base.BaseController;
7
+import com.community.huiju.service.RoleServiceI;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.cloud.context.config.annotation.RefreshScope;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestMethod;
16
+import org.springframework.web.bind.annotation.RequestParam;
17
+import org.springframework.web.bind.annotation.RestController;
18
+
19
+import javax.servlet.http.HttpSession;
20
+
21
+/**
22
+ * @author FXF
23
+ * @date 2019-01-16
24
+ */
25
+@RestController
26
+@RefreshScope
27
+@RequestMapping("/")
28
+@Api(value = "物业端角色API", description = "物业端角色API")
29
+public class RoleController extends BaseController {
30
+	
31
+	@Autowired
32
+	private RoleServiceI roleService;
33
+	
34
+	@ApiOperation(value = "根据搜索条件获取二手租赁列表", notes = "根据搜索条件获取二手租赁列表")
35
+	@ApiImplicitParams({
36
+			@ApiImplicitParam(paramType = "query", dataType = "String", name = "roleName", value = "帖子标题(模糊查询)"),
37
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
38
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
39
+	})
40
+	@RequestMapping(value = "/roles",method = RequestMethod.GET)
41
+	public ResponseBean getInfo(@RequestParam(value = "roleName", required = false) String roleName,
42
+	                            @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
43
+	                            @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
44
+	                            HttpSession session) {
45
+		ResponseBean responseBean = new ResponseBean();
46
+		UserElement userElement = getUserElement(session);
47
+		responseBean = roleService.getRoleList(roleName,userElement,pageNum,pageSize);
48
+		return responseBean;
49
+	}
50
+}

+ 19
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/RoleMapper.java View File

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.community.huiju.model.SysRole;
5
+import com.community.huiju.model.User;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+/**
10
+ * <p>
11
+ * 物业web端用户表 Mapper 接口
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2018-12-18
16
+ */
17
+@Mapper
18
+public interface RoleMapper extends BaseMapper<SysRole> {
19
+}

+ 63
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/SysRole.java View File

@@ -0,0 +1,63 @@
1
+package com.community.huiju.model;
2
+
3
+import com.baomidou.mybatisplus.annotation.TableName;
4
+import lombok.Data;
5
+import lombok.EqualsAndHashCode;
6
+import lombok.experimental.Accessors;
7
+
8
+import java.io.Serializable;
9
+import java.time.LocalDateTime;
10
+
11
+/**
12
+ * <p>
13
+ * 物业web端角色表
14
+ * </p>
15
+ *
16
+ * @author jobob
17
+ * @since 2019-01-17
18
+ */
19
+@Data
20
+@EqualsAndHashCode(callSuper = false)
21
+@Accessors(chain = true)
22
+@TableName("tp_sys_role")
23
+public class SysRole implements Serializable {
24
+
25
+    private static final long serialVersionUID = 1L;
26
+
27
+    /**
28
+     * 小区id
29
+     */
30
+    private Integer communityId;
31
+
32
+    /**
33
+     * 角色名称
34
+     */
35
+    private String roleName;
36
+
37
+    /**
38
+     * 描述
39
+     */
40
+    private String description;
41
+
42
+    /**
43
+     * 创建人
44
+     */
45
+    private Integer createUser;
46
+
47
+    /**
48
+     * 创建时间
49
+     */
50
+    private LocalDateTime createDate;
51
+
52
+    /**
53
+     * 更新人
54
+     */
55
+    private Integer updateUser;
56
+
57
+    /**
58
+     * 更新时间
59
+     */
60
+    private LocalDateTime updateDate;
61
+
62
+
63
+}

+ 19
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/RoleServiceI.java View File

@@ -0,0 +1,19 @@
1
+package com.community.huiju.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.SysRole;
7
+
8
+public interface RoleServiceI extends IService<SysRole> {
9
+	
10
+	/**
11
+	 * 获取角色列表
12
+	 * @param roleName
13
+	 * @param userElement
14
+	 * @param pageNum
15
+	 * @param pageSize
16
+	 * @return
17
+	 */
18
+	ResponseBean getRoleList(String roleName, UserElement userElement, Integer pageNum, Integer pageSize);
19
+}

+ 54
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/RoleServiceImpl.java View File

@@ -0,0 +1,54 @@
1
+package com.community.huiju.service.impl;
2
+
3
+
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.community.commom.mode.ResponseBean;
7
+import com.community.commom.session.UserElement;
8
+import com.community.huiju.dao.RoleMapper;
9
+import com.community.huiju.model.SysRole;
10
+import com.community.huiju.model.TpTransaction;
11
+import com.community.huiju.service.RoleServiceI;
12
+import com.google.common.collect.Maps;
13
+import lombok.extern.slf4j.Slf4j;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.stereotype.Service;
16
+
17
+import java.util.List;
18
+import java.util.Map;
19
+
20
+/**
21
+ * @author FXF
22
+ * @date 2019-01-16
23
+ */
24
+@Service("roleService")
25
+@Slf4j
26
+public class RoleServiceImpl extends ServiceImpl<RoleMapper, SysRole> implements RoleServiceI {
27
+	
28
+	@Autowired
29
+	private RoleMapper roleMapper;
30
+	/**
31
+	 * 获取角色列表
32
+	 *
33
+	 * @param roleName
34
+	 * @param userElement
35
+	 * @param pageNum
36
+	 * @param pageSize
37
+	 * @return
38
+	 */
39
+	@Override
40
+	public ResponseBean getRoleList(String roleName, UserElement userElement, Integer pageNum, Integer pageSize) {
41
+		ResponseBean responseBean = new ResponseBean();
42
+		Page page = new Page(pageNum,pageSize);
43
+		// 分页查询
44
+		SysRole role = new SysRole();
45
+		role.setRoleName(roleName);
46
+		role.setCommunityId(userElement.getCommunityId());
47
+		List<TpTransaction> list = roleMapper.getRoleListByParams(page,role);
48
+		Map<String, Object> map = Maps.newHashMap();
49
+		map.put("list",list);
50
+		map.put("total",page.getTotal());
51
+		responseBean.addSuccess(map);
52
+		return null;
53
+	}
54
+}

+ 5
- 0
CODE/smart-community/property-api/src/main/resources/mapper/SysRoleMapper.xml View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.community.huiju.tp.mapper.SysRoleMapper">
4
+
5
+</mapper>

+ 9
- 0
VUECODE/smart-property-manage/src/api/role.js View File

@@ -0,0 +1,9 @@
1
+import request from '@/utils/request'
2
+
3
+export function fetchList(query) {
4
+  return request({
5
+    url: '/roles',
6
+    method: 'get',
7
+    params: query
8
+  })
9
+}

+ 21
- 0
VUECODE/smart-property-manage/src/router/index.js View File

@@ -174,6 +174,27 @@ export const constantRouterMap = [
174 174
       }
175 175
     ]
176 176
   },
177
+  {
178
+    path: '/account',
179
+    component: Layout,
180
+    redirect: '/account/index',
181
+    alwaysShow: true,
182
+    meta: { title: '账号管理', icon: 'zip' },
183
+    children: [
184
+      {
185
+        path: '/account/user',
186
+        component: () => import('@/views/account/user'),
187
+        name: 'user-index',
188
+        meta: { title: '员工管理', icon: 'table' }
189
+      },
190
+      {
191
+        path: '/account/role',
192
+        component: () => import('@/views/account/role'),
193
+        name: 'role-index',
194
+        meta: { title: '角色管理', icon: 'table' }
195
+      }
196
+    ]
197
+  },
177 198
 
178 199
   { path: '*', redirect: '/404', hidden: true }
179 200
 ]

+ 3
- 1
VUECODE/smart-property-manage/src/store/index.js View File

@@ -11,6 +11,7 @@ import getters from './getters'
11 11
 import announcement from './modules/announcement'
12 12
 import buildingOwnerInfo from './modules/buildingOwnerInfo'
13 13
 import activity from './modules/activity'
14
+import role from './modules/role'
14 15
 
15 16
 Vue.use(Vuex)
16 17
 
@@ -25,7 +26,8 @@ const store = new Vuex.Store({
25 26
     buildingOwnerInfo,
26 27
     announcement,
27 28
     activity,
28
-    transaction
29
+    transaction,
30
+    role
29 31
   },
30 32
   getters
31 33
 })

+ 36
- 0
VUECODE/smart-property-manage/src/store/modules/role.js View File

@@ -0,0 +1,36 @@
1
+import { fetchList } from '@/api/role'
2
+
3
+const transaction = {
4
+  namespaced: true,
5
+  state: {
6
+    total: '',
7
+    roleList: []
8
+  },
9
+
10
+  mutations: {
11
+    SET_LIST: (state, list) => {
12
+      state.transactionList = list
13
+    },
14
+    SET_TOTAL: (state, total) => {
15
+      state.total = total
16
+    }
17
+  },
18
+
19
+  actions: {
20
+    // fetchList,获取社区列表
21
+    FetchRoleList({ commit }, listQuery) {
22
+      return new Promise((resolve, reject) => {
23
+        fetchList(listQuery).then(response => {
24
+          const data = response.data
25
+          commit('SET_LIST', data.list)
26
+          commit('SET_TOTAL', data.total)
27
+          resolve()
28
+        }).catch(error => {
29
+          reject(error)
30
+        })
31
+      })
32
+    }
33
+  }
34
+}
35
+
36
+export default transaction

+ 242
- 0
VUECODE/smart-property-manage/src/views/account/role.vue View File

@@ -0,0 +1,242 @@
1
+<template>
2
+  <div class="app-container">
3
+    <div class="filter-container">
4
+      <el-input v-model="listQuery.roleName" placeholder="角色名称" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
5
+      <el-button v-waves class="filter-item" type="info" @click="clearListQuery">清空</el-button>
6
+      <el-button v-waves class="filter-item" type="primary" @click="handleFilter">查询</el-button>
7
+    </div>
8
+    <div style="margin-top: 20px;">
9
+      <el-button type="primary" @click="addActivity">添加</el-button>
10
+      <el-button type="warning" @click="ediActivity">修改</el-button>
11
+      <el-button type="danger" @click="invalidActivity">作废</el-button>
12
+    </div>
13
+    
14
+    <el-table
15
+      v-loading="listLoading"
16
+      :key="tableKey"
17
+      :data="roleList"
18
+      border
19
+      fit
20
+      highlight-current-row
21
+      style="width: 100%; margin-top: 20px;"
22
+      @sort-change="sortChange">
23
+      <el-table-column type="selection" width="55" align="center"/>
24
+      <el-table-column label="角色名称" align="center">
25
+        <template slot-scope="scope">
26
+          <span @click="handleLook(scope.row.id)" style="color: #409EFF;cursor: pointer">{{ scope.row.transactionTitle }}</span>
27
+        </template>
28
+      </el-table-column>
29
+      <el-table-column label="角色描述" align="center">
30
+        <template slot-scope="scope">
31
+          <span>{{ scope.row.viewCount }}</span>
32
+        </template>
33
+      </el-table-column>
34
+      <el-table-column label="创建人" align="center">
35
+        <template slot-scope="scope">
36
+          <span>{{ scope.row.userName }}</span>
37
+        </template>
38
+      </el-table-column>
39
+      <el-table-column label="创建时间" align="center">
40
+        <template slot-scope="scope">
41
+          <span>{{ formatDate(scope.row.createDate) }}</span>
42
+        </template>
43
+      </el-table-column>
44
+      <el-table-column label="修改人" align="center">
45
+        <template slot-scope="scope">
46
+          <span>{{ scope.row.userName }}</span>
47
+        </template>
48
+      </el-table-column>
49
+      <el-table-column label="修改时间" align="center">
50
+        <template slot-scope="scope">
51
+          <span>{{ formatDate(scope.row.createDate) }}</span>
52
+        </template>
53
+      </el-table-column>
54
+    </el-table>
55
+
56
+    <!-- <pagination v-show="total>0" :total="total" :current-page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 20, 30]" @pagination="getList" /> -->
57
+    <el-pagination
58
+      :total="total"
59
+      :current-page="listQuery.pageNum"
60
+      :page-sizes="[5, 10, 20, 30]"
61
+      :page-size="listQuery.pageSize"
62
+      layout="total, sizes, prev, pager, next, jumper"
63
+      @size-change="handleSizeChange"
64
+      @current-change="handleCurrentChange"/>
65
+
66
+  </div>
67
+</template>
68
+
69
+<script>
70
+import { mapState, mapActions, mapMutations } from 'vuex'
71
+import waves from '@/directive/waves' // Waves directive
72
+import { parseTime } from '@/utils'
73
+
74
+export default {
75
+  computed: {
76
+    ...mapState('transaction', {
77
+      transactionList: s => s.transactionList,
78
+      total: s => s.total
79
+    })
80
+  },
81
+  directives: { waves },
82
+  data() {
83
+    var _self = this
84
+    return {
85
+      events: {
86
+        click: (e) => {
87
+          // _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
88
+          _self.detail.longitude = e.lnglat.lng
89
+          _self.detail.latitude = e.lnglat.lat
90
+        }
91
+      },
92
+      markers: [],
93
+      searchOption: {
94
+        city: '南京',
95
+        citylimit: false
96
+      },
97
+      listLoading: true,
98
+      listQuery: {
99
+        pageNum: 1,
100
+        pageSize: 20,
101
+        roleName: undefined
102
+      },
103
+      tableKey: 0,
104
+      downloadLoading: false
105
+    }
106
+  },
107
+  created() {
108
+    this.getList()
109
+  },
110
+  methods: {
111
+    ...mapMutations('role', {
112
+    }),
113
+    ...mapActions('role', [
114
+      'FetchRoleList'
115
+    ]),
116
+    setCurrent(item) {
117
+      this.setDetail({ ...item })
118
+    },
119
+    getList() {
120
+      this.listLoading = true
121
+      this.FetchRoleList(this.listQuery).then(() => {
122
+        this.listLoading = false
123
+      }).catch(() => {
124
+        this.loading = false
125
+        console.log('get list error')
126
+      })
127
+    },
128
+    clearListQuery() {
129
+      this.listQuery.pageNum = 1
130
+      this.listQuery.pageSize = 20
131
+      this.listQuery.transactionId = undefined
132
+      this.listQuery.transactionTitle = undefined
133
+      this.listQuery.status = undefined
134
+      this.listQuery.isReported = undefined
135
+      this.getList()
136
+    },
137
+    handleFilter() {
138
+      this.listQuery.pageNum = 1
139
+      this.getList()
140
+    },
141
+    handleModifyStatus(row, status) {
142
+      this.$message({
143
+        message: '操作成功',
144
+        type: 'success'
145
+      })
146
+      row.status = status
147
+    },
148
+    sortChange(data) {
149
+      const { prop, order } = data
150
+      if (prop === 'id') {
151
+        this.sortByID(order)
152
+      }
153
+    },
154
+    handleSizeChange(val) {
155
+      // console.log(`每页 ${val} 条`);
156
+      this.listQuery.pageSize = val
157
+      this.getList()
158
+    },
159
+    handleCurrentChange(val) {
160
+      // console.log(`当前页: ${val}`);
161
+      this.listQuery.pageNum = val
162
+      this.getList()
163
+    },
164
+    sortByID(order) {
165
+      if (order === 'ascending') {
166
+        this.listQuery.sort = '+id'
167
+      } else {
168
+        this.listQuery.sort = '-id'
169
+      }
170
+      this.handleFilter()
171
+    },
172
+    handleUpdate(row) {
173
+      this.setCurrent(row)
174
+      this.dialogStatus = 'update'
175
+      this.dialogFormVisible = true
176
+      this.$nextTick(() => {
177
+        this.$refs['dataForm'].clearValidate()
178
+      })
179
+      this.getEditCityList()
180
+      this.getEditDistrictList()
181
+    },
182
+    handleLook(id) {
183
+      this.$router.push({ name: 'transaction-info', params: { id: id }})
184
+    },
185
+    handleCreate() {
186
+      this.resetDetail()
187
+      this.dialogStatus = 'create'
188
+      this.dialogFormVisible = true
189
+      this.$nextTick(() => {
190
+        this.$refs['dataForm'].clearValidate()
191
+      })
192
+    },
193
+    handleDelete(row) {
194
+      this.$notify({
195
+        title: '成功',
196
+        message: '删除成功',
197
+        type: 'success',
198
+        duration: 2000
199
+      })
200
+      const index = this.list.indexOf(row)
201
+      this.list.splice(index, 1)
202
+    },
203
+    handleDownload() {
204
+      this.downloadLoading = true
205
+      import('@/vendor/Export2Excel').then(excel => {
206
+        const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
207
+        const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
208
+        const data = this.formatJson(filterVal, this.list)
209
+        excel.export_json_to_excel({
210
+          header: tHeader,
211
+          data,
212
+          filename: 'table-list'
213
+        })
214
+        this.downloadLoading = false
215
+      })
216
+    },
217
+    padDate(value) {
218
+      value = value < 10 ? '0' + value : value
219
+      return value
220
+    },
221
+    formatDate(val) {
222
+      var value = new Date(val)
223
+      var year = value.getFullYear()
224
+      var month = this.padDate(value.getMonth() + 1)
225
+      var day = this.padDate(value.getDate())
226
+      var hour = this.padDate(value.getHours())
227
+      var minutes = this.padDate(value.getMinutes())
228
+      var seconds = this.padDate(value.getSeconds())
229
+      return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
230
+    },
231
+    formatJson(filterVal, jsonData) {
232
+      return jsonData.map(v => filterVal.map(j => {
233
+        if (j === 'timestamp') {
234
+          return parseTime(v[j])
235
+        } else {
236
+          return v[j]
237
+        }
238
+      }))
239
+    },
240
+  }
241
+}
242
+</script>

+ 262
- 0
VUECODE/smart-property-manage/src/views/account/user.vue View File

@@ -0,0 +1,262 @@
1
+<template>
2
+  <div class="app-container">
3
+    <span>这个是用户相关的页面</span>
4
+    <div class="filter-container">
5
+      <el-input v-model="listQuery.transactionId" placeholder="帖子编号" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
6
+      <el-input v-model="listQuery.transactionTitle" placeholder="帖子标题" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
7
+      <el-select v-model="listQuery.status" placeholder="发布状态" style="width: 130px" class="filter-item">
8
+        <el-option label="已发布" value="1"/>
9
+        <el-option label="已作废" value="0"/>
10
+      </el-select>
11
+      <el-select v-model="listQuery.isReported" placeholder="是否被举报" class="filter-item" style="width: 130px">
12
+        <el-option label="无举报" value="0"/>
13
+        <el-option label="被举报" value="1"/>
14
+      </el-select>
15
+      <el-button v-waves class="filter-item" type="info" @click="clearListQuery">清空</el-button>
16
+      <el-button v-waves class="filter-item" type="primary" @click="handleFilter">查询</el-button>
17
+    </div>
18
+
19
+    <el-table
20
+      v-loading="listLoading"
21
+      :key="tableKey"
22
+      :data="transactionList"
23
+      border
24
+      fit
25
+      highlight-current-row
26
+      style="width: 100%; margin-top: 20px;"
27
+      @sort-change="sortChange">
28
+      <el-table-column label="编号" align="center">
29
+        <template slot-scope="scope">
30
+          <span>{{ scope.row.id }}</span>
31
+        </template>
32
+      </el-table-column>
33
+      <el-table-column label="类型" align="center">
34
+        <template slot-scope="scope">
35
+          <span v-if="scope.row.type === '0'">二手</span>
36
+          <span v-if="scope.row.type === '1'">求购</span>
37
+          <span v-if="scope.row.type === '2'">租赁</span>
38
+        </template>
39
+      </el-table-column>
40
+      <el-table-column label="标题" align="center">
41
+        <template slot-scope="scope">
42
+          <span @click="handleLook(scope.row.id)" style="color: #409EFF;cursor: pointer">{{ scope.row.transactionTitle }}</span>
43
+        </template>
44
+      </el-table-column>
45
+      <el-table-column label="查看人数" align="center">
46
+        <template slot-scope="scope">
47
+          <span>{{ scope.row.viewCount }}</span>
48
+        </template>
49
+      </el-table-column>
50
+      <el-table-column label="发布人" align="center">
51
+        <template slot-scope="scope">
52
+          <span>{{ scope.row.userName }}</span>
53
+        </template>
54
+      </el-table-column>
55
+      <el-table-column label="发布时间" align="center">
56
+        <template slot-scope="scope">
57
+          <span>{{ formatDate(scope.row.createDate) }}</span>
58
+        </template>
59
+      </el-table-column>
60
+      <el-table-column label="发布状态" align="center">
61
+        <template slot-scope="scope">
62
+          <span v-if="scope.row.status === '0'">已作废</span>
63
+          <span v-if="scope.row.status === '1'">已发布</span>
64
+        </template>
65
+      </el-table-column>
66
+      <el-table-column label="举报状态" align="center">
67
+        <template slot-scope="scope">
68
+          <span>{{ scope.row.isReported === '1' ? "被举报" : "无举报" }}</span>
69
+        </template>
70
+      </el-table-column>
71
+    </el-table>
72
+
73
+    <!-- <pagination v-show="total>0" :total="total" :current-page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" :page-sizes="[5, 10, 20, 30]" @pagination="getList" /> -->
74
+    <el-pagination
75
+      :total="total"
76
+      :current-page="listQuery.pageNum"
77
+      :page-sizes="[5, 10, 20, 30]"
78
+      :page-size="listQuery.pageSize"
79
+      layout="total, sizes, prev, pager, next, jumper"
80
+      @size-change="handleSizeChange"
81
+      @current-change="handleCurrentChange"/>
82
+
83
+  </div>
84
+</template>
85
+
86
+<script>
87
+import { mapState, mapActions, mapMutations } from 'vuex'
88
+import waves from '@/directive/waves' // Waves directive
89
+import { parseTime } from '@/utils'
90
+
91
+export default {
92
+  computed: {
93
+    ...mapState('transaction', {
94
+      transactionList: s => s.transactionList,
95
+      total: s => s.total
96
+    })
97
+  },
98
+  directives: { waves },
99
+  data() {
100
+    var _self = this
101
+    return {
102
+      events: {
103
+        click: (e) => {
104
+          // _self.postData.Coordinate = e.lnglat.lat + ',' + e.lnglat.lng
105
+          _self.detail.longitude = e.lnglat.lng
106
+          _self.detail.latitude = e.lnglat.lat
107
+        }
108
+      },
109
+      markers: [],
110
+      searchOption: {
111
+        city: '南京',
112
+        citylimit: false
113
+      },
114
+      listLoading: true,
115
+      listQuery: {
116
+        pageNum: 1,
117
+        pageSize: 20,
118
+        transactionId: undefined,
119
+        transactionTitle: undefined,
120
+        status: undefined,
121
+        isReported: undefined
122
+      },
123
+      tableKey: 0,
124
+      downloadLoading: false
125
+    }
126
+  },
127
+  created() {
128
+    this.getList()
129
+  },
130
+  methods: {
131
+    ...mapMutations('transaction', {
132
+    }),
133
+    ...mapActions('transaction', [
134
+      'FetchTransactionList'
135
+    ]),
136
+    setCurrent(item) {
137
+      this.setDetail({ ...item })
138
+    },
139
+    getList() {
140
+      this.listLoading = true
141
+      this.FetchTransactionList(this.listQuery).then(() => {
142
+        this.listLoading = false
143
+      }).catch(() => {
144
+        this.loading = false
145
+        console.log('get list error')
146
+      })
147
+    },
148
+    clearListQuery() {
149
+      this.listQuery.pageNum = 1
150
+      this.listQuery.pageSize = 20
151
+      this.listQuery.transactionId = undefined
152
+      this.listQuery.transactionTitle = undefined
153
+      this.listQuery.status = undefined
154
+      this.listQuery.isReported = undefined
155
+      this.getList()
156
+    },
157
+    handleFilter() {
158
+      this.listQuery.pageNum = 1
159
+      this.getList()
160
+    },
161
+    handleModifyStatus(row, status) {
162
+      this.$message({
163
+        message: '操作成功',
164
+        type: 'success'
165
+      })
166
+      row.status = status
167
+    },
168
+    sortChange(data) {
169
+      const { prop, order } = data
170
+      if (prop === 'id') {
171
+        this.sortByID(order)
172
+      }
173
+    },
174
+    handleSizeChange(val) {
175
+      // console.log(`每页 ${val} 条`);
176
+      this.listQuery.pageSize = val
177
+      this.getList()
178
+    },
179
+    handleCurrentChange(val) {
180
+      // console.log(`当前页: ${val}`);
181
+      this.listQuery.pageNum = val
182
+      this.getList()
183
+    },
184
+    sortByID(order) {
185
+      if (order === 'ascending') {
186
+        this.listQuery.sort = '+id'
187
+      } else {
188
+        this.listQuery.sort = '-id'
189
+      }
190
+      this.handleFilter()
191
+    },
192
+    handleUpdate(row) {
193
+      this.setCurrent(row)
194
+      this.dialogStatus = 'update'
195
+      this.dialogFormVisible = true
196
+      this.$nextTick(() => {
197
+        this.$refs['dataForm'].clearValidate()
198
+      })
199
+      this.getEditCityList()
200
+      this.getEditDistrictList()
201
+    },
202
+    handleLook(id) {
203
+      this.$router.push({ name: 'transaction-info', params: { id: id }})
204
+    },
205
+    handleCreate() {
206
+      this.resetDetail()
207
+      this.dialogStatus = 'create'
208
+      this.dialogFormVisible = true
209
+      this.$nextTick(() => {
210
+        this.$refs['dataForm'].clearValidate()
211
+      })
212
+    },
213
+    handleDelete(row) {
214
+      this.$notify({
215
+        title: '成功',
216
+        message: '删除成功',
217
+        type: 'success',
218
+        duration: 2000
219
+      })
220
+      const index = this.list.indexOf(row)
221
+      this.list.splice(index, 1)
222
+    },
223
+    handleDownload() {
224
+      this.downloadLoading = true
225
+      import('@/vendor/Export2Excel').then(excel => {
226
+        const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
227
+        const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
228
+        const data = this.formatJson(filterVal, this.list)
229
+        excel.export_json_to_excel({
230
+          header: tHeader,
231
+          data,
232
+          filename: 'table-list'
233
+        })
234
+        this.downloadLoading = false
235
+      })
236
+    },
237
+    padDate(value) {
238
+      value = value < 10 ? '0' + value : value
239
+      return value
240
+    },
241
+    formatDate(val) {
242
+      var value = new Date(val)
243
+      var year = value.getFullYear()
244
+      var month = this.padDate(value.getMonth() + 1)
245
+      var day = this.padDate(value.getDate())
246
+      var hour = this.padDate(value.getHours())
247
+      var minutes = this.padDate(value.getMinutes())
248
+      var seconds = this.padDate(value.getSeconds())
249
+      return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
250
+    },
251
+    formatJson(filterVal, jsonData) {
252
+      return jsonData.map(v => filterVal.map(j => {
253
+        if (j === 'timestamp') {
254
+          return parseTime(v[j])
255
+        } else {
256
+          return v[j]
257
+        }
258
+      }))
259
+    },
260
+  }
261
+}
262
+</script>