您的位置:首页 > 编程语言 > Java开发

Java进度条(excel文件解析)的实现

2016-01-27 16:16 507 查看
文件上传页面

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Excel发布_钢银商家中心</title>

<link href="http://static.banksteel.com/2014/images/fav.ico" rel="shortcut icon">

<link href="http://static.banksteel.com/member/v3/css/member.css" rel="stylesheet" type="text/css" >

<link href="/skin/css/dataTables.bootstrap.css" rel="stylesheet" />

<link href="/skin/css/pageStyle.css" rel="stylesheet" />

<link rel="shortcut icon" href="http://static.banksteel.com/member/v3/images/fav.ico" />

<link href="http://static.banksteel.com/member/v3/css/resource.css" rel="stylesheet" type="text/css">

</head>

<body class="pop pop-excel1">

<div class="popup-bg">

<div class="popup-box">

<div class="res-onsell-ex1 cl">

<span class="fl">选择文件:</span>

<input class="inp1 fl" id="fileText" value="">

<span class="upload-excel fl">

<input type="file" value="" class="find-excel" name="uploadFile" id="uploadFile" onchange="showFileName();">

<a href="javascript:void(0);">浏 览 </a>

</span>

<span class="excel-check fl">

<input type="checkbox" class="inp2" id="cover">覆盖

</span>

<span class="excel-tip fl">[<a href="/resourcefile/gy/mgy1.xls">下载Excel模板</a>]。</span>

<div class="excel-error-tip" style="display:none" id="excelTipInfo">文件格式不对,请选择xls格式!</div>

</div>

<div class="form-excel mtb10">

<input type="reset" class="formbtn btn-orange btn-middle" value="确定" id="excel1-dialog">

<input type="reset" class="formbtn btn-gray btn-middle" value="取消" id="close-dialog">

</div>

</div>

</div>

<script type="text/javascript" src="http://static.banksteel.com/member/v3/js/jquery-1.10.2.js"></script>

<script type="text/javascript" src="http://static.banksteel.com/member/v3/js/global.js"></script>

<script type="text/javascript" src="http://static.banksteel.com/member/v3/js/select2.js"></script>

<script type="text/javascript" src="http://static.banksteel.com/member/v3/js/base.js"></script>

<script type="text/javascript" src="/skin/js/resource/json2.js"></script>

<script type="text/javascript" src="/skin/js/resource/MyNumber.js"></script>

<script type="text/javascript" src="/skin/js/ajaxfileupload.js"></script>

<script type="text/javascript">

$(function(){



var dialog = top.dialog.get(window);

$('#excel1-dialog').on('click', function () {

var fileName = $("#uploadFile").val();

var randomNum = Math.random();

if(fileName != "" && (fileName.endsWith(".xls") || fileName.endsWith(".xlsx")))

{

//关闭父窗口

parent.pubexc.close();

var cover = 0 ;

if($("#cover").is(':checked'))

{

cover = 1;

}

jQuery.ajaxFileUpload({

url: '/resource/inventory/excel_publish_upload.jsp?cover='+cover+'&randomNum='+randomNum,

type: 'post',

secureuri: false, //一般设置为false

fileElementId: 'uploadFile', // 上传文件的id、name属性名

dataType: 'json', //返回值类型,一般设置为json、application/json

success: function(msg){

},

error: function(msg){

window.location.href = "/resource/inventory/excel_publish_result.jsp?randomNum="+randomNum;

}

});

//弹出进度条窗口

top.dialog({

url: '/resource/inventory/excel_publish_progress.jsp?randomNum='+randomNum,

title: ' ',

fixed:true,

width: 362,

height:120


})

.showModal();

return false;

}

else

{

$("#excelTipInfo").css("display","");

}

});

$("#close-dialog").click(function(){

parent.pubexc.close().remove();

})



})

//点击上传展示文件名

function showFileName() {

var uploadFile = $("#uploadFile").val();

if (uploadFile != null && uploadFile != '' && (uploadFile.endsWith(".xls") || uploadFile.endsWith(".xlsx")))

{

$("#excelTipInfo").css("display","none");

}

else

{

$("#excelTipInfo").css("display","");

}

$("#fileText").val(uploadFile);

}

</script>

</body>

</html>

后台代码:

@Override

public Map<String, Object> publishShopResourceByExcel(byte[] content, Boolean isCover, String randomNum, UserContext context)

