新增导出excel功能。

This commit is contained in:
Renpc-kilig 2021-01-19 10:12:56 +08:00
parent 28aa2c3f30
commit c05e2ac12c
13 changed files with 556 additions and 29 deletions

View File

@ -361,7 +361,7 @@ public class BossScoreController extends AbstractController {
return year;
}
/*@ApiOperation(value = "导出excel(立案情况)", notes = "导出excel(立案情况)接口")
@ApiOperation(value = "导出excel(立案情况)", notes = "导出excel(立案情况)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("excelworknote")
public void excelWorkNote(HttpServletResponse response) throws Exception {
@ -373,36 +373,60 @@ public class BossScoreController extends AbstractController {
String [] headers = {"街镇村","上报数量","每件得分","总得分"};
List<List<String>> listHeader = new ArrayList<>();
for (String item : headers){
for(String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
}
List<DeptAssessDTO> deptAssessDTOs = deptAssessDao.listDeptAssess(params);
List<List<String>> listData = new ArrayList<>();
for (DeptAssessDTO d : deptAssessDTOs) {
List<String> data = new ArrayList<String>();
data.add(d.getDeptName());
data.add(d.getDeptTotalYear());
data.add(d.getDeptTotalQuarter());
data.add(d.getDeptCaseNum().toString());
data.add(""+d.getDeptCaseSettleScore().toString()+"");
data.add(d.getDeptCaseTimeoutNum().toString());
data.add(""+d.getDeptCaseTimeoutScore().toString()+"");
data.add(d.getDeptCaseGrossScore().toString());
Integer num = deptInspectorService.countDeptInspectorNum(d.getDeptTotalYear(),d.getDeptTotalQuarter(),d.getDeptId());
data.add(""+num.toString()+"");
data.add(d.getDeptCaseTotalScore().toString()+"");
double zdy = deptAssessChangeScoreService.getDeptChangeScore(d.getDeptAssessId());
data.add(zdy+"");
Double eventScore = totalEvenSocre(d.getDeptCaseTotalScore(),zdy);
data.add(eventScore.toString()+"");
data.add(d.getDeptTotalTime());
ListPage page = new ListPage();
SuccessResultList<List<WorkNoteForScoreDTO>> successResultList = worknoteForScore(page);
List<WorkNoteForScoreDTO> workNoteForScoreDTOS = successResultList.getRows();
List<List<Object>> listData = new ArrayList<>();
for (WorkNoteForScoreDTO dto : workNoteForScoreDTOS) {
List<Object> data = new ArrayList<>();
data.add(dto.getAreaName());
data.add(dto.getNoteCount());
data.add(dto.getEveryScore());
data.add(dto.getScore());
listData.add(data);
}
EasyExcel.write(response.getOutputStream()).sheet("职能部门考核分数表").head(listHeader).doWrite(listData);
}*/
EasyExcel.write(response.getOutputStream()).sheet("街镇村立案情况考核分数统计表").head(listHeader).doWrite(listData);
}
@ApiOperation(value = "导出excel(人口管理)", notes = "导出excel(人口管理)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("excelpersonscore")
public void excelPersonScore(HttpServletResponse response) throws Exception {
Map<String, Object> params = requestParams();
String excelName = params.get("year") + ""+ params.get("quarter") +"季度街镇村人口管理分数统计表";
String fileName = URLEncoder.encode(excelName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"街镇村","录入总数","人口预估","总得分"};
List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
}
ListPage page = new ListPage();
SuccessResultList<List<DictDTO>> successResultList = personScore(page);
List<DictDTO> dictDTOS = successResultList.getRows();
List<List<Object>> listData = new ArrayList<>();
for (DictDTO dto : dictDTOS) {
List<Object> data = new ArrayList<>();
data.add(dto.getName());
data.add(dto.getInsertCount() == null ? 0 : dto.getInsertCount());
data.add(dto.getMsg());
data.add(dto.getScore());
listData.add(data);
}
EasyExcel.write(response.getOutputStream()).sheet("街镇村人口管理分数统计表").head(listHeader).doWrite(listData);
}
}

