Browse Source

[feat]国税发票

新增国税发票-国外列表页面
修改国税发票前端页面,统一文件命名
dev
liuxiaoxu 3 months ago
parent
commit
f3235c7e75
  1. 16
      ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialTaxInvoiceController.java
  2. 0
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRmb.html
  3. 0
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRmbDetail.html
  4. 0
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUsd.html
  5. 2
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUsdDetail.html
  6. 2
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/taxInvoice.html
  7. 2
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceRmb.html
  8. 101
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceRmbDetail.html
  9. 8
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceUsd.html
  10. 529
      ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceUsdDetail.html

16
ruoyi-admin/src/main/java/com/ruoyi/financial/controller/FinancialTaxInvoiceController.java

@ -102,9 +102,9 @@ public class FinancialTaxInvoiceController extends BaseController
String commonCurrency = taxInvoice.getCommonCurrency();
mmap.put("taxInvoice", taxInvoice);
if ("1".equals(commonCurrency)){
return prefix + "/auditInvoiceRMB";
return prefix + "/auditInvoiceRmb";
}else {
return prefix + "/auditInvoiceUSD";
return prefix + "/auditInvoiceUsd";
}
}
@ -133,9 +133,9 @@ public class FinancialTaxInvoiceController extends BaseController
String commonCurrency = taxInvoice.getCommonCurrency();
mmap.put("taxInvoice", taxInvoice);
if ("1".equals(commonCurrency)){
return prefix + "/uploadInvoiceRMB";
return prefix + "/uploadInvoiceRmb";
}else {
return prefix + "/uploadInvoiceUSD";
return prefix + "/uploadInvoiceUsd";
}
}
@ -163,9 +163,9 @@ public class FinancialTaxInvoiceController extends BaseController
FinancialTaxInvoice taxInvoice = financialTaxInvoiceService.selectFinancialTaxInvoiceById(taxInvoiceId);
mmap.put("taxInvoice", taxInvoice);
if ("1".equals(taxInvoice.getCommonCurrency())){
return prefix + "/auditInvoiceRMBDetail";
return prefix + "/auditInvoiceRmbDetail";
}else {
return prefix + "/auditInvoiceUSDDetail";
return prefix + "/auditInvoiceUsdDetail";
}
}
@ -190,9 +190,9 @@ public class FinancialTaxInvoiceController extends BaseController
FinancialTaxInvoice taxInvoice = financialTaxInvoiceService.selectFinancialTaxInvoiceWithAttachById(taxInvoiceId);
mmap.put("taxInvoice", taxInvoice);
if ("1".equals(taxInvoice.getCommonCurrency())){
return prefix + "/uploadInvoiceRMBDetail";
return prefix + "/uploadInvoiceRmbDetail";
}else {
return prefix + "/uploadInvoiceUSDDetail";
return prefix + "/uploadInvoiceUsdDetail";
}
}

0
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRMB.html → ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRmb.html

0
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRMBDetail.html → ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceRmbDetail.html

0
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUSD.html → ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUsd.html

2
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUSDDetail.html → ruoyi-admin/src/main/resources/templates/financial/taxInvoice/auditInvoiceUsdDetail.html

@ -236,7 +236,7 @@
function submitHandler() {
$.operate.save(prefix + "/auditInvoiceDetail", $('#form-taxInvoice-form-taxInvoice-auditUsdDetail').serialize());
$.operate.save(prefix + "/auditInvoiceDetail", $('#form-taxInvoice-auditUsdDetail').serialize());
}

2
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/taxInvoice.html

@ -261,7 +261,7 @@
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.taxInvoiceId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
//actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.taxInvoiceId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
if (row.taxInvoiceStatus=="0" && row.commonCurrency=="1"){
actions.push('<a class="btn btn-success btn-xs ' + auditInvoiceFlag + '" href="javascript:void(0)" onclick="auditInvoiceRmb(\'' + row.taxInvoiceId + '\')"><i class="fa fa-edit"></i>审核</a>');
}

2
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceRMB.html → ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceRmb.html