{

long supplierId = 0;

Supplier supplier = null;

if (context.getMemberId() != 0)

{

supplier = supplierService.getSupplierByMemberId(context.getMemberId());

}

if (ObjectUtils.notNull(supplier))

{

supplierId = supplier.getId();

}

if (isCover)

{

List<SteelResource> steelResources = steelResourceService.deleteBySupplierId(supplierId);

if (ObjectUtils.notEmpty(steelResources))

{

for (SteelResource steelResource : steelResources)

{

if (SteelResource.STATUS_SELL == steelResource.getStatus()

&& (steelResource.getOnboardItems() > 0 || steelResource.getOnboardQty() > 0))

{

resourcePriceSummaryThread.collect(steelResource.getSummaryCode());

}

}

}

try

{

mqService.append(DocumentUtil.STEELRESOURCE_PUBLISH_QUEUE, supplierId + "|d");

}

catch (MQException e)

{

e.printStackTrace();

}

}

Map<String, Object> returnMap = new HashMap<String, Object>();

// 不能正确解析的资源

List<ResourceDTO> wrongResourcesList = new ArrayList<ResourceDTO>();

// 可以正确解析的资源列表

List<ResourceDTO> rightResourcesList = new ArrayList<ResourceDTO>();

// 如果上传的Excel中有捆包号相同的资源,则只保留一条

Map<String, ResourceDTO> noSamePackageNoMap = new HashMap<String, ResourceDTO>();

// 当前解析的进度

cacheService.set("precent" + randomNum, "0");


// 对上传的资源进行解析,处理

List<ResourceInventoryParseDTO> excelResourcesList = null;

try

{

// 当前解析的进度

cacheService.set("precent" + randomNum, "10");

// excel传入解析后的资源

excelResourcesList = importShopResource(content, context.getMemberId());

// 当前解析的进度

cacheService.set("precent" + randomNum, "20");


}

catch (Exception e)

{

e.printStackTrace();

}

// 正确解析了的资源条数

int rightResourcesSize = 0;

// 不能正确解析的资源条数

int wrongResourcesSize = 0;

// 捆包号重复的资源条数

int samePackgeNoResourcesSize = 0;

if (excelResourcesList != null)

{

int count = 0;

int percent = 20;

for (ResourceInventoryParseDTO resource : excelResourcesList)

{

count++;

// 解析错误标志

int[] wrongFlag = new int[9];

// 解析错误的原因

String wrongReason = "";

ResourceDTO resourceDTO = new ResourceDTO();

// 获取上传资源的品名、材质、规格、品牌产地、仓库

String breedAlias = resource.getCategoryAlias();

String materialAlias = resource.getMaterialAlias();

String specAlias = resource.getSpecAlias();

String brandAlias = resource.getFactoryAlias();

String warehouseAlias = resource.getWarehouseAlias();

// 解析品名

MarketBreed breed = catalogService.getMarketBreedByKey(breedAlias.replace(" ", ""));

if (StringUtils.isTrimEmpty(breedAlias))

{

// 缺失品名的情况直接跳过

wrongReason += "品名缺失 ";

continue;

}

else if (ObjectUtils.isNull(breed))

{

breed = catalogService.getMarketBreedByBreedAlias(breedAlias);

if (ObjectUtils.isNull(breed))

{

wrongReason += "品名非标 ";

wrongFlag[0] = 1;

resourceDTO.setBreed(breedAlias);

}

else

{

resourceDTO.setBreed(breed.getName());

resourceDTO.setBreedId(breed.getId());

}

}

else

{

resourceDTO.setBreed(breed.getName());

resourceDTO.setBreedId(breed.getId());

}

// 解析规格

if (StringUtils.isTrimEmpty(specAlias))

{

wrongReason += "规格缺失 ";

wrongFlag[1] = 1;

}

else if (specAlias.length() > 60)

{

wrongReason += "规格过长 ";

wrongFlag[1] = 1;

}

else

{

resourceDTO.setSpec(specAlias);

}

// 解析牌号material

if (StringUtils.isTrimEmpty(materialAlias))

{

wrongReason += "牌号为空 ";

wrongFlag[2] = 1;

}

else if (materialAlias.length() > 60)

{

wrongReason += "牌号长度过长 ";

wrongFlag[2] = 1;

}

else

{

resourceDTO.setMaterial(materialAlias);

}

// 解析产地/品牌brand

if (StringUtils.isTrimEmpty(brandAlias))

{

wrongReason += "产地/品牌为空 ";

wrongFlag[3] = 1;

}

else if (brandAlias.length() > 60)

{

wrongReason += "产地/品牌过长 ";

wrongFlag[3] = 1;

}

else

{

resourceDTO.setBrand(brandAlias);

}

// 解析仓库 同时解析交货地

Warehouse warehouseEntity = catalogService.getWarehouseByKey(warehouseAlias.replace(" ", ""));

if (StringUtils.isTrimEmpty(warehouseAlias))

{

wrongReason += "仓库为空 ";

wrongFlag[4] = 1;

}

else if (warehouseAlias.length() > 20)

{

wrongReason += "仓库名称过长 ";

wrongFlag[4] = 1;

}

else

{

if (ObjectUtils.isNull(warehouseEntity))

{

String warehouse = catalogService.getAliasWarehouse(warehouseAlias);

if (StringUtils.isTrimEmpty(warehouse))

{

wrongReason += "仓库名称非标 ";

wrongFlag[4] = 1;

resourceDTO.setWarehouse(warehouseAlias);

resourceDTO.setCity(resource.getAreaName());

}

else

{

resourceDTO.setWarehouse(warehouse);

// 获取仓库对应的城市

City city = catalogService.getCityByWarehouse(warehouse);

if (ObjectUtils.notNull(city))

{

resourceDTO.setCity(city.getName());

resourceDTO.setCityId(city.getId());

}

}

}

else

{

resourceDTO.setWarehouse(warehouseEntity.getName());

// 获取仓库对应的城市

City city = catalogService.getCityByWarehouse(warehouseEntity.getName());

if (ObjectUtils.notNull(city))

{

resourceDTO.setCity(city.getName());

resourceDTO.setCityId(city.getId());

}

}

}

// 解析计重方式 0-理重 1-过磅2-抄码

String weightWay = resource.getWeightWay();

if (!StringUtils.isTrimEmpty(weightWay) && "过磅".equals(weightWay.trim()))

{

resourceDTO.setWeightWay(1);

}

else if (!StringUtils.isTrimEmpty(weightWay) && "抄码".equals(weightWay.trim()))

{

resourceDTO.setWeightWay(2);

}

else

{

resourceDTO.setWeightWay(0);

}

// 解析件重件重不大于100

Double averageQty = resource.getAverageQty();

if (averageQty == null)

{

wrongReason += "件重为空 ";

wrongFlag[5] = 1;

}

else if (averageQty < 0 || averageQty >= 100)

{

wrongReason += "件重不能小于0且不能大于100 ";

wrongFlag[5] = 1;

}

else

{

resourceDTO.setAverageQty(averageQty);

}

// 解析件数

Integer inItems = resource.getInItems();

if (inItems == null)

{

wrongReason += "件数为空 ";

wrongFlag[6] = 1;

}

else if (inItems <= 0)

{

wrongReason += "件数必须要>=0 ";

wrongFlag[6] = 1;

}

else

{

resourceDTO.setInItems(inItems);

resourceDTO.setInQty(NumberTools.multi(inItems, averageQty));

}

// 解析发布价格

Double onboardPrice = resource.getBasePrice();

if (onboardPrice == null)

{

wrongReason += "发布价格为空 ";

wrongFlag[7] = 1;

}

else

{

resourceDTO.setOnboardPrice(onboardPrice);

}

// 解析备注

String note = resource.getRemark();

if (StringUtils.notTrimEmpty(note))

{

if (note.length() > 200)

{

wrongReason += "备注长度过长 ";

}

else

{

resourceDTO.setNote(note);

}

}

// 拿到捆包号

String serialNo = resource.getPackageNo();

try

{

BigDecimal bd = new BigDecimal(serialNo);

serialNo = bd.toPlainString();

}

catch (Exception e)

{

// 转换出问题说明是非纯数字

serialNo = resource.getPackageNo();

}

if (StringUtils.isTrimEmpty(serialNo))

{

// 允许捆包号为空,捆包号为空,如果品名、仓库并非非标,则解析正确,保存

resourceDTO.setSerialNo("");

if (StringUtils.isTrimEmpty(wrongReason))

{

rightResourcesList.add(resourceDTO);

rightResourcesSize++;

}

else

{

resourceDTO.setWrongReson(wrongReason);

resourceDTO.setWrongFlag(wrongFlag);

wrongResourcesList.add(resourceDTO);

wrongResourcesSize++;

}

}

else

{

// 解决Excel中资源捆包号冲突的问题

if (noSamePackageNoMap.get(serialNo) != null)

{

continue;

}

List<SteelResource> steelResources = steelResourceService

.querySteelResourceByMemberIdAndSerialNo(context.getMemberId(), serialNo);

if (ObjectUtils.notNull(steelResources) && !steelResources.isEmpty())

{

wrongFlag[8] = 1;

wrongReason += "捆包号重复 ";

resourceDTO.setWrongReson(wrongReason);

resourceDTO.setWrongFlag(wrongFlag);

samePackgeNoResourcesSize++;

resourceDTO.setSerialNo(serialNo);

}

else

{

resourceDTO.setWrongReson(wrongReason);

resourceDTO.setWrongFlag(wrongFlag);

resourceDTO.setSerialNo(serialNo);

}

noSamePackageNoMap.put(resourceDTO.getSerialNo(), resourceDTO);

}

//每循环一次,统计循环次数,计算进度

percent = (int) (20 + NumberTools.multi(NumberTools.div(count, excelResourcesList.size()), 60));

cacheService.set("precent" + randomNum, percent + "");


}

// 如果上传的资源有捆包号重复的,则前边一条被后边一条覆盖

for (Entry<String, ResourceDTO> entry : noSamePackageNoMap.entrySet())

{

if (StringUtils.isTrimEmpty(entry.getValue().getWrongReson()))

{

rightResourcesList.add(entry.getValue());

rightResourcesSize++;

}

else

{

wrongResourcesList.add(entry.getValue());

wrongResourcesSize++;

}

}

// 解析正确的资源将直接保存

if (!rightResourcesList.isEmpty())

{

// 获取供应商组ID

List<SupplierGroup> supplierGroupList = supplierGroupService.querySupplierGroupBySupplierId(supplierId);

if (ObjectUtils.notNull(supplierGroupList) && !supplierGroupList.isEmpty())

{

marketResourcePublish(rightResourcesList, supplierGroupList.get(0), context, supplierId);

}

}

returnMap.put("wrongResourcesList", wrongResourcesList);

returnMap.put("rightResourcesSize", rightResourcesSize);

returnMap.put("wrongResourcesSize", wrongResourcesSize);

returnMap.put("samePackgeNoResourcesSize", samePackgeNoResourcesSize);

cacheService.set("wrongResourceDataMap" + randomNum, JSON.toJSONString(returnMap), 120);

// 当前解析的进度

cacheService.set("precent" + randomNum, "100", 120);


}

return returnMap;

}

