소스 검색

费用申请模块条件导出

ly 5 달 전
부모
커밋
fd005d021f

+ 44 - 1
src/main/java/com/liang/controller/StaBudgetapprovalController.java

@@ -12,6 +12,7 @@ import com.liang.common.exception.CustomException;
12 12
 import com.liang.entity.*;
13 13
 import com.liang.service.*;
14 14
 import io.swagger.annotations.ApiOperation;
15
+import jdk.nashorn.internal.runtime.linker.LinkerCallSite;
15 16
 import org.springframework.data.domain.Page;
16 17
 import org.springframework.data.domain.PageRequest;
17 18
 import org.springframework.http.ResponseEntity;
@@ -20,6 +21,7 @@ import org.springframework.ui.Model;
20 21
 import org.springframework.web.bind.annotation.*;
21 22
 
22 23
 import javax.annotation.Resource;
24
+import java.io.IOException;
23 25
 import java.text.DateFormat;
24 26
 import java.text.SimpleDateFormat;
25 27
 import java.util.*;
@@ -116,6 +118,44 @@ public class StaBudgetapprovalController extends BaseController {
116 118
         return "stabudgetapproval/list_apply";
117 119
     }
118 120
 
121
+    @ResponseBody
122
+    @RequestMapping(value = "/exportExcel/{fromdata}", method = RequestMethod.POST)
123
+    public BaseResult exportExcel(@PathVariable String fromdata)throws Exception{
124
+        SysUserInfo userInfo = getSysUserInfo();
125
+        List<String> postName = sysUserInfoService.getPostNameByUserId(userInfo.getUserId());
126
+        ObjectMapper objectMapper = new ObjectMapper();
127
+        StaBudgetapproval formData = objectMapper.readValue(fromdata, StaBudgetapproval.class);
128
+        String post = "";
129
+        if (postName.size() > 0) {
130
+            for (int i = 0; i < postName.size(); i++) {
131
+                if ("科研专责".equals(postName.get(i))) {
132
+                    post = "过";
133
+                }
134
+            }
135
+        }
136
+
137
+        Map<String, Object> paraMap = new HashMap<>();
138
+        paraMap.put("sqmc", formData.getSqmc());
139
+        paraMap.put("sqr", formData.getSqr());
140
+        paraMap.put("fylb", formData.getFylb());
141
+        paraMap.put("erpbh", formData.getErpbh());
142
+        paraMap.put("spzt", formData.getSpzt());
143
+        paraMap.put("bh", formData.getBh());
144
+        paraMap.put("xmlx", formData.getXmlx());
145
+        paraMap.put("ssbmmc",formData.getSsbmmc());
146
+        paraMap.put("dkyfzr",formData.getDkyfzr());
147
+        paraMap.put("nf",formData.getNf());
148
+
149
+        if (!userInfo.getAccount().equals("admin")) {
150
+            if (!"过".equals(post)) {
151
+                paraMap.put("userId", userInfo.getUserId().toString());
152
+            }
153
+        }
154
+        List<StaBudgetapproval> list = staBudgetapprovalService.getFysqList(paraMap);
155
+
156
+        return BaseResult.success("导出完成!",list);
157
+    }
158
+
119 159
     /**
120 160
      * 费用申请列
121 161
      *
@@ -1421,9 +1461,12 @@ public class StaBudgetapprovalController extends BaseController {
1421 1461
      */
1422 1462
     @ResponseBody
1423 1463
     @PostMapping("/unassociated/{fromdata}")
