cabe4350f1c11e260809920c031b9688.json 8.5 KB

1
  1. {"remainingRequest":"/Users/lihai/jolijoli/pad_spa/node_modules/babel-loader/lib/index.js!/Users/lihai/jolijoli/pad_spa/node_modules/eslint-loader/index.js??ref--13-0!/Users/lihai/jolijoli/pad_spa/src/filters/filter.js","dependencies":[{"path":"/Users/lihai/jolijoli/pad_spa/src/filters/filter.js","mtime":1649813268623},{"path":"/Users/lihai/jolijoli/pad_spa/babel.config.js","mtime":1649813268617},{"path":"/Users/lihai/jolijoli/pad_spa/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/Users/lihai/jolijoli/pad_spa/node_modules/babel-loader/lib/index.js","mtime":315532800000},{"path":"/Users/lihai/jolijoli/pad_spa/node_modules/eslint-loader/index.js","mtime":499162500000}],"contextDependencies":[],"result":["import Vue from 'vue';\n/**\n * 取小数位的精度 页面用法:{{'13232.1' | doubleNum}} 返回值:13232.10\n * @param {Object} value //需要匹配小数位的原始值\n * @param {Object} d //小数位的位数(可不传,不传默认保留两位小数) \n */\n\nVue.filter(\"doubleNum\", function (value, d) {\n if (value == '--') {\n return value;\n }\n\n d = d ? d : '2';\n\n if (value) {\n return parseFloat(value).toFixed(d);\n } else {\n // return '--'\n return 0 .toFixed(d);\n }\n});\n/**\n * 千分位符 页面用法:{{'13232.1' | thousand}} 返回值:13,232.1\n * @param {Object} value //需要匹配的原始值\n * @param {Object} d //需要保留的小数位的位数(可不传,不传保留原始小数位) \n */\n\nVue.filter(\"thousand\", function (value, d) {\n if (value) {\n if (d) value = parseFloat(value).toFixed(d);\n value = value.toString();\n var re = /\\d{1,3}(?=(\\d{3})+$)/g;\n var n1 = value.replace(/^(\\d+)((\\.\\d+)?)$/, function (s, s1, s2) {\n return s1.replace(re, \"$&,\") + s2;\n });\n return n1;\n }\n});\n/**\n * 日期格式重置 页面用法:{{'2017-08-22 18:30:26','yyyy-mm-dd hhmm' | formatDate}} 返回值:'2017-08-22 18:30'\n * @param {Object} value //需要匹配的原始值\n * @param {Object} value2 //需要得到的日期格式(页面不区分大小写,可不传,不传默认返回年月日) \n */\n\nVue.filter(\"formatDate\", function (value, value2) {\n if (value) {\n if (value2) {\n if (value2.toLowerCase() == 'yyyy-mm-dd hhmm') {\n var str = value.slice(11, 19);\n\n if (str == '23:59:59') {\n return value.slice(0, 10) + ' 24:00';\n } else {\n return value.slice(0, 16);\n }\n } else if (value2.toLowerCase() == 'yyyy-mm-dd hh') {\n return value.slice(0, 13);\n } else if (value2.toLowerCase() == 'hhmm') {\n if (value.slice(11, 19) == '23:59:59') {\n return '24:00';\n }\n\n return value.slice(11, 16);\n } else {\n return value.slice(0, 10);\n }\n } else {\n return value.slice(0, 10);\n }\n }\n});\n/**\n * 时间格式重置 页面用法:{{'18:30:26' | formatTime}} 返回值:'18:30'\n * @param {Object} value //需要匹配的原始值\n */\n\nVue.filter(\"formatTime\", function (value) {\n if (value) {\n if (value == '23:59:59') {\n return \"24:00\";\n } else {\n return value.slice(0, 5);\n }\n }\n});\n/**\n * 格式重置 返回百分比\n * @param {Object} value //需要匹配的原始值\n */\n\nVue.filter(\"percent\", function (value) {\n if (value) {\n return parseFloat(value).toFixed(2) + '%';\n } else {\n return 0 .toFixed(2) + '%';\n }\n});",{"version":3,"sources":["/Users/lihai/jolijoli/pad_spa/src/filters/filter.js"],"names":["Vue","filter","value","d","parseFloat","toFixed","toString","re","n1","replace","s","s1","s2","value2","toLowerCase","str","slice"],"mappings":"AAAA,OAAOA,GAAP,MAAgB,KAAhB;AACA;;;;;;AAKAA,GAAG,CAACC,MAAJ,CAAW,WAAX,EAAwB,UAASC,KAAT,EAAeC,CAAf,EAAkB;AACzC,MAAGD,KAAK,IAAE,IAAV,EAAe;AACd,WAAOA,KAAP;AACA;;AACDC,EAAAA,CAAC,GAACA,CAAC,GAACA,CAAD,GAAG,GAAN;;AACA,MAAGD,KAAH,EAAS;AACR,WAAOE,UAAU,CAACF,KAAD,CAAV,CAAkBG,OAAlB,CAA0BF,CAA1B,CAAP;A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MAAM,CAACC,WAAP,MAAsB,MAAzB,EAAgC;AACrC,YAAGZ,KAAK,CAACc,KAAN,CAAY,EAAZ,EAAe,EAAf,KAAoB,UAAvB,EAAkC;AACjC,iBAAO,OAAP;AACA;;AACD,eAAOd,KAAK,CAACc,KAAN,CAAY,EAAZ,EAAe,EAAf,CAAP;AACA,OALK,MAKA;AACL,eAAOd,KAAK,CAACc,KAAN,CAAY,CAAZ,EAAc,EAAd,CAAP;AACA;AACD,KAlBD,MAkBK;AACJ,aAAOd,KAAK,CAACc,KAAN,CAAY,CAAZ,EAAc,EAAd,CAAP;AACA;AACD;AACD,CAxBD;AA0BA;;;;;AAIAhB,GAAG,CAACC,MAAJ,CAAW,YAAX,EAAyB,UAASC,KAAT,EAAgB;AACxC,MAAGA,KAAH,EAAS;AACR,QAAGA,KAAK,IAAE,UAAV,EAAqB;AACpB,aAAO,OAAP;AACA,KAFD,MAEM;AACL,aAAOA,KAAK,CAACc,KAAN,CAAY,CAAZ,EAAc,CAAd,CAAP;AACA;AACD;AACD,CARD;AAUA;;;;;AAIAhB,GAAG,CAACC,MAAJ,CAAW,SAAX,EAAsB,UAASC,KAAT,EAAgB;AACrC,MAAGA,KAAH,EAAS;AACR,WAAOE,UAAU,CAACF,KAAD,CAAV,CAAkBG,OAAlB,CAA0B,CAA1B,IAA8B,GAArC;AACA,GAFD,MAEM;AACL,WAAQ,CAAD,EAAIA,OAAJ,CAAY,CAAZ,IAAiB,GAAxB;AACA;AACD,CAND","sourcesContent":["import Vue from 'vue'\n/**\n * 取小数位的精度 页面用法:{{'13232.1' | doubleNum}} 返回值:13232.10\n * @param {Object} value //需要匹配小数位的原始值\n * @param {Object} d //小数位的位数(可不传,不传默认保留两位小数) \n */\nVue.filter(\"doubleNum\", function(value,d) {\n\tif(value=='--'){\n\t\treturn value;\n\t}\n\td=d?d:'2';\n\tif(value){\n\t\treturn parseFloat(value).toFixed(d);\n\t} else{\n\t\t// return '--'\n\t\treturn (0).toFixed(d);\n\t}\n});\n\n/**\n * 千分位符 页面用法:{{'13232.1' | thousand}} 返回值:13,232.1\n * @param {Object} value //需要匹配的原始值\n * @param {Object} d //需要保留的小数位的位数(可不传,不传保留原始小数位) \n */\nVue.filter(\"thousand\", function(value,d) {\n\tif(value){\n\t\tif(d) value=parseFloat(value).toFixed(d);\n\t\tvalue=value.toString();\n\t\tvar re=/\\d{1,3}(?=(\\d{3})+$)/g;\n\t\tvar n1=value.replace(/^(\\d+)((\\.\\d+)?)$/,function(s,s1,s2){return s1.replace(re,\"$&,\")+s2;});\n\t\treturn n1;\n\t}\n});\n\n/**\n * 日期格式重置 页面用法:{{'2017-08-22 18:30:26','yyyy-mm-dd hhmm' | formatDate}} 返回值:'2017-08-22 18:30'\n * @param {Object} value //需要匹配的原始值\n * @param {Object} value2 //需要得到的日期格式(页面不区分大小写,可不传,不传默认返回年月日) \n */\nVue.filter(\"formatDate\", function(value,value2) {\n\tif(value){ \n\t\tif(value2) {\n\t\t\tif(value2.toLowerCase()=='yyyy-mm-dd hhmm'){\n\t\t\t\tlet str=value.slice(11,19);\n\t\t\t\tif(str=='23:59:59'){\n\t\t\t\t\treturn value.slice(0,10)+' 24:00';\n\t\t\t\t} else{\n\t\t\t\t\treturn value.slice(0,16);\n\t\t\t\t}\n\t\t\t} else if(value2.toLowerCase()=='yyyy-mm-dd hh'){\n\t\t\t\treturn value.slice(0,13);\n\t\t\t}else if(value2.toLowerCase()=='hhmm'){\n\t\t\t\tif(value.slice(11,19)=='23:59:59'){\n\t\t\t\t\treturn '24:00';\n\t\t\t\t}\n\t\t\t\treturn value.slice(11,16);\n\t\t\t} else{\n\t\t\t\treturn value.slice(0,10);\n\t\t\t}\n\t\t}else{\n\t\t\treturn value.slice(0,10);\n\t\t}\n\t}\n});\n\n/**\n * 时间格式重置 页面用法:{{'18:30:26' | formatTime}} 返回值:'18:30'\n * @param {Object} value //需要匹配的原始值\n */\nVue.filter(\"formatTime\", function(value) {\n\tif(value){ \n\t\tif(value=='23:59:59'){\n\t\t\treturn \"24:00\";\n\t\t} else{\n\t\t\treturn value.slice(0,5);\n\t\t}\n\t}\n});\n\n/**\n * 格式重置 返回百分比\n * @param {Object} value //需要匹配的原始值\n */\nVue.filter(\"percent\", function(value) {\n\tif(value){\n\t\treturn parseFloat(value).toFixed(2)+ '%';\n\t} else{\n\t\treturn (0).toFixed(2) + '%';\n\t}\n});\n"]}]}