View File

@ -1,5 +1,7 @@
package com.cm.bigdata.controller.apis.casesupervise;
import com.alibaba.excel.EasyExcel;
import com.cm.bigdata.pojo.dtos.ztree.DictDTO;
import com.cm.bigdata.utils.DateRange;
import com.cm.bigdata.utils.DateUtils;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -161,4 +165,44 @@ public class CaseSuperviseController extends AbstractController {
params.put("endDate", endDate);
params.put("year", year);
}
@ApiOperation(value = "导出excel(案件督察)", notes = "导出excel(案件督察)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("excelpersonscore")
public void excelPersonScore(HttpServletResponse response) throws Exception {
Map<String, Object> params = requestParams();
String excelName = params.get("year") + ""+ params.get("quarter") +"季度街镇村案件督察分数统计表";
String fileName = URLEncoder.encode(excelName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"街镇村","未及时检查案件","未及时结案案件","督察次数","督察扣分/次","扣分","总得分","督察年","督察季度","督察时间"};
List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
}
ListPage page = new ListPage();
SuccessResultList<List<CaseSuperviseDTO>> successResultList = listPageCaseSupervise(page);
List<CaseSuperviseDTO> caseSuperviseDTOS = successResultList.getRows();
List<List<Object>> listData = new ArrayList<>();
for (CaseSuperviseDTO dto : caseSuperviseDTOS) {
List<Object> data = new ArrayList<>();
data.add(dto.getAreaName());
data.add(dto.getInspectCount());
data.add(dto.getCloseCount());
data.add(dto.getDataCount());
data.add(dto.getEveryoneScore());
data.add(dto.getLostScore());
data.add(dto.getScore());
data.add(dto.getYear());
data.add(dto.getQuarter());
data.add(dto.getSuperviseTime());
listData.add(data);
}
EasyExcel.write(response.getOutputStream()).sheet("街镇村案件督察分数统计表").head(listHeader).doWrite(listData);
}
}

View File

