8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png
打印示例 V8
admin 1月前

打印示例功能

var rec, recs = app.dataGrid.getSelection();
if (recs.length != 1) {
  Wb.warn('请选择1条记录。');
  return;
}
rec = recs[0];
var order_num = 0;
Cs.info('rec-----------', rec);

// 是否用印
app.isseal_tr = '';
if ( rec.data.IS_SEAL == '0' ){
  app.isseal_tr = '<tr>' +
				'<td style="width:110px;">是否用印</td>' +
				'<td style="width:255px; text-align:left;" colspan="3" id="A_IS_SEAL">' +
				'<input type="radio" style="margin:10px;" checked /><label>是</label>' +
				'<input type="radio" style="margin-left:50px;" /><label>否</label>' +
				'</td>' +
			'</tr>' +
			'<tr>' +
				'<td style="width:110px;">发往单位</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_SEND_CUST_ID">' + getNoNullValue(rec.data.SEND_CUST_ID) + '</td>' +
				'<td style="width:110px" id="A_TIME_LM103080">印章名称</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_SEAL_NAME">' + getNoNullValue(getSEALNAME(rec.data.SEAL_NAME)) + '</td>' +
			'</tr>' +
			'<tr>' +
				'<td style="width:110px;">用印内容</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_SEAL_CONTENT">' + getNoNullValue(rec.data.SEAL_CONTENT) + '</td>' +
				'<td style="width:110px" id="A_TIME_LM103080">用印份数</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_SEAL_NUMBER">' + getNoNullValue(rec.data.SEAL_NUMBER) + '</td>' +
			'</tr>';
} else {
  app.isseal_tr = '<tr>' +
				'<td style="width:110px;">是否用印</td>' +
				'<td style="width:255px; text-align:left;" colspan="3" id="A_IS_SEAL">' +
				'<input type="radio" style="margin:10px;" /><label>是</label>' +
				'<input type="radio" style="margin-left:50px;" checked /><label>否</label>' +
				'</td>' +
                '</tr>';
}
Cs.info('用印完成');

