Selaa lähdekoodia

完成 流水信息

weiximei 6 vuotta sitten
vanhempi
commit
975fb01bf0

+ 57
- 3
CODE/smart-community/property-api/src/main/java/com/community/huiju/controller/BillStatementController.java Näytä tiedosto

@@ -1,9 +1,22 @@
1 1
 package com.community.huiju.controller;
2 2
 
3 3
 
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
4 6
 import com.community.huiju.common.base.BaseController;
5
-import org.springframework.web.bind.annotation.RequestMapping;
6
-import org.springframework.web.bind.annotation.RestController;
7
+import com.community.huiju.service.IBillStatementService;
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.apache.poi.hssf.usermodel.HSSFWorkbook;
13
+import org.springframework.beans.factory.annotation.Autowired;
14
+import org.springframework.cloud.context.config.annotation.RefreshScope;
15
+import org.springframework.web.bind.annotation.*;
16
+
17
+import javax.servlet.http.HttpServletResponse;
18
+import javax.servlet.http.HttpSession;
19
+import java.io.OutputStream;
7 20
 
8 21
 /**
9 22
  * <p>
@@ -14,7 +27,48 @@ import org.springframework.web.bind.annotation.RestController;
14 27
  * @since 2019-02-13
15 28
  */
16 29
 @RestController
17
-@RequestMapping("/tp/bill-statement")
30
+@RequestMapping("/")
31
+@RefreshScope
32
+@Api(value = "流水信息 API", description = "流水信息 API")
18 33
 public class BillStatementController extends BaseController {
19 34
 
35
+    @Autowired
36
+    private IBillStatementService iBillStatementService;
37
+
38
+    @ApiOperation(value = "获取流水信息", notes = "获取流水信息")
39
+    @ApiImplicitParams({
40
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "body", name = "parameter", value = "id流水编号," +
41
+                    "billId缴费项编号,billName缴费项名称,billInvoiceId缴费单编号,payName缴费人"),
42
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "header", name = "X-Auth-Token", value = "token")
43
+    })
44
+    @RequestMapping(value = "/bill/statement/all", method = RequestMethod.POST)
45
+    public ResponseBean getBillStatement(HttpSession session, @RequestBody String parameter) {
46
+        ResponseBean responseBean = new ResponseBean();
47
+        UserElement userElement = getUserElement(session);
48
+        responseBean = iBillStatementService.getBillStatement(userElement, parameter);
49
+        return responseBean;
50
+    }
51
+
52
+    @ApiOperation(value = "导出Excel", notes = "导出Excel")
53
+    @ApiImplicitParams({
54
+            @ApiImplicitParam(paramType = "header", dataTypeClass = String.class, name = "X-Auth-Token", value = "Token")
55
+    })
56
+    @RequestMapping(value = "/bill/statement/exportExcel", method = RequestMethod.GET)
57
+    public void exportExcel(HttpServletResponse response, HttpSession session) {
58
+        ResponseBean responseBean = new ResponseBean();
59
+        UserElement userElement = getUserElement(session);
60
+        HSSFWorkbook workbook = (HSSFWorkbook) iBillStatementService.exportExcel(userElement).getData();
61
+        this.setResponseHeader(response, "流水信息.xls");
62
+        //响应到客户端
63
+        try {
64
+            OutputStream os = response.getOutputStream();
65
+            workbook.write(os);
66
+            os.flush();
67
+            os.close();
68
+        } catch (Exception e) {
69
+            e.printStackTrace();
70
+        }
71
+    }
72
+
73
+
20 74
 }

+ 7
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/BillStatementMapper.java Näytä tiedosto

@@ -1,8 +1,14 @@
1 1
 package com.community.huiju.dao;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
3 4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
6
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 7
 import com.community.huiju.model.BillStatement;
5 8
 import org.apache.ibatis.annotations.Mapper;
9
+import org.apache.ibatis.annotations.Param;
10
+
11
+import java.util.Map;
6 12
 