/**

*

* @description: 跳转到显示进度条的页面

* @param request

* @return

* @author: matao

* @createTime:2015年6月25日 下午8:09:13

*/

@RequestMapping(value = "/excel_publish_progress")

public ModelAndView excelPublishProgress(@RequestParam(required = true) String randomNum)

{

return new ModelAndView("/resource/inventory/excel_publish_progress", "randomNum", randomNum);

}

进度条窗口页面:

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Excel发布_钢银商家中心</title>

<link href="http://static.banksteel.com/2014/images/fav.ico" rel="shortcut icon">

<link href="http://static.banksteel.com/member/v3/css/resource.css" rel="stylesheet" type="text/css">

</head>

<body class="pop pop-excel1">

<div class="popup-bg">

<div class="popup-box">

<ul class="pub-excel-content">

<li class="publish-tip1">系统正在读取资源数据...<span id="counter">0%</span></li>

<li class="publish-speed"><div class="speed1"><span></span></div></li>

</ul>

<input type="hidden" id="randomNum" value="$!{randomNum}"/>

</div>

</div>

<script src="http://static.banksteel.com/member/v3/js/jquery-1.10.2.js"></script>

<script src="http://static.banksteel.com/member/v3/js/base.js"></script>

<script src="http://static.banksteel.com/member/v3/js/global.js"></script>