// 打印日期
var print_date = new Date();
Cs.info('打印日期开始', print_date);
print_date = print_date.toLocaleString('zh', { hour12:false }).replace(/\//g,'-');

Cs.info('打印日期完成', print_date);

//附件
app.file_tr = '';
Wb.request({
  url: 'm?xwl=liquidity_fxgl/workflow/T_COMMENTS/select_files',
  params: {
    OBJECT_ID: rec.data.APPLY_ID
  },
  success: function(resp) {
    var rows = Wb.decode(resp.responseText).rows;
    Wb.each(rows, function(row, i) {
      app.file_tr += getNoNullValue(row.NAME)+ '.' + getNoNullValue(row.EXTENSION) + '<br>';
    });
  order_num +=1;
 Cs.info(order_num);
    if ( order_num == '3' ){
      arry.sort(getSortFun('desc', 'COMMENT_TIME'));
      Cs.info('1', arry);
      var index = 0;
      Wb.each(arry, function(data, i) {
        index = i + 1;
        app.table_tr += '<tr>' +
          '<td>' + index + '</td>' +
          '<td style="width:260px">' + getNoNullValue(data.REMARK) + '</div></td>' +
          '<td style="width:100px">' + getNoNullValue(data.NODE) + '</td>' +
          '<td style="width:140px">' + getNoNullValue(data.COMMENT_USER) + '</td>' +
          '<td style="width:140px">' + getNoNullValue(data.COMMENT_TIME) + '</td>' +
          '</tr>';
      });
      // 打印
      getPrint(rec, app.isseal_tr, app.file_tr, app.table_tr, print_date);
    }
  }
});


//流程审批意见
var arry = [];
app.table_tr = '';
Wb.request({
  url: 'newService/standard/json',
  params: {
    flowInstId: rec.data.PROCESS_ID,
    transCode: 'flow.flowPassNodeAction'
  },
  success: function(resp) {
    var rspData = Wb.decode(resp.responseText).rspData;
    Cs.info(rspData);
    Wb.each(rspData.flowPassNodeList, function(row) {
      if (row.nodeDealUsers) {
        Wb.each(row.nodeDealUsers, function(node) {
          if (node.status != '1') {
            var remark, userType;
            if (row.flowNodeInstEObj.nodeName == '开始节点') {
              remark = '发起申请';
              if (rec.RELATE_RES_PROCESS_ID) {
                return;
              }
            } else {
              remark = node.remark;
            }
            switch (node.userType) {
              case '1':
                userType = '普通用户';
                break;
              case '2':
                userType = '协办用户';
                break;
              case '3':
                userType = '转办用户';
                break;
              case '4':
                userType = '辅助用户';
                break;
              case '6':
                userType = '委托用户';
                break;
              default:
                userType = '';
            }

            if (row.flowNodeInstEObj.nodeName != '开始节点') {
              arry.push({
                FLOW_ID: row.flowNodeInstEObj.flowInstId,
                REMARK: remark,
                COMMENT_DATE:node.dealTime,
                COMMENT_USER: node.displayName + '(' + node.userName + ')',
                COMMENT_TIME: new Date(node.dealTime).toLocaleString().replace(/:\d{1,2}$/, ' '),
                NODE: row.flowNodeInstEObj.nodeName,
                ACT: node.actionText,
                USERTYPE: userType
              });
            }

          }
        });
      }
    });
    order_num +=1;
    Cs.info(order_num);
    if ( order_num == '3' ){
      arry.sort(getSortFun('desc', 'COMMENT_TIME'));
      Cs.info('1', arry);
      var index = 0;
      Wb.each(arry, function(data, i) {
        index = i + 1;
        app.table_tr += '<tr>' +
          '<td>' + index + '</td>' +
          '<td style="width:260px">' + getNoNullValue(data.REMARK) + '</div></td>' +
          '<td style="width:100px">' + getNoNullValue(data.NODE) + '</td>' +
          '<td style="width:140px">' + getNoNullValue(data.COMMENT_USER) + '</td>' +
          '<td style="width:140px">' + getNoNullValue(data.COMMENT_TIME) + '</td>' +
          '</tr>';
      });
      // 打印
      getPrint(rec, app.isseal_tr, app.file_tr, app.table_tr, print_date);
    }
  }
});

//抄送
Wb.request({
  url: 'm?xwl=liquidity_fxgl/workflow/T_COMMENTS/select_cc_comments_new',
  params: {
    I_PROCESS_ID: rec.data.PROCESS_ID
  },
  success: function(resp) {
    var rows = Wb.decode(resp.responseText).rows;
    Cs.info(rows);
    Wb.each(rows, function(row) {
      console.log('???????????????????????????????????????????');
      console.log(row);
      console.log('???????????????????????????????????????????');
      var act = '';
      if (Wb.isEmpty(row.DEAL_TIME)) {
        act = '被转发';
      } else {
        act = '已阅';
      }
      var COMMENT_TIME = row.DEAL_TIME ? new Date(row.DEAL_TIME).toLocaleString().replace(/:\d{1,2}$/, ' ') : new Date(row.CREATE_TIME).toLocaleString().replace(/:\d{1,2}$/, ' ');

      arry.push({
        FLOW_ID: row.FLOW_INST_ID,
        REMARK: row.REMARK_CONTENT,
        COMMENT_DATE:row.DEAL_TIME ?row.DEAL_TIME:row.CREATE_TIME,
        COMMENT_USER: row.DISPLAY_NAME + '(' + row.USER_NAME + ')',
        COMMENT_TIME: COMMENT_TIME,
        NODE: '查阅人',
        ACT: act,
        USERTYPE: '普通用户'
      });
    });
    order_num +=1;
    Cs.info(order_num);
    if ( order_num == '3' ){
      arry.sort(getSortFun('desc', 'COMMENT_TIME'));
      Cs.info('1', arry);
      var index = 0;
      Wb.each(arry, function(data, i) {
        index = i + 1;
        app.table_tr += '<tr>' +
          '<td>' + index + '</td>' +
          '<td style="width:260px">' + getNoNullValue(data.REMARK) + '</div></td>' +
          '<td style="width:100px">' + getNoNullValue(data.NODE) + '</td>' +
          '<td style="width:140px">' + getNoNullValue(data.COMMENT_USER) + '</td>' +
          '<td style="width:140px">' + getNoNullValue(data.COMMENT_TIME) + '</td>' +
          '</tr>';
      });
      // 打印
      getPrint(rec, app.isseal_tr, app.file_tr, app.table_tr, print_date);
    }
  }
});

function getPrint(rec, isseal_tr, file_tr, table_tr, print_date) {
  var remarksTable =
    '<div id="print_element_remark">' +
	'<div class="expense_detail_title" style="text-align:center;font-size:18px;font-weight:bold;" id="a1">银行授信材料申请单</div>' +
	'<table id="tb118000" class="expense_detail_table2" border="1px solid #000" style="border:1px solid #000; border-collapse:collapse" cellspacing="0" cellpadding="5">' +
		'<tbody>' +
			'<tr id="title">' +
				'<td style="width:110px" colspan="1">标题</td>' +
				'<td style="width:610px; text-align:left;" colspan="3" id="A_TITLE">银行授信材料申请单-' + rec.data.DEPT_NAME + '-' + rec.data.BUSI_DATE + '(单据编号:' + rec.data.SEQ_ID + ')</td>' +
			'</tr>' +
			'<tr>' +
				'<td style="width:110px;">申请人</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_USER_NAME">' + getNoNullValue(rec.data.APPLY_USER_NAME) + '</td>' +
				'<td style="width:110px" id="A_TIME_LM103080">申请部门</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_DEPT_NAME">' + getNoNullValue(rec.data.DEPT_NAME) + '</td>' +
			'</tr>' +
			'<tr>' +
				'<td style="width:110px;">申请日期</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_BUSI_DATE">' + getNoNullValue(rec.data.BUSI_DATE) + '</td>' +
				'<td style="width:110px" id="A_TIME_LM103080">记账编号</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_SEQ_ID">' + getNoNullValue(rec.data.SEQ_ID) + '</td>' +
			'</tr>' +
			'<tr>' +
				'<td style="width:110px;">授信银行</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_CUST_NAME">' + getNoNullValue(rec.data.CUST_NAME) + '</td>' +
				'<td style="width:110px" id="A_TIME_LM103080">授信机构管理部门</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_CUST_MNG_DEPT_NAME">' + getNoNullValue(rec.data.CUST_MNG_DEPT_NAME) + '</td>' +
			'</tr>' +
			'<tr>' +
				'<td style="width:110px;">授信管理机构联系人</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_CUST_CONTRACT_USER">' + getNoNullValue(rec.data.CUST_CONTRACT_USER) + '</td>' +
				'<td style="width:110px" id="A_TIME_LM103080">授信管理机构联系方式</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_CUST_CONTRACT_PHONE">' + getNoNullValue(rec.data.CUST_CONTRACT_PHONE) + '</td>' +
			'</tr>' +
            isseal_tr +
			'<tr>' +
				'<td style="width:110px;">最终审批人</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_FINAL_APPROVER">' + getNoNullValue(getFINALAPPROVER(rec.data.FINAL_APPROVER)) + '</td>' +
				'<td style="width:110px" id="A_TIME_LM103080">附件</td>' +
				'<td style="width:255px; text-align:left;" colspan="1" id="A_FILE">' + getNoNullValue(file_tr) + '</td>' +
			'</tr>' +
			'<tr>' +
            '<td style="width:110px" id="A_TIME_LM103080">申请理由</td>' +
				'<td style="width:720px; text-align:left;" colspan="3" id="A_ALLOCATE_PURPOSE">' + getNoNullValue(rec.data.APPLY_REASON) + '</td>' +
			'</tr>' +
		'</tbody>' +
	'</table>' +
	'<br>' +
	'<div class="expense_detail_section" id="remar_detail_LM103080">' +
		'<div class="expense_detail_title" style="text-align:center;" id="A_APPLY_FILE">授信所需材料</div>' +
		'<div style="border:1px solid #000; border-collapse:collapse">' +
		'<table id="send_table" class="expense_detail_table2" style="border:0px solid #000; border-collapse:collapse; margin:10px;" cellspacing="0" cellpadding="5">' +
			'<tbody>' +
				'<tr>' +
					'<td style="width:120px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,0,1) + ' /><label>营业执照正本</label></td>' +
					'<td style="width:130px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,1,2) + ' /><label>营业执照副本</label></td>' +
					'<td style="width:125px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,2,3) + ' /><label>金融许可证正本</label></td>' +
					'<td style="width:130px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,3,4) + ' /><label>金融许可证副本</label></td>' +
					'<td style="width:140px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,4,5) + ' /><label>开户许可证</label></td>' +
				'</tr>' +
				'<tr>' +
					'<td style="width:120px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,5,6) + ' /><label>信用代码</label></td>' +
					'<td style="width:130px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,6,7) + ' /><label>法人身份证</label></td>' +
					'<td style="width:125px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,7,8) + ' /><label>公司章程</label></td>' +
					'<td style="width:130px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,8,9) + ' /><label>公司简介</label></td>' +
					'<td style="width:140px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,9,10) + ' /><label>董事会成员列表</label></td>' +
				'</tr>' +
				'<tr>' +
					'<td style="width:120px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,10,11) + ' /><label>公司高管简历</label></td>' +
					'<td style="width:130px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,11,12) + ' /><label>公司组织结构图</label></td>' +
					'<td style="width:125px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,12,13) + ' /><label>验资报告</label></td>' +
					'<td style="width:130px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,13,14) + ' /><label>近一季财务报表</label></td>' +
					'<td style="width:140px;text-align:left;"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,14,15) + ' /><label>近一季净资本报表</label></td>' +
				'</tr>' +
				'<tr>' +
					'<td style="width:120px;text-align:left;" colspan="3"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,19,20) + ' /><label>证监会公布的最新年度分类结果</label></td>' +
					'<td style="width:130px;text-align:left;" colspan="2"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,20,21) + ' /><label>部分主要合作银行授信情况表</label></td>' +
				'</tr>' +
				'<tr>' +
					'<td style="width:120px;text-align:left;" colspan="1"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,22,23) + ' /><label>其他</label></td>' +
					'<td style="width:140px;text-align:left;border-bottom:1px solid #000" colspan="3">' + getAPPLYFILEA(rec.data.APPLY_FILE,22,23,rec.data.OTHER_REPORT) + '</td>' +
				'</tr>' +
				'<tr>' +
					'<td style="width:120px;text-align:left;" colspan="1"><input type="checkbox" style="margin-left:5px;margin-bottom:10px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,23,24) + ' /><label>净资本报告</label></td>' +
					'<td style="width:140px;text-align:left;border-bottom:1px solid #000" colspan="3">' + getAPPLYFILEA(rec.data.APPLY_FILE,23,24,rec.data.SRIS_REPORT) + '</td>' +
				'</tr>' +
				'<tr>' +
					'<td style="width:120px;text-align:left;" colspan="1"><input type="checkbox" style="margin-left:5px;margin-bottom:2px;" ' + getAPPLYFILE(rec.data.APPLY_FILE,24,25) + ' /><label>审计报告</label></td>' +
					'<td style="width:120px;text-align:left;border-bottom:1px solid #000" colspan="3">' + getAPPLYFILEA(rec.data.APPLY_FILE,24,25,rec.data.AUDIT_REPORT) + '</td>' +
				'</tr>' +
			'</tbody>' +
		'</table>' +
		'</div>' +
	'</div>' +
	'<br>' +
	'<div class="expense_detail_section" id="remar_detail_LM103080">' +
		'<div class="expense_detail_title" style="text-align:center;" id="remar_detail_title_LM118000">流程审批意见</div>' +
		'<table class="expense_detail_table2" id="remar_detail_table" border="1px solid #000" style="border:1px solid #000; border-collapse:collapse" cellspacing="0" cellpadding="5">' +
			'<tbody>' +
				'<tr>' +
					'<td style="width:50px;"></td>' +
					'<td style="width:260px; ">审批意见</td>' +
					'<td style="width:100px;">节点名称</td>' +
					'<td style="width:140px;">审批人员</td>' +
					'<td style="width:140px;">审批时间</td>' +
				'</tr>' +
             table_tr +
			'</tbody>' +
		'</table>' +
	'</div>' +
'</div>';

  $('#remar_detail').empty();
  $('#print_element_remark').empty();
  $('#print_element_remark').append(remarksTable);
  //editWin show  时候 取备注数据
  // $('#print_element_remark #remar_detail_table').append(table_tr);
  
  // document.getElementById('A_FILE').innerHTML = file_tr;


  $('#print_element .page_footer #expense_print_date .item_content').text(print_date);

  // 打印
  var printPaper = document.getElementById('print_element').cloneNode(true);
  Cs.info(printPaper.innerHTML);
  Wb.print(printPaper.innerHTML, '');
}

function getSEALNAME(nums) {
  var SEALNAME;
  switch (nums) {
    case '0':
      SEALNAME = '公章';
      break;
    case '1':
      SEALNAME = '公章+法人章';
      break;
    default :
      SEALNAME = nums;
  }
  return SEALNAME;
}

function getFINALAPPROVER(nums) {
  var FINALAPPROVER;
  switch (nums) {
    case '0':
      FINALAPPROVER = '计财部分管领导';
      break;
    case '1':
      FINALAPPROVER = '总经理';
      break;
    case '2':
      FINALAPPROVER = '董事长';
      break;
    default :
      FINALAPPROVER = nums;
  }
  return FINALAPPROVER;
}

function getAPPLYFILE(apply, start, end) {
  var APPLYFILE;
  switch (apply.substring(start,end)) {
    case '0':
      APPLYFILE = ' ';
      break;
    case '1':
      APPLYFILE = 'checked';
      break;
  }
  return APPLYFILE;
}

// 
function getAPPLYFILEA(apply, start, end, report) {
  var APPLYFILE;
  switch (apply.substring(start,end)) {
    case '0':
      APPLYFILE = ' ';
      break;
    case '1':
      APPLYFILE = report;
      break;
  }
  return APPLYFILE;
}

function getNoNullValue(value) {
  return value ? value : "";
}

function getSortFun(order, sortBy) {
  var ordAlpah = order == "asc" ? ">=" : "<=";
  var sortFun = new Function(
    "a",
    "b",
    "return Date.parse(new Date(a." + sortBy + ").toString())" + ordAlpah + "Date.parse(new Date(b." + sortBy + ").toString())" + "?1:-1"
  );
  return sortFun;
}
最新回复 (0)
    • 朕弟分享 | 专注小众,乐于分享!
      2
          
返回
发新帖 搜索 反馈 回顶部