7 13
 /**
8 14
  * <p>
@@ -15,4 +21,5 @@ import org.apache.ibatis.annotations.Mapper;
15 21
 @Mapper
16 22
 public interface BillStatementMapper extends BaseMapper<BillStatement> {
17 23
 
24
+    IPage<BillStatement> getBillStatementAll(Page page, @Param("map") Map<String, Object> map);
18 25
 }

+ 20
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/model/BillStatement.java Näytä tiedosto

@@ -1,6 +1,10 @@
1 1
 package com.community.huiju.model;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
3 6
 import com.baomidou.mybatisplus.annotation.TableName;
7
+import javafx.scene.chart.ValueAxis;
4 8
 import lombok.Data;
5 9
 import lombok.EqualsAndHashCode;
6 10
 import lombok.experimental.Accessors;
@@ -24,6 +28,9 @@ public class BillStatement implements Serializable {
24 28
 
25 29
     private static final long serialVersionUID = 1L;
26 30
 
31
+    @TableId(value = "id", type = IdType.AUTO)
32
+    private Integer id;
33
+
27 34
     /**
28 35
      * 小区id
29 36
      */
@@ -62,7 +69,19 @@ public class BillStatement implements Serializable {
62 69
     /**
63 70
      * 生成流水时间
64 71
      */
65
-    private LocalDateTime createTime;
72
+    private Data createTime;
73
+
74
+    /**
75
+     * 收费组编号
76
+     */
77
+    @TableField(exist = false)
78
+    private Integer billId;
79
+
80
+    /**
81
+     * 收费组名称
82
+     */
83
+    @TableField(exist = false)
84
+    private String billName;
66 85
 
67 86
 
68 87
 }

+ 16
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/IBillStatementService.java Näytä tiedosto

@@ -1,6 +1,8 @@
1 1
 package com.community.huiju.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
4 6
 import com.community.huiju.model.BillStatement;
5 7
 
6 8
 /**
@@ -13,4 +15,18 @@ import com.community.huiju.model.BillStatement;
13 15
  */
14 16
 public interface IBillStatementService extends IService<BillStatement> {
15 17
 
18
+    /**
19
+     * 查询流水账单
20
+     * @param userElement
21
+     * @param parameter
22
+     * @return
23
+     */
24
+    ResponseBean getBillStatement(UserElement userElement, String parameter);
25
+
26
+    /**
27
+     * 导出Excel
28
+     * @param userElement
29
+     * @return
30
+     */
31
+    ResponseBean exportExcel(UserElement userElement);
16 32
 }

+ 1
- 1
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BillInvoiceServiceImpl.java Näytä tiedosto

@@ -403,7 +403,7 @@ public class BillInvoiceServiceImpl extends ServiceImpl<BillInvoiceMapper, BillI
403 403
                 cell = row.createCell(11);
404 404
                 cell.setCellValue(records.get(t).getUpdateUserName());
405 405
                 cell.setCellStyle(style);