<script type="text/javascript">

var timerProgress = "";

$(function(){

timerProgress = setInterval(showProgress,100);

})

function showProgress(){

var ajaxTimeout = jQuery.ajax({

url:"/resource/inventory/show_progress.jsp",

timeout : 1000,

type:"get",

async:false,

data: {"randomNum":$("#randomNum").val()},

dataType:"text",

success: function(num)

{

if(num == null)

{

ajaxTimeout.abort();

$('#counter').html(0+'%');

$(".speed1 span").css("width","0%");

clearInterval(timerProgress);

}

else

{

$(".speed1 span").css("width",num+"%");



if(num>0 && num<20)

{

$('.publish-tip1').html("系统正在读取资源数据...<span id='counter'>"+num+"%</span>");

}

if(num>20 && num<80)

{

$('.publish-tip1').html("系统正在解析资源数据...<span id='counter'>"+num+"%</span>");

}

if(num ==80)

{

$('.publish-tip1').html("解析完成,正在保存...<span id='counter'>"+num+"%</span>");

}

if(num == 100)

{

clearInterval(timerProgress);

window.parent.location.href = "/resource/inventory/excel_publish_result.jsp?randomNum="+$("#randomNum").val();

}



}



}

});

}

</script>

</body>

</html>

//展示错误的数据

