<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../javascript/tools/common/SwapList.js"></script><script src="../javascript/tools/common/Util.js"></script><script src="../javascript/tools/promotion/jquery.js"></script><script src="../javascript/tools/promotion/calendar/WdatePicker.js" type="text/javascript"></script><script src="/wcs/javascript/tools/common/dynamiclist.js"></script><script src="/wcs/javascript/tools/common/Vector.js"></script><script src="../javascript/tools/promotion/jquery.cookie.js"></script><script src="../javascript/tools/promotion/voucherBigPackage/bigPacageUtil.js"></script><script src="../javascript/tools/promotion/voucherBigPackage/utilforBigPackage.js"></script><script src="../javascript/tools/promotion/voucherBigPackage/SNProductGroupList1.js"></script><link href="../javascript/tools/promotion/calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function initializeState(){
if(top.getData("name")!=undefined){
document.package.name.value=top.getData("name");
}
getBrand();
initTableA();
getCatgory();
initTableB();
getProduct();
if(jsonList != undefined && jsonList != null){
initTableC(jsonList);
}else{
initTableC("");
}
disableButton();
judgeFlag();
parent.parent.setContentFrameLoaded(true);
}
function judgeFlag(){
var brandf=top.get("brandFlag");
var catgoryf=top.get("catgoryFlag");
if(brandf != undefined && brandf != null){
if(brandf=="t"){
document.getElementById("debarBrand").setAttribute("disabled","true");
document.getElementById("addBrand").removeAttribute("disabled");
}else if(brandf=="f"){
document.getElementById("addBrand").setAttribute("disabled","true");
document.getElementById("debarBrand").removeAttribute("disabled");
}
}
if(catgoryf != undefined && catgoryf != null){
if(catgoryf=="t"){
document.getElementById("debarCatgory").setAttribute("disabled","true");
document.getElementById("addCatgory").removeAttribute("disabled");
}else if(catgoryf=="f"){
document.getElementById("addCatgory").setAttribute("disabled","true");
document.getElementById("debarCatgory").removeAttribute("disabled");
}
}
}
parent.cancelAction =function(){
top.put("brandFlag",null);
top.put("catgoryFlag",null);
top.saveModel(parent.model);
top.goBack();
}
//对应下一步按钮事件,
parent.sumbitAction =function(){
var name=document.package.name.value;
if(name==""){
alertDialog("包名不能为空!");
document.package.name.focus();
return false;
}
top.put("brandFlag",null);
top.put("catgoryFlag",null);
var brandInfo = top.getData("brandTmp");
var catgoryInfo = top.getData("catTmp");
var productInfo = top.getData("jsonList");
var objp=new Object();
/**
if((brandInfo == undefined || brandInfo == null || brandInfo.length <= 0)
&& (catgoryInfo == undefined || catgoryInfo == null || catgoryInfo.length <= 0)
&& (productInfo == undefined || productInfo == null || productInfo.length <= 0)){
alert("请选择相应的数据");
return false;
}
**/
if(brandInfo != undefined && brandInfo != null && brandInfo.length > 0 ){
//top.sendBackData(brandInfo,"brandResultsList");
var brandCode=brandInfo;
var brandCodeList=new Array();//品类
var flag=new Array();// 标志位
var lastBrand="";//品牌
var lastFlagB="";
for(var i=0;i<brandCode.length;i++){
brandCodeList[i]=brandCode[i].brandCode;
flag[i]=brandCode[i].flag;
//alert(brandCodeList[i])
}
for(var j=0;j<brandCodeList.length;j++){
lastBrand+=brandCodeList[j]+";";
lastFlagB+= flag[j]+";";
if(j==brandCodeList.length-1){
lastBrand=lastBrand.substring(0,lastBrand.length-1);
lastFlagB=lastFlagB.substring(0,lastFlagB.length-1);
}
}
objp["lastBrand"]=lastBrand;//品牌编码组
objp["lastFlagB"]=lastFlagB;//品牌编码组
//alert(lastFlagB)
//top.showContent(url,objp);
}
if(catgoryInfo != undefined && catgoryInfo != null && catgoryInfo.length > 0 ){
//top.sendBackData(catgoryInfo,"catgoryResultsList");
var catery=catgoryInfo;
var caterList=new Array();//品类
var lastcatery="";//品类列表
var lastFlagc="";
var flag=new Array();// 标志位
for(var i=0;i<catery.length;i++){
caterList[i]=catery[i].catGroupId;
flag[i]=catery[i].flag;
}
for(var j=0;j<caterList.length;j++){
lastcatery+=caterList[j]+";";
lastFlagc+= flag[j]+";";
if(j==caterList.length-1){
lastcatery=lastcatery.substring(0,lastcatery.length-1);
lastFlagc=lastFlagc.substring(0,lastFlagc.length-1);
}
}
objp["lastcatery"]=lastcatery;//品类编码组
objp["lastFlagc"]=lastFlagc;//品类包含标志
//alert(lastFlagc)
//top.showContent(url,objp);
}
if(productInfo != undefined && productInfo != null && productInfo.length > 0 ){
//top.sendBackData(productInfo,"ProductResultsList");
var lastData = productInfo;
var categoryIdList="";//单品的编码
var lastFlagP="";
var flag=new Array();// 标志位
for(var i=0;i<lastData.length;i++){
categoryIdList+=lastData[i].categoryId+";";
lastFlagP+= lastData[i].flag+";";
if(i==lastData.length-1){
categoryIdList=categoryIdList.substring(0,categoryIdList.length-1);
lastFlagP=lastFlagP.substring(0,lastFlagP.length-1);
}
}
objp["categoryIdList"]=categoryIdList;
objp["lastFlagP"]=lastFlagP;
//alert(lastFlagP)
//top.showContent(url,objp);
}
objp["name"]=name;
savePackageData(objp)
//top.showContent(url,objp);
//alert(lastFlagP)
//alert(lastFlagc)
//alert(lastFlagB)
//top.goBack();
}
function savePackageData(obj){
var vurl = "/webapp/wcs/tools/servlet/SNCreateBigPackageCmd";
var pdata = {name:obj.name,lastFlagP:obj.lastFlagP,categoryIdList:obj.categoryIdList,lastFlagc:obj.lastFlagc,lastcatery:obj.lastcatery,lastFlagB:obj.lastFlagB,lastBrand:obj.lastBrand};
$.ajax({
type: "POST",
cache:false,
url: vurl,
data: pdata,
success: function(data){
if(data){
alertDialog(data);
}
refreshList();
}
});
}
function refreshList(){
top.saveData(null,"brandResultsList");
top.saveData(null,"name");
top.saveData(null,"brandTmp");
top.saveData(null,"catTmp");
top.saveData(null,"jsonList");
top.saveData(null,"brandCode");
top.saveData(null,"brandName");
top.saveData(null,"catResultsList");//品类列表的值
top.saveData(null,"cateryId");
top.saveData(null,"cateryName");
top.saveData(null,"resultsList");
var url="/webapp/wcs/tools/servlet/NewDynamicListView?ActionXMLFile=SNPromotion.SNkwPackageView2List&cmd=SNCreatePackageView2";
parent.parent.CONTENTS.location.replace(url);
}
//控制添加按钮是否可用
function disableButton(){
var brand = top.getData("brandTmp");
if(brand != undefined && brand != null && brand.length > 0){
for(var i=0;i<brand.length;i++){
if(brand[i].flag==1){
document.getElementById("debarBrand").setAttribute("disabled","true");
document.getElementById("addBrand").removeAttribute("disabled");
}else if(brand[i].flag==0){
document.getElementById("addBrand").setAttribute("disabled","true");
document.getElementById("debarBrand").removeAttribute("disabled");
}
}
}else{
document.getElementById("debarBrand").removeAttribute("disabled");
document.getElementById("addBrand").removeAttribute("disabled");
}
var catgory = top.getData("catTmp");
if(catgory != undefined && catgory != null && catgory.length > 0){
for(var i=0;i<catgory.length;i++){
if(catgory[i].flag==1){
document.getElementById("debarCatgory").setAttribute("disabled","true");
document.getElementById("addCatgory").removeAttribute("disabled");
}else if(catgory[i].flag==0){
document.getElementById("addCatgory").setAttribute("disabled","true");
document.getElementById("debarCatgory").removeAttribute("disabled");
}
}
}else{
document.getElementById("addCatgory").removeAttribute("disabled");
document.getElementById("debarCatgory").removeAttribute("disabled");
}
}
//全选列表方法
function checkAll(states,flag) {
switch(flag){
case 1:
var chks = document.getElementsByName("checkAll1");
for(var i = 0,j = chks.length; i < j; i++) {
chks[i].checked = states;
}
break;
case 2:
var chks = document.getElementsByName("checkAll2");
for(var i = 0,j = chks.length; i < j; i++) {
chks[i].checked = states;
}
break;
case 3:
var chks = document.getElementsByName("checkAll3");
for(var i = 0,j = chks.length; i < j; i++) {
chks[i].checked = states;
}
break;
}
}
//删除操作
function deleteInfo(deleteflag){
var s= new Array();
var result = new Array();
var index = new Array();
switch(deleteflag){
//删除品牌
case 'brand':
var chks = document.getElementsByName("checkAll1");
for (var i = 0,j = chks.length; i < j; i++) {
if(chks[i].checked == true){
s[s.length]=chks[i].value;
}
}
index = top.getData("brandTmp");
break;
//删除品类
case 'catgory':
var chks = document.getElementsByName("checkAll2");
for (var i = 0,j = chks.length; i < j; i++) {
if(chks[i].checked == true){
s[s.length]=chks[i].value;
}
}
index = top.getData("catTmp");
break;
//删除单品
case 'product':
var chks = document.getElementsByName("checkAll3");
for (var i = 0,j = chks.length; i < j; i++) {
if(chks[i].checked == true){
s[s.length]=chks[i].value;
}
}
index = top.getData("jsonList");
break;
}
if(s != null && s.length > 0){
for(var m=0;m < eval(s[0].toString());m++){
result[result.length]=index[m];
}
for(var n=0;n < s.length;n++){
if((n+1) < s.length){
for(var k = eval(s[n].toString())+1;k < eval(s[n+1].toString());k++){
result[result.length]=index[k];
}
}else{
for(var p = eval(s[n].toString())+1; p < index.length;p++){
result[result.length]=index[p];
}
}
}
var code = new Array();
var name = new Array();
if(deleteflag=="brand"){
if(result.length > 0){
for(var i=0;i<result.length;i++){
code[code.length]=result[i].brandCode;
name[name.length]=result[i].brandName;
}
}
top.saveData(name,"brandName");
top.saveData(code,"brandCode");
top.saveData(result,"brandTmp");
$("#perBrand").html("");
getBrand();
initTableA();
}else if(deleteflag=="catgory"){
if(result.length > 0){
for(var i=0;i<result.length;i++){
code[code.length]=result[i].catGroupId;
name[name.length]=result[i].catGroupName;
}
}
top.saveData(name,"cateryName");
top.saveData(code,"cateryId");
top.saveData(result,"catTmp");
$("#perCatgory").html("");
getCatgory();
initTableB();
}else if(deleteflag=="product"){
top.saveData(result,"jsonList");
$("#perProduct").html("");
getProduct();
if(jsonList != undefined && jsonList != null){
initTableC(jsonList);
}else{
initTableC("");
}
}
pageLoad();
disableButton();
}
}
//获得品牌
var brandCode = new Array();
var brandName = new Array();
var brandTmp =new Array();
function getBrand(){
var brandResultsList=top.getData("brandResultsList");
if(brandResultsList!=undefined&&brandResultsList!=null){
if(top.getData("brandCode")!=undefined){
brandCode=removeCatertoy(brandResultsList==null?null:brandResultsList[0],top.getData("brandCode"));
}else{
brandCode=brandResultsList==null?null:brandResultsList[0];
}
if(top.getData("brandName")!=undefined){
brandName=removeCatertoy(brandResultsList==null?null:brandResultsList[1],top.getData("brandName"));
}else{
brandName=brandResultsList==null?null:brandResultsList[1];
}
top.saveData(brandCode,"brandCode");
top.saveData(brandName,"brandName");
for(var i=0;i<brandCode.length;i++){
var obj=new Object();
obj["brandCode"]=brandCode[i];
obj["brandName"]=brandName[i];
for(var j=0;j<brandResultsList[0].length;j++){
if(brandCode[i]==brandResultsList[0][j]){
if(top.get("debar")=="1"){
obj["flag"]=1;
}else{
obj["flag"]=0;
}
}
}
var s= top.getData("brandTmp");
if(s != undefined && s != null){
for(var k=0;k<s.length;k++){
if(brandCode[i]==s[k].brandCode){
obj["flag"]=s[k].flag;
}
}
}
brandTmp.push(obj);
}
top.saveData(brandTmp,"brandTmp");
top.put("debar",null);
}else{
if(top.getData("brandTmp") != undefined && top.getData("brandTmp") != null){
brandTmp=top.getData("brandTmp");
}
}
top.saveData(null,"brandResultsList");
$("#divFood2").show();
if(brandTmp.length==0){
$("#divFood2").html("第0页/共0页");
}else{
$("#divFood2").html("第"+1+"页/共"+(brandTmp.length/5)*1+"页");
}
}
function initTableA(){
var sb=[];
sb[sb.length]='<table id="brand" cellpadding="1" cellspacing="0" border="0" width="100%" bgcolor="#FFFFFF" style="folat:left" >';
sb[sb.length]='<tr>';
sb[sb.length]="<th id='rewardAmount_full_head' class='list_header' width='1%'><input type='checkBox' onClick='checkAll(this.checked,1)'></th>";
sb[sb.length]='<th id="rewardAmount_full_head" class="list_header" >品牌编码</th>';
sb[sb.length]='<th id="toTotalLimit_full_head" class="list_header" >品牌名称</th>';
sb[sb.length]='<th id="toTotalLimit_full_head" class="list_header" >关系</th>';
sb[sb.length]='</tr>';
sb[sb.length]='<tbody id="group_one2">';
if(brandTmp!=null&&brandTmp.length>0){
for(var j=0;j<brandTmp.length;j++){
sb[sb.length]='<tr>';
sb[sb.length]='<td class="list_info1"><input type="checkBox" name="checkAll1" value="'+j+'"/></td>';
sb[sb.length]='<td class="list_info1">'+brandTmp[j].brandCode+'</td>';
sb[sb.length]='<td class="list_info1">'+brandTmp[j].brandName+'</td>';
var f=brandTmp[j].flag==1 ? '包含':'排除';
sb[sb.length]='<td class="list_info1">'+f+'</td>';
sb[sb.length]='</tr>';
}
}
sb[sb.length]='</tbody>';
sb[sb.length]='</table>';
$("#perBrand").append(sb.join(""));
var table=document.getElementById("brand");
for (var i = 0; i < table.rows.length; i++){
if ((i+1) % 2){
table.rows[i].style.backgroundColor = '#efefef';
}
}
}
//获得品类
var catRange=new Array();//全局的品类列表
var cateryId = new Array();
var cateryName = new Array();
var catTmp =new Array();
function getCatgory(){
var catResultsList=top.getData("catResultsList");//品类列表的值
if(catResultsList!=undefined&&catResultsList!=null){
if(top.getData("cateryId")!=undefined){
cateryId=removeCatertoy(catResultsList==null?null:catResultsList[0],top.getData("cateryId"));
}else{
cateryId=catResultsList==null?null:catResultsList[0];
}
if(top.getData("cateryName")!=undefined){
cateryName=removeCatertoy(catResultsList==null?null:catResultsList[1],top.getData("cateryName"));
}else{
cateryName=catResultsList==null?null:catResultsList[1];
}
top.saveData(cateryId,"cateryId");
top.saveData(cateryName,"cateryName");
for(var i=0;i<cateryId.length;i++){
var obj=new Object();
obj["catGroupId"]=cateryId[i];
obj["catGroupName"]=cateryName[i];
for(var j=0;j<catResultsList[0].length;j++){
if(cateryId[i]==catResultsList[0][j]){
if(top.get("debar2")=="1"){
obj["flag"]=1;
}else{
obj["flag"]=0;
}
}
}
var s= top.getData("catTmp");
if(s != undefined && s != null){
for(var k=0;k<s.length;k++){
if(cateryId[i]==s[k].catGroupId){
obj["flag"]=s[k].flag;
}
}
}
catTmp.push(obj);
}
top.put("debar2",null);
top.saveData(catTmp,"catTmp");
}else{
if(top.getData("catTmp") != undefined && top.getData("catTmp") != null){
catTmp=top.getData("catTmp");
}
}
top.saveData(null,"catResultsList");
$("#divFood3").show();
if(catTmp.length==0){
$("#divFood3").html("第0页/共0页");
}else{
$("#divFood3").html("第"+1+"页/共"+(catTmp.length/5)*1+"页");
}
}
function initTableB(){
var sb=[];
sb[sb.length]='<table id="catery" cellpadding="1" cellspacing="0" border="0" width="100%" bgcolor="#FFFFFF" style="folat:left" >';
sb[sb.length]='<tr>';
sb[sb.length]="<th id='rewardAmount_full_head' class='list_header' width='1%'><input type='checkBox' onClick='checkAll(this.checked,2)'></th>";
sb[sb.length]='<th id="rewardAmount_full_head" class="list_header" >品类编码</th>';
sb[sb.length]='<th id="toTotalLimit_full_head" class="list_header" >品类名称</th>';
sb[sb.length]='<th id="toTotalLimit_full_head" class="list_header" >关系</th>';
sb[sb.length]='</tr>';
sb[sb.length]='<tbody id="group_one3">';
if(catTmp!=null&&catTmp.length>0){
for(var j=0;j<catTmp.length;j++){
sb[sb.length]='<tr>';
sb[sb.length]='<td class="list_info1"><input type="checkBox" name="checkAll2" value="'+j+'"/></td>';
sb[sb.length]='<td class="list_info1">'+catTmp[j].catGroupId+'</td>';
sb[sb.length]='<td class="list_info1">'+catTmp[j].catGroupName+'</td>';
var f=catTmp[j].flag==1 ? '包含':'排除';
sb[sb.length]='<td class="list_info1">'+f+ '</td>';
sb[sb.length]='</tr>';
}
}
sb[sb.length]='</tbody>';
sb[sb.length]='</table>';
$("#perCatgory").append(sb.join(""));
var table=document.getElementById("catery");
for (var i = 0; i < table.rows.length; i++){
if ((i+1) % 2){
table.rows[i].style.backgroundColor = '#efefef';
}
}
}
//获得单品
var productRange=new Array();//全局商品列表
var jsonList;
var tmp=new Array();
var partNumber = new Array();//商品编码
var catGroupName = new Array();//商品组名称
var brandName =new Array();//品牌名称
var catGroupId = new Array();//商品组名称
var brandCode =new Array();//品牌名称
var productName =new Array();//商品名称
var salesOrgName =new Array();//销售组织名称
var vendorName = new Array();//品牌名称
var depot =new Array();//库位
var categoryId=new Array();//数量
var number=0;
function getProduct(){
var resultList = top.getData("resultsList");
if(resultList!=undefined && resultList!=null){
productRange=removeDuplicate(resultList,top.getData("jsonList"));
for(var i=0;i<productRange.length;i++){
categoryId[i]=productRange[i].categoryId;
partNumber[i]=productRange[i].partNumber;
catGroupName[i]=productRange[i].catGroupName;
brandName[i]=productRange[i].brandName;
productName[i]=productRange[i].productName;
salesOrgName[i]=productRange[i].salesOrgName;
vendorName[i]=productRange[i].vendorName;
depot[i]=productRange[i].depot;
brandCode[i]=productRange[i].brandCode;
catGroupId[i]=productRange[i].catGroupId;
}
number=productRange.length;
jsonList = productsList(number);
top.put("debar1",null);
top.saveData(jsonList,"jsonList");
}else{
if(top.getData("jsonList") != undefined && top.getData("jsonList") != null){
jsonList=top.getData("jsonList");
}
}
top.saveData(null,"resultsList");
$("#divFood1").show();
if(jsonList==undefined){
$("#divFood1").html("第0页/共0页");
}else{
$("#divFood1").html("第"+1+"页/共"+(jsonList.length/5)*1+"页");
}
}
//商品类表
function productsList(size){
var json1=new Array();//封装成JSON
for(var j=number;j>0;j--){
json1[number-j]=new Array();
json1[number-j][0]= partNumber[number-j];
json1[number-j][1]= catGroupName[number-j];
json1[number-j][2]= brandName[number-j];
json1[number-j][3]= productName[number-j];
json1[number-j][4]= salesOrgName[number-j];
json1[number-j][5]= vendorName[number-j];
json1[number-j][6]= depot[number-j];
json1[number-j][7]= categoryId[number-j];
json1[number-j][9]= brandCode[number-j];
json1[number-j][10]= catGroupId[number-j];
var s= top.getData("jsonList");
if(s != undefined && s != null){
for(var k=0;k<s.length;k++){
if(s[k].partNumber==partNumber[number-j] && s[k].salesOrgName==salesOrgName[number-j] && s[k].vendorName==vendorName[number-j] && s[k].depot==depot[number-j]){
json1[number-j][8]=s[k].flag;
}
}
}
var resultListTmp = top.getData("resultsList");
for(var m=0;m<resultListTmp.length;m++){
if(partNumber[number-j]==resultListTmp[m].partNumber && salesOrgName[number-j]==resultListTmp[m].salesOrgName &&vendorName[number-j]==resultListTmp[m].vendorName && depot[number-j]==resultListTmp[m].depot){
if(top.get("debar1")=="1"){
json1[number-j][8]= 1;
}else{
json1[number-j][8]= 0;
}
}
}
}
var strObj="[";
for(var i=0;i<json1.length;i++){
strObj+="{partNumber:'"+json1[i][0]+
"',catGroupName:'"+json1[i][1]+
"',brandName:'"+json1[i][2]+
"',productName:'"+json1[i][3]+
"',salesOrgName:'"+json1[i][4]+
"',vendorName:'"+json1[i][5]+
"',depot:'"+json1[i][6]+
"',categoryId:'"+json1[i][7]+
"',brandCode:'"+json1[i][9]+
"',catGroupId:'"+json1[i][10]+
"',flag:'"+json1[i][8];
if(i==json1.length-1){
strObj+="'}";
}else{
strObj+="'},";
}
}
strObj+="]";
var rst = eval("{" + strObj + "}");
return rst;
}
/****************************单品包含**********************************/
var input=new Array();
function initTableC(jsonList){
var sb=[];
sb[sb.length]='<table id="product" cellpadding="1" cellspacing="0" border="0" width="100%" bgcolor="#FFFFFF" style="folat:left" >';
sb[sb.length]='<tr>';
sb[sb.length]="<th id='rewardAmount_full_head' class='list_header' width='1%'><input type='checkBox' onClick='checkAll(this.checked,3)'></th>";
sb[sb.length]='<th id="rewardAmount_full_head" class="list_header" >商品代码</th>';
sb[sb.length]='<th id="toTotalLimit_full_head" class="list_header" >B2C商品类别</th>';
sb[sb.length]='<th id="toTotalLimit_full_head" class="list_header" >品牌名称</th>';
sb[sb.length]='<th id="rewardAmount_full_head" class="list_header" >商品名称</th>';
sb[sb.length]='<th id="rewardAmount_full_head" class="list_header" >销售组织名称</th>';
sb[sb.length]='<th id="adjustmentType_full_head" class="list_header" >供应商名称</th>';
sb[sb.length]='<th id="discountLimit_full_head" class="list_header" >库位</th>';
sb[sb.length]='<th id="discountLimit_full_head" class="list_header" >关系</th>';
sb[sb.length]='</tr>';
sb[sb.length]='<tbody id="group_one1">';
if(jsonList != undefined && jsonList != null){
for(var i=0;i<jsonList.length;i++){
sb[sb.length]='<tr>';
sb[sb.length]='<td class="list_info1"><input type="checkBox" name="checkAll3" value="'+i+'"/></td>';
sb[sb.length]='<td class="list_info1">'+jsonList[i].partNumber+'</td>';
sb[sb.length]='<td class="list_info1">'+jsonList[i].catGroupName+'</td>';
sb[sb.length]='<td class="list_info1">'+jsonList[i].brandName+'</td>';
sb[sb.length]='<td class="list_info1">'+jsonList[i].productName+'</td>';
sb[sb.length]='<td class="list_info1">'+jsonList[i].salesOrgName+'</td>';
sb[sb.length]='<td class="list_info1">'+jsonList[i].vendorName+'</td>';
sb[sb.length]='<td class="list_info1">'+jsonList[i].depot+'</td>';
var f=jsonList[i].flag=="1" ? '包含' : '排除';
sb[sb.length]='<td class="list_info1">'+f+'</td>';
sb[sb.length]='</tr>';
}
}
sb[sb.length]='</tbody>';
sb[sb.length]='</table>';
$("#perProduct").append(sb.join(""));
var table=document.getElementById("product");
for (var i = 0; i < table.rows.length; i++){
if ((i+1) % 2){
table.rows[i].style.backgroundColor = '#efefef';
}
}
}
function pageLoad(){
page1 = new Page(5,'product','group_one1',1,'pageno1',"divFood1"); //单品分页
page2 = new Page(5,'brand','group_one2',1,'pageno2',"divFood2"); //单品排除分页
page3 = new Page(5,'catery','group_one3',1,'pageno3',"divFood3"); //单品排除分页
}
/*******添加品牌包含 ***********************/
function insertCProducts(){
var name=document.package.name.value;
top.saveData(name,"name");
top.put("debar","1");
productType('2');
}
/*******添加品牌排除 ***********************/
function insertDProducts(){
var name=document.package.name.value;
top.saveData(name,"name");
top.put("debar","0");
productType('2');
}
/*******添加单品包含****************/
function insertSProducts(){
var name=document.package.name.value;
top.saveData(name,"name");
top.put("debar1","1");
productType('1');
}
/*******添加单品排除****************/
function insertSDProducts(){
var name=document.package.name.value;
top.saveData(name,"name");
top.put("debar1","0");
productType('1');
}
/*******添加品类(包含)**********/
function insertBProducts(){
var name=document.package.name.value;
top.saveData(name,"name");
top.put("debar2","1");
productType('3');
}
/*******添加品类(排除)**********/
function insertBDProducts(){
var name=document.package.name.value;
top.saveData(name,"name");
top.put("debar2","0");
productType('3');
}
/******公共跳转页面****************/
function productType(type){
var url;
switch(type){
case '2': {
top.put("type","brand");
url="/webapp/wcs/tools/servlet/DialogView?XMLFile=SNPromotion.SNProductSearchDialog";
top.saveModel(parent.model);
top.setContent("产品搜索",url,true);
}break;
case '1': {
top.put("type","single");
top.saveModel(parent.model);
url="/webapp/wcs/tools/servlet/DialogView?XMLFile=SNPromotion.SNProductSearchDialog";
top.setContent("产品搜索",url,true);
}break;
case '3': {
top.put("type","categroy");
url="/webapp/wcs/tools/servlet/DialogView?XMLFile=SNPromotion.SNProductSearchDialog";
top.saveModel(parent.model);
top.setContent("产品搜索",url,true);
}break;
}
}
</script><script src="/wcs/javascript/tools/common/DateUtil.js"></script><script src="/wcs/javascript/tools/common/dynamiclist.js"></script><link rel="stylesheet" type="text/css" href="<%=%20UIUtil.getCSSFile(locale)%20%>">
创建套餐包
一个包可以有单品、品牌+品类、品牌、品类默认为包含关系。
<!-- 品类 end--><!-- 品牌 begin-->
分享到:
相关推荐
在JavaScript(JS)中操作HTML表格是Web开发中常见的任务,尤其在实现CRUD(创建、读取、更新、删除)操作时。本教程将深入探讨如何使用纯JS实现这一功能,无需依赖任何外部库,如jQuery或Angular。 首先,我们需要...
1. **EasyUI DataGrid**: DataGrid是EasyUI中的核心组件之一,它用于展示和管理表格数据。通过DataGrid,我们可以实现分页、排序、过滤等功能,并且可以方便地进行数据的CRUD操作。DataGrid通过JSON数据源获取数据,...
- `App.vue`: 应用的主组件,可能包含了一个表格用于显示数据,以及按钮用于导航到其他CRUD操作页面。 - `crudService.js`: 可能是一个服务模块,封装了与后端通信的逻辑,如添加、获取、更新和删除数据的API调用。 ...
4. **分页操作**:在描述中提到了分页,这意味着项目可能包含了对大量数据的处理。分页功能通常通过计算总页数、当前页码,以及每页显示的数据量来实现,这可以帮助优化用户体验,避免一次性加载过多数据导致性能...
综合以上分析,这个CRUD示例项目主要展示了如何利用EasyUI和PHP来实现对数据库中的用户数据进行基本操作。开发者可以借此学习如何结合前端和后端技术,实现数据交互,理解CRUD操作在实际项目中的应用。通过阅读和...
5. **DAO层设计**:创建Hibernate的Data Access Object(DAO)接口和实现类,这里包含对数据库的CRUD操作方法,比如使用Session对象执行SQL语句。 6. **Service层设计**:创建Service接口和实现类,将业务逻辑封装...
PHP文件(get_users.php, update_user.php, save_user.php, remove_user.php)负责处理来自前端的请求,进行数据的CRUD操作。例如,"get_users.php" 可能会使用SQL查询语句从数据库中获取用户信息,而"save_user....
在"EasyUI第一讲"的压缩包文件中,可能包含了示例代码、HTML 模板、CSS 样式和 JavaScript 文件,这些都是用来演示如何配置和使用 DataGrid 进行 CRUD 操作的。通过研究这些文件,开发者可以更好地理解和应用 EasyUI...
本项目是关于使用Java服务器页面(JSP)和Servlet技术,结合ExtJS前端框架,实现数据的创建(Create)、读取(Read)、更新(Update)和删除(Delete),也就是常说的CRUD操作。这是一个典型的Web应用程序开发示例,...
"jQuery Table CRUD"指的是使用jQuery来实现表格数据的创建(Create)、读取(Read)、更新(Update)和删除(Delete)功能。这是一种常见的Web应用程序功能,用于管理动态数据。下面我们将深入探讨如何利用jQuery来实现这一...
本项目利用IntelliJ IDEA这个强大的集成开发环境(IDE)来整合这些技术,实现了数据库的CRUD(创建Create、读取Read、更新Update、删除Delete)操作。以下将详细介绍每个组件及其在项目中的作用。 1. **Servlet**:...
CRUD是数据库管理的基本操作,而分页则是为了提高用户体验,使得大量数据可以被有序、分批地展示。 **创建(Create)** 在ASP中,创建新数据通常涉及到向数据库执行INSERT语句。这可能通过ADO(ActiveX Data ...
在Web应用中,Model负责处理数据和业务逻辑,View负责展示数据,Controller负责接收用户请求并调用Model和View进行相应操作。在本项目中,Servlet通常作为Controller,JSP作为View,而业务逻辑和数据访问层则可能由...
grocery CRUD是一本详细介绍如何使用CodeIgniter框架进行快速开发的书籍。本书由鹤仔撰写并由鹤仔出版社荣誉出版,旨在帮助开发者们掌握grocery CRUD的核心功能及其在CodeIgniter中的应用。 #### 二、grocery CRUD...
6. 数据绑定:将表格数据绑定到JavaScript对象或数组,可以使用模板字符串或库如Vue.js,React等实现双向数据绑定,简化CRUD操作。 7. 表格插件:使用jQuery的DataTables,Bootstrap的Table,或者现代的Ag-Grid,...
- **删除**:选择特定行后,前端发起请求,后台处理删除操作,然后更新表格数据。 - **查询**:用户可以通过输入关键字或选择条件来过滤表格数据,后台根据这些条件查询数据库并返回结果。 - **修改**:用户点击...
PHP Grid 提供专业外观的 HTML 表格组件功能,提供了基于 Ajax 的编辑、创建、更新和删除操作。支持跨浏览器的即时编辑,支持所有的表单组件,集成搜索工具栏,支持图片显示,导出数据到 HTML 和 Excel ;支持权限...
4. **视图创建**:为每个操作创建视图,使用EasyUI组件构建用户界面,如使用`datagrid`展示数据,`dialog`进行编辑和删除操作。 5. **绑定数据**:控制器将模型数据传递给视图,使用`@model`指令和`@Html`辅助方法...
2. **CRUD操作**:CRUD是数据库操作的基础,这个系统实现了对人员信息的增删改查。创建新记录通常涉及表单提交,更新则通过编辑现有记录并保存更改,删除则通过选择一条记录并确认删除。JSF通过动作事件(Action ...