406
-                if (null == records.get(t).getUpdateDate()) {
406
+                if (null != records.get(t).getUpdateDate()) {
407 407
                     // 修改时间
408 408
                     cell = row.createCell(12);
409 409
                     cell.setCellValue(dateFormat.format(records.get(t).getUpdateDate()));

+ 164
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BillStatementServiceImpl.java Näytä tiedosto

@@ -1,11 +1,24 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
3 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.community.commom.mode.ResponseBean;
8
+import com.community.commom.session.UserElement;
9
+import com.community.huiju.model.BillInvoice;
4 10
 import com.community.huiju.model.BillStatement;
5 11
 import com.community.huiju.dao.BillStatementMapper;
6 12
 import com.community.huiju.service.IBillStatementService;
13
+import com.google.common.collect.Maps;
14
+import org.apache.poi.hssf.usermodel.*;
15
+import org.springframework.beans.factory.annotation.Autowired;
7 16
 import org.springframework.stereotype.Service;
8 17
 
18
+import java.text.SimpleDateFormat;
19
+import java.util.List;
20
+import java.util.Map;
21
+
9 22
 /**
10 23
  * <p>
11 24
  * 账单流水表 服务实现类
@@ -17,4 +30,155 @@ import org.springframework.stereotype.Service;
17 30
 @Service
18 31
 public class BillStatementServiceImpl extends ServiceImpl<BillStatementMapper, BillStatement> implements IBillStatementService {
19 32
 
33
+    @Autowired
34
+    private BillStatementMapper billStatementMapper;
35
+
36
+    @Override
37
+    public ResponseBean getBillStatement(UserElement userElement, String parameter) {
38
+        ResponseBean responseBean = new ResponseBean();
39
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
40
+
41
+        Integer pageNum = jsonObject.getInteger("pageNum");
42
+        Integer pageSize = jsonObject.getInteger("pageSize");
43
+        // 流水 id
44
+        Integer id = jsonObject.getInteger("id");
45
+        // 缴费项 id
46
+        Integer billId = jsonObject.getInteger("billId");
47
+        // 缴费项 名称
48
+        String billName = jsonObject.getString("billName");
49
+        // 缴费单 编号
50
+        Integer billInvoiceId = jsonObject.getInteger("billInvoiceId");
51
+        // 缴费人
52
+        String payName = jsonObject.getString("payName");
53
+
54
+        // 参数
55
+        Map<String, Object> map = Maps.newHashMap();
56
+        map.put("id", id);
57
+        map.put("billId", billId);
58
+        map.put("billName", billName);
59
+        map.put("billInvoiceId", billInvoiceId);
60
+        map.put("payName", payName);
61
+        map.put("communityId", userElement.getCommunityId());
62
+
63
+        Page<BillStatement> page = new Page<>();
64
+        page.setCurrent(pageNum);
65
+        page.setSize(pageSize);
66
+        IPage<BillStatement> billStatementIPage = billStatementMapper.getBillStatementAll(page, map);
67
+
68
+        Map<String, Object> respMap = Maps.newHashMap();
69
+        respMap.put("list", billStatementIPage.getRecords());
70
+        respMap.put("pageNum", billStatementIPage.getCurrent());
71
+        respMap.put("pageSize", billStatementIPage.getSize());
72
+        respMap.put("total", billStatementIPage.getTotal());
73
+
74
+        responseBean.addSuccess(respMap);
75
+        return responseBean;
76
+    }
77
+
78
+    @Override
79
+    public ResponseBean exportExcel(UserElement userElement) {
80
+        ResponseBean responseBean = new ResponseBean();
81
+        String [] title = new String[] { "流水号","收费组编号","收费组名称","收费单号","费用金额","缴费人","缴费备注","缴费方式","流水生成时间"};
82
+
83
+        HSSFWorkbook excel = excel(title, userElement,null);
84
+        responseBean.addSuccess(excel);
85
+        return responseBean;
86
+    }
87
+
88
+    /**
89
+     * 表格
90
+     * @param title
91
+     * @param workbook
92
+     * @return
93
+     */
94
+    private HSSFWorkbook excel(String[] title, UserElement userElement, HSSFWorkbook workbook) {
95
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
96
+
97
+        if (null == workbook) {
98
+            workbook = new HSSFWorkbook();
99
+        }
100
+        HSSFSheet sheet = workbook.createSheet("缴费单");
101
+        // 行数标记
102
+        int rowNum = 0;
103
+        // 创建一行,用作标题
104
+        HSSFRow row = sheet.createRow(rowNum);
105
+        // 创建样式
106
+        HSSFCellStyle style = workbook.createCellStyle();
107
+        // 居中
108
+        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
109
+
110
+        // 创建列对象
111
+        HSSFCell cell = null;
112
+
113
+        // 写入表头
114
+        for (int i = 0; i<title.length; i++) {
115
+            cell = row.createCell(i);
116
+            cell.setCellValue(title[i]);
117
+            cell.setCellStyle(style);
118
+        }
119
+
120
+        Map<String, Object> map = Maps.newHashMap();
121
+        map.put("communityId", userElement.getCommunityId());
122
+
123
+        Page<BillStatement> page = new Page<>();
124
+        page.setCurrent(1);
125
+        page.setSize(500);
126
+        IPage<BillStatement> billInvoiceIPage = billStatementMapper.getBillStatementAll(page, map);
127
+        List<BillStatement> records = billInvoiceIPage.getRecords();
128
+
129
+
130
+        // 写入内容
131
+        for (int i = 1; i<= billInvoiceIPage.getPages(); i++) {
132
+            for (int t = 0; t<records.size(); t++) {
133
+                row = sheet.createRow(++rowNum);
134
+                // 流水号
135
+                cell = row.createCell(0);
136
+                cell.setCellValue(records.get(t).getId());
137
+                cell.setCellStyle(style);
138
+                // 收费组编号
139
+                cell = row.createCell(1);
140
+                cell.setCellValue(records.get(t).getBillId());
141
+                cell.setCellStyle(style);
142
+                // 收费组名称
143
+                cell = row.createCell(2);
144
+                cell.setCellValue(records.get(t).getBillName());
145
+                cell.setCellStyle(style);
146
+                // 收费单号
147
+                cell = row.createCell(3);
148
+                cell.setCellValue(records.get(t).getBillInvoiceId());
149
+                cell.setCellStyle(style);
150
+                // 费用金额
151
+                cell = row.createCell(4);
152
+                double price = Double.valueOf(records.get(t).getPayPrice()) / 100.00;
153
+                cell.setCellValue(price);
154
+                cell.setCellStyle(style);
155
+                // 缴费人
156
+                cell = row.createCell(5);
157
+                cell.setCellValue(records.get(t).getPayName());
158
+                cell.setCellStyle(style);
159
+                // 缴费备注
160
+                cell = row.createCell(6);
161
+                cell.setCellValue(records.get(t).getPayRemark());
162
+                cell.setCellStyle(style);
163
+                // 缴费方式
164
+                cell = row.createCell(7);
165
+                cell.setCellValue("0".equals(records.get(t).getPayType()) ? "微信支付" : "1".equals(records.get(t).getPayType()) ? "线下缴费" : "未知");
166
+                cell.setCellStyle(style);
167
+                if (null != records.get(t).getCreateTime()) {
168
+                    // 生成流水时间
169
+                    cell = row.createCell(8);
170
+                    cell.setCellValue(dateFormat.format(records.get(t).getCreateTime()));
171
+                    cell.setCellStyle(style);
172
+                }
173
+            }
174
+            page.setCurrent(i);
175
+            page.setSize(500);
176
+            billInvoiceIPage = billStatementMapper.getBillStatementAll(page, map);
177
+            records = billInvoiceIPage.getRecords();
178
+
179
+        }
180
+
181
+        return workbook;
182
+    }
183
+
20 184
 }

+ 34
- 0
CODE/smart-community/property-api/src/main/resources/mapper/BillStatementMapper.xml Näytä tiedosto

@@ -2,4 +2,38 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.community.huiju.dao.BillStatementMapper">
4 4
 
5
+    <select id="getBillStatementAll" resultType="com.community.huiju.model.BillStatement">
6
+        SELECT
7
+            tbs.*,
8
+            tb.id as billId,
9
+            tb.bill_name as billName
10
+        FROM
11
+            tp_bill_statement tbs
12
+        LEFT JOIN tp_bill_invoice tbi ON tbs.bill_invoice_id = tbi.id
13
+        LEFT JOIN tp_bill tb ON tbi.bill_id = tb.id
14
+        <where>
15
+            <trim prefixOverrides="and | or">
16
+                <if test="map.id != null">
17
+                    and tbs.id = #{map.id}
18
+                </if>
19
+                <if test="map.billId != null">
20
+                    and tb.id = #{map.billId}
21
+                </if>
22
+                <if test="map.billName != null and map.billName != ''">
23
+                    and tb.bill_name like CONCAT('%',#{map.billName},'%')
24
+                </if>
25
+                <if test="map.billInvoiceId != null">
26
+                    and tbs.id = #{map.billInvoiceId}
27
+                </if>
28
+                <if test="map.payName != null and map.payName != ''">
29
+                    and tbs.pay_name like CONCAT('%', #{map.payName}, '%')
30
+                </if>
31
+                <if test="map.communityId != null">
32
+                    and tbs.community_id = #{map.communityId}
33
+                </if>
34
+            </trim>
35
+        </where>
36
+        order by tbs.create_time DESC
37
+    </select>
38
+
5 39
 </mapper>

+ 9
- 0
VUECODE/smart-property-manage/src/api/billInvoice.js Näytä tiedosto

@@ -113,3 +113,12 @@ export function updateBillInvoiceIdPayPrice(data) {
113 113
     }
114 114
   })
115 115
 }