@ -273,7 +273,7 @@
var taxInvoice = [[${taxInvoice}]];
var prefix = ctx + "financial/taxInvoice";
$("#form-taxInvoice-auditRmb").validate({
$("#form-taxInvoice-uploadRmb").validate({
focusCleanup: true
});

101
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceRMBDetail.html → ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceRmbDetail.html

@ -7,7 +7,7 @@
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-taxInvoice-uploadRmb" th:object="${taxInvoice}">
<form class="form-horizontal m" id="form-taxInvoice-uploadRmbDetail" th:object="${taxInvoice}">
<input name="taxInvoiceId" th:field="*{taxInvoiceId}" type="hidden">
<!-- 添加隐藏的输入框 -->
<input id="fileIdStr" name="fileIdStr" type="text" hidden>
@ -273,7 +273,7 @@
var taxInvoice = [[${taxInvoice}]];
var prefix = ctx + "financial/taxInvoice";
$("#form-taxInvoice-auditRmb").validate({
$("#form-taxInvoice-uploadRmbDetail").validate({
focusCleanup: true
});
@ -283,6 +283,13 @@
autoclose: true
});
function submitHandler() {
$.operate.save(prefix + "/uploadInvoiceDetail", $('#form-taxInvoice-uploadRmbDetail').serialize());
}
$(document).ready(function () {
var initialPreview = [];
var initialPreviewConfig = [];
@ -378,7 +385,95 @@
//开票物料
$(function() {
var options = {
id: 'bootstrap-table-material',
url: prefix + "/getInvoiceMaterialListByCode",
queryParams: function(params) {
return {
taxInvoiceCode: $("#taxInvoiceCode").val(),
}
},
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);
});

8
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceUSD.html → ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceUsd.html

@ -355,12 +355,12 @@
field: 'materialNum',
},
{
title: '物料的含税单价(RMB)',
field: 'taxRmb',
title: '物料的含税单价(美元)',
field: 'taxUsd',
},
{
title: '物料的不含税单价(RMB)',
field: 'noTaxRmb',
title: '物料的不含税单价(美元)',
field: 'noTaxUsd',
},
{
title: '已出库数量',

529
ruoyi-admin/src/main/resources/templates/financial/taxInvoice/uploadInvoiceUsdDetail.html

@ -0,0 +1,529 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('上传国税发票')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-taxInvoice-uploadUsdDetail" th:object="${taxInvoice}">
<input name="taxInvoiceId" th:field="*{taxInvoiceId}" type="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">
<input name="taxInvoiceCode" th:field="*{taxInvoiceCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">销售订单编号:</label>
<div class="col-sm-7">
<input name="salesOrderCode" th:field="*{salesOrderCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">订单类型:</label>
<div class="col-sm-7">
<select name="salesOrderType" class="form-control m-b" th:with="type=${@dict.getType('sys_order_type')}" readonly>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{salesOrderType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">报价币种:</label>
<div class="col-sm-7">
<select name="commonCurrency" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" readonly>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{commonCurrency}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">客户代码/ID:</label>
<div class="col-sm-7">
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">客户名称:</label>
<div class="col-sm-7">
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">联系电话:</label>
<div class="col-sm-7">
<input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司地址:</label>
<div class="col-sm-7">
<input name="enterpriseAddress" th:field="*{enterpriseAddress}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票公司名称:</label>
<div class="col-sm-7">
<input name="invoiceCompanyName" th:field="*{invoiceCompanyName}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票公司税号:</label>
<div class="col-sm-7">
<input name="invoiceCompanyCode" th:field="*{invoiceCompanyCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司开户行:</label>
<div class="col-sm-7">
<input name="depositBank" th:field="*{depositBank}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">公司开户账号:</label>
<div class="col-sm-7">
<input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">税率:</label>
<div class="col-sm-7">
<div class="input-group">
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" readonly>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required" >发票种类:</label>
<div class="col-sm-7">
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_class')}">
<input type="radio" th:id="${'taxInvoiceClass_' + dict.dictCode}" name="taxInvoiceClass" th:value="${dict.dictValue}" th:field="*{taxInvoiceClass}" disabled>
<label th:for="${'taxInvoiceClass_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">发票类型:</label>
<div class="col-sm-7">
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_type')}">
<input type="radio" th:id="${'taxInvoiceType_' + dict.dictCode}" name="taxInvoiceType" th:value="${dict.dictValue}" th:field="*{taxInvoiceType}" disabled>
<label th:for="${'taxInvoiceType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">发票抬头:</label>
<div class="col-sm-7">
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_title')}">
<input type="radio" th:id="${'taxInvoiceTitle_' + dict.dictCode}" name="taxInvoiceTitle" th:value="${dict.dictValue}" th:field="*{taxInvoiceTitle}" disabled>
<label th:for="${'taxInvoiceTitle_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">邮箱:</label>
<div class="col-sm-7">
<input name="invoiceEmail" th:field="*{invoiceEmail}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">业务备注:</label>
<div class="col-sm-7">
<input name="businessRemark" th:field="*{businessRemark}" class="form-control" type="text" readonly>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">开票物料</h4>
</div>
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table-material"></table>
</div>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">开票额度</h4>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">不含税总价(美元):</label>
<div class="col-sm-7">
<input name="noUsdSum" th:field="*{noUsdSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">含税总价(美元):</label>
<div class="col-sm-7">
<input name="usdTaxSum" th:field="*{usdTaxSum}" class="form-control" type="text" id="usdTaxSumInput" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">物料数合计:</label>
<div class="col-sm-7">
<input name="materialSum" th:field="*{materialSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">数量合计:</label>
<div class="col-sm-7">
<input name="enterpriseSum" th:field="*{enterpriseSum}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票额度比例:</label>
<div class="col-sm-7">
<div class="input-group">
<input name="invoiceQuotaRatio" th:field="*{invoiceQuotaRatio}" class="form-control" type="text" id="invoiceQuotaRatioInput" readonly>
<span class="input-group-addon">%</span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票金额(美元):</label>
<div class="col-sm-7">
<input name="invoiceAmountUsd" th:field="*{invoiceAmountUsd}" class="form-control" type="text" id="invoiceAmountUsdInput" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">开票用途:</label>
<div class="col-sm-7">
<input name="invoicePurpose" th:field="*{invoicePurpose}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">实际开票金额(RMB):</label>
<div class="col-sm-7">
<input name="actualInvoiceAmountRmb" th:field="*{actualInvoiceAmountRmb}" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">实际开票金额(美元):</label>
<div class="col-sm-7">
<input name="actualInvoiceAmountUsd" th:field="*{actualInvoiceAmountUsd}" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">发票备注:</label>
<div class="col-sm-7">
<input name="invoiceRemark" th:field="*{invoiceRemark}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label is-required">开票日期:</label>
<div class="col-sm-7">
<div class="input-group date">
<input name="invoiceData" th:value="${#dates.format(taxInvoice.invoiceData, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">发票代码:</label>
<div class="col-sm-7">
<input name="invoiceCode" th:field="*{invoiceCode}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-5 control-label">发票号码:</label>
<div class="col-sm-7">
<input name="invoicePhone" th:field="*{invoicePhone}" class="form-control" type="text" readonly>
</div>
</div>
<div class="container">
<div class="row">
<h4 class="font-weight-bold">导入发票:</h4>
</div>
<div class="file-loading col-sm-8">
<input class="file-upload" id="singleFile" name="file" type="file">
</div>
</div>
<!-- 用户评价 -->
<!-- <div class="form-group">-->
<!-- <label class="col-sm-4 control-label">导入发票:</label>-->
<!-- </div>-->
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<script th:inline="javascript">
var materialProcessMethodDatas = [[${@dict.getType('processMethod')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var taxInvoiceStatusDatas = [[${@dict.getType('tax_invoice_status')}]];
var taxInvoice = [[${taxInvoice}]];
var prefix = ctx + "financial/taxInvoice";
$("#form-taxInvoice-uploadUsdDetail").validate({
focusCleanup: true
});
$("input[name='invoiceData']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
function submitHandler() {
$.operate.save(prefix + "/uploadInvoiceDetail", $('#form-taxInvoice-uploadUsdDetail').serialize());
}
//开票物料
$(function() {
var options = {
id: 'bootstrap-table-material',
url: prefix + "/getInvoiceMaterialListByCode",
queryParams: function(params) {
return {
taxInvoiceCode: $("#taxInvoiceCode").val(),
}
},
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: '物料的含税单价(美元)',
field: 'taxUsd',
},
{
title: '物料的不含税单价(美元)',
field: 'noTaxUsd',
},
{
title: '已出库数量',
field: 'outBoundQuantity',
},
{
title: '已验收数',
field: 'hasCheckNum',
},
{
title: '退货数',
field: 'refundsNum',
}]
};
$.table.init(options);
});
$(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);
}
}
}
// 单图上传
$("#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, // 是否显示预览
fileSizeGetter: true,
previewFileType: ['image', 'txt', 'text','pdf'],
validateInitialCount: true,
preferIconicPreview: true, // 这将强制缩略图按照以下文件扩展名的图标显示
maxFileCount: 1,
autoReplace: true, // 自动替换
showUpload: false, // 不显示上传按钮
showCaption: false, // 不显示标题
showRemove: false, // 显示移除按钮
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));
var response = data.response;
var attachFileId = response.data.id;
if (response.code === web_status.SUCCESS) {
$('#fileIdStr').val(attachFileId);
$.modal.msgSuccess("上传成功");
} else {
$.modal.alertError(response.msg);
}
}).on('filebatchremoved', function (event, id, index) {
$("#fileIdStr").val('');
});
// 添加清除输入框值的功能
$(".file-upload").on('fileclear', function (event) {
$("#fileIdStr").val('');
});
// 生成文件删除配置
function generFilDel(file) {
if (file) {
var type = file.url.substr(file.url.lastIndexOf('.') + 1);
return {
type: getTypeByExtension(type),
size: file.size,
caption: file.name,
url: prefix + "/deletePic",
key: file.id,
downloadUrl: file.url
};
}
}
// 根据文件扩展名获取文件类型
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 "";
}
}
});
// var attachId = $("#photoAttachId").val();
// var fileIdList=[];
// var fileList=[];
// if(attachId){
// $.ajax({
// type: "get",
// url: ctx + "system/attach/file/getListByAttachId",
// data: {attachId:attachId},
// cache: false,
// async: false, // 设置成同步
// dataType: 'json',
// success: function(result) {
// if (result.code == web_status.SUCCESS) {
// result.data.forEach((item) => {
// fileIdList.push(item.id);
// fileList.push({name: item.name, url: item.url, attachFileId: item.id,isBind:true});
// });
// } else {
// $.modal.msgError(result.msg);
// }
// },
// error: function(error) {
// $.modal.msgError("获取附件失败。");
// }
// });
// }
</script>
</body>
</html>
Loading…
Cancel
Save