123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425 |
- (function ($) {
- //========= ts 时间戳转换
- $.extend($.fn.fmatter, {
- ts: function (cellvalue, options, rowdata) {
- var date = new Date();
- date.setTime(cellvalue);
- var y = date.getFullYear();
- var m = date.getMonth() + 1;
- m = m < 10 ? ('0' + m) : m;
- var d = date.getDate();
- d = d < 10 ? ('0' + d) : d;
- var h = date.getHours();
- h = h < 10 ? ('0' + h) : h;
- var minute = date.getMinutes();
- var second = date.getSeconds();
- minute = minute < 10 ? ('0' + minute) : minute;
- second = second < 10 ? ('0' + second) : second;
- return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
- }
- });
- $.extend($.fn.fmatter.ts, {
- unformat: function (cellvalue, options) {
- return (new Date(cellvalue)).valueOf();
- }
- });
- //========= enable 转换
- $.extend($.fn.fmatter, {
- enable: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '启用';
- case '0':
- return '禁用';
- case '-1':
- return '删除';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.enable, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '启用') {
- return 1;
- } else if (cellvalue === '禁用') {
- return 0;
- } else if (cellvalue === '删除') {
- return -1;
- }
- return cellvalue;
- }
- });
- //========= c1转换
- $.extend($.fn.fmatter, {
- c1: function (cellvalue, options, rowdata) {
- if (cellvalue) {
- return '#' + cellvalue;
- }
- return '';
- }
- });
- $.extend($.fn.fmatter.c1, {
- unformat: function (cellvalue, options) {
- if (cellvalue) {
- return cellvalue.slice(1);
- }
- return cellvalue.slice(1);
- }
- });
- //========= beAction 转换
- $.extend($.fn.fmatter, {
- beAction: function (cellvalue, options, rowdata) {
- if (cellvalue === 'Y') {
- return '启用';
- } else if (cellvalue === 'N') {
- return '禁用';
- } else if (cellvalue === 'D') {
- return '删除';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.beAction, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '启用') {
- return 'Y';
- } else if (cellvalue === '禁用') {
- return 'N';
- } else if (cellvalue === '删除') {
- return 'D';
- }
- return cellvalue;
- }
- });
- //========= c2转换
- $.extend($.fn.fmatter, {
- c2: function (cellvalue, options, rowdata) {
- if (cellvalue) {
- return '*' + cellvalue;
- }
- return '';
- }
- });
- $.extend($.fn.fmatter.c2, {
- unformat: function (cellvalue, options) {
- if (cellvalue) {
- return cellvalue.slice(1);
- }
- return '';
- }
- });
- //========= staffJob 转换
- $.extend($.fn.fmatter, {
- staffJob: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '拣货员';
- case '2':
- return '发货员';
- case '3':
- return '收货员';
- case '4':
- return '验货员';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.staffJob, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '拣货员') {
- return 1;
- } else if (cellvalue === '发货员') {
- return 2;
- } else if (cellvalue === '收货员') {
- return 3;
- } else if (cellvalue === '验货员') {
- return 4;
- }
- return cellvalue;
- }
- });
- //========= whareaCategory 转换
- $.extend($.fn.fmatter, {
- whareaCategory: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '存储区';
- case '2':
- return '拣货区';
- case '3':
- return '播种区';
- case '4':
- return '复核理货区';
- case '5':
- return '集货发运区';
- case '6':
- return '组装加工区';
- case '7':
- return '月台区';
- case '8':
- return '停车场';
- case '9':
- return '退货区';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.whareaCategory, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '存储区') {
- return 1;
- } else if (cellvalue === '拣货区') {
- return 2;
- } else if (cellvalue === '播种区') {
- return 3;
- } else if (cellvalue === '复核理货区') {
- return 4;
- } else if (cellvalue === '集货发运区') {
- return 5;
- } else if (cellvalue === '组装加工区') {
- return 6;
- } else if (cellvalue === '月台区') {
- return 7;
- } else if (cellvalue === '停车场') {
- return 8;
- } else if (cellvalue === '退货区') {
- return 9;
- }
- return cellvalue;
- }
- });
- //========= stockEnv 转换
- $.extend($.fn.fmatter, {
- stockEnv: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '冷藏';
- case '2':
- return '常温';
- case '3':
- return '阴凉';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.stockEnv, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '冷藏') {
- return 1;
- } else if (cellvalue === '常温') {
- return 2;
- } else if (cellvalue === '阴凉') {
- return 3;
- }
- return cellvalue;
- }
- });
- //========= double转换
- $.extend($.fn.fmatter, {
- double: function (cellvalue, options, rowdata) {
- if (cellvalue != null) {
- return parseFloat(cellvalue).toFixed(2);
- }
- return '';
- }
- });
- //========= turnoverDemand 转换
- $.extend($.fn.fmatter, {
- turnoverDemand: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '快速周转';
- case '2':
- return '中速周转';
- case '3':
- return '慢速周转';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.turnoverDemand, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '快速周转') {
- return 1;
- } else if (cellvalue === '中速周转') {
- return 2;
- } else if (cellvalue === '慢速周转') {
- return 3;
- }
- return cellvalue;
- }
- });
- //========= locatType 转换
- $.extend($.fn.fmatter, {
- locatType: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '地面平仓';
- case '2':
- return '重力式货架';
- case '3':
- return '货架';
- case '4':
- return '自动化货架';
- case '5':
- return '高层货架';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.locatType, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '地面平仓') {
- return 1;
- } else if (cellvalue === '重力式货架') {
- return 2;
- } else if (cellvalue === '货架') {
- return 3;
- } else if (cellvalue === '自动化货架') {
- return 4;
- } else if (cellvalue === '高层货架') {
- return 5;
- }
- return cellvalue;
- }
- });
- //========= locatProcMode 转换
- $.extend($.fn.fmatter, {
- locatProcMode: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '仅限整箱';
- case '2':
- return '仅限托盘';
- case '3':
- return '其他';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.locatProcMode, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '仅限整箱') {
- return 1;
- } else if (cellvalue === '仅限托盘') {
- return 2;
- } else if (cellvalue === '其他') {
- return 3;
- }
- return cellvalue;
- }
- });
- //========= locatAttr 转换
- $.extend($.fn.fmatter, {
- locatAttr: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '正常';
- case '2':
- return '封存';
- case '3':
- return '管控';
- case '4':
- return '禁入';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.locatAttr, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '正常') {
- return 1;
- } else if (cellvalue === '封存') {
- return 2;
- } else if (cellvalue === '管控') {
- return 3;
- } else if (cellvalue === '禁入') {
- return 4;
- }
- return cellvalue;
- }
- });
- //========= 上架库位颜色 转换
- $.extend($.fn.fmatter, {
- fmtCodeColor: function (cellvalue, options, rowdata) {
- if (cellvalue != null && cellvalue != '')
- return '<span style="color:blue">' + cellvalue + '</span>';
- else
- return '';
- }
- });
- //========= 上架数量颜色 转换
- $.extend($.fn.fmatter, {
- fmtQtyColor: function (cellvalue, options, rowdata) {
- if (cellvalue != null && cellvalue != '')
- return '<span style="color:blue">' + parseFloat(cellvalue).toFixed(2) + '</span>';
- else
- return '';
- }
- });
- //========= 是否 转换
- $.extend($.fn.fmatter, {
- yesOrNo: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '是';
- case '0':
- return '否';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.yesOrNo, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '是') {
- return 1;
- } else if (cellvalue === '否') {
- return 0;
- }
- return cellvalue;
- }
- });
- //========= 取消、未取消 转换
- $.extend($.fn.fmatter, {
- cancel: function (cellvalue, options, rowdata) {
- switch ($.trim(cellvalue)) {
- case '1':
- return '取消';
- case '0':
- return '未取消';
- }
- return cellvalue;
- }
- });
- $.extend($.fn.fmatter.cancel, {
- unformat: function (cellvalue, options) {
- if (cellvalue === '取消') {
- return 1;
- } else if (cellvalue === '未取消') {
- return 0;
- }
- return cellvalue;
- }
- });
- })(jQuery);
|