116
+
117
+// 下载excel
118
+export function exportExcel(billId) {
119
+  return request({
120
+    url: '/bill/invoice/exportExcel/' + billId,
121
+    method: 'get',
122
+    responseType: 'blob'
123
+  })
124
+}

+ 28
- 0
VUECODE/smart-property-manage/src/api/billStatement.js Näytä tiedosto

@@ -0,0 +1,28 @@
1
+import request from '@/utils/request'
2
+
3
+// 获取流水信息
4
+export function getBillStatementAll(data) {
5
+  return request({
6
+    url: '/bill/statement/all',
7
+    method: 'post',
8
+    data: {
9
+      id: data.id, // 流水 id
10
+      billId: data.billId, // 缴费项 id
11
+      billName: data.billName, //  缴费项 名称
12
+      billInvoiceId: data.billInvoiceId, // 缴费单 编号
13
+      payName: data.payName, //  缴费人
14
+      pageNum: data.pageNum,
15
+      pageSize: data.pageSize
16
+    }
17
+  })
18
+}
19
+
20
+// 下载excel
21
+export function exportExcel() {
22
+  return request({
23
+    url: '/bill/statement/exportExcel',
24
+    method: 'get',
25
+    responseType: 'blob'
26
+  })
27
+}
28
+

+ 6
- 0
VUECODE/smart-property-manage/src/router/index.js Näytä tiedosto