@Override

public Map<String, Object> getPublishShopResourceByExcelProcess(String randomNum)

{

Map<String, Object> returnMap = new HashMap<String, Object>();

String precent = cacheService.get("precent" + randomNum);

returnMap.put("precent", precent);

if (NumberUtils.parseInt(precent) == 100)

{

String wrongResourceData = cacheService.get("wrongResourceDataMap" + randomNum);

if (StringUtils.notTrimEmpty(wrongResourceData))

{

JSONObject jsonObject = JSONObject.parseObject(wrongResourceData);

returnMap.put("wrongResourcesList", jsonObject.get("wrongResourcesList"));

returnMap.put("wrongResourcesSize", jsonObject.get("wrongResourcesSize"));

returnMap.put("rightResourcesSize", jsonObject.get("rightResourcesSize"));

returnMap.put("samePackgeNoResourcesSize", jsonObject.get("samePackgeNoResourcesSize"));

}

}

return returnMap;

}

错误数据展示页面

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Excel发布_钢银商家中心</title>

<link href="http://static.banksteel.com/2014/images/fav.ico" rel="shortcut icon">

<link href="http://static.banksteel.com/member/v3/css/resource.css" rel="stylesheet" type="text/css">

</head>

<body>

#parse("/inc/topbar.vm")

#parse("/inc/header_bd.vm")

<div class="warp">

#parse("/inc/side_seller.vm")

<div class="main fr">

<div class="cl">

<h2 class="fl" data-rel="resource-index">

<i></i>资源列表

</h2>



</div>

<div class="popup-bg">

<div class="popup-box">

<form class="" role="form" id="shopResourceForm" action="/resource/inventory/cover_packageNo.jsp" method="post" >

<ul class="pub-excel-content">

<li class="publish-tip"><img src="http://static.banksteel.com/member/v3/images/res_right.png">资源解析完成,成功<span class="sp1">$!{returnMap.rightResourcesSize}</span>条,非标准<span class="sp2">$!{returnMap.wrongResourcesSize}</span>条,其中捆包号重复<span
class="sp2">#if($!{returnMap.samePackgeNoResourcesSize}) $!{returnMap.samePackgeNoResourcesSize} #else 0 #end</span>条</li>

#if($!{returnMap.wrongResourcesList} && $returnMap.wrongResourcesList.size() != 0)

<li class="excel-tit"><b>失败资源明细</b></li>

<li>

<table width="100%" cellspacing="0" cellpadding="0" border="0" class="table" id="simpledatatable">

<tbody>

<tr class="bg">

<th width="8%"> 品名</th>

<th width="8%"> 规格</th>

<th width="8%"> 材质</th>

<th width="8%"> 品牌</th>

<th width="10%">交货地 仓库</th>

<th width="8%"> 捆包号 </th>

<th width="8%"> 价格 </th>

<th width="7%"> 数量 </th>

<th width="7%"> 重量 </th>

<th width="6%"> 备注 </th>

<th class="last" width="14%"> 失败原因 </th>

</tr>



#foreach($shopResource in $!{returnMap.wrongResourcesList})

<tr>

<td #if($!shopResource.wrongFlag[0] == 1) class="danger" #end id="category_$!velocityCount">$!{shopResource.breed} </td>

<td #if($!shopResource.wrongFlag[1] == 1) class="danger" #end id="spec_$!velocityCount">$!{shopResource.spec} </td>

<td #if($!shopResource.wrongFlag[2] == 1) class="danger" #end id="material_$!velocityCount">$!{shopResource.material} </td>

<td #if($!shopResource.wrongFlag[3] == 1) class="danger" #end id="factory_$!velocityCount">$!{shopResource.brand} </td>

<td #if($!shopResource.wrongFlag[4] == 1) class="danger" #end id="warehouse_$!velocityCount">$!{shopResource.city} $!{shopResource.warehouse}</td>

