|
@@ -1630,6 +1630,145 @@ app.controller("formeditCtrl", ["$scope", "$http", "$timeout", "$interval", "$sc
|
|
|
sp.layerhide()
|
|
|
}
|
|
|
|
|
|
+ self.printEXCEL = function () {
|
|
|
+ self.columns = [
|
|
|
+ { header: "姓名", key: "XM", width: 20 },
|
|
|
+ { header: "单位", key: "DW", width: 30 },
|
|
|
+ { header: "职务", key: "ZW", width: 30 },
|
|
|
+ { header: "性别", key: "XB", width: 20 },
|
|
|
+ { header: "出生年月", key: "CSNY", width: 30 },
|
|
|
+ { header: "最高学历学位", key: "ZGXL", width: 30 },
|
|
|
+ { header: "毕业院校", key: "BYYX", width: 30 },
|
|
|
+ { header: "专业", key: "ZY", width: 35 },
|
|
|
+ { header: "参加工作时间", key: "CJGZSJ", width: 30 },
|
|
|
+ { header: "入党时间", key: "RDSJ", width: 30 },
|
|
|
+ { header: "是否有巡视巡察经验", key: "XSXCJY", width: 20 },
|
|
|
+ { header: "入库类别", key: "RKLB", width: 20 },
|
|
|
+ { header: "手机", key: "SJ", width: 20 },
|
|
|
+ { header: "备注", key: "BZ", width: 100 }
|
|
|
+ ]
|
|
|
+ self.listExcel = self.rcList.map(function (item) {
|
|
|
+ return {
|
|
|
+ XM: item.XM,
|
|
|
+ DW: item.DW,
|
|
|
+ ZW: item.ZW,
|
|
|
+ XB: item.XB,
|
|
|
+ CSNY: item.CSNY,
|
|
|
+ ZGXL: item.ZGXL,
|
|
|
+ BYYX: item.BYYX,
|
|
|
+ ZY: item.ZY,
|
|
|
+ CJGZSJ: item.CJGZSJ,
|
|
|
+ RDSJ: item.RDSJ,
|
|
|
+ XSXCJY: item.XSXCJY1,
|
|
|
+ RKLB: item.RKLB1,
|
|
|
+ SJ: item.SJ,
|
|
|
+ BZ: item.BZ
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // 创建工作簿
|
|
|
+ var workbook = new ExcelJS.Workbook()
|
|
|
+ // 添加工作表
|
|
|
+ var worksheet = workbook.addWorksheet('sheet1')
|
|
|
+ // 设置表头
|
|
|
+ worksheet.columns = self.columns
|
|
|
+ // 添加表体数据
|
|
|
+ self.listExcel.forEach(function (item) {
|
|
|
+ worksheet.addRow(item)
|
|
|
+ })
|
|
|
+ /**
|
|
|
+ * 设置样式
|
|
|
+ */
|
|
|
+ // 1、设置标题行样式
|
|
|
+ var headerRow = worksheet.getRow(1)
|
|
|
+ // 连续遍历所有非空单元格
|
|
|
+ headerRow.eachCell(function (cell) {
|
|
|
+ // 边框 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E8%BE%B9%E6%A1%86
|
|
|
+ cell.border = {
|
|
|
+ top: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ left: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ bottom: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ right: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ }
|
|
|
+ // 填充 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%A1%AB%E5%85%85
|
|
|
+ cell.fill = {
|
|
|
+ type: 'pattern',
|
|
|
+ pattern: 'solid',
|
|
|
+ fgColor: {
|
|
|
+ argb: '4f81bd'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 字体 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AD%97%E4%BD%93
|
|
|
+ cell.font = {
|
|
|
+ name: '微软雅黑',
|
|
|
+ size: 11,
|
|
|
+ bold: true,
|
|
|
+ color: { argb: '000000' }
|
|
|
+ }
|
|
|
+ // 对齐 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AF%B9%E9%BD%90
|
|
|
+ cell.alignment = {
|
|
|
+ vertical: 'middle',
|
|
|
+ horizontal: 'center'
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 2、设置内容行样式
|
|
|
+ const bodyRow = worksheet.getRows(2, self.listExcel.length + 1)
|
|
|
+ bodyRow.forEach(function (row) {
|
|
|
+ //遍历此列中的所有当前单元格,包括空单元格
|
|
|
+ row.eachCell({ includeEmpty: true }, function (cell) {
|
|
|
+ // 边框
|
|
|
+ cell.border = {
|
|
|
+ top: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ left: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ bottom: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ right: {
|
|
|
+ style: 'thin'
|
|
|
+ },
|
|
|
+ }
|
|
|
+ // 字体 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AD%97%E4%BD%93
|
|
|
+ cell.font = {
|
|
|
+ name: '微软雅黑',
|
|
|
+ size: 11,
|
|
|
+ color: { argb: '000000' }
|
|
|
+ }
|
|
|
+ // 对齐 https://github.com/exceljs/exceljs/blob/HEAD/README_zh.md#%E5%AF%B9%E9%BD%90
|
|
|
+ cell.alignment = {
|
|
|
+ vertical: 'middle',
|
|
|
+ horizontal: 'center'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 导出表格
|
|
|
+ workbook.xlsx.writeBuffer().then(function (buffer) {
|
|
|
+ const blob = new Blob([buffer], {
|
|
|
+ type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
|
|
+ })
|
|
|
+ const link = document.createElement('a')
|
|
|
+ link.href = URL.createObjectURL(blob)
|
|
|
+ link.download = '市住建委党委巡察人才库人选登记表' + sp.format(sp.getLocalDate()) + '.xlsx'
|
|
|
+ link.click()
|
|
|
+ URL.revokeObjectURL(link.href) // 下载完成释放掉blob对象
|
|
|
+ })
|
|
|
+ //})
|
|
|
+ }
|
|
|
+
|
|
|
//签写意见编辑状态
|
|
|
self.opinion = {
|
|
|
WZYLDQFYJ: false,
|