@@ -247,6 +247,12 @@ export const constantRouterMap = [
247 247
         name: 'bill-info-add',
248 248
         hidden: true,
249 249
         meta: { title: '添加更多收费单', icon: 'table' }
250
+      },
251
+      {
252
+        path: '/bill/management/statement/index',
253
+        component: () => import('@/views/bill/statement/index'),
254
+        name: 'bill-statement-index',
255
+        meta: { title: '流水信息', icon: 'table' }
250 256
       }
251 257
     ]
252 258
   },

+ 3
- 1
VUECODE/smart-property-manage/src/store/index.js Näytä tiedosto

@@ -15,6 +15,7 @@ import role from './modules/role'
15 15
 import billInvoice from './modules/billInvoice'
16 16
 import ticket from './modules/ticket'
17 17
 import bill from './modules/bill'
18
+import billStatement from './modules/billStatement'
18 19
 
19 20
 Vue.use(Vuex)
20 21
 
@@ -33,7 +34,8 @@ const store = new Vuex.Store({
33 34
     role,
34 35
     billInvoice,
35 36
     ticket,
36
-    bill
37
+    bill,
38
+    billStatement
37 39
   },
38 40
   getters
39 41
 })

+ 10
- 1
VUECODE/smart-property-manage/src/store/modules/billInvoice.js Näytä tiedosto