<td #if($!shopResource.wrongFlag[8] == 1) class="danger" #end>$!{shopResource.serialNo}</td>

<td #if($!shopResource.wrongFlag[7] == 1) class="danger" #end>$!{shopResource.onboardPrice}</td>

<td #if($!shopResource.wrongFlag[6] == 1) class="danger" #end>$!{shopResource.inItems}</td>

<td #if($!shopResource.wrongFlag[5] == 1) class="danger" #end>$!{shopResource.inQty}</td>

<td>$!{shopResource.note}</td>

<td class="last">$!{shopResource.wrongReson}</td>



<input type="hidden" name="breedName" value="$!{shopResource.breed}">

<input type="hidden" name="breedId" value="$!{shopResource.breedId}">

<input type="hidden" name="specName" value="$!{shopResource.spec}">

<input type="hidden" name="materialName" value="$!{shopResource.material}">

<input type="hidden" name="cityName" value="$!{shopResource.city}">

<input type="hidden" name="cityId" value="$!{shopResource.cityId}">

<input type="hidden" name="warehouseName" value="$!{shopResource.warehouse}">

<input type="hidden" name="brandName" value="$!{shopResource.brand}">



<input type="hidden" name="weightWay" value="$!{shopResource.weightWay}">

<input type="hidden" name="serialNo" value="$!{shopResource.serialNo}">

<input type="hidden" name="basePrice" value="$!{shopResource.onboardPrice}">

<input type="hidden" name="onboardPrice" value="$!{shopResource.onboardPrice}">

<input type="hidden" name="averageQty" value="$!{shopResource.averageQty}">

<input type="hidden" name="inItems" value="$!{shopResource.inItems}">

<input type="hidden" name="inQty" value="$!{shopResource.inQty}">

<input type="hidden" name="note" value="$!{shopResource.note}">

<input type="hidden" name="wrongReason" value="$!{shopResource.wrongReson}">

<input type="hidden" name="unstandardFlag" #if($!shopResource.wrongFlag[0] == 1 || $!shopResource.wrongFlag[1] == 1 || $!shopResource.wrongFlag[2] == 1 ||$!shopResource.wrongFlag[3] == 1||$!shopResource.wrongFlag[4]
== 1||$!shopResource.wrongFlag[5] == 1||$!shopResource.wrongFlag[6] == 1||$!shopResource.wrongFlag[7] == 1) value="1" #else value="0" #end>

<input type="hidden" name="isCover" #if($!shopResource.wrongFlag[8] == 1) value="1" #else value="0" #end >

</tr>

#end

</tbody>

</table>

</li>

#end

<li class="pub-excel-btn">

#if($!{returnMap.wrongResourcesList} && $returnMap.wrongResourcesList.size() != 0)

<a onclick="coverShopResource();" class="pub-excel-btn2" href="javascript:void(0)">覆盖相同捆包号资源</a>    

#end

<a class="pub-excel-btn1" href="/resource/inventory/list.jsp">返回</a>

</li>

</ul>

</form>

</div>

</div>

</div>

</div>

<script src="http://static.banksteel.com/member/v3/js/jquery-1.10.2.js"></script>

<script src="http://static.banksteel.com/member/v3/js/base.js"></script>

<script src="http://static.banksteel.com/member/v3/js/global.js"></script>

<script type="text/javascript">

$(function(){

//列表hover以及隔行换色

$(".table tr").hover(function(){

$(this).addClass("over");

},function(){$(this).removeClass("over");});

$(".table tr:even").addClass("alt");

})

//覆盖相同捆包号的资源

function coverShopResource()

{

var packageNoCount = 0;

$("#simpledatatable tr").each(function(i){

var firstTdObj = $(this).find("td:eq(0)");

var fifthTdObj = $(this).find("td:eq(4)")

var sixthTdObj = $(this).find("td:eq(5)");

var firAttr=firstTdObj.attr("class");

var fifAttr=fifthTdObj.attr("class");

if(sixthTdObj.attr("class") == "danger" && typeof(firAttr) == "undefined" && typeof(fifAttr) == "undefined")

{

packageNoCount++;

}

});

if(packageNoCount > 0)

{



if(confirm("表格中捆包号红色的标准资源会覆盖保存!确认覆盖保存吗"))

{

$("#shopResourceForm").submit();

}

}

else

{

$("#shopResourceForm").submit();

}



}

</script>

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: