|
|
@ -10,7 +10,7 @@ |
|
|
|
<form class="form-horizontal m" id="form-taxInvoice-uploadRmb" th:object="${taxInvoice}"> |
|
|
|
<input name="taxInvoiceId" th:field="*{taxInvoiceId}" type="hidden"> |
|
|
|
<!-- 添加隐藏的输入框 --> |
|
|
|
<input id="fileIdStr" th:field="*{fileIdStr}" name="fileIdStr" type="text" hidden> |
|
|
|
<input id="fileIdStr" name="fileIdStr" type="text" hidden> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">发票单号:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
@ -251,7 +251,6 @@ |
|
|
|
</div> |
|
|
|
<div class="file-loading col-sm-8"> |
|
|
|
<input class="file-upload" id="singleFile" name="file" type="file"> |
|
|
|
<input id="photoAttachId" readonly name = "photoAttachId" hidden th:field="*{photoAttachId}"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- 用户评价 --> |
|
|
@ -284,121 +283,47 @@ |
|
|
|
autoclose: true |
|
|
|
}); |
|
|
|
|
|
|
|
//开票物料 |
|
|
|
$(function() { |
|
|
|
var options = { |
|
|
|
id: 'bootstrap-table-material', |
|
|
|
url: prefix + "/getInvoiceMaterialListByCode", |
|
|
|
queryParams: function(params) { |
|
|
|
return { |
|
|
|
taxInvoiceCode: $("#taxInvoiceCode").val(), |
|
|
|
$(document).ready(function () { |
|
|
|
var initialPreview = []; |
|
|
|
var initialPreviewConfig = []; |
|
|
|
var initialPreviewFileType = []; |
|
|
|
var sysAttachFiles = taxInvoice.sysAttachFiles || []; // 确保 sysAttachFiles 是一个数组 |
|
|
|
|
|
|
|
// 遍历 sysAttachFiles 并构建 initialPreview 和 initialPreviewConfig |
|
|
|
if (sysAttachFiles.length > 0) { |
|
|
|
for (var i = 0; i < sysAttachFiles.length; i++) { |
|
|
|
var sysAttachFile = sysAttachFiles[i]; |
|
|
|
if (sysAttachFile) { |
|
|
|
var delSysAttachFile = generFilDel(sysAttachFile); |
|
|
|
initialPreview.push(sysAttachFile.url); |
|
|
|
initialPreviewConfig.push(delSysAttachFile); |
|
|
|
} |
|
|
|
}, |
|
|
|
showSearch: false, |
|
|
|
showRefresh: false, |
|
|
|
showToggle: false, |
|
|
|
showColumns: false, |
|
|
|
pagination: false, // 设置不分页 |
|
|
|
modalName: "国税发票物料", |
|
|
|
columns: [{ |
|
|
|
checkbox: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '国税发票物料ID', |
|
|
|
field: 'invoiceMaterialId', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料编号', |
|
|
|
field: 'materialCode', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料名称', |
|
|
|
field: 'materialName', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialType', |
|
|
|
title: '物料类型', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料加工方式', |
|
|
|
field: 'materialProcessMethod', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(materialProcessMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料品牌', |
|
|
|
field: 'materialBrand', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料图片', |
|
|
|
field: 'materialPhotourl', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料单位', |
|
|
|
field: 'materialUnit', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料描述', |
|
|
|
field: 'materialDescribe', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料的数量', |
|
|
|
field: 'materialNum', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料的含税单价(RMB)', |
|
|
|
field: 'taxRmb', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料的不含税单价(RMB)', |
|
|
|
field: 'noTaxRmb', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '已出库数量', |
|
|
|
field: 'outBoundQuantity', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '已验收数', |
|
|
|
field: 'hasCheckNum', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '退货数', |
|
|
|
field: 'refundsNum', |
|
|
|
}] |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
|
// 单图上传 |
|
|
|
$(".file-upload").fileinput({ |
|
|
|
$("#singleFile").fileinput({ |
|
|
|
uploadUrl: ctx + "common/uploadSingleFile", |
|
|
|
dropZoneTitle: '可以将文件拖放到这里,支持文件上传', |
|
|
|
language: 'zh', |
|
|
|
allowedFileExtensions: ['bmp', 'gif', 'jpg', 'jpeg', 'png', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'html', 'htm', 'txt', 'text', 'rar', 'zip', 'gz', 'bz2', 'pdf', 'bpmn', 'bar', 'db'], |
|
|
|
showPreview: true, // 是否显示预览 |
|
|
|
showCaption: false, // 是否显示标题 |
|
|
|
fileSizeGetter: true, |
|
|
|
previewFileType: ['image', 'txt', 'text','pdf'], |
|
|
|
validateInitialCount: true, |
|
|
|
preferIconicPreview: true, // 这将强制缩略图按照以下文件扩展名的图标显示 |
|
|
|
maxFileCount: 1, |
|
|
|
autoReplace: true, |
|
|
|
showUpload: false, // 不显示上传按钮 |
|
|
|
showCaption: false, // 不显示标题 |
|
|
|
showRemove: true, // 显示移除按钮 |
|
|
|
browseClass: "btn btn-primary", // 浏览按钮样式 |
|
|
|
removeClass: "btn btn-danger", // 移除按钮样式 |
|
|
|
removeIcon: "<i class='fa fa-trash'></i>", // 移除按钮图标 |
|
|
|
browseLabel: "选择文件", // 浏览按钮文本 |
|
|
|
removeLabel: "删除", // 移除按钮文本 |
|
|
|
layoutTemplates: { |
|
|
|
main2: "{preview}\n" + |
|
|
|
"{remove}\n" + |
|
|
|
"{browse}" |
|
|
|
} |
|
|
|
}).on('filepreupload', function (event, data, previewId, index) { |
|
|
|
// 在文件上传前的处理 |
|
|
|
// 可以在这里设置一些上传前的逻辑 |
|
|
|
autoReplace: true, // 自动替换 |
|
|
|
initialPreview: initialPreview, |
|
|
|
initialPreviewConfig: initialPreviewConfig, |
|
|
|
initialPreviewFileType: initialPreviewFileType, |
|
|
|
initialPreviewAsData: true, // 默认为数据 |
|
|
|
}).on('filebatchselected', function (event, data, previewId, index) { |
|
|
|
// 当文件被选中时,开始上传 |
|
|
|
$(this).fileinput("upload"); |
|
|
|
}).on('fileuploaded', function (event, data, previewId, index) { |
|
|
|
log.info("data:" + JSON.stringify(data)) |
|
|
|
log.info("data:" + JSON.stringify(data)); |
|
|
|
var response = data.response; |
|
|
|
|
|
|
|
var attachFileId = response.data.id; |
|
|
@ -417,53 +342,50 @@ |
|
|
|
$("#fileIdStr").val(''); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 绑定详情按钮点击事件 |
|
|
|
var photoAttachId = $('#photoAttachId').val(); |
|
|
|
if (photoAttachId) { |
|
|
|
$.ajax({ |
|
|
|
type: "GET", |
|
|
|
url: ctx + "system/attach/file/getListByAttachId", |
|
|
|
data: {attachId: photoAttachId}, |
|
|
|
cache: false, |
|
|
|
async: false, // 设置成同步 |
|
|
|
dataType: 'json', |
|
|
|
success: function (result) { |
|
|
|
if (result.code === web_status.SUCCESS) { |
|
|
|
var fileList = result.data.map(function (item) { |
|
|
|
// 生成文件删除配置 |
|
|
|
function generFilDel(file) { |
|
|
|
if (file) { |
|
|
|
var type = file.url.substr(file.url.lastIndexOf('.') + 1); |
|
|
|
return { |
|
|
|
caption: item.name, |
|
|
|
url: item.url, |
|
|
|
key: item.id, |
|
|
|
extra: { |
|
|
|
attachFileId: item.id, |
|
|
|
isBind: true |
|
|
|
} |
|
|
|
type: getTypeByExtension(type), |
|
|
|
size: file.size, |
|
|
|
caption: file.name, |
|
|
|
url: prefix + "/deletePic", |
|
|
|
key: file.id, |
|
|
|
downloadUrl: file.url |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
// 清除现有的文件信息 |
|
|
|
$(".file-upload").fileinput("clear"); |
|
|
|
|
|
|
|
// 使用获取的文件信息初始化文件上传组件 |
|
|
|
$(".file-upload").fileinput("batchAdd", fileList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$.modal.msgSuccess("文件信息加载成功"); |
|
|
|
} else { |
|
|
|
$.modal.alertError(result.msg); |
|
|
|
// 根据文件扩展名获取文件类型 |
|
|
|
function getTypeByExtension(extension) { |
|
|
|
switch (extension) { |
|
|
|
case 'pdf': |
|
|
|
return "pdf"; |
|
|
|
case 'text': |
|
|
|
return "text"; |
|
|
|
case 'mp4': |
|
|
|
return {type: "video", filetype: "video/mp4"}; |
|
|
|
case 'txt': |
|
|
|
return "txt"; |
|
|
|
case 'db': |
|
|
|
return "db"; |
|
|
|
default: |
|
|
|
return ""; |
|
|
|
} |
|
|
|
}, |
|
|
|
error: function (error) { |
|
|
|
$.modal.msgError("获取附件失败。"); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
$.modal.msgError("没有文件信息可以显示。"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var attachId = $("#photoAttachId").val(); |
|
|
|
// var fileIdList=[]; |
|
|
|