@@ -1,4 +1,4 @@
1
-import { getBillInvoiceList, updateBillNameAndBillExplainAndEndDate, getBillByIdInfo, deleteBillInvoiceById, billInvoiceOfflinePayment, updateBillInvoiceStatus, addTempBillInvoice, getTempBillInvoice, deleteTempBillInvoice, updateBillInvoiceIdPayPrice } from '@/api/billInvoice'
1
+import { getBillInvoiceList, updateBillNameAndBillExplainAndEndDate, getBillByIdInfo, deleteBillInvoiceById, billInvoiceOfflinePayment, updateBillInvoiceStatus, addTempBillInvoice, getTempBillInvoice, deleteTempBillInvoice, updateBillInvoiceIdPayPrice, exportExcel } from '@/api/billInvoice'
2 2
 
3 3
 const billInvoice = {
4 4
   state: {
@@ -97,6 +97,15 @@ const billInvoice = {
97 97
           reject(error)
98 98
         })
99 99
       })
100
+    },
101
+    ExportBillInvoiceExcel({ commit }, billId) { // 下载excel
102
+      return new Promise((resolve, reject) => {
103
+        exportExcel(billId).then(response => {
104
+          resolve(response)
105
+        }).catch(error => {
106
+          reject(error)
107
+        })
108
+      })
100 109
     }
101 110
   }
102 111
 }

+ 32
- 0
VUECODE/smart-property-manage/src/store/modules/billStatement.js Näytä tiedosto

@@ -0,0 +1,32 @@
1
+import { getBillStatementAll, exportExcel } from '@/api/billStatement'
2
+
3
+const billStatement = {
4
+  state: {
5
+
6
+  },
7
+  mutations: {
8
+
9
+  },
10
+  actions: {
11
+    GetBillStatementAll({ commit }, data) { // 获取流水信息
12
+      return new Promise((resolve, reject) => {
13
+        getBillStatementAll(data).then(response => {
14
+          resolve(response)
15
+        }).catch(error => {
16
+          reject(error)
17
+        })
18
+      })
19
+    },
20
+    ExportBillStatementExcel({ commit }) { // 导出 excel
21
+      return new Promise((resolve, reject) => {
22
+        exportExcel().then(response => {
23
+          resolve(response)
24
+        }).catch(error => {
25
+          reject(error)
26
+        })
27
+      })
28
+    }
29
+  }
30
+}
31
+
32
+export default billStatement

+ 14
- 1
VUECODE/smart-property-manage/src/views/bill/info/index.vue Näytä tiedosto

@@ -63,7 +63,7 @@
63 63
       <el-button type="primary" @click="addBillInvoice">添加更多收费单</el-button>
64 64
       <el-button type="danger" @click="deleteBeachIds">删除</el-button>
65 65
       <el-button type="primary" @click="offlinePayment">设置为已线下缴费</el-button>
66
-      <el-button type="success">导出数据</el-button>
66
+      <el-button type="success" @click="exportExcel">导出数据</el-button>
67 67
       <div style="height: 40px; line-height: 40px; margin-left: 10px; color: #99a9bf;">未缴户主费用可以直接点击 收费金额数字 修改,已缴费业主无法修改,需要线下多退少补</div>
68 68
     </div>
69 69
     <el-table
@@ -425,6 +425,19 @@ export default {
425 425
     showPayPrice(payPrice) { //  转换金额
426 426
       const price = payPrice / 100
427 427
       return price
428
+    },
429
+    exportExcel() {
430
+      this.$store.dispatch('ExportBillInvoiceExcel', this.formInline.billId).then(res => {
431
+        const url = window.URL.createObjectURL(new Blob([res]))
432
+        const link = document.createElement('a')
433
+        link.style.display = 'none'
434
+        link.href = url
435
+        link.setAttribute('download', '缴费单.xls')
436
+        document.body.appendChild(link)
437
+        link.click()
438
+      }).catch(() => {
439
+        console.log('error ExportBillInvoiceExcel')
440
+      })
428 441
     }
429 442
   }
430 443
 }

+ 216
- 0
VUECODE/smart-property-manage/src/views/bill/statement/index.vue Näytä tiedosto