@ -1,9 +1,18 @@
package com.cm.bigdata.controller.apis.partyscore;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.row.SimpleRowHeightStyleStrategy;
import com.alibaba.fastjson.JSONArray;
import com.cm.bigdata.config.properties.PartyBuildingProperties;
import com.cm.bigdata.config.properties.ScoreProperties;
import com.cm.bigdata.pojo.dtos.casesupervise.CaseSuperviseDTO;
import com.cm.bigdata.pojo.dtos.configforscore.ConfigForScoreDTO;
import com.cm.bigdata.pojo.dtos.partymeetingscore.ExcelMeetingDTO;
import com.cm.bigdata.pojo.dtos.partymeetingscore.MeetingDTO;
import com.cm.bigdata.pojo.dtos.partymeetingscore.PartyMeetingScoreDTO;
import com.cm.bigdata.pojo.dtos.partyscore.PartyScoreDTO;
@ -11,8 +20,10 @@ import com.cm.bigdata.pojo.dtos.scoredetail.ScoreDetailDTO;
import com.cm.bigdata.pojo.vos.scoredetail.ScoreDetailVO;
import com.cm.bigdata.service.configforscore.IConfigForScoreService;
import com.cm.bigdata.service.scoredetail.IScoreDetailService;
import com.cm.bigdata.utils.ColumnWidthStrategy;
import com.cm.bigdata.utils.DateRange;
import com.cm.bigdata.utils.DateUtils;
import com.cm.bigdata.utils.MergeStrategy;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.SearchException;
@ -20,10 +31,14 @@ import com.cm.common.plugin.oauth.token.ClientTokenManager;
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResultList;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.util.StringUtils;
@ -33,6 +48,10 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import javax.servlet.http.HttpServletResponse;
import javax.swing.filechooser.FileSystemView;
import java.io.File;
import java.net.URLEncoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -358,4 +377,151 @@ public class PartyScoreController extends AbstractController {
scoreDetailService.saveScoreDetail(scoreDetailVO);
}
}
@ApiOperation(value = "导出excel(案件督察)", notes = "导出excel(案件督察)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("excelpersonscore")
public String excelPersonScore(HttpServletResponse response) throws Exception {
Map<String, Object> params = requestParams();
File desktopDir = FileSystemView.getFileSystemView() .getHomeDirectory();
String desktopPath = desktopDir.getAbsolutePath();
String excelName = desktopPath + "\\" + params.get("year") + ""+ params.get("quarter") +"季度街镇村党组织建设分数统计表.xlsx";
ListPage page = new ListPage();
List<PartyScoreDTO> partyScoreDTOS = partyMeetingScore(page);
List<ExcelMeetingDTO> excelMeetingDTOS = Lists.newArrayList();
if(!StringUtils.isEmpty(params.get("quarter"))) {
if("1".equals(params.get("quarter").toString())) {
for(PartyScoreDTO dto: partyScoreDTOS) {
for(MeetingDTO meetingDTO: dto.getPartyMeetingScoreDTO1().getMeetingList()) {
ExcelMeetingDTO excelMeetingDTO = new ExcelMeetingDTO();
excelMeetingDTO.setAreaName(dto.getAreaName());
excelMeetingDTO.setMeetingType(meetingDTO.getCategoryName());
excelMeetingDTO.setShouldCount(meetingDTO.getShouldCount());
excelMeetingDTO.setCount(meetingDTO.getCounts().toString());
excelMeetingDTO.setScore(dto.getPartyMeetingScoreDTO1().getScore().toString());
excelMeetingDTOS.add(excelMeetingDTO);
}
}
}else if("2".equals(params.get("quarter").toString())) {
for(PartyScoreDTO dto: partyScoreDTOS) {
for(MeetingDTO meetingDTO: dto.getPartyMeetingScoreDTO2().getMeetingList()) {
ExcelMeetingDTO excelMeetingDTO = new ExcelMeetingDTO();
excelMeetingDTO.setAreaName(dto.getAreaName());
excelMeetingDTO.setMeetingType(meetingDTO.getCategoryName());
excelMeetingDTO.setShouldCount(meetingDTO.getShouldCount());
excelMeetingDTO.setCount(meetingDTO.getCounts().toString());
excelMeetingDTO.setScore(dto.getPartyMeetingScoreDTO2().getScore().toString());
excelMeetingDTOS.add(excelMeetingDTO);
}
}
}else if("3".equals(params.get("quarter").toString())) {
for(PartyScoreDTO dto: partyScoreDTOS) {
for(MeetingDTO meetingDTO: dto.getPartyMeetingScoreDTO3().getMeetingList()) {
ExcelMeetingDTO excelMeetingDTO = new ExcelMeetingDTO();
excelMeetingDTO.setAreaName(dto.getAreaName());
excelMeetingDTO.setMeetingType(meetingDTO.getCategoryName());
excelMeetingDTO.setShouldCount(meetingDTO.getShouldCount());
excelMeetingDTO.setCount(meetingDTO.getCounts().toString());
excelMeetingDTO.setScore(dto.getPartyMeetingScoreDTO3().getScore().toString());
excelMeetingDTOS.add(excelMeetingDTO);
}
}
}else if("4".equals(params.get("quarter").toString())) {
for(PartyScoreDTO dto: partyScoreDTOS) {
for(MeetingDTO meetingDTO: dto.getPartyMeetingScoreDTO4().getMeetingList()) {
ExcelMeetingDTO excelMeetingDTO = new ExcelMeetingDTO();
excelMeetingDTO.setAreaName(dto.getAreaName());
excelMeetingDTO.setMeetingType(meetingDTO.getCategoryName());
excelMeetingDTO.setShouldCount(meetingDTO.getShouldCount());
excelMeetingDTO.setCount(meetingDTO.getCounts().toString());
excelMeetingDTO.setScore(dto.getPartyMeetingScoreDTO4().getScore().toString());
excelMeetingDTOS.add(excelMeetingDTO);
}
}
}
}
List<List<Object>> data = Lists.newArrayList();
excelMeetingDTOS.forEach(d -> data.add(Lists.newArrayList(d.getAreaName(), d.getMeetingType(), d.getShouldCount(), d.getCount(), d.getScore())));
MergeStrategy mergeStrategy = new MergeStrategy(3, 3);
ExcelWriter excelWriter = EasyExcel.write(excelName)
// 设置统一的表头表内容样式
.registerWriteHandler(style())
// 设置表头表内容的行高
.registerWriteHandler(new SimpleRowHeightStyleStrategy((short) 50, (short) 20))
.build();
WriteSheet sheet1 = EasyExcel.writerSheet(0, "党组织建设")
// 指定这个sheet的每个列的宽度
.registerWriteHandler(new ColumnWidthStrategy())
.registerWriteHandler(mergeStrategy)
// 自定义多级复杂表头
.head(scoreHead(params))
.build();
excelWriter.write(data, sheet1);
excelWriter.finish();
return "success";
}
public HorizontalCellStyleStrategy style() {
// 头的样式
WriteCellStyle headStyle = new WriteCellStyle();
headStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
WriteFont headFont = new WriteFont();
headFont.setBold(true);
headFont.setFontHeightInPoints((short) 16);
headStyle.setWriteFont(headFont);
headStyle.setWrapped(true);
// 内容的样式
WriteCellStyle contentStyle = new WriteCellStyle();
contentStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
contentStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
WriteFont contentWriteFont = new WriteFont();
contentWriteFont.setFontHeightInPoints((short) 12);
contentStyle.setWriteFont(contentWriteFont);
contentStyle.setBorderTop(BorderStyle.THIN);
contentStyle.setBorderBottom(BorderStyle.THIN);
contentStyle.setBorderLeft(BorderStyle.THIN);
contentStyle.setBorderRight(BorderStyle.THIN);
contentStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
contentStyle.setVerticalAlignment(VerticalAlignment.CENTER);
contentStyle.setWrapped(true);
return new HorizontalCellStyleStrategy(headStyle, contentStyle);
}
private static List<List<String>> scoreHead(Map<String, Object> params) {
List<List<String>> list = Lists.newArrayList();
List<String> head0 = Lists.newArrayList();
List<String> head1 = Lists.newArrayList();
List<String> head2 = Lists.newArrayList();
List<String> head3 = Lists.newArrayList();
List<String> head4 = Lists.newArrayList();
String title = params.get("year") + "" + params.get("quarter") + "季度";
head0.add(title);
head0.add("街镇村");
head1.add(title);
head1.add("类型");
head2.add(title);
head2.add("应上报数");
head3.add(title);
head3.add("实际上报");
head4.add(title);
head4.add("总分");
list.add(head0);
list.add(head1);
list.add(head2);
list.add(head3);
list.add(head4);
return list;
}
}

