|
@@ -8,6 +8,8 @@
|
|
|
<meta name="decorator" content="default"/>
|
|
<meta name="decorator" content="default"/>
|
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
|
<%--var Srole = "<%= UserUtils.getSelectRole().getName()%>";--%>
|
|
<%--var Srole = "<%= UserUtils.getSelectRole().getName()%>";--%>
|
|
|
|
|
+ // 当前登录用户已下载过的发票ID集合(逗号分隔字符串)
|
|
|
|
|
+ var downloadedInvoiceIds = "${downloadedInvoiceIds}";
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
$(document).ready(function() {
|
|
|
// laydate.render({
|
|
// laydate.render({
|
|
@@ -224,6 +226,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 发票下载点击处理
|
|
|
|
|
+ * 1. 通过隐藏iframe触发文件下载(服务端会自动记录下载成功)
|
|
|
|
|
+ * 2. 延迟后更新当前行的下载状态显示
|
|
|
|
|
+ */
|
|
|
|
|
+ function onInvoiceDownload(invoiceId) {
|
|
|
|
|
+ // 延迟更新UI:等待服务端完成下载记录
|
|
|
|
|
+ setTimeout(function() {
|
|
|
|
|
+ // 将该invoiceId加入已下载集合
|
|
|
|
|
+ if (downloadedInvoiceIds) {
|
|
|
|
|
+ var ids = downloadedInvoiceIds.split(',');
|
|
|
|
|
+ if (ids.indexOf(invoiceId) === -1) {
|
|
|
|
|
+ downloadedInvoiceIds += ',' + invoiceId;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ downloadedInvoiceIds = invoiceId;
|
|
|
|
|
+ }
|
|
|
|
|
+ // 更新表格中对应行的下载状态
|
|
|
|
|
+ try {
|
|
|
|
|
+ var tableData = layui.table.cache['contentTable'];
|
|
|
|
|
+ if (tableData) {
|
|
|
|
|
+ for (var i = 0; i < tableData.length; i++) {
|
|
|
|
|
+ if (tableData[i].id === invoiceId) {
|
|
|
|
|
+ // 更新操作列按钮文字
|
|
|
|
|
+ var row = $("tr[data-index='" + i + "']");
|
|
|
|
|
+ row.find('.btn-xs').each(function() {
|
|
|
|
|
+ var text = $(this).text();
|
|
|
|
|
+ if (text.indexOf('下载所有格式发票') !== -1 || text.indexOf('已下载') !== -1) {
|
|
|
|
|
+ $(this).text('已下载-再次下载').removeClass('btn-primary').addClass('btn-default');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ // 更新下载状态列
|
|
|
|
|
+ var cells = row.find('td');
|
|
|
|
|
+ cells.each(function() {
|
|
|
|
|
+ var cellText = $(this).text().trim();
|
|
|
|
|
+ if (cellText === '未下载') {
|
|
|
|
|
+ $(this).html('<span style="color:green;font-weight:bold;">已下载</span>');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch(e) {
|
|
|
|
|
+ console.log('更新下载状态异常:', e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 3000);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function receiptInvoice(title,url,width,height,target){
|
|
function receiptInvoice(title,url,width,height,target){
|
|
|
|
|
|
|
|
if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
|
|
if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)){//如果是移动端,就使用自适应大小弹窗
|
|
@@ -905,6 +956,17 @@
|
|
|
var xml = "<span style=\"cursor:default;\" class=\"status-label status-label-" + '未上传' + "\" >未上传</span>";
|
|
var xml = "<span style=\"cursor:default;\" class=\"status-label status-label-" + '未上传' + "\" >未上传</span>";
|
|
|
return xml;
|
|
return xml;
|
|
|
}}
|
|
}}
|
|
|
|
|
+ ,{align:'center', title: '下载状态', fixed: 'right', width:80,templet:function(d){
|
|
|
|
|
+ if(d && d.omsAttachmentUrl && d.omsAttachmentUrl.trim() !== '') {
|
|
|
|
|
+ var downloadedSet = downloadedInvoiceIds ? downloadedInvoiceIds.split(',') : [];
|
|
|
|
|
+ if (downloadedSet.indexOf(d.id) !== -1) {
|
|
|
|
|
+ return '<span style="color:green;font-weight:bold;">已下载</span>';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return '<span style="color:#999;">未下载</span>';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }}
|
|
|
,{align:'center', title: '审核状态', fixed: 'right', width:70,templet:function(d){
|
|
,{align:'center', title: '审核状态', fixed: 'right', width:70,templet:function(d){
|
|
|
<%--var st = getAuditState(d.status);--%>
|
|
<%--var st = getAuditState(d.status);--%>
|
|
|
|
|
|
|
@@ -1003,10 +1065,14 @@
|
|
|
var clientName = d.clientName || ''; // 开票单位
|
|
var clientName = d.clientName || ''; // 开票单位
|
|
|
// 编码文件名(核心解决中文乱码)
|
|
// 编码文件名(核心解决中文乱码)
|
|
|
var fileName = encodeURIComponent('dzfp_' + widNumber + '_' + clientName + '_' + invoiceNum + '所有发票格式');
|
|
var fileName = encodeURIComponent('dzfp_' + widNumber + '_' + clientName + '_' + invoiceNum + '所有发票格式');
|
|
|
- // 拼接完整下载地址
|
|
|
|
|
- var downLoadUrl = baseCtx + '/workfullmanage/workFullManage/downLoadOMSInvoiceAttachzip?file=' + fileUrl + '&fileName=' + fileName;
|
|
|
|
|
- // 修正:HTML用class属性(不是className),href拼接转义引号,补充分号
|
|
|
|
|
- xml += "<a href=\"" + downLoadUrl + "\" class=\"btn btn-xs btn-primary\">下载所有格式发票</a>";
|
|
|
|
|
|
|
+ // 拼接完整下载地址(包含invoiceId用于记录下载)
|
|
|
|
|
+ var downLoadUrl = baseCtx + '/workfullmanage/workFullManage/downLoadOMSInvoiceAttachzip?file=' + fileUrl + '&fileName=' + fileName + '&invoiceId=' + d.id;
|
|
|
|
|
+ // 判断是否已下载,显示不同按钮文字
|
|
|
|
|
+ var downloadedSet = downloadedInvoiceIds ? downloadedInvoiceIds.split(',') : [];
|
|
|
|
|
+ var isDownloaded = downloadedSet.indexOf(d.id) !== -1;
|
|
|
|
|
+ var btnText = isDownloaded ? '已下载-再次下载' : '下载所有格式发票';
|
|
|
|
|
+ var btnClass = isDownloaded ? 'btn btn-xs btn-default' : 'btn btn-xs btn-primary';
|
|
|
|
|
+ xml += "<a href=\"" + downLoadUrl + "\" class=\"" + btnClass + "\" onclick=\"onInvoiceDownload('" + d.id + "')\">" + btnText + "</a>";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(d.redInvoice != undefined && d.redInvoice =="1" && Math.sign(d.money) !== -1)
|
|
if(d.redInvoice != undefined && d.redInvoice =="1" && Math.sign(d.money) !== -1)
|