@@ -0,0 +1,216 @@
1
+<template>
2
+  <div id="root">
3
+    <el-form :model="formInline" inline class="form-inline">
4
+      <el-form-item label="流水号">
5
+        <el-input v-model="formInline.id" placeholder="流水号"/>
6
+      </el-form-item>
7
+      <el-form-item label="缴费项目编号">
8
+        <el-input v-model="formInline.billId" placeholder="缴费项目编号"/>
9
+      </el-form-item>
10
+      <el-form-item label="缴费项目名">
11
+        <el-input v-model="formInline.billName" placeholder="缴费项目名"/>
12
+      </el-form-item>
13
+      <el-form-item label="收费单号">
14
+        <el-input v-model="formInline.billInvoiceId" placeholder="收费单号"/>
15
+      </el-form-item>
16
+      <el-form-item label="缴费人">
17
+        <el-input v-model="formInline.payName" placeholder="缴费人"/>
18
+      </el-form-item>
19
+      <el-form-item>
20
+        <el-button type="info" @click="clear">清空</el-button>
21
+        <el-button type="primary" @click="getBillStatement">搜索</el-button>
22
+      </el-form-item>
23
+    </el-form>
24
+    <el-button type="primary" style="margin-left: 20px; margin-bottom: 20px;" @click="exportExcel">导出数据</el-button>
25
+    <el-table
26
+      ref="multipleTable"
27
+      :data="list"
28
+      border
29
+      tooltip-effect="dark"
30
+      style="width: 100%"
31
+      @selection-change="handleSelectionChange">
32
+      <!--<el-table-column-->
33
+      <!--type="selection"-->
34
+      <!--align="center"-->
35
+      <!--width="55"/>-->
36
+      <el-table-column
37
+        label="流水号"
38
+        prop="id"
39
+        align="center">
40
+        <!--<template slot-scope="scope">{{ scope.row.date }}</template>-->
41
+      </el-table-column>
42
+      <el-table-column
43
+        prop="billId"
44
+        align="center"
45
+        label="收费组编号">
46
+        <template slot-scope="scope">
47
+          <span style="color: #409EFF;cursor: pointer" @click="getInfo(scope.row.billId)">{{ scope.row.billId }}</span>
48
+        </template>
49
+      </el-table-column>
50
+      <el-table-column
51
+        prop="billName"
52
+        label="收费组名称"
53
+        align="center"
54
+        show-overflow-tooltip>
55
+        <template slot-scope="scope">
56
+          <span style="color: #409EFF;cursor: pointer" @click="getInfo(scope.row.billId)">{{ scope.row.billName }}</span>
57
+        </template>
58
+      </el-table-column>
59
+      <el-table-column
60
+        prop="billInvoiceId"
61
+        label="收费单号"
62
+        align="center"
63
+        width="120"/>
64
+      <el-table-column
65
+        prop="payPrice"
66
+        align="center"
67
+        label="费用金额">
68
+        <template slot-scope="scope">{{ showPayPrice(scope.row.payPrice) }}</template>
69
+      </el-table-column>
70
+      <el-table-column
71
+        prop="payName"
72
+        align="center"
73
+        label="缴费人"/>
74
+      <el-table-column
75
+        prop="payRemark"
76
+        align="center"
77
+        label="缴费备注"/>
78
+      <el-table-column
79
+        prop="payType"
80
+        align="center"
81
+        label="缴费方式">
82
+        <template slot-scope="scope">{{ showPayType(scope.row.payType) }}</template>
83
+      </el-table-column>
84
+      <el-table-column
85
+        prop="createTime"
86
+        align="center"
87
+        label="流水生成时间">
88
+        <template slot-scope="scope">{{ formatDate(scope.row.createTime) }}</template>
89
+      </el-table-column>
90
+    </el-table>
91
+    <div class="foot-page">
92
+      <el-pagination
93
+        :current-page="formInline.pageNum"
94
+        :page-sizes="[10, 20, 40, 100]"
95
+        :page-size="formInline.pageSize"
96
+        :total="total"
97
+        layout="total, sizes, prev, pager, next, jumper"
98
+        @size-change="handleSizeChange"
99
+        @current-change="handleCurrentChange"/>
100
+    </div>
101
+  </div>
102
+</template>
103
+
104
+<script>
105
+export default {
106
+  name: 'Index',
107
+  data() {
108
+    return {
109
+      formInline: {
110
+        id: '', // 流水 id
111
+        billId: '', // 缴费项 id
112
+        billName: '', //  缴费项 名称
113
+        billInvoiceId: '', // 缴费单 编号
114
+        payName: '', //  缴费人
115
+        pageNum: 1,
116
+        pageSize: 10
117
+      },
118
+      list: [], // 数据
119
+      total: 0 // 总数
120
+    }
121
+  },
122
+  mounted() {
123
+    this.getBillStatement()
124
+  },
125
+  methods: {
126
+    handleSelectionChange(val) {
127
+      console.log(val)
128
+    },
129
+    handleSizeChange(val) {
130
+      console.log(`每页 ${val} 条`)
131
+      this.formInline.pageSize = val
132
+      this.getBillStatement()
133
+    },
134
+    handleCurrentChange(val) {
135
+      console.log(`当前页: ${val}`)
136
+      this.formInline.pageNum = val
137
+      this.getBillStatement()
138
+    },
139
+    getBillStatement() { //  获取流水信息
140
+      this.$store.dispatch('GetBillStatementAll', this.formInline).then(res => {
141
+        const resData = res.data
142
+        this.list = resData.list
143
+        this.formInline.pageNum = resData.pageNum
144
+        this.formInline.pageSize = resData.pageSize
145
+        this.total = resData.total
146
+      }).catch(() => {
147
+        console.log('error GetBillStatementAll')
148
+      })
149
+    },
150
+    showPayType(obj) {
151
+      let str = ''
152
+      switch (obj) {
153
+        case '0':
154
+          str = '微信缴费'
155
+          break
156
+        case '1':
157
+          str = '线下缴费'
158
+          break
159
+      }
160
+      return str
161
+    },
162
+    formatDate(val) {
163
+      var value = new Date(val)
164
+      var year = value.getFullYear()
165
+      var month = value.getMonth() + 1
166
+      var day = value.getDate()
167
+      // var hour = value.getHours()
168
+      // var minutes = value.getMinutes()
169
+      // var seconds = value.getSeconds()
170
+      // return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds
171
+      return year + '-' + month + '-' + day
172
+    },
173
+    showPayPrice(payPrice) { //  转换金额
174
+      const price = payPrice / 100
175
+      return price
176
+    },
177
+    getInfo(billId) { // 跳转收费组详情
178
+      this.$router.push({ name: 'bill-info', params: { id: billId }})
179
+    },
180
+    clear() { // 情空
181
+      this.formInline.pageNum = 1
182
+      this.formInline.pageSize = 10
183
+      this.formInline.id = '' // 流水 id
184
+      this.formInline.billId = '' // 缴费项 id
185
+      this.formInline.billName = '' //  缴费项 名称
186
+      this.formInline.billInvoiceId = '' // 缴费单 编号
187
+      this.formInline.payName = '' //  缴费人
188
+    },
189
+    exportExcel() {
190
+      this.$store.dispatch('ExportBillStatementExcel', this.formInline.billId).then(res => {
191
+        const url = window.URL.createObjectURL(new Blob([res]))
192
+        const link = document.createElement('a')
193
+        link.style.display = 'none'
194
+        link.href = url
195
+        link.setAttribute('download', '流水信息.xls')
196
+        document.body.appendChild(link)
197
+        link.click()
198
+      }).catch(() => {
199
+        console.log('error ExportBillStatementExcel')
200
+      })
201
+    }
202
+  }
203
+}
204
+</script>
205
+
206
+<style scoped>
207
+.form-inline {
208
+  margin-top: 20px;
209
+  margin-right: 20px;
210
+  margin-left: 20px;
211
+}
212
+.foot-page {
213
+  display: flex;
214
+  justify-content: flex-end;
215
+}
216
+</style>