|
@ -10,7 +10,7 @@ |
|
|
<form class="form-horizontal m" id="form-taxInvoice-uploadRmb" th:object="${taxInvoice}"> |
|
|
<form class="form-horizontal m" id="form-taxInvoice-uploadRmb" th:object="${taxInvoice}"> |
|
|
<input name="taxInvoiceId" th:field="*{taxInvoiceId}" type="hidden"> |
|
|
<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"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-5 control-label">发票单号:</label> |
|
|
<label class="col-sm-5 control-label">发票单号:</label> |
|
|
<div class="col-sm-7"> |
|
|
<div class="col-sm-7"> |
|
@ -251,7 +251,6 @@ |
|
|
</div> |
|
|
</div> |
|
|
<div class="file-loading col-sm-8"> |
|
|
<div class="file-loading col-sm-8"> |
|
|
<input class="file-upload" id="singleFile" name="file" type="file"> |
|
|
<input class="file-upload" id="singleFile" name="file" type="file"> |
|
|
<input id="photoAttachId" readonly name = "photoAttachId" hidden th:field="*{photoAttachId}"> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<!-- 用户评价 --> |
|
|
<!-- 用户评价 --> |
|
@ -284,121 +283,47 @@ |
|
|
autoclose: true |
|
|
autoclose: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
//开票物料 |
|
|
$(document).ready(function () { |
|
|
$(function() { |
|
|
var initialPreview = []; |
|
|
var options = { |
|
|
var initialPreviewConfig = []; |
|
|
id: 'bootstrap-table-material', |
|
|
var initialPreviewFileType = []; |
|
|
url: prefix + "/getInvoiceMaterialListByCode", |
|
|
var sysAttachFiles = taxInvoice.sysAttachFiles || []; // 确保 sysAttachFiles 是一个数组 |
|
|
queryParams: function(params) { |
|
|
|
|
|
return { |
|
|
// 遍历 sysAttachFiles 并构建 initialPreview 和 initialPreviewConfig |
|
|
taxInvoiceCode: $("#taxInvoiceCode").val(), |
|
|
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", |
|
|
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, |
|
|
maxFileCount: 1, |
|
|
autoReplace: true, |
|
|
autoReplace: true, // 自动替换 |
|
|
showUpload: false, // 不显示上传按钮 |
|
|
initialPreview: initialPreview, |
|
|
showCaption: false, // 不显示标题 |
|
|
initialPreviewConfig: initialPreviewConfig, |
|
|
showRemove: true, // 显示移除按钮 |
|
|
initialPreviewFileType: initialPreviewFileType, |
|
|
browseClass: "btn btn-primary", // 浏览按钮样式 |
|
|
initialPreviewAsData: true, // 默认为数据 |
|
|
removeClass: "btn btn-danger", // 移除按钮样式 |
|
|
}).on('filebatchselected', function (event, data, previewId, index) { |
|
|
removeIcon: "<i class='fa fa-trash'></i>", // 移除按钮图标 |
|
|
// 当文件被选中时,开始上传 |
|
|
browseLabel: "选择文件", // 浏览按钮文本 |
|
|
$(this).fileinput("upload"); |
|
|
removeLabel: "删除", // 移除按钮文本 |
|
|
|
|
|
layoutTemplates: { |
|
|
|
|
|
main2: "{preview}\n" + |
|
|
|
|
|
"{remove}\n" + |
|
|
|
|
|
"{browse}" |
|
|
|
|
|
} |
|
|
|
|
|
}).on('filepreupload', function (event, data, previewId, index) { |
|
|
|
|
|
// 在文件上传前的处理 |
|
|
|
|
|
// 可以在这里设置一些上传前的逻辑 |
|
|
|
|
|
}).on('fileuploaded', function (event, data, previewId, index) { |
|
|
}).on('fileuploaded', function (event, data, previewId, index) { |
|
|
log.info("data:" + JSON.stringify(data)) |
|
|
log.info("data:" + JSON.stringify(data)); |
|
|
var response = data.response; |
|
|
var response = data.response; |
|
|
|
|
|
|
|
|
var attachFileId = response.data.id; |
|
|
var attachFileId = response.data.id; |
|
@ -417,53 +342,50 @@ |
|
|
$("#fileIdStr").val(''); |
|
|
$("#fileIdStr").val(''); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 生成文件删除配置 |
|
|
// 绑定详情按钮点击事件 |
|
|
function generFilDel(file) { |
|
|
var photoAttachId = $('#photoAttachId').val(); |
|
|
if (file) { |
|
|
if (photoAttachId) { |
|
|
var type = file.url.substr(file.url.lastIndexOf('.') + 1); |
|
|
$.ajax({ |
|
|
return { |
|
|
type: "GET", |
|
|
type: getTypeByExtension(type), |
|
|
url: ctx + "system/attach/file/getListByAttachId", |
|
|
size: file.size, |
|
|
data: {attachId: photoAttachId}, |
|
|
caption: file.name, |
|
|
cache: false, |
|
|
url: prefix + "/deletePic", |
|
|
async: false, // 设置成同步 |
|
|
key: file.id, |
|
|
dataType: 'json', |
|
|
downloadUrl: file.url |
|
|
success: function (result) { |
|
|
}; |
|
|
if (result.code === web_status.SUCCESS) { |
|
|
} |
|
|
var fileList = result.data.map(function (item) { |
|
|
} |
|
|
return { |
|
|
|
|
|
caption: item.name, |
|
|
// 根据文件扩展名获取文件类型 |
|
|
url: item.url, |
|
|
function getTypeByExtension(extension) { |
|
|
key: item.id, |
|
|
switch (extension) { |
|
|
extra: { |
|
|
case 'pdf': |
|
|
attachFileId: item.id, |
|
|
return "pdf"; |
|
|
isBind: true |
|
|
case 'text': |
|
|
} |
|
|
return "text"; |
|
|
}; |
|
|
case 'mp4': |
|
|
}); |
|
|
return {type: "video", filetype: "video/mp4"}; |
|
|
|
|
|
case 'txt': |
|
|
// 清除现有的文件信息 |
|
|
return "txt"; |
|
|
$(".file-upload").fileinput("clear"); |
|
|
case 'db': |
|
|
|
|
|
return "db"; |
|
|
// 使用获取的文件信息初始化文件上传组件 |
|
|
default: |
|
|
$(".file-upload").fileinput("batchAdd", fileList); |
|
|
return ""; |
|
|
|
|
|
|
|
|
$.modal.msgSuccess("文件信息加载成功"); |
|
|
|
|
|
} else { |
|
|
|
|
|
$.modal.alertError(result.msg); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
error: function (error) { |
|
|
|
|
|
$.modal.msgError("获取附件失败。"); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
$.modal.msgError("没有文件信息可以显示。"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// var attachId = $("#photoAttachId").val(); |
|
|
// var attachId = $("#photoAttachId").val(); |
|
|
// var fileIdList=[]; |
|
|
// var fileIdList=[]; |
|
|