基于bootstraptable封装一个过滤组件(带文本,下拉,弹窗多选搜索)

workProcedureIn:{ field: “workProcedureIn”, dataType: “hidde”, data: [], value:[], defaultValue: null, mode: “client” },

workProcedureNotIn:{ field: “workProcedureNotIn”, dataType: “hidde”, data: [], value:[], defaultValue: null, mode: “client” },

classes: { field: “Classes”, dataType: “pop”, data: [], defaultValue: null, mode: “client”,sortFunc:classesSort },

cylinderNo: { field: “CylinderNo”, dataType: “pop”, data: [], defaultValue: null, mode: “client” }

},

target: “table1”,

tableRefresh: function (tableDataList, filterData) {

return tableDataList.filter(function (items) {

var isMacth = true;

if (isMacth && bootstrapFiterTableUtils.likeIsMacth(filterData.sCardNo, items.sCardNo)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.equalIsMacth(filterData.sWorkCentreName, items.sWorkCentreName)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.likeIsMacth(filterData.sMaterialLot, items.sMaterialLot)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.equalIsMacth(filterData.sCustomerFullName, items.sCustomerFullName)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.equalIsMacth(filterData.orderType, items.orderType)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.multipleEqualIsMacth(filterData.operationMode, items.operationMode)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.multipleEqualIsMacth(filterData.sMaterialTypeName, items.sMaterialTypeName)) { isMacth = true; } else { isMacth = false; };

if (isMacth && sColorNameIsMacth(filterData.sColorName,items)){ isMacth = true;}else{ isMacth = false;};

if (isMacth && bootstrapFiterTableUtils.equalIsMacth(filterData.sChemicalGroup, items.sChemicalGroup)) { isMacth = true; } else { isMacth = false; };

if (isMacth && colorSeriesIsMacth(filterData.colorSeries, items)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.multipleEqualIsMacth(filterData.ProductionSign, items.ProductionSign)) { isMacth = true; } else { isMacth = false; };

if (isMacth && workProcedureInIsMacth(bootstrapFiterTable1.option.filterData.workProcedureIn.value,items)){ isMacth = true;}else{ isMacth = false;};

if (isMacth && workProcedureNotInIsMacth(bootstrapFiterTable1.option.filterData.workProcedureNotIn.value, items)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.multipleEqualIsMacth(filterData.classes, items.Classes)) { isMacth = true; } else { isMacth = false; };

if (isMacth && bootstrapFiterTableUtils.equalIsMacth(filterData.cylinderNo, items.CylinderNo)) { isMacth = true; } else { isMacth = false; };

return isMacth;

})

},

linkage:true

});

bootstrapFiterTable1.init();

}

function classesSort(a, b) {

var _a = “”;

var _b = “”;

var _a1 = 0;

var _b1 = 0;

if (a.name == null) { _a = “1900-01-01_白班” } else { _a = a.name; if (a.split('')[1] == “白班”) { _a1 = 0 } else { _a1 = 0.00001 } };

if (b.name == null) { _b = “1900-01-01_白班” } else { _b = b.name; if (b.split('')[1] == “白班”) { _b1 = 0 } else { _b1 = 0.00001 } };

return new Date(a.split('‘)[0]) - new Date(b.split('’)[0]) + (_a1 -_b1);

}

function sChemicalGroupIsMacth(search_value,items){

var isMacth = false;

if(search_value ==“√”){

if(items.sChemicalGroup != “” || items.sChemicalGroup != null){

isMacth = true;

}

}else if(bootstrapFiterTableUtils.equalIsMacth(search_value,items.sChemicalGroup)){

isMacth = true;

}

return isMacth;

}

function nPlanOutputQtyIsMacth(search_value,items){

var isMacth = false;

if(search_value == “”){

isMacth = true;

}else{

if(parseFloat(search_value)<=items.nPlanOutputQty){

isMacth = true;

}

}

return isMacth;

}

function colorSeriesIsMacth(search_value,items){

var isMacth = false;

if(bootstrapFiterTableUtils.equalIsMacth(search_value,items.colorSeries)){

isMacth = true;

}

if(search_value == “公共色号” && items.sColorName == “本白”){

isMacth = false;

}

return isMacth;

}

function sColorNameIsMacth(search_value,items){

var isMacth = false;

if(search_value == “”){

isMacth = true;

}else{

if(search_value == “包含待定色”){

isMacth = true;

}

if(search_value == “待定色” && bootstrapFiterTableUtils.likeIsMacth(“待定色”, items.sColorName)){

isMacth = true;

}

if(search_value == “不包含待定色” && !bootstrapFiterTableUtils.likeIsMacth(“待定色”, items.sColorName)){

isMacth = true;

}

if(search_value == “不包含公共色号” && items.sColorNo.length >7){

isMacth = true;

}

}

return isMacth;

}

function iPrintCountIsMacth(search_value,items){

var isMacth = false;

if(search_value == “”){

isMacth = true;

}else{

if(search_value == “未打印” && parseFloat(search_value) == 0){

isMacth = true;

}

}

return isMacth;

}

function workProcedureInIsMacth(search_value,items){

var isMacth = false;

if(search_value.length==0){

isMacth = true;

}else{

search_value.forEach(function(search_items){

if(bootstrapFiterTableUtils.likeIsMacth(“;”+search_items+“-”, items.workingProcedureList)){

isMacth = true;

}

})

}

return isMacth;

}

function workProcedureNotInIsMacth(search_value,items){

var isMacth = true;

if(search_value.length==0){

isMacth = true;

}else{

search_value.forEach(function(search_items){

if(!bootstrapFiterTableUtils.likeIsMacth(“;”+search_items+“-”, items.workingProcedureList)){

isMacth = false;

}

})

}

return isMacth;

}

function btn_workProcedureIn() {

var index = layer.open({

btn: [‘确认’, ‘取消’], //按钮

yes: function (index, layero) {

var data = parent.$(“#layui-layer-iframe” + index)[0].contentWindow.getData();

bootstrapFiterTable1.option.filterData.workProcedureIn.value = [];

for (var i = 0; i < data.length; i++) {

bootstrapFiterTable1.option.filterData.workProcedureIn.value.push(data[i].Name);

}

bootstrapFiterTable1.refresh();

layer.close(index);

}, btn2: function (index, layero) {

layer.close(index);

},

type: 2,

title: ‘工序’,

area: [‘300px’, ‘500px’],

shadeClose: true, //开启遮罩关闭

content: ‘/CommonModule/PM_CardNoProgressTrack/WorkProcedureList’,

success: function (layero, index) {

parent.$(“#layui-layer-iframe” + index)[0].contentWindow.setSelections(bootstrapFiterTable1.option.filterData.workProcedureIn.value);

}

});

}

function btn_workProcedureNotIn() {

var index = layer.open({

btn: [‘确认’, ‘取消’], //按钮

yes: function (index, layero) {

var data = parent.$(“#layui-layer-iframe” + index)[0].contentWindow.getData();

bootstrapFiterTable1.option.filterData.workProcedureNotIn.value =[];

for (var i = 0; i < data.length; i++) {

bootstrapFiterTable1.option.filterData.workProcedureNotIn.value.push(data[i].Name);

}

bootstrapFiterTable1.refresh();

layer.close(index);

}, btn2: function (index, layero) {

layer.close(index);

},

type: 2,

title: ‘工序’,

area: [‘300px’, ‘500px’],

shadeClose: true, //开启遮罩关闭

content: ‘/CommonModule/PM_CardNoProgressTrack/WorkProcedureList’,

success: function (layero, index) {

parent.$(“#layui-layer-iframe” + index)[0].contentWindow.setSelections(bootstrapFiterTable1.option.filterData.workProcedureNotIn.value);

}

});

}

function initTable1() {

$table1.bootstrapTable({

data: [],

method: ‘post’, //请求方式(*)

striped: false, //是否显示行间隔色

cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)

pagination: true, //是否显示分页(*)

sortable: true, //是否启用排序

sortOrder: “asc”, //排序方式

sidePagination: “client”, //分页方式:client客户端分页,server服务端分页(*)

pageList: [50, 100, 150, 200], //可供选择的每页的行数(*)

search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大

strictSearch: false,

showColumns: false, //是否显示所有的列

showRefresh: false, //是否显示刷新按钮

minimumCountColumns: 2, //最少允许的列数

clickToSelect: true, //是否启用点击选中行

height: $(window).height() - 130, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度

uniqueId: “”, //每一行的唯一标识,一般为主键列

showToggle: false, //是否显示详细视图和列表视图的切换按钮

cardView: false, //是否显示详细视图

detailView: false, //是否显示父子表

iconSize: ‘outline’,

showFooter: true,

columns: [{

width: ‘90px’,

title: ‘完成日期’,

field: ‘tFactEndTime’,

sortable: true,

formatter: function (value, item, index) {

return value.substr(0, 10);

},

footerFormatter: function (items) {

return “合计:”;

}

}, {

width: ‘130px’,

title: ‘卡号’,

field: ‘sCardNo’,

formatter: function (value, item, index) {

var span =“”;

span += item.sCardNo + “
”;

span += item.tCreateTime.substr(0,10) + “
”;

span += item.sWorkCentreName + “
”;

span += item.operationMode;

return span;

},

footerFormatter: function (items) {

var count = 0;

for (var i in items) {

count++;

}

return “合计:” + count;

},

sortable: true

}, {

width: ‘120px’,

title: ‘批号’,

field: ‘sMaterialLot’,

formatter: function (value, item, index) {

var span =“”;

span += item.sMaterialLot + “
”;

span += item.sCustomerFullName + “
”;

span += item.sSalesName + “
”;

span += item.orderType;

return span;

},

sortable: true

}, {

width: ‘100px’,

title: ‘品种’,

field: ‘sMaterialName’,

formatter: function (value, item, index) {

var span =“”;

span += item.sMaterialName + “
”;

span += Utils.isnull(item.ProofingClothState,‘’) + “
”;

return span;

},

sortable: true

}, {

width: ‘190px’,

title: ‘规格’,

sortable: true,

field: ‘OrderComponent’

}, {

width: ‘210px’,

title: ‘加工要求’,

sortable: true,

field: ‘OrderFinishingMethod’,

formatter: function (value, item, index) {

var span =“”;

span += item.OrderFinishingMethod + “
”;

span += item.OrderRemark + “
”;

return span;

}

}, {

width: ‘120px’,

title: ‘色号’,

field: ‘sColorNo’,

formatter: function (value, item, index) {

var span =“”;

span += item.sColorNo + “
” + item.sColorName;

if(item.ProductionSign != null)

{

span += “
” + item.ProductionSign +“”;

}

return span;

},

footerFormatter: function (f_list) {

var f_arr = [];

for (var i = 0; i < f_list.length; i++) {

if(f_arr.findIndex((item, index) => {return item == f_list[i].sColorNo;})==-1){

f_arr.push(f_list[i].sColorNo);

}

}

return f_arr.length;

},

sortable: true

}, {

width: ‘120px’,

title: ‘颜色’,

field: ‘sColorNo’,

formatter: function (value, item, index) {

var span =“”;

span += Utils.isnull(item.colorSeries,“”) +“/” + Utils.isnull(item.ColorSystem2,“”) + “
”;

span +=“

”;

span += Utils.isnull(item.sChemicalGroup,“”);

return span;

},

sortable: true

}, {

width: ‘70px’,

field: ‘nPlanOutputQty’,

title: ‘米数’,

sortable: true,

footerFormatter: function (items) {

var count = 0;

for (var i in items) {

count += items[i][this.field];

}

return count;

}

}, {

width: ‘300px’,

field: ‘workingProcedureList’,

title: ‘工序进度’,

formatter: function (value, item, index) {

var workingProcedureList = value.split(‘-’);

var _sWorkingProcedureName = “”;

for (var i = 0; i < workingProcedureList.length; i++) {

(function (j) {

var workingProcedure = workingProcedureList[j].split(‘;’);

if (workingProcedure[0] == 1) {

_sWorkingProcedureName += “”;

} else if (workingProcedure[1] == 1) {

_sWorkingProcedureName += “”;

}

_sWorkingProcedureName += workingProcedure[2];

_sWorkingProcedureName += “-”;

})(i)

}

if (_sWorkingProcedureName.length > 0) {

_sWorkingProcedureName = _sWorkingProcedureName.substr(0, _sWorkingProcedureName.length - 1);

}

return _sWorkingProcedureName;

},

sortable: true

},

{

width: ‘90px’,

title: ‘计划工序’,

field: ‘sWorkingProcedureName’,

sortable: true

},

{

width: ‘90px’,

title: ‘班次’,

field: ‘Classes’,

formatter: function (value, item, index) {

var span =“”;

if(item.sWorkingProcedureName !=null){

span += item.sWorkingProcedureName +“
”;

}

if(item.Classes !=null){

span += item.Classes;

}

return span;

},

sortable: true

},

{

width: ‘90px’,

title: ‘机台号’,

field: ‘CylinderNo’,

sortable: true

最后

2020年在匆匆忙忙慌慌乱乱中就这么度过了,我们迎来了新一年,互联网的发展如此之快,技术日新月异,更新迭代成为了这个时代的代名词,坚持下来的技术体系会越来越健壮,JVM作为如今是跳槽大厂必备的技能,如果你还没掌握,更别提之后更新的新技术了。

更多JVM面试整理:

able: true

},

{

width: ‘90px’,

title: ‘计划工序’,

field: ‘sWorkingProcedureName’,

sortable: true

},

{

width: ‘90px’,

title: ‘班次’,

field: ‘Classes’,

formatter: function (value, item, index) {

var span =“”;

if(item.sWorkingProcedureName !=null){

span += item.sWorkingProcedureName +“
”;

}

if(item.Classes !=null){

span += item.Classes;

}

return span;

},

sortable: true

},

{

width: ‘90px’,

title: ‘机台号’,

field: ‘CylinderNo’,

sortable: true

最后

2020年在匆匆忙忙慌慌乱乱中就这么度过了,我们迎来了新一年,互联网的发展如此之快,技术日新月异,更新迭代成为了这个时代的代名词,坚持下来的技术体系会越来越健壮,JVM作为如今是跳槽大厂必备的技能,如果你还没掌握,更别提之后更新的新技术了。

[外链图片转存中…(img-ZSDtPPZM-1721176871979)]

更多JVM面试整理:

[外链图片转存中…(img-fn7UOCv2-1721176871979)]

  • 22
    点赞
  • 24
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值