1424
-    public BaseResult unassociated(@PathVariable String fromdata) {
1464
+    public BaseResult unassociated(@PathVariable String fromdata,
1465
+                                   @RequestParam("page") Integer pageNum,
1466
+                                   @RequestParam("limit") Integer pageSize) {
1425 1467
 
1426 1468
         try {
1469
+            PageHelper.startPage(pageNum,pageSize);
1427 1470
             ObjectMapper objectMapper = new ObjectMapper();
1428 1471
             FormData formData = objectMapper.readValue(fromdata, FormData.class);
1429 1472
             Map<String, String> map = new HashMap<>();

+ 7 - 1
src/main/java/com/liang/controller/StaPrintingFeeController.java

@@ -1,5 +1,6 @@
1 1
 package com.liang.controller;
2 2
 
3
+import com.github.pagehelper.PageHelper;
3 4
 import com.github.pagehelper.PageInfo;
4 5
 import com.liang.common.JsonTool;
5 6
 import com.liang.common.base.BaseController;
@@ -180,7 +181,12 @@ public class StaPrintingFeeController extends BaseController {
180 181
     //印刷费用全部及条件查询
181 182
     @ResponseBody
182 183
     @RequestMapping(value = "/searchData", method = RequestMethod.POST)
183
-    public BaseResult searchData(@RequestParam(required = false, defaultValue = "", value = "MC") String mc, @RequestParam(required = false, defaultValue = "", value = "QSRQ") String qsrq, @RequestParam(required = false, defaultValue = "", value = "JZRQ") String jzrq) {
184
+    public BaseResult searchData(@RequestParam(required = false, defaultValue = "", value = "MC") String mc,
185
+                                 @RequestParam(required = false, defaultValue = "", value = "QSRQ") String qsrq,
186
+                                 @RequestParam(required = false, defaultValue = "", value = "JZRQ") String jzrq,
187
+                                 @RequestParam("page") Integer pageNum,
188
+                                 @RequestParam("limit") Integer pageSize) {
189
+        PageHelper.startPage(pageNum,pageSize);
184 190
         List<HashMap<String, Object>> staFeasibilityreport = staPrintingFeeService.searchPrintingCost(mc, qsrq, jzrq);
185 191
         PageInfo<HashMap<String, Object>> pageinfo = new PageInfo<>(staFeasibilityreport);
186 192
         List<HashMap<String, Object>> rows = pageinfo.getList();

+ 19 - 23
src/main/resources/templates/stabudgetapproval/list_apply.html

@@ -152,9 +152,9 @@
152 152
                 <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="nullify">
153 153
                     <i class="layui-icon layui-icon-delete" style="font-size: 10px;"></i>作废
154 154
                 </button>
155
-                <!--                <button class="layui-btn layui-btn-sm" lay-event="exportExcel">-->
156
-                <!--                    <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出-->
157
-                <!--                </button>-->
155
+                <button class="layui-btn layui-btn-sm" lay-event="exportExcel">
156
+                    <i class="layui-icon layui-icon-export" style="font-size: 10px;"></i>导出
157
+                </button>
158 158
             </div>
159 159
         </script>
160 160
 
@@ -221,34 +221,14 @@
221 221
                     {field: 'bh', width: '8%', title: '编号'},
222 222
                     {field: 'sqmc', width: '25%', title: '申请名称'},
223 223
                     {field: 'erpbh', width: '10%', title: 'ERP编号'},
224
-                    // {field: 'xmmc', width: '20%', title: '项目名称'},
225
-                    // {field: 'sfbyj', width: '8%', title: '是否备用金', align: 'center', templet: function (d) {
226
-                    //         if (1 == d.sfbyj) {
227
-                    //             return '<span class="layui-badge layui-bg-blue">是</span>';
228
-                    //         } else {
229
-                    //             return '<span class="layui-badge layui-bg-orange">否</span>';
230
-                    //         }
231
-                    //     }
232
-                    // },
233 224
                     {field: 'fylbmc', width: '8%', title: '费用类别'},
234 225
                     {field: 'sqje', width: '10%', title: '申请金额(元)'},
235
-                    // {field: 'sfbz', width: '7%', title: '是否报账', align: 'center', templet: function (d) {
236
-                    //         if (1 == d.sfbz) {
237
-                    //             return '<span class="layui-badge layui-bg-blue">是</span>';
238
-                    //         } else {
239
-                    //             return '<span class="layui-badge layui-bg-orange">否</span>';
240
-                    //         }
241
-                    //     }
242
-                    // },
243
-                    // {field: 'bzje', width: '10%', title: '报账金额(元)'},
244 226
                     {field: 'sqrxm', width: '8%', title: '申请人', align: 'center'},
245 227
                     {field: 'sqsj', width: '8%', title: '申请时间', align: 'center'},
246 228
                     {field: 'xmlxmc', width: '11%', title: '项目类型'},
247 229
                     {field: 'nf', width: '5%', title: '年份', align: 'center'},
248 230
                     {field: 'dkyfzrxm', width: '8%', title: '电科院负责人'},
249 231
                     {field: 'ssbmmc', width: '8%', title: '所属部门'}
250
-                    // {field: 'fj', width: '6%', title: '附件'},
251
-                    // {title: '操作', toolbar: '#currentTableBar', width: '15%', align: 'center', fixed: 'right'}
252 232
                 ]
253 233
             ],
254 234
             autoSort: false,
@@ -696,6 +676,22 @@
696 676
                         });
697 677
                     });
698 678
                 }
679
+            }else if (obj.event==='exportExcel'){  // 使用 layui 获取表单数据
680
+                var formData = form.val('search-form');
681
+                console.log(formData);
682
+                var formDataString = JSON.stringify(formData);
683
+                AjaxUtil.post({
684
+                    url: AjaxUtil.ctx + "staBudgetapproval/exportExcel/" + formDataString,
685
+                    contentType: "application/json",
686
+                    success: function (res) {
687
+                        table.exportFile('currentTableId', res.data, 'xlsx');
688
+                    },
689
+                    error: function (error) {
690
+
691
+
692
+                    }
693
+                });
694
+                console.log('进来了');
699 695
             }
700 696
         });
701 697