View File

@ -1,5 +1,7 @@
package com.cm.bigdata.controller.apis.scoredetail;
import com.alibaba.excel.EasyExcel;
import com.cm.bigdata.pojo.dtos.ztree.DictDTO;
import com.cm.bigdata.utils.DateRange;
import com.cm.bigdata.utils.DateUtils;
import com.cm.common.annotation.CheckRequestBodyAnnotation;
@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@ -161,4 +165,38 @@ public class ScoreDetailController extends AbstractController {
params.put("endDate", endDate);
params.put("year", year);
}
@ApiOperation(value = "导出excel(考核统计)", notes = "导出excel(考核统计)接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("excelresult")
public void excelResult(HttpServletResponse response) throws Exception {
Map<String, Object> params = requestParams();
String excelName = params.get("year") + ""+ params.get("quarter") +"季度街镇村最终考核分数统计表";
String fileName = URLEncoder.encode(excelName, "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
String [] headers = {"街镇村","考核年","考核季度","最终得分"};
List<List<String>> listHeader = new ArrayList<>();
for(String item : headers) {
List<String> title = new ArrayList<>();
title.add(item);
listHeader.add(title);
}
ListPage page = new ListPage();
SuccessResultList<List<ScoreDetailDTO>> successResultList = listPageScoreDetail(page);
List<ScoreDetailDTO> scoreDetailDTOS = successResultList.getRows();
List<List<Object>> listData = new ArrayList<>();
for (ScoreDetailDTO dto : scoreDetailDTOS) {
List<Object> data = new ArrayList<>();
data.add(dto.getAreaName());
data.add(dto.getYear());
data.add(dto.getQuarter());
data.add(dto.getGetScore());
listData.add(data);
}
EasyExcel.write(response.getOutputStream()).sheet("街镇村最终考核分数").head(listHeader).doWrite(listData);
}
}

View File

@ -0,0 +1,61 @@
package com.cm.bigdata.pojo.dtos.partymeetingscore;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 29492
*/
public class ExcelMeetingDTO {
@ApiModelProperty(name = "areaName", value = "街镇村名称")
private String areaName;
@ApiModelProperty(name = "meetingType", value = "会议类型")
private String meetingType;
@ApiModelProperty(name = "shouldCount", value = "应上报数量")
private String shouldCount;
@ApiModelProperty(name = "count", value = "实际上报数量")
private String count;
@ApiModelProperty(name = "score", value = "得分")
private String score;
public String getAreaName() {
return areaName == null ? "" : areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
public String getMeetingType() {
return meetingType == null ? "" : meetingType;
}
public void setMeetingType(String meetingType) {
this.meetingType = meetingType;
}
public String getShouldCount() {
return shouldCount == null ? "" : shouldCount;
}
public void setShouldCount(String shouldCount) {
this.shouldCount = shouldCount;
}
public String getCount() {
return count == null ? "" : count;
}
public void setCount(String count) {
this.count = count;
}
public String getScore() {
return score == null ? "" : score;
}
public void setScore(String score) {
this.score = score;
}
}

View File

@ -0,0 +1,34 @@
package com.cm.bigdata.utils;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.style.column.AbstractHeadColumnWidthStyleStrategy;
/**
* @author 29492
*/
public class ColumnWidthStrategy extends AbstractHeadColumnWidthStyleStrategy {
@Override
protected Integer columnWidth(Head head) {
Integer columnIndex = head.getColumnIndex();
switch (columnIndex) {
case 0:
// 班级
return 20;
case 1:
// 姓名
return 30;
case 2:
// 学科
return 20;
case 3:
// 选择题
return 20;
case 4:
// 阅读题
return 10;
default:
return 20;
}
}
}

View File

@ -0,0 +1,45 @@
package com.cm.bigdata.utils;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.write.merge.AbstractMergeStrategy;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
/**
* @author renpc
*/
public class MergeStrategy extends AbstractMergeStrategy {
private final int subjectLength;
private final int nameLength;
private int nextMerge1 = 0;
private int nextMerge2 = 0;
public MergeStrategy(int subjectLength, int nameLength) {
this.subjectLength = subjectLength;
this.nameLength = nameLength;
}
@Override
protected void merge(Sheet sheet, Cell cell, Head head, int relativeRowIndex) {
// 由于每个单元格单元格都会调用该方法为了避免重复合并异常只在应合并的行列执行即可
// relativeRowIndex == 0即表内容的第一行除去表头
if (cell.getColumnIndex() == 0) {
if (relativeRowIndex == 0 || relativeRowIndex == nextMerge1) {
int lastRow = (subjectLength * nameLength) - 1;
nextMerge1 = relativeRowIndex + lastRow;
CellRangeAddress cellRangeAddress = new CellRangeAddress(cell.getRowIndex(), cell.getRowIndex() + lastRow - 1, 0, 0);
sheet.addMergedRegionUnsafe(cellRangeAddress);
}
} else if (cell.getColumnIndex() == 4) {
if (relativeRowIndex == 0 || relativeRowIndex == nextMerge2) {
int lastRow = (subjectLength * nameLength) - 1;
nextMerge2 = relativeRowIndex + lastRow;
CellRangeAddress cellRangeAddress = new CellRangeAddress(cell.getRowIndex(), cell.getRowIndex() + lastRow - 1, 4, 4);
sheet.addMergedRegionUnsafe(cellRangeAddress);
}
}
}
}

View File

@ -86,7 +86,6 @@
v2Str = '第四季度'
}
top.dialog.msg('确定要导出'+v1+'年'+v2Str+'的数据吗?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
@ -150,7 +149,6 @@
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'areaName', width: 150, title: '街镇村', align:'center',
templet: function(row) {

View File

@ -87,7 +87,6 @@
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'userName', width: 150, title: '姓名', align:'center',
templet: function(row) {

View File

@ -109,7 +109,6 @@
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'areaName', width: 150, title: '街镇村', align:'center',
templet: function(row) {

View File

@ -150,6 +150,50 @@
var tableUrl = 'api/partyscore/partymeetingscore';
var yearDate = new Date().getFullYear();
$(document).on('click', '#excel', function() {
var year = $('#year').val();
var quarter = $('#quarter').val();
excel(year,quarter);
});
function excel(v1,v2){
if(v1 === ''){
layer.msg('请选择导出数据年份')
}
if(v2 === ''){
layer.msg('请选择导出数据季度')
}
var v2Str = "";
if(v2 === '1'){
v2Str = '第一季度'
}
if(v2 === '2'){
v2Str = '第二季度'
}
if(v2 === '3'){
v2Str = '第三季度'
}
if(v2 === '4'){
v2Str = '第四季度'
}
top.dialog.msg('确定要导出'+v1+'年'+v2Str+'的数据吗?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
top.restAjax.get(top.restAjax.path('api/partyscore/excelpersonscore?year={year}&quarter={quarter}', [v1,v2]), {}, null, function(code, data) {
if(data == 'success') {
top.dialog.msg('已成功下载文件到电脑桌面');
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
});
}
var vue = new Vue({
el: '#app',
data: {

View File

@ -57,6 +57,44 @@
var tableUrl = 'api/bossscore/personscore?dictId={dictId}';
var dictId = '9d179f05-3ea0-48f7-853c-d3b7124b791c';
$(document).on('click', '#excel', function() {
var year = $('#year').val();
var quarter = $('#quarter').val();
excel(year,quarter);
});
function excel(v1,v2){
if(v1 === ''){
layer.msg('请选择导出数据年份')
}
if(v2 === ''){
layer.msg('请选择导出数据季度')
}
var v2Str = "";
if(v2 === '1'){
v2Str = '第一季度'
}
if(v2 === '2'){
v2Str = '第二季度'
}
if(v2 === '3'){
v2Str = '第三季度'
}
if(v2 === '4'){
v2Str = '第四季度'
}
top.dialog.msg('确定要导出'+v1+'年'+v2Str+'的数据吗?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
window.open(top.restAjax.path('api/bossscore/excelpersonscore?year={year}&quarter={quarter}&dictId={dictId}', [v1, v2, dictId]));
}
});
}
function quarterFun(value){
$("#quarter").empty();
var date;
@ -109,7 +147,6 @@
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'name', width: 150, title: '名称', align:'center',
templet: function(row) {

View File

@ -59,6 +59,44 @@
var resizeTimeout = null;
var tableUrl = 'api/scoredetail/listpagescoredetail';
$(document).on('click', '#excel', function() {
var year = $('#year').val();
var quarter = $('#quarter').val();
excel(year,quarter);
});
function excel(v1,v2){
if(v1 === ''){
layer.msg('请选择导出数据年份')
}
if(v2 === ''){
layer.msg('请选择导出数据季度')
}
var v2Str = "";
if(v2 === '1'){
v2Str = '第一季度'
}
if(v2 === '2'){
v2Str = '第二季度'
}
if(v2 === '3'){
v2Str = '第三季度'
}
if(v2 === '4'){
v2Str = '第四季度'
}
top.dialog.msg('确定要导出'+v1+'年'+v2Str+'的数据吗?', {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function (index) {
top.dialog.close(index);
window.open(top.restAjax.path('api/bossscore/excelworknote?year={year}&quarter={quarter}', [v1,v2]));
}
});
}
function quarterFun(value){
$("#quarter").empty();
var date;