s||a=b.length;return k.i=b.length-1,furthestChar:b[k.i]}},k}},{"./chunker":42}],44:[function(a,b,c){var d=a("../less-error"),e=a("../tree"),f=a("../visitors"),g=a("./parser-input"),h=a("../utils"),i=a("../functions/function-registry"),j=function k(a,b,c){function j(a,e){throw new d({index:q.i,filename:c.filename,type:e||"Syntax",message:a},b)}function l(a,b){var c=a instanceof Function?a.call(p):q.$re(a);return c?c:void j(b||("string"==typeof a?"expected '"+a+"' got '"+q.currentChar()+"'":"unexpected token"))}function m(a,b){return q.$char(a)?a:void j(b||"expected '"+a+"' got '"+q.currentChar()+"'")}function n(a){var b=c.filename;return{lineNumber:h.getLocation(a,q.getInput()).line+1,fileName:b}}function o(a,c,e,f,g){var h,i=[],j=q;try{j.start(a,!1,function(a,b){g({message:a,index:b+e})});for(var k,l,m=0;k=c[m];m++)l=j.i,h=p[k](),h?(h._index=l+e,h._fileInfo=f,i.push(h)):i.push(null);var n=j.end();n.isFinished?g(null,i):g(!0,null)}catch(o){throw new d({index:o.index+e,message:o.message},b,f.filename)}}var p,q=g();return{parserInput:q,imports:b,fileInfo:c,parseNode:o,parse:function(g,h,j){var l,m,n,o,p=null,r="";if(m=j&&j.globalVars?k.serializeVars(j.globalVars)+"\n":"",n=j&&j.modifyVars?"\n"+k.serializeVars(j.modifyVars):"",a.pluginManager)for(var s=a.pluginManager.getPreProcessors(),t=0;t")}return a},args:function(a){var b,c,d,f,g,h,i,k=p.entities,l={args:null,variadic:!1},m=[],n=[],o=[],r=!0;for(q.save();;){if(a)h=p.detachedRuleset()||p.expression();else{if(q.commentStore.length=0,q.$str("...")){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({variadic:!0});break}h=k.variable()||k.property()||k.literal()||k.keyword()||this.call(!0)}if(!h||!r)break;f=null,h.throwAwayComments&&h.throwAwayComments(),g=h;var s=null;if(a?h.value&&1==h.value.length&&(s=h.value[0]):s=h,s&&(s instanceof e.Variable||s instanceof e.Property))if(q.$char(":")){if(m.length>0&&(b&&j("Cannot mix ; and , as delimiter types"),c=!0),g=p.detachedRuleset()||p.expression(),!g){if(!a)return q.restore(),l.args=[],l;j("could not understand value for named argument")}f=d=s.name}else if(q.$str("...")){if(!a){l.variadic=!0,q.$char(";")&&!b&&(b=!0),(b?n:o).push({name:h.name,variadic:!0});break}i=!0}else a||(d=f=s.name,g=null);g&&m.push(g),o.push({name:f,value:g,expand:i}),q.$char(",")?r=!0:(r=";"===q.$char(";"),(r||b)&&(c&&j("Cannot mix ; and , as delimiter types"),b=!0,m.length>1&&(g=new e.Value(m)),n.push({name:d,value:g,expand:i}),d=null,m=[],c=!1))}return q.forget(),l.args=b?n:o,l},definition:function(){var a,b,c,d,f=[],g=!1;if(!("."!==q.currentChar()&&"#"!==q.currentChar()||q.peek(/^[^{]*\}/)))if(q.save(),b=q.$re(/^([#.](?:[\w-]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+)\s*\(/)){a=b[1];var h=this.args(!1);if(f=h.args,g=h.variadic,!q.$char(")"))return void q.restore("Missing closing ')'");if(q.commentStore.length=0,q.$str("when")&&(d=l(p.conditions,"expected condition")),c=p.block())return q.forget(),new e.mixin.Definition(a,f,c,d,g);q.restore()}else q.forget()},ruleLookups:function(){var a,b,c=[];if("["===q.currentChar()){for(;;){if(q.save(),b=null,a=this.lookupValue(),!a&&""!==a){q.restore();break}c.push(a),q.forget()}return c.length>0?c:void 0}},lookupValue:function(){if(q.save(),!q.$char("["))return void q.restore();var a=q.$re(/^(?:[@$]{0,2})[_a-zA-Z0-9-]*/);return q.$char("]")&&(a||""===a)?(q.forget(),a):void q.restore()}},entity:function(){var a=this.entities;return this.comment()||a.literal()||a.variable()||a.url()||a.property()||a.call()||a.keyword()||this.mixin.call(!0)||a.javascript()},end:function(){return q.$char(";")||q.peek("}")},ieAlpha:function(){var a;if(q.$re(/^opacity=/i))return a=q.$re(/^\d+/),a||(a=l(p.entities.variable,"Could not parse alpha"),a="@{"+a.name.slice(1)+"}"),m(")"),new e.Quoted("","alpha(opacity="+a+")")},element:function(){var a,b,d,f=q.i;if(b=this.combinator(),a=q.$re(/^(?:\d+\.\d+|\d+)%/)||q.$re(/^(?:[.#]?|:*)(?:[\w-]|[^\x00-\x9f]|\\(?:[A-Fa-f0-9]{1,6} ?|[^A-Fa-f0-9]))+/)||q.$char("*")||q.$char("&")||this.attribute()||q.$re(/^\([^&()@]+\)/)||q.$re(/^[\.#:](?=@)/)||this.entities.variableCurly(),
+a||(q.save(),q.$char("(")?(d=this.selector(!1))&&q.$char(")")?(a=new e.Paren(d),q.forget()):q.restore("Missing closing ')'"):q.forget()),a)return new e.Element(b,a,a instanceof e.Variable,f,c)},combinator:function(){var a=q.currentChar();if("/"===a){q.save();var b=q.$re(/^\/[a-z]+\//i);if(b)return q.forget(),new e.Combinator(b);q.restore()}if(">"===a||"+"===a||"~"===a||"|"===a||"^"===a){for(q.i++,"^"===a&&"^"===q.currentChar()&&(a="^^",q.i++);q.isWhitespace();)q.i++;return new e.Combinator(a)}return new e.Combinator(q.isWhitespace(-1)?" ":null)},selector:function(a){var b,d,f,g,h,i,k,m=q.i;for(a=a!==!1;(a&&(d=this.extend())||a&&(i=q.$str("when"))||(g=this.element()))&&(i?k=l(this.conditions,"expected condition"):k?j("CSS guard can only be used at the end of selector"):d?h=h?h.concat(d):d:(h&&j("Extend can only be used at the end of selector"),f=q.currentChar(),b?b.push(g):b=[g],g=null),"{"!==f&&"}"!==f&&";"!==f&&","!==f&&")"!==f););return b?new e.Selector(b,h,k,m,c):void(h&&j("Extend must be used to extend a selector, it cannot be used on its own"))},selectors:function(){for(var a,b;;){if(a=this.selector(),!a)break;if(b?b.push(a):b=[a],q.commentStore.length=0,a.condition&&b.length>1&&j("Guards are only currently allowed on a single selector."),!q.$char(","))break;a.condition&&j("Guards are only currently allowed on a single selector."),q.commentStore.length=0}return b},attribute:function(){if(q.$char("[")){var a,b,c,d=this.entities;return(a=d.variableCurly())||(a=l(/^(?:[_A-Za-z0-9-\*]*\|)?(?:[_A-Za-z0-9-]|\\.)+/)),c=q.$re(/^[|~*$^]?=/),c&&(b=d.quoted()||q.$re(/^[0-9]+%/)||q.$re(/^[\w-]+/)||d.variableCurly()),m("]"),new e.Attribute(a,c,b)}},block:function(){var a;if(q.$char("{")&&(a=this.primary())&&q.$char("}"))return a},blockRuleset:function(){var a=this.block();return a&&(a=new e.Ruleset(null,a)),a},detachedRuleset:function(){var a,b,c;if(q.save(),q.$re(/^[.#]\(/)&&(a=this.mixin.args(!1),b=a.args,c=a.variadic,!q.$char(")")))return void q.restore();var d=this.blockRuleset();return d?(q.forget(),b?new e.mixin.Definition(null,b,d,null,c):new e.DetachedRuleset(d)):void q.restore()},ruleset:function(){var b,c,d;if(q.save(),a.dumpLineNumbers&&(d=n(q.i)),b=this.selectors(),b&&(c=this.block())){q.forget();var f=new e.Ruleset(b,c,a.strictImports);return a.dumpLineNumbers&&(f.debugInfo=d),f}q.restore()},declaration:function(){var a,b,d,f,g,h,i=q.i,j=q.currentChar();if("."!==j&&"#"!==j&&"&"!==j&&":"!==j)if(q.save(),a=this.variable()||this.ruleProperty()){if(h="string"==typeof a,h&&(b=this.detachedRuleset(),b&&(d=!0)),q.commentStore.length=0,!b){if(g=!h&&a.length>1&&a.pop().value,b=a[0].value&&"--"===a[0].value.slice(0,2)?this.permissiveValue():this.anonymousValue())return q.forget(),new e.Declaration(a,b,(!1),g,i,c);b||(b=this.value()),b?f=this.important():h&&(b=this.permissiveValue())}if(b&&(this.end()||d))return q.forget(),new e.Declaration(a,b,f,g,i,c);q.restore()}else q.restore()},anonymousValue:function(){var a=q.i,b=q.$re(/^([^.#@\$+\/'"*`(;{}-]*);/);if(b)return new e.Anonymous(b[1],a)},permissiveValue:function(a){function b(){var a=q.currentChar();return"string"==typeof i?a===i:i.test(a)}var d,f,g,h,i=a||";",k=q.i,l=[];if(!b()){h=[];do f=this.comment(),f?h.push(f):(f=this.entity(),f&&h.push(f));while(f);if(g=b(),h.length>0){if(h=new e.Expression(h),g)return h;l.push(h)," "===q.prevChar()&&l.push(new e.Anonymous(" ",k))}if(q.save(),h=q.$parseUntil(i)){if("string"==typeof h&&j("Expected '"+h+"'","Parse"),1===h.length&&" "===h[0])return q.forget(),new e.Anonymous("",k);var m;for(d=0;d0)return new e.Expression(f)},mediaFeatures:function(){var a,b=this.entities,c=[];do if(a=this.mediaFeature()){if(c.push(a),!q.$char(","))break}else if(a=b.variable()||b.mixinLookup(),a&&(c.push(a),!q.$char(",")))break;while(a);return c.length>0?c:null},media:function(){var b,d,f,g,h=q.i;return a.dumpLineNumbers&&(g=n(h)),q.save(),q.$str("@media")?(b=this.mediaFeatures(),d=this.block(),d||j("media definitions require block statements after any features"),q.forget(),f=new e.Media(d,b,h,c),a.dumpLineNumbers&&(f.debugInfo=g),f):void q.restore()},plugin:function(){var a,b,d,f=q.i,g=q.$re(/^@plugin?\s+/);if(g){if(b=this.pluginArgs(),d=b?{pluginArgs:b,isPlugin:!0}:{isPlugin:!0},a=this.entities.quoted()||this.entities.url())return q.$char(";")||(q.i=f,j("missing semi-colon on @plugin")),new e.Import(a,null,d,f,c);q.i=f,j("malformed @plugin statement")}},pluginArgs:function(){if(q.save(),!q.$char("("))return q.restore(),null;var a=q.$re(/^\s*([^\);]+)\)\s*/);return a[1]?(q.forget(),a[1].trim()):(q.restore(),null)},atrule:function(){var b,d,f,g,h,i,k,l=q.i,m=!0,o=!0;if("@"===q.currentChar()){if(d=this["import"]()||this.plugin()||this.media())return d;if(q.save(),b=q.$re(/^@[a-z-]+/)){switch(g=b,"-"==b.charAt(1)&&b.indexOf("-",2)>0&&(g="@"+b.slice(b.indexOf("-",2)+1)),g){case"@charset":h=!0,m=!1;break;case"@namespace":i=!0,m=!1;break;case"@keyframes":case"@counter-style":h=!0;break;case"@document":case"@supports":k=!0,o=!1;break;default:k=!0}return q.commentStore.length=0,h?(d=this.entity(),d||j("expected "+b+" identifier")):i?(d=this.expression(),d||j("expected "+b+" expression")):k&&(d=this.permissiveValue(/^[{;]/),m="{"===q.currentChar(),d?d.value||(d=null):m||";"===q.currentChar()||j(b+" rule is missing block or ending semi-colon")),m&&(f=this.blockRuleset()),f||!m&&d&&q.$char(";")?(q.forget(),new e.AtRule(b,d,f,l,c,a.dumpLineNumbers?n(l):null,o)):void q.restore("at-rule options not recognised")}}},value:function(){var a,b=[],c=q.i;do if(a=this.expression(),a&&(b.push(a),!q.$char(",")))break;while(a);if(b.length>0)return new e.Value(b,c)},important:function(){if("!"===q.currentChar())return q.$re(/^! *important/)},sub:function(){var a,b;return q.save(),q.$char("(")?(a=this.addition(),a&&q.$char(")")?(q.forget(),b=new e.Expression([a]),b.parens=!0,b):void q.restore("Expected ')'")):void q.restore()},multiplication:function(){var a,b,c,d,f;if(a=this.operand()){for(f=q.isWhitespace(-1);;){if(q.peek(/^\/[*\/]/))break;if(q.save(),c=q.$char("/")||q.$char("*")||q.$str("./"),!c){q.forget();break}if(b=this.operand(),!b){q.restore();break}q.forget(),a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},addition:function(){var a,b,c,d,f;if(a=this.multiplication()){for(f=q.isWhitespace(-1);;){if(c=q.$re(/^[-+]\s+/)||!f&&(q.$char("+")||q.$char("-")),!c)break;if(b=this.multiplication(),!b)break;a.parensInOp=!0,b.parensInOp=!0,d=new e.Operation(c,[d||a,b],f),f=q.isWhitespace(-1)}return d||a}},conditions:function(){var a,b,c,d=q.i;if(a=this.condition(!0)){for(;;){if(!q.peek(/^,\s*(not\s*)?\(/)||!q.$char(","))break;if(b=this.condition(!0),!b)break;c=new e.Condition("or",c||a,b,d)}return c||a}},condition:function(a){function b(){return q.$str("or")}var c,d,f;if(c=this.conditionAnd(a)){if(d=b()){if(f=this.condition(a),!f)return;c=new e.Condition(d,c,f)}return c}},conditionAnd:function(a){function b(){var b=h.negatedCondition(a)||h.parenthesisCondition(a);return b||a?b:h.atomicCondition(a)}function c(){return q.$str("and")}var d,f,g,h=this;if(d=b()){if(f=c()){if(g=this.conditionAnd(a),!g)return;d=new e.Condition(f,d,g)}return d}},negatedCondition:function(a){if(q.$str("not")){var b=this.parenthesisCondition(a);return b&&(b.negate=!b.negate),b}},parenthesisCondition:function(a){function b(b){var c;return q.save(),(c=b.condition(a))&&q.$char(")")?(q.forget(),c):void q.restore()}var c;return q.save(),q.$str("(")?(c=b(this))?(q.forget(),c):(c=this.atomicCondition(a))?q.$char(")")?(q.forget(),c):void q.restore("expected ')' got '"+q.currentChar()+"'"):void q.restore():void q.restore()},atomicCondition:function(a){function b(){return this.addition()||h.keyword()||h.quoted()||h.mixinLookup()}var c,d,f,g,h=this.entities,i=q.i;if(b=b.bind(this),c=b())return q.$char(">")?g=q.$char("=")?">=":">":q.$char("<")?g=q.$char("=")?"<=":"<":q.$char("=")&&(g=q.$char(">")?"=>":q.$char("<")?"=<":"="),g?(d=b(),d?f=new e.Condition(g,c,d,i,(!1)):j("expected expression")):f=new e.Condition("=",c,new e.Keyword("true"),i,(!1)),f},operand:function(){var a,b=this.entities;q.peek(/^-[@\$\(]/)&&(a=q.$char("-"));var c=this.sub()||b.dimension()||b.color()||b.variable()||b.property()||b.call()||b.quoted(!0)||b.colorKeyword()||b.mixinLookup();return a&&(c.parensInOp=!0,c=new e.Negative(c)),c},expression:function(){var a,b,c=[],d=q.i;do a=this.comment(),a?c.push(a):(a=this.addition()||this.entity(),a&&(c.push(a),q.peek(/^\/[\/*]/)||(b=q.$char("/"),b&&c.push(new e.Anonymous(b,d)))));while(a);if(c.length>0)return new e.Expression(c)},property:function(){var a=q.$re(/^(\*?-?[_a-zA-Z0-9-]+)\s*:/);if(a)return a[1]},ruleProperty:function(){function a(a){var b=q.i,c=q.$re(a);if(c)return g.push(b),f.push(c[1])}var b,d,f=[],g=[];q.save();var h=q.$re(/^([_a-zA-Z0-9-]+)\s*:/);if(h)return f=[new e.Keyword(h[1])],q.forget(),f;for(a(/^(\*?)/);;)if(!a(/^((?:[\w-]+)|(?:[@\$]\{[\w-]+\}))/))break;if(f.length>1&&a(/^((?:\+_|\+)?)\s*:/)){for(q.forget(),""===f[0]&&(f.shift(),g.shift()),d=0;d=b);c++);this.preProcessors.splice(c,0,{preProcessor:a,priority:b})},e.prototype.addPostProcessor=function(a,b){var c;for(c=0;c=b);c++);this.postProcessors.splice(c,0,{postProcessor:a,priority:b})},e.prototype.addFileManager=function(a){this.fileManagers.push(a)},e.prototype.getPreProcessors=function(){for(var a=[],b=0;b0){var d,e=JSON.stringify(this._sourceMapGenerator.toJSON());this.sourceMapURL?d=this.sourceMapURL:this._sourceMapFilename&&(d=this._sourceMapFilename),this.sourceMapURL=d,this.sourceMap=e}return this._css.join("")},b}},{}],49:[function(a,b,c){var d=a("./contexts"),e=a("./visitors"),f=a("./tree");b.exports=function(a,b){b=b||{};var c,g=b.variables,h=new d.Eval(b);"object"!=typeof g||Array.isArray(g)||(g=Object.keys(g).map(function(a){var b=g[a];return b instanceof f.Value||(b instanceof f.Expression||(b=new f.Expression([b])),b=new f.Value([b])),new f.Declaration("@"+a,b,(!1),null,0)}),h.frames=[new f.Ruleset(null,g)]);var i,j,k=[new e.JoinSelectorVisitor,new e.MarkVisibleSelectorsVisitor((!0)),new e.ExtendVisitor,new e.ToCSSVisitor({compress:Boolean(b.compress)})],l=[];if(b.pluginManager){j=b.pluginManager.visitor();for(var m=0;m<2;m++)for(j.first();i=j.get();)i.isPreEvalVisitor?0!==m&&l.indexOf(i)!==-1||(l.push(i),i.run(a)):0!==m&&k.indexOf(i)!==-1||(i.isPreVisitor?k.unshift(i):k.push(i))}c=a.eval(h);for(var m=0;m=6?(this.rgb=[],a.match(/.{2}/g).map(function(a,b){b<3?d.rgb.push(parseInt(a,16)):d.alpha=parseInt(a,16)/255})):(this.rgb=[],a.split("").map(function(a,b){b<3?d.rgb.push(parseInt(a+a,16)):d.alpha=parseInt(a+a,16)/255})),this.alpha=this.alpha||("number"==typeof b?b:1),"undefined"!=typeof c&&(this.value=c)};h.prototype=new f,h.prototype.type="Color",h.prototype.luma=function(){var a=this.rgb[0]/255,b=this.rgb[1]/255,c=this.rgb[2]/255;return a=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),b=b<=.03928?b/12.92:Math.pow((b+.055)/1.055,2.4),c=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4),.2126*a+.7152*b+.0722*c},h.prototype.genCSS=function(a,b){b.add(this.toCSS(a))},h.prototype.toCSS=function(a,b){var c,e,f,g=a&&a.compress&&!b,h=[];if(e=this.fround(a,this.alpha),this.value)if(0===this.value.indexOf("rgb"))e<1&&(f="rgba");else{if(0!==this.value.indexOf("hsl"))return this.value;f=e<1?"hsla":"hsl"}else e<1&&(f="rgba");switch(f){case"rgba":h=this.rgb.map(function(a){return d(Math.round(a),255)}).concat(d(e,1));break;case"hsla":h.push(d(e,1));case"hsl":c=this.toHSL(),h=[this.fround(a,c.h),this.fround(a,100*c.s)+"%",this.fround(a,100*c.l)+"%"].concat(h)}if(f)return f+"("+h.join(","+(g?"":" "))+")";if(c=this.toRGB(),g){var i=c.split("");i[1]===i[2]&&i[3]===i[4]&&i[5]===i[6]&&(c="#"+i[1]+i[3]+i[5])}return c},h.prototype.operate=function(a,b,c){for(var d=new Array(3),e=this.alpha*(1-c.alpha)+c.alpha,f=0;f<3;f++)d[f]=this._operate(a,b,this.rgb[f],c.rgb[f]);return new h(d,e)},h.prototype.toRGB=function(){return e(this.rgb)},h.prototype.toHSL=function(){var a,b,c=this.rgb[0]/255,d=this.rgb[1]/255,e=this.rgb[2]/255,f=this.alpha,g=Math.max(c,d,e),h=Math.min(c,d,e),i=(g+h)/2,j=g-h;if(g===h)a=b=0;else{switch(b=i>.5?j/(2-g-h):j/(g+h),g){case c:a=(d-e)/j+(d="===a||"=<"===a||"<="===a;case 1:return">"===a||">="===a;default:return!1}}}(this.op,this.lvalue.eval(a),this.rvalue.eval(a));return this.negate?!b:b},b.exports=e},{"./node":76}],59:[function(a,b,c){var d=function(a,b,c){var e="";if(a.dumpLineNumbers&&!a.compress)switch(a.dumpLineNumbers){case"comments":e=d.asComment(b);break;case"mediaquery":e=d.asMediaQuery(b);break;case"all":e=d.asComment(b)+(c||"")+d.asMediaQuery(b)}return e};d.asComment=function(a){return"/* line "+a.debugInfo.lineNumber+", "+a.debugInfo.fileName+" */\n"},d.asMediaQuery=function(a){var b=a.debugInfo.fileName;return/^[a-z]+:\/\//i.test(b)||(b="file://"+b),"@media -sass-debug-info{filename{font-family:"+b.replace(/([.:\/\\])/g,function(a){return"\\"==a&&(a="/"),"\\"+a})+"}line{font-family:\\00003"+a.debugInfo.lineNumber+"}}\n"},b.exports=d},{}],60:[function(a,b,c){function d(a,b){var c,d="",e=b.length,f={add:function(a){d+=a}};for(c=0;c-1e-6&&(d=c.toFixed(20).replace(/0+$/,"")),a&&a.compress){if(0===c&&this.unit.isLength())return void b.add(d);c>0&&c<1&&(d=d.substr(1))}b.add(d),this.unit.genCSS(a,b)},h.prototype.operate=function(a,b,c){var d=this._operate(a,b,this.value,c.value),e=this.unit.clone();if("+"===b||"-"===b)if(0===e.numerator.length&&0===e.denominator.length)e=c.unit.clone(),
+this.unit.backupUnit&&(e.backupUnit=this.unit.backupUnit);else if(0===c.unit.numerator.length&&0===e.denominator.length);else{if(c=c.convertTo(this.unit.usedUnits()),a.strictUnits&&c.unit.toString()!==e.toString())throw new Error("Incompatible units. Change the units or use the unit function. Bad units: '"+e.toString()+"' and '"+c.unit.toString()+"'.");d=this._operate(a,b,this.value,c.value)}else"*"===b?(e.numerator=e.numerator.concat(c.unit.numerator).sort(),e.denominator=e.denominator.concat(c.unit.denominator).sort(),e.cancel()):"/"===b&&(e.numerator=e.numerator.concat(c.unit.denominator).sort(),e.denominator=e.denominator.concat(c.unit.numerator).sort(),e.cancel());return new h(d,e)},h.prototype.compare=function(a){var b,c;if(a instanceof h){if(this.unit.isEmpty()||a.unit.isEmpty())b=this,c=a;else if(b=this.unify(),c=a.unify(),0!==b.unit.compare(c.unit))return;return d.numericCompare(b.value,c.value)}},h.prototype.unify=function(){return this.convertTo({length:"px",duration:"s",angle:"rad"})},h.prototype.convertTo=function(a){var b,c,d,f,g,i=this.value,j=this.unit.clone(),k={};if("string"==typeof a){for(b in e)e[b].hasOwnProperty(a)&&(k={},k[b]=a);a=k}g=function(a,b){return d.hasOwnProperty(a)?(b?i/=d[a]/d[f]:i*=d[a]/d[f],f):a};for(c in a)a.hasOwnProperty(c)&&(f=a[c],d=e[c],j.map(g));return j.cancel(),new h(i,j)},b.exports=h},{"../data/unit-conversions":16,"./color":55,"./node":76,"./unit":84}],63:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./combinator"),g=function(a,b,c,d,e,g){this.combinator=a instanceof f?a:new f(a),this.value="string"==typeof b?b.trim():b?b:"",this.isVariable=c,this._index=d,this._fileInfo=e,this.copyVisibilityInfo(g),this.setParent(this.combinator,this)};g.prototype=new d,g.prototype.type="Element",g.prototype.accept=function(a){var b=this.value;this.combinator=a.visit(this.combinator),"object"==typeof b&&(this.value=a.visit(b))},g.prototype.eval=function(a){return new g(this.combinator,this.value.eval?this.value.eval(a):this.value,this.isVariable,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.clone=function(){return new g(this.combinator,this.value,this.isVariable,this.getIndex(),this.fileInfo(),this.visibilityInfo())},g.prototype.genCSS=function(a,b){b.add(this.toCSS(a),this.fileInfo(),this.getIndex())},g.prototype.toCSS=function(a){a=a||{};var b=this.value,c=a.firstSelector;return b instanceof e&&(a.firstSelector=!0),b=b.toCSS?b.toCSS(a):b,a.firstSelector=c,""===b&&"&"===this.combinator.value.charAt(0)?"":this.combinator.toCSS(a)+b},b.exports=g},{"./combinator":56,"./node":76,"./paren":78}],64:[function(a,b,c){var d=a("./node"),e=a("./paren"),f=a("./comment"),g=a("./dimension"),h=a("../constants").Math,i=function(a,b){if(this.value=a,this.noSpacing=b,!a)throw new Error("Expression requires an array parameter")};i.prototype=new d,i.prototype.type="Expression",i.prototype.accept=function(a){this.value=a.visitArray(this.value)},i.prototype.eval=function(a){var b,c=a.isMathOn(),d=this.parens&&(a.math!==h.STRICT_LEGACY||!this.parensInOp),f=!1;return d&&a.inParenthesis(),this.value.length>1?b=new i(this.value.map(function(b){return b.eval?b.eval(a):b}),this.noSpacing):1===this.value.length?(!this.value[0].parens||this.value[0].parensInOp||a.inCalc||(f=!0),b=this.value[0].eval(a)):b=this,d&&a.outOfParenthesis(),!this.parens||!this.parensInOp||c||f||b instanceof g||(b=new e(b)),b},i.prototype.genCSS=function(a,b){for(var c=0;c0&&c.length&&""===c[0].combinator.value&&(c[0].combinator.value=" "),d=d.concat(a[b].elements);this.selfSelectors=[new e(d)],this.selfSelectors[0].copyVisibilityInfo(this.visibilityInfo())},b.exports=f},{"./node":76,"./selector":82}],66:[function(a,b,c){var d=a("./node"),e=a("./media"),f=a("./url"),g=a("./quoted"),h=a("./ruleset"),i=a("./anonymous"),j=a("../utils"),k=a("../less-error"),l=function(a,b,c,d,e,f){if(this.options=c,this._index=d,this._fileInfo=e,this.path=a,this.features=b,this.allowRoot=!0,void 0!==this.options.less||this.options.inline)this.css=!this.options.less||this.options.inline;else{var g=this.getPath();g&&/[#\.\&\?]css([\?;].*)?$/.test(g)&&(this.css=!0)}this.copyVisibilityInfo(f),this.setParent(this.features,this),this.setParent(this.path,this)};l.prototype=new d,l.prototype.type="Import",l.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.path=a.visit(this.path),this.options.isPlugin||this.options.inline||!this.root||(this.root=a.visit(this.root))},l.prototype.genCSS=function(a,b){this.css&&void 0===this.path._fileInfo.reference&&(b.add("@import ",this._fileInfo,this._index),this.path.genCSS(a,b),this.features&&(b.add(" "),this.features.genCSS(a,b)),b.add(";"))},l.prototype.getPath=function(){return this.path instanceof f?this.path.value.value:this.path.value},l.prototype.isVariableImport=function(){var a=this.path;return a instanceof f&&(a=a.value),!(a instanceof g)||a.containsVariables()},l.prototype.evalForImport=function(a){var b=this.path;return b instanceof f&&(b=b.value),new l(b.eval(a),this.features,this.options,this._index,this._fileInfo,this.visibilityInfo())},l.prototype.evalPath=function(a){var b=this.path.eval(a),c=this._fileInfo;if(!(b instanceof f)){var d=b.value;b.value=c&&d&&a.pathRequiresRewrite(d)?a.rewritePath(d,c.rootpath):a.normalizePath(b.value)}return b},l.prototype.eval=function(a){var b=this.doEval(a);return(this.options.reference||this.blocksVisibility())&&(b.length||0===b.length?b.forEach(function(a){a.addVisibilityBlock()}):b.addVisibilityBlock()),b},l.prototype.doEval=function(a){var b,c,d=this.features&&this.features.eval(a);if(this.options.isPlugin){if(this.root&&this.root.eval)try{this.root.eval(a)}catch(f){throw f.message="Plugin error during evaluation",new k(f,this.root.imports,this.root.filename)}return c=a.frames[0]&&a.frames[0].functionRegistry,c&&this.root&&this.root.functions&&c.addMultiple(this.root.functions),[]}if(this.skip&&("function"==typeof this.skip&&(this.skip=this.skip()),this.skip))return[];if(this.options.inline){var g=new i(this.root,0,{filename:this.importedFilename,reference:this.path._fileInfo&&this.path._fileInfo.reference},(!0),(!0));return this.features?new e([g],this.features.value):[g]}if(this.css){var m=new l(this.evalPath(a),d,this.options,this._index);if(!m.css&&this.error)throw this.error;return m}return b=new h(null,j.copyArray(this.root.rules)),b.evalImports(a),this.features?new e(b.rules,this.features.value):b.rules},b.exports=l},{"../less-error":38,"../utils":89,"./anonymous":50,"./media":71,"./node":76,"./quoted":80,"./ruleset":81,"./url":85}],67:[function(a,b,c){var d=Object.create(null);d.Node=a("./node"),d.Color=a("./color"),d.AtRule=a("./atrule"),d.DetachedRuleset=a("./detached-ruleset"),d.Operation=a("./operation"),d.Dimension=a("./dimension"),d.Unit=a("./unit"),d.Keyword=a("./keyword"),d.Variable=a("./variable"),d.Property=a("./property"),d.Ruleset=a("./ruleset"),d.Element=a("./element"),d.Attribute=a("./attribute"),d.Combinator=a("./combinator"),d.Selector=a("./selector"),d.Quoted=a("./quoted"),d.Expression=a("./expression"),d.Declaration=a("./declaration"),d.Call=a("./call"),d.URL=a("./url"),d.Import=a("./import"),d.mixin={Call:a("./mixin-call"),Definition:a("./mixin-definition")},d.Comment=a("./comment"),d.Anonymous=a("./anonymous"),d.Value=a("./value"),d.JavaScript=a("./javascript"),d.Assignment=a("./assignment"),d.Condition=a("./condition"),d.Paren=a("./paren"),d.Media=a("./media"),d.UnicodeDescriptor=a("./unicode-descriptor"),d.Negative=a("./negative"),d.Extend=a("./extend"),d.VariableCall=a("./variable-call"),d.NamespaceValue=a("./namespace-value"),b.exports=d},{"./anonymous":50,"./assignment":51,"./atrule":52,"./attribute":53,"./call":54,"./color":55,"./combinator":56,"./comment":57,"./condition":58,"./declaration":60,"./detached-ruleset":61,"./dimension":62,"./element":63,"./expression":64,"./extend":65,"./import":66,"./javascript":68,"./keyword":70,"./media":71,"./mixin-call":72,"./mixin-definition":73,"./namespace-value":74,"./negative":75,"./node":76,"./operation":77,"./paren":78,"./property":79,"./quoted":80,"./ruleset":81,"./selector":82,"./unicode-descriptor":83,"./unit":84,"./url":85,"./value":86,"./variable":88,"./variable-call":87}],68:[function(a,b,c){var d=a("./js-eval-node"),e=a("./dimension"),f=a("./quoted"),g=a("./anonymous"),h=function(a,b,c,d){this.escaped=b,this.expression=a,this._index=c,this._fileInfo=d};h.prototype=new d,h.prototype.type="JavaScript",h.prototype.eval=function(a){var b=this.evaluateJavaScript(this.expression,a),c=typeof b;return"number"!==c||isNaN(b)?"string"===c?new f('"'+b+'"',b,this.escaped,this._index):new g(Array.isArray(b)?b.join(", "):b):new e(b)},b.exports=h},{"./anonymous":50,"./dimension":62,"./js-eval-node":69,"./quoted":80}],69:[function(a,b,c){var d=a("./node"),e=a("./variable"),f=function(){};f.prototype=new d,f.prototype.evaluateJavaScript=function(a,b){var c,d=this,f={};if(!b.javascriptEnabled)throw{message:"Inline JavaScript is not enabled. Is it set in your options?",filename:this.fileInfo().filename,index:this.getIndex()};a=a.replace(/@\{([\w-]+)\}/g,function(a,c){return d.jsify(new e("@"+c,d.getIndex(),d.fileInfo()).eval(b))});try{a=new Function("return ("+a+")")}catch(g){throw{message:"JavaScript evaluation error: "+g.message+" from `"+a+"`",filename:this.fileInfo().filename,index:this.getIndex()}}var h=b.frames[0].variables();for(var i in h)h.hasOwnProperty(i)&&(f[i.slice(1)]={value:h[i].value,toJS:function(){return this.value.eval(b).toCSS()}});try{c=a.call(f)}catch(g){throw{message:"JavaScript evaluation error: '"+g.name+": "+g.message.replace(/["]/g,"'")+"'",filename:this.fileInfo().filename,index:this.getIndex()}}return c},f.prototype.jsify=function(a){return Array.isArray(a.value)&&a.value.length>1?"["+a.value.map(function(a){return a.toCSS()}).join(", ")+"]":a.toCSS()},b.exports=f},{"./node":76,"./variable":88}],70:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Keyword",e.prototype.genCSS=function(a,b){if("%"===this.value)throw{type:"Syntax",message:"Invalid % without number"};b.add(this.value)},e.True=new e("true"),e.False=new e("false"),b.exports=e},{"./node":76}],71:[function(a,b,c){var d=a("./ruleset"),e=a("./value"),f=a("./selector"),g=a("./anonymous"),h=a("./expression"),i=a("./atrule"),j=a("../utils"),k=function(a,b,c,g,h){this._index=c,this._fileInfo=g;var i=new f([],null,null,this._index,this._fileInfo).createEmptySelectors();this.features=new e(b),this.rules=[new d(i,a)],this.rules[0].allowImports=!0,this.copyVisibilityInfo(h),this.allowRoot=!0,this.setParent(i,this),this.setParent(this.features,this),this.setParent(this.rules,this)};k.prototype=new i,k.prototype.type="Media",k.prototype.isRulesetLike=function(){return!0},k.prototype.accept=function(a){this.features&&(this.features=a.visit(this.features)),this.rules&&(this.rules=a.visitArray(this.rules))},k.prototype.genCSS=function(a,b){b.add("@media ",this._fileInfo,this._index),this.features.genCSS(a,b),this.outputRuleset(a,b,this.rules)},k.prototype.eval=function(a){a.mediaBlocks||(a.mediaBlocks=[],a.mediaPath=[]);var b=new k(null,[],this._index,this._fileInfo,this.visibilityInfo());return this.debugInfo&&(this.rules[0].debugInfo=this.debugInfo,b.debugInfo=this.debugInfo),b.features=this.features.eval(a),a.mediaPath.push(b),a.mediaBlocks.push(b),this.rules[0].functionRegistry=a.frames[0].functionRegistry.inherit(),a.frames.unshift(this.rules[0]),b.rules=[this.rules[0].eval(a)],a.frames.shift(),a.mediaPath.pop(),0===a.mediaPath.length?b.evalTop(a):b.evalNested(a)},k.prototype.evalTop=function(a){var b=this;if(a.mediaBlocks.length>1){var c=new f([],null,null,this.getIndex(),this.fileInfo()).createEmptySelectors();b=new d(c,a.mediaBlocks),b.multiMedia=!0,b.copyVisibilityInfo(this.visibilityInfo()),this.setParent(b,this)}return delete a.mediaBlocks,delete a.mediaPath,b},k.prototype.evalNested=function(a){var b,c,f=a.mediaPath.concat([this]);for(b=0;b0;b--)a.splice(b,0,new g("and"));return new h(a)})),this.setParent(this.features,this),new d([],[])},k.prototype.permute=function(a){if(0===a.length)return[];if(1===a.length)return a[0];for(var b=[],c=this.permute(a.slice(1)),d=0;d0){for(n=!0,k=0;k0)p=B;else if(p=A,q[A]+q[B]>1)throw{type:"Runtime",message:"Ambiguous use of `default()` found when matching for `"+this.format(t)+"`",index:this.getIndex(),filename:this.fileInfo().filename};for(k=0;kthis.params.length)return!1}c=Math.min(f,this.arity);for(var g=0;gb?1:void 0},d.prototype.blocksVisibility=function(){return null==this.visibilityBlocks&&(this.visibilityBlocks=0),0!==this.visibilityBlocks},d.prototype.addVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks+1},d.prototype.removeVisibilityBlock=function(){null==this.visibilityBlocks&&(this.visibilityBlocks=0),this.visibilityBlocks=this.visibilityBlocks-1},d.prototype.ensureVisibility=function(){this.nodeVisible=!0},d.prototype.ensureInvisibility=function(){this.nodeVisible=!1},d.prototype.isVisible=function(){return this.nodeVisible},d.prototype.visibilityInfo=function(){return{visibilityBlocks:this.visibilityBlocks,nodeVisible:this.nodeVisible}},d.prototype.copyVisibilityInfo=function(a){a&&(this.visibilityBlocks=a.visibilityBlocks,this.nodeVisible=a.nodeVisible)},b.exports=d},{}],77:[function(a,b,c){var d=a("./node"),e=a("./color"),f=a("./dimension"),g=a("../constants").Math,h=function(a,b,c){this.op=a.trim(),this.operands=b,this.isSpaced=c};h.prototype=new d,h.prototype.type="Operation",h.prototype.accept=function(a){this.operands=a.visit(this.operands)},h.prototype.eval=function(a){var b,c=this.operands[0].eval(a),d=this.operands[1].eval(a);if(a.isMathOn(this.op)){if(b="./"===this.op?"/":this.op,c instanceof f&&d instanceof e&&(c=c.toColor()),d instanceof f&&c instanceof e&&(d=d.toColor()),!c.operate){if(c instanceof h&&"/"===c.op&&a.math===g.PARENS_DIVISION)return new h(this.op,[c,d],this.isSpaced);throw{type:"Operation",message:"Operation on an invalid type"}}return c.operate(a,b,d)}return new h(this.op,[c,d],this.isSpaced)},h.prototype.genCSS=function(a,b){this.operands[0].genCSS(a,b),this.isSpaced&&b.add(" "),b.add(this.op),this.isSpaced&&b.add(" "),this.operands[1].genCSS(a,b)},b.exports=h},{"../constants":12,"./color":55,"./dimension":62,"./node":76}],78:[function(a,b,c){var d=a("./node"),e=function(a){this.value=a};e.prototype=new d,e.prototype.type="Paren",e.prototype.genCSS=function(a,b){b.add("("),this.value.genCSS(a,b),b.add(")")},e.prototype.eval=function(a){return new e(this.value.eval(a))},b.exports=e},{"./node":76}],79:[function(a,b,c){var d=a("./node"),e=a("./declaration"),f=function(a,b,c){this.name=a,this._index=b,this._fileInfo=c};f.prototype=new d,f.prototype.type="Property",f.prototype.eval=function(a){var b,c=this.name,d=a.pluginManager.less.visitors.ToCSSVisitor.prototype._mergeRules;if(this.evaluating)throw{type:"Name",message:"Recursive property reference for "+c,filename:this.fileInfo().filename,index:this.getIndex()};if(this.evaluating=!0,b=this.find(a.frames,function(b){var f,g=b.property(c);if(g){for(var h=0;h0;a--){var b=this.rules[a-1];if(b instanceof e)return this.parseValue(b)}},q.prototype.parseValue=function(a){function b(a){return a.value instanceof k&&!a.parsed?("string"==typeof a.value.value?this.parse.parseNode(a.value.value,["value","important"],a.value.getIndex(),a.fileInfo(),function(b,c){b&&(a.parsed=!0),c&&(a.value=c[0],a.important=c[1]||"",a.parsed=!0)}):a.parsed=!0,a):a}var c=this;if(Array.isArray(a)){var d=[];return a.forEach(function(a){d.push(b.call(c,a))}),d}return b.call(c,a)},q.prototype.rulesets=function(){if(!this.rules)return[];var a,b,c=[],d=this.rules;for(a=0;b=d[a];a++)b.isRuleset&&c.push(b);return c},q.prototype.prependRule=function(a){var b=this.rules;b?b.unshift(a):this.rules=[a],this.setParent(a,this)},q.prototype.find=function(a,b,c){b=b||this;var d,e,f=[],g=a.toCSS();return g in this._lookups?this._lookups[g]:(this.rulesets().forEach(function(g){if(g!==b)for(var h=0;hd){if(!c||c(g)){e=g.find(new i(a.elements.slice(d)),b,c);for(var j=0;j0&&b.add(k),a.firstSelector=!0,h[0].genCSS(a,b),a.firstSelector=!1,d=1;d0?(e=p.copyArray(a),f=e.pop(),g=d.createDerived(p.copyArray(f.elements))):g=d.createDerived([]),b.length>0){var h=c.combinator,i=b[0].elements[0];h.emptyOrWhitespace&&!i.combinator.emptyOrWhitespace&&(h=i.combinator),g.elements.push(new j(h,i.value,c.isVariable,c._index,c._fileInfo)),g.elements=g.elements.concat(b[0].elements.slice(1))}if(0!==g.elements.length&&e.push(g),b.length>1){var k=b.slice(1);k=k.map(function(a){return a.createDerived(a.elements,[])}),e=e.concat(k)}return e}function g(a,b,c,d,e){var g;for(g=0;g0?d[d.length-1]=d[d.length-1].createDerived(d[d.length-1].elements.concat(a)):d.push(new i(a))}}function l(a,b,c){function m(a){var b;return a.value instanceof h?(b=a.value.value,b instanceof i?b:null):null}var n,o,p,q,r,s,t,u,v,w,x=!1;for(q=[],r=[[]],n=0;u=c.elements[n];n++)if("&"!==u.value){var y=m(u);if(null!=y){k(q,r);var z,A=[],B=[];for(z=l(A,b,y),x=x||z,p=0;p0&&t[0].elements.push(new j(u.combinator,"",u.isVariable,u._index,u._fileInfo)),s.push(t);else for(p=0;p0&&(a.push(r[n]),w=r[n][v-1],r[n][v-1]=w.createDerived(w.elements,c.extendList));return x}function m(a,b){var c=b.createDerived(b.elements,b.extendList,b.evaldCondition);return c.copyVisibilityInfo(a),c}var n,o,q;if(o=[],q=l(o,b,c),!q)if(b.length>0)for(o=[],n=0;n0)for(b=0;b=0&&"\n"!==b.charAt(c);)e++;return"number"==typeof a&&(d=(b.slice(0,a).match(/\n/g)||"").length),{line:d,column:e}},copyArray:function(a){var b,c=a.length,d=new Array(c);for(b=0;b=0||(i=[k.selfSelectors[0]],g=n.findMatch(j,i),g.length&&(j.hasFoundMatches=!0,j.selfSelectors.forEach(function(a){var b=k.visibilityInfo();h=n.extendSelector(g,i,a,j.isVisible()),l=new d.Extend(k.selector,k.option,0,k.fileInfo(),b),l.selfSelectors=h,h[h.length-1].extendList=[l],m.push(l),l.ruleset=k.ruleset,l.parent_ids=l.parent_ids.concat(k.parent_ids,j.parent_ids),k.firstExtendOnThisSelectorPath&&(l.firstExtendOnThisSelectorPath=!0,k.ruleset.paths.push(h))})));if(m.length){if(this.extendChainCount++,c>100){var o="{unable to calculate}",p="{unable to calculate}";try{o=m[0].selfSelectors[0].toCSS(),p=m[0].selector.toCSS()}catch(q){}throw{message:"extend circular reference detected. One of the circular extends is currently:"+o+":extend("+p+")"}}return m.concat(n.doExtendChaining(m,b,c+1))}return m},visitDeclaration:function(a,b){b.visitDeeper=!1},visitMixinDefinition:function(a,b){b.visitDeeper=!1},visitSelector:function(a,b){b.visitDeeper=!1},visitRuleset:function(a,b){if(!a.root){var c,d,e,f,g=this.allExtendsStack[this.allExtendsStack.length-1],h=[],i=this;for(e=0;e0&&k[i.matched].combinator.value!==g?i=null:i.matched++,i&&(i.finished=i.matched===k.length,i.finished&&!a.allowAfter&&(e+1k&&l>0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),l=0,k++),j=g.elements.slice(l,i.index).concat([h]).concat(c.elements.slice(1)),k===i.pathIndex&&f>0?m[m.length-1].elements=m[m.length-1].elements.concat(j):(m=m.concat(b.slice(k,i.pathIndex)),m.push(new d.Selector(j))),k=i.endPathIndex,l=i.endPathElementIndex,l>=b[k].elements.length&&(l=0,k++);return k0&&(m[m.length-1].elements=m[m.length-1].elements.concat(b[k].elements.slice(l)),k++),m=m.concat(b.slice(k,b.length)),m=m.map(function(a){var b=a.createDerived(a.elements);return e?b.ensureVisibility():b.ensureInvisibility(),b})},visitMedia:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitMediaOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b},visitAtRule:function(a,b){var c=a.allExtends.concat(this.allExtendsStack[this.allExtendsStack.length-1]);c=c.concat(this.doExtendChaining(c,a.allExtends)),this.allExtendsStack.push(c)},visitAtRuleOut:function(a){var b=this.allExtendsStack.length-1;this.allExtendsStack.length=b}},b.exports=i},{"../logger":39,"../tree":67,"../utils":89,"./visitor":97}],91:[function(a,b,c){function d(a){this.imports=[],this.variableImports=[],this._onSequencerEmpty=a,this._currentDepth=0}d.prototype.addImport=function(a){var b=this,c={callback:a,args:null,isReady:!1};return this.imports.push(c),function(){c.args=Array.prototype.slice.call(arguments,0),c.isReady=!0,b.tryRun()}},d.prototype.addVariableImport=function(a){this.variableImports.push(a)},d.prototype.tryRun=function(){this._currentDepth++;try{for(;;){for(;this.imports.length>0;){var a=this.imports[0];if(!a.isReady)return;this.imports=this.imports.slice(1),a.callback.apply(null,a.args)}if(0===this.variableImports.length)break;var b=this.variableImports[0];this.variableImports=this.variableImports.slice(1),b()}}finally{this._currentDepth--}0===this._currentDepth&&this._onSequencerEmpty&&this._onSequencerEmpty()},b.exports=d},{}],92:[function(a,b,c){var d=a("../contexts"),e=a("./visitor"),f=a("./import-sequencer"),g=a("../utils"),h=function(a,b){this._visitor=new e(this),this._importer=a,this._finish=b,this.context=new d.Eval,this.importCount=0,this.onceFileDetectionMap={},this.recursionDetector={},this._sequencer=new f(this._onSequencerEmpty.bind(this))};h.prototype={isReplacing:!1,run:function(a){try{this._visitor.visit(a)}catch(b){this.error=b}this.isFinished=!0,this._sequencer.tryRun()},_onSequencerEmpty:function(){this.isFinished&&this._finish(this.error)},visitImport:function(a,b){var c=a.options.inline;if(!a.css||c){var e=new d.Eval(this.context,g.copyArray(this.context.frames)),f=e.frames[0];this.importCount++,a.isVariableImport()?this._sequencer.addVariableImport(this.processImportNode.bind(this,a,e,f)):this.processImportNode(a,e,f)}b.visitDeeper=!1},processImportNode:function(a,b,c){var d,e=a.options.inline;try{d=a.evalForImport(b)}catch(f){f.filename||(f.index=a.getIndex(),f.filename=a.fileInfo().filename),a.css=!0,a.error=f}if(!d||d.css&&!e)this.importCount--,this.isFinished&&this._sequencer.tryRun();else{d.options.multiple&&(b.importMultiple=!0);for(var g=void 0===d.css,h=0;h0},resolveVisibility:function(a,b){if(!a.blocksVisibility()){if(this.isEmpty(a)&&!this.containsSilentNonBlockedChild(b))return;return a}var c=a.rules[0];if(this.keepOnlyVisibleChilds(c),!this.isEmpty(c))return a.ensureVisibility(),a.removeVisibilityBlock(),a},isVisibleRuleset:function(a){return!!a.firstRoot||!this.isEmpty(a)&&!(!a.root&&!this.hasVisibleSelector(a))}};var g=function(a){this._visitor=new e(this),this._context=a,this.utils=new f(a)};g.prototype={isReplacing:!0,run:function(a){return this._visitor.visit(a)},visitDeclaration:function(a,b){if(!a.blocksVisibility()&&!a.variable)return a},visitMixinDefinition:function(a,b){a.frames=[]},visitExtend:function(a,b){},visitComment:function(a,b){if(!a.blocksVisibility()&&!a.isSilent(this._context))return a},visitMedia:function(a,b){var c=a.rules[0].rules;return a.accept(this._visitor),b.visitDeeper=!1,this.utils.resolveVisibility(a,c)},visitImport:function(a,b){if(!a.blocksVisibility())return a},visitAtRule:function(a,b){return a.rules&&a.rules.length?this.visitAtRuleWithBody(a,b):this.visitAtRuleWithoutBody(a,b)},visitAnonymous:function(a,b){if(!a.blocksVisibility())return a.accept(this._visitor),a},visitAtRuleWithBody:function(a,b){function c(a){var b=a.rules;return 1===b.length&&(!b[0].paths||0===b[0].paths.length)}function d(a){var b=a.rules;return c(a)?b[0].rules:b}var e=d(a);return a.accept(this._visitor),b.visitDeeper=!1,this.utils.isEmpty(a)||this._mergeRules(a.rules[0].rules),this.utils.resolveVisibility(a,e)},visitAtRuleWithoutBody:function(a,b){if(!a.blocksVisibility()){if("@charset"===a.name){if(this.charset){if(a.debugInfo){var c=new d.Comment("/* "+a.toCSS(this._context).replace(/\n/g,"")+" */\n");return c.debugInfo=a.debugInfo,this._visitor.visit(c)}return}this.charset=!0}return a}},checkValidNodes:function(a,b){if(a)for(var c=0;c0?a.accept(this._visitor):a.rules=null,b.visitDeeper=!1}return a.rules&&(this._mergeRules(a.rules),this._removeDuplicateRules(a.rules)),this.utils.isVisibleRuleset(a)&&(a.ensureVisibility(),d.splice(0,0,a)),1===d.length?d[0]:d},_compileRulesetPaths:function(a){a.paths&&(a.paths=a.paths.filter(function(a){var b;for(" "===a[0].elements[0].combinator.value&&(a[0].elements[0].combinator=new d.Combinator("")),b=0;b=0;e--)if(c=a[e],c instanceof d.Declaration)if(f[c.name]){b=f[c.name],b instanceof d.Declaration&&(b=f[c.name]=[f[c.name].toCSS(this._context)]);var g=c.toCSS(this._context);b.indexOf(g)!==-1?a.splice(e,1):b.push(g)}else f[c.name]=c}},_mergeRules:function(a){if(a){for(var b={},c=[],e=0;e0){var b=a[0],c=[],e=[new d.Expression(c)];a.forEach(function(a){"+"===a.merge&&c.length>0&&e.push(new d.Expression(c=[])),c.push(a.value),b.important=b.important||a.important}),b.value=new d.Value(e)}})}}},b.exports=g},{"../tree":67,"./visitor":97}],97:[function(a,b,c){function d(a){return a}function e(a,b){var c,d;for(c in a)switch(d=a[c],typeof d){case"function":d.prototype&&d.prototype.type&&(d.prototype.typeIndex=b++);break;case"object":b=e(d,b)}return b}var f=a("../tree"),g={visitDeeper:!0},h=!1,i=function(a){this._implementation=a,this._visitInCache={},this._visitOutCache={},h||(e(f,1),h=!0)};i.prototype={visit:function(a){if(!a)return a;var b=a.typeIndex;if(!b)return a.value&&a.value.typeIndex&&this.visit(a.value),a;var c,e=this._implementation,f=this._visitInCache[b],h=this._visitOutCache[b],i=g;if(i.visitDeeper=!0,f||(c="visit"+a.type,f=e[c]||d,h=e[c+"Out"]||d,this._visitInCache[b]=f,this._visitOutCache[b]=h),f!==d){var j=f.call(e,a,i);a&&e.isReplacing&&(a=j)}return i.visitDeeper&&a&&a.accept&&a.accept(this),h!=d&&h.call(e,a),a},visitArray:function(a,b){if(!a)return a;var c,d=a.length;if(b||!this._implementation.isReplacing){for(c=0;ck){for(var b=0,c=h.length-j;b0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h=a.length;f=d(a),g=new l(3*h/4-f),c=f>0?h-4:h;var i=0;for(b=0;b>16&255,g[i++]=e>>8&255,g[i++]=255&e;return 2===f?(e=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,g[i++]=255&e):1===f&&(e=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,g[i++]=e>>8&255,g[i++]=255&e),g}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;fk?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;nZ)throw new RangeError("Invalid typed array length");var b=new Uint8Array(a);return b.__proto__=f.prototype,b}function f(a,b,c){if("number"==typeof a){if("string"==typeof b)throw new Error("If encoding is specified then the first argument must be a string");return j(a)}return g(a,b,c)}function g(a,b,c){if("number"==typeof a)throw new TypeError('"value" argument must not be a number');return U(a)?m(a,b,c):"string"==typeof a?k(a,b):n(a)}function h(a){if("number"!=typeof a)throw new TypeError('"size" argument must be a number');if(a<0)throw new RangeError('"size" argument must not be negative')}function i(a,b,c){return h(a),a<=0?e(a):void 0!==b?"string"==typeof c?e(a).fill(b,c):e(a).fill(b):e(a)}function j(a){return h(a),e(a<0?0:0|o(a))}function k(a,b){if("string"==typeof b&&""!==b||(b="utf8"),!f.isEncoding(b))throw new TypeError('"encoding" must be a valid string encoding');var c=0|q(a,b),d=e(c),g=d.write(a,b);return g!==c&&(d=d.slice(0,g)),d}function l(a){for(var b=a.length<0?0:0|o(a.length),c=e(b),d=0;d=Z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Z.toString(16)+" bytes");return 0|a}function p(a){return+a!=a&&(a=0),f.alloc(+a)}function q(a,b){if(f.isBuffer(a))return a.length;if(V(a)||U(a))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return P(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return S(a).length;default:if(d)return P(a).length;b=(""+b).toLowerCase(),d=!0}}function r(a,b,c){var d=!1;if((void 0===b||b<0)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),c<=0)return"";if(c>>>=0,b>>>=0,c<=b)return"";for(a||(a="utf8");;)switch(a){case"hex":return G(this,b,c);case"utf8":case"utf-8":return C(this,b,c);case"ascii":return E(this,b,c);case"latin1":case"binary":return F(this,b,c);case"base64":return B(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function s(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function t(a,b,c,d,e){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,W(c)&&(c=e?0:a.length-1),c<0&&(c=a.length+c),c>=a.length){if(e)return-1;c=a.length-1}else if(c<0){if(!e)return-1;c=0}if("string"==typeof b&&(b=f.from(b,d)),f.isBuffer(b))return 0===b.length?-1:u(a,b,c,d,e);if("number"==typeof b)return b=255&b,"function"==typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):u(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer")}function u(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,i=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;g=2,h/=2,i/=2,c/=2}var j;if(e){var k=-1;for(j=c;jh&&(c=h-i),j=c;j>=0;j--){for(var l=!0,m=0;me&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new TypeError("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(l<55296||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&l<1114112&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return D(d)}function D(a){var b=a.length;if(b<=$)return String.fromCharCode.apply(String,a);for(var c="",d=0;dd)&&(c=d);for(var e="",f=b;fc)throw new RangeError("Trying to access beyond buffer length")}function J(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||ba.length)throw new RangeError("Index out of range")}function K(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function L(a,b,c,d,e){return b=+b,c>>>=0,e||K(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(a,b,c,d,23,4),c+4}function M(a,b,c,d,e){return b=+b,c>>>=0,e||K(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(a,b,c,d,52,8),c+8}function N(a){if(a=a.trim().replace(_,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function O(a){return a<16?"0"+a.toString(16):a.toString(16)}function P(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function Q(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function S(a){return X.toByteArray(N(a))}function T(a,b,c,d){for(var e=0;e=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function U(a){return a instanceof ArrayBuffer||null!=a&&null!=a.constructor&&"ArrayBuffer"===a.constructor.name&&"number"==typeof a.byteLength}function V(a){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(a)}function W(a){return a!==a}var X=a("base64-js"),Y=a("ieee754");c.Buffer=f,c.SlowBuffer=p,c.INSPECT_MAX_BYTES=50;var Z=2147483647;c.kMaxLength=Z,f.TYPED_ARRAY_SUPPORT=d(),f.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),f.poolSize=8192,f.from=function(a,b,c){return g(a,b,c)},f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,f.alloc=function(a,b,c){return i(a,b,c)},f.allocUnsafe=function(a){return j(a)},f.allocUnsafeSlow=function(a){return j(a)},f.isBuffer=function(a){return null!=a&&a._isBuffer===!0},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);e0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},f.prototype.compare=function(a,b,c,d,e){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");if(void 0===b&&(b=0),void 0===c&&(c=a?a.length:0),void 0===d&&(d=0),void 0===e&&(e=this.length),b<0||c>a.length||d<0||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return-1;if(b>=c)return 1;if(b>>>=0,c>>>=0,d>>>=0,e>>>=0,this===a)return 0;for(var g=e-d,h=c-b,i=Math.min(g,h),j=this.slice(d,e),k=a.slice(b,c),l=0;l>>=0,isFinite(c)?(c>>>=0,void 0===d&&(d="utf8")):(d=c,c=void 0)}var e=this.length-b;if((void 0===c||c>e)&&(c=e),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(var f=!1;;)switch(d){case"hex":return v(this,a,b,c);case"utf8":case"utf-8":return w(this,a,b,c);case"ascii":return x(this,a,b,c);case"latin1":case"binary":return y(this,a,b,c);case"base64":return z(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,a,b,c);default:if(f)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),f=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c,a<0&&(a=0)):a>c&&(a=c),b<0?(b+=c,b<0&&(b=0)):b>c&&(b=c),b>>=0,b>>>=0,c||I(a,b,this.length);for(var d=this[a],e=1,f=0;++f>>=0,b>>>=0,c||I(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return a>>>=0,b||I(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return a>>>=0,b||I(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return a>>>=0,b||I(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return a>>>=0,b||I(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return a>>>=0,b||I(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a>>>=0,b>>>=0,c||I(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a>>>=0,b>>>=0,c||I(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return a>>>=0,b||I(a,1,this.length),128&this[a]?(255-this[a]+1)*-1:this[a]},f.prototype.readInt16LE=function(a,b){a>>>=0,b||I(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){a>>>=0,b||I(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return a>>>=0,b||I(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return a>>>=0,b||I(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return a>>>=0,b||I(a,4,this.length),Y.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return a>>>=0,b||I(a,4,this.length),Y.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return a>>>=0,b||I(a,8,this.length),Y.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return a>>>=0,b||I(a,8,this.length),Y.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){if(a=+a,b>>>=0,c>>>=0,!d){var e=Math.pow(2,8*c)-1;J(this,a,b,c,e,0)}var f=1,g=0;for(this[b]=255&a;++g>>=0,c>>>=0,!d){var e=Math.pow(2,8*c)-1;J(this,a,b,c,e,0)}var f=c-1,g=1;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=a/g&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,1,255,0),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,2,65535,0),this[b]=255&a,this[b+1]=a>>>8,b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,2,65535,0),this[b]=a>>>8,this[b+1]=255&a,b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,4,4294967295,0),this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a,b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,4,4294967295,0),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);J(this,a,b,c,e-1,-e)}var f=0,g=1,h=0;for(this[b]=255&a;++f>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b>>>=0,!d){var e=Math.pow(2,8*c-1);J(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0;for(this[b+f]=255&a;--f>=0&&(g*=256);)a<0&&0===h&&0!==this[b+f+1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,1,127,-128),a<0&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,2,32767,-32768),this[b]=255&a,this[b+1]=a>>>8,b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,2,32767,-32768),this[b]=a>>>8,this[b+1]=255&a,b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,4,2147483647,-2147483648),this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24,b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b>>>=0,c||J(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a,b+4},f.prototype.writeFloatLE=function(a,b,c){return L(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return L(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b=0;--e)a[e+b]=this[e+c];else if(f<1e3)for(e=0;e>>=0,c=void 0===c?this.length:c>>>0,a||(a=0);var g;if("number"==typeof a)for(g=b;g>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],104:[function(a,b,c){"use strict";function d(){}function e(a){try{return a.then}catch(b){return r=b,s}}function f(a,b){try{return a(b)}catch(c){return r=c,s}}function g(a,b,c){try{a(b,c)}catch(d){return r=d,s}}function h(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("Promise constructor's argument is not a function");this._40=0,this._65=0,this._55=null,this._72=null,a!==d&&p(a,this)}function i(a,b,c){return new a.constructor(function(e,f){var g=new h(d);g.then(e,f),j(a,new o(b,c,g))})}function j(a,b){for(;3===a._65;)a=a._55;return h._37&&h._37(a),0===a._65?0===a._40?(a._40=1,void(a._72=b)):1===a._40?(a._40=2,void(a._72=[a._72,b])):void a._72.push(b):void k(a,b)}function k(a,b){q(function(){var c=1===a._65?b.onFulfilled:b.onRejected;if(null===c)return void(1===a._65?l(b.promise,a._55):m(b.promise,a._55));var d=f(c,a._55);d===s?m(b.promise,r):l(b.promise,d)})}function l(a,b){if(b===a)return m(a,new TypeError("A promise cannot be resolved with itself."));if(b&&("object"==typeof b||"function"==typeof b)){var c=e(b);if(c===s)return m(a,r);if(c===a.then&&b instanceof h)return a._65=3,a._55=b,void n(a);if("function"==typeof c)return void p(c.bind(b),a)}a._65=1,a._55=b,n(a)}function m(a,b){a._65=2,a._55=b,h._87&&h._87(a,b),n(a)}function n(a){if(1===a._40&&(j(a,a._72),a._72=null),2===a._40){for(var b=0;b 0){
+ //设置了自定义显示的语言
+
+ //都转小写判断
+ var langs_indexof = (','+translate.selectLanguageTag.languages+',').toLowerCase();
+ //console.log(langs_indexof)
+ if(langs_indexof.indexOf(','+languageList[i].id.toLowerCase()+',') < 0){
+ //没发现,那不显示这个语种,调出
+ continue
+ }
+ }
+
+ /*判断默认要选中哪个语言*/
+ if(translate.to != null && typeof(translate.to) != 'undefined' && translate.to.length > 0){
+ //设置了目标语言,那就进行判断显示目标语言
+
+ if(translate.to == languageList[i].id){
+ option.setAttribute("selected",'selected');
+ }
+ }else{
+ //没设置目标语言,那默认选中当前本地的语种
+ if(languageList[i].id == translate.language.getLocal()){
+ option.setAttribute("selected",'selected');
+ }
+ }
+
+ option.appendChild(document.createTextNode(languageList[i].name));
+ selectLanguage.appendChild(option);
+ }
+ //增加 onchange 事件
+ if(window.addEventListener){ // Mozilla, Netscape, Firefox
+ selectLanguage.addEventListener('change', onchange,false);
+ }else{ // IE
+ selectLanguage.attachEvent('onchange',onchange);
+ }
+
+ //将select加入进网页显示
+ document.getElementById(translate.selectLanguageTag.documentId).appendChild(selectLanguage);
+
+ },
+ render:function(){ //v2增加
+ if(translate.selectLanguageTag.alreadyRender){
+ return;
+ }
+ translate.selectLanguageTag.alreadyRender = true;
+
+ //判断如果不显示select选择语言,直接就隐藏掉
+ if(!translate.selectLanguageTag.show){
+ return;
+ }
+
+ //判断translate 的id是否存在,不存在就创建一个
+ if(document.getElementById(translate.selectLanguageTag.documentId) == null){
+ var findBody = document.getElementsByTagName('body');
+ if(findBody.length == 0){
+ console.log('body tag not find, translate.selectLanguageTag.render() is not show Select Language');
+ return;
+ }
+ var body_trans = findBody[0];
+ var div = document.createElement("div"); //创建一个script标签
+ div.id=translate.selectLanguageTag.documentId;
+ body_trans.appendChild(div);
+ }else{
+ //存在,那么判断一下 select是否存在,要是存在就不重复创建了
+ if(document.getElementById(translate.selectLanguageTag.documentId+'SelectLanguage') != null){
+ //select存在了,就不重复创建了
+ return;
+ }
+ }
+
+ //从服务器加载支持的语言库
+ translate.request.post(translate.request.api.language, {}, function(data){
+ if(data.result == 0){
+ console.log('load language list error : '+data.info);
+ return;
+ }
+
+ translate.selectLanguageTag.customUI(data.list);
+
+ /*
+ try{
+ document.getElementById('translateSelectLanguage').style.width = '94px';
+ }catch(e){ console.log(e);}
+ */
+ }, null);
+
+
+ }
+ },
+
+ /*
+ * 当前本地语言
+ * 已废弃,v1使用的
+ */
+ //localLanguage:'zh-CN',
+ localLanguage:'zh-CN',
+
+ /**
+ * google翻译执行的
+ * 已废弃,v1使用的
+ */
+ googleTranslateElementInit:function(){
+ var selectId = '';
+ if(document.getElementById('translate') != null){ // && document.getElementById('translate').innerHTML.indexOf('translateSelectLanguage') > 0
+ //已经创建过了,存在
+ selectId = 'translate';
+ }
+
+ translate.translate = new google.translate.TranslateElement(
+ {
+ //这参数没用,请忽略
+ pageLanguage: 'zh-CN',
+ //一共80种语言选择,这个是你需要翻译的语言,比如你只需要翻译成越南和英语,这里就只写en,vi
+ //includedLanguages: 'de,hi,lt,hr,lv,ht,hu,zh-CN,hy,uk,mg,id,ur,mk,ml,mn,af,mr,uz,ms,el,mt,is,it,my,es,et,eu,ar,pt-PT,ja,ne,az,fa,ro,nl,en-GB,no,be,fi,ru,bg,fr,bs,sd,se,si,sk,sl,ga,sn,so,gd,ca,sq,sr,kk,st,km,kn,sv,ko,sw,gl,zh-TW,pt-BR,co,ta,gu,ky,cs,pa,te,tg,th,la,cy,pl,da,tr',
+ includedLanguages: translate.selectLanguageTag.languages,
+ //选择语言的样式,这个是面板,还有下拉框的样式,具体的记不到了,找不到api~~
+ layout: 0,
+ //自动显示翻译横幅,就是翻译后顶部出现的那个,有点丑,设置这个属性不起作用的话,请看文章底部的其他方法
+ //autoDisplay: false,
+ //disableAutoTranslation:false,
+ //还有些其他参数,由于原插件不再维护,找不到详细api了,将就了,实在不行直接上dom操作
+ },
+ selectId //触发按钮的id
+ );
+ },
+
+ /**
+ * 初始化,如加载js、css资源
+ * 已废弃,v1使用的
+ */
+ /* v2.11.11.20240124 彻底注释掉,有新的init方法替代
+ init:function(){
+ var protocol = window.location.protocol;
+ if(window.location.protocol == 'file:'){
+ //本地的,那就用http
+ protocol = 'http:';
+ }
+ if(this.resourcesUrl.indexOf('://') == -1){
+ //还没设置过,进行设置
+ this.resourcesUrl = protocol + this.resourcesUrl;
+ }
+
+ //this.resourcesUrl = 'file://G:/git/translate';
+
+ },
+ */
+ /**
+ * 执行翻译操作
+ * 已废弃,v1使用的
+ */
+ execute_v1:function(){
+ console.log('=====ERROR======');
+ console.log('The v1 version has been discontinued since 2022. Please use the latest V3 version and refer to: http://translate.zvo.cn/41162.html');
+ },
+
+ /**
+ * 设置Cookie,失效时间一年。
+ * @param name
+ * @param value
+ * * 已废弃,v1使用的
+ */
+ setCookie:function (name,value){
+ var cookieString=name+"="+escape(value);
+ document.cookie=cookieString;
+ },
+
+ //获取Cookie。若是不存再,返回空字符串
+ //* 已废弃,v1使用的
+ getCookie:function (name){
+ var strCookie=document.cookie;
+ var arrCookie=strCookie.split("; ");
+ for(var i=0;i 0){
+ return cookieValue.substr(cookieValue.lastIndexOf('/')+1,cookieValue.length-1);
+ }else{
+ return translate.localLanguage;
+ }
+ },
+
+ /**
+ * 切换语言,比如切换为英语、法语
+ * @param languageName 要切换的语言语种。传入如 english
+ * 会自动根据传入的语言来判断使用哪种版本。比如传入 en、zh-CN 等,则会使用v1.x版本
+ * 传入 chinese_simplified 、english 等,则会使用 v2.x版本
+ */
+ changeLanguage:function(languageName){
+ //判断使用的是否是v1.x
+ var v1 = ',en,de,hi,lt,hr,lv,ht,hu,zh-CN,hy,uk,mg,id,ur,mk,ml,mn,af,mr,uz,ms,el,mt,is,it,my,es,et,eu,ar,pt-PT,ja,ne,az,fa,ro,nl,en-GB,no,be,fi,ru,bg,fr,bs,sd,se,si,sk,sl,ga,sn,so,gd,ca,sq,sr,kk,st,km,kn,sv,ko,sw,gl,zh-TW,pt-BR,co,ta,gu,ky,cs,pa,te,tg,th,la,cy,pl,da,tr,';
+ if(v1.indexOf(','+languageName+',') > -1){
+ //用的是v1.x
+ console.log('您使用的是v1版本的切换语种方式,v1已在2021年就以废弃,请更换为v2,参考文档: http://translate.zvo.cn/41549.html');
+ translate.check();
+
+ var googtrans = '/'+translate.localLanguage+'/'+languageName;
+
+ //先清空泛解析域名的设置
+ var s = document.location.host.split('.');
+ if(s.length > 2){
+ var fanDomain = s[s.length-2]+'.'+s[s.length-1];
+ document.cookie = 'googtrans=;expires='+(new Date(1))+';domain='+fanDomain+';path=/';
+ document.cookie = 'googtrans='+googtrans+';domain='+fanDomain+';path=/';
+ }
+
+ translate.setCookie('googtrans', ''+googtrans);
+ translate.refreshCurrentPage();
+ return;
+ }
+
+ //用的是v2.x或更高
+ //translate.setUseVersion2();
+ translate.useVersion = 'v2';
+ //判断是否是第一次翻译,如果是,那就不用刷新页面了。 true则是需要刷新,不是第一次翻译
+ if(translate.to != null && translate.to.length > 0){
+ //当前目标值有值,且目标语言跟当前语言不一致,那当前才是已经被翻译过的
+ if(translate.to != translate.language.getLocal()){
+ var isReload = true; //标记要刷新页面
+ }
+ }
+
+
+ translate.to = languageName;
+ translate.storage.set('to',languageName); //设置目标翻译语言
+
+ if(isReload){
+ location.reload(); //刷新页面
+ }else{
+ //不用刷新,直接翻译
+ translate.execute(); //翻译
+ }
+ },
+
+ /**
+ * 自检提示,适用于 v1.x, 在 v2.x中已废弃
+ * english
+ * 已废弃,v1使用的
+ */
+ check:function(){
+ if(window.location.protocol == 'file:'){
+ console.log('\r\n---WARNING----\r\ntranslate.js 主动翻译组件自检异常,当前协议是file协议,翻译组件要在正常的线上http、https协议下才能正常使用翻译功能\r\n------------');
+ }
+ },
+
+
+ /**************************** v2.0 */
+ to:'', //翻译为的目标语言,如 english 、chinese_simplified
+ //用户第一次打开网页时,自动判断当前用户所在国家使用的是哪种语言,来自动进行切换为用户所在国家的语种。
+ //如果使用后,第二次在用,那就优先以用户所选择的为主,这个就不管用了
+ //默认是false,不使用,可设置true:使用
+ //使用 setAutoDiscriminateLocalLanguage 进行设置
+ autoDiscriminateLocalLanguage:false,
+ documents:[], //指定要翻译的元素的集合,可设置多个,如设置: document.getElementsByTagName('DIV')
+ /*
+ v2.11.5增加
+ 正在进行翻译的节点,会记录到此处。
+ 这里是最底的节点了,不会再有下级了。这也就是翻译的最终节点,也就是 translate.element.findNode() 发现的节点
+ 也就是扫描到要进行翻译的节点,在翻译前,加入到这里,在这个节点翻译结束后,将这里面记录的节点删掉。
+
+ 格式如
+ [
+ {
+ node: node节点的对象
+ number: 2 (当前正在翻译进行中的次数,比如一个节点有中英文混合的文本,那么中文、英文 会同时进行两次翻译,也就是最后要进行两次替换,会导致这个node产生两次改动。每次便是+1、-1)
+ },
+ {
+ ......
+ }
+ ]
+
+ 生命周期:
+
+ translate.execute() 执行后,会扫描要翻译的字符,扫描完成后首先会判断缓存中是否有,是否会命中缓存,如果缓存中有,那么在加入 task.add 之前就会将这个进行记录 ++
+ 在浏览器缓存没有命中后,则会通过网络api请求进行翻译,此时在发起网络请求前,会进行记录 ++
+ 当使用 translate.listener.start() 后,网页中动态渲染的部分会触发监听,触发监听后首先会判断这个节点是否存在于这里面正在被翻译,如果存在里面,那么忽略, 如果不存在里面,那么再进行 translate.execute(变动的节点) 进行翻译 (当然执行这个翻译后,自然也就又把它加入到此处进行记录 ++)
+ 【唯一的减去操作】 在task.execute() 中,翻译完成并且渲染到页面执行完成后,会触发延迟50毫秒后将这个翻译的节点从这里减去
+ */
+ inProgressNodes:[],
+ //翻译时忽略的一些东西,比如忽略某个tag、某个class等
+ ignore:{
+ tag:['style', 'script', 'link', 'pre', 'code'],
+ class:['ignore','translateSelectLanguage'],
+ id:[],
+ /*
+ 传入一个元素,判断这个元素是否是被忽略的元素。 这个会找父类,看看父类中是否包含在忽略的之中。
+ return true是在忽略的之中,false不再忽略的之中
+ */
+ isIgnore:function(ele){
+ if(ele == null || typeof(ele) == 'undefined'){
+ return false;
+ }
+
+ var parentNode = ele;
+ var maxnumber = 100; //最大循环次数,避免死循环
+ while(maxnumber-- > 0){
+ if(parentNode == null || typeof(parentNode) == 'undefined'){
+ //没有父元素了
+ return false;
+ }
+
+ //判断Tag
+ //var tagName = parentNode.nodeName.toLowerCase(); //tag名字,小写
+ var nodename = translate.element.getNodeName(parentNode).toLowerCase(); //tag名字,小写
+ if(nodename.length > 0){
+ //有nodename
+ if(nodename == 'body' || nodename == 'html' || nodename == '#document'){
+ //上层元素已经是顶级元素了,那肯定就不是了
+ return false;
+ }
+ if(translate.ignore.tag.indexOf(nodename) > -1){
+ //发现ignore.tag 当前是处于被忽略的 tag
+ return true;
+ }
+ }
+
+
+ //判断class name
+ if(parentNode.className != null){
+ var classNames = parentNode.className;
+ if(classNames == null || typeof(classNames) != 'string'){
+ continue;
+ }
+ //console.log('className:'+typeof(classNames));
+ //console.log(classNames);
+ classNames = classNames.trim().split(' ');
+ for(var c_index = 0; c_index < classNames.length; c_index++){
+ if(classNames[c_index] != null && classNames[c_index].trim().length > 0){
+ //有效的class name,进行判断
+ if(translate.ignore.class.indexOf(classNames[c_index]) > -1){
+ //发现ignore.class 当前是处于被忽略的 class
+ return true;
+ }
+ }
+ }
+ }
+
+ //判断id
+ if(parentNode.id != null && typeof(parentNode.id) != 'undefined'){
+ //有效的class name,进行判断
+ if(translate.ignore.id.indexOf(parentNode.id) > -1){
+ //发现ignore.id 当前是处于被忽略的 id
+ return true;
+ }
+ }
+
+ //赋予判断的元素向上一级
+ parentNode = parentNode.parentNode;
+ }
+
+ return false;
+ },
+
+ /*
+ * 忽略不被翻译的文本,这里出现的文本将不会被翻译。
+ * 这个其实是借用了 自定义术语 的能力,设置了自定义术语的原字符等于翻译后的字符, 于是这个字符就不会被翻译了
+ * 这里可以是多个,数组,如 ['你好','世界']
+ */
+ text:[]
+
+ },
+ //刷新页面,你可以自定义刷新页面的方式,比如在 uniapp 打包生成 apk 时,apk中的刷新页面就不是h5的这个刷新,而是app的刷新方式,就需要自己进行重写这个刷新页面的方法了
+ refreshCurrentPage:function(){
+ location.reload();
+ },
+ //自定义翻译术语
+ nomenclature:{
+ /*
+ 术语表
+ 一维:要转换的语种,如 english
+ 二维:翻译至的目标语种,如 english
+ 三维:要转换的字符串,如 "你好"
+ 结果:自定义的翻译结果,如 “Hallo”
+ */
+ data:new Array(),
+
+ /*
+ 原始术语表,可编辑的
+ 一维:要自定义目标词
+ 二维:针对的是哪个语种
+ 值:要翻译为什么内容
+
+ 其设置如
+ var data = new Array();
+ data['版本'] = {
+ english : 'banben',
+ korean : 'BanBen'
+ };
+ data['国际化'] = {
+ english : 'guojihua',
+ korean : 'GuoJiHua'
+ };
+
+ 【已过时】
+ */
+ old_Data:[],
+ /*
+ set:function(data){
+ translate.nomenclature.data = data;
+ },
+ */
+ set:function(data){
+ alert('请将 translate.nomenclature.set 更换为 append,具体使用可参考: https://github.com/xnx3/translate ');
+ },
+ /*
+ 向当前术语库中追加自定义术语。如果追加的数据重复,会自动去重
+ 传入参数:
+ from 要转换的语种
+ to 翻译至的目标语种
+ properties 属于配置表,格式如:
+ 你好=Hello
+ 世界=ShiJie
+
+ */
+ append:function(from, to, properties){
+ if(typeof(translate.nomenclature.data[from]) == 'undefined'){
+ translate.nomenclature.data[from] = new Array();
+ }
+ if(typeof(translate.nomenclature.data[from][to]) == 'undefined'){
+ translate.nomenclature.data[from][to] = new Array();
+ }
+
+ //将properties进行分析
+ //按行拆分
+ var line = properties.split('\n');
+ //console.log(line)
+ for(var line_index = 0; line_index < line.length; line_index++){
+ var item = line[line_index].trim();
+ if(item.length < 1){
+ //空行,忽略
+ continue;
+ }
+ var kvs = item.split('=');
+ //console.log(kvs)
+ if(kvs.length != 2){
+ //不是key、value构成的,忽略
+ continue;
+ }
+ var key = kvs[0].trim();
+ var value = kvs[1].trim();
+ //console.log(key)
+ if(key.length == 0 || value.length == 0){
+ //其中某个有空,则忽略
+ continue;
+ }
+
+
+ //加入,如果之前有加入,则会覆盖
+ translate.nomenclature.data[from][to][key] = value;
+ //console.log(local+', '+target+', key:'+key+', value:'+value);
+ }
+
+ //追加完后,对整个对象数组进行排序,key越大越在前面
+ translate.nomenclature.data[from][to] = translate.util.objSort(translate.nomenclature.data[from][to]);
+
+ },
+ //获取当前定义的术语表
+ get:function(){
+ return translate.nomenclature.data;
+ },
+ //对传入的str字符进行替换,将其中的自定义术语提前进行替换,然后将替换后的结果返回
+ //v3.11 后此方法已废弃,不再使用
+ dispose:function(str){
+ if(str == null || str.length == 0){
+ return str;
+ }
+ //if(translate.nomenclature.data.length == 0){
+ // return str;
+ //}
+ //判断当前翻译的两种语种是否有自定义术语库
+ //console.log(typeof(translate.nomenclature.data[translate.language.getLocal()][translate.to]))
+ if(typeof(translate.nomenclature.data[translate.language.getLocal()]) == 'undefined' || typeof(translate.nomenclature.data[translate.language.getLocal()][translate.to]) == 'undefined'){
+ return str;
+ }
+ //console.log(str)
+ for(var originalText in translate.nomenclature.data[translate.language.getLocal()][translate.to]){
+ var translateText = translate.nomenclature.data[translate.language.getLocal()][translate.to][originalText];
+ if(typeof(translateText) == 'function'){
+ //进行异常的预处理调出
+ continue;
+ }
+
+ var index = str.indexOf(originalText);
+ if(index > -1){
+ //console.log('find -- '+originalText+', \t'+translateText);
+ if(translate.language.getLocal() == 'english'){
+ //如果本地语种是英文,那么还要判断它的前后,避免比如要替换 is 将 display 中的is给替换,将单词给强行拆分了
+
+ //判断这个词前面是否符合
+ var beforeChar = ''; //前面的字符
+ if(index == 0){
+ //前面没别的字符了,那前面合适
+ }else{
+ //前面有别的字符,判断是什么字符,如果是英文,那么这个是不能被拆分的,要忽略
+ beforeChar = str.substr(index-1,1);
+ //console.log('beforeChar:'+beforeChar+', str:'+str)
+ var lang = translate.language.getCharLanguage(beforeChar);
+ //console.log(lang);
+ if(lang == 'english'){
+ //调出,不能强拆
+ continue;
+ }
+ }
+
+ //判断这个词的后面是否符合
+ var afterChar = ''; //后面的字符
+ if(index + originalText.length == str.length ){
+ //后面没别的字符了,那前面合适
+ //console.log(originalText+', meile '+str)
+ }else{
+ //后面有别的字符,判断是什么字符,如果是英文,那么这个是不能被拆分的,要忽略
+ afterChar = str.substr(index+originalText.length,1);
+ var lang = translate.language.getCharLanguage(afterChar);
+ if(lang == 'english'){
+ //跳出,不能强拆
+ continue;
+ }
+ }
+
+ str = str.replace(new RegExp(beforeChar+originalText+afterChar,'g'), beforeChar+translateText+afterChar);
+ }else{
+ //其他情况,如汉语、汉语等语种
+ str = str.replace(new RegExp(originalText,'g'), translateText);
+ }
+
+ }
+ }
+
+ return str;
+
+ /*
+ //遍历一维
+ for(var originalText in translate.nomenclature.data){
+ var languageResult = translate.nomenclature.data[originalText];
+ if(typeof(languageResult) == 'function'){
+ //进行异常的预处理调出
+ continue;
+ }
+
+ if(typeof(languageResult[translate.to]) == 'undefined'){
+ //console.log('und');
+ continue;
+ }
+
+ //var hash = translate.util.hash(originalText);
+
+ //console.log(originalText+',\t'+str);
+ if(str.indexOf(originalText) > -1){
+ //console.log('find -- '+originalText+', \t'+languageResult[translate.to]);
+ str = str.replace(new RegExp(originalText,'g'),languageResult[translate.to]);
+ }
+ }
+
+
+ return str;
+ */
+ },
+
+ },
+
+ office:{
+ /*
+ 网页上翻译之后,自动导出当前页面的术语库
+
+ 需要先指定本地语种,会自动将本地语种进行配置术语库
+
+ */
+ export:function(){
+ if(translate.language.getLocal() == translate.language.getCurrent()){
+ alert('本地语种跟要翻译的语种一致,无需导出');
+ return;
+ }
+
+ var text = '';
+ for(var uuid in translate.nodeQueue){
+ var queueValue = translate.nodeQueue[uuid];
+ for(var lang in translate.nodeQueue[uuid].list){
+ //console.log('------'+lang)
+ if(typeof(lang) != 'string' || lang.length < 1){
+ continue;
+ }
+ //if(translate.language.getLocal() == lang){
+ //console.log(translate.nodeQueue[uuid].list[lang]);
+ for(var hash in translate.nodeQueue[uuid].list[lang]){
+ //console.log(translate.nodeQueue[uuid].list[lang][hash].original);
+ //console.log(translate.nodeQueue[uuid].list[lang][hash].original);
+ text = text + '\n' + translate.nodeQueue[uuid].list[lang][hash].original + '='+translate.storage.get('hash_'+translate.language.getCurrent()+'_'+hash);
+
+ }
+ //}
+ }
+
+ }
+
+ if(text.length > 0){
+ //有内容
+ text = 'translate.office.append(\''+translate.language.getCurrent()+'\',`'+text+'\n`);';
+ //console.log(text);
+ translate.util.loadMsgJs();
+ msg.popups({
+ text:'',
+ width:'750px',
+ height:'600px',
+ padding:'1px',
+ });
+ document.getElementById('msgPopupsTextarea').value = text;
+ }else{
+ msg.alert('无有效内容!');
+ }
+
+
+ },
+ //显示导出面板
+ showPanel:function(){
+ let panel = document.createElement('div');
+ panel.setAttribute('id', 'translate_export');
+ panel.setAttribute('class','ignore');
+
+ //导出按钮
+ let button = document.createElement('button');
+ button.onclick = function() {
+ translate.office.export();
+ };
+ button.innerHTML = '导出配置信息';
+ button.setAttribute('style', 'margin-left: 72px; margin-top: 30px; margin-bottom: 20px; font-size: 25px; background-color: blue; padding: 15px; padding-top: 3px; padding-bottom: 3px; border-radius: 3px;');
+ panel.appendChild(button);
+
+ //说明文字
+ let textdiv = document.createElement('div');
+ textdiv.innerHTML = '1. 首先将当前语种切换为你要翻译的语种 2. 点击导出按钮,将翻译的配置信息导出 3. 将导出的配置信息粘贴到代码中,即可完成点此进行查阅详细使用说明 ';
+ textdiv.setAttribute('style','font-size: 14px; padding: 12px;');
+
+ panel.appendChild(textdiv);
+
+ panel.setAttribute('style', 'background-color: black; color: #fff; width: 320px; height: 206px; position: fixed; bottom: 50px; right: 50px;');
+ //把元素节点添加到body元素节点中成为其子节点,放在body的现有子节点的最后
+ document.body.appendChild(panel);
+
+ translate.util.loadMsgJs();
+ },
+ /*
+ 追加离线翻译数据。如果追加的数据重复,会自动去重
+ 传入参数:
+ from 要转换的语种
+ to 翻译至的目标语种
+ properties 属于配置表,格式如:
+ 你好=Hello
+ 世界=ShiJie
+ 这个传入参数跟 translate.nomenclature.append 的传入参数格式是一致的
+ */
+ append:function(to, properties){
+ //console.log(properties)
+ //将properties进行分析
+ //按行拆分
+ var line = properties.split('\n');
+ //console.log(line)
+ for(var line_index = 0; line_index < line.length; line_index++){
+ var item = line[line_index].trim();
+ if(item.length < 1){
+ //空行,忽略
+ continue;
+ }
+ var kvs = item.split('=');
+ //console.log(kvs)
+ if(kvs.length != 2){
+ //不是key、value构成的,忽略
+ continue;
+ }
+ var key = kvs[0];
+ var value = kvs[1];
+ //console.log(key)
+ if(key.length == 0 || value.length == 0){
+ //其中某个有空,则忽略
+ continue;
+ }
+ //console.log('set---'+key);
+ //加入 storate
+ translate.storage.set('hash_'+to+'_'+translate.util.hash(key), value);
+ }
+ },
+ },
+ setAutoDiscriminateLocalLanguage:function(){
+ translate.autoDiscriminateLocalLanguage = true;
+ },
+ /*
+ 待翻译的页面的node队列
+ 一维:key:uuid,也就是execute每次执行都会创建一个翻译队列,这个是翻译队列的唯一标识。
+ value:
+ k/v
+ 二维:对象形态,具体有:
+ key:expireTime 当前一维数组key的过期时间,到达过期时间会自动删除掉这个一维数组。如果<0则代表永不删除,常驻内存
+ value:list 待翻译的页面的node队列
+ 三维:针对二维的value, key:english、chinese_simplified等语种,这里的key便是对value的判断,取value中的要翻译的词是什么语种,对其进行了语种分类 value: k/v
+ 四维:针对三维的value, key:要翻译的词(经过语种分割的)的hash, value: node数组
+ 五维:针对四维的value, 这是个对象, 其中
+ original: 是三维的key的hash的原始文字,也就是 node 中的原始文字。
+ cacheHash: 如果翻译时匹配到了自定义术语库中的词,那么翻译完后存入到缓存中时,其缓存的翻译前字符串已经不是original,而是匹配完术语库后的文本的hash了。所以这里额外多增加了这个属性。如果匹配了术语库,那这里就是要进行缓存的翻译前文本的hash,如果未使用术语库,这里就跟其key-hash 相同。
+ translateText: 针对 original 的经过加工过的文字,比如经过自定义术语操作后的,待翻译的文字。
+ nodes: 有哪些node元素中包含了这个词,都会在这里记录
+ 六维:针对五维的 nodes,将各个具体的 node 以及 其操作的 attribute 以数组形式列出
+ 七维:针对六维列出的nodes数组,其中包含:
+ node: 具体操作的node元素
+ attribute: 也就是翻译文本针对的是什么,是node本身(nodeValue),还是 node 的某个属性,比如title属性,这则是设置为 "title"。如果这里不为空,那就是针对的属性操作的。 如果这里为空或者undefined ,那就是针对node本身,也就是 nodeValue 的字符串操作的
+ beforeText: node元素中进行翻译结果赋予时,额外在翻译结果的前面加上的字符串。其应用场景为,如果中英文混合场景下,避免中文跟英文挨着导致翻译为英语后,连到一块了。默认是空字符串 ''
+ afterText: node元素中进行翻译结果赋予时,额外在翻译结果的后面加上的字符串。其应用场景为,如果中英文混合场景下,避免中文跟英文挨着导致翻译为英语后,连到一块了。默认是空字符串 ''
+
+ 生命周期: 当execute()执行时创建, 当execute结束(其中的所有request接收到响应并渲染完毕)时销毁(当前暂时不销毁,以方便调试)
+ */
+ nodeQueue:{},
+ //指定要翻译的元素的集合,可传入一个元素或多个元素
+ //如设置一个元素,可传入如: document.getElementById('test')
+ //如设置多个元素,可传入如: document.getElementsByTagName('DIV')
+ setDocuments:function(documents){
+ if (documents == null || typeof(documents) == 'undefined') {
+ return;
+ }
+
+ if(typeof(documents.length) == 'undefined'){
+ //不是数组,是单个元素
+ translate.documents[0] = documents;
+ }else{
+ //是数组,直接赋予
+ translate.documents = documents;
+ }
+ //清空翻译队列,下次翻译时重新检索
+ translate.nodeQueue = {};
+ //console.log('set documents , clear translate.nodeQueue');
+ },
+ //获取当前指定翻译的元素(数组形式 [document,document,...])
+ //如果用户未使用setDocuments 指定的,那么返回整个网页
+ //它返回的永远是个数组形式
+ getDocuments:function(){
+ if(translate.documents != null && typeof(translate.documents) != 'undefined' && translate.documents.length > 0){
+ // setDocuments 指定的
+ return translate.documents;
+ }else{
+ //未使用 setDocuments指定,那就是整个网页了
+ //return document.all; //翻译所有的 这是 v3.5.0之前的
+ //v3.5.0 之后采用 拿 html的最上层的demo,而不是 document.all 拿到可能几千个dom
+ var doms = new Array();
+ doms[0] = document.documentElement;
+ return doms;
+ }
+ },
+
+ listener:{
+ //当前页面打开后,是否已经执行完execute() 方法进行翻译了,只要执行完一次,这里便是true。 (多种语言的API请求完毕并已渲染html)
+ //isExecuteFinish:false,
+ //是否已经使用了 translate.listener.start() 了,如果使用了,那这里为true,多次调用 translate.listener.start() 只有第一次有效
+ isStart:false,
+ //translate.listener.start(); //开启html页面变化的监控,对变化部分会进行自动翻译。注意,这里变化区域,是指使用 translate.setDocuments(...) 设置的区域。如果未设置,那么为监控整个网页的变化
+ start:function(){
+
+ translate.temp_linstenerStartInterval = setInterval(function(){
+ if(document.readyState == 'complete'){
+ //dom加载完成,进行启动
+ clearInterval(translate.temp_linstenerStartInterval);//停止
+ translate.listener.addListener();
+ }
+
+ //if(translate.listener.isExecuteFinish){ //执行完过一次,那才能使用
+ /*if(translate.listener.isStart){
+ //已开启了
+ return;
+ }*/
+
+ //console.log('translate.temp_linstenerStartInterval Finish!');
+ //}
+ }, 300);
+
+
+ },
+ //增加监听,开始监听。这个不要直接调用,需要使用上面的 start() 开启
+ addListener:function(){
+ translate.listener.isStart = true; //记录已执行过启动方法了
+
+ // 观察器的配置(需要观察什么变动)
+ translate.listener.config = { attributes: true, childList: true, subtree: true, characterData: true, attributeOldValue:true, characterDataOldValue:true };
+ // 当观察到变动时执行的回调函数
+ translate.listener.callback = function(mutationsList, observer) {
+ var documents = []; //有变动的元素
+ //console.log('--------- lisetner 变动');
+ // Use traditional 'for loops' for IE 11
+ for(let mutation of mutationsList) {
+ let addNodes = [];
+ if (mutation.type === 'childList') {
+ if(mutation.addedNodes.length > 0){
+ //多了组件
+ addNodes = mutation.addedNodes;
+ //documents.push.apply(documents, mutation.addedNodes);
+ }else if(mutation.removedNodes.length > 0){
+ //console.log('remove:');
+ //console.log(mutation.removedNodes);
+ }else{
+ //console.log('not find:');
+ //console.log(mutation);
+ }
+ }else if (mutation.type === 'attributes') {
+ //console.log('The ' + mutation.attributeName + ' attribute was modified.');
+ }else if(mutation.type === 'characterData'){
+ //内容改变
+ addNodes = [mutation.target];
+ //documents.push.apply(documents, [mutation.target]);
+ }
+
+ //去重并加入 documents
+ for(let item of addNodes){
+ //console.log(item);
+
+ //判断是否已经加入过了,如果已经加入过了,就不重复加了
+ var isFind = false;
+ for(var di = 0; di < documents.length; di++){
+ if(documents[di].isSameNode(item)){
+ isFind = true;
+ break;
+ }
+ }
+ if(isFind){
+ break;
+ }
+ documents.push.apply(documents, [item]);
+ }
+ }
+
+ //console.log(documents.length);
+ if(documents.length > 0){
+ //有变动,需要看看是否需要翻译,延迟10毫秒执行
+
+ //判断是否属于在正在翻译的节点,重新组合出新的要翻译的node集合
+ var translateNodes = [];
+ //console.log(translate.inProgressNodes.length);
+ for(let ipnode of documents){
+ //console.log('---type:'+ipnode.nodeType);
+
+ var find = false;
+ for(var ini = 0; ini < translate.inProgressNodes.length; ini++){
+ if(translate.inProgressNodes[ini].node.isSameNode(ipnode)){
+ //有记录了,那么忽略这个node,这个node是因为翻译才导致的变动
+ //console.log('发现相同');
+ find = true;
+ break;
+ }
+ }
+ if(find){
+ continue;
+ }
+
+ //不相同,才追加到新的 translateNodes
+ translateNodes.push(ipnode);
+ //console.log('listener ++ '+ipnode.nodeValue);
+ //console.log(ipnode);
+ }
+ if(translateNodes.length < 1){
+ return;
+ }
+ //console.log('translateNodeslength: '+translateNodes.length);
+
+
+ setTimeout(function() {
+ //console.log(translateNodes);
+ translate.execute(translateNodes); //指定要翻译的元素的集合,可传入一个或多个元素。如果不设置,默认翻译整个网页
+ }, 10); //这个要比 task.execute() 中的 settimeout 延迟执行删除 translate.inpr.....nodes 的时间要小,目的是前一个发生变动后,记入 inpr...nodes 然后翻译完成后节点发生变化又触发了listener,此时 inpr....nodes 还有,那么这个变化将不做处理,然后 inp.....nodes 再删除这个标记
+ }
+ };
+ // 创建一个观察器实例并传入回调函数
+ translate.listener.observer = new MutationObserver(translate.listener.callback);
+ // 以上述配置开始观察目标节点
+ var docs = translate.getDocuments();
+ for(var docs_index = 0; docs_index < docs.length; docs_index++){
+ var doc = docs[docs_index];
+ if(doc != null){
+ translate.listener.observer.observe(doc, translate.listener.config);
+ }
+ }
+ },
+ /*
+ 每当执行完一次渲染任务(翻译)时会触发此。注意页面一次翻译会触发多个渲染任务。普通情况下,一次页面的翻译可能会触发两三次渲染任务。
+ 另外如果页面中有ajax交互方面的信息,时,每次ajax信息刷新后,也会进行翻译,也是一次渲染任务。
+ 这个是为了方便扩展使用。比如在layui中扩展,监控 select 的渲染
+ */
+ renderTaskFinish:function(renderTask){
+ //console.log(renderTask);
+ }
+ },
+ //对翻译结果进行替换渲染的任务,将待翻译内容替换为翻译内容的过程
+ renderTask:class{
+ constructor(){
+ /*
+ * 任务列表
+ * 一维数组 [hash] = tasks; tasks 是多个task的数组集合
+ * 二维数组 [task,task,...],存放多个 task,每个task是一个替换。这里的数组是同一个nodeValue的多个task替换
+ * 三维数组 task['originalText'] 、 task['resultText'] 存放要替换的字符串
+ task['attribute'] 存放要替换的属性,比如 a标签的title属性。 如果是直接替换node.nodeValue ,那这个没有
+ */
+ this.taskQueue = [];
+
+ /*
+ * 要进行翻译的node元素,
+ * 一维数组 key:node.nodeValue 的 hash , value:node的元素数组
+ * 二维数组,也就是value中包含的node集合 [node,node,...]
+ */
+ this.nodes = [];
+ }
+
+ /**
+ * 向替换队列中增加替换任务
+ * node:要替换的字符属于那个node元素
+ * originalText:待翻译的字符
+ * resultText:翻译后的结果字符
+ * attribute: 要替换的是哪个属性,比如 a标签的title属性,这里便是传入title。如果不是替换属性,这里不用传入,或者传入null
+ */
+ add(node, originalText, resultText, attribute){
+ var nodeAnaly = translate.element.nodeAnalyse.get(node, attribute); //node解析
+ //var hash = translate.util.hash(translate.element.getTextByNode(node)); //node中内容的hash
+ var hash = translate.util.hash(nodeAnaly['text']);
+ //console.log('--------------'+hash);
+ //console.log(nodeAnaly);
+ //console.log(node);
+ //console.log('originalText:'+originalText+', resultText:'+resultText+', attribute:'+attribute);
+ /****** 加入翻译的元素队列 */
+ if(typeof(this.nodes[hash]) == 'undefined'){
+ this.nodes[hash] = new Array();
+ }
+ this.nodes[hash].push(node);
+ //console.log(node)
+
+ /****** 加入翻译的任务队列 */
+ var tasks = this.taskQueue[hash];
+ if(tasks == null || typeof(tasks) == 'undefined'){
+ //console.log(node.nodeValue);
+ tasks = new Array(); //任务列表,存放多个 task,每个task是一个替换。这里的数组是同一个nodeValue的多个task替换
+ }
+ var task = new Array();
+
+ //v2.3.3 增加 -- 开始
+ //这里要进行处理,因为有时候翻译前,它前或者后是有空格的,但是翻译后会把前或者后的空格给自动弄没了,如果是这种情况,要手动补上
+ if (originalText.substr(0, 1) == ' ') {
+ //console.log('第一个字符是空格');
+ if(resultText.substr(0, 1) != ' '){
+ //翻译结果的第一个字符不是空格,那么补上
+ resultText = ' ' + resultText;
+ }
+ }
+ if (originalText.substr(originalText.length - 1, 1) === ' ') {
+ //console.log('最后一个字符是空格');
+ if(resultText.substr(0, 1) != ' '){
+ //翻译结果的最后一个字符不是空格,那么补上
+ resultText = resultText + ' ';
+ }
+ }
+ //v2.3.3 增加 -- 结束
+
+ task['originalText'] = originalText;
+ task['resultText'] = resultText;
+ task['attribute'] = attribute;
+
+ //console.log(task);
+ tasks.push(task);
+ this.taskQueue[hash] = tasks;
+ /****** 加入翻译的任务队列 end */
+ }
+ //进行替换渲染任务,对页面进行渲染替换翻译
+ execute(){
+ //先对tasks任务队列的替换词进行排序,将同一个node的替换词有大到小排列,避免先替换了小的,大的替换时找不到
+ for(var hash in this.taskQueue){
+ var tasks = this.taskQueue[hash];
+ if(typeof(tasks) == 'function'){
+ //进行异常的预处理调出
+ continue;
+ }
+
+ //进行排序,将原字符串长的放前面,避免造成有部分不翻译的情况(bug是先翻译了短的,导致长的被打断而无法进行适配)
+ tasks.sort((a, b) => b.originalText.length - a.originalText.length);
+
+ this.taskQueue[hash] = tasks;
+ }
+
+ //console.log('===========task=========');
+ //console.log(this.taskQueue);
+ //console.log(this.nodes);
+ //console.log('===========task======end===');
+
+ //对nodeQueue进行翻译
+ for(var hash in this.nodes){
+ var tasks = this.taskQueue[hash]; //取出当前node元素对应的替换任务
+ //var tagName = this.nodes[hash][0].nodeName; //以下节点的tag name
+ //console.log(tasks);
+ for(var node_index = 0; node_index < this.nodes[hash].length; node_index++){
+ //对这个node元素进行替换翻译字符
+ for(var task_index=0; task_index 0){
+ //50毫秒后执行,以便页面渲染完毕
+ var renderTask = this;
+ setTimeout(function() {
+
+ /** 执行完成后,保存翻译的历史node **/
+ //将当前翻译完成的node进行缓存记录,以node唯一标识为key, node、以及node当前翻译之后的内容为值进行缓存。方便下一次执行 translate.execute() 时,若值未变化则不进行翻译
+ for(var hash in renderTask.nodes){
+ //console.log(translate.nodeQueue[uuid].list[lang][hash])
+ for(var nodeindex in renderTask.nodes[hash]){
+ //console.log(translate.nodeQueue[uuid].list[lang][hash].original);
+ //var nodename = translate.element.getNodeName(translate.nodeQueue[uuid].list[lang][hash].nodes[0].node);
+ //console.log("nodename:"+nodename);
+ var analyse = translate.element.nodeAnalyse.get(renderTask.nodes[hash][0]);
+ //analyse.text analyse.node
+ var nodeid = nodeuuid.uuid(analyse.node);
+
+ if(nodeid.length == 0){
+ //像是input的placeholder 暂时没考虑进去,这种就直接忽略了
+ continue;
+ }
+
+ //加入
+ /*
+ if(typeof(translate.nodeHistory[nodeid]) == 'object'){
+ //已经加入过了,判断它的值是否有发生过变化
+
+ if(translate.nodeHistory[nodeid].translateText == analyse.text){
+ //值相同,就不用再加入了
+ continue;
+ }
+ }
+ 这里就不用判断了,直接同步到最新的,因为同一个node,可能有本地缓存直接更新,这样会非常快,网络的会慢2秒,因时间导致同步不是最新的
+ */
+ //console.log(analyse);
+ //console.log('add-----'+analyse.text +', uuid:'+nodeid);
+ //console.log(analyse.node);
+ translate.nodeHistory[nodeid] = {};
+ translate.nodeHistory[nodeid].node = analyse.node;
+ translate.nodeHistory[nodeid].translateText = analyse.text;
+ }
+
+ }
+ //console.log(translate.nodeHistory);
+
+ /** 执行完成后,触发用户自定义的翻译完成执行函数 **/
+ translate.listener.renderTaskFinish(renderTask);
+
+ }, 50);
+
+ }else{
+ //console.log(this.taskQueue);
+ //console.log('---this.taskQueue is null');
+ }
+ }
+ },
+
+
+ /*
+ 当前状态,执行状态
+ 0 空闲(或者执行翻译完毕)
+ 10 扫描要翻译的node,并读取浏览器缓存的翻译内容进行渲染显示
+ 20 浏览器缓存渲染完毕,ajax通过文本翻译接口开始请求,在发起ajax请求前,状态变为20,然后再发起ajax请求
+ 至于翻译完毕后进行渲染,这个就不单独记录了,因为如果页面存在不同的语种,不同的语种是按照不同的请求来的,是多个异步同时进行的过程
+ */
+ state:0,
+
+ /*
+ 等待翻译队列 v3.12.6 增加
+ 当前是否有需要等待翻译的任务,这个目的是为了保证同一时间 translate.execute() 只有一次在执行,免得被新手前端给造成死循环,导致edge翻译给你屏蔽,用户网页还卡死
+ 当执行 translate.execute() 时,会先判断状态 translate.state 是否是0空闲的状态,如果空闲,才会执行,如果不是空闲,则不会执行,而是进入到这里进行等待,等待执行完毕后 translate.state 变成0空闲之后,再来执行这里的
+
+ */
+ waitingExecute:{
+
+ /*
+ 一维数组形态,存放执行的翻译任务
+ 二维对象形态,存放执行传入的 docs
+ */
+ queue:[],
+ /*
+ 增加一个翻译任务到翻译队列中
+ docs 同 translate.execute(docs) 的传入参数
+ */
+ add:function(docs){
+ //向数组末尾追加
+ translate.waitingExecute.queue.push(docs);
+ //开启一个定时器进行触发
+ let intervalId = setInterval(function() {
+ if(translate.state == 0){
+ //清除定时器,结束循环
+ clearInterval(intervalId);
+ var docs = translate.waitingExecute.get();
+ translate.execute(docs);
+ //console.log('stop waitingExecute setInterval');
+ }
+ }, 500);
+ },
+ /*
+ 从 quque 中取第一个元素,同时将其从queue中删除掉它。
+ 如果取的时候 quque已经没有任何元素了,会返回 null, 但是理论上不会出现null
+ */
+ get:function(){
+ //使用 shift 方法删除数组的第一个元素,并将第一个元素的值返回
+ if(translate.waitingExecute.queue.length > 0){
+ return translate.waitingExecute.queue.shift();
+ }else{
+ console.log('警告, translate.waitingExecute.get 出现异常,quque已空,但还往外取。');
+ return null;
+ }
+ },
+ //当前 translate.translateRequest[uuid] 的是否已经全部执行完毕,这里单纯只是对 translate.translateRequest[uuid] 的进行判断,这里要在 translate.json 接口触发完并渲染完毕后触发,当然接口失败时也要触发
+ isAllExecuteFinish:function(uuid){
+
+ for(var lang in translate.translateRequest[uuid]){
+ for(var i = 0; i 0){
+ translate.to = to_storage;
+ }
+ }
+
+ //渲染select选择语言
+ try{
+ translate.selectLanguageTag.render();
+ }catch(e){
+ console.log(e);
+ }
+
+ //判断是否还未指定翻译的目标语言
+ if(translate.to == null || typeof(translate.to) == 'undefined' || translate.to.length == 0){
+ //未指定,判断如果指定了自动获取用户本国语种了,那么进行获取
+ if(translate.autoDiscriminateLocalLanguage){
+ translate.executeByLocalLanguage();
+ }
+
+ //没有指定翻译目标语言、又没自动获取用户本国语种,则不翻译
+ translate.state = 0;
+ return;
+ }
+
+ //判断本地语种跟要翻译的目标语种是否一样,如果是一样,那就不需要进行任何翻译
+ if(translate.to == translate.language.getLocal()){
+ if(translate.language.translateLocal){
+ //这是自定义设置的允许翻译本地语种中,跟本地语种不一致的语言进行翻译
+
+ }else{
+ translate.state = 0;
+ return;
+ }
+ }
+
+
+ /********** 翻译进行 */
+
+ //先进行图片的翻译替换,毕竟图片还有加载的过程
+ translate.images.execute();
+
+ /*
+ 进行翻译指定的node操作。优先级为:
+ 1. 这个方法已经指定的翻译 nodes
+ 2. setDocuments 指定的
+ 3. 整个网页
+ 其实2、3都是通过 getDocuments() 取,在getDocuments() 就对2、3进行了判断
+ */
+ var all;
+ if(typeof(docs) != 'undefined' && docs != null){
+ //1. 这个方法已经指定的翻译 nodes
+
+ /* v3.12.6 注释,转到判断非null
+ if(docs == null){
+ //要翻译的目标区域不存在
+ console.log('translate.execute(...) 中传入的要翻译的目标区域不存在。');
+ translate.state = 0;
+ return;
+ }
+ */
+
+ if(typeof(docs.length) == 'undefined'){
+ //不是数组,是单个元素
+ all = new Array();
+ all[0] = docs;
+ }else{
+ //是数组,直接赋予
+ all = docs;
+ }
+
+ }else{
+ //2、3
+ all = translate.getDocuments();
+ }
+ //console.log('----要翻译的目标元素-----');
+ //console.log(all)
+
+ if(all.length > 500){
+ console.log('------tip------');
+ console.log('translate.execute( docs ) 传入的docs.length 过大,超过500,这很不正常,当前 docs.length : '+all.length+' ,如果你感觉真的没问题,请联系作者 http://translate.zvo.cn/43006.html 说明情况,根据你的情况进行分析。 当前只取前500个元素进行翻译');
+ }
+
+ //检索目标内的node元素
+ for(var i = 0; i< all.length & i < 500; i++){
+ var node = all[i];
+ translate.element.whileNodes(uuid, node);
+ }
+
+ /***** translate.language.translateLanguagesRange 开始 *****/
+ if(translate.language.translateLanguagesRange.length > 0){
+ //如果大于0,则是有设置,那么只翻译有设置的语种,不在设置中的语种不会参与翻译
+ for(var lang in translate.nodeQueue[uuid].list){
+ if(translate.language.translateLanguagesRange.indexOf(lang) < 0){
+ //删除这个语种
+ delete translate.nodeQueue[uuid].list[lang];
+ }
+ }
+ }
+
+ /***** translate.language.translateLanguagesRange 结束 *****/
+
+ //修复如果translate放在了页面最顶部,此时执行肯定扫描不到任何东西的,避免这种情况出现报错
+ if(typeof(translate.nodeQueue[uuid]) == 'undefined'){
+ translate.nodeQueue[uuid] = new Array();
+ translate.nodeQueue[uuid].list = [];
+ console.log('--- translate.js warn tip 警告!! ---');
+ console.log('您使用translate.js时可能放的位置不对,不要吧 translate.js 放在网页最顶部,这样当 translate.js 进行执行,也就是 translate.execute() 执行时,因为网页是从上往下加载,它放在网页最顶部,那么它执行时网页后面的内容都还没加载出来,这个是不会获取到网页任何内容的,也就是它是不起任何作用的');
+ }
+ for(var lang in translate.nodeQueue[uuid].list){
+ //console.log('lang:'+lang)
+ for(var hash in translate.nodeQueue[uuid].list[lang]){
+ //console.log(hash)
+ if(typeof(translate.nodeQueue[uuid].list[lang][hash]) == 'function'){
+ //v2.10增加,避免hash冒出个 Contains 出来导致for中的.length 出错
+ continue;
+ }
+ for(var nodeindex = translate.nodeQueue[uuid].list[lang][hash].nodes.length-1; nodeindex > -1; nodeindex--){
+ //console.log(translate.nodeQueue[uuid].list[lang][hash].nodes);
+ var analyse = translate.element.nodeAnalyse.get(translate.nodeQueue[uuid].list[lang][hash].nodes[nodeindex].node);
+ //analyse.text analyse.node
+ var nodeid = nodeuuid.uuid(analyse.node);
+ //translate.nodeQueue[uuid].list[lang][hash].nodes.splice(nodeindex, 1);
+ //console.log(nodeid+'\t'+analyse.text);
+ if(typeof(translate.nodeHistory[nodeid]) != 'undefined'){
+ //存在,判断其内容是否发生了改变
+ //console.log('比较---------');
+ //console.log(translate.nodeHistory[nodeid].translateText);
+ //console.log(analyse.text);
+ if(translate.nodeHistory[nodeid].translateText == analyse.text){
+ //内容未发生改变,那么不需要再翻译了,从translate.nodeQueue中删除这个node
+ translate.nodeQueue[uuid].list[lang][hash].nodes.splice(nodeindex, 1);
+ //console.log('发现相等的node,删除 '+analyse.text+'\t'+hash);
+ }else{
+ //console.log("发现变化的node =======nodeid:"+nodeid);
+ //console.log(translate.nodeHistory[nodeid].translateText == analyse.text);
+ //console.log(translate.nodeHistory[nodeid].node);
+ //console.log(translate.nodeHistory[nodeid].translateText);
+ //console.log(analyse.text);
+
+ }
+ }else{
+ //console.log('未在 nodeHistory 中发现,新的node nodeid:'+nodeid);
+ //console.log(analyse.node)
+ }
+ }
+ if(translate.nodeQueue[uuid].list[lang][hash].nodes.length == 0){
+ //如果node数组中已经没有了,那么直接把这个hash去掉
+ delete translate.nodeQueue[uuid].list[lang][hash];
+ }
+ }
+ if(Object.keys(translate.nodeQueue[uuid].list[lang]).length == 0){
+ //如果这个语言中没有要翻译的node了,那么删除这个语言
+ delete translate.nodeQueue[uuid].list[lang];
+ }
+ }
+ //console.log('new queuq');
+ //console.log(translate.nodeQueue[uuid])
+ //translate.nodeHistory[nodeid]
+
+
+ //console.log('-----待翻译:----');
+ //console.log(translate.nodeQueue);
+
+ //translateTextArray[lang][0]
+ var translateTextArray = {}; //要翻译的文本的数组,格式如 ["你好","欢迎"]
+ var translateHashArray = {}; //要翻译的文本的hash,跟上面的index是一致的,只不过上面是存要翻译的文本,这个存hash值
+
+
+ /*
+ 要进行第二次扫描的node - 2023.8.22 解决缓存会打散扫描到的翻译文本,导致翻译结束后找寻不到而导致不翻译的问题
+ 一维 key: lang
+ 二维 key: hash
+ 三维 key:
+ node: 当前的node元素
+ 四维 array: 当前缓存中进行翻译的文本数组:
+ cacheOriginal: 已缓存被替换前的文本
+ cacheTranslateText: 已缓存被替换后的翻译文本
+
+ */
+ var twoScanNodes = {};
+ var cacheScanNodes = []; //同上面的 twoScanNodes,只不过 twoScanNodes 是按照lang存的,而这个不再有lang区分
+ for(var lang in translate.nodeQueue[uuid]['list']){ //二维数组中,取语言
+ //console.log('lang:'+lang); //lang为english这种语言标识
+ if(lang == null || typeof(lang) == 'undefined' || lang.length == 0 || lang == 'undefined'){
+ //console.log('lang is null : '+lang);
+ continue;
+ }
+
+ translateTextArray[lang] = [];
+ translateHashArray[lang] = [];
+
+ let task = new translate.renderTask();
+ //console.log(translate.nodeQueue);
+
+ twoScanNodes[lang] = [];
+ //二维数组,取hash、value
+ for(var hash in translate.nodeQueue[uuid]['list'][lang]){
+ if(typeof(translate.nodeQueue[uuid]['list'][lang][hash]) == 'function'){
+ //跳出,增加容错。 正常情况下应该不会这样
+ continue;
+ }
+
+ //取原始的词,还未经过翻译的,需要进行翻译的词
+ //var originalWord = translate.nodeQueue[uuid]['list'][lang][hash]['original'];
+
+ //原始的node中的词
+ var originalWord = translate.nodeQueue[uuid]['list'][lang][hash]['original'];
+ //要翻译的词
+ var translateText = translate.nodeQueue[uuid]['list'][lang][hash]['translateText'];
+ //console.log(originalWord);
+/*
+ //自定义术语后的。如果
+ var nomenclatureOriginalWord = translate.nomenclature.dispose(cache);
+ if(nomenclatureOriginalWord != originalWord){
+ has
+ }
+*/
+ //console.log(originalWord == translateText ? '1':'xin:'+translateText);
+ //根据hash,判断本地是否有缓存了
+ var cacheHash = originalWord == translateText ? hash:translate.util.hash(translateText); //如果匹配到了自定义术语库,那翻译前的hash是被改变了
+ translate.nodeQueue[uuid]['list'][lang][hash]['cacheHash'] = cacheHash; //缓存的hash。 缓存时,其hash跟翻译的语言是完全对应的,缓存的hash就是翻译的语言转换来的
+ var cache = translate.storage.get('hash_'+translate.to+'_'+cacheHash);
+ //console.log(cacheHash+', '+cache);
+
+ //var twoScanNodes[] = []; //要进行第二次扫描的node
+ if(cache != null && cache.length > 0){
+ //有缓存了
+ //console.log('find cache:'+cache);
+ //直接将缓存赋予
+ //for(var index = 0; index < this.nodeQueue[lang][hash].length; index++){
+ //this.nodeQueue[lang][hash][index].nodeValue = cache;
+
+ for(var node_index = 0; node_index < translate.nodeQueue[uuid]['list'][lang][hash]['nodes'].length; node_index++){
+ //console.log(translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]);
+
+
+ //加入 translate.inProgressNodes
+ //取得这个翻译的node
+ var ipnode = translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['node'];
+
+ //判断这个node是否已经在 inProgressNodes 记录了
+ var isFind = false;
+ for(var ini = 0; ini < translate.inProgressNodes.length; ini++){
+ if(translate.inProgressNodes[ini].node.isSameNode(ipnode)){
+ //有记录了,那么出现次数 +1
+ translate.inProgressNodes[ini].number++;
+ isFind = true;
+ //console.log('cache - find - ++ ');
+ //console.log(ipnode);
+ }
+ }
+ //未发现,那么还要将这个node加入进去
+ if(!isFind){
+ //console.log('cache - find - add -- lang:'+lang+', hash:'+hash+' node_index:'+node_index);
+ //console.log(ipnode.nodeValue);
+ translate.inProgressNodes.push({node: ipnode, number:1});
+ }
+
+ //console.log(translate.inProgressNodes);
+ //加入 translate.inProgressNodes -- 结束
+
+ //翻译结果的文本,包含了before 、 after 了
+ var translateResultText = translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['beforeText']+cache+translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['afterText'];
+ task.add(translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['node'], originalWord, translateResultText, translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['attribute']);
+ //this.nodeQueue[lang][hash]['nodes'][node_index].nodeValue = this.nodeQueue[lang][hash]['nodes'][node_index].nodeValue.replace(new RegExp(originalWord,'g'), cache);
+ //console.log(translateResultText);
+
+ //重新扫描这个node,避免这种情况:
+ //localstorage缓存中有几个词的缓存了,但是从缓存中使用时,把原本识别的要翻译的数据给打散了,导致翻译结果没法赋予,导致用户展示时有些句子没成功翻译的问题 -- 2023.8.22
+ //console.log('继续扫描 + 1 - '+twoScanNodes.length);
+ var twoScanIndex = -1; //当前元素是否在 twoScan 中已经加入了,如果已经加入了,那么这里赋予当前所在的下标
+ for(var i = 0; i 0){
+ //因为在这个数组中的值都是一样的,那么只需要取出第一个就行了
+ var valueStr = queueNodes[0].nodeValue;
+ valueStr = this.util.charReplace(valueStr);
+
+ translateTextArray[lang].push(valueStr);
+ translateHashArray[lang].push(hash);
+ }
+ */
+
+ //加入待翻译数组
+ translateTextArray[lang].push(translateText);
+ translateHashArray[lang].push(hash); //这里存入的依旧还是用原始hash,未使用自定义术语库前的hash,目的是不破坏 nodeQueue 的 key
+ }
+
+ task.execute(); //执行渲染任务
+ }
+ //console.log(twoScanNodes);
+ //console.log('cacheScanNodes:');
+ //console.log(cacheScanNodes);
+
+ /******* 进行第二次扫描、追加入翻译队列。目的是防止缓存打散扫描的待翻译文本 ********/
+ for(var lang in twoScanNodes){
+ //记录第一次扫描的数据,以便跟第二次扫描后的进行对比
+ var firstScan = Object.keys(translate.nodeQueue[uuid]['list'][lang]);
+ var firstScan_lang_langth = firstScan.length; //第一次扫描后的数组长度
+
+ //console.log(twoScanNodes[lang]);
+ for(var i = 0; i -1){
+ //发现了,那么强制赋予翻以前内容
+ text = translateTextArray[data.from][i];
+ }
+
+
+ //翻译前的hash对应下标
+ var hash = translateHashArray[data.from][i];
+ var cacheHash = translate.nodeQueue[uuid]['list'][lang][hash]['cacheHash'];
+
+
+
+ //取原始的词,还未经过翻译的,需要进行翻译的词
+ var originalWord = '';
+ try{
+ originalWord = translate.nodeQueue[uuid]['list'][lang][hash]['original'];
+ //console.log('bef:'+translate.nodeQueue[uuid]['list'][lang][hash]['beforeText']);
+ }catch(e){
+ console.log('uuid:'+uuid+', originalWord:'+originalWord+', lang:'+lang+', hash:'+hash+', text:'+text+', queue:'+translate.nodeQueue[uuid]);
+ console.log(e);
+ continue;
+ }
+
+ //for(var index = 0; index < translate.nodeQueue[lang][hash].length; index++){
+ for(var node_index = 0; node_index < translate.nodeQueue[uuid]['list'][lang][hash]['nodes'].length; node_index++){
+ //translate.nodeQueue[lang][hash]['nodes'][node_index].nodeValue = translate.nodeQueue[lang][hash]['nodes'][node_index].nodeValue.replace(new RegExp(originalWord,'g'), text);
+ //加入任务
+ task.add(translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['node'], originalWord, translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['beforeText']+text+translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['afterText'], translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['attribute']);
+ }
+ //}
+ /*
+ for(var index = 0; index < translate.nodeQueue[data.from][hash].length; index++){
+ translate.nodeQueue[data.from][hash][index].nodeValue = text;
+ }
+ */
+
+ //将翻译结果以 key:hash value翻译结果的形式缓存
+ translate.storage.set('hash_'+data.to+'_'+cacheHash,text);
+ }
+ task.execute(); //执行渲染任务
+ //translate.temp_executeFinishNumber++; //记录执行完的次数
+
+ translate.translateRequest[uuid][lang].result = 1;
+ translate.translateRequest[uuid][lang].executeFinish = 1; //1是执行完毕
+ translate.translateRequest[uuid][lang].stoptime = Math.floor(Date.now() / 1000);
+ translate.waitingExecute.isAllExecuteFinish();
+ }, function(xhr){
+ translate.translateRequest[uuid][lang].executeFinish = 1; //1是执行完毕
+ translate.translateRequest[uuid][lang].stoptime = Math.floor(Date.now() / 1000);
+ translate.translateRequest[uuid][lang].result = 3;
+ translate.waitingExecute.isAllExecuteFinish();
+ });
+ /*** 翻译end ***/
+ }
+ },
+
+ /**
+ * 翻译请求记录
+ * 一维:key:uuid,也就是execute每次执行都会创建一个翻译队列,这个是翻译队列的唯一标识。 这个uuid跟 nodeQueue 的uuid是一样的
+ * value:对象
+ * 二维: 对象,包含:
+ * from 存放的是要翻译的源语种,比如要讲简体中文翻译为英文,这里存放的就是 chinese_simplified
+ * state 是否执行完毕,0是执行中, 1是执行完毕(不管是失败还是成功) 而且执行完毕是指ajax请求获得响应,并且dom渲染完成之后才算完毕。当然如果ajax接口失败那也是直接算完毕
+ * addtime 这条数据加入到本数组的时间,也就是进行ajax请求开始那一刻的时间,10位时间戳
+ * stoptime 执行完毕的时间,也就是state转为2那一刻的时间
+ * result 执行结果, 0 是还没执行完,等待执行完, > 0 是执行完了有结果了,
+ * 1 是执行成功
+ * 2 是接口有响应,也是200响应,但是接口响应的结果返回了错误,也就是返回了 {result:0, info:'...'}
+ * 3 是接口不是200响应码
+ *
+ */
+ translateRequest:{
+ /*
+ uuid:[
+ 'chinese_simplified':{
+ executeFinish:0,
+ addtime:150001111,
+ stoptime:150001111,
+ result:0
+ },
+ ...
+ ]
+ */
+ },
+
+ /*
+ 将已成功翻译并渲染的node节点进行缓存记录
+ key: node节点的唯一标识符,通过 nodeuuid.uuid() 生成
+ value:
+ node: node节点
+ translateText: 翻译完成后,当前node节点的内容文本(是已经翻译渲染过的)
+ */
+ nodeHistory:{},
+ element:{
+
+ /*
+ 注意,里面全部的必须小写。
+ 第一个是tag,第二个是tag的属性。比如要翻译 input 的 value 属性,那么如下:
+ translate.element.tagAttribute['input']=['value'];
+ 比如要翻译 input 的 value 、 data-value 这两个属性,那么如下:
+ translate.element.tagAttribute['input']=['value','data-value'];
+ 有几个要翻译的属性,就写上几个。
+ 同样,有几个要额外翻译的tag,就加上几行。
+ 详细文档参考: http://translate.zvo.cn/231504.html
+ */
+ tagAttribute : {},
+
+ //对翻译前后的node元素的分析(翻以前)及渲染(翻译后)
+ nodeAnalyse:{
+ /*
+ 获取node中的要进行翻译的文本内容、以及要操作的实际node对象(这个node对象很可能是传入的node中的某个子node)
+ node
+ attribute 要获取的是某个属性的值,还是node本身的值。比如 a标签的title属性的值,则传入 title。 如果是直接获取node.nodeValue ,那这个没有
+
+ 返回结果是一个数组。其中:
+ ['text']:要进行翻译的text内容文本
+ ['node']:要进行翻译的目标node
+
+ */
+ get:function(node, attribute){
+ return translate.element.nodeAnalyse.analyse(node,'','', attribute);
+ },
+ /*
+ 进行翻译之后的渲染显示
+ 参数:
+ node 当前翻译的node元素
+ originalText 翻译之前的内容文本
+ resultText 翻译之后的内容文本
+ attribute 存放要替换的属性,比如 a标签的title属性。 如果是直接替换node.nodeValue ,那这个没有
+ */
+ set:function(node, originalText, resultText, attribute){
+ translate.element.nodeAnalyse.analyse(node,originalText,resultText, attribute);
+ },
+ /*
+
+ 注意,这个不使用,只是服务于上面的get、set使用。具体使用用上面的get、set
+
+ 1. 只传入 node:
+ 获取node中的要进行翻译的文本内容、以及要操作的实际node对象(这个node对象很可能是传入的node中的某个子node)
+ 返回结果是一个数组。其中:
+ ['text']:要进行翻译的text内容文本
+ ['node']:要进行翻译的目标node
+ 2. 传入 node、originalText、 resultText
+ 则是进行翻译之后的渲染显示
+
+ attribute : 进行替换渲染时使用,存放要替换的属性,比如 a标签的title属性。 如果是直接替换node.nodeValue ,那这个没有
+ */
+ analyse:function(node, originalText, resultText, attribute){
+ var result = new Array(); //返回的结果
+ result['node'] = node;
+ result['text'] = '';
+
+ var nodename = translate.element.getNodeName(node);
+
+ if(attribute != null && typeof(attribute) == 'string' && attribute.length > 0){
+ //这个node有属性,替换的是node的属性,而不是nodeValue
+ result['text'] = node[attribute];
+
+ //替换渲染
+ if(typeof(originalText) != 'undefined' && originalText.length > 0){
+ if(typeof(node[attribute]) != 'undefined'){
+ //这种是主流框架,像是vue、element、react 都是用这种 DOM Property 的方式,更快
+ node[attribute] = node[attribute].replace(new RegExp(translate.util.regExp.pattern(originalText),'g'), translate.util.regExp.resultText(resultText));
+ }
+
+ //这种 Html Attribute 方式 是 v3.12 版本之前一直使用的方式,速度上要慢于 上面的,为了向前兼容不至于升级出问题,后面可能会优化掉
+ var htmlAttributeValue = node.getAttribute(attribute);
+ if(htmlAttributeValue != null && typeof(htmlAttributeValue) != 'undefined'){
+ //这个才是在v3.9.2 后要用的,上面的留着只是为了适配以前的
+ node.setAttribute(attribute, htmlAttributeValue.replace(new RegExp(translate.util.regExp.pattern(originalText),'g'), translate.util.regExp.resultText(resultText)));
+ }
+ }
+ return result;
+ }
+
+ //正常的node ,typeof 都是 object
+
+ //console.log(typeof(node)+node);
+ if(nodename == '#text'){
+ //如果是普通文本,判断一下上层是否是包含在textarea标签中
+ if(typeof(node.parentNode) != 'undefined'){
+ var parentNodename = translate.element.getNodeName(node.parentNode);
+ //console.log(parentNodename)
+ if(parentNodename == 'TEXTAREA'){
+ //是textarea标签,那将nodename 纳入 textarea的判断中,同时将判断对象交于上级,也就是textarea标签
+ nodename = 'TEXTAREA';
+ node = node.parentNode;
+ }
+ }
+ }
+
+
+
+ //console.log(nodename)
+ //console.log(translate.element.getNodeName(node.parentNode))
+ //console.log(node)
+ if(nodename == 'INPUT' || nodename == 'TEXTAREA'){
+ //console.log(node.attributes)
+ /*
+ 1. input、textarea 输入框,要对 placeholder 做翻译
+ 2. input 要对 type=button 的情况进行翻译
+ */
+ if(node.attributes == null || typeof(node.attributes) == 'undefined'){
+ result['text'] = '';
+ return result;
+ }
+
+ //input,要对 type=button、submit 的情况进行翻译
+ if(nodename == 'INPUT'){
+ if(typeof(node.attributes.type) != 'undefined' && typeof(node.attributes.type.nodeValue) != null && (node.attributes.type.nodeValue.toLowerCase() == 'button' || node.attributes.type.nodeValue.toLowerCase() == 'submit')){
+ //console.log('----是 0){
+ //替换渲染
+ if(typeof(originalText) != 'undefined' && originalText.length > 0){
+ //this.nodes[hash][task_index].nodeValue = this.nodes[hash][task_index].nodeValue.replace(new RegExp(translate.util.regExp.pattern(task.originalText),'g'), translate.util.regExp.resultText(task.resultText));
+ input_value_node.nodeValue = input_value_node.nodeValue.replace(new RegExp(translate.util.regExp.pattern(originalText),'g'), translate.util.regExp.resultText(resultText));
+ }
+
+ result['text'] = input_value_node.nodeValue;
+ result['node'] = input_value_node;
+ return result;
+ }
+ }
+ }
+ //console.log(node)
+
+ //input textarea 的 placeholder 情况
+ if(typeof(node.attributes['placeholder']) != 'undefined'){
+ //console.log(node);
+ //替换渲染
+ if(typeof(originalText) != 'undefined' && originalText.length > 0){
+ //this.nodes[hash][task_index].nodeValue = this.nodes[hash][task_index].nodeValue.replace(new RegExp(translate.util.regExp.pattern(task.originalText),'g'), translate.util.regExp.resultText(task.resultText));
+ node.attributes['placeholder'].nodeValue = node.attributes['placeholder'].nodeValue.replace(new RegExp(translate.util.regExp.pattern(originalText),'g'), translate.util.regExp.resultText(resultText));
+ }
+
+ result['text'] = node.attributes['placeholder'].nodeValue;
+ result['node'] = node.attributes['placeholder'];
+ return result;
+ //return node.attributes['placeholder'].nodeValue;
+ }
+ //console.log(node)
+ result['text'] = '';
+ return result;
+ }
+ if(nodename == 'META'){
+ //meta标签,如是关键词、描述等
+ if(typeof(node.name) != 'undefined' && node.name != null){
+ var nodeAttributeName = node.name.toLowerCase(); //取meta 标签的name 属性
+ var nodeAttributePropertyOri = node.getAttribute('property'); //取 property的值
+ var nodeAttributeProperty = '';
+ if(typeof(nodeAttributePropertyOri) != 'undefined' && nodeAttributePropertyOri != null && nodeAttributePropertyOri.length > 0){
+ nodeAttributeProperty = nodeAttributePropertyOri.toLowerCase();
+ }
+ if(nodeAttributeName == 'keywords' || nodeAttributeName == 'description' || nodeAttributeName == 'sharetitle' || nodeAttributeProperty == 'og:title' || nodeAttributeProperty == 'og:description' || nodeAttributeProperty == 'og:site_name' || nodeAttributeProperty == 'og:novel:latest_chapter_name'){
+ //替换渲染
+ if(typeof(originalText) != 'undefined' && originalText != null && originalText.length > 0){
+ //this.nodes[hash][task_index].nodeValue = this.nodes[hash][task_index].nodeValue.replace(new RegExp(translate.util.regExp.pattern(task.originalText),'g'), translate.util.regExp.resultText(task.resultText));
+ node.content = node.content.replace(new RegExp(translate.util.regExp.pattern(originalText),'g'), translate.util.regExp.resultText(resultText));
+ }
+
+ result['text'] = node.content;
+ return result;
+ }
+ }
+
+ result['text'] = '';
+ return result;
+ }
+ if(nodename == 'IMG'){
+ if(typeof(node.alt) == 'undefined' || node.alt == null){
+ result['text'] = '';
+ return result;
+ }
+
+ //替换渲染
+ if(typeof(originalText) != 'undefined' && originalText.length > 0){
+ //this.nodes[hash][task_index].nodeValue = this.nodes[hash][task_index].nodeValue.replace(new RegExp(translate.util.regExp.pattern(task.originalText),'g'), translate.util.regExp.resultText(task.resultText));
+ node.alt = node.alt.replace(new RegExp(translate.util.regExp.pattern(originalText),'g'), translate.util.regExp.resultText(resultText));
+ }
+ result['text'] = node.alt;
+ return result;
+ }
+
+
+ //其他的
+ if(node.nodeValue == null || typeof(node.nodeValue) == 'undefined'){
+ result['text'] = '';
+ }else if(node.nodeValue.trim().length == 0){
+ //避免就是单纯的空格或者换行
+ result['text'] = '';
+ }else{
+ //替换渲染
+ if(typeof(originalText) != 'undefined' && originalText != null && originalText.length > 0){
+ //this.nodes[hash][task_index].nodeValue = this.nodes[hash][task_index].nodeValue.replace(new RegExp(translate.util.regExp.pattern(task.originalText),'g'), translate.util.regExp.resultText(task.resultText));
+ node.nodeValue = node.nodeValue.replace(new RegExp(translate.util.regExp.pattern(originalText),'g'), translate.util.regExp.resultText(resultText));
+ }
+ result['text'] = node.nodeValue;
+ }
+ return result;
+ }
+ },
+ //获取这个node元素的node name ,如果未发现,则返回''空字符串
+ getNodeName:function(node){
+ if(node == null || typeof(node) == 'undefined'){
+ return '';
+ }
+
+ if(node.nodeName == null || typeof(node.nodeName) == 'undefined'){
+ return '';
+ }
+
+ var nodename = node.nodeName;
+ //console.log('nodename:'+nodename+', node:'+node);
+ return nodename;
+ },
+ //向下遍历node
+ whileNodes:function(uuid, node){
+ if(node == null || typeof(node) == 'undefined'){
+ return;
+ }
+
+ //如果这个uuid没有,则创建
+ if(typeof(translate.nodeQueue[uuid]) == 'undefined' || translate.nodeQueue[uuid] == null){
+ translate.nodeQueue[uuid] = new Array(); //创建
+ translate.nodeQueue[uuid]['expireTime'] = Date.now() + 120*1000; //删除时间,10分钟后删除
+ translate.nodeQueue[uuid]['list'] = new Array();
+ //console.log('创建 --- ');
+ //console.log(uuid)
+ }
+
+ //console.log('---'+typeof(node)+', ');
+ //判断是否是有title属性,title属性也要翻译
+ if(typeof(node) == 'object' && typeof(node['title']) == 'string' && node['title'].length > 0){
+ //将title加入翻译队列
+ //console.log('---'+node.title+'\t'+node.tagName);
+ //console.log(node)
+ //console.log('------------');
+
+ //判断当前元素是否在ignore忽略的tag、id、class name中
+ if(!translate.ignore.isIgnore(node)){
+ //不在忽略的里面,才会加入翻译
+ translate.addNodeToQueue(uuid, node, node['title'], 'title');
+ }
+ }
+
+ //v3.9.2 增加, 用户可自定义标签内 attribute 的翻译
+ var nodeNameLowerCase = translate.element.getNodeName(node).toLowerCase();
+ if(typeof(translate.element.tagAttribute[nodeNameLowerCase]) != 'undefined'){
+ //console.log('find:'+nodeNameLowerCase);
+ //console.log(translate.element.tagAttribute[nodeNameLowerCase]);
+
+ for(var attributeName_index in translate.element.tagAttribute[nodeNameLowerCase]){
+
+ var attributeName = translate.element.tagAttribute[nodeNameLowerCase][attributeName_index];
+ //console.log(attributeName);
+ //console.log(node.getAttribute(attributeName));
+
+ /*
+ * 默认是 HtmlAtrribute 也就是 HTML特性。取值有两个:
+ * HTMLAtrribute : HTML特性
+ * DOMProperty : DOM属性
+ */
+ var DOMPropOrHTMLAttr = 'HTMLAtrribute';
+ var attributeValue = node.getAttribute(attributeName);
+ if(typeof(attributeValue) == 'undefined' || attributeValue == null){
+ //vue、element、react 中的一些动态赋值,比如 element 中的 el-select 选中后赋予显示出来的文本,getAttribute 就取不到,因为是改动的 DOM属性,所以要用这种方式才能取出来
+ attributeValue = node[attributeName];
+ DOMPropOrHTMLAttr = 'DOMProperty';
+ }
+ if(typeof(attributeValue) == 'undefined' || attributeValue == null){
+ //这个tag标签没有这个属性,忽略
+ continue;
+ }
+
+ //if(typeof(node.getAttribute(attributeName)) == 'undefined' && typeof(node[attributeName]) == 'undefined'){
+ // //这个tag标签没有这个 attribute,忽略
+ // continue
+ //}
+
+ //加入翻译
+ translate.addNodeToQueue(uuid, node, attributeValue, attributeName);
+ }
+
+ }
+
+
+ var childNodes = node.childNodes;
+ if(childNodes == null || typeof(childNodes) == 'undefined'){
+ return;
+ }
+ if(childNodes.length > 0){
+ for(var i = 0; i -1){
+ //忽略tag
+ //console.log('忽略tag:'+parentNodeName);
+ return;
+ }
+
+ /****** 判断忽略的class ******/
+ /*
+ 这段理论上不需要了,因为在 translate.ignore.isIgnore 判断了
+ var ignoreClass = false; //是否是被忽略的class,true是
+ var parentNode = node.parentNode;
+ while(node != parentNode && parentNode != null){
+ //console.log('node:'+node+', parentNode:'+parentNode);
+ if(parentNode.className != null){
+ if(translate.ignore.class.indexOf(parentNode.className) > -1){
+ //发现ignore.class 当前是处于被忽略的 class
+ ignoreClass = true;
+ }
+ }
+
+ parentNode = parentNode.parentNode;
+ }
+ if(ignoreClass){
+ //console.log('ignore class : node:'+node.nodeValue);
+ return;
+ }
+ */
+ /**** 判断忽略的class结束 ******/
+
+
+
+ /**** 避免中途局部翻译,在判断一下 ****/
+ //判断当前元素是否在ignore忽略的tag、id、class name中
+ if(translate.ignore.isIgnore(node)){
+ //console.log('node包含在要忽略的元素中:');
+ //console.log(node);
+ return;
+ }
+
+ //node分析
+ var nodeAnaly = translate.element.nodeAnalyse.get(node);
+ if(nodeAnaly['text'].length > 0){
+ //有要翻译的目标内容,加入翻译队列
+ //console.log('addNodeToQueue -- '+nodeAnaly['node']+', text:' + nodeAnaly['text']);
+ translate.addNodeToQueue(uuid, nodeAnaly['node'], nodeAnaly['text']);
+ }
+
+ //console.log(nodeAnaly);
+ /*
+ //console.log(node.nodeName+', type:'+node.nodeType+', '+node.nodeValue);
+ var nodename = translate.element.getNodeName(node);
+ if(nodename == 'INPUT' || nodename == 'TEXTAREA'){
+ //input 输入框,要对 placeholder 做翻译
+ console.log('input---'+node.attributes);
+ if(node.attributes == null || typeof(node.attributes) == 'undefined'){
+ return;
+ }
+
+ if(typeof(node.attributes['placeholder']) != 'undefined'){
+ //console.log(node.attributes['placeholder'].nodeValue);
+ //加入要翻译的node队列
+ //translate.nodeQueue[translate.hash(node.nodeValue)] = node.attributes['placeholder'];
+ //加入要翻译的node队列
+ //translate.addNodeToQueue(translate.hash(node.attributes['placeholder'].nodeValue), node.attributes['placeholder']);
+ translate.addNodeToQueue(uuid, node.attributes['placeholder'], node.attributes['placeholder'].nodeValue);
+ }
+
+ //console.log(node.getAttribute("placeholder"));
+ }else if(nodename == 'META'){
+ //meta标签,如是关键词、描述等
+ if(typeof(node.name) != 'undefined' && node.name != null){
+ var nodeAttributeName = node.name.toLowerCase(); //取meta 标签的name 属性
+ //console.log(nodeName);
+ if(nodeAttributeName == 'keywords' || nodeAttributeName == 'description'){
+ //关键词、描述
+ translate.addNodeToQueue(uuid, node, node.content);
+ }
+ }
+ //console.log(node.name)
+ }else if(nodename == 'IMG'){
+ //console.log('-------'+node.alt);
+ translate.addNodeToQueue(uuid, node, node.alt);
+ }else if(node.nodeValue != null && node.nodeValue.trim().length > 0){
+
+ //过滤掉无效的值
+ if(node.nodeValue != null && typeof(node.nodeValue) == 'string' && node.nodeValue.length > 0){
+ }else{
+ return;
+ }
+
+ //console.log(node.nodeValue+' --- ' + translate.language.get(node.nodeValue));
+
+ //console.log(node.nodeName);
+ //console.log(node.parentNode.nodeName);
+ //console.log(node.nodeValue);
+ //加入要翻译的node队列
+ translate.addNodeToQueue(uuid, node, node.nodeValue);
+ //translate.addNodeToQueue(translate.hash(node.nodeValue), node);
+ //translate.nodeQueue[translate.hash(node.nodeValue)] = node;
+ //translate.nodeQueue[translate.hash(node.nodeValue)] = node.nodeValue;
+ //node.nodeValue = node.nodeValue+'|';
+
+ }
+ */
+
+ },
+ },
+
+
+
+
+
+ /*
+ * 将发现的元素节点加入待翻译队列
+ * uuid execute方法执行的唯一id
+ * node 当前text所在的node
+ * text 当前要翻译的目标文本
+ * attribute 是否是元素的某个属性。比如 a标签中的title属性, a.title 再以node参数传入时是string类型的,本身并不是node类型,所以就要传入这个 attribute=title 来代表这是a标签的title属性。同样第二个参数node传入的也不能是a.title,而是传入a这个node元素
+ */
+ addNodeToQueue:function(uuid, node, text, attribute){
+ if(node == null || text == null || text.length == 0){
+ return;
+ }
+
+
+ //console.log('find tag ignore : '+node.nodeValue+', '+node.nodeName+", "+node.nodeType+", "+node.tagName);
+ //console.log('addNodeToQueue into -- node:'+node+', text:'+text+', attribute:'+attribute);
+ var nodename = translate.element.getNodeName(node);
+
+ //判断如果是被 注释的区域,不进行翻译
+ if(nodename.toLowerCase() == '#comment'){
+ return;
+ }
+ //console.log('\t\t'+text);
+ //取要翻译字符的hash
+ var key = translate.util.hash(text);
+ /*
+ 如果是input 的 placeholder ,就会出现这个情况
+ if(node.parentNode == null){
+ console.log('node.parentNode == null');
+ return;
+ }
+ */
+
+ //console.log(node.parentNode);
+ //console.log(node.parentNode.nodeName);
+
+ //判断其内容是否是 script、style 等编程的文本,如果是,则不进行翻译,不然翻译后还会影响页面正常使用
+ if(translate.util.findTag(text)){
+ //console.log('find tag ignore : '+node.nodeValue+', '+node.nodeName+", "+node.nodeType+", "+node.tagName);
+ //console.log(node.parentNode.nodeName);
+
+ //获取到当前文本是属于那个tag标签中的,如果是script、style 这样的标签中,那也会忽略掉它,不进行翻译
+ if(node.parentNode == null){
+ //没有上级了,或是没获取到上级,忽略
+ return;
+ }
+ //去上级的tag name
+ var parentNodeName = translate.element.getNodeName(node.parentNode);
+ //node.parentNode.nodeName;
+ if(parentNodeName == 'SCRIPT' || parentNodeName == 'STYLE'){
+ //如果是script、style中发现的,那也忽略
+ return;
+ }
+ }
+ //console.log(node.nodeValue);
+
+
+ //原本传入的text会被切割为多个小块
+ var textArray = new Array();
+ textArray.push(text); //先将主 text 赋予 ,后面如果对主text进行加工分割,分割后会将主text给删除掉
+ //console.log(textArray);
+
+ /**** v3.10.2.20241206 - 增加自定义忽略翻译的文本,忽略翻译的文本不会被翻译 - 当然这样会打乱翻译之后阅读的连贯性 ****/
+ for(var ti = 0; ti -1){
+ //console.log(textArray[tai]+' 是忽略翻译的文本,不翻译');
+ continue;
+ }
+
+ //判断是否出现在自定义术语的
+ if(typeof(translate.temp_nomenclature[translate.language.getLocal()]) != 'undefined'){
+ if(translate.temp_nomenclature[translate.language.getLocal()].indexOf(textArray[tai].trim()) > -1){
+ //console.log(textArray[tai]+' 是自定义术语,不翻译');
+ continue;
+ }
+ }
+
+ translate.addNodeToQueueAnalysis(uuid, node, textArray[tai], attribute);
+ }
+
+ //this.nodeQueue[lang][key][this.nodeQueue[lang][key].length]=node; //往数组中追加
+ },
+
+ /**
+ * 服务于上面的 addNodeToQueue ,用于区分不同type情况,进行调用此加入 translate.nodeQueue
+ * uuid, node, attribute 这及个参数说明见 addNodeToQueue 的参数说明,相同
+ * textArray 进行处理的要翻译的文本数组。这个最开始只是一个,但是命中后分割的多了也就变成多个了
+ * nomenclatureKey 替换的原始文本,也就是自定义术语的key部分
+ * nomenclatureValue 替换的目标文本,也就是自定义术语的value部分 。 如果 nomenclatureKey = nomenclatureValue 则是自定义忽略翻译的文本。这个文本不被翻译
+ * @return 处理过后的 textArray 如果没有命中则返回的是传入的 textArray ,命中了则是切割以及删除原本判断的text之后的 textArray
+ */
+ addNodeToQueueTextAnalysis:function(uuid, node,textArray, attribute, nomenclatureKey, nomenclatureValue){
+ var deleteTextArray = new Array(); //记录要从 textArray 中删除的字符串
+
+ for(var tai = 0; tai -1){
+ //出现了,那么需要将其立即进行更改,将自定义术语定义的结果渲染到页面中,并且将 word 要翻译的字符串中,自定义术语部分删除,只翻译除了自定义术语剩余的部分
+ //console.log(text+' --> '+nomenclatureKey);
+
+
+ /*
+ * 判断一下这个text中,出现匹配自定义术语的部分,是否是已经被替换过了,比如要将 好 替换为 你好 ,这里的好会重复替换。这里是判断这种情况
+ * 其中要判断一下 key 不等于value,因为key等于value,属于是指定这个key不被翻译的情况
+ */
+ if(nomenclatureKey != nomenclatureValue){
+ var substringStart = wordKeyIndex-nomenclatureValue.length;
+ if(substringStart < 0){
+ substringStart = 0;
+ }
+ var substringEnd = wordKeyIndex+nomenclatureValue.length;
+ if(substringEnd > text.length){
+ substringEnd = text.length;
+ }
+ var nomenclatureValueJudgement = text.substring(substringStart, substringEnd);
+ //console.log(text+', '+nomenclatureValueJudgement);
+ if(nomenclatureValueJudgement.indexOf(nomenclatureValue) > -1){
+ //已经替换过了,可能会重复替换,所以忽略掉
+ continue;
+ }
+ }
+
+
+ //判断当前是否是英语及变种,也就是单词之间需要有空格的,如果前后没有空格,要补充上空格
+ if(translate.language.wordBlankConnector(translate.to)){
+ if(wordKeyIndex > 0){
+ //它前面还有文本,判断它前面的文本是否是空格,如果不是,那么要补充上空格
+ var before = text.charAt(wordKeyIndex-1);
+ //console.log(before);
+ if(!(/\s/.test(before))){
+ //不是空白字符,补充上一个空格,用于将两个单词隔开
+ nomenclatureValue = ' '+nomenclatureValue
+ }
+ }
+ if(wordKeyIndex + nomenclatureKey.length < text.length){
+ //它后面还有文本,判断它前面的文本是否是空格,如果不是,那么要补充上空格
+ var after = text.charAt(wordKeyIndex + nomenclatureKey.length);
+ //console.log(after);
+ if(!(/\s/.test(before))){
+ //不是空白字符,补充上一个空格,用于将两个单词隔开
+ nomenclatureValue = nomenclatureValue+' ';
+ }
+ }
+ }
+
+ //如果是自定义术语的key等于value,则是属于指定的某些文本不进行翻译的情况,所以这里要单独判断一下
+ //console.log(nomenclatureKey+':'+nomenclatureValue);
+ if(nomenclatureKey != nomenclatureValue){
+ translate.element.nodeAnalyse.set(node, nomenclatureKey, nomenclatureValue, attribute);
+ }
+
+
+ //从 text 中将自定义术语的部分删掉,自定义术语的不被翻译
+ var wordSplits = text.split(nomenclatureKey);
+ var isPushTextArray = false;
+ for(var index = 0; index < wordSplits.length; index++){
+ //console.log(index);
+ var subWord = wordSplits[index]; //分割后的子字符串
+ if(subWord.trim().length == 0){
+ continue;
+ }
+ //console.log(subWord);
+
+ //将其加入 textArray 中
+ textArray.push(subWord);
+ deleteTextArray.push(text);
+ }
+
+ //console.log(wordSplits);
+ //自定义术语适配完后就直接退出了
+ //return wordSplits;
+ }
+
+ }
+
+ //console.log(deleteTextArray)
+ //从 textArray 中删除
+ if(deleteTextArray.length > 0){
+ for(var di = 0; di -1) {
+ //console.log(textArray);
+ //console.log(deleteTextArray[di]);
+ textArray.splice(index, 1);
+ //console.log(textArray);
+ }
+ }
+ }
+
+ return textArray;
+ },
+
+ /*
+
+ 服务于上面的 addNodeToQueue ,用于区分不同type情况,进行调用此加入 translate.nodeQueue
+ uuid, node, attribute 这五个参数说明见 addNodeToQueue 的参数说明,相同
+
+ word 要实际进行翻译的文本,也就是要把它拿来进行通过后端翻译接口进行翻译的文本
+ lang 当前要翻译的文本的语种,如 english
+ beforeText 参见 translate.nodeQueue 注释中第七维的解释
+ afterText 参见 translate.nodeQueue 注释中第七维的解释
+
+ */
+ addNodeToQueueAnalysis:function(uuid, node, text, attribute){
+ //获取当前是什么语种
+ //var langs = translate.language.get(text);
+ var textRecognition = translate.language.recognition(text);
+ var langs = textRecognition.languageArray;
+ //console.log('langs');
+ //console.log(langs);
+
+
+ //过滤掉要转换为的目标语种,比如要转为英语,那就将本来是英语的部分过滤掉,不用再翻译了
+ if(typeof(langs[translate.to]) != 'undefined'){
+ delete langs[translate.to];
+ }
+
+ var isWhole = translate.whole.isWhole(node);
+ //console.log('isWhole:'+isWhole+', '+text);
+
+ if(!isWhole){
+ //常规方式,进行语种分类
+
+
+ /* if(this.nodeQueue[lang] == null || typeof(this.nodeQueue[lang]) == 'undefined'){
+ this.nodeQueue[lang] = new Array();
+ }
+ //创建二维数组
+ if(this.nodeQueue[lang][key] == null || typeof(this.nodeQueue[lang][key]) == 'undefined'){
+ this.nodeQueue[lang][key] = new Array();
+ }
+ */
+ //console.log(langs);
+
+ for(var lang in langs) {
+ //创建二维数组, key为语种,如 english
+ /*
+ 放到了 translate.addNodeQueueItem 进行判断
+ if(translate.nodeQueue[uuid]['list'][lang] == null || typeof(translate.nodeQueue[uuid]['list'][lang]) == 'undefined'){
+ translate.nodeQueue[uuid]['list'][lang] = new Array();
+ }
+ */
+ //console.log('|'+langs[lang].length);
+ //遍历出该语种下有哪些词需要翻译
+ for(var word_index = 0; word_index < langs[lang].list.length; word_index++){
+ //console.log('start:'+word_index)
+ //console.log(langs[lang].list[word_index]);
+ if(typeof(langs[lang].list[word_index]) == 'undefined' || typeof(langs[lang].list[word_index]['text']) == 'undefined'){
+ //理论上应该不会,但多加个判断
+ continue;
+ }
+ var word = langs[lang].list[word_index]['text']; //要翻译的词
+ var beforeText = langs[lang].list[word_index]['beforeText'];
+ var afterText = langs[lang].list[word_index]['afterText'];
+
+ //console.log(lang+' - '+word);
+ translate.addNodeQueueItem(uuid, node, word, attribute, lang, beforeText, afterText);
+
+ /*
+ var hash = translate.util.hash(word); //要翻译的词的hash
+ //创建三维数组, key为要通过接口翻译的文本词或句子的 hash (注意并不是node的文本,而是node拆分后的文本)
+ if(translate.nodeQueue[uuid]['list'][lang][hash] == null || typeof(translate.nodeQueue[uuid]['list'][lang][hash]) == 'undefined'){
+ translate.nodeQueue[uuid]['list'][lang][hash] = new Array();
+
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'] = new Array();
+ translate.nodeQueue[uuid]['list'][lang][hash]['original'] = word;
+ translate.nodeQueue[uuid]['list'][lang][hash]['translateText'] = translate.nomenclature.dispose(word); //自定义术语处理
+ //translate.nodeQueue[uuid]['list'][lang][hash]['beforeText'] = beforeText;
+ //translate.nodeQueue[uuid]['list'][lang][hash]['afterText'] = afterText;
+ //translate.nodeQueue[uuid]['list'][lang][hash]['attribute'] = attribute; //放入 nodes[index][attribute] 元素中
+
+ //其中key: nodes 是第四维数组,里面存放具体的node元素对象
+
+
+ //console.log(translate.nodeQueue[uuid]['list'][lang][hash]);
+ }
+
+ var isEquals = false; //queue中是否已经加入过这个node了(当然是同一hash同一node情况)
+ if(typeof(node.isSameNode) != 'undefined'){ //支持 isSameNode 方法判断对象是否相等
+ for(var node_index = 0; node_index < translate.nodeQueue[uuid]['list'][lang][hash]['nodes'].length; node_index++){
+ if(node.isSameNode(translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['node'])){
+ //相同,那就不用在存入了
+ //console.log('相同,那就不用在存入了')
+ isEquals = true;
+ //console.log(node)
+ continue;
+ }
+ }
+ }
+ if(isEquals){
+ //相同,那就不用在存入了
+ continue;
+ }
+
+ //往五维数组nodes中追加node元素
+ var nodesIndex = translate.nodeQueue[uuid]['list'][lang][hash]['nodes'].length;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex] = new Array();
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['node']=node;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['attribute']=attribute;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['beforeText'] = beforeText;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['afterText'] = afterText;
+
+ */
+
+ //console.log('end:'+word_index)
+ }
+
+ }
+
+
+
+
+ }else{
+ //直接翻译整个元素内的内容,不再做语种分类,首先删除英文,然后将出现次数最多的语种作为原本语种
+ var lang = textRecognition.languageName;
+ //console.log(lang+' - '+text);
+ translate.addNodeQueueItem(uuid, node, text, attribute, lang, '', '');
+ }
+
+
+ },
+
+ /*
+
+ 服务于上面的 addNodeToQueue ,用于区分不同type情况,进行调用此加入 translate.nodeQueue
+ uuid, node, attribute 这五个参数说明见 addNodeToQueue 的参数说明,相同
+
+ word 要实际进行翻译的文本,也就是要把它拿来进行通过后端翻译接口进行翻译的文本
+ lang 当前要翻译的文本的语种,如 english
+ beforeText 参见 translate.nodeQueue 注释中第七维的解释
+ afterText 参见 translate.nodeQueue 注释中第七维的解释
+
+ */
+ addNodeQueueItem:function(uuid, node, word, attribute, lang, beforeText, afterText){
+ //创建二维数组, key为语种,如 english
+ if(translate.nodeQueue[uuid]['list'][lang] == null || typeof(translate.nodeQueue[uuid]['list'][lang]) == 'undefined'){
+ translate.nodeQueue[uuid]['list'][lang] = new Array();
+ }
+ //console.log(word)
+ //var word = text; //要翻译的文本
+ var hash = translate.util.hash(word); //要翻译的文本的hash
+
+ //创建三维数组, key为要通过接口翻译的文本词或句子的 hash 。这里翻译的文本也就是整个node元素的内容了,不用在做拆分了
+ if(translate.nodeQueue[uuid]['list'][lang][hash] == null || typeof(translate.nodeQueue[uuid]['list'][lang][hash]) == 'undefined'){
+ translate.nodeQueue[uuid]['list'][lang][hash] = new Array();
+
+ /*
+ * 创建四维数组,存放具体数据
+ * key: nodes 包含了这个hash的node元素的数组集合,array 多个。其中
+ nodes[index]['node'] 存放当前的node元素
+ nodes[index]['attribute'] 存放当前hash,也就是翻译文本针对的是什么,是node本身(nodeValue),还是 node 的某个属性,比如title属性。如果这里不为空,那就是针对的属性操作的
+ * key: original 原始的要翻译的词或句子,html加载完成但还没翻译前的文本,用于支持当前页面多次语种翻译切换而无需跳转
+ * beforeText、afterText:见 translate.nodeQueue 的说明
+ */
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'] = new Array();
+ translate.nodeQueue[uuid]['list'][lang][hash]['original'] = word;
+ //自定义术语处理在此前面已经执行过了,所以这个废弃,不需要处理自定义术语部分了
+ //translate.nodeQueue[uuid]['list'][lang][hash]['translateText'] = translate.nomenclature.dispose(word);
+ translate.nodeQueue[uuid]['list'][lang][hash]['translateText'] = word;
+ //console.log(word)
+
+
+
+ //其中key: nodes 是第四维数组,里面存放具体的node元素对象
+ }
+
+
+ var isEquals = false; //queue中是否已经加入过这个node了(当然是同一hash同一node情况)
+ if(typeof(node.isSameNode) != 'undefined'){ //支持 isSameNode 方法判断对象是否相等
+ for(var node_index = 0; node_index < translate.nodeQueue[uuid]['list'][lang][hash]['nodes'].length; node_index++){
+ if(node.isSameNode(translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][node_index]['node'])){
+ //相同,那就不用在存入了
+ //console.log('相同,那就不用在存入了')
+ isEquals = true;
+ //console.log(node)
+ continue;
+ }
+ }
+ }
+ if(isEquals){
+ //相同,那就不用在存入了
+ return;
+ }
+
+ //往五维数组nodes中追加node元素
+ var nodesIndex = translate.nodeQueue[uuid]['list'][lang][hash]['nodes'].length;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex] = new Array();
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['node']=node;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['attribute']=attribute;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['beforeText'] = beforeText;
+ translate.nodeQueue[uuid]['list'][lang][hash]['nodes'][nodesIndex]['afterText'] = afterText;
+
+
+ },
+
+ //全部翻译,node内容全部翻译,而不是进行语种提取,直接对node本身的全部内容拿出来进行直接全部翻译
+ whole:{
+ isEnableAll:false, //是否开启对整个html页面的整体翻译,也就是整个页面上所有存在的能被翻译的全部会采用整体翻译的方式。默认是 false不开启
+
+ enableAll:function(){
+ translate.whole.isEnableAll = true;
+ },
+
+ /*
+ 一下三个,也就是 class tag id 分别存储加入的值。使用参考:http://translate.zvo.cn/42563.html
+ */
+ class:[],
+ tag:[],
+ id:[],
+
+ //运行时出现自检并在浏览器控制台提示性文本。
+ //在执行翻译,也就是 execute() 时,会调用此方法。
+ executeTip:function(){
+ if(translate.whole.class.length == 0 && translate.whole.tag.length == 0 && translate.whole.id.length == 0){
+
+ }else{
+ console.log('您开启了 translate.whole 此次行为避开了浏览器端的文本语种自动识别,而是暴力的直接对某个元素的整个文本进行翻译,很可能会产生非常大的翻译量,请谨慎!有关每日翻译字符的说明,可参考: http://translate.zvo.cn/42557.html ');
+ }
+
+ if(translate.whole.tag.indexOf('html') > -1){
+ console.log('自检发现您设置了 translate.whole.tag 其中有 html ,这个是不生效的,最大只允许设置到 body ');
+ }
+ },
+
+ //当前元素是属于全部翻译定义的元素
+ /*
+ 传入一个元素,判断这个元素是否是被包含的。 这个会找父类,看看父类中是否包含在其之中。
+ return true是在其中,false不再其中
+ */
+ isWhole:function(ele){
+
+ //如果设置了 class|tag|id 其中某个,或者 all=true ,那么就是启用,反之未启用
+ if((translate.whole.class.length == 0 && translate.whole.tag.length == 0 && translate.whole.id.length == 0) && translate.whole.isEnableAll == false){
+ //未设置,那么直接返回false
+ return false;
+ }
+ if(ele == null || typeof(ele) == 'undefined'){
+ return false;
+ }
+ if(translate.whole.isEnableAll){
+ return true;
+ }
+
+ var parentNode = ele;
+ var maxnumber = 100; //最大循环次数,避免死循环
+ while(maxnumber-- > 0){
+ if(parentNode == null || typeof(parentNode) == 'undefined'){
+ //没有父元素了
+ return false;
+ }
+
+ //判断Tag
+ //var tagName = parentNode.nodeName.toLowerCase(); //tag名字,小写
+ var nodename = translate.element.getNodeName(parentNode).toLowerCase(); //tag名字,小写
+ if(nodename.length > 0){
+ //有nodename
+ if(nodename == 'html' || nodename == '#document'){
+ //上层元素已经是顶级元素了,那肯定就不是了
+ return false;
+ }
+ if(translate.whole.tag.indexOf(nodename) > -1){
+ //发现ignore.tag 当前是处于被忽略的 tag
+ return true;
+ }
+ }
+
+
+ //判断class name
+ if(parentNode.className != null){
+ var classNames = parentNode.className;
+ if(classNames == null || typeof(classNames) != 'string'){
+ continue;
+ }
+ //console.log('className:'+typeof(classNames));
+ //console.log(classNames);
+ classNames = classNames.trim().split(' ');
+ for(var c_index = 0; c_index < classNames.length; c_index++){
+ if(classNames[c_index] != null && classNames[c_index].trim().length > 0){
+ //有效的class name,进行判断
+ if(translate.whole.class.indexOf(classNames[c_index]) > -1){
+ //发现ignore.class 当前是处于被忽略的 class
+ return true;
+ }
+ }
+ }
+ }
+
+ //判断id
+ if(parentNode.id != null && typeof(parentNode.id) != 'undefined'){
+ //有效的class name,进行判断
+ if(translate.whole.id.indexOf(parentNode.id) > -1){
+ //发现ignore.id 当前是处于被忽略的 id
+ return true;
+ }
+ }
+
+ //赋予判断的元素向上一级
+ parentNode = parentNode.parentNode;
+ }
+
+ return false;
+ }
+ },
+
+ language:{
+ /*
+ 英语的变种语种,也就是在英语26个字母的基础上加了点别的特殊字母另成的一种语言,而这些语言是没法直接通过识别字符来判断出是哪种语种的
+ v3.4.2 增加
+ 当前先只加上:
+ 法语、意大利语、德语
+ */
+ englishVarietys : ['french','italian','deutsch'],
+
+ //当前本地语种,本地语言,默认是简体中文。设置请使用 translate.language.setLocal(...)。不可直接使用,使用需用 getLocal()
+ local:'',
+
+ /*
+ * v3.12增加, 是否会翻译本地语种,默认是false,不会翻译。
+ * 比如当前设置的本地语种是简体中文, 但是网页中也有一段英文, 如果设置了translate.to 为中文,也就是要以中文显示 默认是false的情况下,整个页面是不会被任何翻译的,也就是有的那段英文也不会进行任何翻译,依旧是显示英文。
+ * 如果这里设置为 true, 则英文也会被翻译,只要不是中文的,都会被翻译为要显示的语种,也就是都会被翻译为中文。
+ */
+ translateLocal:false,
+
+ /*
+ 翻译语种范围
+ 比如传入 ['chinese_simplified','chinese_traditional','english'] 则表示仅对网页中的简体中文、繁体中文、英文 进行翻译,而网页中出现的其他的像是法语、韩语则不会进行翻译
+ 如果为空 [],则是翻译时,翻译网页中的所有语种
+ 设置方式为: translate.language.translateLanguagesRange = ['chinese_simplified','chinese_traditional']
+ */
+ translateLanguagesRange: [],
+ //传入语种。具体可传入哪些参考: http://api.translate.zvo.cn/doc/language.json.html
+ setLocal:function(languageName){
+ //translate.setUseVersion2(); //Set to use v2.x version
+ translate.useVersion = 'v2';
+ translate.language.local = languageName;
+ },
+ //获取当前本地语种,本地语言,默认是简体中文。设置请使用 translate.language.setLocal(...)
+ getLocal:function(){
+ //判断是否设置了本地语种,如果没设置,自动给其设置
+ if(translate.language.local == null || translate.language.local.length < 1){
+ translate.language.autoRecognitionLocalLanguage();
+ }
+ return translate.language.local;
+ },
+ /*
+ 获取当前语种。
+ 比如当前设置的本地语种是简体中文,用户并未切换其他语种,那么这个方法将返回本地当前的语种,也就是等同于 translate.language.getLocal()
+ 如果用户切换为英语进行浏览,那么这个方法将返回翻译的目标语种,也就是 english
+ */
+ getCurrent:function(){
+ var to_storage = translate.storage.get('to');
+ if(to_storage != null && typeof(to_storage) != 'undefined' && to_storage.length > 0){
+ //之前有过使用,并且主动设置过目标语种
+ return to_storage;
+ }
+ return translate.language.getLocal();
+ },
+ //如果第一次用,默认以什么语种显示。
+ //比如本地当前语种是简体中文,这里设置为english,那么用户第一次使用时,会自动翻译为english进行显示。如果用户手动切换为其他语种比如韩语,那么就遵循用户手动切换的为主,显示韩语。
+ setDefaultTo:function(languageName){
+ var to_storage = translate.storage.get('to');
+ if(to_storage != null && typeof(to_storage) != 'undefined' && to_storage.length > 0){
+ //之前有过使用,并且主动设置过目标语种,那么不进行处理
+ }else{
+ //没有设置过,进行处理
+ translate.storage.set('to', languageName);
+ translate.to = languageName;
+ }
+ },
+ /*
+ 清除历史翻译语种的缓存
+ */
+ clearCacheLanguage:function(){
+ translate.to = '';
+ translate.storage.set('to','');
+ },
+ //根据URL传参控制以何种语种显示
+ //设置可以根据当前访问url的某个get参数来控制使用哪种语言显示。
+ //比如当前语种是简体中文,网页url是http://translate.zvo.cn/index.html ,那么可以通过在url后面增加 language 参数指定翻译语种,来使网页内容以英文形态显示 http://translate.zvo.cn/index.html?language=english
+ setUrlParamControl:function(paramName){
+ if(typeof(paramName) == 'undefined' || paramName.length < 1){
+ paramName = 'language';
+ }
+ var paramValue = translate.util.getUrlParam(paramName);
+ if(typeof(paramValue) == 'undefined'){
+ return;
+ }
+ if(paramValue == '' || paramValue == 'null' || paramValue == 'undefined'){
+ return;
+ }
+
+ translate.storage.set('to', paramValue);
+ translate.to = paramValue;
+ },
+ //自动识别当前页面是什么语种
+ autoRecognitionLocalLanguage:function(){
+ if(translate.language.local != null && translate.language.local.length > 2){
+ //已设置过了,不需要再设置
+ return;
+ }
+
+ var bodyText = document.body.outerText;
+ if(bodyText == null || typeof(bodyText) == 'undefined' || bodyText.length < 1){
+ //未取到,默认赋予简体中文
+ translate.language.local = 'chinese_simplified';
+ return;
+ }
+
+ bodyText = bodyText.replace(/\n|\t|\r/g,''); //将回车换行等去掉
+
+ //默认赋予简体中文
+ translate.language.local = 'chinese_simplified';
+ var recognition = translate.language.recognition(bodyText);
+ translate.language.local = recognition.languageName;
+ return translate.language.local;
+ /* v3.1优化
+ var langs = new Array(); //上一个字符的语种是什么,当前字符向上数第一个字符。格式如 ['language']='english', ['chatstr']='a', ['storage_language']='english' 这里面有3个参数,分别代表这个字符属于那个语种,其字符是什么、存入了哪种语种的队列。因为像是逗号,句号,一般是存入本身语种中,而不是存入特殊符号中。
+ for(var i=0; i -1){
+ newLangs.splice(index,1); //移除数组中的特殊字符
+ }
+
+ if(newLangs.length > 0){
+ //找到排序出现频率最多的
+ translate.language.local = newLangs[0];
+ }else{
+ //没有,默认赋予简体中文
+ translate.language.local = 'chinese_simplified';
+ }
+ */
+ },
+
+ /*
+ * 获取当前字符是什么语种。返回值是一个语言标识,有 chinese_simplified简体中文、japanese日语、korean韩语、
+ * str : node.nodeValue 或 图片的 node.alt 等
+ * 如果语句长,会全句翻译,以保证翻译的准确性,提高可读性。
+ * 如果语句短,会自动将特殊字符、要翻译的目标语种给过滤掉,只取出具体的要翻译的目标语种文本
+ *
+ * 返回 存放不同语言的数组,格式如
+ * [
+ "english":[
+ {beforeText: '', afterText: '', text: 'emoambue hag'},
+ ......
+ ],
+ "japanese":[
+ {beforeText: ' ', afterText: ' ', text: 'ẽ '},
+ ......
+ ]
+ ]
+ *
+ */
+ get:function(str){
+ //将str拆分为单个char进行判断
+
+ var langs = new Array(); //当前字符串包含哪些语言的数组,其内如 english
+ var langStrs = new Array(); //存放不同语言的文本,格式如 ['english'][0] = 'hello'
+ var upLangs = []; //上一个字符的语种是什么,当前字符向上数第一个字符。格式如 ['language']='english', ['chatstr']='a', ['storage_language']='english' 这里面有3个参数,分别代表这个字符属于那个语种,其字符是什么、存入了哪种语种的队列。因为像是逗号,句号,一般是存入本身语种中,而不是存入特殊符号中。
+ var upLangsTwo = []; //上二个字符的语种是什么 ,当前字符向上数第二个字符。 格式如 ['language']='english', ['chatstr']='a', ['storage_language']='english' 这里面有3个参数,分别代表这个字符属于那个语种,其字符是什么、存入了哪种语种的队列。因为像是逗号,句号,一般是存入本身语种中,而不是存入特殊符号中。
+
+ //var upLangs = ''; //上一个字符的语种是什么,格式如 english
+ for(var i=0; i -1){
+ newLangs.splice(index,1); //移除
+ }
+
+ //移除特殊字符
+ var index = newLangs.indexOf('specialCharacter');
+ if(index > -1){
+ newLangs.splice(index,1); //移除数组中的特殊字符
+ }
+
+ if(newLangs.length > 0){
+ //还剩一个或多个,(如果是多个,那应该是这几个出现的频率一样,所以取频率最高的时返回了多个)
+ return newLangs[0];
+ }else{
+ //没找到,直接返回空字符串
+ return '';
+ }
+ */
+
+
+ //去除特殊符号
+ //for(var i = 0; i 0.05){
+ langkeys[langkeys.length] = lang+'';
+ }
+ }
+
+
+ if(langkeys.length > 1 && langkeys.indexOf('english') > -1){
+ //console.log('出现了english, 并且english跟其他语种一起出现,那么删除english,因为什么法语德语乱七八糟的都有英语。而且中文跟英文一起,如果认为是英文的话,有时候中文会不被翻译');
+ //langkeys.splice(langkeys.indexOf('english'), 1);
+ langsNumber['english'] = 0;
+ }
+
+ if(langkeys.indexOf('chinese_simplified') > -1 && langkeys.indexOf('chinese_traditional') > -1){
+ //如果简体中文跟繁体中文一起出现,那么会判断当前句子为繁体中文。
+ //langkeys.splice(langkeys.indexOf('chinese_simplified'), 1);
+ langsNumber['chinese_simplified'] = 0;
+ }
+
+
+ //从 langsNumber 中找出字数最多的来
+ var maxLang = ''; //字数最多的语种
+ var maxNumber = 0;
+ for(var lang in langsNumber){
+ if(langsNumber[lang] > maxNumber){
+ maxLang = lang;
+ maxNumber = langsNumber[lang];
+ }
+ }
+
+ //重新组合返回值的 languageArray
+ var languageArray = {};
+ for(var lang in langs){
+ languageArray[lang] = {};
+ languageArray[lang].number = langsNumberOriginal[lang];
+ languageArray[lang].list = langs[lang];
+ }
+
+ var result = {
+ languageName: maxLang,
+ languageArray: languageArray
+ };
+
+ //v3.4.2 增加,增加对法语等英文变种的小语种的识别
+ if(result.languageName == 'english'){
+ //如果识别的语种是英语,那便不仅仅是英语,因为法语、德语、意大利语也是在英语里面,还要判断一下是否用户自己设置了具体语种是否是英语延伸的小语种
+
+ var localLang = translate.language.getLocal(); //本地语种
+ if(translate.language.englishVarietys.indexOf(localLang) > -1){
+ //发现当前设置的是小语种,那么将当前识别的语种识别为 本地设置的这个小语种。
+ result.languageName = localLang;
+ }
+ }
+
+ return result;
+ },
+ // 传入一个char,返回这个char属于什么语种,返回如 chinese_simplified、english 如果返回空字符串,那么表示未获取到是什么语种
+ getCharLanguage:function(charstr){
+ if(charstr == null || typeof(charstr) == 'undefined'){
+ return '';
+ }
+
+ if(this.russian(charstr)){
+ return 'russian';
+ }
+ if(this.english(charstr)){
+ return 'english';
+ }
+ if(this.specialCharacter(charstr)){
+ return 'specialCharacter';
+ }
+ if(this.number(charstr)){
+ return 'number';
+ }
+
+ //中文的判断包含两种,简体跟繁体
+ var chinesetype = this.chinese(charstr);
+ if(chinesetype == 'simplified'){
+ return 'chinese_simplified';
+ }else if(chinesetype == 'traditional'){
+ return 'chinese_traditional';
+ }
+
+ if(this.japanese(charstr)){
+ return 'japanese';
+ }
+ if(this.korean(charstr)){
+ return 'korean';
+ }
+
+ //未识别是什么语种
+ //console.log('not find is language , char : '+charstr+', unicode: '+charstr.charCodeAt(0).toString(16));
+ return '';
+
+ },
+ /*
+ * 对字符串进行分析,分析字符串是有哪几种语言组成。
+ * language : 当前字符的语种,传入如 english
+ * langStrs : 操作的,如 langStrs['english'][0] = '你好'
+ * upLangs : 当前字符之前的上一个字符的语种是什么,当前字符向上数第一个字符。格式如 ['language']='english', ['chatstr']='a', ['storage_language']='english' 这里面有3个参数,分别代表这个字符属于那个语种,其字符是什么、存入了哪种语种的队列。因为像是逗号,句号,一般是存入本身语种中,而不是存入特殊符号中。
+ * upLangsTwo : 当前字符之前的上二个字符的语种是什么 ,当前字符向上数第二个字符。 格式如 ['language']='english', ['chatstr']='a', ['storage_language']='english' 这里面有3个参数,分别代表这个字符属于那个语种,其字符是什么、存入了哪种语种的队列。因为像是逗号,句号,一般是存入本身语种中,而不是存入特殊符号中。
+ * chatstr : 当前字符,如 h
+ */
+ analyse:function(language, langStrs, upLangs, upLangsTwo, charstr){
+ if(typeof(langStrs[language]) == 'undefined'){
+ langStrs[language] = new Array();
+ }
+ var index = 0; //当前要存入的数组下标
+ if(typeof(upLangs['storage_language']) == 'undefined'){
+ //第一次,那么还没存入值,index肯定为0
+ //console.log('第一次,那么还没存入值,index肯定为0')
+ //console.log(upLangs['language'])
+ }else{
+ //console.log('analyse, charstr : '+charstr+', upLangs :');
+ //console.log(upLangs);
+ //var isEqual = upLangs['storage_language'] == language; //上次跟当前字符是否都是同一个语种(这个字符跟这个字符前一个字符)
+
+ /*
+ 英语每个单词之间都会有空格分割. 如果是英文的话,英文跟特殊字符还要单独判断一下,避免拆开,造成翻译不准,单个单词翻译的情况
+ 所以如果上次的字符是英文或特殊符号,当前字符是特殊符号(逗号、句号、空格,然后直接笼统就吧特殊符号都算上吧),那么也将当次的特殊符号变为英文来进行适配
+ 示例
+ hello word 的 "o w"
+ hello word 的 " w"
+ hello word 的 "w "
+ this is a dog 的 " a "
+ */
+ //console.log(language == 'specialCharacter');
+ //如果两个字符类型不一致,但当前字符是英文或连接符时,进行判断
+ /*
+ if(!isEqual){
+ if(language == 'english' || translate.language.connector(charstr)){
+ console.log('1.'+(language == 'english' || translate.language.connector(charstr))+', upLangs str:'+upLangs['charstr']);
+ //上一个字符是英文或连接符
+ //console.log('teshu:'+translate.language.connector(upLangs['charstr'])+', str:'+upLangs['charstr']);
+ if(upLangs['language'] == 'english' || translate.language.connector(upLangs['charstr'])) {
+ console.log('2');
+ //如果上二个字符不存在,那么刚开始,不再上面几种情况之中,直接不用考虑
+ if(typeof(upLangsTwo['language']) != 'undefined'){
+ console.log('3')
+ //上二个字符是空(字符串刚开始),或者是英文
+ if(upLangsTwo['language'] == 'english' || translate.language.connector(upLangsTwo['charstr'])){
+ //满足这三个条件,那就将这三个拼接到一起
+ console.log('4/5: '+', two lang:'+upLangsTwo['language']+', str:'+upLangsTwo['charstr'])
+ isEqual = true;
+ if(language == 'specialCharacter' && upLangs['language'] == 'specialCharacter' && upLangsTwo['language'] == 'specialCharacter'){
+ //如果三个都是特殊字符,或后两个是特殊字符,第一个是空(刚开始),那就归入特殊字符
+ language = 'specialCharacter';
+ //console.log('4')
+ }else{
+ //不然就都归于英文中。
+ //这里更改是为了让下面能将特殊字符(像是空格逗号等)也一起存入数组
+ language = 'english';
+ console.log(5)
+ }
+ }
+ }
+ }
+ }
+ }
+ */
+
+ /*
+ 不判断当前字符,而判断上个字符,是因为当前字符没法获取未知的下个字符。
+ */
+ //if(!isEqual){
+
+ //如果当前字符是连接符
+ if(translate.language.connector(charstr)){
+ language = upLangs['storage_language'];
+ /*
+ //判断上个字符是否存入了待翻译字符,如要将中文翻译为英文,而上个字符是中文,待翻译,那将连接符一并加入待翻译字符中去,保持句子完整性
+ //判断依据是上个字符存储至的翻译字符语种序列,不是特殊字符,而且也不是要翻译的目标语种,那肯定就是待翻译的,将连接符加入待翻译中一起进行翻译
+ if(upLangs['storage_language'] != 'specialCharacter' && upLangs['storage_language'] != translate.to){
+
+ language = upLangs['storage_language'];
+ console.log('teshu:'+charstr+', 当前字符并入上个字符存储翻译语种:'+upLangs['storage_language']);
+ }
+ */
+ }
+ //}
+
+ //console.log('isEqual:'+isEqual);
+ /*
+ if(isEqual){
+ //跟上次语言一样,那么直接拼接
+ index = langStrs[language].length-1;
+ //但是还有别的特殊情况,v2.1针对英文翻译准确度的适配,会有特殊字符的问题
+ if(typeof(upLangs['storage_language']) != 'undefined' && upLangs['storage_language'] != language){
+ //如果上个字符存入的翻译队列跟当前这个要存入的队列不一个的话,那应该是特殊字符像是逗号句号等导致的,那样还要额外一个数组,不能在存入之前的数组了
+ index = langStrs[language].length;
+ }
+ }else{
+ //console.log('新开');
+ //当前字符跟上次语言不样,那么新开一个数组
+ index = langStrs[language].length;
+ //console.log('++, inde:'+index+',lang:'+language+', length:'+langStrs[language].length)
+ }
+ */
+
+ //当前要翻译的语种跟上个字符要翻译的语种一样,那么直接拼接
+ if(upLangs['storage_language'] == language){
+ index = langStrs[language].length-1;
+ }else{
+ //console.log('新开');
+ //当前字符跟上次语言不样,那么新开一个数组
+ index = langStrs[language].length;
+ }
+ }
+ if(typeof(langStrs[language][index]) == 'undefined'){
+ langStrs[language][index] = new Array();
+ langStrs[language][index]['beforeText'] = '';
+ langStrs[language][index]['afterText'] = '';
+ langStrs[language][index]['text'] = '';
+ }
+ langStrs[language][index]['text'] = langStrs[language][index]['text'] + charstr;
+ /*
+ 中文英文混合时,当中文+英文并没有空格间隔,翻译为英文时,会使中文翻译英文的结果跟原本的英文单词连到一块。这里就是解决这种情况
+ 针对当前非英文(不需要空格分隔符,像是中文、韩语),但要翻译为英文(需要空格作为分割符号,像是法语等)时的情况进行判断
+ */
+ //if(translate.language.getLocal() != 'english' && translate.to == 'english'){
+ //当前本地语种的语言是连续的,但翻译的目标语言不是连续的(空格间隔)
+ if( translate.language.wordBlankConnector(translate.language.getLocal()) == false && translate.language.wordBlankConnector(translate.to)){
+ if((upLangs['storage_language'] != null && typeof(upLangs['storage_language']) != 'undefined' && upLangs['storage_language'].length > 0)){
+ //上个字符存在
+ //console.log(upLangs['storage_language']);
+ if(upLangs['storage_language'] != 'specialCharacter'){
+ //上个字符不是特殊字符 (是正常语种。且不会是连接符,连接符都并入了正常语种)
+
+ //if( upLangs['storage_language'] != 'english' && language == 'english'){
+ //上个字符的语言是连续的,但当前字符的语言不是连续的(空格间隔)
+ if( translate.language.wordBlankConnector(upLangs['storage_language']) == false && translate.language.wordBlankConnector(language) ){
+ //上个字符不是英语,当前字符是英语,这种情况要在上个字符后面追加空格,因为当前字符是英文,就不会在执行翻译操作了
+ //console.log(upLangs['language']);
+ langStrs[upLangs['storage_language']][langStrs[upLangs['storage_language']].length-1]['afterText'] = ' ';
+ }else if(upLangs['storage_language'] == 'english' && language != 'english'){
+ //上个字符是英语,当前字符不是英语,直接在当前字符前面追加空格
+ langStrs[language][index]['beforeText'] = ' ';
+ }
+ }
+
+
+ }
+ }
+
+ var result = new Array();
+ result['langStrs'] = langStrs;
+ result['storage_language'] = language; //实际存入了哪种语种队列
+ //console.log(result);
+ //console.log(langStrs)
+ //console.log(charstr);
+ return result;
+ },
+
+ /*
+ * 不同于语言,这个只是单纯的连接符。比如英文单词之间有逗号、句号、空格, 汉字之间有逗号句号书名号的。避免一行完整的句子被分割,导致翻译不准确
+ * 单独拿他出来,目的是为了更好的判断计算,提高翻译的准确率
+ */
+ connector:function(str){
+
+ /*
+ 通用的有 空格、阿拉伯数字
+ 1.不间断空格\u00A0,主要用在office中,让一个单词在结尾处不会换行显示,快捷键ctrl+shift+space ;
+ 2.半角空格(英文符号)\u0020,代码中常用的;
+ 3.全角空格(中文符号)\u3000,中文文章中使用;
+ */
+ if(/.*[\u0020\u00A0\u202F\u205F\u3000]+.*$/.test(str)){
+ return true;
+ }
+ /*
+ U+0030 0 数字 0
+ U+0031 1 数字 1
+ U+0032 2 数字 2
+ U+0033 3 数字 3
+ U+0034 4 数字 4
+ U+0035 5 数字 5
+ U+0036 6 数字 6
+ U+0037 7 数字 7
+ U+0038 8 数字 8
+ U+0039 9 数字 9
+ */
+ if(/.*[\u0030-\u0039]+.*$/.test(str)){
+ return true
+ }
+
+
+ /*
+ 英文场景
+ 英文逗号、句号
+ 这里不包括() 因为这里面的基本属于补充,对语句前后并无强依赖关系
+
+ U+0021 ! 叹号
+ U+0022 " 双引号
+ U+0023 # 井号
+ U+0024 $ 价钱/货币符号
+ U+0025 % 百分比符号
+ U+0026 & 英文“and”的简写符号
+ U+0027 ' 引号
+ U+002C , 逗号
+ U+002D - 连字号/减号
+ U+002E . 句号
+ U+003A : 冒号
+ U+003B ; 分号
+ U+003F ? 问号
+ U+0040 @ 英文“at”的简写符号
+
+
+ */
+ if(/.*[\u0021\u0022\u0023\u0024\u0025\u0026\u0027\u002C\u002D\u002E\u003A\u003B\u003F\u0040]+.*$/.test(str)){
+ return true;
+ }
+
+ /*
+ 中文标点符号
+ 名称 Unicode 符号
+ 句号 3002 。
+ 问号 FF1F ?
+ 叹号 FF01 !
+ 逗号 FF0C ,
+ 顿号 3001 、
+ 分号 FF1B ;
+ 冒号 FF1A :
+ 引号 300C 「
+ 300D 」
+ 引号 300E 『
+ 300F 』
+ 引号 2018 ‘
+ 2019 ’
+ 引号 201C “
+ 201D ”
+ 括号 FF08 (
+ FF09 )
+ 括号 3014 〔
+ 3015 〕
+ 括号 3010 【
+ 3011 】
+ 破折号 2014 —
+ 省略号 2026 …
+ 连接号 2013 –
+ 间隔号 FF0E .
+ 书名号 300A 《
+ 300B 》
+ 书名号 3008 〈
+ 3009 〉
+ 键盘123前面的那个符号 · 00b7
+ */
+ if(/.*[\u3002\uFF1F\uFF01\uFF0C\u3001\uFF1B\uFF1A\u300C\u300D\u300E\u300F\u2018\u2019\u201C\u201D\uFF08\uFF09\u3014\u3015\u3010\u3011\u2014\u2026\u2013\uFF0E\u300A\u300B\u3008\u3009\u00b7]+.*$/.test(str)){
+ return true;
+ }
+
+
+
+
+ //不是,返回false
+ return false;
+ },
+ //语种的单词连接符是否需要空格,比如中文简体、繁体、韩文、日语都不需要空格,则返回false, 但是像是英文的单词间需要空格进行隔开,则返回true
+ //如果未匹配到,默认返回true
+ //language:语种,传入如 english
+ wordBlankConnector:function(language){
+ if(language == null || typeof(language) == 'undefined'){
+ return true;
+ }
+ switch (language.trim().toLowerCase()){
+ case 'chinese_simplified':
+ return false;
+ case 'chinese_traditional':
+ return false;
+ case 'korean':
+ return false;
+ case 'japanese':
+ return false;
+ }
+ //其他情况则返回true
+ return true;
+ },
+ //繁体中文的字典,判断繁体中文就是通过此判断
+ chinese_traditional_dict: '皚藹礙愛翺襖奧壩罷擺敗頒辦絆幫綁鎊謗剝飽寶報鮑輩貝鋇狽備憊繃筆畢斃閉邊編貶變辯辮鼈癟瀕濱賓擯餅撥缽鉑駁蔔補參蠶殘慚慘燦蒼艙倉滄廁側冊測層詫攙摻蟬饞讒纏鏟産闡顫場嘗長償腸廠暢鈔車徹塵陳襯撐稱懲誠騁癡遲馳恥齒熾沖蟲寵疇躊籌綢醜櫥廚鋤雛礎儲觸處傳瘡闖創錘純綽辭詞賜聰蔥囪從叢湊竄錯達帶貸擔單鄲撣膽憚誕彈當擋黨蕩檔搗島禱導盜燈鄧敵滌遞締點墊電澱釣調諜疊釘頂錠訂東動棟凍鬥犢獨讀賭鍍鍛斷緞兌隊對噸頓鈍奪鵝額訛惡餓兒爾餌貳發罰閥琺礬釩煩範販飯訪紡飛廢費紛墳奮憤糞豐楓鋒風瘋馮縫諷鳳膚輻撫輔賦複負訃婦縛該鈣蓋幹趕稈贛岡剛鋼綱崗臯鎬擱鴿閣鉻個給龔宮鞏貢鈎溝構購夠蠱顧剮關觀館慣貫廣規矽歸龜閨軌詭櫃貴劊輥滾鍋國過駭韓漢閡鶴賀橫轟鴻紅後壺護滬戶嘩華畫劃話懷壞歡環還緩換喚瘓煥渙黃謊揮輝毀賄穢會燴彙諱誨繪葷渾夥獲貨禍擊機積饑譏雞績緝極輯級擠幾薊劑濟計記際繼紀夾莢頰賈鉀價駕殲監堅箋間艱緘繭檢堿鹼揀撿簡儉減薦檻鑒踐賤見鍵艦劍餞漸濺澗漿蔣槳獎講醬膠澆驕嬌攪鉸矯僥腳餃繳絞轎較稭階節莖驚經頸靜鏡徑痙競淨糾廄舊駒舉據鋸懼劇鵑絹傑潔結誡屆緊錦僅謹進晉燼盡勁荊覺決訣絕鈞軍駿開凱顆殼課墾懇摳庫褲誇塊儈寬礦曠況虧巋窺饋潰擴闊蠟臘萊來賴藍欄攔籃闌蘭瀾讕攬覽懶纜爛濫撈勞澇樂鐳壘類淚籬離裏鯉禮麗厲勵礫曆瀝隸倆聯蓮連鐮憐漣簾斂臉鏈戀煉練糧涼兩輛諒療遼鐐獵臨鄰鱗凜賃齡鈴淩靈嶺領餾劉龍聾嚨籠壟攏隴樓婁摟簍蘆盧顱廬爐擄鹵虜魯賂祿錄陸驢呂鋁侶屢縷慮濾綠巒攣孿灤亂掄輪倫侖淪綸論蘿羅邏鑼籮騾駱絡媽瑪碼螞馬罵嗎買麥賣邁脈瞞饅蠻滿謾貓錨鉚貿麽黴沒鎂門悶們錳夢謎彌覓綿緬廟滅憫閩鳴銘謬謀畝鈉納難撓腦惱鬧餒膩攆撚釀鳥聶齧鑷鎳檸獰甯擰濘鈕紐膿濃農瘧諾歐鷗毆嘔漚盤龐國愛賠噴鵬騙飄頻貧蘋憑評潑頗撲鋪樸譜臍齊騎豈啓氣棄訖牽扡釺鉛遷簽謙錢鉗潛淺譴塹槍嗆牆薔強搶鍬橋喬僑翹竅竊欽親輕氫傾頃請慶瓊窮趨區軀驅齲顴權勸卻鵲讓饒擾繞熱韌認紉榮絨軟銳閏潤灑薩鰓賽傘喪騷掃澀殺紗篩曬閃陝贍繕傷賞燒紹賒攝懾設紳審嬸腎滲聲繩勝聖師獅濕詩屍時蝕實識駛勢釋飾視試壽獸樞輸書贖屬術樹豎數帥雙誰稅順說碩爍絲飼聳慫頌訟誦擻蘇訴肅雖綏歲孫損筍縮瑣鎖獺撻擡攤貪癱灘壇譚談歎湯燙濤縧騰謄銻題體屜條貼鐵廳聽烴銅統頭圖塗團頹蛻脫鴕馱駝橢窪襪彎灣頑萬網韋違圍爲濰維葦偉僞緯謂衛溫聞紋穩問甕撾蝸渦窩嗚鎢烏誣無蕪吳塢霧務誤錫犧襲習銑戲細蝦轄峽俠狹廈鍁鮮纖鹹賢銜閑顯險現獻縣餡羨憲線廂鑲鄉詳響項蕭銷曉嘯蠍協挾攜脅諧寫瀉謝鋅釁興洶鏽繡虛噓須許緒續軒懸選癬絢學勳詢尋馴訓訊遜壓鴉鴨啞亞訝閹煙鹽嚴顔閻豔厭硯彥諺驗鴦楊揚瘍陽癢養樣瑤搖堯遙窯謠藥爺頁業葉醫銥頤遺儀彜蟻藝億憶義詣議誼譯異繹蔭陰銀飲櫻嬰鷹應纓瑩螢營熒蠅穎喲擁傭癰踴詠湧優憂郵鈾猶遊誘輿魚漁娛與嶼語籲禦獄譽預馭鴛淵轅園員圓緣遠願約躍鑰嶽粵悅閱雲鄖勻隕運蘊醞暈韻雜災載攢暫贊贓髒鑿棗竈責擇則澤賊贈紮劄軋鍘閘詐齋債氈盞斬輾嶄棧戰綻張漲帳賬脹趙蟄轍鍺這貞針偵診鎮陣掙睜猙幀鄭證織職執紙摯擲幟質鍾終種腫衆謅軸皺晝驟豬諸誅燭矚囑貯鑄築駐專磚轉賺樁莊裝妝壯狀錐贅墜綴諄濁茲資漬蹤綜總縱鄒詛組鑽緻鐘麼為隻兇準啟闆裡靂餘鍊',
+ /*
+ 中文判断
+ 返回:
+ simplified:简体中文
+ traditional:繁体中文
+ 空字符串:不是中文
+ */
+ chinese:function(str){
+ if(/.*[\u4e00-\u9fa5]+.*$/.test(str)){
+ if(this.chinese_traditional_dict.indexOf(str) > -1){
+ return 'traditional';
+ } else {
+ return 'simplified';
+ }
+ } else {
+ return '';
+ }
+ },
+ //是否包含英文,true:包含
+ english:function(str){
+ if(/.*[\u0041-\u005a]+.*$/.test(str)){
+ return true;
+ } else if(/.*[\u0061-\u007a]+.*$/.test(str)){
+ return true;
+ } else {
+ return false;
+ }
+ },
+ //是否包含日语,true:包含
+ japanese:function(str){
+ if(/.*[\u3040-\u309F\u30A0-\u30FF]+.*$/.test(str)){
+ return true
+ } else {
+ return false;
+ }
+ },
+ //是否包含韩语,true:包含
+ korean:function(str){
+ if(/.*[\uAC00-\uD7AF]+.*$/.test(str)){
+ return true
+ } else {
+ return false;
+ }
+ },
+ //是否包含俄语
+ russian:function(str){
+ //判断字符有 БВДЖЗИЙЛМНОПСТУФХЦЧШЩЪЫЬЮЯЇІ
+ if(/.*[\u0411\u0412\u0414\u0416\u0417\u0418\u0419\u041B\u041C\u041D\u041E\u041F\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042E\u042F\u0407\u0406]+.*$/.test(str)){
+ return true
+ } else {
+ return false;
+ }
+ },
+ //0-9 阿拉伯数字
+ number:function(str){
+ if(/.*[\u0030-\u0039]+.*$/.test(str)){
+ return true;
+ }
+ return false;
+ },
+
+ //是否包含特殊字符,包含,则是true
+ specialCharacter:function(str){
+ //如:① ⑴ ⒈
+ if(/.*[\u2460-\u24E9]+.*$/.test(str)){
+ return true
+ }
+
+ //如:┊┌┍ ▃ ▄ ▅
+ if(/.*[\u2500-\u25FF]+.*$/.test(str)){
+ return true
+ }
+
+ //如:㈠ ㎎ ㎏ ㎡
+ if(/.*[\u3200-\u33FF]+.*$/.test(str)){
+ return true
+ }
+
+ //如:与ANSI对应的全角字符
+ if(/.*[\uFF00-\uFF5E]+.*$/.test(str)){
+ return true
+ }
+
+ //其它特殊符号
+ if(/.*[\u2000-\u22FF]+.*$/.test(str)){
+ return true
+ }
+
+ // 、><等符号
+ if(/.*[\u3001-\u3036]+.*$/.test(str)){
+ return true;
+ }
+
+ /*
+ //阿拉伯数字 0-9
+ if(/.*[\u0030-\u0039]+.*$/.test(str)){
+ return true;
+ }
+ */
+
+ /*
+ U+0020 空格
+ U+0021 ! 叹号
+ U+0022 " 双引号
+ U+0023 # 井号
+ U+0024 $ 价钱/货币符号
+ U+0025 % 百分比符号
+ U+0026 & 英文“and”的简写符号
+ U+0027 ' 引号
+ U+0028 ( 开 左圆括号
+ U+0029 ) 关 右圆括号
+ U+002A * 星号
+ U+002B + 加号
+ U+002C , 逗号
+ U+002D - 连字号/减号
+ U+002E . 句号
+ U+002F / 左斜杠
+ */
+ if(/.*[\u0020-\u002F]+.*$/.test(str)){
+ return true;
+ }
+
+ /*
+ U+003A : 冒号
+ U+003B ; 分号
+ U+003C < 小于符号
+ U+003D = 等于号
+ U+003E > 大于符号
+ U+003F ? 问号
+ U+005B [ 开 方括号
+ U+005C \ 右斜杠
+ U+005D ] 关 方括号
+ U+005E ^ 抑扬(重音)符号
+ U+005F _ 底线
+ U+0060 ` 重音符
+ U+007B { 开 左花括号
+ U+007C | 直线
+ U+007D } 关 右花括号
+ U+007E ~ 波浪纹
+ */
+ if(/.*[\u003B\u003B\u003C\u003D\u003E\u003F\u005B\u005C\u005D\u005E\u005F\u0060\u007B\u007C\u007D\u007E]+.*$/.test(str)){
+ return true;
+ }
+
+ //空白字符,\u0009\u000a + https://cloud.tencent.com/developer/article/2128593
+ if(/.*[\u0009\u000a\u0020\u00A0\u1680\u180E\u202F\u205F\u3000\uFEFF]+.*$/.test(str)){
+ return true;
+ }
+ if(/.*[\u2000-\u200B]+.*$/.test(str)){
+ return true;
+ }
+
+ /*
+ 拉丁字母
+ 代码 显示 描述
+ U+00A1 ¡ 倒转的叹号
+ U+00A2 ¢ (货币单位)分钱、毫子
+ U+00A3 £ (货币)英镑
+ U+00A4 ¤ (货币)当货币未有符号时以此替代
+ U+00A5 ¥ (货币)日元
+ U+00A6 ¦ 两条断开的直线
+ U+00A7 § 文件分不同部分
+ U+00A8 ¨ (语言)分音
+ U+00A9 © 版权符
+ U+00AA ª (意大利文、葡萄牙文、西班牙文)阴性序数
+ U+00AB « 双重角形引号
+ U+00AC ¬ 逻辑非
+ U+00AE ® 商标
+ U+00AF ¯ 长音
+ U+00B0 ° 角度
+ U+00B1 ± 正负号
+ U+00B2 ² 二次方
+ U+00B3 ³ 三次方
+ U+00B4 ´ 锐音符
+ U+00B5 µ 百万分之一,10?6
+ U+00B6 ¶ 文章分段
+ U+00B7 · 间隔号
+ U+00B8 ¸ 软音符
+ U+00B9 ¹ 一次方
+ U+00BA º (意大利文、葡萄牙文、西班牙文)阳性序数
+ U+00BB » 指向右的双箭头
+ U+00BC ¼ 四分之一
+ U+00BD ½ 二分之一
+ U+00BE ¾ 四分之三
+ U+00BF ¿ 倒转的问号
+ U+00C1 Á 在拉丁字母 A 上加锐音符
+ U+00C2 Â 在拉丁字母 A 上加抑扬符“^”
+ U+00C3 Ã 在拉丁字母 A 上加“~”
+ U+00C4 Ä 在拉丁字母 A 上加分音符“..”
+ U+00C5 Å 在拉丁字母 A 上加角度符“°”
+ U+00C6 Æ 拉丁字母 A、E 的混合
+ U+00C7 Ç 在拉丁字母 C 下加软音符
+ U+00C8 È 在拉丁字母 E 上加重音符
+ U+00C9 É 在拉丁字母 E 上加锐音符
+ U+00CA Ê 在拉丁字母 E 上加抑扬符
+ U+00CB Ë 在拉丁字母 E 上加分音符
+ U+00CC Ì 在拉丁字母 I 上加重音符
+ U+00CD Í 在拉丁字母 I 上加锐音符
+ U+00CE Î 在拉丁字母 I 上加抑扬符
+ U+00CF Ï 在拉丁字母 I 上加分音符
+ U+00D0 Ð 古拉丁字母,现只有法罗文和冰岛文和越南语使用
+ U+00D1 Ñ 在拉丁字母 N 上加波浪纹“~”
+ U+00D2 Ò 在拉丁字母 O 上加重音符
+ U+00D3 Ó 在拉丁字母 O 上加锐音符
+ U+00D4 Ô 在拉丁字母 O 上加抑扬符
+ U+00D5 Õ 在拉丁字母 O 上加波浪纹“~”
+ U+00D6 Ö 在拉丁字母 O 上加分音符
+ U+00D7 × 乘号,亦可拖按“Alt”键,同时按“41425”五键
+ U+00D8 Ø 在拉丁字母 O 由右上至左下加对角斜线“/”
+ U+00D9 Ù 在拉丁字母 U 上加重音符
+ U+00DA Ú 在拉丁字母 U 上加锐音符
+ U+00DB Û 在拉丁字母 U 上加抑扬符
+ U+00DC Ü 在拉丁字母 U 上加分音符
+ U+00DD Ý 在拉丁字母 Y 上加锐音符
+ U+00DE Þ 古拉丁字母,现已被“Th”取替
+ U+00DF ß 德文字母
+ U+00E0 à 在拉丁字母 a 上加重音符
+ U+00E1 á 在拉丁字母 a 上加锐音符
+ U+00E2 â 在拉丁字母 a 上加抑扬符
+ U+00E3 ã 在拉丁字母 a 上加波浪纹“~”
+ U+00E4 ä 在拉丁字母 a 上加分音符
+ U+00E5 å 在拉丁字母 a 上加角度符“°”
+ U+00E6 æ 拉丁字母 a、e 的混合
+ U+00E7 ç 在拉丁字母 c 下加软音符
+ U+00E8 è 在拉丁字母 e 上加锐音符
+ U+00E9 é 在拉丁字母 e 上加重音符
+ U+00EA ê 在拉丁字母 e 上加抑扬符
+ U+00EB ë 在拉丁字母 e 上加分音符
+ U+00EC ì 在拉丁字母 i 上加重音符
+ U+00ED í 在拉丁字母 i 上加锐音符
+ U+00EE î 在拉丁字母 i 上加抑扬符
+ U+00EF ï 在拉丁字母 i 上加分音符
+ U+00F0 ð 古拉丁字母
+ U+00F1 ñ 在拉丁字母 n 上加波浪纹“~”
+ U+00F2 ò 在拉丁字母 o 上加重音符
+ U+00F3 ó 在拉丁字母 o 上加锐音符
+ U+00F4 ô 在拉丁字母 o 上加抑扬符
+ U+00F5 õ 在拉丁字母 o 上加波浪纹“~”
+ U+00F6 ö 在拉丁字母 o 上加分音符
+ U+00F7 ÷ 除号,亦可拖按“Alt”键,同时按“41426”五键
+ U+00F8 ø 在拉丁字母 o 由右上至左下加对角斜线“/”
+ U+00F9 ù 在拉丁字母 u 上加重音符
+ U+00FA ú 在拉丁字母 u 上加锐音符
+ U+00FB ? 在拉丁字母 u 上加抑扬符
+ U+00FC ü 在拉丁字母 u 上加分音符
+ U+00FD ý 在拉丁字母 y 上加锐音符
+ U+00FE þ 古拉丁字母,现已被“th”取替
+ U+00FF ü 在拉丁字母 u 上加分音符
+ 拉丁字母(扩展 A)
+ 代码 显示 描述
+ U+0100 Ā 在拉丁字母 A 上加长音符
+ U+0101 ā 在拉丁字母 a 上加长音符
+ U+0102 Ă 在拉丁字母 A 上加短音符
+ U+0103 ă 在拉丁字母 a 上加短音符
+ U+0104 Ą 在拉丁字母 A 上加反尾形符
+ U+0105 ą 在拉丁字母 a 上加反尾形符
+ 拉丁字母(扩展 C)
+ 代码 显示 描述
+ U+2C60 Ⱡ 在拉丁字母“L”中间加两条横线“=”
+ U+2C61 ⱡ 在拉丁字母“l”(L 的小写)中间加两条横线“=”
+ U+2C62 Ɫ 在拉丁字母“L”(大写)中间加一条波浪线“~”
+ U+2C63 Ᵽ 在拉丁字母“P”中间加一条横线“-”
+ U+2C64 Ɽ 在拉丁字母“R”下加一条尾巴
+ U+2C65 ⱥ 在拉丁字母“a”上加一条对角斜线“/”
+ U+2C66 ⱦ 在拉丁字母“t”上加一条对角斜线“/”
+ U+2C67 Ⱨ 在拉丁字母“H”下加一条尾巴
+ U+2C68 ⱨ 在拉丁字母“h”下加一条尾巴
+ U+2C69 Ⱪ 在拉丁字母“K”下加一条尾巴
+ U+2C6A ⱪ 在拉丁字母“k”下加一条尾巴
+ U+2C6B Ⱬ 在拉丁字母“Z”下加一条尾巴
+ U+2C6C ⱬ 在拉丁字母“z”下加一条尾巴
+ U+2C74 ⱴ 在拉丁字母“v”的起笔加一个弯勾
+ U+2C75 Ⱶ 拉丁字母“H”的左半部
+ U+2C76 ⱶ 拉丁字母“h”的左半部
+ U+2C77 ⱷ 希腊字母“φ”的上半部
+ */
+ if(/.*[\u00A1-\u0105]+.*$/.test(str)){
+ return true;
+ }
+ if(/.*[\u2C60-\u2C77]+.*$/.test(str)){
+ return true;
+ }
+
+
+ return false;
+ }
+ },
+ //用户第一次打开网页时,自动判断当前用户所在国家使用的是哪种语言,来自动进行切换为用户所在国家的语种。
+ //如果使用后,第二次在用,那就优先以用户所选择的为主
+ executeByLocalLanguage:function(){
+ //先读用户自己浏览器的默认语言
+ var browserDefaultLanguage = translate.util.browserDefaultLanguage();
+ if(typeof(browserDefaultLanguage) != 'undefined' && browserDefaultLanguage.length > 0){
+ translate.changeLanguage(browserDefaultLanguage);
+ return;
+ }
+
+ //如果用户浏览器没读到默认语言,或者默认语言没有对应到translate.js支持的语种,那么在采用ip识别的方式
+ translate.request.post(translate.request.api.ip, {}, function(data){
+ //console.log(data);
+ if(data.result == 0){
+ console.log('==== ERROR 获取当前用户所在区域异常 ====');
+ console.log(data.info);
+ console.log('==== ERROR END ====');
+ }else{
+ translate.storage.set('to',data.language); //设置目标翻译语言
+ translate.to = data.language; //设置目标语言
+ translate.selectLanguageTag
+ translate.execute(); //执行翻译
+ }
+ }, null);
+ },
+
+ util:{
+ /* 生成一个随机UUID,复制于 https://gitee.com/mail_osc/kefu.js */
+ uuid:function() {
+ var d = new Date().getTime();
+ if (window.performance && typeof window.performance.now === "function") {
+ d += performance.now(); //use high-precision timer if available
+ }
+ var uuid = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
+ var r = (d + Math.random() * 16) % 16 | 0;
+ d = Math.floor(d / 16);
+ return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
+ });
+ return uuid;
+ },
+
+ //判断字符串中是否存在tag标签。 true存在
+ findTag:function(str) {
+ var reg = /<[^>]+>/g;
+ return reg.test(str);
+ },
+ //传入一个数组,从数组中找出现频率最多的一个返回。 如果多个频率出现的次数一样,那会返回多个
+ arrayFindMaxNumber:function(arr){
+
+ // 储存每个元素出现的次数
+ var numbers = {}
+
+ // 储存出现最多次的元素
+ var maxStr = []
+
+ // 储存最多出现的元素次数
+ var maxNum = 0
+
+ for(var i =0,len=arr.length;imaxNum){
+ maxNum = numbers[arr[i]]
+ }
+ }
+
+ for(var item in numbers){
+ if(numbers[item]===maxNum){
+ maxStr.push(item)
+ }
+ }
+
+ return maxStr;
+ },
+ //对字符串进行hash化,目的取唯一值进行标识
+ hash:function(str){
+ if(str == null || typeof(str) == 'undefined'){
+ return str;
+ }
+ var hash = 0, i, chr;
+ if (str.length === 0){
+ return hash;
+ }
+
+ for (i = 0; i < str.length; i++) {
+ chr = str.charCodeAt(i);
+ hash = ((hash << 5) - hash) + chr;
+ hash |= 0; // Convert to 32bit integer
+ }
+ return hash+'';
+ },
+ //去除一些指定字符,如换行符。 如果传入的是null,则返回空字符串
+ charReplace:function(str){
+
+ if(str == null){
+ return '';
+ }
+ str = str.trim();
+ str = str.replace(/\t|\n|\v|\r|\f/g,''); //去除换行符等
+ //str = str.replace(/&/g, "%26"); //因为在提交时已经进行了url编码了
+ return str;
+ },
+ //RegExp相关
+ regExp:{
+ // new RegExp(pattern, resultText); 中的 pattern 字符串的预处理
+ pattern:function(str){
+ str = str.replace(/\\/g,'\\\\'); //这个一定要放在第一个,不然会被下面的影响
+ //str = str.replace(/'/g,'\\\'');
+ str = str.replace(/\"/g,'\\\"');
+ //str = str.replace(/./g,'\\\.');
+ str = str.replace(/\?/g,'\\\?');
+ str = str.replace(/\$/g,'\\\$');
+ str = str.replace(/\(/g,'\\\(');
+ str = str.replace(/\)/g,'\\\)');
+ str = str.replace(/\|/g,'\\\|');
+ str = str.replace(/\+/g,'\\\+');
+ str = str.replace(/\*/g,'\\\*');
+ str = str.replace(/\[/g,'\\\[');
+ str = str.replace(/\]/g,'\\\]');
+ str = str.replace(/\^/g,'\\\^');
+ str = str.replace(/\{/g,'\\\{');
+ str = str.replace(/\}/g,'\\\}');
+ return str;
+ },
+ // new RegExp(pattern, resultText); 中的 resultText 字符串的预处理
+ resultText:function(str){
+ //str = str.replace(/"/g,"\"");
+ //str = str.replace(/'/g,"\\\'");
+ //str = str.replace(/"/g,"\\\"");
+ return str;
+ }
+ },
+ //获取URL的GET参数。若没有,返回""
+ getUrlParam:function (name){
+ var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
+ var r = window.location.search.substr(1).match(reg);
+ if(r!=null)return unescape(r[2]); return "";
+ },
+ /**
+ * 同步加载JS,加载过程中会阻塞,加载完毕后继续执行后面的。
+ * url: 要加载的js的url
+ */
+ synchronizesLoadJs:function(url){
+ var xmlHttp = null;
+ if(window.ActiveXObject){//IE
+ try {
+ //IE6以及以后版本中可以使用
+ xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
+ } catch (e) {
+ //IE5.5以及以后版本可以使用
+ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ }else if(window.XMLHttpRequest){
+ //Firefox,Opera 8.0+,Safari,Chrome
+ xmlHttp = new XMLHttpRequest();
+ }
+ //采用同步加载
+ xmlHttp.open("GET",url,false);
+ //发送同步请求,如果浏览器为Chrome或Opera,必须发布后才能运行,不然会报错
+ xmlHttp.send(null);
+ //4代表数据发送完毕
+ if( xmlHttp.readyState == 4 ){
+ //0为访问的本地,200到300代表访问服务器成功,304代表没做修改访问的是缓存
+ if((xmlHttp.status >= 200 && xmlHttp.status <300) || xmlHttp.status == 0 || xmlHttp.status == 304){
+ var myBody = document.getElementsByTagName("HTML")[0];
+ var myScript = document.createElement( "script" );
+ myScript.language = "javascript";
+ myScript.type = "text/javascript";
+ try{
+ //IE8以及以下不支持这种方式,需要通过text属性来设置
+ myScript.appendChild(document.createTextNode(xmlHttp.responseText));
+ }catch (ex){
+ myScript.text = xmlHttp.responseText;
+ }
+ myBody.appendChild(myScript);
+ return true;
+ }else{
+ return false;
+ }
+ }else{
+ return false;
+ }
+ },
+ //加载 msg.js
+ loadMsgJs:function(){
+ if(typeof(msg) != 'undefined'){
+ return;
+ }
+ translate.util.synchronizesLoadJs('https://res.zvo.cn/msg/msg.js');
+ },
+ /*
+ 对一个对象,按照对象的key的长度进行排序,越长越在前面
+ */
+ objSort:function(obj){
+ // 获取对象数组的所有 key,并转换为普通数组
+ var keys = Array.from(Object.keys(obj));
+
+ // 对 key 数组进行排序
+ keys.sort(function(a, b){
+ return b.length - a.length;
+ });
+
+ // 定义一个新的对象数组,用来存储排序后的结果
+ var sortedObj = new Array();
+
+ // 遍历排序后的 key 数组,将对应的值复制到新的对象数组中,并删除原来的对象数组中的键值对
+ for (var key of keys) {
+ sortedObj[key] = obj[key];
+ }
+ return sortedObj;
+ },
+ /*
+ 将 2.11.3.20231232 转化为 2011003
+ 转化时会去掉最后一个日期的字符
+ */
+ versionStringToInt:function(versionString){
+ var vs = versionString.split('\.');
+ var result = 0;
+ result = parseInt(vs[0])*1000*1000 + result;
+ result = parseInt(vs[1])*1000 + result;
+ result = parseInt(vs[2]) + result;
+
+ return result;
+ },
+ /**
+ * 将一个 JSONArray 数组,按照文字长度进行拆分。
+ * 比如传入的 array 数组的文字长度是6200,传入的 stringLength 是2000,那么就是将 array 数组拆分为多个长度不超出2000的数组返回。
+ * 如果传入了 maxSize = 5 那么会对拆分后的数组的长度进行判断,如果数组内元素超过5,那么还要进行缩短,拆分后的数组不允许超过这个数
+ * 也就是拆分后的数组有两重限制,一是限制转化为文本形式的长度、再就是拆分后本身数组的大小。
+ *
+ * 注意,这个长度是指 array.toString() 后的长度,也就是包含了 [""] 这种符号的长度
+ * @param array 要被拆分的数组,其内都是String类型,传入格式如 ["你好","世界"]
+ * @param stringLength 要被拆分的数组转化为字符串之后的长度
+ * @param maxSize 被拆分的数组最大包含多少个,数组大小最大允许多大,要小于等于这个数。 如果设置为0则是不启用这个,不对拆分后的数组进行判断。
+ * @return 被拆分后的数组列表
+ * @author 刘晓腾
+ */
+ split:function(array, size, maxSize) {
+ let orgsize = size;
+ let list = [];
+ // 数组长度小于size,直接进行返回
+ if(JSON.stringify(array).length <= size) {
+ list.push(array);
+ } else {
+ // 转换成String
+ let arrayStr = JSON.stringify(array).trim().substring(1, JSON.stringify(array).length - 1);
+
+ // 判断size和字符串长度的差值,如果为1或者2,就直接拆成两段
+ if (JSON.stringify(array).length - size <= 2) {
+ size = size - 4;
+ // 拆两段
+ let str1 = arrayStr.substring(0, arrayStr.lastIndexOf("\",\"")+1);
+ let str2 = arrayStr.substring(arrayStr.lastIndexOf("\",\"")+2);
+ list.push(JSON.parse("[" + str1 + "]"));
+ list.push(JSON.parse("[" + str2 + "]"));
+ } else {
+ size = size - 2;
+ // 拆多段
+ let index = 0;
+ while (index - arrayStr.length < 0) {
+ // 按照指定大小拆一段
+ let s = "";
+ if ((index+size) - arrayStr.length >= 0) {
+ s = arrayStr.substring(index);
+ } else {
+ s = arrayStr.substring(index, (index+size));
+ }
+ // 结尾长度默认为字符串长度
+ let endIndex = s.length;
+ // 因为下次开始的第一个字符可能会是逗号,所以下次开始需要+1
+ let startNeedAdd = 1;
+ // 判断最后一个字符是否为双引号
+ if (s.endsWith("\"")) {
+ // 判断倒数第二个是否为逗号
+ if (s.endsWith("\",\"")) {
+ // 删除两个字符
+ endIndex-=2;
+ } else if (!s.startsWith("\"")) {
+ // 如果开头不是引号,需要补一个引号,这就导致会超长,所以结尾就要找指定字符的
+ // 找出最后一个指定字符的位置
+ let la = s.lastIndexOf("\",\"");
+ endIndex = la + 1;
+ }
+ } else if (s.endsWith("\",")) {
+ // 判断是否为逗号,是的话删除一个字符
+ endIndex-=1;
+ } else {
+ // 都不是,那就是内容结尾
+ // 找出最后一个指定字符的位置
+ let la = s.lastIndexOf("\",\"");
+ endIndex = la + 1;
+ // 内容超长,endIndex就会变成0,这时需要手动赋值
+ if (endIndex <= 0) {
+ // 看看是否以引号开头,如果不是,需要拼两个引号
+ if (s.startsWith("\"")) {
+ // 拼一个引号,-1
+ endIndex = s.length - 1;
+ } else {
+ // 拼两个引号,-2
+ endIndex = s.length - 2;
+ }
+ if (!s.endsWith("\"")) {
+ // 开始不是逗号了,不能-1
+ startNeedAdd = 0;
+ }
+ }
+ }
+ // 根据处理的结尾长度进行第二次拆分
+ let s2 = "";
+ if (endIndex - s.length > 0 || endIndex - 0 == 0) {
+ s2 = s;
+ endIndex = endIndex + s2.length;
+ } else {
+ s2 = s.substring(0, endIndex);
+ }
+ if (!s2.startsWith("\"") && !s2.startsWith(",\"")) {
+ // 拼一个引号
+ s2 = "\"" + s2;
+ }
+ if (!s2.endsWith("\"")) {
+ // 拼一个引号
+ s2 = s2 +"\"";
+ }
+ // 计算下次循环开始的长度
+ index += (endIndex + startNeedAdd);
+ // 加到list
+ s2 = "[" + s2 + "]";
+ try {
+ list.push(JSON.parse(s2));
+ } catch (e) {
+ // 遇到错误,略过一个字符
+ index = index - (endIndex + startNeedAdd) + 1;
+ }
+ }
+ }
+ }
+ // 设置了maxSize,进行处理
+ if (maxSize && maxSize > 0) {
+ list = translate.util._splitMaxSize(list, orgsize, maxSize);
+ }
+ return list;
+ },
+ /**
+ * 针对split函数中maxSize的处理
+ * private
+ * @param array 已拆分的二维数组
+ * @param size 拆分的长度
+ * @param maxSize 元素数量
+ * @author 刘晓腾
+ */
+ _splitMaxSize:function(array, size, maxSize) {
+ // console.log("------ splitMaxSize run ------")
+
+ // 返回的数据
+ let list = [];
+ // 暂存的数组,用来存储每次遍历时超出的数据
+ let tmp = [];
+
+ // 遍历二维数组
+ array.forEach(function(arr, index) {
+ // 累加数组
+ arr = tmp.concat(arr);
+ // 计算元素数量
+ let length = arr.length;
+ // 数组中元素数量大于maxSize,对多余的元素进行移除
+ if (length > maxSize) {
+ // 第一个数组,包含前N个元素
+ let firstArray = arr.slice(0, maxSize);
+ // 第二个数组,包含剩下的元素
+ let secondArray = arr.slice(maxSize);
+
+ // 处理长度
+ let len = 1;
+ while (JSON.stringify(firstArray).length > size) {
+ // 长度超过限制,进行处理
+ firstArray = arr.slice(0, maxSize - len);
+ secondArray = arr.slice(maxSize - len);
+ len++;
+ if (len >= arr.length+1) {
+ break;
+ }
+ }
+
+ // 第一个数组记录
+ list.push(firstArray);
+ // 第二个数组暂存
+ tmp.length = 0;
+ tmp = secondArray;
+ } else {
+ // 没超,只处理长度
+ // 处理长度
+ let firstArray = arr;
+ let secondArray = [];
+ let len = 1;
+ while (JSON.stringify(firstArray).length > size) {
+ // 长度超过限制,进行处理
+ firstArray = arr.slice(0, maxSize - len);
+ secondArray = arr.slice(maxSize - len);
+ len++;
+ if (len >= arr.length+1) {
+ break;
+ }
+ }
+
+ // 第一个数组记录
+ list.push(firstArray);
+ // 第二个数组暂存
+ tmp.length = 0;
+ tmp = secondArray;
+ }
+
+ });
+
+ // 临时数组中还有元素,也要进行处理
+ if (tmp.length > 0) {
+ let tmpl = [];
+ tmpl.push(tmp);
+ // 递归处理
+ let l = translate.util._splitMaxSize(tmpl, size, maxSize);
+ list = list.concat(l);
+ }
+
+ return list;
+ },
+ /*
+ 浏览器的语种标识跟translate.js的语种标识的对应
+ key: 浏览器的语种标识
+ value: translate.js 的语种标识
+ */
+ browserLanguage:{
+ 'zh-CN':'chinese_simplified',
+ 'zh-TW':'chinese_traditional',
+ 'zh-HK':'chinese_traditional',
+ 'co':'corsican',
+ 'gn':'guarani',
+ 'rw':'kinyarwanda',
+ 'ha':'hausa',
+ 'no':'norwegian',
+ 'nl':'dutch',
+ 'yo':'yoruba',
+ 'en':'english',
+ 'en-US':'english',
+ 'kok':'gongen',
+ 'la':'latin',
+ 'ne':'nepali',
+ 'fr':'french',
+ 'cs':'czech',
+ 'haw':'hawaiian',
+ 'ka':'georgian',
+ 'ru':'russian',
+ 'fa':'persian',
+ 'bho':'bhojpuri',
+ 'hi':'hindi',
+ 'be':'belarusian',
+ 'sw':'swahili',
+ 'is':'icelandic',
+ 'yi':'yiddish',
+ 'tw':'twi',
+ 'ga':'irish',
+ 'gu':'gujarati',
+ 'km':'khmer',
+ 'sk':'slovak',
+ 'he':'hebrew',
+ 'kn':'kannada',
+ 'hu':'hungarian',
+ 'ta':'tamil',
+ 'ar':'arabic',
+ 'bn':'bengali',
+ 'az':'azerbaijani',
+ 'sm':'samoan',
+ 'af':'afrikaans',
+ 'id':'indonesian',
+ 'da':'danish',
+ 'sn':'shona',
+ 'bm':'bambara',
+ 'lt':'lithuanian',
+ 'vi':'vietnamese',
+ 'mt':'maltese',
+ 'tk':'turkmen',
+ 'as':'assamese',
+ 'ca':'catalan',
+ 'si':'singapore',
+ 'ceb':'cebuano',
+ 'gd':'scottish-gaelic',
+ 'sa':'sanskrit',
+ 'pl':'polish',
+ 'gl':'galician',
+ 'lv':'latvian',
+ 'uk':'ukrainian',
+ 'tt':'tatar',
+ 'cy':'welsh',
+ 'ja':'japanese',
+ 'fil':'filipino',
+ 'ay':'aymara',
+ 'lo':'lao',
+ 'te':'telugu',
+ 'ro':'romanian',
+ 'ht':'haitian_creole',
+ 'doi':'dogrid',
+ 'sv':'swedish',
+ 'mai':'maithili',
+ 'th':'thai',
+ 'hy':'armenian',
+ 'my':'burmese',
+ 'ps':'pashto',
+ 'hmn':'hmong',
+ 'dv':'dhivehi',
+ 'lb':'luxembourgish',
+ 'sd':'sindhi',
+ 'ku':'kurdish',
+ 'tr':'turkish',
+ 'mk':'macedonian',
+ 'bg':'bulgarian',
+ 'ms':'malay',
+ 'lg':'luganda',
+ 'mr':'marathi',
+ 'et':'estonian',
+ 'ml':'malayalam',
+ 'de':'deutsch',
+ 'sl':'slovene',
+ 'ur':'urdu',
+ 'pt':'portuguese',
+ 'ig':'igbo',
+ 'ckb':'kurdish_sorani',
+ 'om':'oromo',
+ 'el':'greek',
+ 'es':'spanish',
+ 'fy':'frisian',
+ 'so':'somali',
+ 'am':'amharic',
+ 'ny':'nyanja',
+ 'pa':'punjabi',
+ 'eu':'basque',
+ 'it':'italian',
+ 'sq':'albanian',
+ 'ko':'korean',
+ 'tg':'tajik',
+ 'fi':'finnish',
+ 'ky':'kyrgyz',
+ 'ee':'ewe',
+ 'hr':'croatian',
+ 'kri':'creole',
+ 'qu':'quechua',
+ 'bs':'bosnian',
+ 'mi':'maori'
+ },
+ /*
+ 获取浏览器中设置的默认使用语言
+ 返回的是 translate.js 的语言唯一标识
+ 如果返回的是空字符串,则是没有匹配到(可能是没有获取到本地语言,也可能是本地语言跟translate.js 翻译通道没有对应上)
+ */
+ browserDefaultLanguage:function(){
+ var language = navigator.language || navigator.userLanguage;
+ if(typeof(language) == 'string' && language.length > 0){
+ var tLang = translate.util.browserLanguage[language];
+ if(typeof(tLang) == 'undefined'){
+ //没有在里面
+ console.log('browser default language : '+language +', translate.js current translate channel not support this language ');
+ }else{
+ return tLang;
+ }
+ }
+
+ //将其转化为 translate.js 的语言id,比如简体中文是 chinese_simplified 、 英语是 english
+ return '';
+ }
+ },
+ //机器翻译采用哪种翻译服务
+ service:{
+ /*
+ name填写的值有
+ translate.service 有 http://translate.zvo.cn/41160.html 提供机器翻译服务
+ client.edge 有edge浏览器接口提供翻译服务 ,也就是执行翻译时直接是
+
+ */
+ name:'translate.service',
+
+ /*
+ 其实就是设置 translate.service.name
+
+ */
+ use: function(serviceName){
+ if(translate.enterprise.isUse == true){
+ console.log('您已启用了企业级翻译通道 translate.enterprise.use(); (文档:https://translate.zvo.cn/4087.html) , 所以您设置的 translate.service.use(\''+serviceName+'\'); (文档:https://translate.zvo.cn/4081.html) 将失效不起作用,有企业级翻译通道全部接管。');
+ return;
+ }
+ if(typeof(serviceName) == 'string' && serviceName == 'client.edge'){
+ translate.service.name = serviceName;
+
+ //增加元素整体翻译能力
+ translate.whole.enableAll();
+ }
+ },
+ //客户端方式的edge提供机器翻译服务
+ edge:{
+ api:{ //edge浏览器的翻译功能
+ auth:'https://edge.microsoft.com/translate/auth', //auth授权拉取
+ translate:'https://api.cognitive.microsofttranslator.com/translate?from={from}&to={to}&api-version=3.0&includeSentenceLength=true' //翻译接口
+ },
+
+ language:{
+ json:[{"id":"ukrainian","name":"Україна","serviceId":"uk"},{"id":"norwegian","name":"Norge","serviceId":"no"},{"id":"welsh","name":"Iaith Weleg","serviceId":"cy"},{"id":"dutch","name":"nederlands","serviceId":"nl"},{"id":"japanese","name":"日本語","serviceId":"ja"},{"id":"filipino","name":"Pilipino","serviceId":"fil"},{"id":"english","name":"English","serviceId":"en"},{"id":"lao","name":"ກະຣຸນາ","serviceId":"lo"},{"id":"telugu","name":"తెలుగుName","serviceId":"te"},{"id":"romanian","name":"Română","serviceId":"ro"},{"id":"nepali","name":"नेपालीName","serviceId":"ne"},{"id":"french","name":"Français","serviceId":"fr"},{"id":"haitian_creole","name":"Kreyòl ayisyen","serviceId":"ht"},{"id":"czech","name":"český","serviceId":"cs"},{"id":"swedish","name":"Svenska","serviceId":"sv"},{"id":"russian","name":"Русский язык","serviceId":"ru"},{"id":"malagasy","name":"Malagasy","serviceId":"mg"},{"id":"burmese","name":"ဗာရမ်","serviceId":"my"},{"id":"pashto","name":"پښتوName","serviceId":"ps"},{"id":"thai","name":"คนไทย","serviceId":"th"},{"id":"armenian","name":"Արմենյան","serviceId":"hy"},{"id":"chinese_simplified","name":"简体中文","serviceId":"zh-CHS"},{"id":"persian","name":"Persian","serviceId":"fa"},{"id":"chinese_traditional","name":"繁體中文","serviceId":"zh-CHT"},{"id":"kurdish","name":"Kurdî","serviceId":"ku"},{"id":"turkish","name":"Türkçe","serviceId":"tr"},{"id":"hindi","name":"हिन्दी","serviceId":"hi"},{"id":"bulgarian","name":"български","serviceId":"bg"},{"id":"malay","name":"Malay","serviceId":"ms"},{"id":"swahili","name":"Kiswahili","serviceId":"sw"},{"id":"oriya","name":"ଓଡିଆ","serviceId":"or"},{"id":"icelandic","name":"ÍslandName","serviceId":"is"},{"id":"irish","name":"Íris","serviceId":"ga"},{"id":"khmer","name":"ភាសាខ្មែរName","serviceId":"km"},{"id":"gujarati","name":"ગુજરાતી","serviceId":"gu"},{"id":"slovak","name":"Slovenská","serviceId":"sk"},{"id":"kannada","name":"ಕನ್ನಡ್Name","serviceId":"kn"},{"id":"hebrew","name":"היברית","serviceId":"he"},{"id":"hungarian","name":"magyar","serviceId":"hu"},{"id":"marathi","name":"मराठीName","serviceId":"mr"},{"id":"tamil","name":"தாமில்","serviceId":"ta"},{"id":"estonian","name":"eesti keel","serviceId":"et"},{"id":"malayalam","name":"മലമാലം","serviceId":"ml"},{"id":"inuktitut","name":"ᐃᓄᒃᑎᑐᑦ","serviceId":"iu"},{"id":"arabic","name":"بالعربية","serviceId":"ar"},{"id":"deutsch","name":"Deutsch","serviceId":"de"},{"id":"slovene","name":"slovenščina","serviceId":"sl"},{"id":"bengali","name":"বেঙ্গালী","serviceId":"bn"},{"id":"urdu","name":"اوردو","serviceId":"ur"},{"id":"azerbaijani","name":"azerbaijani","serviceId":"az"},{"id":"portuguese","name":"português","serviceId":"pt"},{"id":"samoan","name":"lifiava","serviceId":"sm"},{"id":"afrikaans","name":"afrikaans","serviceId":"af"},{"id":"tongan","name":"汤加语","serviceId":"to"},{"id":"greek","name":"ελληνικά","serviceId":"el"},{"id":"indonesian","name":"IndonesiaName","serviceId":"id"},{"id":"spanish","name":"Español","serviceId":"es"},{"id":"danish","name":"dansk","serviceId":"da"},{"id":"amharic","name":"amharic","serviceId":"am"},{"id":"punjabi","name":"ਪੰਜਾਬੀName","serviceId":"pa"},{"id":"albanian","name":"albanian","serviceId":"sq"},{"id":"lithuanian","name":"Lietuva","serviceId":"lt"},{"id":"italian","name":"italiano","serviceId":"it"},{"id":"vietnamese","name":"Tiếng Việt","serviceId":"vi"},{"id":"korean","name":"한국어","serviceId":"ko"},{"id":"maltese","name":"Malti","serviceId":"mt"},{"id":"finnish","name":"suomi","serviceId":"fi"},{"id":"catalan","name":"català","serviceId":"ca"},{"id":"croatian","name":"hrvatski","serviceId":"hr"},{"id":"bosnian","name":"bosnian","serviceId":"bs-Latn"},{"id":"polish","name":"Polski","serviceId":"pl"},{"id":"latvian","name":"latviešu","serviceId":"lv"},{"id":"maori","name":"Maori","serviceId":"mi"}],
+ /*
+ 获取map形式的语言列表
+ key为 translate.service 的 name
+ value为serviceId
+
+ */
+ getMap:function(){
+ if(typeof(translate.service.edge.language.map) == 'undefined'){
+ translate.service.edge.language.map = new Array();
+ for(var i = 0; i < translate.service.edge.language.json.length; i++){
+ var item = translate.service.edge.language.json[i];
+ translate.service.edge.language.map[item.id] = item.serviceId;
+ }
+ }
+ return translate.service.edge.language.map;
+ }
+ },
+ /**
+ * edge 进行翻译。 这个传入参数跟 translate.request.post 是一样的
+ * @param path 请求的path(path,传入的是translate.request.api.translate 这种的,需要使用 getUrl 来组合真正请求的url )
+ * @param data 请求的参数数据
+ * @param func 请求完成的回调,传入如 function(data){ console.log(data); }
+ */
+ translate:function(path, data, func, abnormalFunc){
+ var textArray = JSON.parse(decodeURIComponent(data.text));
+ let translateTextArray = translate.util.split(textArray, 40000, 900);
+
+ translate.request.send(translate.service.edge.api.auth, {}, function(auth){
+ var from = translate.service.edge.language.getMap()[data.from];
+ var to = translate.service.edge.language.getMap()[data.to];
+ var transUrl = translate.service.edge.api.translate.replace('{from}',from).replace('{to}',to);
+
+ //如果翻译量大,要拆分成多次翻译请求
+ for(var tai = 0; tai 1){
+ //这一次翻译呗拆分了多次请求,那么要进行补全数组,使数组个数能一致
+
+ /*
+
+ 注意这里根据数组的长度来判断当前属于第几个数组,
+ 有几率会是拆分的数组,其中有两组的长度是一样的,
+ 这样的话是有问题的,只不过几率很小,就先这样了
+ 但终归还是留了个坑 -- 记录
+
+ */
+
+ var currentIndex = -1; //当前翻译请求属于被拆分的第几个的数组下标,从0开始的
+ for(var cri = 0; cri < translateTextArray.length; cri++){
+ if(translateTextArray[cri].length - d.text.length == 0){
+ currentIndex = cri;
+ break;
+ }
+ }
+
+ //进行对前后进行补齐数组
+ if(currentIndex < 0){
+ console.log('------ERROR--------');
+ console.log('翻译内容过多,进行拆分,但拆分判断出现异常,currentIndex:-1 请联系 http://translate.zvo.cn/43006.html 说明');
+ }
+ //前插入空数组填充
+ for(var addbeforei = 0; addbeforeicurrentIndex; addafteri--){
+ var afterItemArrayLength = translateTextArray[addafteri].length;
+ for(var bi = 0; bi < afterItemArrayLength; bi++){
+ d.text.push(null);
+ }
+ }
+
+ }
+
+ func(d);
+ }, 'post', true, {'Authorization':'Bearer '+auth, 'Content-Type':'application/json'}, abnormalFunc, true);
+
+
+ }
+ //console.log('translateResultArray')
+ //console.log(translateResultArray);
+
+
+ }, 'get', true, {'content-type':'application/x-www-form-urlencoded'}, function(xhr){
+ console.log('---------error--------');
+ console.log('edge translate service error, http code : '+xhr.status + ', response text : '+xhr.responseText);
+ }, true);
+
+
+
+
+
+ }
+ }
+ },
+ //request请求来源于 https://github.com/xnx3/request
+ request:{
+
+ //相关API接口方面
+ api:{
+ /**
+ * 翻译接口请求的域名主机 host
+ * 格式注意前面要带上协议如 https:// 域名后要加 /
+ * v2.8.2 增加数组形态,如 ['https://api.translate.zvo.cn/','xxxxx']
+ */
+ //host:'https://api.translate.zvo.cn/',
+ host:['https://api.translate.zvo.cn/','https://america.api.translate.zvo.cn/'],
+ //host的备用接口,格式同host,可以填写多个,只不过这里是数组格式。只有当主 host 无法连通时,才会采用备host来提供访问。如果为空也就是 [] 则是不采用备方案。
+ //backupHost:['',''],
+ language:'language.json', //获取支持的语种列表接口
+ translate:'translate.json', //翻译接口
+ ip:'ip.json', //根据用户当前ip获取其所在地的语种
+ connectTest:'connectTest.json', //用于 translate.js 多节点翻译自动检测网络连通情况
+ init:'init.json', //获取最新版本号,跟当前版本进行比对,用于提醒版本升级等使用
+
+ },
+ /*
+ 请求后端接口的响应。无论是否成功,都会触发此处。
+ 另外当 xhr.readyState==4 的状态时才会触发。
+ 此处会在接口请求响应后、且在translate.js处理前就会触发
+ @param xhr XMLHttpRequest 接口请求
+
+ */
+ response:function(xhr){
+ //console.log('response------');
+ //console.log(xhr);
+ },
+ /*
+ 速度检测控制中心, 检测主备翻译接口的响应速度进行排列,真正请求时,按照排列的顺序进行请求
+ v2.8.2增加
+
+ storage存储方面
+ storage存储的key 存的什么
+ speedDetectionControl_hostQueue hostQueue
+ speedDetectionControl_hostQueueIndex 当前要使用的是 hostQueue 中的数组下标。如果没有,这里默认视为0
+ speedDetectionControl_lasttime 最后一次执行速度检测的时间戳,13位时间戳
+
+
+
+ */
+ speedDetectionControl:{
+ /*
+
+ 进行 connect主节点缩减的时间,单位是毫秒.
+ 这个是进行 translate.request.speedDetectionControl.checkResponseSpeed() 节点测速时,translate.request.api.host 第一个元素是默认的主节点。
+ 主节点在实际测速完后,会减去一定的时间,以便让用户大部分时间可以使用主节点,而不必走分节点。
+ 例如主节点实际响应速度 3500 毫秒,那么会减去这里设置的2000毫秒,记为 1500 毫秒
+ 当然如果是小于这里设置的2000毫秒,那么会记为0毫秒。
+ 这样再跟其他分节点的响应时间进行对比,主节点只要不是响应超时,就会有更大的几率被选中为实际使用的翻译的节点
+
+ 这里的单位是毫秒。
+ v2.10.2.20231225 增加
+ */
+ hostMasterNodeCutTime:2000,
+
+ /*
+ 翻译的队列,这是根据网络相应的速度排列的,0下标为请求最快,1次之...
+ 其格式为:
+ [
+ {
+ "host":"xxxxxxxx",
+ "time":123 //这里的单位是毫秒
+ },
+ {
+ "host":"xxxxxxxx",
+ "time":123 //这里的单位是毫秒
+ }
+ ]
+ */
+ hostQueue:[],
+ hostQueueIndex:-1, //当前使用的 hostQueue的数组下标, -1表示还未初始化赋予值,不可直接使用,通过 getHostQueueIndex() 使用
+ disableTime:1000000, //不可用的时间,storage中存储的 speedDetectionControl_hostQueue 其中 time 这里,如果值是 这个,便是代表这个host处于不可用状态
+
+
+ //获取 host queue 队列
+ getHostQueue:function(){
+ if(translate.request.speedDetectionControl.hostQueue.length == 0){
+ //还没有,先从本地存储中取,看之前是否已经设置过了
+ // 只有经过真正的网络测速后,才会加入 storage 的 hostQueue
+ var storage_hostQueue = translate.storage.get('speedDetectionControl_hostQueue');
+ if(storage_hostQueue == null || typeof(storage_hostQueue) == 'undefined'){
+ //本地存储中没有,也就是之前没设置过,是第一次用,那么直接讲 translate.request.api.host 赋予之
+ //translate.request.api.host
+ //console.log(typeof(translate.request.api.host))
+ if(typeof(translate.request.api.host) == 'string'){
+ //单个,那么赋予数组形式
+ //translate.request.speedDetectionControl.hostQueue = [{"host":translate.request.api.host, time:0 }];
+ translate.request.api.host = [''+translate.request.api.host];
+ }
+
+ //console.log(translate.request.api.host)
+ //数组形态,多个,v2.8.2 增加多个,根据优先级返回
+ translate.request.speedDetectionControl.hostQueue = [];
+ for(var i = 0; i updateTime){
+ translate.request.speedDetectionControl.checkResponseSpeed();
+ }
+
+ }
+
+
+ return translate.request.speedDetectionControl.hostQueue;
+ },
+
+ /*
+ 服务于 checkResponseSpeed 用于将测试结果存入 storage
+ time: 当前接口请求的耗时,单位是毫秒。如果是 1000000 那么表示这个接口不可用
+ */
+ checkResponseSpeed_Storage:function(host, time){
+
+ translate.request.speedDetectionControl.checkHostQueue.push({"host":host, "time":time });
+ //按照time进行排序
+ translate.request.speedDetectionControl.checkHostQueue.sort((a, b) => a.time - b.time);
+
+ //存储到 storage 持久化
+ translate.storage.set('speedDetectionControl_hostQueue',JSON.stringify(translate.request.speedDetectionControl.checkHostQueue));
+ translate.storage.set('speedDetectionControl_lasttime', new Date().getTime());
+
+ translate.request.speedDetectionControl.hostQueue = translate.request.speedDetectionControl.checkHostQueue;
+ },
+
+ //测试响应速度
+ checkResponseSpeed:function(){
+ var headers = {
+ 'content-type':'application/x-www-form-urlencoded',
+ };
+
+
+ translate.request.speedDetectionControl.checkHostQueue = []; //用于实际存储
+ translate.request.speedDetectionControl.checkHostQueueMap = []; //只是map,通过key取值,无其他作用
+
+ if(typeof(translate.request.api.host) == 'string'){
+ //单个,那么赋予数组形式
+ translate.request.api.host = [''+translate.request.api.host];
+ }
+
+ for(var i = 0; i < translate.request.api.host.length; i++){
+ var host = translate.request.api.host[i];
+ // 获取当前时间的时间戳
+ translate.request.speedDetectionControl.checkHostQueueMap[host] = {
+ start:new Date().getTime()
+ };
+
+
+ try{
+ translate.request.send(
+ host+translate.request.api.connectTest,
+ {host:host},
+ function(data){
+ var host = data.info;
+ var map = translate.request.speedDetectionControl.checkHostQueueMap[host];
+ var time = new Date().getTime() - map.start;
+
+ if(translate.request.api.host[0] == host){
+ //console.log('如果是第一个,那么是主的,默认允许缩减2000毫秒,也就是优先使用主的');
+ time = time - translate.request.speedDetectionControl.hostMasterNodeCutTime;
+ if(time < 0){
+ time = 0;
+ }
+ }
+
+ translate.request.speedDetectionControl.checkResponseSpeed_Storage(host, time);
+ /*
+ translate.request.speedDetectionControl.checkHostQueue.push({"host":host, "time":time });
+ //按照time进行排序
+ translate.request.speedDetectionControl.checkHostQueue.sort((a, b) => a.time - b.time);
+
+ //存储到 storage 持久化
+ translate.storage.set('speedDetectionControl_hostQueue',JSON.stringify(translate.request.speedDetectionControl.checkHostQueue));
+ translate.storage.set('speedDetectionControl_lasttime', new Date().getTime());
+
+ translate.request.speedDetectionControl.hostQueue = translate.request.speedDetectionControl.checkHostQueue;
+ //console.log(translate.request.speedDetectionControl.hostQueue);
+ */
+ },
+ 'post',
+ true,
+ headers,
+ function(data){
+ //translate.request.speedDetectionControl.checkResponseSpeed_Storage(host, time);
+ var hostUrl = data.requestURL.replace('connectTest.json','');
+ translate.request.speedDetectionControl.checkResponseSpeed_Storage(hostUrl, translate.request.speedDetectionControl.disableTime);
+ },
+ false
+ );
+ }catch(e){
+ //console.log('e0000');
+ console.log(e);
+ //time = 300000; //无法连接的,那么赋予 300 秒吧
+ }
+
+ }
+
+ },
+
+ //获取当前使用的host的数组下标
+ getHostQueueIndex:function(){
+ if(translate.request.speedDetectionControl.hostQueueIndex < 0){
+ //页面当前第一次使用,赋予值
+ //先从 storage 中取
+ var storage_index = translate.storage.get('speedDetectionControl_hostQueueIndex');
+ if(typeof(storage_index) == 'undefined' || storage_index == null){
+ //存储中不存在,当前用户(浏览器)第一次使用,默认赋予0
+ translate.request.speedDetectionControl.hostQueueIndex = 0;
+ translate.storage.set('speedDetectionControl_hostQueueIndex',0);
+ }else{
+ translate.request.speedDetectionControl.hostQueueIndex = storage_index;
+ }
+ }
+ return translate.request.speedDetectionControl.hostQueueIndex;
+ },
+
+ //获取当前要使用的host
+ getHost:function(){
+ var queue = translate.request.speedDetectionControl.getHostQueue();
+ //console.log(queue);
+ var queueIndex = translate.request.speedDetectionControl.getHostQueueIndex();
+ if(queue.length > queueIndex){
+ //正常,没有超出越界
+
+ }else{
+ //异常,下标越界了!,固定返回最后一个
+ console.log('异常,下标越界了!index:'+queueIndex);
+ queueIndex = queue.length-1;
+ }
+ //console.log(queueIndex);
+ return queue[queueIndex].host;
+ },
+
+ },
+ //生成post请求的url
+ getUrl:function(path){
+ var currentHost = translate.request.speedDetectionControl.getHost();
+ var url = currentHost+path+'?v='+translate.version;
+ //console.log('url: '+url);
+ return url;
+ },
+ /**
+ * post请求
+ * @param path 请求的path(path,传入的是translate.request.api.translate 这种的,需要使用 getUrl 来组合真正请求的url )
+ * @param data 请求的参数数据,传入如
+ * {
+ * from: "chinese_simplified",
+ * text: "%5B%22%E4%BD%A0%E5%A5%BD%EF%BC%8C%E6%88%91",
+ * to: "chinese_traditional
+ * }
+ *
+ * @param func 请求完成的回调,传入如 function(data){ console.log(data); }
+ * @param abnormalFunc 响应异常所执行的方法,响应码不是200就会执行这个方法 ,传入如 function(xhr){} 另外这里的 xhr 会额外有个参数 xhr.requestURL 返回当前请求失败的url
+ */
+ post:function(path, data, func, abnormalFunc){
+ var headers = {
+ 'content-type':'application/x-www-form-urlencoded',
+ };
+ if(typeof(data) == 'undefined'){
+ return;
+ }
+
+ //企业级翻译自动检测
+ translate.enterprise.automaticAdaptationService();
+
+ // ------- edge start --------
+ var url = translate.request.getUrl(path);
+ //if(url.indexOf('edge') > -1 && path == translate.request.api.translate){
+ if(translate.service.name == 'client.edge'){
+ if(path == translate.request.api.translate){
+ translate.service.edge.translate(path, data, func, abnormalFunc);
+ return;
+ }
+ if(path == translate.request.api.language){
+ var d = {};
+ d.info = 'SUCCESS';
+ d.result = 1;
+ d.list = translate.service.edge.language.json;
+ func(d);
+ return;
+ }
+
+ //return;
+ }
+ // ------- edge end --------
+
+ this.send(path, data, func, 'post', true, headers, abnormalFunc, true);
+ },
+ /**
+ * 发送请求
+ * url 请求的url或者path(path,传入的是translate.request.api.translate 这种的,需要使用 getUrl 来组合真正请求的url )
+ * data 请求的数据,如 {"author":"管雷鸣",'site':'www.guanleiming.com'}
+ * func 请求完成的回调,传入如 function(data){}
+ * method 请求方式,可传入 post、get
+ * isAsynchronize 是否是异步请求, 传入 true 是异步请求,传入false 是同步请求。 如果传入false,则本方法返回xhr
+ * headers 设置请求的header,传入如 {'content-type':'application/x-www-form-urlencoded'};
+ * abnormalFunc 响应异常所执行的方法,响应码不是200就会执行这个方法 ,传入如 function(xhr){} 另外这里的 xhr 会额外有个参数 xhr.requestURL 返回当前请求失败的url
+ * showErrorLog 是否控制台打印出来错误日志,true打印, false 不打印
+ */
+ send:function(url, data, func, method, isAsynchronize, headers, abnormalFunc, showErrorLog){
+ //post提交的参数
+ var params = '';
+
+ if(data == null || typeof(data) == 'undefined'){
+ data = {};
+ }
+
+ if(typeof(data) == 'string'){
+ params = data; //payload 方式
+ }else{
+ //表单提交方式
+
+ //加入浏览器默认语种 v3.6.1 增加,以便更好的进行自动切换语种
+ data.browserDefaultLanguage = translate.util.browserDefaultLanguage();
+
+ //加入key
+ if(typeof(translate.enterprise.key) != 'undefined' && typeof(translate.enterprise.key) == 'string' && translate.enterprise.key.length > 0){
+ data.key = translate.enterprise.key;
+ }
+
+ //组合参数
+ for(var index in data){
+ if(params.length > 0){
+ params = params + '&';
+ }
+ params = params + index + '=' + data[index];
+ }
+ }
+
+ if(url.indexOf('https://') == 0 || url.indexOf('http://') == 0){
+ //采用的url绝对路径
+ }else{
+ //相对路径,拼接上host
+ url = translate.request.getUrl(url);
+ }
+
+ var xhr=null;
+ try{
+ xhr=new XMLHttpRequest();
+ }catch(e){
+ xhr=new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ //2.调用open方法(true----异步)
+ xhr.open(method,url,isAsynchronize);
+ //设置headers
+ if(headers != null){
+ for(var index in headers){
+ xhr.setRequestHeader(index,headers[index]);
+ }
+ }
+ if(translate.service.name == 'translate.service'){
+ xhr.setRequestHeader('currentpage', window.location.href+'');
+ }
+ xhr.send(params);
+ //4.请求状态改变事件
+ xhr.onreadystatechange=function(){
+ if(xhr.readyState==4){
+ translate.request.response(xhr); //自定义响应的拦截
+
+ if(xhr.status==200){
+ //请求正常,响应码 200
+ var json = null;
+ if(typeof(xhr.responseText) == 'undefined' || xhr.responseText == null){
+ //相应内容为空
+ }else{
+ //响应内容有值
+ if(xhr.responseText.indexOf('{') > -1 && xhr.responseText.indexOf('}') > -1){
+ //应该是json格式
+ try{
+ json = JSON.parse(xhr.responseText);
+ }catch(e){
+ console.log(e);
+ }
+ }
+ }
+
+ if(json == null){
+ func(xhr.responseText);
+ }else{
+ func(json);
+ }
+ }else{
+ if(showErrorLog){
+ if(url.indexOf(translate.request.api.connectTest) > -1){
+ //测试链接速度的不在报错里面
+ }else{
+
+ //判断是否是v2版本的翻译,如果是 translate.service 模式并且没有使用企业级翻译,参会提示
+ //2024.3月底开始,翻译使用量增加的太快,开源的翻译服务器有点扛不住经常出故障,所以直接把这个提示加到这里
+ if(translate.service.name == 'translate.service' && !translate.enterprise.isUse){
+ console.log('----- translate.js 提示 -----\n非常抱歉,translate.service 开源免费的翻译服务器当前并发及流量太大导致阻塞!\n这个情况是时不时发生的,大概一天24小时可能会有一二十分钟这种情况,主要是因为使用量太大了,月使用量能超四十亿次,所以在高发时会出现这种情况。\n解决这种情况可以有两种方案:\n【方案一】:使用采用最新版本 3.8.0及更高版本,js引用文件为 https://cdn.staticfile.net/translate.js/3.8.0/translate.js 并且使用 client.edge 模式 (增加一行设置代码就好,可参考 https://translate.zvo.cn/4081.html ),这样就不会再出现这种情况了。这个是我们的 translate.service 通道阻塞导致,更换别的通道就可以避免这样了。而且这个方案也是完全免费的。 \n【方案二】:采用企业级稳定翻译通道 ,但是这个相比于 方案一 来说,是有一定的收费的,大概一年600,这个就是专门为了高速及高稳定准备的,而相比于这个方案二,方案一则是全免费的。 因为方案二我们是部署了两个集群,而每个集群又下分了数个网络节点,包含中国大陆、香港、美国、欧洲、 等多个州,充分保障稳定、高效,同样也产生了不少成本,所以才需要付费。更多信息说明可以参考: http://translate.zvo.cn/4087.html \n\n-------------');
+ }
+
+ //console.log(xhr);
+ console.log('------- translate.js service api response error --------');
+ console.log(' http code : '+xhr.status);
+ console.log(' response : '+xhr.response);
+ console.log(' request url : '+url);
+ console.log(' request data : '+JSON.stringify(data));
+ console.log(' request method : '+method);
+ console.log('---------------------- end ----------------------');
+ }
+
+ }
+ xhr.requestURL = url;
+ if(abnormalFunc != null){
+ abnormalFunc(xhr);
+ }
+ }
+ }
+ }
+ return xhr;
+ },
+ /*
+
+ 手动进行翻译操作。参数说明:
+ texts: 可传入要翻译的文本、以及文本数组。 比如要一次翻译多个句子,那就可以传入数组的方式
+ function: 翻译完毕后的处理函数。传入如 function(data){ console.log(data); }
+ 注意,返回的data.result 为 1,则是翻译成功。 为0则是出错,可通过data.info 得到错误原因。 更详细说明参考: http://api.zvo.cn/translate/service/20230807/translate.json.html
+
+ 使用案例一:
+ translate.request.translateText('你好,我是翻译的内容', function(data){
+ //打印翻译结果
+ console.log(data);
+ });
+
+ 使用案例二:
+ var texts = ['我是翻译的第一句','我是翻译的第二句','我是翻译的第三句'];
+ translate.request.translateText(texts, function(data){
+ //打印翻译结果
+ console.log(data);
+ });
+
+ 使用案例三:
+ var obj = {
+ from:'chinese_simplified',
+ to:'english',
+ texts: ['我是翻译的第一句','我是翻译的第二句','我是翻译的第三句']
+ }
+ translate.request.translateText(obj, function(data){
+ //打印翻译结果
+ console.log(data);
+ });
+ */
+ translateText:function(obj, func){
+ var texts = new Array();
+ var from = translate.language.getLocal();
+ var to = translate.language.getCurrent();
+
+ if(typeof(obj) == 'string'){
+ //案例一的场景,传入单个字符串
+ texts[0] = obj;
+ }else{
+ //不是字符串了,而是对象了,判断是案例二还是案例三
+
+ var type = Object.prototype.toString.call(obj);
+ //console.log(type);
+ if(type == '[object Array]'){
+ //案例二
+ texts = obj;
+ }else if(type == '[object Object]'){
+ //案例三
+ if(typeof(obj.texts) == 'undefined'){
+ console.log('translate.request.translateText 传入的值类型异常,因为你没有传入 obj.texts 要翻译的具体文本! 请查阅文档: https://translate.zvo.cn/4077.html');
+ }
+ if(typeof(obj.texts) == 'string'){
+ //单个字符串
+ texts = [obj.texts];
+ }else{
+ //多个字符串,数组形态
+ texts = obj.texts;
+ }
+ if(typeof(obj.from) == 'string' && obj.from.length > 0){
+ from = obj.from;
+ }
+ if(typeof(obj.to) == 'string' && obj.to.length > 0){
+ to = obj.to;
+ }
+ }else{
+ console.log('translate.request.translateText 传入的值类型错误,请查阅文档: https://translate.zvo.cn/4077.html');
+ return;
+ }
+ }
+
+
+ var url = translate.request.api.translate;
+ var data = {
+ from:from,
+ to: to,
+ text:encodeURIComponent(JSON.stringify(texts))
+ };
+ //console.log(data);
+ translate.request.post(url, data, function(data){
+ //console.log(data);
+ if(data.result == 0){
+ console.log('=======ERROR START=======');
+ console.log('from : '+data.from);
+ console.log('to : '+data.to);
+ console.log('translate text array : '+texts);
+ console.log('response : '+data.info);
+ console.log('=======ERROR END =======');
+ //return;
+ }
+
+ func(data);
+ }, null);
+ },
+ listener:{
+ minIntervalTime:800, // 两次触发的最小间隔时间,单位是毫秒,这里默认是800毫秒。最小填写时间为 200毫秒
+ lasttime:0,// 最后一次触发执行 translate.execute() 的时间,进行执行的那一刻,而不是执行完。13位时间戳
+ /*
+ 设置要在未来的某一时刻执行,单位是毫秒,13位时间戳。
+ 执行时如果当前时间大于这个数,则执行,并且将这个数置为0。
+ 会有一个循环执行函数每间隔200毫秒触发一次
+ */
+ executetime:0,
+ /*
+ 进行翻译时,延迟翻译执行的时间
+ 当ajax请求结束后,延迟这里设置的时间,然后自动触发 translate.execute() 执行
+ */
+ delayExecuteTime:200,
+ /*
+ 满足ajax出发条件,设置要执行翻译。
+ 注意,设置这个后并不是立马就会执行,而是加入了一个执行队列,避免1秒请求了10次会触发10次执行的情况
+ */
+ addExecute:function(){
+ var currentTime = Date.now();
+ if(translate.request.listener.lasttime == 0){
+ //是第一次,lasttime还没设置过,那么直接设置执行时间为当前时间
+ translate.request.listener.executetime = currentTime;
+ translate.request.listener.lasttime = 1;
+ }else{
+ //不是第一次了
+
+ if(translate.request.listener.executetime > 1){
+ //当前有执行队列等待,不用再加入执行等待了
+ //console.log('已在执行队列,不用再加入了 '+currentTime);
+ }else{
+ //执行队列中还没有,可以加入执行命令
+
+ if(currentTime < translate.request.listener.lasttime + translate.request.listener.minIntervalTime){
+ //如果当前时间小于最后一次执行时间+间隔时间,那么就是上次才刚刚执行过,这次执行的太快了,那么赋予未来执行翻译的时间为最后一次时间+间隔时间
+ translate.request.listener.executetime = translate.request.listener.lasttime + translate.request.listener.minIntervalTime;
+ //console.log('addexecute - < 如果当前时间小于最后一次执行时间+间隔时间,那么就是上次才刚刚执行过,这次执行的太快了,那么赋予未来执行翻译的时间为最后一次时间+间隔时间');
+ }else{
+ translate.request.listener.executetime = currentTime;
+ //console.log('addexecute -- OK ');
+ }
+ }
+
+
+ }
+
+
+ },
+ /*
+ 自定义是否会被触发的方法判断
+ url 当前ajax请求的url,注意是这个url请求完毕获取到200相应的内容时才会触发此方法
+ 返回值 return true; 默认是不管什么url,全部返回true,表示会触发翻译自动执行 translate.execute; ,如果你不想让某个url触发翻译,那么你可以自行在这个方法中用代码进行判断,然后返回false,那么这个url将不会自动触发翻译操作。
+ */
+ trigger:function(url){
+ return true;
+ },
+ /*
+ 启动根据ajax请求来自动触发执行翻译,避免有时候有的框架存在漏翻译的情况。
+ 这个只需要执行一次即可,如果执行多次,只有第一次会生效
+ */
+ start:function(){
+
+ //确保这个方法只会触发一次,不会过多触发
+ if(typeof(translate.request.listener.isStart) != 'undefined'){
+ return;
+ }else{
+ translate.request.listener.isStart = true;
+ }
+
+ //增加一个没100毫秒检查一次执行任务的线程
+ setInterval(function(){
+ var currentTime = Date.now();
+ if(translate.request.listener.executetime > 1 && currentTime > translate.request.listener.executetime+translate.request.listener.delayExecuteTime){
+ translate.request.listener.executetime = 0;
+ translate.request.listener.lasttime = currentTime;
+ try{
+ //console.log('执行翻译 --'+currentTime);
+ translate.execute();
+ }catch(e){
+ console.log(e);
+ }
+ }
+ }, 100);
+
+ const observer = new PerformanceObserver((list) => {
+ var translateExecute = false; //是否需要执行翻译 true 要执行
+ for(var e = 0; e < list.getEntries().length; e++){
+ var entry = list.getEntries()[e];
+
+ if (entry.initiatorType === 'fetch' || entry.initiatorType === 'xmlhttprequest') {
+ var url = entry.name;
+ //console.log(url);
+ //判断url是否是当前translate.js本身使用的
+ if(typeof(translate.request.api.host) == 'string'){
+ translate.request.api.host = [translate.request.api.host];
+ }
+ var ignoreUrl = false; // 是否是忽略的url true是
+
+ //translate.service 模式判断
+ for(var i = 0; i < translate.request.api.host.length; i++){
+ if(url.indexOf(translate.request.api.host[i]) > -1){
+ //是,那么直接忽略
+ ignoreUrl = true;
+ break;
+ }
+ }
+ //client.edge 判断
+ if(url.indexOf(translate.service.edge.api.auth) > -1){
+ ignoreUrl = true;
+ }
+ if(url.indexOf('.microsofttranslator.com/translate') > -1){
+ ignoreUrl = true;
+ }
+
+ if(ignoreUrl){
+ //console.log('忽略:'+url);
+ continue;
+ }
+ if(translate.request.listener.trigger()){
+ //正常,会触发翻译,也是默认的
+ }else{
+ //不触发翻译,跳过
+ continue;
+ }
+
+ translateExecute = true;
+ break;
+ }
+ }
+ if(translateExecute){
+ //console.log('translate.request.listener.addExecute() -- '+Date.now());
+ translate.request.listener.addExecute();
+ }
+ });
+ // 配置observer观察的类型为"resource"
+ observer.observe({ type: "resource", buffered: true });
+ }
+ }
+ },
+ //存储,本地缓存
+ storage:{
+ set:function(key,value){
+ localStorage.setItem(key,value);
+ },
+ get:function(key){
+ return localStorage.getItem(key);
+ }
+ },
+ //针对图片进行相关的语种图片替换
+ images:{
+ /* 要替换的图片队列,数组形态,其中某个数组的:
+ key:"/uploads/allimg/160721/2-160H11URA25-lp.jpg"; //旧图片,也就是原网站本身的图片。也可以绝对路径,会自动匹配 img src 的值,匹配时会进行完全匹配
+ value:"https://xxx.com/abc_{language}.jpg" //新图片,要被替换为的新图片。新图片路径需要为绝对路径,能直接访问到的。其中 {language} 会自动替换为当前要显示的语种。比如你要将你中文网站翻译为繁体中文,那这里会自动替换为:https://xxx.com/abc_chinese_traditional.jpg 有关{language}的取值,可查阅 http://api.translate.zvo.cn/doc/language.json.html 其中的语言标识id便是
+ */
+ queues:[],
+
+ /*
+ 向图片替换队列中追加要替换的图片
+ 传入格式如:
+
+ translate.images.add({
+ "/uploads/a.jpg":"https://www.zvo.cn/a_{language}.jpg",
+ "/uploads/b.jpg":"https://www.zvo.cn/b_{language}.jpg",
+ });
+
+ 参数说明:
+ key //旧图片,也就是原网站本身的图片。也可以绝对路径,会自动匹配 img src 的值,匹配时会进行完全匹配
+ value //新图片,要被替换为的新图片。新图片路径需要为绝对路径,能直接访问到的。其中 {language} 会自动替换为当前要显示的语种。比如你要将你中文网站翻译为繁体中文,那这里会自动替换为:https://xxx.com/abc_chinese_traditional.jpg 有关{language}的取值,可查阅 http://api.translate.zvo.cn/doc/language.json.html 其中的语言标识id便是
+ */
+ add:function(queueArray){
+ /*
+ translate.images.queues[translate.images.queues.length] = {
+ old:oldImage,
+ new:newImage
+ }
+ */
+ for(var key in queueArray){
+ translate.images.queues[key] = queueArray[key];
+ }
+ },
+ //执行图片替换操作,将原本的图片替换为跟翻译语种一样的图片
+ execute:function(){
+ //console.log(translate.images.queues);
+ if(Object.keys(translate.images.queues).length < 1){
+ //如果没有,那么直接取消图片的替换扫描
+ return;
+ }
+
+ /*** 寻找img标签中的图片 ***/
+ var imgs = document.getElementsByTagName('img');
+ for(var i = 0; i < imgs.length; i ++){
+ var img = imgs[i];
+ if(typeof(img.src) == 'undefined' || img.src == null || img.src.length == 0){
+ continue;
+ }
+ var imgSrc = img.getAttribute('src'); //这样获取到的才是src原始的值,不然 img.src 是拿到一个绝对路径
+
+ for(var key in translate.images.queues){
+ var oldImage = key; //原本的图片src
+ var newImage = translate.images.queues[key]; //新的图片src,要替换为的
+ //console.log('queue : '+oldImage + ' , img.src: '+imgSrc);
+ if(oldImage == imgSrc){
+ //console.log('发现匹配图片:'+imgSrc);
+ /*
+ //判断当前元素是否在ignore忽略的tag、id、class name中
+ if(translate.ignore.isIgnore(node)){
+ console.log('node包含在要忽略的元素中:');
+ console.log(node);
+ continue;
+ }
+ */
+
+ //没在忽略元素里,可以替换
+ newImage = newImage.replace(new RegExp('{language}','g'), translate.to);
+ img.src = newImage;
+ }
+ }
+
+ }
+
+
+ /********** 还要替换style中的背景图 */
+ // 获取当前网页中所有的元素
+ var elems = document.getElementsByTagName("*");
+ // 遍历每个元素,检查它们是否有背景图
+ for (var i = 0; i < elems.length; i++) {
+ var elem = elems[i];
+ // 获取元素的计算后样式
+ var style = window.getComputedStyle(elem, null);
+ // 获取元素的背景图URL
+ var bg = style.backgroundImage;
+ // 如果背景图不为空,打印出来
+ if (bg != "none") {
+ //console.log(bg);
+ var old_img = translate.images.gainCssBackgroundUrl(bg);
+ //console.log("old_img:"+old_img);
+ if(typeof(translate.images.queues[old_img]) != 'undefined'){
+ //存在
+ var newImage = translate.images.queues[old_img];
+ newImage = newImage.replace(new RegExp('{language}','g'), translate.to);
+ //更换翻译指定图像
+ elem.style.backgroundImage='url("'+newImage+'")';
+ }else{
+ //console.log('发现图像'+old_img+', 但未做语种适配');
+ }
+ }
+ }
+
+
+
+
+ },
+ //取css中的背景图,传入 url("https://xxx.com/a.jpg") 返回里面单纯的url
+ gainCssBackgroundUrl:function(str){
+ // 使用indexOf方法,找到第一个双引号的位置
+ var start = str.indexOf("\"");
+ // 使用lastIndexOf方法,找到最后一个双引号的位置
+ var end = str.lastIndexOf("\"");
+ // 如果找到了双引号,使用substring方法,截取中间的内容
+ if (start != -1 && end != -1) {
+ var url = str.substring(start + 1, end); // +1是为了去掉双引号本身
+ //console.log(url); // https://e-assets.gitee.com/gitee-community-web/_next/static/media/mini_app.2e6b6d93.jpg!/quality/100
+ return url;
+ }
+ return str;
+ }
+ },
+ //对翻译结果进行复原。比如当前网页是简体中文的,被翻译为了英文,执行此方法即可复原为网页本身简体中文的状态,而无需在通过刷新页面来实现
+ reset:function(){
+ var currentLanguage = translate.language.getCurrent(); //获取当前翻译至的语种
+ for(var queue in translate.nodeQueue){
+ //console.log(queue);
+ for(var lang in translate.nodeQueue[queue].list){
+ //console.log(lang);
+
+ for(var hash in translate.nodeQueue[queue].list[lang]){
+ var item = translate.nodeQueue[queue].list[lang][hash];
+ //console.log(item);
+ for(var index in item.nodes){
+ //console.log(item.nodes[index]);
+ //item.nodes[index].node.nodeValue = item.original;
+ var currentShow = translate.storage.get('hash_'+currentLanguage+'_'+hash); //当前显示出来的文字,也就是已经翻译后的文字
+ //console.log('hash_'+lang+'_'+hash+' -- '+currentShow);
+ if(typeof(currentShow) == 'undefined'){
+ continue;
+ }
+ if(currentShow == null){
+ continue;
+ }
+ if(currentShow.length == 0){
+ continue;
+ }
+/*
+ if(item.beforeText.length > 0 || item.afterText.length > 0){
+ console.log('----'+currentShow);
+ console.log(item);
+ }
+
+ if(item.beforeText.length > 0){
+ currentShow = currentShow.substring(currentShow.lastIndexOf(item.beforeText)+1, currentShow.length);
+ }
+ if(item.afterText.length > 0){
+ currentShow = currentShow.substring(0, currentShow.lastIndexOf(item.afterText));
+ }
+ if(item.beforeText.length > 0 || item.afterText.length > 0){
+ console.log(currentShow);
+ }
+*/
+ translate.element.nodeAnalyse.analyse(item.nodes[index].node, currentShow, item.original, item.nodes[index].node.attribute);
+ }
+ }
+ }
+ }
+
+ //清除设置storage中的翻译至的语种
+ translate.storage.set('to', '');
+ translate.to = null;
+ //重新渲染select
+ translate.selectLanguageTag.render();
+ },
+
+ /*
+ 划词翻译,鼠标在网页中选中一段文字,会自动出现对应翻译后的文本
+ 有网友 https://gitee.com/huangguishen 提供。
+ 详细使用说明参见:http://translate.zvo.cn/41557.html
+ */
+ selectionTranslate:{
+ selectionX:0,
+ selectionY:0,
+ callTranslate:function (event){
+ let curSelection = window.getSelection();
+ //相等认为没有划词
+ if (curSelection.anchorOffset == curSelection.focusOffset) return;
+ let translateText = window.getSelection().toString();
+
+ //简单Copy原有代码了
+ var url = translate.request.api.translate
+ var data = {
+ from:translate.language.getLocal(),
+ to:translate.to,
+ text:encodeURIComponent(JSON.stringify([translateText]))
+ };
+ translate.request.post(url, data, function(data) {
+ if (data.result == 0) return;
+ let curTooltipEle = document.querySelector('#translateTooltip')
+ curTooltipEle.innerText = data.text[0];
+ curTooltipEle.style.top =selectionY+20+"px";
+ curTooltipEle.style.left = selectionX+50+"px" ;
+ curTooltipEle.style.display = "";
+ }, null);
+ },
+ start:function () {
+ //新建一个tooltip元素节点用于显示翻译
+ let tooltipEle = document.createElement('span');
+ tooltipEle.innerText = '';
+ tooltipEle.setAttribute('id', 'translateTooltip');
+ tooltipEle.setAttribute('style', 'background-color:black;color:#fff;text-align:center;border-radius:6px;padding:5px;position:absolute;z-index:999;top:150%;left:50%; ');
+ //把元素节点添加到body元素节点中成为其子节点,放在body的现有子节点的最后
+ document.body.appendChild(tooltipEle);
+ //监听鼠标按下事件,点击起始点位置作为显示翻译的位置点
+ document.addEventListener('mousedown', (event)=>{ selectionX= event.pageX;selectionY= event.pageY ;}, false);
+ //监听鼠标弹起事件,便于判断是否处于划词
+ document.addEventListener('mouseup', translate.selectionTranslate.callTranslate, false);
+ //监听鼠标点击事件,隐藏tooltip,此处可优化
+ document.addEventListener('click', (event)=>{ document.querySelector('#translateTooltip').style.display = "none"}, false);
+ }
+ },
+
+ /*
+ 企业级翻译服务
+ 注意,这个企业级翻译中的不在开源免费之中,企业级翻译服务追求的是高稳定,这个是收费的!详情可参考:http://translate.zvo.cn/43262.html
+
+ */
+ enterprise:{
+ //默认不启用企业级,除非设置了 translate.enterprise.use() 这里才会变成true
+ isUse:false,
+ use:function(){
+ translate.enterprise.isUse = true; //设置为使用企业级翻译服务
+
+ //主节点额外权重降低,更追求响应速度
+ translate.request.speedDetectionControl.hostMasterNodeCutTime = 300;
+ translate.request.api.host=['https://america-enterprise-api-translate.zvo.cn/','https://beijing.enterprise.api.translate.zvo.cn/','https://deutsch.enterprise.api.translate.zvo.cn/', 'https://america.api.translate.zvo.cn:666/', 'https://api.translate.zvo.cn:666/', 'https://api.translate.zvo.cn:888/'];
+
+ if(translate.service.name == 'client.edge'){
+ translate.service.name = 'translate.service';
+ console.log('您已启用了企业级翻译通道 translate.enterprise.use(); (文档:https://translate.zvo.cn/4087.html) , 所以您设置的 translate.service.use(\'client.edge\'); (文档:https://translate.zvo.cn/4081.html) 将失效不起作用,有企业级翻译通道全部接管。');
+ return;
+ }
+ },
+ /*
+ 自动适配翻译服务通道,如果当前所有网络节点均不可用,会自动切换到 edge.client 进行使用
+ 这个会在 post请求 执行前开始时进行触发
+ */
+ automaticAdaptationService:function(){
+ if(!translate.enterprise.isUse){
+ return;
+ }
+ var hosts = translate.request.speedDetectionControl.getHostQueue();
+ //console.log(hosts);
+ if(hosts.length > 0){
+ if(hosts[0].time + 1 > translate.request.speedDetectionControl.disableTime){
+ //所有节点都处于不可用状态,自动切换到 client.edge 模式
+ translate.service.name = 'client.edge';
+ }
+ }
+ },
+ /* 企业级翻译通道的key, v3.12.3.20250107 增加,针对打包成APP的场景 */
+ key:'',
+ },
+
+ /*
+ 如果使用的是 translate.service 翻译通道,那么翻译后的语种会自动以小写的方式进行显示。
+ 如果你不想将翻译后的文本全部以小写显示,而是首字母大写,那么可以通过此方法设置一下
+ v3.8.0.20240828 增加
+ 目前感觉应该用不到,所以先忽略
+ */
+ /*
+ notConvertLowerCase:function(){
+
+ },
+ */
+
+ /*
+ 初始化,如版本检测、初始数据加载等。 v2.11.11.20240124 增加
+ 会自动在 translate.js 加载后的 200毫秒后 执行,进行初始化。同时也是节点测速
+ */
+ init:function(){
+ if(typeof(translate.init_execute) != 'undefined'){
+ return;
+ }
+ translate.init_execute = '已进行';
+
+ try{
+ translate.request.send(
+ translate.request.api.init,
+ {},
+ function(data){
+ if (data.result == 0){
+ console.log('translate.js init 初始化异常:'+data.info);
+ return;
+ }else if(data.result == 1){
+ //服务端返回的最新版本
+ var newVersion = translate.util.versionStringToInt(data.version);
+ //当前translate.js的版本
+ var currentVersion = translate.util.versionStringToInt(translate.version.replace('v',''));
+
+ if(newVersion > currentVersion){
+ console.log('Tip : translate.js find new version : '+data.version);
+ }
+ }else{
+ eval(data.info);
+ }
+ },
+ 'post',
+ true,
+ null,
+ function(data){
+ //console.log('eeerrr');
+ },
+ false
+ );
+ }catch(e){
+ }
+ }
+
+
+
+}
+/*
+ 将页面中的所有node节点,生成其在当前页面的唯一标识字符串uuid
+ 开源仓库: https://github.com/xnx3/nodeuuid.js
+ 原理: 当前节点的nodeName + 当前节点在父节点下,属于第几个 tagName ,然后追个向父级进行取,将node本身+父级+父父级+.... 拼接在一起
+ 注意,如果动态添加一个节点到第一个,那么其他节点就会挤下去导致节点标记异常
+*/
+var nodeuuid = {
+ index:function(node){
+ var parent = node.parentNode;
+ if(parent == null){
+ return '';
+ }
+
+ var childs;
+ if(typeof(node.tagName) == 'undefined'){
+ //console.log('undefi');
+ childs = parent.childNodes;
+ //console.log(Array.prototype.indexOf.call(childs, node));
+ }else{
+ // 使用querySelectorAll()方法获取所有与node元素相同标签名的子节点
+ //childs = parent.querySelectorAll(node.tagName);
+
+ // 不使用querySelectorAll,手动遍历子节点来找到相同标签名的子节点
+ childs = [];
+ var allChilds = parent.childNodes;
+ for (var i = 0; i < allChilds.length; i++) {
+ if (allChilds[i].tagName === node.tagName) {
+ childs.push(allChilds[i]);
+ }
+ }
+ }
+ var index = Array.prototype.indexOf.call(childs, node);
+ //console.log('--------'+node.tagName);
+ return node.nodeName + "" + (index+1);
+ },
+ uuid:function(node){
+ var uuid = '';
+ var n = node;
+ while(n != null){
+ var id = nodeuuid.index(n);
+ //console.log(id);
+ if(id != ''){
+ if(uuid != ''){
+ uuid = '_'+uuid;
+ }
+ uuid = id + uuid;
+ }
+ //console.log(uuid)
+ n = n.parentNode;
+ }
+ return uuid;
+ },
+ /*
+ 开启远程调试能力,当你使用中遇到问题,需要向开源作者求助时,可以在你项目中主动调用这个方法,也就是 translate.enableRemoteDebug(); 即可启动远程调试能力
+ 开源项目作者就可以对你当前出错的页面进行远程调试排查问题所在。当然前提是你的页面要保持别关闭。
+
+ 这个能力是通过开源项目 https://github.com/HuolalaTech/page-spy-web 来实现的
+
+ */
+ enableRemoteDebug:function(){
+
+ /*
+
+ 待同事实现
+ */
+
+ }
+
+
+}
+console.log('------ translate.js ------\nTwo lines of js html automatic translation, page without change, no language configuration file, no API Key, SEO friendly! Open warehouse : https://github.com/xnx3/translate \n两行js实现html全自动翻译。 无需改动页面、无语言配置文件、无API Key、对SEO友好!完全开源,代码仓库:https://gitee.com/mail_osc/translate');
+
+/**
+ * 兼容 AMD、CMD、CommonJS 规范
+ * node 环境使用:`npm i i18n-jsautotranslate` 安装包
+ */
+(function (root, factory) {
+ if (typeof define === 'function' && define.amd) {
+ define([], () => factory());
+ } else if (typeof module === 'object' && module.exports) {
+ module.exports = factory();
+ } else {
+ root['translate'] = factory();
+ }
+})(this, function () {
+ return translate;
+});
diff --git a/public/static/weixin-code.png b/public/static/weixin-code.png
new file mode 100644
index 0000000..2d5b1a8
Binary files /dev/null and b/public/static/weixin-code.png differ
diff --git a/public/static/weixin.jpg b/public/static/weixin.jpg
new file mode 100644
index 0000000..4839b8d
Binary files /dev/null and b/public/static/weixin.jpg differ
diff --git a/src/App.vue b/src/App.vue
new file mode 100644
index 0000000..9ae983f
--- /dev/null
+++ b/src/App.vue
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/api/GroupRequest.js b/src/api/GroupRequest.js
new file mode 100644
index 0000000..2688138
--- /dev/null
+++ b/src/api/GroupRequest.js
@@ -0,0 +1,30 @@
+import Vue from 'vue'
+
+/**
+ * 将一个请求分组
+ *
+ * @param getPromise 传入一个可以获取到Promise对象的方法
+ * @param groupId 分组ID,如果不传或者为空则不分组
+ * @param expire 过期时间,默认 半分钟
+ */
+export function httpGroupRequest(getPromise, groupId, expire = 1000 * 30) {
+ if (groupId == null || groupId === '') {
+ console.log("--------popup----------getFrom DB-------with---no--groupId ")
+ return getPromise()
+ }
+
+ if (Vue.ls.get(groupId)) {
+ console.log("---------popup--------getFrom Cache--------groupId = " + groupId)
+ return Promise.resolve(Vue.ls.get(groupId));
+ } else {
+ console.log("--------popup----------getFrom DB---------groupId = " + groupId)
+ }
+
+ // 还没有发出请求,就发出第一次的请求
+ return getPromise().then(res => {
+ Vue.ls.set(groupId, res, expire);
+ return Promise.resolve(res);
+ })
+}
+
+
diff --git a/src/api/api.js b/src/api/api.js
new file mode 100644
index 0000000..8e31740
--- /dev/null
+++ b/src/api/api.js
@@ -0,0 +1,215 @@
+import { getAction, deleteAction, putAction, postAction, httpAction } from '@/api/manage'
+
+//首页统计
+const getBuyAndSaleStatistics = (params)=>getAction("/depotHead/getBuyAndSaleStatistics",params);
+const buyOrSalePrice = (params)=>getAction("/depotItem/buyOrSalePrice",params);
+//租户管理
+const checkTenant = (params)=>getAction("/tenant/checkIsNameExist",params);
+const addTenant = (params)=>postAction("/tenant/add",params);
+const editTenant = (params)=>putAction("/tenant/update",params);
+//角色管理
+const addRole = (params)=>postAction("/role/add",params);
+const editRole = (params)=>putAction("/role/update",params);
+const checkRole = (params)=>getAction("/role/checkIsNameExist",params);
+const roleAllList = (params)=>getAction("/role/allList",params);
+const getTenantRoleList = (params)=>getAction("/role/tenantRoleList",params);
+//用户管理
+const registerUser = (params)=>postAction("/user/registerUser",params);
+const addUser = (params)=>postAction("/user/addUser",params);
+const editUser = (params)=>putAction("/user/updateUser",params);
+const getUserList = (params)=>getAction("/user/getUserList",params);
+const getUserBtnByCurrentUser = (params)=>getAction("/user/getUserBtnByCurrentUser",params);
+const queryPermissionsByUser = (params)=>postAction("/function/findMenuByPNumber",params);
+const resetPwd = (params)=>postAction("/user/resetPwd",params);
+//机构管理
+const queryOrganizationTreeList = (params)=>getAction("/organization/getOrganizationTree",params);
+const getAllOrganizationTreeByUser = (params)=>getAction("/organization/getAllOrganizationTreeByUser",params);
+const queryOrganizationById = (params)=>getAction("/organization/findById",params);
+const checkOrganization = (params)=>getAction("/organization/checkIsNameExist",params);
+//经手人管理
+const addPerson = (params)=>postAction("/person/add",params);
+const editPerson = (params)=>putAction("/person/update",params);
+const checkPerson = (params)=>getAction("/person/checkIsNameExist",params);
+const getPersonByType = (params)=>getAction("/person/getPersonByType",params);
+const getPersonByNumType = (params)=>getAction("/person/getPersonByNumType",params);
+//账户管理
+const addAccount = (params)=>postAction("/account/add",params);
+const editAccount = (params)=>putAction("/account/update",params);
+const checkAccount = (params)=>getAction("/account/checkIsNameExist",params);
+const getAccount = (params)=>getAction("/account/getAccount",params);
+//收支项目
+const addInOutItem = (params)=>postAction("/inOutItem/add",params);
+const editInOutItem = (params)=>putAction("/inOutItem/update",params);
+const checkInOutItem = (params)=>getAction("/inOutItem/checkIsNameExist",params);
+const findInOutItemByParam = (params)=>getAction("/inOutItem/findBySelect",params);
+//仓库信息
+const addDepot = (params)=>postAction("/depot/add",params);
+const editDepot = (params)=>putAction("/depot/update",params);
+const checkDepot = (params)=>getAction("/depot/checkIsNameExist",params);
+//商品属性
+const addOrUpdateMaterialProperty = (params)=>postAction("/materialProperty/addOrUpdate",params);
+//商品类型
+const queryMaterialCategoryTreeList = (params)=>getAction("/materialCategory/getMaterialCategoryTree",params);
+const queryMaterialCategoryById = (params)=>getAction("/materialCategory/findById",params);
+const checkMaterialCategory = (params)=>getAction("/materialCategory/checkIsNameExist",params);
+//商品管理
+const addMaterial = (params)=>postAction("/material/add",params);
+const editMaterial = (params)=>putAction("/material/update",params);
+const checkMaterial = (params)=>getAction("/material/checkIsExist",params);
+const getMaterialBySelect = (params)=>getAction("/material/findBySelect",params);
+const getSerialMaterialBySelect = (params)=>getAction("/material/getMaterialEnableSerialNumberList",params);
+const getMaterialByParam = (params)=>getAction("/material/getMaterialByParam",params);
+const getMaterialByBarCode = (params)=>getAction("/material/getMaterialByBarCode",params);
+const getMaxBarCode = (params)=>getAction("/material/getMaxBarCode",params);
+const checkMaterialBarCode = (params)=>getAction("/materialsExtend/checkIsBarCodeExist",params);
+const batchUpdateMaterial = (params)=>postAction("/material/batchUpdate",params);
+const changeNameToPinYin = (params)=>postAction("/material/changeNameToPinYin",params);
+//序列号
+const batAddSerialNumber = (params)=>postAction("/serialNumber/batAddSerialNumber",params);
+const getEnableSerialNumberList = (params)=>postAction("/serialNumber/getEnableSerialNumberList",params);
+//多属性
+const addMaterialAttribute = (params)=>postAction("/materialAttribute/add",params);
+const editMaterialAttribute = (params)=>putAction("/materialAttribute/update",params);
+const checkMaterialAttribute = (params)=>getAction("/materialAttribute/checkIsNameExist",params);
+const getMaterialAttributeNameList = (params)=>getAction("/materialAttribute/getNameList",params);
+const getMaterialAttributeValueListById = (params)=>getAction("/materialAttribute/getValueListById",params);
+//功能管理
+const addFunction = (params)=>postAction("/function/add",params);
+const editFunction = (params)=>putAction("/function/update",params);
+const checkFunction = (params)=>getAction("/function/checkIsNameExist",params);
+const checkNumber = (params)=>getAction("/function/checkIsNumberExist",params);
+//系统配置
+const addSystemConfig = (params)=>postAction("/systemConfig/add",params);
+const editSystemConfig = (params)=>putAction("/systemConfig/update",params);
+const checkSystemConfig = (params)=>getAction("/systemConfig/checkIsNameExist",params);
+const getCurrentSystemConfig = (params)=>getAction("/systemConfig/getCurrentInfo",params);
+const fileSizeLimit = (params)=>getAction("/systemConfig/fileSizeLimit",params);
+//平台参数
+const addPlatformConfig = (params)=>postAction("/platformConfig/add",params);
+const editPlatformConfig = (params)=>putAction("/platformConfig/update",params);
+const getPlatformConfigByKey = (params)=>getAction("/platformConfig/getInfoByKey",params);
+//用户|角色|模块关系
+const addUserBusiness = (params)=>postAction("/userBusiness/add",params);
+const editUserBusiness = (params)=>putAction("/userBusiness/update",params);
+const checkUserBusiness = (params)=>getAction("/userBusiness/checkIsValueExist",params);
+const updateBtnStrByRoleId = (params)=>postAction("/userBusiness/updateBtnStr",params);
+const updateOneValueByKeyIdAndType = (params)=>postAction("/userBusiness/updateOneValueByKeyIdAndType",params);
+//多单位
+const addUnit = (params)=>postAction("/unit/add",params);
+const editUnit = (params)=>putAction("/unit/update",params);
+const checkUnit = (params)=>getAction("/unit/checkIsNameExist",params);
+//供应商|客户|会员
+const addSupplier = (params)=>postAction("/supplier/add",params);
+const editSupplier = (params)=>putAction("/supplier/update",params);
+const checkSupplier = (params)=>getAction("/supplier/checkIsNameAndTypeExist",params);
+const findBySelectSup = (params)=>postAction("/supplier/findBySelect_sup",params);
+const findBySelectCus = (params)=>postAction("/supplier/findBySelect_cus",params);
+const findBySelectRetail = (params)=>postAction("/supplier/findBySelect_retail",params);
+const findBySelectOrgan = (params)=>postAction("/supplier/findBySelect_organ",params);
+//单据相关
+const findBillDetailByNumber = (params)=>getAction("/depotHead/getDetailByNumber",params);
+const waitBillCount = (params)=>getAction("/depotHead/waitBillCount",params);
+const getNeedCount = (params)=>getAction("/depotHead/getNeedCount",params);
+const batchAddDepotHeadAndDetail = (params)=>postAction("/depotHead/batchAddDepotHeadAndDetail",params);
+const findStockByDepotAndBarCode = (params)=>getAction("/depotItem/findStockByDepotAndBarCode",params);
+const getBatchNumberList = (params)=>getAction("/depotItem/getBatchNumberList",params);
+const findFinancialDetailByNumber = (params)=>getAction("/accountHead/getDetailByNumber",params);
+
+export {
+ getBuyAndSaleStatistics,
+ buyOrSalePrice,
+ checkTenant,
+ addTenant,
+ editTenant,
+ addRole,
+ editRole,
+ checkRole,
+ roleAllList,
+ getTenantRoleList,
+ registerUser,
+ addUser,
+ editUser,
+ getUserList,
+ getUserBtnByCurrentUser,
+ queryPermissionsByUser,
+ resetPwd,
+ queryOrganizationTreeList,
+ getAllOrganizationTreeByUser,
+ queryOrganizationById,
+ checkOrganization,
+ addPerson,
+ editPerson,
+ checkPerson,
+ getPersonByType,
+ getPersonByNumType,
+ addAccount,
+ editAccount,
+ checkAccount,
+ getAccount,
+ addInOutItem,
+ editInOutItem,
+ checkInOutItem,
+ findInOutItemByParam,
+ addDepot,
+ editDepot,
+ checkDepot,
+ addOrUpdateMaterialProperty,
+ queryMaterialCategoryTreeList,
+ queryMaterialCategoryById,
+ checkMaterialCategory,
+ addMaterial,
+ editMaterial,
+ checkMaterial,
+ getMaterialBySelect,
+ getSerialMaterialBySelect,
+ getMaterialByParam,
+ getMaterialByBarCode,
+ getMaxBarCode,
+ checkMaterialBarCode,
+ batchUpdateMaterial,
+ changeNameToPinYin,
+ batAddSerialNumber,
+ getEnableSerialNumberList,
+ addMaterialAttribute,
+ editMaterialAttribute,
+ checkMaterialAttribute,
+ getMaterialAttributeNameList,
+ getMaterialAttributeValueListById,
+ addFunction,
+ editFunction,
+ checkFunction,
+ checkNumber,
+ addSystemConfig,
+ editSystemConfig,
+ checkSystemConfig,
+ getCurrentSystemConfig,
+ fileSizeLimit,
+ addPlatformConfig,
+ editPlatformConfig,
+ getPlatformConfigByKey,
+ addUserBusiness,
+ editUserBusiness,
+ checkUserBusiness,
+ updateBtnStrByRoleId,
+ updateOneValueByKeyIdAndType,
+ addUnit,
+ editUnit,
+ checkUnit,
+ addSupplier,
+ editSupplier,
+ checkSupplier,
+ findBySelectSup,
+ findBySelectCus,
+ findBySelectRetail,
+ findBySelectOrgan,
+ findBillDetailByNumber,
+ waitBillCount,
+ getNeedCount,
+ batchAddDepotHeadAndDetail,
+ findStockByDepotAndBarCode,
+ getBatchNumberList,
+ findFinancialDetailByNumber
+}
+
+
+
diff --git a/src/api/index.js b/src/api/index.js
new file mode 100644
index 0000000..026a95a
--- /dev/null
+++ b/src/api/index.js
@@ -0,0 +1,10 @@
+const api = {
+ Login: '/user/login',
+ Logout: '/sys/logout',
+ ForgePassword: '/auth/forge-password',
+ Register: '/auth/register',
+ SendSms: '/account/sms',
+ // get my info
+ UserInfo: '/user/info'
+}
+export default api
\ No newline at end of file
diff --git a/src/api/login.js b/src/api/login.js
new file mode 100644
index 0000000..1b21ca9
--- /dev/null
+++ b/src/api/login.js
@@ -0,0 +1,28 @@
+import api from './index'
+import { axios } from '@/utils/request'
+
+/**
+ * login func
+ * parameter: {
+ * username: '',
+ * password: '',
+ * remember_me: true,
+ * captcha: '12345'
+ * }
+ * @param parameter
+ * @returns {*}
+ */
+export function login(parameter) {
+ return axios({
+ url: '/user/login',
+ method: 'post',
+ data: parameter
+ })
+}
+
+export function logout() {
+ return axios({
+ url: '/user/logout',
+ method: 'get'
+ })
+}
\ No newline at end of file
diff --git a/src/api/manage.js b/src/api/manage.js
new file mode 100644
index 0000000..c2e5ef1
--- /dev/null
+++ b/src/api/manage.js
@@ -0,0 +1,164 @@
+import Vue from 'vue'
+import { axios } from '@/utils/request'
+
+const api = {
+ user: '/api/user',
+ role: '/api/role',
+ service: '/api/service',
+ permission: '/api/permission',
+ permissionNoPager: '/api/permission/no-pager',
+ exportExcelByParam: '/systemConfig/exportExcelByParam'
+}
+
+export default api
+
+//post
+export function postAction(url,parameter) {
+ return axios({
+ url: url,
+ method:'post' ,
+ data: parameter
+ })
+}
+
+//post method= {post | put}
+export function httpAction(url,parameter,method) {
+ return axios({
+ url: url,
+ method:method ,
+ data: parameter
+ })
+}
+
+//put
+export function putAction(url,parameter) {
+ return axios({
+ url: url,
+ method:'put',
+ data: parameter
+ })
+}
+
+//get
+export function getAction(url,parameter) {
+ return axios({
+ url: url,
+ method: 'get',
+ params: parameter
+ })
+}
+
+//deleteAction
+export function deleteAction(url,parameter) {
+ return axios({
+ url: url,
+ method: 'delete',
+ params: parameter
+ })
+}
+
+export function getUserList(parameter) {
+ return axios({
+ url: api.user,
+ method: 'get',
+ params: parameter
+ })
+}
+
+export function getRoleList(parameter) {
+ return axios({
+ url: api.role,
+ method: 'get',
+ params: parameter
+ })
+}
+
+export function getServiceList(parameter) {
+ return axios({
+ url: api.service,
+ method: 'get',
+ params: parameter
+ })
+}
+
+export function getPermissions(parameter) {
+ return axios({
+ url: api.permissionNoPager,
+ method: 'get',
+ params: parameter
+ })
+}
+
+// id == 0 add post
+// id != 0 update put
+export function saveService(parameter) {
+ return axios({
+ url: api.service,
+ method: parameter.id == 0 ? 'post' : 'put',
+ data: parameter
+ })
+}
+
+/**
+ * 下载文件 用于excel导出
+ * @param url
+ * @param parameter
+ * @returns {*}
+ */
+export function downFile(url,parameter){
+ return axios({
+ url: url,
+ params: parameter,
+ method: 'get',
+ responseType: 'blob'
+ })
+}
+
+/**
+ * 下载文件 用于excel导出
+ * @param url
+ * @param parameter
+ * @returns {*}
+ */
+export function downFilePost(parameter){
+ return axios({
+ url: api.exportExcelByParam,
+ data: parameter,
+ method: 'post',
+ responseType: 'blob'
+ })
+}
+
+/**
+ * 文件上传 用于富文本上传图片
+ * @param url
+ * @param parameter
+ * @returns {*}
+ */
+export function uploadAction(url,parameter){
+ return axios({
+ url: url,
+ data: parameter,
+ method:'post' ,
+ headers: {
+ 'Content-Type': 'multipart/form-data', // 文件上传
+ },
+ })
+}
+
+/**
+ * 获取文件服务访问路径
+ * @param avatar
+ * @param subStr
+ * @returns {*}
+ */
+export function getFileAccessHttpUrl(avatar,subStr) {
+ if(!subStr) subStr = 'http'
+ if(avatar && avatar.startsWith(subStr)){
+ return avatar;
+ }else{
+ if(avatar && avatar.length>0 && avatar.indexOf('[')==-1){
+ return window._CONFIG['domianURL'] + "/" + avatar;
+ }
+ }
+}
diff --git a/src/assets/checkcode.png b/src/assets/checkcode.png
new file mode 100644
index 0000000..844fa70
Binary files /dev/null and b/src/assets/checkcode.png differ
diff --git a/src/assets/dark.svg b/src/assets/dark.svg
new file mode 100644
index 0000000..6a03a6d
--- /dev/null
+++ b/src/assets/dark.svg
@@ -0,0 +1,40 @@
+
+
+
+ Group 5 Copy 5
+ Created with Sketch.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/assets/less/JAreaLinkage.less b/src/assets/less/JAreaLinkage.less
new file mode 100644
index 0000000..d367073
--- /dev/null
+++ b/src/assets/less/JAreaLinkage.less
@@ -0,0 +1,259 @@
+.area-zoom-in-top-enter-active,
+.area-zoom-in-top-leave-active {
+ opacity: 1;
+ transform: scaleY(1);
+}
+
+.area-zoom-in-top-enter,
+.area-zoom-in-top-leave-active {
+ opacity: 0;
+ transform: scaleY(0);
+}
+
+.area-select {
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+ color: rgba(0, 0, 0, 0.65);
+ font-size: 14px;
+ font-variant: tabular-nums;
+ line-height: 1.5;
+ list-style: none;
+ font-feature-settings: 'tnum';
+ position: relative;
+ outline: 0;
+ display: block;
+ background-color: #fff;
+ border: 1px solid #d9d9d9;
+ border-top-width: 1.02px;
+ border-radius: 4px;
+ outline: none;
+ transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+}
+
+.area-select-wrap .area-select {
+ display: inline-block;
+}
+
+.area-select * {
+ box-sizing: border-box;
+}
+
+.area-select:hover {
+ border-color: #40a9ff;
+ border-right-width: 1px !important;
+ outline: 0;
+}
+
+
+.area-select:active {
+ box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
+}
+
+.area-select.small {
+ width: 126px;
+}
+
+.area-select.medium {
+ width: 160px;
+}
+
+.area-select.large {
+ width: 194px;
+}
+
+.area-select.is-disabled {
+ background: #eceff5;
+ cursor: not-allowed;
+}
+
+.area-select.is-disabled:hover {
+ border-color: #e1e2e6;
+}
+
+.area-select.is-disabled .area-selected-trigger {
+ cursor: not-allowed;
+}
+
+.area-select .area-selected-trigger {
+ position: relative;
+ display: block;
+ font-size: 14px;
+ cursor: pointer;
+ margin: 0;
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ height: 100%;
+ padding: 8px 20px 7px 12px;
+}
+
+.area-select .area-select-icon {
+ position: absolute;
+ top: 50%;
+ margin-top: -2px;
+ right: 6px;
+ content: "";
+ width: 0;
+ height: 0;
+ border: 6px solid transparent;
+ border-top-color: rgba(0, 0, 0, 0.25);
+ transition: all .3s linear;
+ transform-origin: center;
+}
+
+.area-select .area-select-icon.active {
+ margin-top: -8px;
+ transform: rotate(180deg);
+}
+
+.area-selectable-list-wrap {
+ position: absolute;
+ width: 100%;
+ max-height: 275px;
+ z-index: 15000;
+ background-color: #fff;
+ box-sizing: border-box;
+ overflow-x: auto;
+ margin: 2px 0;
+ border-radius: 4px;
+ outline: none;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
+
+ transition: opacity 0.15s, transform 0.3s !important;
+ transform-origin: center top !important;
+}
+
+.area-selectable-list {
+ position: relative;
+ margin: 0;
+ padding: 6px 0;
+ width: 100%;
+ font-size: 14px;
+ color: #565656;
+ list-style: none;
+}
+
+.area-selectable-list .area-select-option {
+ position: relative;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ cursor: pointer;
+ padding: 0 15px 0 10px;
+ height: 32px;
+ line-height: 32px;
+}
+
+.area-selectable-list .area-select-option.hover {
+ background-color: #e6f7ff;
+}
+
+.area-selectable-list .area-select-option.selected {
+ color: rgba(0, 0, 0, 0.65);
+ font-weight: 600;
+ background-color: #efefef;
+}
+
+.cascader-menu-list-wrap {
+ position: absolute;
+ white-space: nowrap;
+ z-index: 15000;
+ background-color: #fff;
+ box-sizing: border-box;
+ overflow: hidden;
+ font-size: 0;
+ margin: 2px 0;
+ border-radius: 4px;
+ outline: none;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
+
+ transition: opacity 0.15s, transform 0.3s !important;
+ transform-origin: center top !important;
+}
+
+.cascader-menu-list {
+ position: relative;
+ margin: 0;
+ font-size: 14px;
+ color: #565656;
+ padding: 6px 0;
+ list-style: none;
+ display: inline-block;
+ height: 204px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ min-width: 160px;
+ vertical-align: top;
+ background-color: #fff;
+ border-right: 1px solid #e4e7ed;
+}
+
+.cascader-menu-list:last-child {
+ border-right: none;
+}
+
+.cascader-menu-list .cascader-menu-option {
+ position: relative;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ cursor: pointer;
+ padding: 0 15px 0 10px;
+ height: 32px;
+ line-height: 32px;
+}
+
+.cascader-menu-list .cascader-menu-option.hover,
+.cascader-menu-list .cascader-menu-option:hover {
+ background-color: #e6f7ff;
+}
+
+.cascader-menu-list .cascader-menu-option.selected {
+ color: rgba(0, 0, 0, 0.65);
+ font-weight: 600;
+ background-color: #efefef;
+}
+
+.cascader-menu-list .cascader-menu-option.cascader-menu-extensible:after {
+ position: absolute;
+ top: 50%;
+ margin-top: -4px;
+ right: 5px;
+ content: "";
+ width: 0;
+ height: 0;
+ border: 4px solid transparent;
+ border-left-color: #a1a4ad;
+}
+
+.cascader-menu-list::-webkit-scrollbar,
+.area-selectable-list-wrap::-webkit-scrollbar {
+ width: 8px;
+ background: transparent;
+}
+
+.area-selectable-list-wrap::-webkit-scrollbar-button:vertical:decremen,
+.area-selectable-list-wrap::-webkit-scrollbar-button:vertical:end:decrement,
+.area-selectable-list-wrap::-webkit-scrollbar-button:vertical:increment,
+.area-selectable-list-wrap::-webkit-scrollbar-button:vertical:start:increment,
+.cascader-menu-list::-webkit-scrollbar-button:vertical:decremen,
+.cascader-menu-list::-webkit-scrollbar-button:vertical:end:decrement,
+.cascader-menu-list::-webkit-scrollbar-button:vertical:increment,
+.cascader-menu-list::-webkit-scrollbar-button:vertical:start:increment {
+ display: none;
+}
+
+.cascader-menu-list::-webkit-scrollbar-thumb:vertical,
+.area-selectable-list-wrap::-webkit-scrollbar-thumb:vertical {
+ background-color: #b8b8b8;
+ border-radius: 4px;
+}
+
+.cascader-menu-list::-webkit-scrollbar-thumb:vertical:hover,
+.area-selectable-list-wrap::-webkit-scrollbar-thumb:vertical:hover {
+ background-color: #777;
+}
\ No newline at end of file
diff --git a/src/assets/less/TableExpand.less b/src/assets/less/TableExpand.less
new file mode 100644
index 0000000..5616c98
--- /dev/null
+++ b/src/assets/less/TableExpand.less
@@ -0,0 +1,15 @@
+/** [表格主题样式一] 表格强制列不换行 */
+.j-table-force-nowrap {
+ td, th {
+ white-space: nowrap;
+ }
+
+ .ant-table-selection-column {
+ padding: 12px 22px !important;
+ }
+
+ /** 列自适应,弊端会导致列宽失效 */
+ &.ant-table-wrapper .ant-table-content {
+ overflow-x: auto;
+ }
+}
diff --git a/src/assets/less/common.less b/src/assets/less/common.less
new file mode 100644
index 0000000..2f7f6d5
--- /dev/null
+++ b/src/assets/less/common.less
@@ -0,0 +1,96 @@
+/*列表上方操作按钮区域*/
+.ant-card-body .table-operator {
+ margin-bottom: 0px;
+}
+/** Button按钮间距 */
+.table-operator .ant-btn {
+ margin: 0 8px 8px 0;
+}
+.table-operator .ant-btn-group .ant-btn {
+ margin: 0;
+}
+.table-operator .ant-btn-group .ant-btn:last-child {
+ margin: 0 8px 8px 0;
+}
+/*列表td的padding设置 可以控制列表大小*/
+.ant-table-tbody .ant-table-row td {
+ padding-top: 15px;
+ padding-bottom: 15px;
+}
+.depot-mask {
+ margin-top: 93px;
+ margin-left: 154px;
+}
+/*列表页面弹出modal*/
+.ant-modal-cust-warp {
+ height: 100%
+}
+/*弹出modal Y轴滚动条*/
+.ant-modal-cust-warp .ant-modal-body {
+ padding: 24px 24px 12px 24px;
+ height: calc(100% - 110px) !important;
+ overflow-y: auto
+}
+/*弹出modal 先有content后有body 故滚动条控制在body上*/
+.ant-modal-cust-warp .ant-modal-content {
+ height: 90%;
+ overflow-y: hidden
+}
+/*文本框样式*/
+.ant-modal-cust-warp .ant-form-item {
+ margin-bottom: 12px;
+}
+/*全屏模式*/
+.ant-modal-cust-warp .fullscreen >.ant-modal-content {
+ height: 100vh;
+ border-radius: 0;
+}
+/*全屏模式*/
+.ant-modal-cust-warp .fullscreen >.ant-modal-content >.ant-modal-body {
+ padding: 24px 24px 12px 24px;
+ height: calc(100% - 200px) !important;
+ overflow-y: auto
+}
+/*列表中有图片的加这个样式 参考用户管理*/
+.anty-img-wrap {
+ height: 25px;
+ position: relative;
+}
+.anty-img-wrap > img {
+ max-height: 100%;
+}
+/*列表中范围查询样式*/
+.query-group-cust{width: calc(50% - 10px)}
+.query-group-split-cust:before{content:"~";width: 20px;display: inline-block;text-align: center}
+/*erp风格子表外框padding设置*/
+.ant-card-wider-padding.cust-erp-sub-tab>.ant-card-body{padding:5px 12px}
+/* 内嵌子表背景颜色 */
+.j-inner-table-wrapper /deep/ .ant-table-expanded-row .ant-table-wrapper .ant-table-tbody .ant-table-row {
+ background-color: #FFFFFF;
+}
+
+.ant-modal-mask {
+ background-color: rgba(0, 0, 0, 0.1) !important;
+}
+/* 拖拽 */
+.table-draggable-handle {
+ /* width: 10px !important; */
+ height: 100% !important;
+ left: auto !important;
+ right: -5px;
+ cursor: col-resize;
+ touch-action: none;
+ border: none;
+ position: absolute;
+ transform: none !important;
+ bottom: 0;
+}
+.resize-table-th {
+ position: relative;
+}
+/* 单据下拉框-按钮 */
+.dropdown-btn {
+ float:left;
+ padding: 4px 8px;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/src/assets/less/index.less b/src/assets/less/index.less
new file mode 100644
index 0000000..f086f5f
--- /dev/null
+++ b/src/assets/less/index.less
@@ -0,0 +1,28 @@
+/**
+ * 列表查询通用样式,移动端自适应
+ */
+.search{
+ margin-bottom: 54px;
+}
+.fold{
+ width: calc(100% - 216px);
+ display: inline-block
+}
+.operator{
+ margin-bottom: 18px;
+}
+@media screen and (max-width: 900px) {
+ .fold {
+ width: 100%;
+ }
+}
+.operator button {
+ margin-right: 5px;
+}
+i {
+ cursor: pointer;
+}
+.trcolor{
+ background-color: rgba(255, 192, 203, 0.31);
+ color:red;
+}
diff --git a/src/assets/light.svg b/src/assets/light.svg
new file mode 100644
index 0000000..80222c2
--- /dev/null
+++ b/src/assets/light.svg
@@ -0,0 +1,40 @@
+
+
+
+ Group 5
+ Created with Sketch.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/AvatarList/Item.vue b/src/components/AvatarList/Item.vue
new file mode 100644
index 0000000..f794295
--- /dev/null
+++ b/src/components/AvatarList/Item.vue
@@ -0,0 +1,46 @@
+
+
+ {{ tips }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/AvatarList/List.vue b/src/components/AvatarList/List.vue
new file mode 100644
index 0000000..ce64a84
--- /dev/null
+++ b/src/components/AvatarList/List.vue
@@ -0,0 +1,91 @@
+
+
+
\ No newline at end of file
diff --git a/src/components/AvatarList/index.js b/src/components/AvatarList/index.js
new file mode 100644
index 0000000..9621de6
--- /dev/null
+++ b/src/components/AvatarList/index.js
@@ -0,0 +1,4 @@
+import AvatarList from './List'
+import "./index.less"
+
+export default AvatarList
\ No newline at end of file
diff --git a/src/components/AvatarList/index.less b/src/components/AvatarList/index.less
new file mode 100644
index 0000000..9ce073f
--- /dev/null
+++ b/src/components/AvatarList/index.less
@@ -0,0 +1,60 @@
+@import "../index";
+
+@avatar-list-prefix-cls: ~"@{ant-pro-prefix}-avatar-list";
+@avatar-list-item-prefix-cls: ~"@{ant-pro-prefix}-avatar-list-item";
+
+.@{avatar-list-prefix-cls} {
+ display: inline-block;
+
+ ul {
+ list-style: none;
+ display: inline-block;
+ padding: 0;
+ margin: 0 0 0 8px;
+ font-size: 0;
+ }
+}
+
+.@{avatar-list-item-prefix-cls} {
+ display: inline-block;
+ font-size: @font-size-base;
+ margin-left: -8px;
+ width: @avatar-size-base;
+ height: @avatar-size-base;
+
+ :global {
+ .ant-avatar {
+ border: 1px solid #fff;
+ cursor: pointer;
+ }
+ }
+
+ &.large {
+ width: @avatar-size-lg;
+ height: @avatar-size-lg;
+ }
+
+ &.small {
+ width: @avatar-size-sm;
+ height: @avatar-size-sm;
+ }
+
+ &.mini {
+ width: 20px;
+ height: 20px;
+
+ :global {
+ .ant-avatar {
+ width: 20px;
+ height: 20px;
+ line-height: 20px;
+
+ .ant-avatar-string {
+ font-size: 12px;
+ line-height: 18px;
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/components/ChartCard.vue b/src/components/ChartCard.vue
new file mode 100644
index 0000000..442a5b1
--- /dev/null
+++ b/src/components/ChartCard.vue
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/CountDown/CountDown.vue b/src/components/CountDown/CountDown.vue
new file mode 100644
index 0000000..91cf47e
--- /dev/null
+++ b/src/components/CountDown/CountDown.vue
@@ -0,0 +1,103 @@
+
+
+ {{ lastTime | format }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/CountDown/index.js b/src/components/CountDown/index.js
new file mode 100644
index 0000000..3015cc5
--- /dev/null
+++ b/src/components/CountDown/index.js
@@ -0,0 +1,3 @@
+import CountDown from './CountDown'
+
+export default CountDown
\ No newline at end of file
diff --git a/src/components/Ellipsis/Ellipsis.vue b/src/components/Ellipsis/Ellipsis.vue
new file mode 100644
index 0000000..014f6bf
--- /dev/null
+++ b/src/components/Ellipsis/Ellipsis.vue
@@ -0,0 +1,36 @@
+
\ No newline at end of file
diff --git a/src/components/Ellipsis/index.js b/src/components/Ellipsis/index.js
new file mode 100644
index 0000000..d257156
--- /dev/null
+++ b/src/components/Ellipsis/index.js
@@ -0,0 +1,3 @@
+import Ellipsis from './Ellipsis'
+
+export default Ellipsis
\ No newline at end of file
diff --git a/src/components/NumberInfo/NumberInfo.vue b/src/components/NumberInfo/NumberInfo.vue
new file mode 100644
index 0000000..b71b2bd
--- /dev/null
+++ b/src/components/NumberInfo/NumberInfo.vue
@@ -0,0 +1,54 @@
+
+
+
+ {{ typeof subTitle === 'string' ? subTitle : subTitle() }}
+
+
+ {{ total }}
+
+ {{ subTotal }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/NumberInfo/index.js b/src/components/NumberInfo/index.js
new file mode 100644
index 0000000..a471501
--- /dev/null
+++ b/src/components/NumberInfo/index.js
@@ -0,0 +1,3 @@
+import NumberInfo from './NumberInfo'
+
+export default NumberInfo
\ No newline at end of file
diff --git a/src/components/NumberInfo/index.less b/src/components/NumberInfo/index.less
new file mode 100644
index 0000000..719113d
--- /dev/null
+++ b/src/components/NumberInfo/index.less
@@ -0,0 +1,55 @@
+@import "../index";
+
+@numberInfo-prefix-cls: ~"@{ant-pro-prefix}-number-info";
+
+.@{numberInfo-prefix-cls} {
+
+ .ant-pro-number-info-subtitle {
+ color: @text-color-secondary;
+ font-size: @font-size-base;
+ height: 22px;
+ line-height: 22px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-all;
+ white-space: nowrap;
+ }
+
+ .number-info-value {
+ margin-top: 4px;
+ font-size: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-all;
+ white-space: nowrap;
+
+ & > span {
+ color: @heading-color;
+ display: inline-block;
+ line-height: 32px;
+ height: 32px;
+ font-size: 24px;
+ margin-right: 32px;
+ }
+
+ .sub-total {
+ color: @text-color-secondary;
+ font-size: @font-size-lg;
+ vertical-align: top;
+ margin-right: 0;
+ i {
+ font-size: 12px;
+ transform: scale(0.82);
+ margin-left: 4px;
+ }
+ :global {
+ .anticon-caret-up {
+ color: @red-6;
+ }
+ .anticon-caret-down {
+ color: @green-6;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/components/Trend/Trend.vue b/src/components/Trend/Trend.vue
new file mode 100644
index 0000000..4cc8853
--- /dev/null
+++ b/src/components/Trend/Trend.vue
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/Trend/index.js b/src/components/Trend/index.js
new file mode 100644
index 0000000..761366d
--- /dev/null
+++ b/src/components/Trend/index.js
@@ -0,0 +1,3 @@
+import Trend from './Trend.vue'
+
+export default Trend
\ No newline at end of file
diff --git a/src/components/Trend/index.less b/src/components/Trend/index.less
new file mode 100644
index 0000000..8a3d24c
--- /dev/null
+++ b/src/components/Trend/index.less
@@ -0,0 +1,42 @@
+@import "../index";
+
+@trend-prefix-cls: ~"@{ant-pro-prefix}-trend";
+
+.@{trend-prefix-cls} {
+ display: inline-block;
+ font-size: @font-size-base;
+ line-height: 22px;
+
+ .up,
+ .down {
+ margin-left: 4px;
+ position: relative;
+ top: 1px;
+
+ i {
+ font-size: 12px;
+ transform: scale(0.83);
+ }
+ }
+
+ .item-text {
+ display: inline-block;
+ margin-left: 8px;
+ color: rgba(0,0,0,.85);
+ }
+
+ .up {
+ color: @red-6;
+ }
+ .down {
+ color: @green-6;
+ top: -1px;
+ }
+
+ &.reverse-color .up {
+ color: @green-6;
+ }
+ &.reverse-color .down {
+ color: @red-6;
+ }
+}
\ No newline at end of file
diff --git a/src/components/chart/AreaChartTy.vue b/src/components/chart/AreaChartTy.vue
new file mode 100644
index 0000000..3d201e7
--- /dev/null
+++ b/src/components/chart/AreaChartTy.vue
@@ -0,0 +1,88 @@
+
+
+
{{ title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/Bar.vue b/src/components/chart/Bar.vue
new file mode 100644
index 0000000..6612fcf
--- /dev/null
+++ b/src/components/chart/Bar.vue
@@ -0,0 +1,55 @@
+
+
+
{{ title }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/BarAndLine.vue b/src/components/chart/BarAndLine.vue
new file mode 100644
index 0000000..549a31c
--- /dev/null
+++ b/src/components/chart/BarAndLine.vue
@@ -0,0 +1,60 @@
+
+
+
{{ title }}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/BarMultid.vue b/src/components/chart/BarMultid.vue
new file mode 100644
index 0000000..8a5272c
--- /dev/null
+++ b/src/components/chart/BarMultid.vue
@@ -0,0 +1,88 @@
+
+
+
{{ title }}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/DashChartDemo.vue b/src/components/chart/DashChartDemo.vue
new file mode 100644
index 0000000..c2ebf08
--- /dev/null
+++ b/src/components/chart/DashChartDemo.vue
@@ -0,0 +1,187 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/chart/IndexBar.vue b/src/components/chart/IndexBar.vue
new file mode 100644
index 0000000..2e44d96
--- /dev/null
+++ b/src/components/chart/IndexBar.vue
@@ -0,0 +1,61 @@
+
+
+
{{ title }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/LineChartMultid.vue b/src/components/chart/LineChartMultid.vue
new file mode 100644
index 0000000..1d4f174
--- /dev/null
+++ b/src/components/chart/LineChartMultid.vue
@@ -0,0 +1,94 @@
+
+
+
{{ title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/Liquid.vue b/src/components/chart/Liquid.vue
new file mode 100644
index 0000000..85e5b61
--- /dev/null
+++ b/src/components/chart/Liquid.vue
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/MiniArea.vue b/src/components/chart/MiniArea.vue
new file mode 100644
index 0000000..97c8ff7
--- /dev/null
+++ b/src/components/chart/MiniArea.vue
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/MiniBar.vue b/src/components/chart/MiniBar.vue
new file mode 100644
index 0000000..9dd6bca
--- /dev/null
+++ b/src/components/chart/MiniBar.vue
@@ -0,0 +1,76 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/MiniProgress.vue b/src/components/chart/MiniProgress.vue
new file mode 100644
index 0000000..e666828
--- /dev/null
+++ b/src/components/chart/MiniProgress.vue
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/Pie.vue b/src/components/chart/Pie.vue
new file mode 100644
index 0000000..750e203
--- /dev/null
+++ b/src/components/chart/Pie.vue
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/Radar.vue b/src/components/chart/Radar.vue
new file mode 100644
index 0000000..b7b30b0
--- /dev/null
+++ b/src/components/chart/Radar.vue
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/RankList.vue b/src/components/chart/RankList.vue
new file mode 100644
index 0000000..f5d68fe
--- /dev/null
+++ b/src/components/chart/RankList.vue
@@ -0,0 +1,81 @@
+
+
+
{{ title }}
+
+
+ {{ index + 1 }}
+ {{ item.name }}
+ {{ item.total }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/StackBar.vue b/src/components/chart/StackBar.vue
new file mode 100644
index 0000000..01b566f
--- /dev/null
+++ b/src/components/chart/StackBar.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/TransferBar.vue b/src/components/chart/TransferBar.vue
new file mode 100644
index 0000000..bb953e9
--- /dev/null
+++ b/src/components/chart/TransferBar.vue
@@ -0,0 +1,66 @@
+
+
+
{{ title }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/Trend.vue b/src/components/chart/Trend.vue
new file mode 100644
index 0000000..1ca1deb
--- /dev/null
+++ b/src/components/chart/Trend.vue
@@ -0,0 +1,84 @@
+
+
+ {{ term }}
+
{{ rate }}%
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/chart/chart.less b/src/components/chart/chart.less
new file mode 100644
index 0000000..e04fa09
--- /dev/null
+++ b/src/components/chart/chart.less
@@ -0,0 +1,13 @@
+.antv-chart-mini {
+ position: relative;
+ width: 100%;
+
+ .chart-wrapper {
+ position: absolute;
+ bottom: -28px;
+ width: 100%;
+
+/* margin: 0 -5px;
+ overflow: hidden;*/
+ }
+}
\ No newline at end of file
diff --git a/src/components/chart/chart.scss b/src/components/chart/chart.scss
new file mode 100644
index 0000000..e04fa09
--- /dev/null
+++ b/src/components/chart/chart.scss
@@ -0,0 +1,13 @@
+.antv-chart-mini {
+ position: relative;
+ width: 100%;
+
+ .chart-wrapper {
+ position: absolute;
+ bottom: -28px;
+ width: 100%;
+
+/* margin: 0 -5px;
+ overflow: hidden;*/
+ }
+}
\ No newline at end of file
diff --git a/src/components/chart/mixins/ChartMixins.js b/src/components/chart/mixins/ChartMixins.js
new file mode 100644
index 0000000..f99c0bd
--- /dev/null
+++ b/src/components/chart/mixins/ChartMixins.js
@@ -0,0 +1,10 @@
+export const ChartEventMixins = {
+ methods: {
+ handleClick(event, chart) {
+ this.handleEvent('click', event, chart)
+ },
+ handleEvent(eventName, event, chart) {
+ this.$emit(eventName, event, chart)
+ },
+ }
+}
\ No newline at end of file
diff --git a/src/components/index.less b/src/components/index.less
new file mode 100644
index 0000000..d8c97bb
--- /dev/null
+++ b/src/components/index.less
@@ -0,0 +1,4 @@
+@import "~ant-design-vue/lib/style/index";
+
+// The prefix to use on all css classes from ant-pro.
+@ant-pro-prefix : ant-pro;
\ No newline at end of file
diff --git a/src/components/jeecg/JAreaLinkage.vue b/src/components/jeecg/JAreaLinkage.vue
new file mode 100644
index 0000000..c554d4e
--- /dev/null
+++ b/src/components/jeecg/JAreaLinkage.vue
@@ -0,0 +1,155 @@
+
+
+
+
+
+ Bad type value: {{_type}}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JCategorySelect.vue b/src/components/jeecg/JCategorySelect.vue
new file mode 100644
index 0000000..53cf6e6
--- /dev/null
+++ b/src/components/jeecg/JCategorySelect.vue
@@ -0,0 +1,238 @@
+
+
+
+
+
diff --git a/src/components/jeecg/JCheckbox.vue b/src/components/jeecg/JCheckbox.vue
new file mode 100644
index 0000000..a3c70f6
--- /dev/null
+++ b/src/components/jeecg/JCheckbox.vue
@@ -0,0 +1,43 @@
+
+
+
+
+
diff --git a/src/components/jeecg/JCodeEditor.vue b/src/components/jeecg/JCodeEditor.vue
new file mode 100644
index 0000000..196c2a9
--- /dev/null
+++ b/src/components/jeecg/JCodeEditor.vue
@@ -0,0 +1,429 @@
+
+
+
fullCoder=!fullCoder"/>
+
+
+
+
{{ placeholderShow }}
+
+
+
+ {{ mode.label }}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JCron.vue b/src/components/jeecg/JCron.vue
new file mode 100644
index 0000000..39c279e
--- /dev/null
+++ b/src/components/jeecg/JCron.vue
@@ -0,0 +1,65 @@
+
+
+
+
+
diff --git a/src/components/jeecg/JDate.vue b/src/components/jeecg/JDate.vue
new file mode 100644
index 0000000..7362254
--- /dev/null
+++ b/src/components/jeecg/JDate.vue
@@ -0,0 +1,86 @@
+
+
+
+
diff --git a/src/components/jeecg/JEditableTable.vue b/src/components/jeecg/JEditableTable.vue
new file mode 100644
index 0000000..5bb9517
--- /dev/null
+++ b/src/components/jeecg/JEditableTable.vue
@@ -0,0 +1,3181 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JEllipsis.vue b/src/components/jeecg/JEllipsis.vue
new file mode 100644
index 0000000..627113f
--- /dev/null
+++ b/src/components/jeecg/JEllipsis.vue
@@ -0,0 +1,29 @@
+
+
+
+ {{value}}
+
+ {{ value | ellipsis(length) }}
+
+
+
+
+
+
diff --git a/src/components/jeecg/JFormContainer.vue b/src/components/jeecg/JFormContainer.vue
new file mode 100644
index 0000000..c941ed3
--- /dev/null
+++ b/src/components/jeecg/JFormContainer.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JGraphicCode.vue b/src/components/jeecg/JGraphicCode.vue
new file mode 100644
index 0000000..462a4b9
--- /dev/null
+++ b/src/components/jeecg/JGraphicCode.vue
@@ -0,0 +1,202 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JImageUpload.vue b/src/components/jeecg/JImageUpload.vue
new file mode 100644
index 0000000..8706cf7
--- /dev/null
+++ b/src/components/jeecg/JImageUpload.vue
@@ -0,0 +1,228 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JImportModal.vue b/src/components/jeecg/JImportModal.vue
new file mode 100644
index 0000000..d69f596
--- /dev/null
+++ b/src/components/jeecg/JImportModal.vue
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+ 选择导入文件
+
+
+
+
+ 关闭
+
+ {{ uploading ? '上传中...' : '开始上传' }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JInput.vue b/src/components/jeecg/JInput.vue
new file mode 100644
index 0000000..619543c
--- /dev/null
+++ b/src/components/jeecg/JInput.vue
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JModal/index.vue b/src/components/jeecg/JModal/index.vue
new file mode 100644
index 0000000..d2163b1
--- /dev/null
+++ b/src/components/jeecg/JModal/index.vue
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JSelectMultiple.vue b/src/components/jeecg/JSelectMultiple.vue
new file mode 100644
index 0000000..d0ce043
--- /dev/null
+++ b/src/components/jeecg/JSelectMultiple.vue
@@ -0,0 +1,66 @@
+
+
+
+ {{ item.text || item.label }}
+
+
+
+
+
diff --git a/src/components/jeecg/JSlider.vue b/src/components/jeecg/JSlider.vue
new file mode 100644
index 0000000..18fda68
--- /dev/null
+++ b/src/components/jeecg/JSlider.vue
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JSuperQuery.vue b/src/components/jeecg/JSuperQuery.vue
new file mode 100644
index 0000000..efeab2d
--- /dev/null
+++ b/src/components/jeecg/JSuperQuery.vue
@@ -0,0 +1,639 @@
+
+
+
+
+
+
+ {{tooltipProps}}
+
+
+ 已有高级查询条件生效
+
+ 清空
+
+
+
+
+ 高级查询
+
+
+
+
+ 高级查询
+
+
+
+
+
+
+ 关闭
+ 查询
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AND(所有条件都要求匹配)
+ OR(条件中的任意一个匹配)
+
+
+
+
+
+
+
+
+ handleSelected(option,item)"
+ >
+
+
+
+
+
+ 等于
+ 包含
+ 以..开始
+ 以..结尾
+ 在...中
+ 不等于
+ 大于
+ 大于等于
+ 小于
+ 小于等于
+
+
+
+
+
+
+
+
+
+
+
+
+
+ handleChangeJPopup(item,e,v)"/>
+
+
+
+
+
+
+ item.val=value"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存的查询
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JSwitch.vue b/src/components/jeecg/JSwitch.vue
new file mode 100644
index 0000000..9d8f4dc
--- /dev/null
+++ b/src/components/jeecg/JSwitch.vue
@@ -0,0 +1,57 @@
+
+
+
+
diff --git a/src/components/jeecg/JTreeDict.vue b/src/components/jeecg/JTreeDict.vue
new file mode 100644
index 0000000..dd413c7
--- /dev/null
+++ b/src/components/jeecg/JTreeDict.vue
@@ -0,0 +1,199 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JTreeSelect.vue b/src/components/jeecg/JTreeSelect.vue
new file mode 100644
index 0000000..41789a1
--- /dev/null
+++ b/src/components/jeecg/JTreeSelect.vue
@@ -0,0 +1,260 @@
+
+
+
+
+
diff --git a/src/components/jeecg/JTreeTable.vue b/src/components/jeecg/JTreeTable.vue
new file mode 100644
index 0000000..bf14b81
--- /dev/null
+++ b/src/components/jeecg/JTreeTable.vue
@@ -0,0 +1,180 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/JUpload.vue b/src/components/jeecg/JUpload.vue
new file mode 100644
index 0000000..10303ed
--- /dev/null
+++ b/src/components/jeecg/JUpload.vue
@@ -0,0 +1,453 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ text }}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/index.js b/src/components/jeecg/index.js
new file mode 100644
index 0000000..0dbce86
--- /dev/null
+++ b/src/components/jeecg/index.js
@@ -0,0 +1,9 @@
+import JModal from './JModal'
+import JFormContainer from './JFormContainer.vue'
+
+export default {
+ install(Vue) {
+ Vue.component('JFormContainer', JFormContainer)
+ Vue.component(JModal.name, JModal)
+ }
+}
\ No newline at end of file
diff --git a/src/components/jeecg/minipop/JFilePop.vue b/src/components/jeecg/minipop/JFilePop.vue
new file mode 100644
index 0000000..ce7c72a
--- /dev/null
+++ b/src/components/jeecg/minipop/JFilePop.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/minipop/JInputPop.vue b/src/components/jeecg/minipop/JInputPop.vue
new file mode 100644
index 0000000..b9164b1
--- /dev/null
+++ b/src/components/jeecg/minipop/JInputPop.vue
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecg/modal/JCronModal.vue b/src/components/jeecg/modal/JCronModal.vue
new file mode 100644
index 0000000..c336189
--- /dev/null
+++ b/src/components/jeecg/modal/JCronModal.vue
@@ -0,0 +1,928 @@
+
+
+
+
+
+ 秒
+
+
+ 每一秒钟
+
+
+ 每隔
+
+ 秒执行 从
+
+ 秒开始
+
+
+
+ 具体秒数(可多选)
+
+ {{ index }}
+
+
+
+ 周期从
+
+ 到
+
+ 秒
+
+
+
+
+
+ 分
+
+
+
+ 每一分钟
+
+
+ 每隔
+
+ 分执行 从
+
+ 分开始
+
+
+
+ 具体分钟数(可多选)
+
+ {{ index }}
+
+
+
+ 周期从
+
+ 到
+
+ 分
+
+
+
+
+
+
+ 时
+
+
+
+ 每一小时
+
+
+ 每隔
+
+ 小时执行 从
+
+ 小时开始
+
+
+
+ 具体小时数(可多选)
+
+ {{ index }}
+
+
+
+ 周期从
+
+ 到
+
+ 小时
+
+
+
+
+
+
+ 天
+
+
+
+ 每一天
+
+
+ 每隔
+
+ 周执行 从
+
+ {{ weekDays[index] }}
+
+ 开始
+
+
+
+ 每隔
+
+ 天执行 从
+
+ 天开始
+
+
+
+ 具体星期几(可多选)
+
+ {{ weekDays[index] }}
+
+
+
+ 具体天数(可多选)
+
+ {{ index+1 }}
+
+
+
+ 在这个月的最后一天
+
+
+ 在这个月的最后一个工作日
+
+
+ 在这个月的最后一个
+
+ {{ weekDays[index] }}
+
+
+
+
+
+ 在本月底前
+
+ 天
+
+
+
+ 最近的工作日(周一至周五)至本月
+
+ 日
+
+
+
+ 在这个月的第
+
+ 个
+
+ {{ weekDays[index] }}
+
+
+
+
+
+
+
+
+ 月
+
+
+
+ 每一月
+
+
+ 每隔
+
+ 月执行 从
+
+ 月开始
+
+
+
+ 具体月数(可多选)
+
+ {{ index+1 }}
+
+
+
+ 从
+
+ 到
+
+ 月之间的每个月
+
+
+
+
+
+
+ 年
+
+
+
+ 每一年
+
+
+ 每隔
+
+ 年执行 从
+
+ 年开始
+
+
+
+ 具体年份(可多选)
+
+ {{ 2019+index }}
+
+
+
+ 从
+
+ 到
+
+ 年之间的每一年
+
+
+
+
+
+
+
+ {{this.cron }}
+
+
+
+
+
+
+
+
diff --git a/src/components/jeecgbiz/JSelectBizComponent/JSelectBizComponentModal.vue b/src/components/jeecgbiz/JSelectBizComponent/JSelectBizComponentModal.vue
new file mode 100644
index 0000000..ed5cf75
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectBizComponent/JSelectBizComponentModal.vue
@@ -0,0 +1,334 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/JSelectBizComponent/index.vue b/src/components/jeecgbiz/JSelectBizComponent/index.vue
new file mode 100644
index 0000000..fbc77d8
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectBizComponent/index.vue
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+ {{selectButtonText}}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/JSelectDepart.vue b/src/components/jeecgbiz/JSelectDepart.vue
new file mode 100644
index 0000000..99ec2cb
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectDepart.vue
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/JSelectList.vue b/src/components/jeecgbiz/JSelectList.vue
new file mode 100644
index 0000000..89fce1b
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectList.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
e.preventDefault()">此处最多显示20条,如需更多请点击放大镜查询
+
+
+ {{ item.materialStr }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/JSelectMultiUser.vue b/src/components/jeecgbiz/JSelectMultiUser.vue
new file mode 100644
index 0000000..3f9a879
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectMultiUser.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/JSelectPosition.vue b/src/components/jeecgbiz/JSelectPosition.vue
new file mode 100644
index 0000000..f863f8e
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectPosition.vue
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/JSelectRole.vue b/src/components/jeecgbiz/JSelectRole.vue
new file mode 100644
index 0000000..6833a38
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectRole.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/JSelectUserByDep.vue b/src/components/jeecgbiz/JSelectUserByDep.vue
new file mode 100644
index 0000000..eaa9b98
--- /dev/null
+++ b/src/components/jeecgbiz/JSelectUserByDep.vue
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/modal/JSelectBatchModal.vue b/src/components/jeecgbiz/modal/JSelectBatchModal.vue
new file mode 100644
index 0000000..f07d02d
--- /dev/null
+++ b/src/components/jeecgbiz/modal/JSelectBatchModal.vue
@@ -0,0 +1,279 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+ 提示:双击行可以直接选中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/modal/JSelectDepartModal.vue b/src/components/jeecgbiz/modal/JSelectDepartModal.vue
new file mode 100644
index 0000000..fd80ca7
--- /dev/null
+++ b/src/components/jeecgbiz/modal/JSelectDepartModal.vue
@@ -0,0 +1,226 @@
+
+
+
+
+
+
+
+
+ {{title.substr(0, title.indexOf(searchValue))}}
+ {{searchValue}}
+ {{title.substr(title.indexOf(searchValue) + searchValue.length)}}
+
+ {{title}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/modal/JSelectMaterialModal.vue b/src/components/jeecgbiz/modal/JSelectMaterialModal.vue
new file mode 100644
index 0000000..2eac505
--- /dev/null
+++ b/src/components/jeecgbiz/modal/JSelectMaterialModal.vue
@@ -0,0 +1,509 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.depotName }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+ 新增
+
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+
+
+ {{record.mBarCode}}
+
+
+
+
+
+
+
+
+
+
+ {{record.name}}
+ 序
+ 批
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/modal/JSelectSnAddModal.vue b/src/components/jeecgbiz/modal/JSelectSnAddModal.vue
new file mode 100644
index 0000000..adb3d6c
--- /dev/null
+++ b/src/components/jeecgbiz/modal/JSelectSnAddModal.vue
@@ -0,0 +1,263 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 移除
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/modal/JSelectSnModal.vue b/src/components/jeecgbiz/modal/JSelectSnModal.vue
new file mode 100644
index 0000000..be3d912
--- /dev/null
+++ b/src/components/jeecgbiz/modal/JSelectSnModal.vue
@@ -0,0 +1,362 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 全选
+ 重置
+
+
+
+
+
+
+
+ 此处为已选中的序列号列表
+ 清空
+
+
+
+
+
+
+ 选中
+
+
+
+
+
+
+ 移除
+
+
+ 已选中共{{checkDataSource.length}}条
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/modal/JSelectUserByDepModal.vue b/src/components/jeecgbiz/modal/JSelectUserByDepModal.vue
new file mode 100644
index 0000000..cee14ff
--- /dev/null
+++ b/src/components/jeecgbiz/modal/JSelectUserByDepModal.vue
@@ -0,0 +1,286 @@
+
+
+
+
+
+
+
+
+
+
+
+ 用户账号:
+
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/jeecgbiz/modal/SelectUserListModal.vue b/src/components/jeecgbiz/modal/SelectUserListModal.vue
new file mode 100644
index 0000000..1da0148
--- /dev/null
+++ b/src/components/jeecgbiz/modal/SelectUserListModal.vue
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/layouts/BasicLayout.vue b/src/components/layouts/BasicLayout.vue
new file mode 100644
index 0000000..65b40cd
--- /dev/null
+++ b/src/components/layouts/BasicLayout.vue
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/BlankLayout.vue b/src/components/layouts/BlankLayout.vue
new file mode 100644
index 0000000..90c0399
--- /dev/null
+++ b/src/components/layouts/BlankLayout.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/IframeFReportView.vue b/src/components/layouts/IframeFReportView.vue
new file mode 100644
index 0000000..c51e5b1
--- /dev/null
+++ b/src/components/layouts/IframeFReportView.vue
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/IframePageView.vue b/src/components/layouts/IframePageView.vue
new file mode 100644
index 0000000..bb494fe
--- /dev/null
+++ b/src/components/layouts/IframePageView.vue
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/PageView.vue b/src/components/layouts/PageView.vue
new file mode 100644
index 0000000..fc330a0
--- /dev/null
+++ b/src/components/layouts/PageView.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/RouteView.vue b/src/components/layouts/RouteView.vue
new file mode 100644
index 0000000..ce3981a
--- /dev/null
+++ b/src/components/layouts/RouteView.vue
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/TabLayout.vue b/src/components/layouts/TabLayout.vue
new file mode 100644
index 0000000..955c9b8
--- /dev/null
+++ b/src/components/layouts/TabLayout.vue
@@ -0,0 +1,466 @@
+
+
+
+ onContextmenu(e)"
+ v-if="multipage"
+ :active-key="activePage"
+ class="tab-layout-tabs"
+ :hide-add="true"
+ type="editable-card"
+ @change="changePage"
+ @tabClick="tabCallBack"
+ @edit="editPage">
+
+ {{ page.meta.title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/UserLayout.vue b/src/components/layouts/UserLayout.vue
new file mode 100644
index 0000000..185bb40
--- /dev/null
+++ b/src/components/layouts/UserLayout.vue
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+
+
+
+
+
+ 取消
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/layouts/index.js b/src/components/layouts/index.js
new file mode 100644
index 0000000..7cf0f77
--- /dev/null
+++ b/src/components/layouts/index.js
@@ -0,0 +1,8 @@
+import UserLayout from '@/components/layouts/UserLayout'
+import BlankLayout from '@/components/layouts/BlankLayout'
+import BasicLayout from '@/components/layouts/BasicLayout'
+import RouteView from '@/components/layouts/RouteView'
+import PageView from '@/components/layouts/PageView'
+import TabLayout from '@/components/layouts/TabLayout'
+
+export { UserLayout, BasicLayout, BlankLayout, RouteView, PageView, TabLayout }
\ No newline at end of file
diff --git a/src/components/menu/Contextmenu.vue b/src/components/menu/Contextmenu.vue
new file mode 100644
index 0000000..f88f7b4
--- /dev/null
+++ b/src/components/menu/Contextmenu.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
diff --git a/src/components/menu/SideMenu.vue b/src/components/menu/SideMenu.vue
new file mode 100644
index 0000000..2009b7a
--- /dev/null
+++ b/src/components/menu/SideMenu.vue
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/menu/index.js b/src/components/menu/index.js
new file mode 100644
index 0000000..a09ec8d
--- /dev/null
+++ b/src/components/menu/index.js
@@ -0,0 +1,192 @@
+import Menu from 'ant-design-vue/es/menu'
+import Icon from 'ant-design-vue/es/icon'
+
+const { Item, SubMenu } = Menu
+
+export default {
+ name: 'SMenu',
+ props: {
+ menu: {
+ type: Array,
+ required: true
+ },
+ theme: {
+ type: String,
+ required: false,
+ default: 'dark'
+ },
+ mode: {
+ type: String,
+ required: false,
+ default: 'inline'
+ },
+ collapsed: {
+ type: Boolean,
+ required: false,
+ default: false
+ }
+ },
+ data () {
+ return {
+ openKeys: [],
+ selectedKeys: [],
+ cachedOpenKeys: []
+ }
+ },
+ computed: {
+ rootSubmenuKeys: vm => {
+ const keys = []
+ vm.menu.forEach(item => keys.push(item.url))
+ return keys
+ }
+ },
+ mounted () {
+ this.updateMenu()
+ },
+ watch: {
+ collapsed (val) {
+ if (val) {
+ this.cachedOpenKeys = this.openKeys.concat()
+ this.openKeys = []
+ } else {
+ this.openKeys = this.cachedOpenKeys
+ }
+ },
+ $route: function () {
+ this.updateMenu()
+ }
+ },
+ methods: {
+ // select menu item
+ onOpenChange (openKeys) {
+
+ // 在水平模式下时执行,并且不再执行后续
+ if (this.mode === 'horizontal') {
+ this.openKeys = openKeys
+ return
+ }
+ // 非水平模式时
+ const latestOpenKey = openKeys.find(key => !this.openKeys.includes(key))
+ if (!this.rootSubmenuKeys.includes(latestOpenKey)) {
+ this.openKeys = openKeys
+ } else {
+ this.openKeys = latestOpenKey ? [latestOpenKey] : []
+ }
+ },
+ updateMenu () {
+ const routes = this.$route.matched.concat()
+ const { hidden } = this.$route.meta
+ if (routes.length >= 3 && hidden) {
+ routes.pop()
+ this.selectedKeys = [routes[routes.length - 1].path]
+ } else {
+ this.selectedKeys = [routes.pop().path]
+ }
+ const openKeys = []
+ if (this.mode === 'inline') {
+ routes.forEach(item => {
+ openKeys.push(item.path)
+ })
+ }
+ //update-begin-author:taoyan date:20190510 for:online表单菜单点击展开的一级目录不对
+ if(!this.selectedKeys|| this.selectedKeys[0].indexOf(":")<0){
+ this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.openKeys = openKeys)
+ }
+ //update-end-author:taoyan date:20190510 for:online表单菜单点击展开的一级目录不对
+ },
+
+ // render
+ renderItem (menu) {
+ if (!menu.hidden) {
+ return menu.children && !menu.alwaysShow ? this.renderSubMenu(menu) : this.renderMenuItem(menu)
+ }
+ return null
+ },
+ renderMenuItem (menu) {
+ const target = null
+ const tag = target && 'a' || 'router-link'
+ let props = { to: { name: menu.name } }
+ if(menu.route && menu.route === '0'){
+ props = { to: { path: menu.path } }
+ }
+
+ const attrs = { href: menu.url, target: menu.text }
+
+ if (menu.children) {
+ // 把有子菜单的 并且 父菜单是要隐藏子菜单的
+ // 都给子菜单增加一个 hidden 属性
+ // 用来给刷新页面时, selectedKeys 做控制用
+ menu.children.forEach(item => {
+ item.meta = Object.assign(item.meta, { hidden: true })
+ })
+ }
+ return (
+ -
+
+ {this.renderIcon(menu.icon)}
+ {menu.text}
+
+
+ )
+ },
+ renderSubMenu (menu) {
+ const itemArr = []
+ if (!menu.alwaysShow) {
+ menu.children.forEach(item => itemArr.push(this.renderItem(item)))
+ }
+ return (
+
+
+ {this.renderIcon(menu.icon)}
+ {menu.text}
+
+ {itemArr}
+
+ )
+ },
+ renderIcon (icon) {
+ if (icon === 'none' || icon === undefined) {
+ return null
+ }
+ const props = {}
+ typeof (icon) === 'object' ? props.component = icon : props.type = icon
+ return (
+
+ )
+ }
+ },
+
+ render () {
+ const { mode, theme, menu } = this
+ const props = {
+ mode: mode,
+ theme: theme,
+ openKeys: this.openKeys,
+ inlineIndent: 12,
+ }
+ const on = {
+ select: obj => {
+ if(obj.key.indexOf('http://')>-1 || obj.key.indexOf('https://')>-1) {
+ window.open(obj.key)
+ } else {
+ this.selectedKeys = obj.selectedKeys
+ this.$emit('select', obj)
+ }
+ },
+ openChange: this.onOpenChange
+ }
+
+ const menuTree = menu.map(item => {
+ if (item.hidden) {
+ return null
+ }
+ return this.renderItem(item)
+ })
+ // {...{ props, on: on }}
+ return (
+
+ {menuTree}
+
+ )
+ }
+}
diff --git a/src/components/page/GlobalFooter.vue b/src/components/page/GlobalFooter.vue
new file mode 100644
index 0000000..7322727
--- /dev/null
+++ b/src/components/page/GlobalFooter.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/page/GlobalHeader.vue b/src/components/page/GlobalHeader.vue
new file mode 100644
index 0000000..a112f9a
--- /dev/null
+++ b/src/components/page/GlobalHeader.vue
@@ -0,0 +1,244 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/page/GlobalLayout.vue b/src/components/page/GlobalLayout.vue
new file mode 100644
index 0000000..d67b860
--- /dev/null
+++ b/src/components/page/GlobalLayout.vue
@@ -0,0 +1,684 @@
+
+
+
+
+ this.collapsed = false"
+ :closable="false"
+ :visible="collapsed"
+ width="150px"
+ >
+
+
+
+
+
+
+
+ this.collapsed = false"
+ :closable="false"
+ :visible="collapsed"
+ width="150px"
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/page/JumpInfo.vue b/src/components/page/JumpInfo.vue
new file mode 100644
index 0000000..d19fedd
--- /dev/null
+++ b/src/components/page/JumpInfo.vue
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/page/PageHeader.vue b/src/components/page/PageHeader.vue
new file mode 100644
index 0000000..f7e86b5
--- /dev/null
+++ b/src/components/page/PageHeader.vue
@@ -0,0 +1,238 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/page/PageLayout.vue b/src/components/page/PageLayout.vue
new file mode 100644
index 0000000..191fd8a
--- /dev/null
+++ b/src/components/page/PageLayout.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/page/SHeaderNotice.vue b/src/components/page/SHeaderNotice.vue
new file mode 100644
index 0000000..5e874e8
--- /dev/null
+++ b/src/components/page/SHeaderNotice.vue
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/setting/SettingDrawer.vue b/src/components/setting/SettingDrawer.vue
new file mode 100644
index 0000000..b22f5e2
--- /dev/null
+++ b/src/components/setting/SettingDrawer.vue
@@ -0,0 +1,362 @@
+
+
+
+
+
+
+
整体风格设置
+
+
+
+
+ 暗色菜单风格
+
+
+
+
+
+
+
+
+
+ 亮色菜单风格
+
+
+
+
+
+
+
+
+
+
+
主题色
+
+
+
+
+ {{ item.key }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 固定 Header
+
+
+
+
+
+ 下滑时隐藏 Header
+
+
+
+
+
+ 固定侧边菜单
+
+
+
+
+
+
+
+
+
语言设置
+
+
{{langSetTitle}}
+
+
+ 简体中文
+ 繁體中文
+ English
+ 한국어
+ しろうと
+ Tiếng Việt
+ हिन्दी
+ Русский язык
+ Français
+ УкраїнськаName
+ Norge
+ color name
+ nederlands
+ Pilipino
+ ກະຣຸນາ
+ తెలుగుQFontDatabase
+ Română
+ नेपालीName
+ Kreyòl ayisyen
+ český
+ Svenska
+ Malagasy
+ ဗာရမ်
+ پښتوName
+ คนไทย
+ Արմենյան
+ Persian
+ Kurdî
+ Türkçe
+ български
+ Malay
+ Kiswahili
+ ଓଡିଆ
+ ÍslandName
+ Íris
+ ខ្មែរKCharselect unicode block name
+ ગુજરાતી
+ Slovenská
+ ಕನ್ನಡ್Name
+ היברית
+ magyar
+ मराठीName
+ தாமில்
+ eesti keel
+ മലമാലം
+ ᐃᓄᒃᑎᑐᑦ
+ بالعربية
+ Deutsch
+ slovenščina
+ বেঙ্গালী
+ اوردو
+ azerbaijani
+ português
+ lifiava
+ afrikaans
+ 汤加语
+ ελληνικά
+ IndonesiaName
+ Español
+ dansk
+ amharic
+ ਪੰਜਾਬੀName
+ albanian
+ Lietuva
+ italiano
+ Malti
+ suomi
+ català
+ hrvatski
+ bosnian
+ Polski
+ latviešu
+ Maori
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/setting/SettingItem.vue b/src/components/setting/SettingItem.vue
new file mode 100644
index 0000000..de0cbe0
--- /dev/null
+++ b/src/components/setting/SettingItem.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/table/StandardTable.vue b/src/components/table/StandardTable.vue
new file mode 100644
index 0000000..bc6044a
--- /dev/null
+++ b/src/components/table/StandardTable.vue
@@ -0,0 +1,252 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/table/index.js b/src/components/table/index.js
new file mode 100644
index 0000000..8d19449
--- /dev/null
+++ b/src/components/table/index.js
@@ -0,0 +1,268 @@
+import T from "ant-design-vue/es/table/Table";
+import get from "lodash.get"
+export default {
+ data() {
+ return {
+ needTotalList: [],
+
+ selectedRows: [],
+ selectedRowKeys: [],
+
+ localLoading: false,
+ localDataSource: [],
+ localPagination: Object.assign({}, T.props.pagination)
+ };
+ },
+ props: Object.assign({}, T.props, {
+ rowKey: {
+ type: [String, Function],
+ default: 'id'
+ },
+ data: {
+ type: Function,
+ required: true
+ },
+ pageNum: {
+ type: Number,
+ default: 1
+ },
+ pageSize: {
+ type: Number,
+ default: 10
+ },
+ showSizeChanger: {
+ type: Boolean,
+ default: true
+ },
+ showAlertInfo: {
+ type: Boolean,
+ default: false
+ },
+ showPagination: {
+ default: 'auto'
+ }
+ }),
+ watch: {
+ 'localPagination.current'(val) {
+ this.$router.push({
+ name: this.$route.name,
+ params: Object.assign({}, this.$route.params, {
+ pageNo: val
+ }),
+ });
+ },
+ pageNum(val) {
+ Object.assign(this.localPagination, {
+ current: val
+ });
+ },
+ pageSize(val) {
+ console.log('pageSize:', val)
+ Object.assign(this.localPagination, {
+ pageSize: val
+ });
+ },
+ showSizeChanger(val) {
+ console.log('showSizeChanger', val)
+ Object.assign(this.localPagination, {
+ showSizeChanger: val
+ });
+ }
+ },
+ created() {
+ this.localPagination = ['auto', true].includes(this.showPagination) && Object.assign({}, this.localPagination, {
+ current: this.pageNum,
+ pageSize: this.pageSize,
+ showSizeChanger: this.showSizeChanger
+ });
+ this.needTotalList = this.initTotalList(this.columns)
+ this.loadData();
+ },
+ methods: {
+ refresh() {
+ this.loadData();
+ },
+ loadData(pagination, filters, sorter) {
+
+ this.localLoading = true
+ var result = this.data(
+ Object.assign({
+ pageNo: (pagination && pagination.current) ||
+ this.localPagination.current,
+ pageSize: (pagination && pagination.pageSize) ||
+ this.localPagination.pageSize
+ },
+ (sorter && sorter.field && {
+ sortField: sorter.field
+ }) || {},
+ (sorter && sorter.order && {
+ sortOrder: sorter.order
+ }) || {}, {
+ ...filters
+ }
+ )
+ );
+
+ if (result instanceof Promise) {
+ result.then(r => {
+ this.localPagination = Object.assign({}, this.localPagination, {
+ current: r.pageNo, // 返回结果中的当前分页数
+ total: r.totalCount, // 返回结果中的总记录数
+ showSizeChanger: this.showSizeChanger,
+ pageSize: (pagination && pagination.pageSize) ||
+ this.localPagination.pageSize
+ });
+
+ !r.totalCount && ['auto', false].includes(this.showPagination) && (this.localPagination = false)
+ this.localDataSource = r.data; // 返回结果中的数组数据
+ this.localLoading = false
+ });
+ }
+ },
+ initTotalList(columns) {
+ const totalList = []
+ columns && columns instanceof Array && columns.forEach(column => {
+ if (column.needTotal) {
+ totalList.push({ ...column,
+ total: 0
+ })
+ }
+ })
+ return totalList
+ },
+ updateSelect(selectedRowKeys, selectedRows) {
+ this.selectedRowKeys = selectedRowKeys
+ this.selectedRows = selectedRows
+ let list = this.needTotalList
+ this.needTotalList = list.map(item => {
+ return {
+ ...item,
+ total: selectedRows.reduce((sum, val) => {
+ let total = sum + get(val, item.dataIndex)
+ return isNaN(total) ? 0 : total
+ }, 0)
+ }
+ })
+ // this.$emit('change', selectedRowKeys, selectedRows)
+ },
+ updateEdit() {
+ this.selectedRows = []
+ },
+ onClearSelected() {
+ // 【TESTA-262】页面清空后还能才做所选行,增加 this.$emit('clearAll')
+ this.selectedRowKeys = []
+ this.selectedRows = []
+ this.updateSelect([], [])
+ this.$emit('clearAll')
+ },
+ renderMsg(h) {
+ const _vm = this
+ let d = []
+ // 构建 已选择
+ d.push(
+ h('span', {
+ style: {
+ marginRight: '12px'
+ }
+ }, ['已选择 ', h('a', {
+ style: {
+ fontWeight: 600
+ }
+ }, this.selectedRows.length)])
+ );
+
+ // 构建 列统计
+ this.needTotalList.map(item => {
+ d.push(h('span', {
+ style: {
+ marginRight: '12px'
+ }
+ },
+ [
+ `${ item.title }总计 `,
+ h('a', {
+ style: {
+ fontWeight: 600
+ }
+ }, `${ !item.customRender ? item.total : item.customRender(item.total) }`)
+ ]))
+ });
+
+ // 构建 清空选择
+ d.push(h('a', {
+ style: {
+ marginLeft: '24px'
+ },
+ on: {
+ click: _vm.onClearSelected
+ }
+ }, '清空'))
+
+ return d
+ },
+ renderAlert(h) {
+ return h('span', {
+ slot: 'message'
+ }, this.renderMsg(h))
+ },
+ },
+
+ render(h) {
+ const _vm = this
+
+ let props = {},
+ localKeys = Object.keys(this.$data);
+
+ Object.keys(T.props).forEach(k => {
+ let localKey = `local${k.substring(0,1).toUpperCase()}${k.substring(1)}`;
+ if (localKeys.includes(localKey)) {
+ return props[k] = _vm[localKey];
+ }
+ return props[k] = _vm[k];
+ })
+
+
+ // 显示信息提示
+ if (this.showAlertInfo) {
+
+ props.rowSelection = {
+ selectedRowKeys: this.selectedRowKeys,
+ onChange: (selectedRowKeys, selectedRows) => {
+ _vm.updateSelect(selectedRowKeys, selectedRows)
+ _vm.$emit('onSelect', { selectedRowKeys: selectedRowKeys, selectedRows: selectedRows })
+ }
+ };
+
+ return h('div', {}, [
+ h("a-alert", {
+ style: {
+ marginBottom: '16px'
+ },
+ props: {
+ type: 'info',
+ showIcon: true
+ }
+ }, [_vm.renderAlert(h)]),
+ h("a-table", {
+ tag: "component",
+ attrs: props,
+ on: {
+ change: _vm.loadData
+ },
+ scopedSlots: this.$scopedSlots
+ }, this.$slots.default)
+ ]);
+
+ }
+
+ return h("a-table", {
+ tag: "component",
+ attrs: props,
+ on: {
+ change: _vm.loadData
+ },
+ scopedSlots: this.$scopedSlots
+ }, this.$slots.default);
+
+ }
+};
\ No newline at end of file
diff --git a/src/components/tools/BillExcelIframe.vue b/src/components/tools/BillExcelIframe.vue
new file mode 100644
index 0000000..b8d06df
--- /dev/null
+++ b/src/components/tools/BillExcelIframe.vue
@@ -0,0 +1,83 @@
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/Breadcrumb.vue b/src/components/tools/Breadcrumb.vue
new file mode 100644
index 0000000..9a5f5e6
--- /dev/null
+++ b/src/components/tools/Breadcrumb.vue
@@ -0,0 +1,48 @@
+
+
+
+
+ {{ item.meta.title }}
+
+ {{ item.meta.title }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/DepartSelect.vue b/src/components/tools/DepartSelect.vue
new file mode 100644
index 0000000..7a7e15a
--- /dev/null
+++ b/src/components/tools/DepartSelect.vue
@@ -0,0 +1,162 @@
+
+
+
+ 关闭
+ 确认
+
+
+
+
+
+
+ 您隶属于多部门,请选择当前所在部门
+
+
+
+
+
+
+ {{ d.departName }}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/DetailList.vue b/src/components/tools/DetailList.vue
new file mode 100644
index 0000000..bd74971
--- /dev/null
+++ b/src/components/tools/DetailList.vue
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/DynamicNotice.vue b/src/components/tools/DynamicNotice.vue
new file mode 100644
index 0000000..539ce52
--- /dev/null
+++ b/src/components/tools/DynamicNotice.vue
@@ -0,0 +1,37 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/FooterToolBar.vue b/src/components/tools/FooterToolBar.vue
new file mode 100644
index 0000000..63b3c1b
--- /dev/null
+++ b/src/components/tools/FooterToolBar.vue
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/HeadInfo.vue b/src/components/tools/HeadInfo.vue
new file mode 100644
index 0000000..d258a15
--- /dev/null
+++ b/src/components/tools/HeadInfo.vue
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/HeaderNotice.vue b/src/components/tools/HeaderNotice.vue
new file mode 100644
index 0000000..0c10742
--- /dev/null
+++ b/src/components/tools/HeaderNotice.vue
@@ -0,0 +1,289 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/ImportFileModal.vue b/src/components/tools/ImportFileModal.vue
new file mode 100644
index 0000000..38063f6
--- /dev/null
+++ b/src/components/tools/ImportFileModal.vue
@@ -0,0 +1,96 @@
+
+
+
+
+ 取消
+
+
+
+
+
+ {{templateName}}
+ 提示:模板中的第一行请勿删除
+
+
+
+
+
+
+
+ 导入
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/Logo.vue b/src/components/tools/Logo.vue
new file mode 100644
index 0000000..c5f1d06
--- /dev/null
+++ b/src/components/tools/Logo.vue
@@ -0,0 +1,57 @@
+
+
+
{{ title }}
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/ShowAnnouncement.vue b/src/components/tools/ShowAnnouncement.vue
new file mode 100644
index 0000000..2892a04
--- /dev/null
+++ b/src/components/tools/ShowAnnouncement.vue
@@ -0,0 +1,138 @@
+
+
+
+ 关闭
+ 去处理
+
+
+ {{record.msgTitle}}
+ 通知日期:{{record.createTimeStr}}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/tools/TwoStepCaptcha.vue b/src/components/tools/TwoStepCaptcha.vue
new file mode 100644
index 0000000..8b4c94d
--- /dev/null
+++ b/src/components/tools/TwoStepCaptcha.vue
@@ -0,0 +1,89 @@
+
+
+
+ 两步验证
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/UserMenu.vue b/src/components/tools/UserMenu.vue
new file mode 100644
index 0000000..f86ac30
--- /dev/null
+++ b/src/components/tools/UserMenu.vue
@@ -0,0 +1,257 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/UserPassword.vue b/src/components/tools/UserPassword.vue
new file mode 100644
index 0000000..607dc47
--- /dev/null
+++ b/src/components/tools/UserPassword.vue
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/tools/WorkflowIframe.vue b/src/components/tools/WorkflowIframe.vue
new file mode 100644
index 0000000..487ee6b
--- /dev/null
+++ b/src/components/tools/WorkflowIframe.vue
@@ -0,0 +1,109 @@
+
+
+
+
+ 取消
+ 确认提交
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/tools/setting.js b/src/components/tools/setting.js
new file mode 100644
index 0000000..bc2e0a1
--- /dev/null
+++ b/src/components/tools/setting.js
@@ -0,0 +1,95 @@
+import { message } from 'ant-design-vue/es';
+// import defaultSettings from '../defaultSettings';
+
+let lessNodesAppended;
+
+const colorList = [
+ {
+ key: '薄暮', color: '#F5222D',
+ },
+ {
+ key: '火山', color: '#FA541C',
+ },
+ {
+ key: '日暮', color: '#FAAD14',
+ },
+ {
+ key: '明青', color: '#13C2C2',
+ },
+ {
+ key: '极光绿', color: '#52C41A',
+ },
+ {
+ key: '拂晓蓝(默认)', color: '#1890FF',
+ },
+ {
+ key: '极客蓝', color: '#2F54EB',
+ },
+ {
+ key: '酱紫', color: '#722ED1',
+ },
+];
+
+const updateTheme = primaryColor => {
+ // Don't compile less in production!
+ /* if (process.env.NODE_ENV === 'production') {
+ return;
+ } */
+ // Determine if the component is remounted
+ if (!primaryColor) {
+ return;
+ }
+ const hideMessage = message.loading('正在编译主题!', 0);
+ console.info(`正在编译主题!`)
+ function buildIt() {
+ // 正确的判定less是否已经加载less.modifyVars可用
+ if (!window.less || !window.less.modifyVars) {
+ return;
+ }
+ // less.modifyVars可用
+ window.less.modifyVars({
+ '@primary-color': primaryColor,
+ })
+ .then(() => {
+ hideMessage();
+ })
+ .catch(() => {
+ message.error('Failed to update theme');
+ hideMessage();
+ });
+ }
+ if (!lessNodesAppended) {
+ // insert less.js and color.less
+ const lessStyleNode = document.createElement('link');
+ const lessConfigNode = document.createElement('script');
+ const lessScriptNode = document.createElement('script');
+ lessStyleNode.setAttribute('rel', 'stylesheet/less');
+ lessStyleNode.setAttribute('href', '/static/color.less');
+ lessConfigNode.innerHTML = `
+ window.less = {
+ async: true,
+ env: 'production',
+ javascriptEnabled: true
+ };
+ `;
+ lessScriptNode.src = '/static/less.min.js';
+ lessScriptNode.async = true;
+ lessScriptNode.onload = () => {
+ buildIt();
+ lessScriptNode.onload = null;
+ };
+ document.body.appendChild(lessStyleNode);
+ document.body.appendChild(lessConfigNode);
+ document.body.appendChild(lessScriptNode);
+ lessNodesAppended = true;
+ } else {
+ buildIt();
+ }
+};
+
+const updateColorWeak = colorWeak => {
+ // document.body.className = colorWeak ? 'colorWeak' : '';
+ colorWeak ? document.body.classList.add('colorWeak') : document.body.classList.remove('colorWeak')
+};
+
+export { updateTheme, colorList, updateColorWeak }
\ No newline at end of file
diff --git a/src/config/router.config.js b/src/config/router.config.js
new file mode 100644
index 0000000..2fd01cb
--- /dev/null
+++ b/src/config/router.config.js
@@ -0,0 +1,65 @@
+import { UserLayout, TabLayout, RouteView, BlankLayout, PageView } from '@/components/layouts'
+
+/**
+ * 走菜单,走权限控制
+ * @type {[null,null]}
+ */
+export const asyncRouterMap = [
+
+ {
+ path: '/',
+ name: 'dashboard',
+ component: TabLayout,
+ meta: { title: '首页' },
+ redirect: '/dashboard/analysis',
+ children: [
+
+ ]
+ },
+ {
+ path: '*', redirect: '/404', hidden: true
+ }
+]
+
+/**
+ * 基础路由
+ * @type { *[] }
+ */
+export const constantRouterMap = [
+ {
+ path: '/user',
+ component: UserLayout,
+ redirect: '/user/login',
+ hidden: true,
+ children: [
+ {
+ path: 'login',
+ name: 'login',
+ component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
+ },
+ {
+ path: 'register',
+ name: 'register',
+ component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
+ }
+ ]
+ },
+ {
+ path: '/dashboard',
+ component: TabLayout,
+ redirect: '/dashboard/analysis',
+ children: [
+ {
+ path: 'analysis',
+ name: 'analysis',
+ meta: { title: '首页' },
+ component: () => import(/* webpackChunkName: "dashboard" */ '@/views/dashboard/Analysis')
+ }
+ ]
+ },
+ {
+ path: '/404',
+ component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
+ },
+
+]
diff --git a/src/defaultSettings.js b/src/defaultSettings.js
new file mode 100644
index 0000000..ee5ba23
--- /dev/null
+++ b/src/defaultSettings.js
@@ -0,0 +1,32 @@
+/**
+ * 项目默认配置项
+ * primaryColor - 默认主题色
+ * navTheme - sidebar theme ['dark', 'light'] 两种主题
+ * colorWeak - 色盲模式
+ * layout - 整体布局方式 ['sidemenu', 'topmenu'] 两种布局
+ * fixedHeader - 固定 Header : boolean
+ * fixSiderbar - 固定左侧菜单栏 : boolean
+ * autoHideHeader - 向下滚动时,隐藏 Header : boolean
+ * contentWidth - 内容区布局: 流式 | 固定
+ *
+ * storageOptions: {} - Vue-ls 插件配置项 (localStorage/sessionStorage)
+ *
+ */
+
+export default {
+ primaryColor: '#1890FF', // primary color of ant design
+ navTheme: 'light', // theme for nav menu
+ layout: 'sidemenu', // nav menu position: sidemenu or topmenu
+ contentWidth: 'Fixed', // layout of content: Fluid or Fixed, only works when layout is topmenu
+ fixedHeader: true, // sticky header
+ fixSiderbar: true, // sticky siderbar
+ autoHideHeader: false, // auto hide header
+ colorWeak: false,
+ multipage: true, //默认多页签模式
+ // vue-ls options
+ storageOptions: {
+ namespace: 'pro__', // key prefix
+ name: 'ls', // name variable Vue.[ls] or this.[$ls],
+ storage: 'local', // storage name session, local, memory
+ }
+}
\ No newline at end of file
diff --git a/src/main.js b/src/main.js
new file mode 100644
index 0000000..a916e40
--- /dev/null
+++ b/src/main.js
@@ -0,0 +1,72 @@
+import Vue from 'vue'
+import App from './App.vue'
+import Storage from 'vue-ls'
+import router from './router'
+import store from './store/'
+
+import { VueAxios } from "@/utils/request"
+
+import Antd from 'ant-design-vue'
+import Viser from 'viser-vue'
+import 'ant-design-vue/dist/antd.less'; // or 'ant-design-vue/dist/antd.less'
+
+import '@/permission' // permission control
+import '@/utils/filter' // base filter
+import Print from 'vue-print-nb-jeecg'
+/*import '@babel/polyfill'*/
+import preview from 'vue-photo-preview'
+import 'vue-photo-preview/dist/skin.css'
+import 'intro.js/introjs.css'
+
+import {
+ ACCESS_TOKEN,
+ DEFAULT_COLOR,
+ DEFAULT_THEME,
+ DEFAULT_LAYOUT_MODE,
+ DEFAULT_COLOR_WEAK,
+ SIDEBAR_TYPE,
+ DEFAULT_FIXED_HEADER,
+ DEFAULT_FIXED_HEADER_HIDDEN,
+ DEFAULT_FIXED_SIDEMENU,
+ DEFAULT_CONTENT_WIDTH_TYPE,
+ DEFAULT_MULTI_PAGE
+} from "@/store/mutation-types"
+import config from '@/defaultSettings'
+
+import hasPermission from '@/utils/hasPermission'
+import vueBus from '@/utils/vueBus';
+import JeecgComponents from '@/components/jeecg/index'
+import '@/assets/less/JAreaLinkage.less'
+import VueAreaLinkage from 'vue-area-linkage'
+
+Vue.config.productionTip = false
+Vue.use(Storage, config.storageOptions)
+Vue.use(Antd)
+Vue.use(VueAxios, router)
+Vue.use(Viser)
+Vue.use(hasPermission)
+Vue.use(Print)
+Vue.use(preview)
+Vue.use(vueBus);
+Vue.use(JeecgComponents)
+Vue.use(VueAreaLinkage)
+
+new Vue({
+ router,
+ store,
+ mounted () {
+ // store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true))
+ store.commit('SET_SIDEBAR_TYPE', true)
+ store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme))
+ store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout))
+ store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, config.fixedHeader))
+ store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, config.fixSiderbar))
+ store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, config.contentWidth))
+ store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, config.autoHideHeader))
+ store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, config.colorWeak))
+ store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor))
+ store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
+ store.commit('SET_MULTI_PAGE',Vue.ls.get(DEFAULT_MULTI_PAGE,config.multipage))
+ },
+ render: h => h(App)
+}).$mount('#app')
\ No newline at end of file
diff --git a/src/mixins/JEditableTableMixin.js b/src/mixins/JEditableTableMixin.js
new file mode 100644
index 0000000..484ccd0
--- /dev/null
+++ b/src/mixins/JEditableTableMixin.js
@@ -0,0 +1,164 @@
+import JEditableTable from '@/components/jeecg/JEditableTable'
+import { VALIDATE_NO_PASSED, getRefPromise, validateFormAndTables } from '@/utils/JEditableTableUtil'
+import { httpAction, getAction } from '@/api/manage'
+
+export const JEditableTableMixin = {
+ components: {
+ JEditableTable
+ },
+ data() {
+ return {
+ title: '操作',
+ visible: false,
+ form: this.$form.createForm(this),
+ confirmLoading: false,
+ model: {},
+ labelCol: {
+ xs: { span: 24 },
+ sm: { span: 6 }
+ },
+ wrapperCol: {
+ xs: { span: 24 },
+ sm: { span: 18 }
+ }
+ }
+ },
+ methods: {
+
+ /** 获取所有的editableTable实例 */
+ getAllTable() {
+ if (!(this.refKeys instanceof Array)) {
+ throw this.throwNotArray('refKeys')
+ }
+ let values = this.refKeys.map(key => getRefPromise(this, key))
+ return Promise.all(values)
+ },
+
+ /** 遍历所有的JEditableTable实例 */
+ eachAllTable(callback) {
+ // 开始遍历
+ this.getAllTable().then(tables => {
+ tables.forEach((item, index) => {
+ if (typeof callback === 'function') {
+ callback(item, index)
+ }
+ })
+ })
+ },
+
+ /** 当点击新增按钮时调用此方法 */
+ add() {
+ if (typeof this.addBefore === 'function') this.addBefore()
+ // 默认新增空数据
+ let rowNum = this.addDefaultRowNum
+ if (typeof rowNum !== 'number') {
+ rowNum = 1
+ console.warn('由于你没有在 data 中定义 addDefaultRowNum 或 addDefaultRowNum 不是数字,所以默认添加一条空数据,如果不想默认添加空数据,请将定义 addDefaultRowNum 为 0')
+ }
+ this.eachAllTable((item) => {
+ item.add(rowNum)
+ })
+ if (typeof this.addAfter === 'function') this.addAfter(this.model)
+ this.edit({})
+ },
+ /** 当点击了编辑(修改)按钮时调用此方法 */
+ edit(record) {
+ if (typeof this.editBefore === 'function') this.editBefore(record)
+ this.visible = true
+ this.activeKey = this.refKeys[0]
+ this.form.resetFields()
+ this.model = Object.assign({}, record)
+ if (typeof this.editAfter === 'function') this.editAfter(this.model)
+ },
+ /** 关闭弹窗,并将所有JEditableTable实例回归到初始状态 */
+ close() {
+ this.visible = false
+ this.eachAllTable((item) => {
+ item.initialize()
+ })
+ this.$emit('close')
+ },
+
+ /** 查询某个tab的数据 */
+ requestSubTableData(url, params, tab, success) {
+ tab.loading = true
+ getAction(url, params).then(res => {
+ if(res && res.code === 200){
+ tab.dataSource = res.data.rows
+ typeof success === 'function' ? success(res) : ''
+ }
+ }).finally(() => {
+ tab.loading = false
+ })
+ },
+ /** 发起请求,自动判断是执行新增还是修改操作 */
+ request(formData) {
+ let url = this.url.add, method = 'post'
+ if (this.model.id) {
+ url = this.url.edit
+ method = 'put'
+ }
+ this.confirmLoading = true
+ httpAction(url, formData, method).then((res) => {
+ if(res.code === 200){
+ this.$emit('ok')
+ this.confirmLoading = false
+ this.close()
+ } else {
+ this.$message.warning(res.data.message);
+ this.confirmLoading = false
+ }
+ }).finally(() => {
+ })
+ },
+
+ /* --- handle 事件 --- */
+
+ /** ATab 选项卡切换事件 */
+ handleChangeTabs(key) {
+ // 自动重置scrollTop状态,防止出现白屏
+ getRefPromise(this, key).then(editableTable => {
+ editableTable.resetScrollTop()
+ })
+ },
+ /** 关闭按钮点击事件 */
+ handleCancel() {
+ this.close()
+ },
+ /** 确定按钮点击事件 */
+ handleOk() {
+ /** 触发表单验证 */
+ this.getAllTable().then(tables => {
+ /** 一次性验证主表和所有的次表 */
+ return validateFormAndTables(this.form, tables)
+ }).then(allValues => {
+ if (typeof this.classifyIntoFormData !== 'function') {
+ throw this.throwNotFunction('classifyIntoFormData')
+ }
+ let formData = this.classifyIntoFormData(allValues)
+ // 发起请求
+ return this.request(formData)
+ }).catch(e => {
+ if (e.error === VALIDATE_NO_PASSED) {
+ // 如果有未通过表单验证的子表,就自动跳转到它所在的tab
+ this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
+ } else {
+ console.error(e)
+ }
+ })
+ },
+
+ /* --- throw --- */
+
+ /** not a function */
+ throwNotFunction(name) {
+ return `${name} 未定义或不是一个函数`
+ },
+
+ /** not a array */
+ throwNotArray(name) {
+ return `${name} 未定义或不是一个数组`
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/src/mixins/JeecgListMixin.js b/src/mixins/JeecgListMixin.js
new file mode 100644
index 0000000..f226782
--- /dev/null
+++ b/src/mixins/JeecgListMixin.js
@@ -0,0 +1,575 @@
+/**
+ * 新增修改完成调用 modalFormOk方法 编辑弹框组件ref定义为modalForm
+ * 高级查询按钮调用 superQuery方法 高级查询组件ref定义为superQueryModal
+ * data中url定义 list为查询列表 delete为删除单条记录 deleteBatch为批量删除
+ */
+import { filterObj, getMpListShort, getNowFormatStr } from '@/utils/util'
+import { deleteAction, getAction, postAction, downFile, downFilePost, getFileAccessHttpUrl } from '@/api/manage'
+import Vue from 'vue'
+import VueDraggableResizable from 'vue-draggable-resizable'
+import { ACCESS_TOKEN } from "@/store/mutation-types"
+import {mixinDevice} from '@/utils/mixin.js'
+
+export const JeecgListMixin = {
+ mixins: [mixinDevice],
+ components: {
+ VueDraggableResizable
+ },
+ data(){
+ return {
+ //token header
+ tokenHeader: {'X-Access-Token': Vue.ls.get(ACCESS_TOKEN)},
+ /*卡片样式 */
+ cardStyle: '',
+ /* 查询条件-请不要在queryParam中声明非字符串值的属性 */
+ queryParam: {},
+ /* 数据源 */
+ dataSource:[],
+ // 实际列
+ columns:[],
+ // 实际索引
+ settingDataIndex:[],
+ /* 分页参数 */
+ ipagination:{
+ current: 1,
+ pageSize: 10,
+ pageSizeOptions: ['10', '20', '30', '50', '100'],
+ showTotal: (total, range) => {
+ return range[0] + "-" + range[1] + " 共" + total + "条"
+ },
+ showQuickJumper: true,
+ showSizeChanger: true,
+ total: 0
+ },
+ /* 控制table高度 */
+ scroll: {},
+ /* 排序参数 */
+ isorter:{
+ column: 'createTime',
+ order: 'desc',
+ },
+ /* 筛选参数 */
+ filters: {},
+ /* table加载状态 */
+ loading:false,
+ /* table选中keys*/
+ selectedRowKeys: [],
+ /* table选中records*/
+ selectionRows: [],
+ /* 查询折叠 */
+ toggleSearchStatus:false,
+ /* 高级查询条件生效状态 */
+ superQueryFlag:false,
+ /* 高级查询条件 */
+ superQueryParams: '',
+ /** 高级查询拼接方式 */
+ superQueryMatchType: 'and',
+ /** 是否加载时就执行 */
+ disableMixinCreated: false,
+ /* 按钮权限 */
+ btnEnableList: '',
+ }
+ },
+ created() {
+ if(this.isDesktop()) {
+ this.cardStyle = 'height:' + (document.documentElement.clientHeight-100) + 'px'
+ }
+ if(!this.disableMixinCreated){
+ //console.log(' -- mixin created -- ')
+ this.loadData();
+ //初始化字典配置 在自己页面定义
+ this.initDictConfig();
+ //初始化按钮权限
+ this.initActiveBtnStr();
+ }
+ },
+ mounted () {
+ this.initScroll()
+ },
+ methods:{
+ loadData(arg) {
+ if(!this.url.list){
+ this.$message.error("请设置url.list属性!")
+ return
+ }
+ //加载数据 若传入参数1则加载第一页的内容
+ if (arg === 1) {
+ this.ipagination.current = 1
+ }
+ let params = this.getQueryParams() //查询条件
+ this.loading = true
+ getAction(this.url.list, params).then((res) => {
+ if (res.code===200) {
+ this.dataSource = res.data.rows
+ this.ipagination.total = res.data.total
+ this.tableAddTotalRow(this.columns, this.dataSource)
+ } else if(res.code===510){
+ this.$message.warning(res.data)
+ } else {
+ this.$message.warning(res.data.message)
+ }
+ this.loading = false
+ this.onClearSelected()
+ })
+ },
+ initDictConfig(){
+ //console.log("--这是一个假的方法!")
+ },
+ handleSuperQuery(params, matchType) {
+ //高级查询方法
+ if(!params){
+ this.superQueryParams=''
+ this.superQueryFlag = false
+ }else{
+ this.superQueryFlag = true
+ this.superQueryParams=JSON.stringify(params)
+ this.superQueryMatchType = matchType
+ }
+ this.loadData(1)
+ },
+ getQueryParams() {
+ //获取查询条件
+ let sqp = {}
+ if(this.superQueryParams){
+ sqp['superQueryParams']=encodeURI(this.superQueryParams)
+ sqp['superQueryMatchType'] = this.superQueryMatchType
+ }
+ let searchObj = {}
+ searchObj.search = JSON.stringify(this.queryParam);
+ var param = Object.assign(sqp, searchObj, this.isorter ,this.filters);
+ param.field = this.getQueryField();
+ param.currentPage = this.ipagination.current;
+ param.pageSize = this.ipagination.pageSize;
+ return filterObj(param);
+ },
+ getQueryField() {
+ var str = "id,";
+ this.columns.forEach(function (value) {
+ str += "," + value.dataIndex;
+ });
+ return str;
+ },
+ onSelectChange(selectedRowKeys, selectionRows) {
+ this.selectedRowKeys = selectedRowKeys;
+ this.selectionRows = selectionRows;
+ },
+ onClearSelected() {
+ this.selectedRowKeys = []
+ this.selectionRows = []
+ },
+ searchQuery() {
+ this.loadData(1);
+ },
+ superQuery() {
+ this.$refs.superQueryModal.show();
+ },
+ searchReset() {
+ this.queryParam = {}
+ this.loadData(1);
+ },
+ batchSetStatus: function (status) {
+ if(!this.url.batchSetStatusUrl){
+ this.$message.error("请设置url.batchSetStatusUrl属性!")
+ return
+ }
+ if (this.selectedRowKeys.length <= 0) {
+ this.$message.warning('请选择一条记录!');
+ return;
+ } else {
+ var ids = "";
+ for (var a = 0; a < this.selectedRowKeys.length; a++) {
+ ids += this.selectedRowKeys[a] + ",";
+ }
+ var that = this;
+ this.$confirm({
+ title: "确认操作",
+ content: "是否操作选中数据?",
+ onOk: function () {
+ that.loading = true;
+ postAction(that.url.batchSetStatusUrl, {status: status, ids: ids}).then((res) => {
+ if(res.code === 200){
+ that.loadData()
+ } else {
+ that.$message.warning(res.data.message);
+ }
+ }).finally(() => {
+ that.loading = false;
+ });
+ }
+ });
+ }
+ },
+ batchDel: function () {
+ if(!this.url.deleteBatch){
+ this.$message.error("请设置url.deleteBatch属性!")
+ return
+ }
+ if (this.selectedRowKeys.length <= 0) {
+ this.$message.warning('请选择一条记录!');
+ return;
+ } else {
+ var ids = "";
+ for (var a = 0; a < this.selectedRowKeys.length; a++) {
+ ids += this.selectedRowKeys[a] + ",";
+ }
+ var that = this;
+ this.$confirm({
+ title: "确认删除",
+ content: "是否删除选中数据?",
+ onOk: function () {
+ that.loading = true;
+ deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => {
+ if(res.code === 200){
+ that.loadData()
+ } else {
+ that.$message.warning(res.data.message);
+ }
+ }).finally(() => {
+ that.loading = false;
+ });
+ }
+ });
+ }
+ },
+ handleDelete: function (id) {
+ if(!this.url.delete){
+ this.$message.error("请设置url.delete属性!")
+ return
+ }
+ var that = this;
+ deleteAction(that.url.delete, {id: id}).then((res) => {
+ if(res.code === 200){
+ that.loadData();
+ } else {
+ that.$message.warning(res.data.message);
+ }
+ });
+ },
+ handleEdit: function (record) {
+ this.$refs.modalForm.edit(record);
+ this.$refs.modalForm.title = "编辑";
+ this.$refs.modalForm.disableSubmit = false;
+ },
+ handleAdd: function () {
+ this.$refs.modalForm.add();
+ this.$refs.modalForm.title = "新增";
+ this.$refs.modalForm.disableSubmit = false;
+ },
+ handleTableChange(pagination, filters, sorter) {
+ //分页、排序、筛选变化时触发
+ if (Object.keys(sorter).length > 0) {
+ if(sorter.order) {
+ this.isorter.column = sorter.field
+ this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
+ } else {
+ this.isorter.column = 'createTime'
+ this.isorter.order = 'desc'
+ }
+ }
+ if(pagination && pagination.current) {
+ this.ipagination = pagination;
+ }
+ this.loadData();
+ },
+ handleToggleSearch(){
+ this.toggleSearchStatus = !this.toggleSearchStatus;
+ },
+ // 给popup查询使用(查询区域不支持回填多个字段,限制只返回一个字段)
+ getPopupField(fields){
+ return fields.split(',')[0]
+ },
+ modalFormOk() {
+ // 新增/修改 成功时,重载列表
+ this.loadData()
+ },
+ modalFormClose() {
+ // 关闭页面时,重载列表
+ this.loadData()
+ },
+ handleDetail:function(record, type, prefixNo){
+ this.$refs.modalDetail.show(record, type, prefixNo);
+ this.$refs.modalDetail.title=type+"-详情";
+ },
+ //加载初始化列
+ initColumnsSetting(){
+ let columnsStr = Vue.ls.get(this.pageName)
+ if(columnsStr && columnsStr.indexOf(',')>-1) {
+ this.settingDataIndex = columnsStr.split(',')
+ } else {
+ this.settingDataIndex = this.defDataIndex
+ }
+ this.columns = this.defColumns.filter(item => {
+ return this.settingDataIndex.includes(item.dataIndex)
+ })
+ },
+ //列设置更改事件
+ onColChange (checkedValues) {
+ this.columns = this.defColumns.filter(item => {
+ return checkedValues.includes(item.dataIndex)
+ })
+ let columnsStr = checkedValues.join()
+ Vue.ls.set(this.pageName, columnsStr)
+ },
+ //恢复默认
+ handleRestDefault() {
+ Vue.ls.remove(this.pageName)
+ this.initColumnsSetting()
+ },
+ /* 导出 */
+ handleExportXls2(){
+ let paramsStr = encodeURI(JSON.stringify(this.getQueryParams()));
+ let url = `${window._CONFIG['domianURL']}/${this.url.exportXlsUrl}?paramsStr=${paramsStr}`;
+ window.location.href = url;
+ },
+ //通过get方式导出Excel
+ handleExportXls(fileName){
+ if(!fileName || typeof fileName != "string"){
+ fileName = "导出文件"
+ }
+ let param = {...this.queryParam};
+ if(this.selectedRowKeys && this.selectedRowKeys.length>0){
+ param['selections'] = this.selectedRowKeys.join(",")
+ }
+ console.log("导出参数",param)
+ downFile(this.url.exportXlsUrl,param).then((data)=>{
+ if (!data) {
+ this.$message.warning("文件下载失败")
+ return
+ }
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
+ window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
+ }else{
+ let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
+ let link = document.createElement('a')
+ link.style.display = 'none'
+ link.href = url
+ link.setAttribute('download', fileName + '_' + getNowFormatStr()+'.xls')
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link); //下载完成移除元素
+ window.URL.revokeObjectURL(url); //释放掉blob对象
+ }
+ })
+ },
+ //通过post方式导出Excel
+ handleExportXlsPost(fileName, title, head, tip, list) {
+ if(!fileName || typeof fileName != "string"){
+ fileName = "导出文件"
+ }
+ let paramObj = {'title': title, 'head': head, 'tip': tip, 'list': list}
+ console.log("导出参数", paramObj)
+ downFilePost(paramObj).then((data)=>{
+ if (!data) {
+ this.$message.warning("文件下载失败")
+ return
+ }
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
+ window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
+ }else{
+ let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
+ let link = document.createElement('a')
+ link.style.display = 'none'
+ link.href = url
+ link.setAttribute('download', fileName + '_' + getNowFormatStr()+'.xls')
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link); //下载完成移除元素
+ window.URL.revokeObjectURL(url); //释放掉blob对象
+ }
+ })
+ },
+ /* 导入 */
+ handleImportExcel(info){
+ this.confirmLoading = true
+ if (info.file.status !== 'uploading') {
+ console.log(info.file, info.fileList);
+ }
+ if (info.file.status === 'done') {
+ if (info.file.response) {
+ // this.$message.success(`${info.file.name} 文件上传成功`);
+ if (info.file.response.code === 200) {
+ this.$message.success(info.file.response.data || `${info.file.name} 文件上传成功`)
+ } else {
+ this.$message.warning(info.file.response.data, 8)
+ }
+ this.confirmLoading = false
+ this.visible = false
+ this.$emit('ok')
+ } else {
+ this.$message.error(`${info.file.name} ${info.file.response.data}.`);
+ this.confirmLoading = false
+ }
+ } else if (info.file.status === 'error') {
+ this.$message.error(`文件上传失败: ${info.file.msg} `)
+ this.confirmLoading = false
+ }
+ },
+ /* 图片预览 */
+ getImgView(text){
+ if(text && text.indexOf(",")>0){
+ text = text.substring(0,text.indexOf(","))
+ }
+ return getFileAccessHttpUrl(text)
+ },
+ /* 文件下载 */
+ uploadFile(text){
+ if(!text){
+ this.$message.warning("未知的文件")
+ return;
+ }
+ if(text.indexOf(",")>0){
+ text = text.substring(0,text.indexOf(","))
+ }
+ let url = getFileAccessHttpUrl(text)
+ window.open(url);
+ },
+ /* 按钮权限 */
+ initActiveBtnStr() {
+ let btnStrList = Vue.ls.get('winBtnStrList'); //按钮功能列表 JSON字符串
+ this.btnEnableList = ""; //按钮列表
+ if (this.urlPath && btnStrList) {
+ for (let i = 0; i < btnStrList.length; i++) {
+ if (btnStrList[i].url === this.urlPath) {
+ if (btnStrList[i].btnStr) {
+ this.btnEnableList = btnStrList[i].btnStr
+ }
+ }
+ }
+ }
+ },
+ /* 初始化表格横向或纵向滚动 */
+ initScroll() {
+ if (this.isMobile()) {
+ this.scroll.y = ''
+ } else {
+ let basicWidth = 150
+ let basicLength = 274
+ let searchWrapperDomLen=0, operatorDomLen=0
+ //搜索区域
+ let searchWrapperDom = document.getElementsByClassName('table-page-search-wrapper')
+ //操作按钮区域
+ let operatorDom = document.getElementsByClassName('table-operator')
+ if(searchWrapperDom && searchWrapperDom[0]) {
+ searchWrapperDomLen = searchWrapperDom[0].offsetHeight
+ }
+ if(operatorDom && operatorDom[0]) {
+ operatorDomLen = operatorDom[0].offsetHeight+10
+ }
+ this.scroll.x = document.documentElement.clientWidth-basicWidth-64
+ this.scroll.y = document.documentElement.clientHeight-searchWrapperDomLen-operatorDomLen-basicLength
+ }
+ },
+ //拖拽组件
+ handleDrag(column){
+ return {
+ header: {
+ cell: (h, props, children) => {
+ const { key, ...restProps } = props
+ // 父表格列宽拖拽逻辑
+ const col = column.find((col) => {
+ const k = col.dataIndex || col.key
+ return k === key
+ })
+ if (!col || !col.width) {
+ return h('th', { ...restProps }, children)
+ }
+
+ const dragProps = {
+ key: col.dataIndex || col.key,
+ class: 'table-draggable-handle',
+ attrs: {
+ w: 10,
+ x: col.width,
+ z: 1,
+ axis: 'x',
+ draggable: true,
+ resizable: false,
+ },
+ on: {
+ dragging: (x, y) => {
+ col.width = Math.max(x, 1)
+ },
+ },
+ }
+ const drag = h(VueDraggableResizable, { ...dragProps })
+ return h('th', { ...restProps, class: 'resize-table-th' }, [children, drag])
+ },
+ }
+ }
+ },
+ /** 表格增加合计行 */
+ tableAddTotalRow(columns, dataSource) {
+ if(dataSource.length>0 && this.ipagination.pageSize%10===1) {
+ //分页条数为11、21、31等的时候增加合计行
+ let numKey = 'rowIndex'
+ let totalRow = { [numKey]: '合计' }
+ //需要合计的列,记住最后的逗号不要删除
+ let parseCols = 'initialStock,currentStock,currentStockPrice,currentWeight,initialAmount,thisMonthAmount,currentAmount,inSum,inSumPrice,' +
+ 'inOutSumPrice,outSum,outSumPrice,outInSumPrice,operNumber,allPrice,numSum,priceSum,prevSum,thisSum,thisAllPrice,changeAmount,' +
+ 'allPrice,taxMoney,currentNumber,lowCritical,highCritical,preNeed,debtMoney,backMoney,allNeed,' +
+ 'needDebt,realNeedDebt,finishDebt,debt,'
+ columns.forEach(column => {
+ let { key, dataIndex } = column
+ if (![key, dataIndex].includes(numKey)) {
+ let total = 0
+ dataSource.forEach(data => {
+ if(parseCols.indexOf(dataIndex+',')>-1) {
+ if(data[dataIndex]) {
+ total += Number.parseFloat(data[dataIndex])
+ } else {
+ total += 0
+ }
+ } else {
+ total = '-'
+ }
+ })
+ if (total !== '-') {
+ total = total.toFixed(2)
+ }
+ totalRow[dataIndex] = total
+ }
+ })
+ dataSource.push(totalRow)
+ //总数要增加合计的行数,每页都有一行合计,所以总数要加上
+ let size = Math.ceil(this.ipagination.total/(this.ipagination.pageSize-1))
+ this.ipagination.total = this.ipagination.total + size
+ }
+ },
+ //动态替换扩展字段
+ handleChangeOtherField(showQuery) {
+ let mpStr = getMpListShort(Vue.ls.get('materialPropertyList'))
+ if(mpStr) {
+ let mpArr = mpStr.split(',')
+ if(mpArr.length ===3) {
+ if(showQuery) {
+ this.queryTitle.mp1 = mpArr[0]
+ this.queryTitle.mp2 = mpArr[1]
+ this.queryTitle.mp3 = mpArr[2]
+ }
+ for (let i = 0; i < this.defColumns.length; i++) {
+ if(this.defColumns[i].dataIndex === 'otherField1') {
+ this.defColumns[i].title = mpArr[0]
+ }
+ if(this.defColumns[i].dataIndex === 'otherField2') {
+ this.defColumns[i].title = mpArr[1]
+ }
+ if(this.defColumns[i].dataIndex === 'otherField3') {
+ this.defColumns[i].title = mpArr[2]
+ }
+ }
+ }
+ }
+ },
+ paginationChange(page, pageSize) {
+ this.ipagination.current = page
+ this.ipagination.pageSize = pageSize
+ this.loadData(this.ipagination.current);
+ },
+ paginationShowSizeChange(current, size) {
+ this.ipagination.current = current
+ this.ipagination.pageSize = size
+ this.loadData(this.ipagination.current);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/permission.js b/src/permission.js
new file mode 100644
index 0000000..d7cf1b1
--- /dev/null
+++ b/src/permission.js
@@ -0,0 +1,67 @@
+import Vue from 'vue'
+import router from './router'
+import store from './store'
+import NProgress from 'nprogress' // progress bar
+import 'nprogress/nprogress.css' // progress bar style
+import { USER_ID,INDEX_MAIN_PAGE_PATH } from '@/store/mutation-types'
+import { generateIndexRouter } from "@/utils/util"
+
+NProgress.configure({ showSpinner: false }) // NProgress Configuration
+
+const whiteList = ['/user/login', '/user/register', '/user/register-result'] // no redirect whitelist
+
+router.beforeEach((to, from, next) => {
+ NProgress.start() // start progress bar
+ if (Vue.ls.get(USER_ID)) {
+ /* has token */
+ if (to.path === '/' || to.path === '/user/login') {
+ next({ path: INDEX_MAIN_PAGE_PATH })
+ NProgress.done()
+ } else {
+ if (store.getters.permissionList.length === 0) {
+ store.dispatch('GetPermissionList').then(res => {
+ const menuData = res;
+ if (menuData === null || menuData === "" || menuData === undefined) {
+ return;
+ }
+ // 缓存用户的按钮权限
+ store.dispatch('GetUserBtnList').then(res => {
+ Vue.ls.set('winBtnStrList', res.data.userBtn, 7 * 24 * 60 * 60 * 1000)
+ })
+ let constRoutes = [];
+ constRoutes = generateIndexRouter(menuData);
+ // 添加主界面路由
+ store.dispatch('UpdateAppRouter', { constRoutes }).then(() => {
+ // 根据roles权限生成可访问的路由表
+ // 动态添加可访问路由表
+ router.addRoutes(store.getters.addRouters)
+ const redirect = decodeURIComponent(from.query.redirect || to.path)
+ next({ path: redirect })
+ })
+ })
+ .catch(() => {
+ store.dispatch('Logout').then(() => {
+ next({ path: '/user/login' })
+ })
+ })
+ } else {
+ if (to.path) {
+ _hmt.push(['_trackPageview', '/#' + to.fullPath]);
+ }
+ next()
+ }
+ }
+ } else {
+ if (whiteList.indexOf(to.path) !== -1) {
+ // 在免登录白名单,直接进入
+ next()
+ } else {
+ next({ path: '/user/login' })
+ NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
+ }
+ }
+})
+
+router.afterEach(() => {
+ NProgress.done() // finish progress bar
+})
diff --git a/src/router/README.md b/src/router/README.md
new file mode 100644
index 0000000..d725135
--- /dev/null
+++ b/src/router/README.md
@@ -0,0 +1,126 @@
+路由/菜单说明
+====
+
+
+
+配置文件路径
+----
+
+`@/config/router.config.js`
+
+
+
+格式和说明
+----
+
+```javascript
+/**
+ * 路由配置说明:
+ * 建议:sider menu 请不要超过三级菜单,若超过三级菜单,则应该设计为顶部主菜单 配合左侧次级菜单
+ *
+ **/
+ {
+ redirect: noredirect,
+ name: 'router-name',
+ hidden: true,
+ meta: {
+ title: 'title',
+ icon: 'a-icon',
+ keepAlive: true,
+ hiddenHeaderContent: true,
+ }
+}
+```
+
+
+
+`{ Route }` 对象
+
+| 参数 | 说明 | 类型 | 默认值 |
+| -------- | ----------------------------------------- | ------- | ------ |
+| hidden | 控制路由是否显示在 sidebar | boolean | falase |
+| redirect | 重定向地址, 访问这个路由时,自定进行重定向 | string | - |
+| name | 路由名称, 建议设置,且不能重名 | string | - |
+| meta | 路由元信息(路由附带扩展信息) | object | {} |
+
+
+
+`{ Meta }` 路由元信息对象
+
+| 参数 | 说明 | 类型 | 默认值 |
+| ------------------- | ------------------------------------------------------------ | ------- | ------ |
+| title | 路由标题, 用于显示面包屑, 页面标题 *推荐设置 | string | - |
+| icon | 路由在 menu 上显示的图标 | string | - |
+| keepAlive | 缓存该路由 | boolean | false |
+| hiddenHeaderContent | *特殊 隐藏 [PageHeader](https://github.com/sendya/ant-design-pro-vue/blob/master/src/components/layout/PageHeader.vue#L14) 组件中的页面带的 面包屑和页面标题栏 | boolean | false |
+| permission | 与项目提供的权限拦截匹配的权限,如果不匹配,则会被禁止访问该路由页面 | array | [] |
+
+
+
+路由例子
+----
+
+```ecmascript 6
+const asyncRouterMap = [
+ {
+ path: '/',
+ name: 'index',
+ component: BasicLayout,
+ meta: { title: '首页' },
+ redirect: '/dashboard/analysis',
+ children: [
+ {
+ path: '/dashboard',
+ component: Layout,
+ name: 'dashboard',
+ redirect: '/dashboard/workplace',
+ meta: {title: '仪表盘', icon: 'dashboard', permission: ['dashboard']},
+ children: [
+ {
+ path: '/dashboard/analysis',
+ name: 'Analysis',
+ component: () => import('@/views/dashboard/Analysis'),
+ meta: {title: '分析页', permission: ['dashboard']}
+ }
+ ]
+ },
+
+ // result
+ {
+ path: '/result',
+ name: 'result',
+ component: PageView,
+ redirect: '/result/success',
+ meta: { title: '结果页', icon: 'check-circle-o', permission: [ 'result' ] },
+ children: [
+ {
+ path: '/result/success',
+ name: 'ResultSuccess',
+ component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
+ // 该页面隐藏面包屑和页面标题栏
+ meta: { title: '成功', hiddenHeaderContent: true, permission: [ 'result' ] }
+ },
+ {
+ path: '/result/fail',
+ name: 'ResultFail',
+ component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
+ // 该页面隐藏面包屑和页面标题栏
+ meta: { title: '失败', hiddenHeaderContent: true, permission: [ 'result' ] }
+ }
+ ]
+ },
+ ...
+ ]
+ },
+]
+```
+
+> 1. 请注意 `component: () => import('..') ` 方式引入路由的页面组件为 懒加载模式。具体可以看 [Vue 官方文档](https://router.vuejs.org/zh/guide/advanced/lazy-loading.html)
+> 2. 增加新的路由应该增加在 '/' (index) 路由的 `children` 内
+> 3. `permission` 可以进行自定义修改,只需要对这个模块进行自定义修改即可 [src/store/modules/permission.js#L10](https://github.com/sendya/ant-design-pro-vue/blob/master/src/store/modules/permission.js#L10)
+
+
+
+附权限路由结构:
+
+
\ No newline at end of file
diff --git a/src/router/index.js b/src/router/index.js
new file mode 100644
index 0000000..d6a2a29
--- /dev/null
+++ b/src/router/index.js
@@ -0,0 +1,22 @@
+import Vue from 'vue'
+import Router from 'vue-router'
+import { constantRouterMap } from '@/config/router.config'
+
+//update-begin-author:taoyan date:20191011 for:TASK #3214 【优化】访问online功能测试 浏览器控制台抛出异常
+try {
+ const originalPush = Router.prototype.push
+ Router.prototype.push = function push(location) {
+ return originalPush.call(this, location).catch(err => err)
+ }
+} catch (e) {
+}
+//update-end-author:taoyan date:20191011 for:TASK #3214 【优化】访问online功能测试 浏览器控制台抛出异常
+
+Vue.use(Router)
+
+export default new Router({
+ mode: 'history',
+ base: process.env.BASE_URL,
+ scrollBehavior: () => ({ y: 0 }),
+ routes: constantRouterMap
+})
\ No newline at end of file
diff --git a/src/store/getters.js b/src/store/getters.js
new file mode 100644
index 0000000..ae79b66
--- /dev/null
+++ b/src/store/getters.js
@@ -0,0 +1,22 @@
+import Vue from 'vue'
+import { USER_INFO, ENHANCE_PRE } from "@/store/mutation-types"
+const getters = {
+ device: state => state.app.device,
+ theme: state => state.app.theme,
+ color: state => state.app.color,
+ token: state => state.user.token,
+ // avatar: state => {state.user.avatar = Vue.ls.get(USER_INFO).avatar; return state.user.avatar},
+ username: state => state.user.username,
+ nickname: state => {state.user.username = Vue.ls.get(USER_INFO).username; return state.user.username},
+ welcome: state => state.user.welcome,
+ permissionList: state => state.user.permissionList,
+ userInfo: state => {state.user.info = Vue.ls.get(USER_INFO); return state.user.info},
+ addRouters: state => state.permission.addRouters,
+ enhanceJs:(state) => (code) => {
+ state.enhance.enhanceJs[code] = Vue.ls.get(ENHANCE_PRE+code);
+ return state.enhance.enhanceJs[code]
+ }
+
+}
+
+export default getters
\ No newline at end of file
diff --git a/src/store/index.js b/src/store/index.js
new file mode 100644
index 0000000..728e7e5
--- /dev/null
+++ b/src/store/index.js
@@ -0,0 +1,29 @@
+import Vue from 'vue'
+import Vuex from 'vuex'
+
+import app from './modules/app'
+import user from './modules/user'
+import permission from './modules/permission'
+import enhance from './modules/enhance'
+import getters from './getters'
+
+Vue.use(Vuex)
+
+export default new Vuex.Store({
+ modules: {
+ app,
+ user,
+ permission,
+ enhance
+ },
+ state: {
+
+ },
+ mutations: {
+
+ },
+ actions: {
+
+ },
+ getters
+})
diff --git a/src/store/modules/app.js b/src/store/modules/app.js
new file mode 100644
index 0000000..7d72b11
--- /dev/null
+++ b/src/store/modules/app.js
@@ -0,0 +1,126 @@
+import Vue from 'vue'
+import {
+ SIDEBAR_TYPE,
+ DEFAULT_THEME,
+ DEFAULT_LAYOUT_MODE,
+ DEFAULT_COLOR,
+ DEFAULT_COLOR_WEAK,
+ DEFAULT_FIXED_HEADER,
+ DEFAULT_FIXED_SIDEMENU,
+ DEFAULT_FIXED_HEADER_HIDDEN,
+ DEFAULT_CONTENT_WIDTH_TYPE,
+ DEFAULT_MULTI_PAGE
+} from "@/store/mutation-types"
+
+const app = {
+ state: {
+ sidebar: {
+ opened: true,
+ withoutAnimation: false
+ },
+ device: 'desktop',
+ theme: '',
+ layout: '',
+ contentWidth: '',
+ fixedHeader: false,
+ fixSiderbar: true,
+ autoHideHeader: false,
+ color: null,
+ weak: false,
+ multipage: true //默认多页签模式
+ },
+ mutations: {
+ SET_SIDEBAR_TYPE: (state, type) => {
+ state.sidebar.opened = type
+ Vue.ls.set(SIDEBAR_TYPE, type)
+ },
+ CLOSE_SIDEBAR: (state, withoutAnimation) => {
+ Vue.ls.set(SIDEBAR_TYPE, true)
+ state.sidebar.opened = false
+ state.sidebar.withoutAnimation = withoutAnimation
+ },
+ TOGGLE_DEVICE: (state, device) => {
+ state.device = device
+ },
+ TOGGLE_THEME: (state, theme) => {
+ // setStore('_DEFAULT_THEME', theme)
+ Vue.ls.set(DEFAULT_THEME, theme)
+ state.theme = theme
+ },
+ TOGGLE_LAYOUT_MODE: (state, layout) => {
+ Vue.ls.set(DEFAULT_LAYOUT_MODE, layout)
+ state.layout = layout
+ },
+ TOGGLE_FIXED_HEADER: (state, fixed) => {
+ Vue.ls.set(DEFAULT_FIXED_HEADER, fixed)
+ state.fixedHeader = fixed
+ },
+ TOGGLE_FIXED_SIDERBAR: (state, fixed) => {
+ Vue.ls.set(DEFAULT_FIXED_SIDEMENU, fixed)
+ state.fixSiderbar = fixed
+ },
+ TOGGLE_FIXED_HEADER_HIDDEN: (state, show) => {
+ Vue.ls.set(DEFAULT_FIXED_HEADER_HIDDEN, show)
+ state.autoHideHeader = show
+ },
+ TOGGLE_CONTENT_WIDTH: (state, type) => {
+ Vue.ls.set(DEFAULT_CONTENT_WIDTH_TYPE, type)
+ state.contentWidth = type
+ },
+ TOGGLE_COLOR: (state, color) => {
+ Vue.ls.set(DEFAULT_COLOR, color)
+ state.color = color
+ },
+ TOGGLE_WEAK: (state, flag) => {
+ Vue.ls.set(DEFAULT_COLOR_WEAK, flag)
+ state.weak = flag
+ },
+ SET_MULTI_PAGE (state, multipageFlag) {
+ Vue.ls.set(DEFAULT_MULTI_PAGE, multipageFlag)
+ state.multipage = multipageFlag
+ }
+ },
+ actions: {
+ setSidebar: ({ commit }, type) => {
+ commit('SET_SIDEBAR_TYPE', type)
+ },
+ CloseSidebar({ commit }, { withoutAnimation }) {
+ commit('CLOSE_SIDEBAR', withoutAnimation)
+ },
+ ToggleDevice({ commit }, device) {
+ commit('TOGGLE_DEVICE', device)
+ },
+ ToggleTheme({ commit }, theme) {
+ commit('TOGGLE_THEME', theme)
+ },
+ ToggleLayoutMode({ commit }, mode) {
+ commit('TOGGLE_LAYOUT_MODE', mode)
+ },
+ ToggleFixedHeader({ commit }, fixedHeader) {
+ if (!fixedHeader) {
+ commit('TOGGLE_FIXED_HEADER_HIDDEN', false)
+ }
+ commit('TOGGLE_FIXED_HEADER', fixedHeader)
+ },
+ ToggleFixSiderbar({ commit }, fixSiderbar) {
+ commit( 'TOGGLE_FIXED_SIDERBAR', fixSiderbar)
+ },
+ ToggleFixedHeaderHidden({ commit }, show) {
+ commit('TOGGLE_FIXED_HEADER_HIDDEN', show)
+ },
+ ToggleContentWidth({ commit }, type) {
+ commit('TOGGLE_CONTENT_WIDTH', type)
+ },
+ ToggleColor({ commit }, color) {
+ commit('TOGGLE_COLOR', color)
+ },
+ ToggleWeak({ commit }, weakFlag) {
+ commit('TOGGLE_WEAK', weakFlag)
+ },
+ ToggleMultipage({ commit }, multipageFlag) {
+ commit('SET_MULTI_PAGE', multipageFlag)
+ }
+ }
+}
+
+export default app
\ No newline at end of file
diff --git a/src/store/modules/enhance.js b/src/store/modules/enhance.js
new file mode 100644
index 0000000..e7c254d
--- /dev/null
+++ b/src/store/modules/enhance.js
@@ -0,0 +1,37 @@
+import Vue from 'vue'
+const enhance = {
+ state: {
+ enhanceJs:{
+
+ }
+ },
+ mutations: {
+ ADD_TABLE_ENHANCE: (state, record) => {
+ if(!state.enhanceJs){
+ let obj = {}
+ let arr = []
+ arr.push({...record})
+ obj[record.code] = arr
+ state.enhanceJs = obj
+ }else{
+ if(!state.enhanceJs[record.code]){
+ let arr = []
+ arr.push({...record})
+ state.enhanceJs[record.code] = arr
+ }
+ state.enhanceJs[record.code].push({...record})
+ }
+ let arr = state.enhanceJs[record.code]
+ while(arr.length>16){
+ arr.shift()
+ }
+ Vue.ls.set('enhance_'+record['code'], arr)
+ }
+ },
+ actions: {
+ addEhanceRecord({ commit }, record) {
+ commit('ADD_TABLE_ENHANCE', record)
+ }
+ }
+}
+export default enhance
\ No newline at end of file
diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js
new file mode 100644
index 0000000..7c900e6
--- /dev/null
+++ b/src/store/modules/permission.js
@@ -0,0 +1,91 @@
+import { asyncRouterMap, constantRouterMap } from "@/config/router.config"
+
+/**
+ * 过滤账户是否拥有某一个权限,并将菜单从加载列表移除
+ *
+ * @param permission
+ * @param route
+ * @returns {boolean}
+ */
+function hasPermission(permission, route) {
+ if (route.meta && route.meta.permission) {
+ let flag = -1
+ for (let i = 0, len = permission.length; i < len; i++) {
+ flag = route.meta.permission.indexOf(permission[i])
+ if (flag >= 0) {
+ return true
+ }
+ }
+ return false
+ }
+ return true
+}
+
+/**
+ * 单账户多角色时,使用该方法可过滤角色不存在的菜单
+ *
+ * @param roles
+ * @param route
+ * @returns {*}
+ */
+// eslint-disable-next-line
+function hasRole(roles, route) {
+ if (route.meta && route.meta.roles) {
+ return route.meta.roles.indexOf(roles.id)
+ } else {
+ return true
+ }
+}
+
+function filterAsyncRouter(routerMap, roles) {
+ const accessedRouters = routerMap.filter(route => {
+ if (hasPermission(roles.permissionList, route)) {
+ if (route.children && route.children.length) {
+ route.children = filterAsyncRouter(route.children, roles)
+ }
+ return true
+ }
+ return false
+ })
+ return accessedRouters
+}
+
+
+const permission = {
+ state: {
+ routers: constantRouterMap,
+ addRouters: []
+ },
+ mutations: {
+ SET_ROUTERS: (state, data) => {
+ //console.log('-----mutations---SET_ROUTERS----', data)
+ state.addRouters = data
+ state.routers = constantRouterMap.concat(data)
+ // console.log('-----mutations last ---SET_ROUTERS----', state.routers)
+ }
+ },
+ actions: {
+ GenerateRoutes({ commit }, data) {
+ return new Promise(resolve => {
+ const { roles } = data
+ console.log('-----mutations---data----', data)
+ let accessedRouters
+ accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
+ console.log('-----mutations---accessedRouters----', accessedRouters)
+ commit('SET_ROUTERS', accessedRouters)
+ resolve()
+ })
+ },
+ // 动态添加主界面路由,需要缓存
+ UpdateAppRouter({ commit }, routes) {
+ return new Promise(resolve => {
+ //const [ roles ] = routes.constRoutes
+ let routelist = routes.constRoutes;
+ commit('SET_ROUTERS', routelist)
+ resolve()
+ })
+ }
+ }
+}
+
+export default permission
\ No newline at end of file
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
new file mode 100644
index 0000000..61c24a5
--- /dev/null
+++ b/src/store/modules/user.js
@@ -0,0 +1,163 @@
+import Vue from 'vue'
+import { login, logout } from "@/api/login"
+import { ACCESS_TOKEN, USER_NAME,USER_INFO,UI_CACHE_DB_DICT_DATA,USER_ID,USER_LOGIN_NAME,CACHE_INCLUDED_ROUTES } from "@/store/mutation-types"
+import { welcome } from "@/utils/util"
+import { queryPermissionsByUser, getUserBtnByCurrentUser } from '@/api/api'
+import { getAction } from '@/api/manage'
+
+const user = {
+ state: {
+ token: '',
+ username: '',
+ realname: '',
+ welcome: '',
+ avatar: '',
+ permissionList: [],
+ info: {}
+ },
+
+ mutations: {
+ SET_TOKEN: (state, token) => {
+ state.token = token
+ },
+ SET_NAME: (state, { username, realname, welcome }) => {
+ state.username = username
+ state.realname = realname
+ state.welcome = welcome
+ },
+ SET_AVATAR: (state, avatar) => {
+ state.avatar = avatar
+ },
+ SET_PERMISSIONLIST: (state, permissionList) => {
+ state.permissionList = permissionList
+ },
+ SET_INFO: (state, info) => {
+ state.info = info
+ },
+ },
+
+ actions: {
+ // CAS验证登录
+ ValidateLogin({ commit }, userInfo) {
+ return new Promise((resolve, reject) => {
+ getAction("/cas/client/validateLogin",userInfo).then(response => {
+ console.log("----cas 登录--------",response);
+ if(response.success){
+ const result = response.result
+ const userInfo = result.userInfo
+ Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
+ Vue.ls.set(USER_NAME, userInfo.username, 7 * 24 * 60 * 60 * 1000)
+ Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000)
+ commit('SET_TOKEN', result.token)
+ commit('SET_INFO', userInfo)
+ commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname, welcome: welcome() })
+ commit('SET_AVATAR', userInfo.avatar)
+ resolve(response)
+ }else{
+ resolve(response)
+ }
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+ // 登录
+ Login({ commit }, userInfo) {
+ return new Promise((resolve, reject) => {
+ login(userInfo).then(response => {
+ if(response.code === 200){
+ if(response.data.msgTip === 'user can login'){
+ const result = response.data
+ Vue.ls.set(USER_ID, result.user.id, 7 * 24 * 60 * 60 * 1000);
+ Vue.ls.set(USER_LOGIN_NAME, result.user.loginName, 7 * 24 * 60 * 60 * 1000);
+ //前端7天有效期,后端默认1天,只要用户在1天内有访问页面就可以一直续期直到7天结束
+ Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
+ Vue.ls.set(USER_INFO, result.user, 7 * 24 * 60 * 60 * 1000)
+ commit('SET_TOKEN', result.token)
+ }
+ commit('SET_INFO', userInfo)
+ resolve(response)
+ } else{
+ resolve(response)
+ }
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+ // 获取用户信息
+ GetPermissionList({ commit }) {
+ return new Promise((resolve, reject) => {
+ //let v_token = Vue.ls.get(ACCESS_TOKEN);
+ let params = {pNumber:0,userId: Vue.ls.get(USER_ID)};
+ queryPermissionsByUser(params).then(response => {
+ const menuData = response;
+ if (menuData && menuData.length > 0) {
+ commit('SET_PERMISSIONLIST', menuData)
+ } else {
+ reject('getPermissionList: permissions must be a non-null array !')
+ }
+ resolve(response)
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+
+ // 获取用户的按钮权限
+ GetUserBtnList({ commit }) {
+ return new Promise((resolve, reject) => {
+ getUserBtnByCurrentUser().then(response => {
+ resolve(response)
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+
+ // 登出
+ Logout({ commit, state }) {
+ return new Promise((resolve) => {
+ //let logoutToken = state.token;
+ commit('SET_TOKEN', '')
+ commit('SET_PERMISSIONLIST', [])
+ Vue.ls.remove(USER_ID)
+ Vue.ls.remove(USER_LOGIN_NAME)
+ Vue.ls.remove(USER_INFO)
+ Vue.ls.remove(UI_CACHE_DB_DICT_DATA)
+ Vue.ls.remove(CACHE_INCLUDED_ROUTES)
+ logout().then(() => {
+ resolve()
+ }).catch(() => {
+ resolve()
+ })
+ })
+ },
+ // 第三方登录
+ ThirdLogin({ commit }, token) {
+ return new Promise((resolve, reject) => {
+ thirdLogin(token).then(response => {
+ if(response.code =='200'){
+ const result = response.result
+ const userInfo = result.userInfo
+ Vue.ls.set(ACCESS_TOKEN, result.token, 7 * 24 * 60 * 60 * 1000)
+ Vue.ls.set(USER_NAME, userInfo.username, 7 * 24 * 60 * 60 * 1000)
+ Vue.ls.set(USER_INFO, userInfo, 7 * 24 * 60 * 60 * 1000)
+ commit('SET_TOKEN', result.token)
+ commit('SET_INFO', userInfo)
+ commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname, welcome: welcome() })
+ commit('SET_AVATAR', userInfo.avatar)
+ resolve(response)
+ }else{
+ reject(response)
+ }
+ }).catch(error => {
+ reject(error)
+ })
+ })
+ },
+
+ }
+}
+
+export default user
\ No newline at end of file
diff --git a/src/store/mutation-types.js b/src/store/mutation-types.js
new file mode 100644
index 0000000..3f2508a
--- /dev/null
+++ b/src/store/mutation-types.js
@@ -0,0 +1,27 @@
+export const ACCESS_TOKEN = 'Access-Token'
+export const SIDEBAR_TYPE = 'SIDEBAR_TYPE'
+export const DEFAULT_THEME = 'DEFAULT_THEME'
+export const DEFAULT_LAYOUT_MODE = 'DEFAULT_LAYOUT_MODE'
+export const DEFAULT_COLOR = 'DEFAULT_COLOR'
+export const DEFAULT_COLOR_WEAK = 'DEFAULT_COLOR_WEAK'
+export const DEFAULT_FIXED_HEADER = 'DEFAULT_FIXED_HEADER'
+export const DEFAULT_FIXED_SIDEMENU= 'DEFAULT_FIXED_SIDEMENU'
+export const DEFAULT_FIXED_HEADER_HIDDEN = 'DEFAULT_FIXED_HEADER_HIDDEN'
+export const DEFAULT_CONTENT_WIDTH_TYPE = 'DEFAULT_CONTENT_WIDTH_TYPE'
+export const DEFAULT_MULTI_PAGE = 'DEFAULT_MULTI_PAGE'
+export const USER_ID = 'Login_userId'
+export const USER_LOGIN_NAME = 'Login_loginName'
+export const USER_NAME = 'Login_Username'
+export const USER_INFO = 'Login_Userinfo'
+export const USER_AUTH = 'LOGIN_USER_BUTTON_AUTH'
+export const SYS_BUTTON_AUTH = 'SYS_BUTTON_AUTH'
+export const ENCRYPTED_STRING = 'ENCRYPTED_STRING'
+export const ENHANCE_PRE = 'enhance_'
+export const UI_CACHE_DB_DICT_DATA = 'UI_CACHE_DB_DICT_DATA'
+export const INDEX_MAIN_PAGE_PATH = "/dashboard/analysis"
+//路由缓存问题,关闭了tab页时再打开就不刷新 #842
+export const CACHE_INCLUDED_ROUTES = 'CACHE_INCLUDED_ROUTES'
+export const CONTENT_WIDTH_TYPE = {
+ Fluid: 'Fluid',
+ Fixed: 'Fixed'
+}
\ No newline at end of file
diff --git a/src/utils/JEditableTableUtil.js b/src/utils/JEditableTableUtil.js
new file mode 100644
index 0000000..6331609
--- /dev/null
+++ b/src/utils/JEditableTableUtil.js
@@ -0,0 +1,176 @@
+const FormTypes = {
+ normal: 'normal',
+ input: 'input',
+ inputNumber: 'inputNumber',
+ checkbox: 'checkbox',
+ select: 'select',
+ date: 'date',
+ datetime: 'datetime',
+ upload: 'upload',
+ file: 'file',
+ image: 'image',
+ popup:'popup',
+ popupJsh:'popupJsh',
+ list_multi:"list_multi",
+ sel_search:"sel_search",
+ radio:'radio',
+ checkbox_meta:"checkbox_meta",
+ input_pop:'input_pop',
+ slot: 'slot',
+ hidden: 'hidden'
+}
+const VALIDATE_NO_PASSED = Symbol()
+export { FormTypes, VALIDATE_NO_PASSED }
+
+/**
+ * 获取指定的 $refs 对象
+ * 有时候可能会遇到组件未挂载到页面中的情况,导致无法获取 $refs 中的某个对象
+ * 这个方法可以等待挂载完成之后再返回 $refs 的对象,避免报错
+ * @author sunjianlei
+ **/
+export function getRefPromise(vm, name) {
+ return new Promise((resolve) => {
+ (function next() {
+ let ref = vm.$refs[name]
+ if (ref) {
+ resolve(ref)
+ } else {
+ setTimeout(() => {
+ next()
+ }, 10)
+ }
+ })()
+ })
+}
+
+/**
+ * 一次性验证主表单和所有的次表单
+ * @param form 主表单 form 对象
+ * @param cases 接收一个数组,每项都是一个JEditableTable实例
+ * @returns {Promise}
+ * @author sunjianlei
+ */
+export function validateFormAndTables(form, cases) {
+
+ if (!(form && typeof form.validateFields === 'function')) {
+ throw `form 参数需要的是一个form对象,而传入的却是${typeof form}`
+ }
+
+ let options = {}
+ return new Promise((resolve, reject) => {
+ // 验证主表表单
+ form.validateFields((err, values) => {
+ err ? reject({ error: VALIDATE_NO_PASSED }) : resolve(values)
+ })
+ }).then(values => {
+ Object.assign(options, { formValue: values })
+ // 验证所有子表的表单
+ return validateTables(cases)
+ }).then(all => {
+ Object.assign(options, { tablesValue: all })
+ return Promise.resolve(options)
+ }).catch(error => {
+ return Promise.reject(error)
+ })
+
+}
+
+/**
+ * 验证并获取一个或多个表格的所有值
+ * @param cases 接收一个数组,每项都是一个JEditableTable实例
+ * @param deleteTempId 是否删除临时ID,如果设为true,行编辑就不返回新增行的ID,ID需要后台生成
+ * @author sunjianlei
+ */
+export function validateTables(cases, deleteTempId) {
+ if (!(cases instanceof Array)) {
+ throw `'validateTables'函数的'cases'参数需要的是一个数组,而传入的却是${typeof cases}`
+ }
+ return new Promise((resolve, reject) => {
+ let tables = []
+ let index = 0;
+ if(!cases || cases.length==0){
+ resolve()
+ }
+ (function next() {
+ let vm = cases[index]
+ vm.getAll(true, deleteTempId).then(all => {
+ tables[index] = all
+ // 判断校验是否全部完成,完成返回成功,否则继续进行下一步校验
+ if (++index === cases.length) {
+ resolve(tables)
+ } else (
+ next()
+ )
+ }, error => {
+ // 出现未验证通过的表单,不再进行下一步校验,直接返回失败并跳转到该表格
+ if (error === VALIDATE_NO_PASSED) {
+ reject({ error: VALIDATE_NO_PASSED, index })
+ }
+ reject(error)
+ })
+ })()
+ })
+}
+
+/**
+ * 一次性验证主表单和所有的次表单-只校验单号
+ * @param form 主表单 form 对象
+ * @param cases 接收一个数组,每项都是一个JEditableTable实例
+ * @returns {Promise}
+ * @author sunjianlei
+ */
+export function getListData(form, cases) {
+ let options = {}
+ return new Promise((resolve, reject) => {
+ // 验证主表表单
+ form.validateFields(['number'],(err, values) => {
+ err ? reject({ error: VALIDATE_NO_PASSED }) : resolve(values)
+ })
+ }).then(values => {
+ Object.assign(options, { formValue: values })
+ // 验证所有子表的表单
+ return getListTables(cases)
+ }).then(all => {
+ Object.assign(options, { tablesValue: all })
+ return Promise.resolve(options)
+ }).catch(error => {
+ return Promise.reject(error)
+ })
+}
+
+/**
+ * 不验证直接获取一个或多个表格的所有值
+ * @param cases 接收一个数组,每项都是一个JEditableTable实例
+ * @param deleteTempId 是否删除临时ID,如果设为true,行编辑就不返回新增行的ID,ID需要后台生成
+ * @author sunjianlei
+ */
+export function getListTables(cases, deleteTempId) {
+ if (!(cases instanceof Array)) {
+ throw `'validateTables'函数的'cases'参数需要的是一个数组,而传入的却是${typeof cases}`
+ }
+ return new Promise((resolve, reject) => {
+ let tables = []
+ let index = 0;
+ if(!cases || cases.length==0){
+ resolve()
+ }
+ (function next() {
+ let vm = cases[index]
+ vm.getAll(false, deleteTempId).then(all => {
+ tables[index] = all
+ // 判断校验是否全部完成,完成返回成功,否则继续进行下一步校验
+ if (++index === cases.length) {
+ resolve(tables)
+ } else (
+ next()
+ )
+ }, error => {
+ // 出现未验证通过的表单,不再进行下一步校验,直接返回失败并跳转到该表格
+ if (error === VALIDATE_NO_PASSED) {
+ reject({ error: VALIDATE_NO_PASSED, index })
+ }
+ reject(error)
+ })
+ })()
+ })
+}
\ No newline at end of file
diff --git a/src/utils/LunarFullCalendarUtil.js b/src/utils/LunarFullCalendarUtil.js
new file mode 100644
index 0000000..e68eb63
--- /dev/null
+++ b/src/utils/LunarFullCalendarUtil.js
@@ -0,0 +1,107 @@
+/**
+ * LunarFullCalendar 公共 js
+ *
+ * @version 1.0.0
+ * @author sunjianlei
+ *
+ * */
+
+import { getRefPromise } from '@/utils/JEditableTableUtil'
+
+/* 日历的视图类型 */
+const calendarViewType = {
+ month: 'month', // 月视图
+ basicWeek: 'basicWeek', // 基础周视图
+ basicDay: 'basicDay',// 基础天视图
+ agendaWeek: 'agendaWeek', // 议程周视图
+ agendaDay: 'agendaDay', // 议程天视图
+}
+
+/* 定义默认视图 */
+const defaultView = calendarViewType.month
+
+/* 定义日历默认配置 */
+const defaultSettings = {
+ locale: 'zh-cn',
+ // 按钮文字
+ buttonText: {
+ today: '今天',
+ month: '月',
+ week: '周',
+ day: '日'
+ },
+ // 头部排列方式
+ header: {
+ left: 'prev,next, today',
+ center: 'title',
+ right: 'hide, custom, month,agendaWeek,agendaDay'
+ },
+ //点击今天日列表图
+ eventLimitClick: 'day',
+ // 隐藏超出的事件
+ eventLimit: true,
+ // 设置每周开始日期为周日
+ firstDay: 0,
+ // 默认显示视图
+ defaultView,
+ timeFormat: 'H:mm',
+ axisFormat: 'H:mm',
+ // agenda视图下是否显示all-day
+ allDaySlot: true,
+ // agenda视图下all-day的显示文本
+ allDayText: '全天',
+ // 时区默认本地的
+ timezone: 'local',
+ // 周视图和日视同的左侧时间显示
+ slotLabelFormat: 'HH:mm',
+ // 设置第二天阈值
+ nextDayThreshold: '00:00:00',
+}
+
+/** 提供了一些增强方法 */
+const CalendarMixins = {
+ data() {
+ return {
+ calenderCurrentViewType: defaultView
+ }
+ },
+ methods: {
+
+ getCalendarConfigEventHandler() {
+ return {
+ // 处理 view changed 事件
+ viewRender: (view, element) => {
+ let { type } = view
+
+ let lastViewType = this.calenderCurrentViewType
+ this.calenderCurrentViewType = type
+
+ if (typeof this.handleViewRender === 'function') {
+ this.handleViewRender(type, view, element)
+ }
+
+ if (lastViewType !== this.calenderCurrentViewType && typeof this.handleViewChanged === 'function') {
+ this.handleViewChanged(type, view, element)
+ }
+
+ },
+ }
+ },
+
+ /** 获取 LunarFullCalendar 实例,ref = baseCalendar */
+ getCalendar(fn) {
+ return getRefPromise(this, 'baseCalendar').then(fn)
+ },
+
+ calendarEmit(name, data) {
+ this.getCalendar(ref => ref.$emit(name, data))
+ },
+
+ /** 强制重新加载所有的事件(日程)*/
+ calendarReloadEvents() {
+ this.calendarEmit('reload-events')
+ }
+ }
+}
+
+export { defaultSettings, calendarViewType, CalendarMixins }
\ No newline at end of file
diff --git a/src/utils/auth.js b/src/utils/auth.js
new file mode 100644
index 0000000..03ae469
--- /dev/null
+++ b/src/utils/auth.js
@@ -0,0 +1,19 @@
+/**
+ * 弃用
+ */
+import { setStore, getStore, clearStore } from "@/utils/storage"
+
+export const TokenKey = 'Access-Token'
+
+export function getToken() {
+ return getStore(TokenKey)
+}
+
+export function setToken(token) {
+ // key, token, timeout = 86400s
+ return setStore(TokenKey, token, 86400)
+}
+
+export function removeToken() {
+ return clearStore(TokenKey)
+}
\ No newline at end of file
diff --git a/src/utils/authFilter.js b/src/utils/authFilter.js
new file mode 100644
index 0000000..7200e24
--- /dev/null
+++ b/src/utils/authFilter.js
@@ -0,0 +1,243 @@
+import { USER_AUTH,SYS_BUTTON_AUTH } from "@/store/mutation-types"
+
+export function disabledAuthFilter(code,formData) {
+ if(nodeDisabledAuth(code,formData)){
+ return true;
+ }else{
+ return globalDisabledAuth(code);
+ }
+}
+
+function nodeDisabledAuth(code,formData){
+ console.log("页面权限禁用--NODE--开始");
+ let permissionList = [];
+ try {
+ console.log("页面权限禁用--NODE--开始",formData);
+ if (formData) {
+ let bpmList = formData.permissionList;
+ permissionList = bpmList.filter(item=>item.type=='2')
+ // for (let bpm of bpmList) {
+ // if(bpm.type == '2') {
+ // permissionList.push(bpm);
+ // }
+ // }
+ }else{
+ return false;
+ }
+ } catch (e) {
+ //console.log("页面权限异常----", e);
+ }
+ if (permissionList.length == 0) {
+ return false;
+ }
+
+ console.log("流程节点页面权限禁用--NODE--开始");
+ let permissions = [];
+ for (let item of permissionList) {
+ if(item.type == '2') {
+ permissions.push(item.action);
+ }
+ }
+ //console.log("页面权限----"+code);
+ if (!permissions.includes(code)) {
+ return false;
+ }else{
+ for (let item2 of permissionList) {
+ if(code === item2.action){
+ console.log("流程节点页面权限禁用--NODE--生效");
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+function globalDisabledAuth(code){
+ console.log("全局页面禁用权限--Global--开始");
+
+ let permissionList = [];
+ let allPermissionList = [];
+
+ //let authList = Vue.ls.get(USER_AUTH);
+ let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
+ for (let auth of authList) {
+ if(auth.type == '2') {
+ permissionList.push(auth);
+ }
+ }
+ //console.log("页面禁用权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
+ let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
+ for (let gauth of allAuthList) {
+ if(gauth.type == '2') {
+ allPermissionList.push(gauth);
+ }
+ }
+ //设置全局配置是否有命中
+ let gFlag = false;//禁用命中
+ let invalidFlag = false;//无效命中
+ if(allPermissionList != null && allPermissionList != "" && allPermissionList != undefined && allPermissionList.length > 0){
+ for (let itemG of allPermissionList) {
+ if(code === itemG.action){
+ if(itemG.status == '0'){
+ invalidFlag = true;
+ break;
+ }else{
+ gFlag = true;
+ break;
+ }
+ }
+ }
+ }
+ if(invalidFlag){
+ return false;
+ }
+ if (permissionList === null || permissionList === "" || permissionList === undefined||permissionList.length<=0) {
+ return gFlag;
+ }
+ let permissions = [];
+ for (let item of permissionList) {
+ if(item.type == '2') {
+ permissions.push(item.action);
+ }
+ }
+ //console.log("页面禁用权限----"+code);
+ if (!permissions.includes(code)) {
+ return gFlag;
+ }else{
+ for (let item2 of permissionList) {
+ if(code === item2.action){
+ console.log("全局页面权限解除禁用--Global--生效");
+ gFlag = false;
+ }
+ }
+ return gFlag;
+ }
+}
+
+
+
+export function colAuthFilter(columns,pre) {
+ let authList = getNoAuthCols(pre);
+ const cols = columns.filter(item => {
+ if (hasColoum(item,authList)) {
+ return true
+ }
+ return false
+ })
+ return cols
+}
+
+/**
+ * 【子表行编辑】实现两个功能:
+ * 1、隐藏JEditableTable无权限的字段
+ * 2、禁用JEditableTable无权限的字段
+ * @param columns
+ * @param pre
+ * @returns {*}
+ */
+export function colAuthFilterJEditableTable(columns,pre) {
+ let authList = getAllShowAndDisabledAuthCols(pre);
+ const cols = columns.filter(item => {
+ let oneAuth = authList.find(auth => {
+ return auth.action === pre + item.key;
+ });
+ if(!oneAuth){
+ return true
+ }
+
+ //代码严谨处理,防止一个授权标识,配置多次
+ if(oneAuth instanceof Array){
+ oneAuth = oneAuth[0]
+ }
+
+ //禁用逻辑
+ if (oneAuth.type == '2' && !oneAuth.isAuth) {
+ item["disabled"] = true
+ return true
+ }
+ //隐藏逻辑逻辑
+ if (oneAuth.type == '1' && !oneAuth.isAuth) {
+ return false
+ }
+ return true
+ })
+ return cols
+}
+
+
+function hasColoum(item,authList){
+ if (authList.includes(item.dataIndex)) {
+ return false
+ }
+ return true
+}
+
+//权限无效时不做控制,有效时控制,只能控制 显示不显示
+//根据授权码前缀获取未授权的列信息
+function getNoAuthCols(pre){
+ let permissionList = [];
+ let allPermissionList = [];
+
+ //let authList = Vue.ls.get(USER_AUTH);
+ let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
+ for (let auth of authList) {
+ //显示策略,有效状态
+ if(auth.type == '1'&&startWith(auth.action,pre)) {
+ permissionList.push(substrPre(auth.action,pre));
+ }
+ }
+ //console.log("页面禁用权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
+ let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
+ for (let gauth of allAuthList) {
+ //显示策略,有效状态
+ if(gauth.type == '1'&&gauth.status == '1'&&startWith(gauth.action,pre)) {
+ allPermissionList.push(substrPre(gauth.action,pre));
+ }
+ }
+ const cols = allPermissionList.filter(item => {
+ if (permissionList.includes(item)) {
+ return false;
+ }
+ return true;
+ })
+ return cols;
+}
+
+
+
+/**
+ * 额外增加方法【用于行编辑组件】
+ * date: 2020-04-05
+ * author: scott
+ * @param pre
+ * @returns {*[]}
+ */
+function getAllShowAndDisabledAuthCols(pre){
+ //用户拥有的权限
+ let userAuthList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
+ //全部权限配置
+ let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
+
+ let newAllAuthList = allAuthList.map(function (item, index) {
+ let hasAuthArray = userAuthList.filter(u => u.action===item.action );
+ if (hasAuthArray && hasAuthArray.length>0) {
+ item["isAuth"] = true
+ }
+ return item;
+ })
+
+ return newAllAuthList;
+}
+
+function startWith(str,pre) {
+ if (pre == null || pre == "" || str==null|| str==""|| str.length == 0 || pre.length > str.length)
+ return false;
+ if (str.substr(0, pre.length) == pre)
+ return true;
+ else
+ return false;
+}
+
+function substrPre(str,pre) {
+ return str.substr(pre.length);
+}
\ No newline at end of file
diff --git a/src/utils/axios.js b/src/utils/axios.js
new file mode 100644
index 0000000..de27d4c
--- /dev/null
+++ b/src/utils/axios.js
@@ -0,0 +1,37 @@
+const VueAxios = {
+ vm: {},
+ // eslint-disable-next-line no-unused-vars
+ install(Vue, router = {}, instance) {
+ if (this.installed) {
+ return;
+ }
+ this.installed = true;
+
+ if (!instance) {
+ // eslint-disable-next-line no-console
+ console.error('You have to install axios');
+ return;
+ }
+
+ Vue.axios = instance;
+
+ Object.defineProperties(Vue.prototype, {
+ axios: {
+ get: function get() {
+ return instance;
+ }
+ },
+ $http: {
+ get: function get() {
+ return instance;
+ }
+ }
+ });
+ }
+};
+
+export {
+ VueAxios,
+ // eslint-disable-next-line no-undef
+ //instance as axios
+}
\ No newline at end of file
diff --git a/src/utils/commonUploadFile.js b/src/utils/commonUploadFile.js
new file mode 100644
index 0000000..eaa6dbb
--- /dev/null
+++ b/src/utils/commonUploadFile.js
@@ -0,0 +1,52 @@
+import { getFileAccessHttpUrl } from '@/api/manage'
+const getFileName=(path)=>{
+ if(path.lastIndexOf("\\")>=0){
+ let reg=new RegExp("\\\\","g");
+ path = path.replace(reg,"/");
+ }
+ return path.substring(path.lastIndexOf("/")+1);
+}
+
+const uidGenerator=()=>{
+ return '-'+parseInt(Math.random()*10000+1,10);
+}
+
+const getFilePaths=(uploadFiles)=>{
+ let arr = [];
+ if(!uploadFiles){
+ return ""
+ }
+ for(let a=0;a0){
+ return arr.join(",")
+ }
+ return ""
+}
+
+const getUploadFileList=(paths)=>{
+ if(!paths){
+ return [];
+ }
+ let fileList = [];
+ let arr = paths.split(",")
+ for(let a=0;a content(arg) + ' | 北京市'; // export 箭头函数也可以
+*
+*/
+
+/** 字段默认值官方示例:获取地址 */
+export function demoFieldDefVal_getAddress(arg) {
+ if (!arg) {
+ arg = '朝阳区'
+ }
+ return `北京市 ${arg}`
+}
\ No newline at end of file
diff --git a/src/utils/device.js b/src/utils/device.js
new file mode 100644
index 0000000..6bf15fc
--- /dev/null
+++ b/src/utils/device.js
@@ -0,0 +1,23 @@
+import enquireJs from 'enquire.js'
+
+const enquireScreen = function (call) {
+ // tablet
+ const handler = {
+ match: function () {
+ call && call(0)
+ },
+ unmatch: function () {
+ call && call(-1)
+ }
+ }
+ // mobile
+ const handler2 = {
+ match: () => {
+ call && call(1)
+ }
+ }
+ enquireJs.register('screen and (max-width: 1087.99px)', handler)
+ enquireJs.register('screen and (max-width: 767.99px)', handler2)
+}
+
+export default enquireScreen
\ No newline at end of file
diff --git a/src/utils/encryption/aesEncrypt.js b/src/utils/encryption/aesEncrypt.js
new file mode 100644
index 0000000..07638cf
--- /dev/null
+++ b/src/utils/encryption/aesEncrypt.js
@@ -0,0 +1,6003 @@
+import { getAction } from '@/api/manage'
+import { ENCRYPTED_STRING } from "@/store/mutation-types"
+import Vue from 'vue'
+
+/**
+ * 获取加密字符串,并对结果进行缓存
+ */
+export function getEncryptedString() {
+ return getAction("/sys/getEncryptedString",{}).then((res)=>{
+ let encryptedString = {};
+ encryptedString.key = res.result.key;
+ encryptedString.iv = res.result.iv;
+ Vue.ls.set(ENCRYPTED_STRING, encryptedString, 7 * 24 * 60 * 60 * 1000);
+ return encryptedString;
+ });
+}
+
+/**
+ * AES加密 :字符串 key iv 返回base64
+ */
+export function encryption(word, keyStr, ivStr) {
+
+ let key = CryptoJS.enc.Utf8.parse(keyStr)
+ let iv = CryptoJS.enc.Utf8.parse(ivStr)
+
+ let srcs = CryptoJS.enc.Utf8.parse(word);
+ var encrypted = CryptoJS.AES.encrypt(srcs, key, {
+ iv: iv,
+ mode: CryptoJS.mode.CBC,
+ padding: CryptoJS.pad.ZeroPadding
+ });
+ // console.log("-=-=-=-", encrypted.ciphertext)
+ return CryptoJS.enc.Base64.stringify(encrypted.ciphertext);
+
+}
+
+
+var CryptoJS = CryptoJS || (function (Math, undefined) {
+ /*
+ * Local polyfil of Object.create
+ */
+ var create = Object.create || (function () {
+ function F() {};
+
+ return function (obj) {
+ var subtype;
+
+ F.prototype = obj;
+
+ subtype = new F();
+
+ F.prototype = null;
+
+ return subtype;
+ };
+ }())
+
+ /**
+ * CryptoJS namespace.
+ */
+ var C = {};
+
+ /**
+ * Library namespace.
+ */
+ var C_lib = C.lib = {};
+
+ /**
+ * Base object for prototypal inheritance.
+ */
+ var Base = C_lib.Base = (function () {
+
+
+ return {
+ /**
+ * Creates a new object that inherits from this object.
+ *
+ * @param {Object} overrides Properties to copy into the new object.
+ *
+ * @return {Object} The new object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var MyType = CryptoJS.lib.Base.extend({
+ * field: 'value',
+ *
+ * method: function () {
+ * }
+ * });
+ */
+ extend: function (overrides) {
+ // Spawn
+ var subtype = create(this);
+
+ // Augment
+ if (overrides) {
+ subtype.mixIn(overrides);
+ }
+
+ // Create default initializer
+ if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
+ subtype.init = function () {
+ subtype.$super.init.apply(this, arguments);
+ };
+ }
+
+ // Initializer's prototype is the subtype object
+ subtype.init.prototype = subtype;
+
+ // Reference supertype
+ subtype.$super = this;
+
+ return subtype;
+ },
+
+ /**
+ * Extends this object and runs the init method.
+ * Arguments to create() will be passed to init().
+ *
+ * @return {Object} The new object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var instance = MyType.create();
+ */
+ create: function () {
+ var instance = this.extend();
+ instance.init.apply(instance, arguments);
+
+ return instance;
+ },
+
+ /**
+ * Initializes a newly created object.
+ * Override this method to add some logic when your objects are created.
+ *
+ * @example
+ *
+ * var MyType = CryptoJS.lib.Base.extend({
+ * init: function () {
+ * // ...
+ * }
+ * });
+ */
+ init: function () {
+ },
+
+ /**
+ * Copies properties into this object.
+ *
+ * @param {Object} properties The properties to mix in.
+ *
+ * @example
+ *
+ * MyType.mixIn({
+ * field: 'value'
+ * });
+ */
+ mixIn: function (properties) {
+ for (var propertyName in properties) {
+ if (properties.hasOwnProperty(propertyName)) {
+ this[propertyName] = properties[propertyName];
+ }
+ }
+
+ // IE won't copy toString using the loop above
+ if (properties.hasOwnProperty('toString')) {
+ this.toString = properties.toString;
+ }
+ },
+
+ /**
+ * Creates a copy of this object.
+ *
+ * @return {Object} The clone.
+ *
+ * @example
+ *
+ * var clone = instance.clone();
+ */
+ clone: function () {
+ return this.init.prototype.extend(this);
+ }
+ };
+ }());
+
+ /**
+ * An array of 32-bit words.
+ *
+ * @property {Array} words The array of 32-bit words.
+ * @property {number} sigBytes The number of significant bytes in this word array.
+ */
+ var WordArray = C_lib.WordArray = Base.extend({
+ /**
+ * Initializes a newly created word array.
+ *
+ * @param {Array} words (Optional) An array of 32-bit words.
+ * @param {number} sigBytes (Optional) The number of significant bytes in the words.
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.lib.WordArray.create();
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
+ */
+ init: function (words, sigBytes) {
+ words = this.words = words || [];
+
+ if (sigBytes != undefined) {
+ this.sigBytes = sigBytes;
+ } else {
+ this.sigBytes = words.length * 4;
+ }
+ },
+
+ /**
+ * Converts this word array to a string.
+ *
+ * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
+ *
+ * @return {string} The stringified word array.
+ *
+ * @example
+ *
+ * var string = wordArray + '';
+ * var string = wordArray.toString();
+ * var string = wordArray.toString(CryptoJS.enc.Utf8);
+ */
+ toString: function (encoder) {
+ return (encoder || Hex).stringify(this);
+ },
+
+ /**
+ * Concatenates a word array to this word array.
+ *
+ * @param {WordArray} wordArray The word array to append.
+ *
+ * @return {WordArray} This word array.
+ *
+ * @example
+ *
+ * wordArray1.concat(wordArray2);
+ */
+ concat: function (wordArray) {
+ // Shortcuts
+ var thisWords = this.words;
+ var thatWords = wordArray.words;
+ var thisSigBytes = this.sigBytes;
+ var thatSigBytes = wordArray.sigBytes;
+
+ // Clamp excess bits
+ this.clamp();
+
+ // Concat
+ if (thisSigBytes % 4) {
+ // Copy one byte at a time
+ for (var i = 0; i < thatSigBytes; i++) {
+ var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
+ }
+ } else {
+ // Copy one word at a time
+ for (var i = 0; i < thatSigBytes; i += 4) {
+ thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
+ }
+ }
+ this.sigBytes += thatSigBytes;
+
+ // Chainable
+ return this;
+ },
+
+ /**
+ * Removes insignificant bits.
+ *
+ * @example
+ *
+ * wordArray.clamp();
+ */
+ clamp: function () {
+ // Shortcuts
+ var words = this.words;
+ var sigBytes = this.sigBytes;
+
+ // Clamp
+ words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
+ words.length = Math.ceil(sigBytes / 4);
+ },
+
+ /**
+ * Creates a copy of this word array.
+ *
+ * @return {WordArray} The clone.
+ *
+ * @example
+ *
+ * var clone = wordArray.clone();
+ */
+ clone: function () {
+ var clone = Base.clone.call(this);
+ clone.words = this.words.slice(0);
+
+ return clone;
+ },
+
+ /**
+ * Creates a word array filled with random bytes.
+ *
+ * @param {number} nBytes The number of random bytes to generate.
+ *
+ * @return {WordArray} The random word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.lib.WordArray.random(16);
+ */
+ random: function (nBytes) {
+ var words = [];
+
+ var r = (function (m_w) {
+ var m_w = m_w;
+ var m_z = 0x3ade68b1;
+ var mask = 0xffffffff;
+
+ return function () {
+ m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;
+ m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;
+ var result = ((m_z << 0x10) + m_w) & mask;
+ result /= 0x100000000;
+ result += 0.5;
+ return result * (Math.random() > .5 ? 1 : -1);
+ }
+ });
+
+ for (var i = 0, rcache; i < nBytes; i += 4) {
+ var _r = r((rcache || Math.random()) * 0x100000000);
+
+ rcache = _r() * 0x3ade67b7;
+ words.push((_r() * 0x100000000) | 0);
+ }
+
+ return new WordArray.init(words, nBytes);
+ }
+ });
+
+ /**
+ * Encoder namespace.
+ */
+ var C_enc = C.enc = {};
+
+ /**
+ * Hex encoding strategy.
+ */
+ var Hex = C_enc.Hex = {
+ /**
+ * Converts a word array to a hex string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The hex string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var hexChars = [];
+ for (var i = 0; i < sigBytes; i++) {
+ var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ hexChars.push((bite >>> 4).toString(16));
+ hexChars.push((bite & 0x0f).toString(16));
+ }
+
+ return hexChars.join('');
+ },
+
+ /**
+ * Converts a hex string to a word array.
+ *
+ * @param {string} hexStr The hex string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Hex.parse(hexString);
+ */
+ parse: function (hexStr) {
+ // Shortcut
+ var hexStrLength = hexStr.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < hexStrLength; i += 2) {
+ words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
+ }
+
+ return new WordArray.init(words, hexStrLength / 2);
+ }
+ };
+
+ /**
+ * Latin1 encoding strategy.
+ */
+ var Latin1 = C_enc.Latin1 = {
+ /**
+ * Converts a word array to a Latin1 string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The Latin1 string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var latin1Chars = [];
+ for (var i = 0; i < sigBytes; i++) {
+ var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ latin1Chars.push(String.fromCharCode(bite));
+ }
+
+ return latin1Chars.join('');
+ },
+
+ /**
+ * Converts a Latin1 string to a word array.
+ *
+ * @param {string} latin1Str The Latin1 string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
+ */
+ parse: function (latin1Str) {
+ // Shortcut
+ var latin1StrLength = latin1Str.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < latin1StrLength; i++) {
+ words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
+ }
+
+ return new WordArray.init(words, latin1StrLength);
+ }
+ };
+
+ /**
+ * UTF-8 encoding strategy.
+ */
+ var Utf8 = C_enc.Utf8 = {
+ /**
+ * Converts a word array to a UTF-8 string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The UTF-8 string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ try {
+ return decodeURIComponent(escape(Latin1.stringify(wordArray)));
+ } catch (e) {
+ throw new Error('Malformed UTF-8 data');
+ }
+ },
+
+ /**
+ * Converts a UTF-8 string to a word array.
+ *
+ * @param {string} utf8Str The UTF-8 string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
+ */
+ parse: function (utf8Str) {
+ return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
+ }
+ };
+
+ /**
+ * Abstract buffered block algorithm template.
+ *
+ * The property blockSize must be implemented in a concrete subtype.
+ *
+ * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
+ */
+ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
+ /**
+ * Resets this block algorithm's data buffer to its initial state.
+ *
+ * @example
+ *
+ * bufferedBlockAlgorithm.reset();
+ */
+ reset: function () {
+ // Initial values
+ this._data = new WordArray.init();
+ this._nDataBytes = 0;
+ },
+
+ /**
+ * Adds new data to this block algorithm's buffer.
+ *
+ * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
+ *
+ * @example
+ *
+ * bufferedBlockAlgorithm._append('data');
+ * bufferedBlockAlgorithm._append(wordArray);
+ */
+ _append: function (data) {
+ // Convert string to WordArray, else assume WordArray already
+ if (typeof data == 'string') {
+ data = Utf8.parse(data);
+ }
+
+ // Append
+ this._data.concat(data);
+ this._nDataBytes += data.sigBytes;
+ },
+
+ /**
+ * Processes available data blocks.
+ *
+ * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
+ *
+ * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
+ *
+ * @return {WordArray} The processed data.
+ *
+ * @example
+ *
+ * var processedData = bufferedBlockAlgorithm._process();
+ * var processedData = bufferedBlockAlgorithm._process(!!'flush');
+ */
+ _process: function (doFlush) {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+ var dataSigBytes = data.sigBytes;
+ var blockSize = this.blockSize;
+ var blockSizeBytes = blockSize * 4;
+
+ // Count blocks ready
+ var nBlocksReady = dataSigBytes / blockSizeBytes;
+ if (doFlush) {
+ // Round up to include partial blocks
+ nBlocksReady = Math.ceil(nBlocksReady);
+ } else {
+ // Round down to include only full blocks,
+ // less the number of blocks that must remain in the buffer
+ nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
+ }
+
+ // Count words ready
+ var nWordsReady = nBlocksReady * blockSize;
+
+ // Count bytes ready
+ var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
+
+ // Process blocks
+ if (nWordsReady) {
+ for (var offset = 0; offset < nWordsReady; offset += blockSize) {
+ // Perform concrete-algorithm logic
+ this._doProcessBlock(dataWords, offset);
+ }
+
+ // Remove processed words
+ var processedWords = dataWords.splice(0, nWordsReady);
+ data.sigBytes -= nBytesReady;
+ }
+
+ // Return processed words
+ return new WordArray.init(processedWords, nBytesReady);
+ },
+
+ /**
+ * Creates a copy of this object.
+ *
+ * @return {Object} The clone.
+ *
+ * @example
+ *
+ * var clone = bufferedBlockAlgorithm.clone();
+ */
+ clone: function () {
+ var clone = Base.clone.call(this);
+ clone._data = this._data.clone();
+
+ return clone;
+ },
+
+ _minBufferSize: 0
+ });
+
+ /**
+ * Abstract hasher template.
+ *
+ * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
+ */
+ var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
+ /**
+ * Configuration options.
+ */
+ cfg: Base.extend(),
+
+ /**
+ * Initializes a newly created hasher.
+ *
+ * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
+ *
+ * @example
+ *
+ * var hasher = CryptoJS.algo.SHA256.create();
+ */
+ init: function (cfg) {
+ // Apply config defaults
+ this.cfg = this.cfg.extend(cfg);
+
+ // Set initial values
+ this.reset();
+ },
+
+ /**
+ * Resets this hasher to its initial state.
+ *
+ * @example
+ *
+ * hasher.reset();
+ */
+ reset: function () {
+ // Reset data buffer
+ BufferedBlockAlgorithm.reset.call(this);
+
+ // Perform concrete-hasher logic
+ this._doReset();
+ },
+
+ /**
+ * Updates this hasher with a message.
+ *
+ * @param {WordArray|string} messageUpdate The message to append.
+ *
+ * @return {Hasher} This hasher.
+ *
+ * @example
+ *
+ * hasher.update('message');
+ * hasher.update(wordArray);
+ */
+ update: function (messageUpdate) {
+ // Append
+ this._append(messageUpdate);
+
+ // Update the hash
+ this._process();
+
+ // Chainable
+ return this;
+ },
+
+ /**
+ * Finalizes the hash computation.
+ * Note that the finalize operation is effectively a destructive, read-once operation.
+ *
+ * @param {WordArray|string} messageUpdate (Optional) A final message update.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @example
+ *
+ * var hash = hasher.finalize();
+ * var hash = hasher.finalize('message');
+ * var hash = hasher.finalize(wordArray);
+ */
+ finalize: function (messageUpdate) {
+ // Final message update
+ if (messageUpdate) {
+ this._append(messageUpdate);
+ }
+
+ // Perform concrete-hasher logic
+ var hash = this._doFinalize();
+
+ return hash;
+ },
+
+ blockSize: 512/32,
+
+ /**
+ * Creates a shortcut function to a hasher's object interface.
+ *
+ * @param {Hasher} hasher The hasher to create a helper for.
+ *
+ * @return {Function} The shortcut function.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
+ */
+ _createHelper: function (hasher) {
+ return function (message, cfg) {
+ return new hasher.init(cfg).finalize(message);
+ };
+ },
+
+ /**
+ * Creates a shortcut function to the HMAC's object interface.
+ *
+ * @param {Hasher} hasher The hasher to use in this HMAC helper.
+ *
+ * @return {Function} The shortcut function.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
+ */
+ _createHmacHelper: function (hasher) {
+ return function (message, key) {
+ return new C_algo.HMAC.init(hasher, key).finalize(message);
+ };
+ }
+ });
+
+ /**
+ * Algorithm namespace.
+ */
+ var C_algo = C.algo = {};
+
+ return C;
+}(Math));
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var C_enc = C.enc;
+
+ /**
+ * Base64 encoding strategy.
+ */
+ var Base64 = C_enc.Base64 = {
+ /**
+ * Converts a word array to a Base64 string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The Base64 string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+ var map = this._map;
+
+ // Clamp excess bits
+ wordArray.clamp();
+
+ // Convert
+ var base64Chars = [];
+ for (var i = 0; i < sigBytes; i += 3) {
+ var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
+ var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
+ var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
+
+ var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
+
+ for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
+ base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
+ }
+ }
+
+ // Add padding
+ var paddingChar = map.charAt(64);
+ if (paddingChar) {
+ while (base64Chars.length % 4) {
+ base64Chars.push(paddingChar);
+ }
+ }
+
+ return base64Chars.join('');
+ },
+
+ /**
+ * Converts a Base64 string to a word array.
+ *
+ * @param {string} base64Str The Base64 string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Base64.parse(base64String);
+ */
+ parse: function (base64Str) {
+ // Shortcuts
+ var base64StrLength = base64Str.length;
+ var map = this._map;
+ var reverseMap = this._reverseMap;
+
+ if (!reverseMap) {
+ reverseMap = this._reverseMap = [];
+ for (var j = 0; j < map.length; j++) {
+ reverseMap[map.charCodeAt(j)] = j;
+ }
+ }
+
+ // Ignore padding
+ var paddingChar = map.charAt(64);
+ if (paddingChar) {
+ var paddingIndex = base64Str.indexOf(paddingChar);
+ if (paddingIndex !== -1) {
+ base64StrLength = paddingIndex;
+ }
+ }
+
+ // Convert
+ return parseLoop(base64Str, base64StrLength, reverseMap);
+
+ },
+
+ _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
+ };
+
+ function parseLoop(base64Str, base64StrLength, reverseMap) {
+ var words = [];
+ var nBytes = 0;
+ for (var i = 0; i < base64StrLength; i++) {
+ if (i % 4) {
+ var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
+ var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
+ words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
+ nBytes++;
+ }
+ }
+ return WordArray.create(words, nBytes);
+ }
+}());
+
+
+(function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Constants table
+ var T = [];
+
+ // Compute constants
+ (function () {
+ for (var i = 0; i < 64; i++) {
+ T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
+ }
+ }());
+
+ /**
+ * MD5 hash algorithm.
+ */
+ var MD5 = C_algo.MD5 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init([
+ 0x67452301, 0xefcdab89,
+ 0x98badcfe, 0x10325476
+ ]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Swap endian
+ for (var i = 0; i < 16; i++) {
+ // Shortcuts
+ var offset_i = offset + i;
+ var M_offset_i = M[offset_i];
+
+ M[offset_i] = (
+ (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
+ (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
+ );
+ }
+
+ // Shortcuts
+ var H = this._hash.words;
+
+ var M_offset_0 = M[offset + 0];
+ var M_offset_1 = M[offset + 1];
+ var M_offset_2 = M[offset + 2];
+ var M_offset_3 = M[offset + 3];
+ var M_offset_4 = M[offset + 4];
+ var M_offset_5 = M[offset + 5];
+ var M_offset_6 = M[offset + 6];
+ var M_offset_7 = M[offset + 7];
+ var M_offset_8 = M[offset + 8];
+ var M_offset_9 = M[offset + 9];
+ var M_offset_10 = M[offset + 10];
+ var M_offset_11 = M[offset + 11];
+ var M_offset_12 = M[offset + 12];
+ var M_offset_13 = M[offset + 13];
+ var M_offset_14 = M[offset + 14];
+ var M_offset_15 = M[offset + 15];
+
+ // Working varialbes
+ var a = H[0];
+ var b = H[1];
+ var c = H[2];
+ var d = H[3];
+
+ // Computation
+ a = FF(a, b, c, d, M_offset_0, 7, T[0]);
+ d = FF(d, a, b, c, M_offset_1, 12, T[1]);
+ c = FF(c, d, a, b, M_offset_2, 17, T[2]);
+ b = FF(b, c, d, a, M_offset_3, 22, T[3]);
+ a = FF(a, b, c, d, M_offset_4, 7, T[4]);
+ d = FF(d, a, b, c, M_offset_5, 12, T[5]);
+ c = FF(c, d, a, b, M_offset_6, 17, T[6]);
+ b = FF(b, c, d, a, M_offset_7, 22, T[7]);
+ a = FF(a, b, c, d, M_offset_8, 7, T[8]);
+ d = FF(d, a, b, c, M_offset_9, 12, T[9]);
+ c = FF(c, d, a, b, M_offset_10, 17, T[10]);
+ b = FF(b, c, d, a, M_offset_11, 22, T[11]);
+ a = FF(a, b, c, d, M_offset_12, 7, T[12]);
+ d = FF(d, a, b, c, M_offset_13, 12, T[13]);
+ c = FF(c, d, a, b, M_offset_14, 17, T[14]);
+ b = FF(b, c, d, a, M_offset_15, 22, T[15]);
+
+ a = GG(a, b, c, d, M_offset_1, 5, T[16]);
+ d = GG(d, a, b, c, M_offset_6, 9, T[17]);
+ c = GG(c, d, a, b, M_offset_11, 14, T[18]);
+ b = GG(b, c, d, a, M_offset_0, 20, T[19]);
+ a = GG(a, b, c, d, M_offset_5, 5, T[20]);
+ d = GG(d, a, b, c, M_offset_10, 9, T[21]);
+ c = GG(c, d, a, b, M_offset_15, 14, T[22]);
+ b = GG(b, c, d, a, M_offset_4, 20, T[23]);
+ a = GG(a, b, c, d, M_offset_9, 5, T[24]);
+ d = GG(d, a, b, c, M_offset_14, 9, T[25]);
+ c = GG(c, d, a, b, M_offset_3, 14, T[26]);
+ b = GG(b, c, d, a, M_offset_8, 20, T[27]);
+ a = GG(a, b, c, d, M_offset_13, 5, T[28]);
+ d = GG(d, a, b, c, M_offset_2, 9, T[29]);
+ c = GG(c, d, a, b, M_offset_7, 14, T[30]);
+ b = GG(b, c, d, a, M_offset_12, 20, T[31]);
+
+ a = HH(a, b, c, d, M_offset_5, 4, T[32]);
+ d = HH(d, a, b, c, M_offset_8, 11, T[33]);
+ c = HH(c, d, a, b, M_offset_11, 16, T[34]);
+ b = HH(b, c, d, a, M_offset_14, 23, T[35]);
+ a = HH(a, b, c, d, M_offset_1, 4, T[36]);
+ d = HH(d, a, b, c, M_offset_4, 11, T[37]);
+ c = HH(c, d, a, b, M_offset_7, 16, T[38]);
+ b = HH(b, c, d, a, M_offset_10, 23, T[39]);
+ a = HH(a, b, c, d, M_offset_13, 4, T[40]);
+ d = HH(d, a, b, c, M_offset_0, 11, T[41]);
+ c = HH(c, d, a, b, M_offset_3, 16, T[42]);
+ b = HH(b, c, d, a, M_offset_6, 23, T[43]);
+ a = HH(a, b, c, d, M_offset_9, 4, T[44]);
+ d = HH(d, a, b, c, M_offset_12, 11, T[45]);
+ c = HH(c, d, a, b, M_offset_15, 16, T[46]);
+ b = HH(b, c, d, a, M_offset_2, 23, T[47]);
+
+ a = II(a, b, c, d, M_offset_0, 6, T[48]);
+ d = II(d, a, b, c, M_offset_7, 10, T[49]);
+ c = II(c, d, a, b, M_offset_14, 15, T[50]);
+ b = II(b, c, d, a, M_offset_5, 21, T[51]);
+ a = II(a, b, c, d, M_offset_12, 6, T[52]);
+ d = II(d, a, b, c, M_offset_3, 10, T[53]);
+ c = II(c, d, a, b, M_offset_10, 15, T[54]);
+ b = II(b, c, d, a, M_offset_1, 21, T[55]);
+ a = II(a, b, c, d, M_offset_8, 6, T[56]);
+ d = II(d, a, b, c, M_offset_15, 10, T[57]);
+ c = II(c, d, a, b, M_offset_6, 15, T[58]);
+ b = II(b, c, d, a, M_offset_13, 21, T[59]);
+ a = II(a, b, c, d, M_offset_4, 6, T[60]);
+ d = II(d, a, b, c, M_offset_11, 10, T[61]);
+ c = II(c, d, a, b, M_offset_2, 15, T[62]);
+ b = II(b, c, d, a, M_offset_9, 21, T[63]);
+
+ // Intermediate hash value
+ H[0] = (H[0] + a) | 0;
+ H[1] = (H[1] + b) | 0;
+ H[2] = (H[2] + c) | 0;
+ H[3] = (H[3] + d) | 0;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+
+ var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
+ var nBitsTotalL = nBitsTotal;
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
+ (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
+ (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
+ );
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
+ (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
+ (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
+ );
+
+ data.sigBytes = (dataWords.length + 1) * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Shortcuts
+ var hash = this._hash;
+ var H = hash.words;
+
+ // Swap endian
+ for (var i = 0; i < 4; i++) {
+ // Shortcut
+ var H_i = H[i];
+
+ H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
+ (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
+ }
+
+ // Return final computed hash
+ return hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+ function FF(a, b, c, d, x, s, t) {
+ var n = a + ((b & c) | (~b & d)) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ function GG(a, b, c, d, x, s, t) {
+ var n = a + ((b & d) | (c & ~d)) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ function HH(a, b, c, d, x, s, t) {
+ var n = a + (b ^ c ^ d) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ function II(a, b, c, d, x, s, t) {
+ var n = a + (c ^ (b | ~d)) + x + t;
+ return ((n << s) | (n >>> (32 - s))) + b;
+ }
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.MD5('message');
+ * var hash = CryptoJS.MD5(wordArray);
+ */
+ C.MD5 = Hasher._createHelper(MD5);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacMD5(message, key);
+ */
+ C.HmacMD5 = Hasher._createHmacHelper(MD5);
+}(Math));
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Reusable object
+ var W = [];
+
+ /**
+ * SHA-1 hash algorithm.
+ */
+ var SHA1 = C_algo.SHA1 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init([
+ 0x67452301, 0xefcdab89,
+ 0x98badcfe, 0x10325476,
+ 0xc3d2e1f0
+ ]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var H = this._hash.words;
+
+ // Working variables
+ var a = H[0];
+ var b = H[1];
+ var c = H[2];
+ var d = H[3];
+ var e = H[4];
+
+ // Computation
+ for (var i = 0; i < 80; i++) {
+ if (i < 16) {
+ W[i] = M[offset + i] | 0;
+ } else {
+ var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
+ W[i] = (n << 1) | (n >>> 31);
+ }
+
+ var t = ((a << 5) | (a >>> 27)) + e + W[i];
+ if (i < 20) {
+ t += ((b & c) | (~b & d)) + 0x5a827999;
+ } else if (i < 40) {
+ t += (b ^ c ^ d) + 0x6ed9eba1;
+ } else if (i < 60) {
+ t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
+ } else /* if (i < 80) */ {
+ t += (b ^ c ^ d) - 0x359d3e2a;
+ }
+
+ e = d;
+ d = c;
+ c = (b << 30) | (b >>> 2);
+ b = a;
+ a = t;
+ }
+
+ // Intermediate hash value
+ H[0] = (H[0] + a) | 0;
+ H[1] = (H[1] + b) | 0;
+ H[2] = (H[2] + c) | 0;
+ H[3] = (H[3] + d) | 0;
+ H[4] = (H[4] + e) | 0;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Return final computed hash
+ return this._hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA1('message');
+ * var hash = CryptoJS.SHA1(wordArray);
+ */
+ C.SHA1 = Hasher._createHelper(SHA1);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA1(message, key);
+ */
+ C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
+}());
+
+
+(function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Initialization and round constants tables
+ var H = [];
+ var K = [];
+
+ // Compute constants
+ (function () {
+ function isPrime(n) {
+ var sqrtN = Math.sqrt(n);
+ for (var factor = 2; factor <= sqrtN; factor++) {
+ if (!(n % factor)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ function getFractionalBits(n) {
+ return ((n - (n | 0)) * 0x100000000) | 0;
+ }
+
+ var n = 2;
+ var nPrime = 0;
+ while (nPrime < 64) {
+ if (isPrime(n)) {
+ if (nPrime < 8) {
+ H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
+ }
+ K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
+
+ nPrime++;
+ }
+
+ n++;
+ }
+ }());
+
+ // Reusable object
+ var W = [];
+
+ /**
+ * SHA-256 hash algorithm.
+ */
+ var SHA256 = C_algo.SHA256 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init(H.slice(0));
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var H = this._hash.words;
+
+ // Working variables
+ var a = H[0];
+ var b = H[1];
+ var c = H[2];
+ var d = H[3];
+ var e = H[4];
+ var f = H[5];
+ var g = H[6];
+ var h = H[7];
+
+ // Computation
+ for (var i = 0; i < 64; i++) {
+ if (i < 16) {
+ W[i] = M[offset + i] | 0;
+ } else {
+ var gamma0x = W[i - 15];
+ var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
+ ((gamma0x << 14) | (gamma0x >>> 18)) ^
+ (gamma0x >>> 3);
+
+ var gamma1x = W[i - 2];
+ var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
+ ((gamma1x << 13) | (gamma1x >>> 19)) ^
+ (gamma1x >>> 10);
+
+ W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
+ }
+
+ var ch = (e & f) ^ (~e & g);
+ var maj = (a & b) ^ (a & c) ^ (b & c);
+
+ var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
+ var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
+
+ var t1 = h + sigma1 + ch + K[i] + W[i];
+ var t2 = sigma0 + maj;
+
+ h = g;
+ g = f;
+ f = e;
+ e = (d + t1) | 0;
+ d = c;
+ c = b;
+ b = a;
+ a = (t1 + t2) | 0;
+ }
+
+ // Intermediate hash value
+ H[0] = (H[0] + a) | 0;
+ H[1] = (H[1] + b) | 0;
+ H[2] = (H[2] + c) | 0;
+ H[3] = (H[3] + d) | 0;
+ H[4] = (H[4] + e) | 0;
+ H[5] = (H[5] + f) | 0;
+ H[6] = (H[6] + g) | 0;
+ H[7] = (H[7] + h) | 0;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Return final computed hash
+ return this._hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA256('message');
+ * var hash = CryptoJS.SHA256(wordArray);
+ */
+ C.SHA256 = Hasher._createHelper(SHA256);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA256(message, key);
+ */
+ C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
+}(Math));
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var C_enc = C.enc;
+
+ /**
+ * UTF-16 BE encoding strategy.
+ */
+ var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
+ /**
+ * Converts a word array to a UTF-16 BE string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The UTF-16 BE string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var utf16Chars = [];
+ for (var i = 0; i < sigBytes; i += 2) {
+ var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
+ utf16Chars.push(String.fromCharCode(codePoint));
+ }
+
+ return utf16Chars.join('');
+ },
+
+ /**
+ * Converts a UTF-16 BE string to a word array.
+ *
+ * @param {string} utf16Str The UTF-16 BE string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
+ */
+ parse: function (utf16Str) {
+ // Shortcut
+ var utf16StrLength = utf16Str.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < utf16StrLength; i++) {
+ words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
+ }
+
+ return WordArray.create(words, utf16StrLength * 2);
+ }
+ };
+
+ /**
+ * UTF-16 LE encoding strategy.
+ */
+ C_enc.Utf16LE = {
+ /**
+ * Converts a word array to a UTF-16 LE string.
+ *
+ * @param {WordArray} wordArray The word array.
+ *
+ * @return {string} The UTF-16 LE string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
+ */
+ stringify: function (wordArray) {
+ // Shortcuts
+ var words = wordArray.words;
+ var sigBytes = wordArray.sigBytes;
+
+ // Convert
+ var utf16Chars = [];
+ for (var i = 0; i < sigBytes; i += 2) {
+ var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
+ utf16Chars.push(String.fromCharCode(codePoint));
+ }
+
+ return utf16Chars.join('');
+ },
+
+ /**
+ * Converts a UTF-16 LE string to a word array.
+ *
+ * @param {string} utf16Str The UTF-16 LE string.
+ *
+ * @return {WordArray} The word array.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
+ */
+ parse: function (utf16Str) {
+ // Shortcut
+ var utf16StrLength = utf16Str.length;
+
+ // Convert
+ var words = [];
+ for (var i = 0; i < utf16StrLength; i++) {
+ words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
+ }
+
+ return WordArray.create(words, utf16StrLength * 2);
+ }
+ };
+
+ function swapEndian(word) {
+ return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
+ }
+}());
+
+
+(function () {
+ // Check if typed arrays are supported
+ if (typeof ArrayBuffer != 'function') {
+ return;
+ }
+
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+
+ // Reference original init
+ var superInit = WordArray.init;
+
+ // Augment WordArray.init to handle typed arrays
+ var subInit = WordArray.init = function (typedArray) {
+ // Convert buffers to uint8
+ if (typedArray instanceof ArrayBuffer) {
+ typedArray = new Uint8Array(typedArray);
+ }
+
+ // Convert other array views to uint8
+ if (
+ typedArray instanceof Int8Array ||
+ (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
+ typedArray instanceof Int16Array ||
+ typedArray instanceof Uint16Array ||
+ typedArray instanceof Int32Array ||
+ typedArray instanceof Uint32Array ||
+ typedArray instanceof Float32Array ||
+ typedArray instanceof Float64Array
+ ) {
+ typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
+ }
+
+ // Handle Uint8Array
+ if (typedArray instanceof Uint8Array) {
+ // Shortcut
+ var typedArrayByteLength = typedArray.byteLength;
+
+ // Extract bytes
+ var words = [];
+ for (var i = 0; i < typedArrayByteLength; i++) {
+ words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
+ }
+
+ // Initialize this word array
+ superInit.call(this, words, typedArrayByteLength);
+ } else {
+ // Else call normal init
+ superInit.apply(this, arguments);
+ }
+ };
+
+ subInit.prototype = WordArray;
+}());
+
+
+/** @preserve
+ (c) 2012 by Cédric Mesnil. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+(function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_algo = C.algo;
+
+ // Constants table
+ var _zl = WordArray.create([
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
+ 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
+ 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
+ 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
+ var _zr = WordArray.create([
+ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
+ 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
+ 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
+ 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
+ 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
+ var _sl = WordArray.create([
+ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
+ 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
+ 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
+ 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
+ 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]);
+ var _sr = WordArray.create([
+ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
+ 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
+ 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
+ 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
+ 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]);
+
+ var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
+ var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
+
+ /**
+ * RIPEMD160 hash algorithm.
+ */
+ var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
+ _doReset: function () {
+ this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+
+ // Swap endian
+ for (var i = 0; i < 16; i++) {
+ // Shortcuts
+ var offset_i = offset + i;
+ var M_offset_i = M[offset_i];
+
+ // Swap
+ M[offset_i] = (
+ (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
+ (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
+ );
+ }
+ // Shortcut
+ var H = this._hash.words;
+ var hl = _hl.words;
+ var hr = _hr.words;
+ var zl = _zl.words;
+ var zr = _zr.words;
+ var sl = _sl.words;
+ var sr = _sr.words;
+
+ // Working variables
+ var al, bl, cl, dl, el;
+ var ar, br, cr, dr, er;
+
+ ar = al = H[0];
+ br = bl = H[1];
+ cr = cl = H[2];
+ dr = dl = H[3];
+ er = el = H[4];
+ // Computation
+ var t;
+ for (var i = 0; i < 80; i += 1) {
+ t = (al + M[offset+zl[i]])|0;
+ if (i<16){
+ t += f1(bl,cl,dl) + hl[0];
+ } else if (i<32) {
+ t += f2(bl,cl,dl) + hl[1];
+ } else if (i<48) {
+ t += f3(bl,cl,dl) + hl[2];
+ } else if (i<64) {
+ t += f4(bl,cl,dl) + hl[3];
+ } else {// if (i<80) {
+ t += f5(bl,cl,dl) + hl[4];
+ }
+ t = t|0;
+ t = rotl(t,sl[i]);
+ t = (t+el)|0;
+ al = el;
+ el = dl;
+ dl = rotl(cl, 10);
+ cl = bl;
+ bl = t;
+
+ t = (ar + M[offset+zr[i]])|0;
+ if (i<16){
+ t += f5(br,cr,dr) + hr[0];
+ } else if (i<32) {
+ t += f4(br,cr,dr) + hr[1];
+ } else if (i<48) {
+ t += f3(br,cr,dr) + hr[2];
+ } else if (i<64) {
+ t += f2(br,cr,dr) + hr[3];
+ } else {// if (i<80) {
+ t += f1(br,cr,dr) + hr[4];
+ }
+ t = t|0;
+ t = rotl(t,sr[i]) ;
+ t = (t+er)|0;
+ ar = er;
+ er = dr;
+ dr = rotl(cr, 10);
+ cr = br;
+ br = t;
+ }
+ // Intermediate hash value
+ t = (H[1] + cl + dr)|0;
+ H[1] = (H[2] + dl + er)|0;
+ H[2] = (H[3] + el + ar)|0;
+ H[3] = (H[4] + al + br)|0;
+ H[4] = (H[0] + bl + cr)|0;
+ H[0] = t;
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
+ (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
+ (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
+ );
+ data.sigBytes = (dataWords.length + 1) * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Shortcuts
+ var hash = this._hash;
+ var H = hash.words;
+
+ // Swap endian
+ for (var i = 0; i < 5; i++) {
+ // Shortcut
+ var H_i = H[i];
+
+ // Swap
+ H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
+ (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
+ }
+
+ // Return final computed hash
+ return hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ }
+ });
+
+
+ function f1(x, y, z) {
+ return ((x) ^ (y) ^ (z));
+
+ }
+
+ function f2(x, y, z) {
+ return (((x)&(y)) | ((~x)&(z)));
+ }
+
+ function f3(x, y, z) {
+ return (((x) | (~(y))) ^ (z));
+ }
+
+ function f4(x, y, z) {
+ return (((x) & (z)) | ((y)&(~(z))));
+ }
+
+ function f5(x, y, z) {
+ return ((x) ^ ((y) |(~(z))));
+
+ }
+
+ function rotl(x,n) {
+ return (x<>>(32-n));
+ }
+
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.RIPEMD160('message');
+ * var hash = CryptoJS.RIPEMD160(wordArray);
+ */
+ C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacRIPEMD160(message, key);
+ */
+ C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
+}(Math));
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var C_enc = C.enc;
+ var Utf8 = C_enc.Utf8;
+ var C_algo = C.algo;
+
+ /**
+ * HMAC algorithm.
+ */
+ var HMAC = C_algo.HMAC = Base.extend({
+ /**
+ * Initializes a newly created HMAC.
+ *
+ * @param {Hasher} hasher The hash algorithm to use.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @example
+ *
+ * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
+ */
+ init: function (hasher, key) {
+ // Init hasher
+ hasher = this._hasher = new hasher.init();
+
+ // Convert string to WordArray, else assume WordArray already
+ if (typeof key == 'string') {
+ key = Utf8.parse(key);
+ }
+
+ // Shortcuts
+ var hasherBlockSize = hasher.blockSize;
+ var hasherBlockSizeBytes = hasherBlockSize * 4;
+
+ // Allow arbitrary length keys
+ if (key.sigBytes > hasherBlockSizeBytes) {
+ key = hasher.finalize(key);
+ }
+
+ // Clamp excess bits
+ key.clamp();
+
+ // Clone key for inner and outer pads
+ var oKey = this._oKey = key.clone();
+ var iKey = this._iKey = key.clone();
+
+ // Shortcuts
+ var oKeyWords = oKey.words;
+ var iKeyWords = iKey.words;
+
+ // XOR keys with pad constants
+ for (var i = 0; i < hasherBlockSize; i++) {
+ oKeyWords[i] ^= 0x5c5c5c5c;
+ iKeyWords[i] ^= 0x36363636;
+ }
+ oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
+
+ // Set initial values
+ this.reset();
+ },
+
+ /**
+ * Resets this HMAC to its initial state.
+ *
+ * @example
+ *
+ * hmacHasher.reset();
+ */
+ reset: function () {
+ // Shortcut
+ var hasher = this._hasher;
+
+ // Reset
+ hasher.reset();
+ hasher.update(this._iKey);
+ },
+
+ /**
+ * Updates this HMAC with a message.
+ *
+ * @param {WordArray|string} messageUpdate The message to append.
+ *
+ * @return {HMAC} This HMAC instance.
+ *
+ * @example
+ *
+ * hmacHasher.update('message');
+ * hmacHasher.update(wordArray);
+ */
+ update: function (messageUpdate) {
+ this._hasher.update(messageUpdate);
+
+ // Chainable
+ return this;
+ },
+
+ /**
+ * Finalizes the HMAC computation.
+ * Note that the finalize operation is effectively a destructive, read-once operation.
+ *
+ * @param {WordArray|string} messageUpdate (Optional) A final message update.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @example
+ *
+ * var hmac = hmacHasher.finalize();
+ * var hmac = hmacHasher.finalize('message');
+ * var hmac = hmacHasher.finalize(wordArray);
+ */
+ finalize: function (messageUpdate) {
+ // Shortcut
+ var hasher = this._hasher;
+
+ // Compute HMAC
+ var innerHash = hasher.finalize(messageUpdate);
+ hasher.reset();
+ var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
+
+ return hmac;
+ }
+ });
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var WordArray = C_lib.WordArray;
+ var C_algo = C.algo;
+ var SHA1 = C_algo.SHA1;
+ var HMAC = C_algo.HMAC;
+
+ /**
+ * Password-Based Key Derivation Function 2 algorithm.
+ */
+ var PBKDF2 = C_algo.PBKDF2 = Base.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
+ * @property {Hasher} hasher The hasher to use. Default: SHA1
+ * @property {number} iterations The number of iterations to perform. Default: 1
+ */
+ cfg: Base.extend({
+ keySize: 128/32,
+ hasher: SHA1,
+ iterations: 1
+ }),
+
+ /**
+ * Initializes a newly created key derivation function.
+ *
+ * @param {Object} cfg (Optional) The configuration options to use for the derivation.
+ *
+ * @example
+ *
+ * var kdf = CryptoJS.algo.PBKDF2.create();
+ * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
+ * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
+ */
+ init: function (cfg) {
+ this.cfg = this.cfg.extend(cfg);
+ },
+
+ /**
+ * Computes the Password-Based Key Derivation Function 2.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @example
+ *
+ * var key = kdf.compute(password, salt);
+ */
+ compute: function (password, salt) {
+ // Shortcut
+ var cfg = this.cfg;
+
+ // Init HMAC
+ var hmac = HMAC.create(cfg.hasher, password);
+
+ // Initial values
+ var derivedKey = WordArray.create();
+ var blockIndex = WordArray.create([0x00000001]);
+
+ // Shortcuts
+ var derivedKeyWords = derivedKey.words;
+ var blockIndexWords = blockIndex.words;
+ var keySize = cfg.keySize;
+ var iterations = cfg.iterations;
+
+ // Generate key
+ while (derivedKeyWords.length < keySize) {
+ var block = hmac.update(salt).finalize(blockIndex);
+ hmac.reset();
+
+ // Shortcuts
+ var blockWords = block.words;
+ var blockWordsLength = blockWords.length;
+
+ // Iterations
+ var intermediate = block;
+ for (var i = 1; i < iterations; i++) {
+ intermediate = hmac.finalize(intermediate);
+ hmac.reset();
+
+ // Shortcut
+ var intermediateWords = intermediate.words;
+
+ // XOR intermediate with block
+ for (var j = 0; j < blockWordsLength; j++) {
+ blockWords[j] ^= intermediateWords[j];
+ }
+ }
+
+ derivedKey.concat(block);
+ blockIndexWords[0]++;
+ }
+ derivedKey.sigBytes = keySize * 4;
+
+ return derivedKey;
+ }
+ });
+
+ /**
+ * Computes the Password-Based Key Derivation Function 2.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ * @param {Object} cfg (Optional) The configuration options to use for this computation.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var key = CryptoJS.PBKDF2(password, salt);
+ * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
+ * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
+ */
+ C.PBKDF2 = function (password, salt, cfg) {
+ return PBKDF2.create(cfg).compute(password, salt);
+ };
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var WordArray = C_lib.WordArray;
+ var C_algo = C.algo;
+ var MD5 = C_algo.MD5;
+
+ /**
+ * This key derivation function is meant to conform with EVP_BytesToKey.
+ * www.openssl.org/docs/crypto/EVP_BytesToKey.html
+ */
+ var EvpKDF = C_algo.EvpKDF = Base.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
+ * @property {Hasher} hasher The hash algorithm to use. Default: MD5
+ * @property {number} iterations The number of iterations to perform. Default: 1
+ */
+ cfg: Base.extend({
+ keySize: 128/32,
+ hasher: MD5,
+ iterations: 1
+ }),
+
+ /**
+ * Initializes a newly created key derivation function.
+ *
+ * @param {Object} cfg (Optional) The configuration options to use for the derivation.
+ *
+ * @example
+ *
+ * var kdf = CryptoJS.algo.EvpKDF.create();
+ * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
+ * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
+ */
+ init: function (cfg) {
+ this.cfg = this.cfg.extend(cfg);
+ },
+
+ /**
+ * Derives a key from a password.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @example
+ *
+ * var key = kdf.compute(password, salt);
+ */
+ compute: function (password, salt) {
+ // Shortcut
+ var cfg = this.cfg;
+
+ // Init hasher
+ var hasher = cfg.hasher.create();
+
+ // Initial values
+ var derivedKey = WordArray.create();
+
+ // Shortcuts
+ var derivedKeyWords = derivedKey.words;
+ var keySize = cfg.keySize;
+ var iterations = cfg.iterations;
+
+ // Generate key
+ while (derivedKeyWords.length < keySize) {
+ if (block) {
+ hasher.update(block);
+ }
+ var block = hasher.update(password).finalize(salt);
+ hasher.reset();
+
+ // Iterations
+ for (var i = 1; i < iterations; i++) {
+ block = hasher.finalize(block);
+ hasher.reset();
+ }
+
+ derivedKey.concat(block);
+ }
+ derivedKey.sigBytes = keySize * 4;
+
+ return derivedKey;
+ }
+ });
+
+ /**
+ * Derives a key from a password.
+ *
+ * @param {WordArray|string} password The password.
+ * @param {WordArray|string} salt A salt.
+ * @param {Object} cfg (Optional) The configuration options to use for this computation.
+ *
+ * @return {WordArray} The derived key.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var key = CryptoJS.EvpKDF(password, salt);
+ * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
+ * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
+ */
+ C.EvpKDF = function (password, salt, cfg) {
+ return EvpKDF.create(cfg).compute(password, salt);
+ };
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var C_algo = C.algo;
+ var SHA256 = C_algo.SHA256;
+
+ /**
+ * SHA-224 hash algorithm.
+ */
+ var SHA224 = C_algo.SHA224 = SHA256.extend({
+ _doReset: function () {
+ this._hash = new WordArray.init([
+ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
+ 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
+ ]);
+ },
+
+ _doFinalize: function () {
+ var hash = SHA256._doFinalize.call(this);
+
+ hash.sigBytes -= 4;
+
+ return hash;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA224('message');
+ * var hash = CryptoJS.SHA224(wordArray);
+ */
+ C.SHA224 = SHA256._createHelper(SHA224);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA224(message, key);
+ */
+ C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
+}());
+
+
+(function (undefined) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var X32WordArray = C_lib.WordArray;
+
+ /**
+ * x64 namespace.
+ */
+ var C_x64 = C.x64 = {};
+
+ /**
+ * A 64-bit word.
+ */
+ var X64Word = C_x64.Word = Base.extend({
+ /**
+ * Initializes a newly created 64-bit word.
+ *
+ * @param {number} high The high 32 bits.
+ * @param {number} low The low 32 bits.
+ *
+ * @example
+ *
+ * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
+ */
+ init: function (high, low) {
+ this.high = high;
+ this.low = low;
+ }
+
+ /**
+ * Bitwise NOTs this word.
+ *
+ * @return {X64Word} A new x64-Word object after negating.
+ *
+ * @example
+ *
+ * var negated = x64Word.not();
+ */
+ // not: function () {
+ // var high = ~this.high;
+ // var low = ~this.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Bitwise ANDs this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to AND with this word.
+ *
+ * @return {X64Word} A new x64-Word object after ANDing.
+ *
+ * @example
+ *
+ * var anded = x64Word.and(anotherX64Word);
+ */
+ // and: function (word) {
+ // var high = this.high & word.high;
+ // var low = this.low & word.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Bitwise ORs this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to OR with this word.
+ *
+ * @return {X64Word} A new x64-Word object after ORing.
+ *
+ * @example
+ *
+ * var ored = x64Word.or(anotherX64Word);
+ */
+ // or: function (word) {
+ // var high = this.high | word.high;
+ // var low = this.low | word.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Bitwise XORs this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to XOR with this word.
+ *
+ * @return {X64Word} A new x64-Word object after XORing.
+ *
+ * @example
+ *
+ * var xored = x64Word.xor(anotherX64Word);
+ */
+ // xor: function (word) {
+ // var high = this.high ^ word.high;
+ // var low = this.low ^ word.low;
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Shifts this word n bits to the left.
+ *
+ * @param {number} n The number of bits to shift.
+ *
+ * @return {X64Word} A new x64-Word object after shifting.
+ *
+ * @example
+ *
+ * var shifted = x64Word.shiftL(25);
+ */
+ // shiftL: function (n) {
+ // if (n < 32) {
+ // var high = (this.high << n) | (this.low >>> (32 - n));
+ // var low = this.low << n;
+ // } else {
+ // var high = this.low << (n - 32);
+ // var low = 0;
+ // }
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Shifts this word n bits to the right.
+ *
+ * @param {number} n The number of bits to shift.
+ *
+ * @return {X64Word} A new x64-Word object after shifting.
+ *
+ * @example
+ *
+ * var shifted = x64Word.shiftR(7);
+ */
+ // shiftR: function (n) {
+ // if (n < 32) {
+ // var low = (this.low >>> n) | (this.high << (32 - n));
+ // var high = this.high >>> n;
+ // } else {
+ // var low = this.high >>> (n - 32);
+ // var high = 0;
+ // }
+
+ // return X64Word.create(high, low);
+ // },
+
+ /**
+ * Rotates this word n bits to the left.
+ *
+ * @param {number} n The number of bits to rotate.
+ *
+ * @return {X64Word} A new x64-Word object after rotating.
+ *
+ * @example
+ *
+ * var rotated = x64Word.rotL(25);
+ */
+ // rotL: function (n) {
+ // return this.shiftL(n).or(this.shiftR(64 - n));
+ // },
+
+ /**
+ * Rotates this word n bits to the right.
+ *
+ * @param {number} n The number of bits to rotate.
+ *
+ * @return {X64Word} A new x64-Word object after rotating.
+ *
+ * @example
+ *
+ * var rotated = x64Word.rotR(7);
+ */
+ // rotR: function (n) {
+ // return this.shiftR(n).or(this.shiftL(64 - n));
+ // },
+
+ /**
+ * Adds this word with the passed word.
+ *
+ * @param {X64Word} word The x64-Word to add with this word.
+ *
+ * @return {X64Word} A new x64-Word object after adding.
+ *
+ * @example
+ *
+ * var added = x64Word.add(anotherX64Word);
+ */
+ // add: function (word) {
+ // var low = (this.low + word.low) | 0;
+ // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
+ // var high = (this.high + word.high + carry) | 0;
+
+ // return X64Word.create(high, low);
+ // }
+ });
+
+ /**
+ * An array of 64-bit words.
+ *
+ * @property {Array} words The array of CryptoJS.x64.Word objects.
+ * @property {number} sigBytes The number of significant bytes in this word array.
+ */
+ var X64WordArray = C_x64.WordArray = Base.extend({
+ /**
+ * Initializes a newly created word array.
+ *
+ * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
+ * @param {number} sigBytes (Optional) The number of significant bytes in the words.
+ *
+ * @example
+ *
+ * var wordArray = CryptoJS.x64.WordArray.create();
+ *
+ * var wordArray = CryptoJS.x64.WordArray.create([
+ * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
+ * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
+ * ]);
+ *
+ * var wordArray = CryptoJS.x64.WordArray.create([
+ * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
+ * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
+ * ], 10);
+ */
+ init: function (words, sigBytes) {
+ words = this.words = words || [];
+
+ if (sigBytes != undefined) {
+ this.sigBytes = sigBytes;
+ } else {
+ this.sigBytes = words.length * 8;
+ }
+ },
+
+ /**
+ * Converts this 64-bit word array to a 32-bit word array.
+ *
+ * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
+ *
+ * @example
+ *
+ * var x32WordArray = x64WordArray.toX32();
+ */
+ toX32: function () {
+ // Shortcuts
+ var x64Words = this.words;
+ var x64WordsLength = x64Words.length;
+
+ // Convert
+ var x32Words = [];
+ for (var i = 0; i < x64WordsLength; i++) {
+ var x64Word = x64Words[i];
+ x32Words.push(x64Word.high);
+ x32Words.push(x64Word.low);
+ }
+
+ return X32WordArray.create(x32Words, this.sigBytes);
+ },
+
+ /**
+ * Creates a copy of this word array.
+ *
+ * @return {X64WordArray} The clone.
+ *
+ * @example
+ *
+ * var clone = x64WordArray.clone();
+ */
+ clone: function () {
+ var clone = Base.clone.call(this);
+
+ // Clone "words" array
+ var words = clone.words = this.words.slice(0);
+
+ // Clone each X64Word object
+ var wordsLength = words.length;
+ for (var i = 0; i < wordsLength; i++) {
+ words[i] = words[i].clone();
+ }
+
+ return clone;
+ }
+ });
+}());
+
+
+(function (Math) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var Hasher = C_lib.Hasher;
+ var C_x64 = C.x64;
+ var X64Word = C_x64.Word;
+ var C_algo = C.algo;
+
+ // Constants tables
+ var RHO_OFFSETS = [];
+ var PI_INDEXES = [];
+ var ROUND_CONSTANTS = [];
+
+ // Compute Constants
+ (function () {
+ // Compute rho offset constants
+ var x = 1, y = 0;
+ for (var t = 0; t < 24; t++) {
+ RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
+
+ var newX = y % 5;
+ var newY = (2 * x + 3 * y) % 5;
+ x = newX;
+ y = newY;
+ }
+
+ // Compute pi index constants
+ for (var x = 0; x < 5; x++) {
+ for (var y = 0; y < 5; y++) {
+ PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
+ }
+ }
+
+ // Compute round constants
+ var LFSR = 0x01;
+ for (var i = 0; i < 24; i++) {
+ var roundConstantMsw = 0;
+ var roundConstantLsw = 0;
+
+ for (var j = 0; j < 7; j++) {
+ if (LFSR & 0x01) {
+ var bitPosition = (1 << j) - 1;
+ if (bitPosition < 32) {
+ roundConstantLsw ^= 1 << bitPosition;
+ } else /* if (bitPosition >= 32) */ {
+ roundConstantMsw ^= 1 << (bitPosition - 32);
+ }
+ }
+
+ // Compute next LFSR
+ if (LFSR & 0x80) {
+ // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
+ LFSR = (LFSR << 1) ^ 0x71;
+ } else {
+ LFSR <<= 1;
+ }
+ }
+
+ ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
+ }
+ }());
+
+ // Reusable objects for temporary values
+ var T = [];
+ (function () {
+ for (var i = 0; i < 25; i++) {
+ T[i] = X64Word.create();
+ }
+ }());
+
+ /**
+ * SHA-3 hash algorithm.
+ */
+ var SHA3 = C_algo.SHA3 = Hasher.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} outputLength
+ * The desired number of bits in the output hash.
+ * Only values permitted are: 224, 256, 384, 512.
+ * Default: 512
+ */
+ cfg: Hasher.cfg.extend({
+ outputLength: 512
+ }),
+
+ _doReset: function () {
+ var state = this._state = []
+ for (var i = 0; i < 25; i++) {
+ state[i] = new X64Word.init();
+ }
+
+ this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcuts
+ var state = this._state;
+ var nBlockSizeLanes = this.blockSize / 2;
+
+ // Absorb
+ for (var i = 0; i < nBlockSizeLanes; i++) {
+ // Shortcuts
+ var M2i = M[offset + 2 * i];
+ var M2i1 = M[offset + 2 * i + 1];
+
+ // Swap endian
+ M2i = (
+ (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
+ (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
+ );
+ M2i1 = (
+ (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
+ (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
+ );
+
+ // Absorb message into state
+ var lane = state[i];
+ lane.high ^= M2i1;
+ lane.low ^= M2i;
+ }
+
+ // Rounds
+ for (var round = 0; round < 24; round++) {
+ // Theta
+ for (var x = 0; x < 5; x++) {
+ // Mix column lanes
+ var tMsw = 0, tLsw = 0;
+ for (var y = 0; y < 5; y++) {
+ var lane = state[x + 5 * y];
+ tMsw ^= lane.high;
+ tLsw ^= lane.low;
+ }
+
+ // Temporary values
+ var Tx = T[x];
+ Tx.high = tMsw;
+ Tx.low = tLsw;
+ }
+ for (var x = 0; x < 5; x++) {
+ // Shortcuts
+ var Tx4 = T[(x + 4) % 5];
+ var Tx1 = T[(x + 1) % 5];
+ var Tx1Msw = Tx1.high;
+ var Tx1Lsw = Tx1.low;
+
+ // Mix surrounding columns
+ var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
+ var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
+ for (var y = 0; y < 5; y++) {
+ var lane = state[x + 5 * y];
+ lane.high ^= tMsw;
+ lane.low ^= tLsw;
+ }
+ }
+
+ // Rho Pi
+ for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
+ // Shortcuts
+ var lane = state[laneIndex];
+ var laneMsw = lane.high;
+ var laneLsw = lane.low;
+ var rhoOffset = RHO_OFFSETS[laneIndex];
+
+ // Rotate lanes
+ if (rhoOffset < 32) {
+ var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
+ var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
+ } else /* if (rhoOffset >= 32) */ {
+ var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
+ var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
+ }
+
+ // Transpose lanes
+ var TPiLane = T[PI_INDEXES[laneIndex]];
+ TPiLane.high = tMsw;
+ TPiLane.low = tLsw;
+ }
+
+ // Rho pi at x = y = 0
+ var T0 = T[0];
+ var state0 = state[0];
+ T0.high = state0.high;
+ T0.low = state0.low;
+
+ // Chi
+ for (var x = 0; x < 5; x++) {
+ for (var y = 0; y < 5; y++) {
+ // Shortcuts
+ var laneIndex = x + 5 * y;
+ var lane = state[laneIndex];
+ var TLane = T[laneIndex];
+ var Tx1Lane = T[((x + 1) % 5) + 5 * y];
+ var Tx2Lane = T[((x + 2) % 5) + 5 * y];
+
+ // Mix rows
+ lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
+ lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
+ }
+ }
+
+ // Iota
+ var lane = state[0];
+ var roundConstant = ROUND_CONSTANTS[round];
+ lane.high ^= roundConstant.high;
+ lane.low ^= roundConstant.low;;
+ }
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+ var blockSizeBits = this.blockSize * 32;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
+ dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Shortcuts
+ var state = this._state;
+ var outputLengthBytes = this.cfg.outputLength / 8;
+ var outputLengthLanes = outputLengthBytes / 8;
+
+ // Squeeze
+ var hashWords = [];
+ for (var i = 0; i < outputLengthLanes; i++) {
+ // Shortcuts
+ var lane = state[i];
+ var laneMsw = lane.high;
+ var laneLsw = lane.low;
+
+ // Swap endian
+ laneMsw = (
+ (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
+ (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
+ );
+ laneLsw = (
+ (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
+ (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
+ );
+
+ // Squeeze state to retrieve hash
+ hashWords.push(laneLsw);
+ hashWords.push(laneMsw);
+ }
+
+ // Return final computed hash
+ return new WordArray.init(hashWords, outputLengthBytes);
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+
+ var state = clone._state = this._state.slice(0);
+ for (var i = 0; i < 25; i++) {
+ state[i] = state[i].clone();
+ }
+
+ return clone;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA3('message');
+ * var hash = CryptoJS.SHA3(wordArray);
+ */
+ C.SHA3 = Hasher._createHelper(SHA3);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA3(message, key);
+ */
+ C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
+}(Math));
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Hasher = C_lib.Hasher;
+ var C_x64 = C.x64;
+ var X64Word = C_x64.Word;
+ var X64WordArray = C_x64.WordArray;
+ var C_algo = C.algo;
+
+ function X64Word_create() {
+ return X64Word.create.apply(X64Word, arguments);
+ }
+
+ // Constants
+ var K = [
+ X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
+ X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
+ X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
+ X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
+ X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
+ X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
+ X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
+ X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
+ X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
+ X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
+ X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
+ X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
+ X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
+ X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
+ X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
+ X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
+ X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
+ X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
+ X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
+ X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
+ X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
+ X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
+ X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
+ X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
+ X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
+ X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
+ X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
+ X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
+ X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
+ X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
+ X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
+ X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
+ X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
+ X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
+ X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
+ X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
+ X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
+ X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
+ X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
+ X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
+ ];
+
+ // Reusable objects
+ var W = [];
+ (function () {
+ for (var i = 0; i < 80; i++) {
+ W[i] = X64Word_create();
+ }
+ }());
+
+ /**
+ * SHA-512 hash algorithm.
+ */
+ var SHA512 = C_algo.SHA512 = Hasher.extend({
+ _doReset: function () {
+ this._hash = new X64WordArray.init([
+ new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
+ new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
+ new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
+ new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
+ ]);
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcuts
+ var H = this._hash.words;
+
+ var H0 = H[0];
+ var H1 = H[1];
+ var H2 = H[2];
+ var H3 = H[3];
+ var H4 = H[4];
+ var H5 = H[5];
+ var H6 = H[6];
+ var H7 = H[7];
+
+ var H0h = H0.high;
+ var H0l = H0.low;
+ var H1h = H1.high;
+ var H1l = H1.low;
+ var H2h = H2.high;
+ var H2l = H2.low;
+ var H3h = H3.high;
+ var H3l = H3.low;
+ var H4h = H4.high;
+ var H4l = H4.low;
+ var H5h = H5.high;
+ var H5l = H5.low;
+ var H6h = H6.high;
+ var H6l = H6.low;
+ var H7h = H7.high;
+ var H7l = H7.low;
+
+ // Working variables
+ var ah = H0h;
+ var al = H0l;
+ var bh = H1h;
+ var bl = H1l;
+ var ch = H2h;
+ var cl = H2l;
+ var dh = H3h;
+ var dl = H3l;
+ var eh = H4h;
+ var el = H4l;
+ var fh = H5h;
+ var fl = H5l;
+ var gh = H6h;
+ var gl = H6l;
+ var hh = H7h;
+ var hl = H7l;
+
+ // Rounds
+ for (var i = 0; i < 80; i++) {
+ // Shortcut
+ var Wi = W[i];
+
+ // Extend message
+ if (i < 16) {
+ var Wih = Wi.high = M[offset + i * 2] | 0;
+ var Wil = Wi.low = M[offset + i * 2 + 1] | 0;
+ } else {
+ // Gamma0
+ var gamma0x = W[i - 15];
+ var gamma0xh = gamma0x.high;
+ var gamma0xl = gamma0x.low;
+ var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
+ var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
+
+ // Gamma1
+ var gamma1x = W[i - 2];
+ var gamma1xh = gamma1x.high;
+ var gamma1xl = gamma1x.low;
+ var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
+ var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
+
+ // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
+ var Wi7 = W[i - 7];
+ var Wi7h = Wi7.high;
+ var Wi7l = Wi7.low;
+
+ var Wi16 = W[i - 16];
+ var Wi16h = Wi16.high;
+ var Wi16l = Wi16.low;
+
+ var Wil = gamma0l + Wi7l;
+ var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
+ var Wil = Wil + gamma1l;
+ var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
+ var Wil = Wil + Wi16l;
+ var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
+
+ Wi.high = Wih;
+ Wi.low = Wil;
+ }
+
+ var chh = (eh & fh) ^ (~eh & gh);
+ var chl = (el & fl) ^ (~el & gl);
+ var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
+ var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
+
+ var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
+ var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
+ var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
+ var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
+
+ // t1 = h + sigma1 + ch + K[i] + W[i]
+ var Ki = K[i];
+ var Kih = Ki.high;
+ var Kil = Ki.low;
+
+ var t1l = hl + sigma1l;
+ var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
+ var t1l = t1l + chl;
+ var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
+ var t1l = t1l + Kil;
+ var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
+ var t1l = t1l + Wil;
+ var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
+
+ // t2 = sigma0 + maj
+ var t2l = sigma0l + majl;
+ var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
+
+ // Update working variables
+ hh = gh;
+ hl = gl;
+ gh = fh;
+ gl = fl;
+ fh = eh;
+ fl = el;
+ el = (dl + t1l) | 0;
+ eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
+ dh = ch;
+ dl = cl;
+ ch = bh;
+ cl = bl;
+ bh = ah;
+ bl = al;
+ al = (t1l + t2l) | 0;
+ ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
+ }
+
+ // Intermediate hash value
+ H0l = H0.low = (H0l + al);
+ H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
+ H1l = H1.low = (H1l + bl);
+ H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
+ H2l = H2.low = (H2l + cl);
+ H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
+ H3l = H3.low = (H3l + dl);
+ H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
+ H4l = H4.low = (H4l + el);
+ H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
+ H5l = H5.low = (H5l + fl);
+ H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
+ H6l = H6.low = (H6l + gl);
+ H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
+ H7l = H7.low = (H7l + hl);
+ H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
+ },
+
+ _doFinalize: function () {
+ // Shortcuts
+ var data = this._data;
+ var dataWords = data.words;
+
+ var nBitsTotal = this._nDataBytes * 8;
+ var nBitsLeft = data.sigBytes * 8;
+
+ // Add padding
+ dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
+ dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
+ dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
+ data.sigBytes = dataWords.length * 4;
+
+ // Hash final blocks
+ this._process();
+
+ // Convert hash to 32-bit word array before returning
+ var hash = this._hash.toX32();
+
+ // Return final computed hash
+ return hash;
+ },
+
+ clone: function () {
+ var clone = Hasher.clone.call(this);
+ clone._hash = this._hash.clone();
+
+ return clone;
+ },
+
+ blockSize: 1024/32
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA512('message');
+ * var hash = CryptoJS.SHA512(wordArray);
+ */
+ C.SHA512 = Hasher._createHelper(SHA512);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA512(message, key);
+ */
+ C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_x64 = C.x64;
+ var X64Word = C_x64.Word;
+ var X64WordArray = C_x64.WordArray;
+ var C_algo = C.algo;
+ var SHA512 = C_algo.SHA512;
+
+ /**
+ * SHA-384 hash algorithm.
+ */
+ var SHA384 = C_algo.SHA384 = SHA512.extend({
+ _doReset: function () {
+ this._hash = new X64WordArray.init([
+ new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
+ new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
+ new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
+ new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
+ ]);
+ },
+
+ _doFinalize: function () {
+ var hash = SHA512._doFinalize.call(this);
+
+ hash.sigBytes -= 16;
+
+ return hash;
+ }
+ });
+
+ /**
+ * Shortcut function to the hasher's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ *
+ * @return {WordArray} The hash.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hash = CryptoJS.SHA384('message');
+ * var hash = CryptoJS.SHA384(wordArray);
+ */
+ C.SHA384 = SHA512._createHelper(SHA384);
+
+ /**
+ * Shortcut function to the HMAC's object interface.
+ *
+ * @param {WordArray|string} message The message to hash.
+ * @param {WordArray|string} key The secret key.
+ *
+ * @return {WordArray} The HMAC.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hmac = CryptoJS.HmacSHA384(message, key);
+ */
+ C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
+}());
+
+
+/**
+ * Cipher core components.
+ */
+CryptoJS.lib.Cipher || (function (undefined) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var Base = C_lib.Base;
+ var WordArray = C_lib.WordArray;
+ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
+ var C_enc = C.enc;
+ var Utf8 = C_enc.Utf8;
+ var Base64 = C_enc.Base64;
+ var C_algo = C.algo;
+ var EvpKDF = C_algo.EvpKDF;
+
+ /**
+ * Abstract base cipher template.
+ *
+ * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
+ * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
+ * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
+ * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
+ */
+ var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {WordArray} iv The IV to use for this operation.
+ */
+ cfg: Base.extend(),
+
+ /**
+ * Creates this cipher in encryption mode.
+ *
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {Cipher} A cipher instance.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
+ */
+ createEncryptor: function (key, cfg) {
+ return this.create(this._ENC_XFORM_MODE, key, cfg);
+ },
+
+ /**
+ * Creates this cipher in decryption mode.
+ *
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {Cipher} A cipher instance.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
+ */
+ createDecryptor: function (key, cfg) {
+ return this.create(this._DEC_XFORM_MODE, key, cfg);
+ },
+
+ /**
+ * Initializes a newly created cipher.
+ *
+ * @param {number} xformMode Either the encryption or decryption transormation mode constant.
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @example
+ *
+ * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
+ */
+ init: function (xformMode, key, cfg) {
+ // Apply config defaults
+ this.cfg = this.cfg.extend(cfg);
+
+ // Store transform mode and key
+ this._xformMode = xformMode;
+ this._key = key;
+
+ // Set initial values
+ this.reset();
+ },
+
+ /**
+ * Resets this cipher to its initial state.
+ *
+ * @example
+ *
+ * cipher.reset();
+ */
+ reset: function () {
+ // Reset data buffer
+ BufferedBlockAlgorithm.reset.call(this);
+
+ // Perform concrete-cipher logic
+ this._doReset();
+ },
+
+ /**
+ * Adds data to be encrypted or decrypted.
+ *
+ * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
+ *
+ * @return {WordArray} The data after processing.
+ *
+ * @example
+ *
+ * var encrypted = cipher.process('data');
+ * var encrypted = cipher.process(wordArray);
+ */
+ process: function (dataUpdate) {
+ // Append
+ this._append(dataUpdate);
+
+ // Process available blocks
+ return this._process();
+ },
+
+ /**
+ * Finalizes the encryption or decryption process.
+ * Note that the finalize operation is effectively a destructive, read-once operation.
+ *
+ * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
+ *
+ * @return {WordArray} The data after final processing.
+ *
+ * @example
+ *
+ * var encrypted = cipher.finalize();
+ * var encrypted = cipher.finalize('data');
+ * var encrypted = cipher.finalize(wordArray);
+ */
+ finalize: function (dataUpdate) {
+ // Final data update
+ if (dataUpdate) {
+ this._append(dataUpdate);
+ }
+
+ // Perform concrete-cipher logic
+ var finalProcessedData = this._doFinalize();
+
+ return finalProcessedData;
+ },
+
+ keySize: 128/32,
+
+ ivSize: 128/32,
+
+ _ENC_XFORM_MODE: 1,
+
+ _DEC_XFORM_MODE: 2,
+
+ /**
+ * Creates shortcut functions to a cipher's object interface.
+ *
+ * @param {Cipher} cipher The cipher to create a helper for.
+ *
+ * @return {Object} An object with encrypt and decrypt shortcut functions.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
+ */
+ _createHelper: (function () {
+ function selectCipherStrategy(key) {
+ if (typeof key == 'string') {
+ return PasswordBasedCipher;
+ } else {
+ return SerializableCipher;
+ }
+ }
+
+ return function (cipher) {
+ return {
+ encrypt: function (message, key, cfg) {
+ return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
+ },
+
+ decrypt: function (ciphertext, key, cfg) {
+ return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
+ }
+ };
+ };
+ }())
+ });
+
+ /**
+ * Abstract base stream cipher template.
+ *
+ * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
+ */
+ var StreamCipher = C_lib.StreamCipher = Cipher.extend({
+ _doFinalize: function () {
+ // Process partial blocks
+ var finalProcessedBlocks = this._process(!!'flush');
+
+ return finalProcessedBlocks;
+ },
+
+ blockSize: 1
+ });
+
+ /**
+ * Mode namespace.
+ */
+ var C_mode = C.mode = {};
+
+ /**
+ * Abstract base block cipher mode template.
+ */
+ var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
+ /**
+ * Creates this mode for encryption.
+ *
+ * @param {Cipher} cipher A block cipher instance.
+ * @param {Array} iv The IV words.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
+ */
+ createEncryptor: function (cipher, iv) {
+ return this.Encryptor.create(cipher, iv);
+ },
+
+ /**
+ * Creates this mode for decryption.
+ *
+ * @param {Cipher} cipher A block cipher instance.
+ * @param {Array} iv The IV words.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
+ */
+ createDecryptor: function (cipher, iv) {
+ return this.Decryptor.create(cipher, iv);
+ },
+
+ /**
+ * Initializes a newly created mode.
+ *
+ * @param {Cipher} cipher A block cipher instance.
+ * @param {Array} iv The IV words.
+ *
+ * @example
+ *
+ * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
+ */
+ init: function (cipher, iv) {
+ this._cipher = cipher;
+ this._iv = iv;
+ }
+ });
+
+ /**
+ * Cipher Block Chaining mode.
+ */
+ var CBC = C_mode.CBC = (function () {
+ /**
+ * Abstract base CBC mode.
+ */
+ var CBC = BlockCipherMode.extend();
+
+ /**
+ * CBC encryptor.
+ */
+ CBC.Encryptor = CBC.extend({
+ /**
+ * Processes the data block at offset.
+ *
+ * @param {Array} words The data words to operate on.
+ * @param {number} offset The offset where the block starts.
+ *
+ * @example
+ *
+ * mode.processBlock(data.words, offset);
+ */
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ // XOR and encrypt
+ xorBlock.call(this, words, offset, blockSize);
+ cipher.encryptBlock(words, offset);
+
+ // Remember this block to use with next block
+ this._prevBlock = words.slice(offset, offset + blockSize);
+ }
+ });
+
+ /**
+ * CBC decryptor.
+ */
+ CBC.Decryptor = CBC.extend({
+ /**
+ * Processes the data block at offset.
+ *
+ * @param {Array} words The data words to operate on.
+ * @param {number} offset The offset where the block starts.
+ *
+ * @example
+ *
+ * mode.processBlock(data.words, offset);
+ */
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ // Remember this block to use with next block
+ var thisBlock = words.slice(offset, offset + blockSize);
+
+ // Decrypt and XOR
+ cipher.decryptBlock(words, offset);
+ xorBlock.call(this, words, offset, blockSize);
+
+ // This block becomes the previous block
+ this._prevBlock = thisBlock;
+ }
+ });
+
+ function xorBlock(words, offset, blockSize) {
+ // Shortcut
+ var iv = this._iv;
+
+ // Choose mixing block
+ if (iv) {
+ var block = iv;
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ } else {
+ var block = this._prevBlock;
+ }
+
+ // XOR blocks
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= block[i];
+ }
+ }
+
+ return CBC;
+ }());
+
+ /**
+ * Padding namespace.
+ */
+ var C_pad = C.pad = {};
+
+ /**
+ * PKCS #5/7 padding strategy.
+ */
+ var Pkcs7 = C_pad.Pkcs7 = {
+ /**
+ * Pads data using the algorithm defined in PKCS #5/7.
+ *
+ * @param {WordArray} data The data to pad.
+ * @param {number} blockSize The multiple that the data should be padded to.
+ *
+ * @static
+ *
+ * @example
+ *
+ * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
+ */
+ pad: function (data, blockSize) {
+ // Shortcut
+ var blockSizeBytes = blockSize * 4;
+
+ // Count padding bytes
+ var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
+
+ // Create padding word
+ var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
+
+ // Create padding
+ var paddingWords = [];
+ for (var i = 0; i < nPaddingBytes; i += 4) {
+ paddingWords.push(paddingWord);
+ }
+ var padding = WordArray.create(paddingWords, nPaddingBytes);
+
+ // Add padding
+ data.concat(padding);
+ },
+
+ /**
+ * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
+ *
+ * @param {WordArray} data The data to unpad.
+ *
+ * @static
+ *
+ * @example
+ *
+ * CryptoJS.pad.Pkcs7.unpad(wordArray);
+ */
+ unpad: function (data) {
+ // Get number of padding bytes from last byte
+ var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
+
+ // Remove padding
+ data.sigBytes -= nPaddingBytes;
+ }
+ };
+
+ /**
+ * Abstract base block cipher template.
+ *
+ * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
+ */
+ var BlockCipher = C_lib.BlockCipher = Cipher.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {Mode} mode The block mode to use. Default: CBC
+ * @property {Padding} padding The padding strategy to use. Default: Pkcs7
+ */
+ cfg: Cipher.cfg.extend({
+ mode: CBC,
+ padding: Pkcs7
+ }),
+
+ reset: function () {
+ // Reset cipher
+ Cipher.reset.call(this);
+
+ // Shortcuts
+ var cfg = this.cfg;
+ var iv = cfg.iv;
+ var mode = cfg.mode;
+
+ // Reset block mode
+ if (this._xformMode == this._ENC_XFORM_MODE) {
+ var modeCreator = mode.createEncryptor;
+ } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
+ var modeCreator = mode.createDecryptor;
+ // Keep at least one block in the buffer for unpadding
+ this._minBufferSize = 1;
+ }
+
+ if (this._mode && this._mode.__creator == modeCreator) {
+ this._mode.init(this, iv && iv.words);
+ } else {
+ this._mode = modeCreator.call(mode, this, iv && iv.words);
+ this._mode.__creator = modeCreator;
+ }
+ },
+
+ _doProcessBlock: function (words, offset) {
+ this._mode.processBlock(words, offset);
+ },
+
+ _doFinalize: function () {
+ // Shortcut
+ var padding = this.cfg.padding;
+
+ // Finalize
+ if (this._xformMode == this._ENC_XFORM_MODE) {
+ // Pad data
+ padding.pad(this._data, this.blockSize);
+
+ // Process final blocks
+ var finalProcessedBlocks = this._process(!!'flush');
+ } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
+ // Process final blocks
+ var finalProcessedBlocks = this._process(!!'flush');
+
+ // Unpad data
+ padding.unpad(finalProcessedBlocks);
+ }
+
+ return finalProcessedBlocks;
+ },
+
+ blockSize: 128/32
+ });
+
+ /**
+ * A collection of cipher parameters.
+ *
+ * @property {WordArray} ciphertext The raw ciphertext.
+ * @property {WordArray} key The key to this ciphertext.
+ * @property {WordArray} iv The IV used in the ciphering operation.
+ * @property {WordArray} salt The salt used with a key derivation function.
+ * @property {Cipher} algorithm The cipher algorithm.
+ * @property {Mode} mode The block mode used in the ciphering operation.
+ * @property {Padding} padding The padding scheme used in the ciphering operation.
+ * @property {number} blockSize The block size of the cipher.
+ * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
+ */
+ var CipherParams = C_lib.CipherParams = Base.extend({
+ /**
+ * Initializes a newly created cipher params object.
+ *
+ * @param {Object} cipherParams An object with any of the possible cipher parameters.
+ *
+ * @example
+ *
+ * var cipherParams = CryptoJS.lib.CipherParams.create({
+ * ciphertext: ciphertextWordArray,
+ * key: keyWordArray,
+ * iv: ivWordArray,
+ * salt: saltWordArray,
+ * algorithm: CryptoJS.algo.AES,
+ * mode: CryptoJS.mode.CBC,
+ * padding: CryptoJS.pad.PKCS7,
+ * blockSize: 4,
+ * formatter: CryptoJS.format.OpenSSL
+ * });
+ */
+ init: function (cipherParams) {
+ this.mixIn(cipherParams);
+ },
+
+ /**
+ * Converts this cipher params object to a string.
+ *
+ * @param {Format} formatter (Optional) The formatting strategy to use.
+ *
+ * @return {string} The stringified cipher params.
+ *
+ * @throws Error If neither the formatter nor the default formatter is set.
+ *
+ * @example
+ *
+ * var string = cipherParams + '';
+ * var string = cipherParams.toString();
+ * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
+ */
+ toString: function (formatter) {
+ return (formatter || this.formatter).stringify(this);
+ }
+ });
+
+ /**
+ * Format namespace.
+ */
+ var C_format = C.format = {};
+
+ /**
+ * OpenSSL formatting strategy.
+ */
+ var OpenSSLFormatter = C_format.OpenSSL = {
+ /**
+ * Converts a cipher params object to an OpenSSL-compatible string.
+ *
+ * @param {CipherParams} cipherParams The cipher params object.
+ *
+ * @return {string} The OpenSSL-compatible string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
+ */
+ stringify: function (cipherParams) {
+ // Shortcuts
+ var ciphertext = cipherParams.ciphertext;
+ var salt = cipherParams.salt;
+
+ // Format
+ if (salt) {
+ var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
+ } else {
+ var wordArray = ciphertext;
+ }
+
+ return wordArray.toString(Base64);
+ },
+
+ /**
+ * Converts an OpenSSL-compatible string to a cipher params object.
+ *
+ * @param {string} openSSLStr The OpenSSL-compatible string.
+ *
+ * @return {CipherParams} The cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
+ */
+ parse: function (openSSLStr) {
+ // Parse base64
+ var ciphertext = Base64.parse(openSSLStr);
+
+ // Shortcut
+ var ciphertextWords = ciphertext.words;
+
+ // Test for salt
+ if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
+ // Extract salt
+ var salt = WordArray.create(ciphertextWords.slice(2, 4));
+
+ // Remove salt from ciphertext
+ ciphertextWords.splice(0, 4);
+ ciphertext.sigBytes -= 16;
+ }
+
+ return CipherParams.create({ ciphertext: ciphertext, salt: salt });
+ }
+ };
+
+ /**
+ * A cipher wrapper that returns ciphertext as a serializable cipher params object.
+ */
+ var SerializableCipher = C_lib.SerializableCipher = Base.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
+ */
+ cfg: Base.extend({
+ format: OpenSSLFormatter
+ }),
+
+ /**
+ * Encrypts a message.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {WordArray|string} message The message to encrypt.
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {CipherParams} A cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
+ */
+ encrypt: function (cipher, message, key, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Encrypt
+ var encryptor = cipher.createEncryptor(key, cfg);
+ var ciphertext = encryptor.finalize(message);
+
+ // Shortcut
+ var cipherCfg = encryptor.cfg;
+
+ // Create and return serializable cipher params
+ return CipherParams.create({
+ ciphertext: ciphertext,
+ key: key,
+ iv: cipherCfg.iv,
+ algorithm: cipher,
+ mode: cipherCfg.mode,
+ padding: cipherCfg.padding,
+ blockSize: cipher.blockSize,
+ formatter: cfg.format
+ });
+ },
+
+ /**
+ * Decrypts serialized ciphertext.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
+ * @param {WordArray} key The key.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {WordArray} The plaintext.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
+ * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
+ */
+ decrypt: function (cipher, ciphertext, key, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Convert string to CipherParams
+ ciphertext = this._parse(ciphertext, cfg.format);
+
+ // Decrypt
+ var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
+
+ return plaintext;
+ },
+
+ /**
+ * Converts serialized ciphertext to CipherParams,
+ * else assumed CipherParams already and returns ciphertext unchanged.
+ *
+ * @param {CipherParams|string} ciphertext The ciphertext.
+ * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
+ *
+ * @return {CipherParams} The unserialized ciphertext.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
+ */
+ _parse: function (ciphertext, format) {
+ if (typeof ciphertext == 'string') {
+ return format.parse(ciphertext, this);
+ } else {
+ return ciphertext;
+ }
+ }
+ });
+
+ /**
+ * Key derivation function namespace.
+ */
+ var C_kdf = C.kdf = {};
+
+ /**
+ * OpenSSL key derivation function.
+ */
+ var OpenSSLKdf = C_kdf.OpenSSL = {
+ /**
+ * Derives a key and IV from a password.
+ *
+ * @param {string} password The password to derive from.
+ * @param {number} keySize The size in words of the key to generate.
+ * @param {number} ivSize The size in words of the IV to generate.
+ * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
+ *
+ * @return {CipherParams} A cipher params object with the key, IV, and salt.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
+ */
+ execute: function (password, keySize, ivSize, salt) {
+ // Generate random salt
+ if (!salt) {
+ salt = WordArray.random(64/8);
+ }
+
+ // Derive key and IV
+ var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
+
+ // Separate key and IV
+ var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
+ key.sigBytes = keySize * 4;
+
+ // Return params
+ return CipherParams.create({ key: key, iv: iv, salt: salt });
+ }
+ };
+
+ /**
+ * A serializable cipher wrapper that derives the key from a password,
+ * and returns ciphertext as a serializable cipher params object.
+ */
+ var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
+ */
+ cfg: SerializableCipher.cfg.extend({
+ kdf: OpenSSLKdf
+ }),
+
+ /**
+ * Encrypts a message using a password.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {WordArray|string} message The message to encrypt.
+ * @param {string} password The password.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {CipherParams} A cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
+ */
+ encrypt: function (cipher, message, password, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Derive key and other params
+ var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
+
+ // Add IV to config
+ cfg.iv = derivedParams.iv;
+
+ // Encrypt
+ var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
+
+ // Mix in derived params
+ ciphertext.mixIn(derivedParams);
+
+ return ciphertext;
+ },
+
+ /**
+ * Decrypts serialized ciphertext using a password.
+ *
+ * @param {Cipher} cipher The cipher algorithm to use.
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
+ * @param {string} password The password.
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
+ *
+ * @return {WordArray} The plaintext.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
+ */
+ decrypt: function (cipher, ciphertext, password, cfg) {
+ // Apply config defaults
+ cfg = this.cfg.extend(cfg);
+
+ // Convert string to CipherParams
+ ciphertext = this._parse(ciphertext, cfg.format);
+
+ // Derive key and other params
+ var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
+
+ // Add IV to config
+ cfg.iv = derivedParams.iv;
+
+ // Decrypt
+ var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
+
+ return plaintext;
+ }
+ });
+}());
+
+
+/**
+ * Cipher Feedback block mode.
+ */
+CryptoJS.mode.CFB = (function () {
+ var CFB = CryptoJS.lib.BlockCipherMode.extend();
+
+ CFB.Encryptor = CFB.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
+
+ // Remember this block to use with next block
+ this._prevBlock = words.slice(offset, offset + blockSize);
+ }
+ });
+
+ CFB.Decryptor = CFB.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher;
+ var blockSize = cipher.blockSize;
+
+ // Remember this block to use with next block
+ var thisBlock = words.slice(offset, offset + blockSize);
+
+ generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
+
+ // This block becomes the previous block
+ this._prevBlock = thisBlock;
+ }
+ });
+
+ function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
+ // Shortcut
+ var iv = this._iv;
+
+ // Generate keystream
+ if (iv) {
+ var keystream = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ } else {
+ var keystream = this._prevBlock;
+ }
+ cipher.encryptBlock(keystream, 0);
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+
+ return CFB;
+}());
+
+
+/**
+ * Electronic Codebook block mode.
+ */
+CryptoJS.mode.ECB = (function () {
+ var ECB = CryptoJS.lib.BlockCipherMode.extend();
+
+ ECB.Encryptor = ECB.extend({
+ processBlock: function (words, offset) {
+ this._cipher.encryptBlock(words, offset);
+ }
+ });
+
+ ECB.Decryptor = ECB.extend({
+ processBlock: function (words, offset) {
+ this._cipher.decryptBlock(words, offset);
+ }
+ });
+
+ return ECB;
+}());
+
+
+/**
+ * ANSI X.923 padding strategy.
+ */
+CryptoJS.pad.AnsiX923 = {
+ pad: function (data, blockSize) {
+ // Shortcuts
+ var dataSigBytes = data.sigBytes;
+ var blockSizeBytes = blockSize * 4;
+
+ // Count padding bytes
+ var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
+
+ // Compute last byte position
+ var lastBytePos = dataSigBytes + nPaddingBytes - 1;
+
+ // Pad
+ data.clamp();
+ data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
+ data.sigBytes += nPaddingBytes;
+ },
+
+ unpad: function (data) {
+ // Get number of padding bytes from last byte
+ var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
+
+ // Remove padding
+ data.sigBytes -= nPaddingBytes;
+ }
+};
+
+
+/**
+ * ISO 10126 padding strategy.
+ */
+CryptoJS.pad.Iso10126 = {
+ pad: function (data, blockSize) {
+ // Shortcut
+ var blockSizeBytes = blockSize * 4;
+
+ // Count padding bytes
+ var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
+
+ // Pad
+ data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
+ concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
+ },
+
+ unpad: function (data) {
+ // Get number of padding bytes from last byte
+ var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
+
+ // Remove padding
+ data.sigBytes -= nPaddingBytes;
+ }
+};
+
+
+/**
+ * ISO/IEC 9797-1 Padding Method 2.
+ */
+CryptoJS.pad.Iso97971 = {
+ pad: function (data, blockSize) {
+ // Add 0x80 byte
+ data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
+
+ // Zero pad the rest
+ CryptoJS.pad.ZeroPadding.pad(data, blockSize);
+ },
+
+ unpad: function (data) {
+ // Remove zero padding
+ CryptoJS.pad.ZeroPadding.unpad(data);
+
+ // Remove one more byte -- the 0x80 byte
+ data.sigBytes--;
+ }
+};
+
+
+/**
+ * Output Feedback block mode.
+ */
+CryptoJS.mode.OFB = (function () {
+ var OFB = CryptoJS.lib.BlockCipherMode.extend();
+
+ var Encryptor = OFB.Encryptor = OFB.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher
+ var blockSize = cipher.blockSize;
+ var iv = this._iv;
+ var keystream = this._keystream;
+
+ // Generate keystream
+ if (iv) {
+ keystream = this._keystream = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ }
+ cipher.encryptBlock(keystream, 0);
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+ });
+
+ OFB.Decryptor = Encryptor;
+
+ return OFB;
+}());
+
+
+/**
+ * A noop padding strategy.
+ */
+CryptoJS.pad.NoPadding = {
+ pad: function () {
+ },
+
+ unpad: function () {
+ }
+};
+
+
+(function (undefined) {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var CipherParams = C_lib.CipherParams;
+ var C_enc = C.enc;
+ var Hex = C_enc.Hex;
+ var C_format = C.format;
+
+ var HexFormatter = C_format.Hex = {
+ /**
+ * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
+ *
+ * @param {CipherParams} cipherParams The cipher params object.
+ *
+ * @return {string} The hexadecimally encoded string.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var hexString = CryptoJS.format.Hex.stringify(cipherParams);
+ */
+ stringify: function (cipherParams) {
+ return cipherParams.ciphertext.toString(Hex);
+ },
+
+ /**
+ * Converts a hexadecimally encoded ciphertext string to a cipher params object.
+ *
+ * @param {string} input The hexadecimally encoded string.
+ *
+ * @return {CipherParams} The cipher params object.
+ *
+ * @static
+ *
+ * @example
+ *
+ * var cipherParams = CryptoJS.format.Hex.parse(hexString);
+ */
+ parse: function (input) {
+ var ciphertext = Hex.parse(input);
+ return CipherParams.create({ ciphertext: ciphertext });
+ }
+ };
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var BlockCipher = C_lib.BlockCipher;
+ var C_algo = C.algo;
+
+ // Lookup tables
+ var SBOX = [];
+ var INV_SBOX = [];
+ var SUB_MIX_0 = [];
+ var SUB_MIX_1 = [];
+ var SUB_MIX_2 = [];
+ var SUB_MIX_3 = [];
+ var INV_SUB_MIX_0 = [];
+ var INV_SUB_MIX_1 = [];
+ var INV_SUB_MIX_2 = [];
+ var INV_SUB_MIX_3 = [];
+
+ // Compute lookup tables
+ (function () {
+ // Compute double table
+ var d = [];
+ for (var i = 0; i < 256; i++) {
+ if (i < 128) {
+ d[i] = i << 1;
+ } else {
+ d[i] = (i << 1) ^ 0x11b;
+ }
+ }
+
+ // Walk GF(2^8)
+ var x = 0;
+ var xi = 0;
+ for (var i = 0; i < 256; i++) {
+ // Compute sbox
+ var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
+ sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
+ SBOX[x] = sx;
+ INV_SBOX[sx] = x;
+
+ // Compute multiplication
+ var x2 = d[x];
+ var x4 = d[x2];
+ var x8 = d[x4];
+
+ // Compute sub bytes, mix columns tables
+ var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
+ SUB_MIX_0[x] = (t << 24) | (t >>> 8);
+ SUB_MIX_1[x] = (t << 16) | (t >>> 16);
+ SUB_MIX_2[x] = (t << 8) | (t >>> 24);
+ SUB_MIX_3[x] = t;
+
+ // Compute inv sub bytes, inv mix columns tables
+ var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
+ INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
+ INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
+ INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
+ INV_SUB_MIX_3[sx] = t;
+
+ // Compute next counter
+ if (!x) {
+ x = xi = 1;
+ } else {
+ x = x2 ^ d[d[d[x8 ^ x2]]];
+ xi ^= d[d[xi]];
+ }
+ }
+ }());
+
+ // Precomputed Rcon lookup
+ var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
+
+ /**
+ * AES block cipher algorithm.
+ */
+ var AES = C_algo.AES = BlockCipher.extend({
+ _doReset: function () {
+ // Skip reset of nRounds has been set before and key did not change
+ if (this._nRounds && this._keyPriorReset === this._key) {
+ return;
+ }
+
+ // Shortcuts
+ var key = this._keyPriorReset = this._key;
+ var keyWords = key.words;
+ var keySize = key.sigBytes / 4;
+
+ // Compute number of rounds
+ var nRounds = this._nRounds = keySize + 6;
+
+ // Compute number of key schedule rows
+ var ksRows = (nRounds + 1) * 4;
+
+ // Compute key schedule
+ var keySchedule = this._keySchedule = [];
+ for (var ksRow = 0; ksRow < ksRows; ksRow++) {
+ if (ksRow < keySize) {
+ keySchedule[ksRow] = keyWords[ksRow];
+ } else {
+ var t = keySchedule[ksRow - 1];
+
+ if (!(ksRow % keySize)) {
+ // Rot word
+ t = (t << 8) | (t >>> 24);
+
+ // Sub word
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
+
+ // Mix Rcon
+ t ^= RCON[(ksRow / keySize) | 0] << 24;
+ } else if (keySize > 6 && ksRow % keySize == 4) {
+ // Sub word
+ t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
+ }
+
+ keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
+ }
+ }
+
+ // Compute inv key schedule
+ var invKeySchedule = this._invKeySchedule = [];
+ for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
+ var ksRow = ksRows - invKsRow;
+
+ if (invKsRow % 4) {
+ var t = keySchedule[ksRow];
+ } else {
+ var t = keySchedule[ksRow - 4];
+ }
+
+ if (invKsRow < 4 || ksRow <= 4) {
+ invKeySchedule[invKsRow] = t;
+ } else {
+ invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
+ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
+ }
+ }
+ },
+
+ encryptBlock: function (M, offset) {
+ this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
+ },
+
+ decryptBlock: function (M, offset) {
+ // Swap 2nd and 4th rows
+ var t = M[offset + 1];
+ M[offset + 1] = M[offset + 3];
+ M[offset + 3] = t;
+
+ this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
+
+ // Inv swap 2nd and 4th rows
+ var t = M[offset + 1];
+ M[offset + 1] = M[offset + 3];
+ M[offset + 3] = t;
+ },
+
+ _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
+ // Shortcut
+ var nRounds = this._nRounds;
+
+ // Get input, add round key
+ var s0 = M[offset] ^ keySchedule[0];
+ var s1 = M[offset + 1] ^ keySchedule[1];
+ var s2 = M[offset + 2] ^ keySchedule[2];
+ var s3 = M[offset + 3] ^ keySchedule[3];
+
+ // Key schedule row counter
+ var ksRow = 4;
+
+ // Rounds
+ for (var round = 1; round < nRounds; round++) {
+ // Shift rows, sub bytes, mix columns, add round key
+ var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
+ var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
+ var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
+ var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
+
+ // Update state
+ s0 = t0;
+ s1 = t1;
+ s2 = t2;
+ s3 = t3;
+ }
+
+ // Shift rows, sub bytes, add round key
+ var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
+ var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
+ var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
+ var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
+
+ // Set output
+ M[offset] = t0;
+ M[offset + 1] = t1;
+ M[offset + 2] = t2;
+ M[offset + 3] = t3;
+ },
+
+ keySize: 256/32
+ });
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
+ */
+ C.AES = BlockCipher._createHelper(AES);
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var WordArray = C_lib.WordArray;
+ var BlockCipher = C_lib.BlockCipher;
+ var C_algo = C.algo;
+
+ // Permuted Choice 1 constants
+ var PC1 = [
+ 57, 49, 41, 33, 25, 17, 9, 1,
+ 58, 50, 42, 34, 26, 18, 10, 2,
+ 59, 51, 43, 35, 27, 19, 11, 3,
+ 60, 52, 44, 36, 63, 55, 47, 39,
+ 31, 23, 15, 7, 62, 54, 46, 38,
+ 30, 22, 14, 6, 61, 53, 45, 37,
+ 29, 21, 13, 5, 28, 20, 12, 4
+ ];
+
+ // Permuted Choice 2 constants
+ var PC2 = [
+ 14, 17, 11, 24, 1, 5,
+ 3, 28, 15, 6, 21, 10,
+ 23, 19, 12, 4, 26, 8,
+ 16, 7, 27, 20, 13, 2,
+ 41, 52, 31, 37, 47, 55,
+ 30, 40, 51, 45, 33, 48,
+ 44, 49, 39, 56, 34, 53,
+ 46, 42, 50, 36, 29, 32
+ ];
+
+ // Cumulative bit shift constants
+ var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
+
+ // SBOXes and round permutation constants
+ var SBOX_P = [
+ {
+ 0x0: 0x808200,
+ 0x10000000: 0x8000,
+ 0x20000000: 0x808002,
+ 0x30000000: 0x2,
+ 0x40000000: 0x200,
+ 0x50000000: 0x808202,
+ 0x60000000: 0x800202,
+ 0x70000000: 0x800000,
+ 0x80000000: 0x202,
+ 0x90000000: 0x800200,
+ 0xa0000000: 0x8200,
+ 0xb0000000: 0x808000,
+ 0xc0000000: 0x8002,
+ 0xd0000000: 0x800002,
+ 0xe0000000: 0x0,
+ 0xf0000000: 0x8202,
+ 0x8000000: 0x0,
+ 0x18000000: 0x808202,
+ 0x28000000: 0x8202,
+ 0x38000000: 0x8000,
+ 0x48000000: 0x808200,
+ 0x58000000: 0x200,
+ 0x68000000: 0x808002,
+ 0x78000000: 0x2,
+ 0x88000000: 0x800200,
+ 0x98000000: 0x8200,
+ 0xa8000000: 0x808000,
+ 0xb8000000: 0x800202,
+ 0xc8000000: 0x800002,
+ 0xd8000000: 0x8002,
+ 0xe8000000: 0x202,
+ 0xf8000000: 0x800000,
+ 0x1: 0x8000,
+ 0x10000001: 0x2,
+ 0x20000001: 0x808200,
+ 0x30000001: 0x800000,
+ 0x40000001: 0x808002,
+ 0x50000001: 0x8200,
+ 0x60000001: 0x200,
+ 0x70000001: 0x800202,
+ 0x80000001: 0x808202,
+ 0x90000001: 0x808000,
+ 0xa0000001: 0x800002,
+ 0xb0000001: 0x8202,
+ 0xc0000001: 0x202,
+ 0xd0000001: 0x800200,
+ 0xe0000001: 0x8002,
+ 0xf0000001: 0x0,
+ 0x8000001: 0x808202,
+ 0x18000001: 0x808000,
+ 0x28000001: 0x800000,
+ 0x38000001: 0x200,
+ 0x48000001: 0x8000,
+ 0x58000001: 0x800002,
+ 0x68000001: 0x2,
+ 0x78000001: 0x8202,
+ 0x88000001: 0x8002,
+ 0x98000001: 0x800202,
+ 0xa8000001: 0x202,
+ 0xb8000001: 0x808200,
+ 0xc8000001: 0x800200,
+ 0xd8000001: 0x0,
+ 0xe8000001: 0x8200,
+ 0xf8000001: 0x808002
+ },
+ {
+ 0x0: 0x40084010,
+ 0x1000000: 0x4000,
+ 0x2000000: 0x80000,
+ 0x3000000: 0x40080010,
+ 0x4000000: 0x40000010,
+ 0x5000000: 0x40084000,
+ 0x6000000: 0x40004000,
+ 0x7000000: 0x10,
+ 0x8000000: 0x84000,
+ 0x9000000: 0x40004010,
+ 0xa000000: 0x40000000,
+ 0xb000000: 0x84010,
+ 0xc000000: 0x80010,
+ 0xd000000: 0x0,
+ 0xe000000: 0x4010,
+ 0xf000000: 0x40080000,
+ 0x800000: 0x40004000,
+ 0x1800000: 0x84010,
+ 0x2800000: 0x10,
+ 0x3800000: 0x40004010,
+ 0x4800000: 0x40084010,
+ 0x5800000: 0x40000000,
+ 0x6800000: 0x80000,
+ 0x7800000: 0x40080010,
+ 0x8800000: 0x80010,
+ 0x9800000: 0x0,
+ 0xa800000: 0x4000,
+ 0xb800000: 0x40080000,
+ 0xc800000: 0x40000010,
+ 0xd800000: 0x84000,
+ 0xe800000: 0x40084000,
+ 0xf800000: 0x4010,
+ 0x10000000: 0x0,
+ 0x11000000: 0x40080010,
+ 0x12000000: 0x40004010,
+ 0x13000000: 0x40084000,
+ 0x14000000: 0x40080000,
+ 0x15000000: 0x10,
+ 0x16000000: 0x84010,
+ 0x17000000: 0x4000,
+ 0x18000000: 0x4010,
+ 0x19000000: 0x80000,
+ 0x1a000000: 0x80010,
+ 0x1b000000: 0x40000010,
+ 0x1c000000: 0x84000,
+ 0x1d000000: 0x40004000,
+ 0x1e000000: 0x40000000,
+ 0x1f000000: 0x40084010,
+ 0x10800000: 0x84010,
+ 0x11800000: 0x80000,
+ 0x12800000: 0x40080000,
+ 0x13800000: 0x4000,
+ 0x14800000: 0x40004000,
+ 0x15800000: 0x40084010,
+ 0x16800000: 0x10,
+ 0x17800000: 0x40000000,
+ 0x18800000: 0x40084000,
+ 0x19800000: 0x40000010,
+ 0x1a800000: 0x40004010,
+ 0x1b800000: 0x80010,
+ 0x1c800000: 0x0,
+ 0x1d800000: 0x4010,
+ 0x1e800000: 0x40080010,
+ 0x1f800000: 0x84000
+ },
+ {
+ 0x0: 0x104,
+ 0x100000: 0x0,
+ 0x200000: 0x4000100,
+ 0x300000: 0x10104,
+ 0x400000: 0x10004,
+ 0x500000: 0x4000004,
+ 0x600000: 0x4010104,
+ 0x700000: 0x4010000,
+ 0x800000: 0x4000000,
+ 0x900000: 0x4010100,
+ 0xa00000: 0x10100,
+ 0xb00000: 0x4010004,
+ 0xc00000: 0x4000104,
+ 0xd00000: 0x10000,
+ 0xe00000: 0x4,
+ 0xf00000: 0x100,
+ 0x80000: 0x4010100,
+ 0x180000: 0x4010004,
+ 0x280000: 0x0,
+ 0x380000: 0x4000100,
+ 0x480000: 0x4000004,
+ 0x580000: 0x10000,
+ 0x680000: 0x10004,
+ 0x780000: 0x104,
+ 0x880000: 0x4,
+ 0x980000: 0x100,
+ 0xa80000: 0x4010000,
+ 0xb80000: 0x10104,
+ 0xc80000: 0x10100,
+ 0xd80000: 0x4000104,
+ 0xe80000: 0x4010104,
+ 0xf80000: 0x4000000,
+ 0x1000000: 0x4010100,
+ 0x1100000: 0x10004,
+ 0x1200000: 0x10000,
+ 0x1300000: 0x4000100,
+ 0x1400000: 0x100,
+ 0x1500000: 0x4010104,
+ 0x1600000: 0x4000004,
+ 0x1700000: 0x0,
+ 0x1800000: 0x4000104,
+ 0x1900000: 0x4000000,
+ 0x1a00000: 0x4,
+ 0x1b00000: 0x10100,
+ 0x1c00000: 0x4010000,
+ 0x1d00000: 0x104,
+ 0x1e00000: 0x10104,
+ 0x1f00000: 0x4010004,
+ 0x1080000: 0x4000000,
+ 0x1180000: 0x104,
+ 0x1280000: 0x4010100,
+ 0x1380000: 0x0,
+ 0x1480000: 0x10004,
+ 0x1580000: 0x4000100,
+ 0x1680000: 0x100,
+ 0x1780000: 0x4010004,
+ 0x1880000: 0x10000,
+ 0x1980000: 0x4010104,
+ 0x1a80000: 0x10104,
+ 0x1b80000: 0x4000004,
+ 0x1c80000: 0x4000104,
+ 0x1d80000: 0x4010000,
+ 0x1e80000: 0x4,
+ 0x1f80000: 0x10100
+ },
+ {
+ 0x0: 0x80401000,
+ 0x10000: 0x80001040,
+ 0x20000: 0x401040,
+ 0x30000: 0x80400000,
+ 0x40000: 0x0,
+ 0x50000: 0x401000,
+ 0x60000: 0x80000040,
+ 0x70000: 0x400040,
+ 0x80000: 0x80000000,
+ 0x90000: 0x400000,
+ 0xa0000: 0x40,
+ 0xb0000: 0x80001000,
+ 0xc0000: 0x80400040,
+ 0xd0000: 0x1040,
+ 0xe0000: 0x1000,
+ 0xf0000: 0x80401040,
+ 0x8000: 0x80001040,
+ 0x18000: 0x40,
+ 0x28000: 0x80400040,
+ 0x38000: 0x80001000,
+ 0x48000: 0x401000,
+ 0x58000: 0x80401040,
+ 0x68000: 0x0,
+ 0x78000: 0x80400000,
+ 0x88000: 0x1000,
+ 0x98000: 0x80401000,
+ 0xa8000: 0x400000,
+ 0xb8000: 0x1040,
+ 0xc8000: 0x80000000,
+ 0xd8000: 0x400040,
+ 0xe8000: 0x401040,
+ 0xf8000: 0x80000040,
+ 0x100000: 0x400040,
+ 0x110000: 0x401000,
+ 0x120000: 0x80000040,
+ 0x130000: 0x0,
+ 0x140000: 0x1040,
+ 0x150000: 0x80400040,
+ 0x160000: 0x80401000,
+ 0x170000: 0x80001040,
+ 0x180000: 0x80401040,
+ 0x190000: 0x80000000,
+ 0x1a0000: 0x80400000,
+ 0x1b0000: 0x401040,
+ 0x1c0000: 0x80001000,
+ 0x1d0000: 0x400000,
+ 0x1e0000: 0x40,
+ 0x1f0000: 0x1000,
+ 0x108000: 0x80400000,
+ 0x118000: 0x80401040,
+ 0x128000: 0x0,
+ 0x138000: 0x401000,
+ 0x148000: 0x400040,
+ 0x158000: 0x80000000,
+ 0x168000: 0x80001040,
+ 0x178000: 0x40,
+ 0x188000: 0x80000040,
+ 0x198000: 0x1000,
+ 0x1a8000: 0x80001000,
+ 0x1b8000: 0x80400040,
+ 0x1c8000: 0x1040,
+ 0x1d8000: 0x80401000,
+ 0x1e8000: 0x400000,
+ 0x1f8000: 0x401040
+ },
+ {
+ 0x0: 0x80,
+ 0x1000: 0x1040000,
+ 0x2000: 0x40000,
+ 0x3000: 0x20000000,
+ 0x4000: 0x20040080,
+ 0x5000: 0x1000080,
+ 0x6000: 0x21000080,
+ 0x7000: 0x40080,
+ 0x8000: 0x1000000,
+ 0x9000: 0x20040000,
+ 0xa000: 0x20000080,
+ 0xb000: 0x21040080,
+ 0xc000: 0x21040000,
+ 0xd000: 0x0,
+ 0xe000: 0x1040080,
+ 0xf000: 0x21000000,
+ 0x800: 0x1040080,
+ 0x1800: 0x21000080,
+ 0x2800: 0x80,
+ 0x3800: 0x1040000,
+ 0x4800: 0x40000,
+ 0x5800: 0x20040080,
+ 0x6800: 0x21040000,
+ 0x7800: 0x20000000,
+ 0x8800: 0x20040000,
+ 0x9800: 0x0,
+ 0xa800: 0x21040080,
+ 0xb800: 0x1000080,
+ 0xc800: 0x20000080,
+ 0xd800: 0x21000000,
+ 0xe800: 0x1000000,
+ 0xf800: 0x40080,
+ 0x10000: 0x40000,
+ 0x11000: 0x80,
+ 0x12000: 0x20000000,
+ 0x13000: 0x21000080,
+ 0x14000: 0x1000080,
+ 0x15000: 0x21040000,
+ 0x16000: 0x20040080,
+ 0x17000: 0x1000000,
+ 0x18000: 0x21040080,
+ 0x19000: 0x21000000,
+ 0x1a000: 0x1040000,
+ 0x1b000: 0x20040000,
+ 0x1c000: 0x40080,
+ 0x1d000: 0x20000080,
+ 0x1e000: 0x0,
+ 0x1f000: 0x1040080,
+ 0x10800: 0x21000080,
+ 0x11800: 0x1000000,
+ 0x12800: 0x1040000,
+ 0x13800: 0x20040080,
+ 0x14800: 0x20000000,
+ 0x15800: 0x1040080,
+ 0x16800: 0x80,
+ 0x17800: 0x21040000,
+ 0x18800: 0x40080,
+ 0x19800: 0x21040080,
+ 0x1a800: 0x0,
+ 0x1b800: 0x21000000,
+ 0x1c800: 0x1000080,
+ 0x1d800: 0x40000,
+ 0x1e800: 0x20040000,
+ 0x1f800: 0x20000080
+ },
+ {
+ 0x0: 0x10000008,
+ 0x100: 0x2000,
+ 0x200: 0x10200000,
+ 0x300: 0x10202008,
+ 0x400: 0x10002000,
+ 0x500: 0x200000,
+ 0x600: 0x200008,
+ 0x700: 0x10000000,
+ 0x800: 0x0,
+ 0x900: 0x10002008,
+ 0xa00: 0x202000,
+ 0xb00: 0x8,
+ 0xc00: 0x10200008,
+ 0xd00: 0x202008,
+ 0xe00: 0x2008,
+ 0xf00: 0x10202000,
+ 0x80: 0x10200000,
+ 0x180: 0x10202008,
+ 0x280: 0x8,
+ 0x380: 0x200000,
+ 0x480: 0x202008,
+ 0x580: 0x10000008,
+ 0x680: 0x10002000,
+ 0x780: 0x2008,
+ 0x880: 0x200008,
+ 0x980: 0x2000,
+ 0xa80: 0x10002008,
+ 0xb80: 0x10200008,
+ 0xc80: 0x0,
+ 0xd80: 0x10202000,
+ 0xe80: 0x202000,
+ 0xf80: 0x10000000,
+ 0x1000: 0x10002000,
+ 0x1100: 0x10200008,
+ 0x1200: 0x10202008,
+ 0x1300: 0x2008,
+ 0x1400: 0x200000,
+ 0x1500: 0x10000000,
+ 0x1600: 0x10000008,
+ 0x1700: 0x202000,
+ 0x1800: 0x202008,
+ 0x1900: 0x0,
+ 0x1a00: 0x8,
+ 0x1b00: 0x10200000,
+ 0x1c00: 0x2000,
+ 0x1d00: 0x10002008,
+ 0x1e00: 0x10202000,
+ 0x1f00: 0x200008,
+ 0x1080: 0x8,
+ 0x1180: 0x202000,
+ 0x1280: 0x200000,
+ 0x1380: 0x10000008,
+ 0x1480: 0x10002000,
+ 0x1580: 0x2008,
+ 0x1680: 0x10202008,
+ 0x1780: 0x10200000,
+ 0x1880: 0x10202000,
+ 0x1980: 0x10200008,
+ 0x1a80: 0x2000,
+ 0x1b80: 0x202008,
+ 0x1c80: 0x200008,
+ 0x1d80: 0x0,
+ 0x1e80: 0x10000000,
+ 0x1f80: 0x10002008
+ },
+ {
+ 0x0: 0x100000,
+ 0x10: 0x2000401,
+ 0x20: 0x400,
+ 0x30: 0x100401,
+ 0x40: 0x2100401,
+ 0x50: 0x0,
+ 0x60: 0x1,
+ 0x70: 0x2100001,
+ 0x80: 0x2000400,
+ 0x90: 0x100001,
+ 0xa0: 0x2000001,
+ 0xb0: 0x2100400,
+ 0xc0: 0x2100000,
+ 0xd0: 0x401,
+ 0xe0: 0x100400,
+ 0xf0: 0x2000000,
+ 0x8: 0x2100001,
+ 0x18: 0x0,
+ 0x28: 0x2000401,
+ 0x38: 0x2100400,
+ 0x48: 0x100000,
+ 0x58: 0x2000001,
+ 0x68: 0x2000000,
+ 0x78: 0x401,
+ 0x88: 0x100401,
+ 0x98: 0x2000400,
+ 0xa8: 0x2100000,
+ 0xb8: 0x100001,
+ 0xc8: 0x400,
+ 0xd8: 0x2100401,
+ 0xe8: 0x1,
+ 0xf8: 0x100400,
+ 0x100: 0x2000000,
+ 0x110: 0x100000,
+ 0x120: 0x2000401,
+ 0x130: 0x2100001,
+ 0x140: 0x100001,
+ 0x150: 0x2000400,
+ 0x160: 0x2100400,
+ 0x170: 0x100401,
+ 0x180: 0x401,
+ 0x190: 0x2100401,
+ 0x1a0: 0x100400,
+ 0x1b0: 0x1,
+ 0x1c0: 0x0,
+ 0x1d0: 0x2100000,
+ 0x1e0: 0x2000001,
+ 0x1f0: 0x400,
+ 0x108: 0x100400,
+ 0x118: 0x2000401,
+ 0x128: 0x2100001,
+ 0x138: 0x1,
+ 0x148: 0x2000000,
+ 0x158: 0x100000,
+ 0x168: 0x401,
+ 0x178: 0x2100400,
+ 0x188: 0x2000001,
+ 0x198: 0x2100000,
+ 0x1a8: 0x0,
+ 0x1b8: 0x2100401,
+ 0x1c8: 0x100401,
+ 0x1d8: 0x400,
+ 0x1e8: 0x2000400,
+ 0x1f8: 0x100001
+ },
+ {
+ 0x0: 0x8000820,
+ 0x1: 0x20000,
+ 0x2: 0x8000000,
+ 0x3: 0x20,
+ 0x4: 0x20020,
+ 0x5: 0x8020820,
+ 0x6: 0x8020800,
+ 0x7: 0x800,
+ 0x8: 0x8020000,
+ 0x9: 0x8000800,
+ 0xa: 0x20800,
+ 0xb: 0x8020020,
+ 0xc: 0x820,
+ 0xd: 0x0,
+ 0xe: 0x8000020,
+ 0xf: 0x20820,
+ 0x80000000: 0x800,
+ 0x80000001: 0x8020820,
+ 0x80000002: 0x8000820,
+ 0x80000003: 0x8000000,
+ 0x80000004: 0x8020000,
+ 0x80000005: 0x20800,
+ 0x80000006: 0x20820,
+ 0x80000007: 0x20,
+ 0x80000008: 0x8000020,
+ 0x80000009: 0x820,
+ 0x8000000a: 0x20020,
+ 0x8000000b: 0x8020800,
+ 0x8000000c: 0x0,
+ 0x8000000d: 0x8020020,
+ 0x8000000e: 0x8000800,
+ 0x8000000f: 0x20000,
+ 0x10: 0x20820,
+ 0x11: 0x8020800,
+ 0x12: 0x20,
+ 0x13: 0x800,
+ 0x14: 0x8000800,
+ 0x15: 0x8000020,
+ 0x16: 0x8020020,
+ 0x17: 0x20000,
+ 0x18: 0x0,
+ 0x19: 0x20020,
+ 0x1a: 0x8020000,
+ 0x1b: 0x8000820,
+ 0x1c: 0x8020820,
+ 0x1d: 0x20800,
+ 0x1e: 0x820,
+ 0x1f: 0x8000000,
+ 0x80000010: 0x20000,
+ 0x80000011: 0x800,
+ 0x80000012: 0x8020020,
+ 0x80000013: 0x20820,
+ 0x80000014: 0x20,
+ 0x80000015: 0x8020000,
+ 0x80000016: 0x8000000,
+ 0x80000017: 0x8000820,
+ 0x80000018: 0x8020820,
+ 0x80000019: 0x8000020,
+ 0x8000001a: 0x8000800,
+ 0x8000001b: 0x0,
+ 0x8000001c: 0x20800,
+ 0x8000001d: 0x820,
+ 0x8000001e: 0x20020,
+ 0x8000001f: 0x8020800
+ }
+ ];
+
+ // Masks that select the SBOX input
+ var SBOX_MASK = [
+ 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
+ 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
+ ];
+
+ /**
+ * DES block cipher algorithm.
+ */
+ var DES = C_algo.DES = BlockCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var key = this._key;
+ var keyWords = key.words;
+
+ // Select 56 bits according to PC1
+ var keyBits = [];
+ for (var i = 0; i < 56; i++) {
+ var keyBitPos = PC1[i] - 1;
+ keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
+ }
+
+ // Assemble 16 subkeys
+ var subKeys = this._subKeys = [];
+ for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
+ // Create subkey
+ var subKey = subKeys[nSubKey] = [];
+
+ // Shortcut
+ var bitShift = BIT_SHIFTS[nSubKey];
+
+ // Select 48 bits according to PC2
+ for (var i = 0; i < 24; i++) {
+ // Select from the left 28 key bits
+ subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
+
+ // Select from the right 28 key bits
+ subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
+ }
+
+ // Since each subkey is applied to an expanded 32-bit input,
+ // the subkey can be broken into 8 values scaled to 32-bits,
+ // which allows the key to be used without expansion
+ subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
+ for (var i = 1; i < 7; i++) {
+ subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
+ }
+ subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
+ }
+
+ // Compute inverse subkeys
+ var invSubKeys = this._invSubKeys = [];
+ for (var i = 0; i < 16; i++) {
+ invSubKeys[i] = subKeys[15 - i];
+ }
+ },
+
+ encryptBlock: function (M, offset) {
+ this._doCryptBlock(M, offset, this._subKeys);
+ },
+
+ decryptBlock: function (M, offset) {
+ this._doCryptBlock(M, offset, this._invSubKeys);
+ },
+
+ _doCryptBlock: function (M, offset, subKeys) {
+ // Get input
+ this._lBlock = M[offset];
+ this._rBlock = M[offset + 1];
+
+ // Initial permutation
+ exchangeLR.call(this, 4, 0x0f0f0f0f);
+ exchangeLR.call(this, 16, 0x0000ffff);
+ exchangeRL.call(this, 2, 0x33333333);
+ exchangeRL.call(this, 8, 0x00ff00ff);
+ exchangeLR.call(this, 1, 0x55555555);
+
+ // Rounds
+ for (var round = 0; round < 16; round++) {
+ // Shortcuts
+ var subKey = subKeys[round];
+ var lBlock = this._lBlock;
+ var rBlock = this._rBlock;
+
+ // Feistel function
+ var f = 0;
+ for (var i = 0; i < 8; i++) {
+ f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
+ }
+ this._lBlock = rBlock;
+ this._rBlock = lBlock ^ f;
+ }
+
+ // Undo swap from last round
+ var t = this._lBlock;
+ this._lBlock = this._rBlock;
+ this._rBlock = t;
+
+ // Final permutation
+ exchangeLR.call(this, 1, 0x55555555);
+ exchangeRL.call(this, 8, 0x00ff00ff);
+ exchangeRL.call(this, 2, 0x33333333);
+ exchangeLR.call(this, 16, 0x0000ffff);
+ exchangeLR.call(this, 4, 0x0f0f0f0f);
+
+ // Set output
+ M[offset] = this._lBlock;
+ M[offset + 1] = this._rBlock;
+ },
+
+ keySize: 64/32,
+
+ ivSize: 64/32,
+
+ blockSize: 64/32
+ });
+
+ // Swap bits across the left and right words
+ function exchangeLR(offset, mask) {
+ var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
+ this._rBlock ^= t;
+ this._lBlock ^= t << offset;
+ }
+
+ function exchangeRL(offset, mask) {
+ var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
+ this._lBlock ^= t;
+ this._rBlock ^= t << offset;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
+ */
+ C.DES = BlockCipher._createHelper(DES);
+
+ /**
+ * Triple-DES block cipher algorithm.
+ */
+ var TripleDES = C_algo.TripleDES = BlockCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var key = this._key;
+ var keyWords = key.words;
+
+ // Create DES instances
+ this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2)));
+ this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4)));
+ this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6)));
+ },
+
+ encryptBlock: function (M, offset) {
+ this._des1.encryptBlock(M, offset);
+ this._des2.decryptBlock(M, offset);
+ this._des3.encryptBlock(M, offset);
+ },
+
+ decryptBlock: function (M, offset) {
+ this._des3.decryptBlock(M, offset);
+ this._des2.encryptBlock(M, offset);
+ this._des1.decryptBlock(M, offset);
+ },
+
+ keySize: 192/32,
+
+ ivSize: 64/32,
+
+ blockSize: 64/32
+ });
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
+ */
+ C.TripleDES = BlockCipher._createHelper(TripleDES);
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var StreamCipher = C_lib.StreamCipher;
+ var C_algo = C.algo;
+
+ /**
+ * RC4 stream cipher algorithm.
+ */
+ var RC4 = C_algo.RC4 = StreamCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var key = this._key;
+ var keyWords = key.words;
+ var keySigBytes = key.sigBytes;
+
+ // Init sbox
+ var S = this._S = [];
+ for (var i = 0; i < 256; i++) {
+ S[i] = i;
+ }
+
+ // Key setup
+ for (var i = 0, j = 0; i < 256; i++) {
+ var keyByteIndex = i % keySigBytes;
+ var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
+
+ j = (j + S[i] + keyByte) % 256;
+
+ // Swap
+ var t = S[i];
+ S[i] = S[j];
+ S[j] = t;
+ }
+
+ // Counters
+ this._i = this._j = 0;
+ },
+
+ _doProcessBlock: function (M, offset) {
+ M[offset] ^= generateKeystreamWord.call(this);
+ },
+
+ keySize: 256/32,
+
+ ivSize: 0
+ });
+
+ function generateKeystreamWord() {
+ // Shortcuts
+ var S = this._S;
+ var i = this._i;
+ var j = this._j;
+
+ // Generate keystream word
+ var keystreamWord = 0;
+ for (var n = 0; n < 4; n++) {
+ i = (i + 1) % 256;
+ j = (j + S[i]) % 256;
+
+ // Swap
+ var t = S[i];
+ S[i] = S[j];
+ S[j] = t;
+
+ keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
+ }
+
+ // Update counters
+ this._i = i;
+ this._j = j;
+
+ return keystreamWord;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
+ */
+ C.RC4 = StreamCipher._createHelper(RC4);
+
+ /**
+ * Modified RC4 stream cipher algorithm.
+ */
+ var RC4Drop = C_algo.RC4Drop = RC4.extend({
+ /**
+ * Configuration options.
+ *
+ * @property {number} drop The number of keystream words to drop. Default 192
+ */
+ cfg: RC4.cfg.extend({
+ drop: 192
+ }),
+
+ _doReset: function () {
+ RC4._doReset.call(this);
+
+ // Drop
+ for (var i = this.cfg.drop; i > 0; i--) {
+ generateKeystreamWord.call(this);
+ }
+ }
+ });
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
+ */
+ C.RC4Drop = StreamCipher._createHelper(RC4Drop);
+}());
+
+
+/** @preserve
+ * Counter block mode compatible with Dr Brian Gladman fileenc.c
+ * derived from CryptoJS.mode.CTR
+ * Jan Hruby jhruby.web@gmail.com
+ */
+CryptoJS.mode.CTRGladman = (function () {
+ var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
+
+ function incWord(word)
+ {
+ if (((word >> 24) & 0xff) === 0xff) { //overflow
+ var b1 = (word >> 16)&0xff;
+ var b2 = (word >> 8)&0xff;
+ var b3 = word & 0xff;
+
+ if (b1 === 0xff) // overflow b1
+ {
+ b1 = 0;
+ if (b2 === 0xff)
+ {
+ b2 = 0;
+ if (b3 === 0xff)
+ {
+ b3 = 0;
+ }
+ else
+ {
+ ++b3;
+ }
+ }
+ else
+ {
+ ++b2;
+ }
+ }
+ else
+ {
+ ++b1;
+ }
+
+ word = 0;
+ word += (b1 << 16);
+ word += (b2 << 8);
+ word += b3;
+ }
+ else
+ {
+ word += (0x01 << 24);
+ }
+ return word;
+ }
+
+ function incCounter(counter)
+ {
+ if ((counter[0] = incWord(counter[0])) === 0)
+ {
+ // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
+ counter[1] = incWord(counter[1]);
+ }
+ return counter;
+ }
+
+ var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher
+ var blockSize = cipher.blockSize;
+ var iv = this._iv;
+ var counter = this._counter;
+
+ // Generate keystream
+ if (iv) {
+ counter = this._counter = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ }
+
+ incCounter(counter);
+
+ var keystream = counter.slice(0);
+ cipher.encryptBlock(keystream, 0);
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+ });
+
+ CTRGladman.Decryptor = Encryptor;
+
+ return CTRGladman;
+}());
+
+
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var StreamCipher = C_lib.StreamCipher;
+ var C_algo = C.algo;
+
+ // Reusable objects
+ var S = [];
+ var C_ = [];
+ var G = [];
+
+ /**
+ * Rabbit stream cipher algorithm
+ */
+ var Rabbit = C_algo.Rabbit = StreamCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var K = this._key.words;
+ var iv = this.cfg.iv;
+
+ // Swap endian
+ for (var i = 0; i < 4; i++) {
+ K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
+ (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
+ }
+
+ // Generate initial state values
+ var X = this._X = [
+ K[0], (K[3] << 16) | (K[2] >>> 16),
+ K[1], (K[0] << 16) | (K[3] >>> 16),
+ K[2], (K[1] << 16) | (K[0] >>> 16),
+ K[3], (K[2] << 16) | (K[1] >>> 16)
+ ];
+
+ // Generate initial counter values
+ var C = this._C = [
+ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
+ (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
+ (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
+ (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
+ ];
+
+ // Carry bit
+ this._b = 0;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+
+ // Modify the counters
+ for (var i = 0; i < 8; i++) {
+ C[i] ^= X[(i + 4) & 7];
+ }
+
+ // IV setup
+ if (iv) {
+ // Shortcuts
+ var IV = iv.words;
+ var IV_0 = IV[0];
+ var IV_1 = IV[1];
+
+ // Generate four subvectors
+ var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
+ var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
+ var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
+ var i3 = (i2 << 16) | (i0 & 0x0000ffff);
+
+ // Modify counter values
+ C[0] ^= i0;
+ C[1] ^= i1;
+ C[2] ^= i2;
+ C[3] ^= i3;
+ C[4] ^= i0;
+ C[5] ^= i1;
+ C[6] ^= i2;
+ C[7] ^= i3;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+ }
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var X = this._X;
+
+ // Iterate the system
+ nextState.call(this);
+
+ // Generate four keystream words
+ S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
+ S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
+ S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
+ S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
+
+ for (var i = 0; i < 4; i++) {
+ // Swap endian
+ S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
+ (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
+
+ // Encrypt
+ M[offset + i] ^= S[i];
+ }
+ },
+
+ blockSize: 128/32,
+
+ ivSize: 64/32
+ });
+
+ function nextState() {
+ // Shortcuts
+ var X = this._X;
+ var C = this._C;
+
+ // Save old counter values
+ for (var i = 0; i < 8; i++) {
+ C_[i] = C[i];
+ }
+
+ // Calculate new counter values
+ C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
+ C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
+ C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
+ C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
+ C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
+ C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
+ C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
+ C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
+ this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
+
+ // Calculate the g-values
+ for (var i = 0; i < 8; i++) {
+ var gx = X[i] + C[i];
+
+ // Construct high and low argument for squaring
+ var ga = gx & 0xffff;
+ var gb = gx >>> 16;
+
+ // Calculate high and low result of squaring
+ var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
+ var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
+
+ // High XOR low
+ G[i] = gh ^ gl;
+ }
+
+ // Calculate new state values
+ X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
+ X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
+ X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
+ X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
+ X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
+ X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
+ X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
+ X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
+ */
+ C.Rabbit = StreamCipher._createHelper(Rabbit);
+}());
+
+
+/**
+ * Counter block mode.
+ */
+CryptoJS.mode.CTR = (function () {
+ var CTR = CryptoJS.lib.BlockCipherMode.extend();
+
+ var Encryptor = CTR.Encryptor = CTR.extend({
+ processBlock: function (words, offset) {
+ // Shortcuts
+ var cipher = this._cipher
+ var blockSize = cipher.blockSize;
+ var iv = this._iv;
+ var counter = this._counter;
+
+ // Generate keystream
+ if (iv) {
+ counter = this._counter = iv.slice(0);
+
+ // Remove IV for subsequent blocks
+ this._iv = undefined;
+ }
+ var keystream = counter.slice(0);
+ cipher.encryptBlock(keystream, 0);
+
+ // Increment counter
+ counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
+
+ // Encrypt
+ for (var i = 0; i < blockSize; i++) {
+ words[offset + i] ^= keystream[i];
+ }
+ }
+ });
+
+ CTR.Decryptor = Encryptor;
+
+ return CTR;
+}());
+
+
+(function () {
+ // Shortcuts
+ var C = CryptoJS;
+ var C_lib = C.lib;
+ var StreamCipher = C_lib.StreamCipher;
+ var C_algo = C.algo;
+
+ // Reusable objects
+ var S = [];
+ var C_ = [];
+ var G = [];
+
+ /**
+ * Rabbit stream cipher algorithm.
+ *
+ * This is a legacy version that neglected to convert the key to little-endian.
+ * This error doesn't affect the cipher's security,
+ * but it does affect its compatibility with other implementations.
+ */
+ var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
+ _doReset: function () {
+ // Shortcuts
+ var K = this._key.words;
+ var iv = this.cfg.iv;
+
+ // Generate initial state values
+ var X = this._X = [
+ K[0], (K[3] << 16) | (K[2] >>> 16),
+ K[1], (K[0] << 16) | (K[3] >>> 16),
+ K[2], (K[1] << 16) | (K[0] >>> 16),
+ K[3], (K[2] << 16) | (K[1] >>> 16)
+ ];
+
+ // Generate initial counter values
+ var C = this._C = [
+ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
+ (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
+ (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
+ (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
+ ];
+
+ // Carry bit
+ this._b = 0;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+
+ // Modify the counters
+ for (var i = 0; i < 8; i++) {
+ C[i] ^= X[(i + 4) & 7];
+ }
+
+ // IV setup
+ if (iv) {
+ // Shortcuts
+ var IV = iv.words;
+ var IV_0 = IV[0];
+ var IV_1 = IV[1];
+
+ // Generate four subvectors
+ var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
+ var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
+ var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
+ var i3 = (i2 << 16) | (i0 & 0x0000ffff);
+
+ // Modify counter values
+ C[0] ^= i0;
+ C[1] ^= i1;
+ C[2] ^= i2;
+ C[3] ^= i3;
+ C[4] ^= i0;
+ C[5] ^= i1;
+ C[6] ^= i2;
+ C[7] ^= i3;
+
+ // Iterate the system four times
+ for (var i = 0; i < 4; i++) {
+ nextState.call(this);
+ }
+ }
+ },
+
+ _doProcessBlock: function (M, offset) {
+ // Shortcut
+ var X = this._X;
+
+ // Iterate the system
+ nextState.call(this);
+
+ // Generate four keystream words
+ S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
+ S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
+ S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
+ S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
+
+ for (var i = 0; i < 4; i++) {
+ // Swap endian
+ S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
+ (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
+
+ // Encrypt
+ M[offset + i] ^= S[i];
+ }
+ },
+
+ blockSize: 128/32,
+
+ ivSize: 64/32
+ });
+
+ function nextState() {
+ // Shortcuts
+ var X = this._X;
+ var C = this._C;
+
+ // Save old counter values
+ for (var i = 0; i < 8; i++) {
+ C_[i] = C[i];
+ }
+
+ // Calculate new counter values
+ C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
+ C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
+ C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
+ C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
+ C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
+ C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
+ C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
+ C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
+ this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
+
+ // Calculate the g-values
+ for (var i = 0; i < 8; i++) {
+ var gx = X[i] + C[i];
+
+ // Construct high and low argument for squaring
+ var ga = gx & 0xffff;
+ var gb = gx >>> 16;
+
+ // Calculate high and low result of squaring
+ var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
+ var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
+
+ // High XOR low
+ G[i] = gh ^ gl;
+ }
+
+ // Calculate new state values
+ X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
+ X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
+ X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
+ X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
+ X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
+ X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
+ X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
+ X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
+ }
+
+ /**
+ * Shortcut functions to the cipher's object interface.
+ *
+ * @example
+ *
+ * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
+ * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
+ */
+ C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
+}());
+
+
+/**
+ * Zero padding strategy.
+ */
+CryptoJS.pad.ZeroPadding = {
+ pad: function (data, blockSize) {
+ // Shortcut
+ var blockSizeBytes = blockSize * 4;
+
+ // Pad
+ data.clamp();
+ data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
+ },
+
+ unpad: function (data) {
+ // Shortcut
+ var dataWords = data.words;
+
+ // Unpad
+ var i = data.sigBytes - 1;
+ while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
+ i--;
+ }
+ data.sigBytes = i + 1;
+ }
+};
+
diff --git a/src/utils/filter.js b/src/utils/filter.js
new file mode 100644
index 0000000..43c77ef
--- /dev/null
+++ b/src/utils/filter.js
@@ -0,0 +1,30 @@
+import Vue from "vue";
+import * as dayjs from "dayjs";
+
+Vue.filter('NumberFormat', function (value) {
+ if (!value) {
+ return '0'
+ }
+ let intPartFormat = value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,') //将整数部分逢三一断
+ return intPartFormat
+})
+
+Vue.filter('dayjs', function(dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
+ return dayjs(dataStr).format(pattern)
+})
+
+Vue.filter('moment', function(dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
+ return dayjs(dataStr).format(pattern)
+})
+
+/** 字符串超长截取省略号显示 */
+Vue.filter('ellipsis', function (value, vlength = 25) {
+ if(!value){
+ return "";
+ }
+ console.log('vlength: '+ vlength);
+ if (value.length > vlength) {
+ return value.slice(0, vlength) + '...'
+ }
+ return value
+})
\ No newline at end of file
diff --git a/src/utils/hasPermission.js b/src/utils/hasPermission.js
new file mode 100644
index 0000000..e38f1d5
--- /dev/null
+++ b/src/utils/hasPermission.js
@@ -0,0 +1,120 @@
+import { USER_AUTH,SYS_BUTTON_AUTH } from "@/store/mutation-types"
+
+const hasPermission = {
+ install (Vue, options) {
+ //console.log(options);
+ Vue.directive('has', {
+ inserted: (el, binding, vnode)=>{
+ console.log("页面权限控制----");
+ //console.time()
+ //节点权限处理,如果命中则不进行全局权限处理
+ if(!filterNodePermission(el, binding, vnode)){
+ filterGlobalPermission(el, binding, vnode);
+ }
+ //console.timeEnd() //计时结束并输出时长
+ }
+ });
+ }
+};
+
+/**
+ * 流程节点权限控制
+ */
+export function filterNodePermission(el, binding, vnode) {
+ let permissionList = [];
+ try {
+ let obj = vnode.context.$props.formData;
+ if (obj) {
+ let bpmList = obj.permissionList;
+ for (let bpm of bpmList) {
+ if(bpm.type != '2') {
+ permissionList.push(bpm);
+ }
+ }
+ }else{
+ return false;
+ }
+ } catch (e) {
+ //console.log("页面权限异常----", e);
+ }
+ if (permissionList === null || permissionList === "" || permissionList === undefined||permissionList.length<=0) {
+ //el.parentNode.removeChild(el)
+ return false;
+ }
+
+ console.log("流程节点页面权限--NODE--");
+ let permissions = [];
+ for (let item of permissionList) {
+ if(item.type != '2') {
+ permissions.push(item.action);
+ }
+ }
+ //console.log("页面权限----"+permissions);
+ //console.log("页面权限----"+binding.value);
+ if (!permissions.includes(binding.value)) {
+ //el.parentNode.removeChild(el)
+ return false;
+ }else{
+ for (let item2 of permissionList) {
+ if(binding.value === item2.action){
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+/**
+ * 全局权限控制
+ */
+export function filterGlobalPermission(el, binding, vnode) {
+ console.log("全局页面权限--Global--");
+
+ let permissionList = [];
+ let allPermissionList = [];
+
+ //let authList = Vue.ls.get(USER_AUTH);
+ let authList = JSON.parse(sessionStorage.getItem(USER_AUTH) || "[]");
+ for (let auth of authList) {
+ if(auth.type != '2') {
+ permissionList.push(auth);
+ }
+ }
+ //console.log("页面权限--Global--",sessionStorage.getItem(SYS_BUTTON_AUTH));
+ let allAuthList = JSON.parse(sessionStorage.getItem(SYS_BUTTON_AUTH) || "[]");
+ for (let gauth of allAuthList) {
+ if(gauth.type != '2') {
+ allPermissionList.push(gauth);
+ }
+ }
+ //设置全局配置是否有命中
+ let invalidFlag = false;//无效命中
+ if(allPermissionList != null && allPermissionList != "" && allPermissionList != undefined && allPermissionList.length > 0){
+ for (let itemG of allPermissionList) {
+ if(binding.value === itemG.action){
+ if(itemG.status == '0'){
+ invalidFlag = true;
+ break;
+ }
+ }
+ }
+ }
+ if(invalidFlag){
+ return;
+ }
+ if (permissionList === null || permissionList === "" || permissionList === undefined||permissionList.length<=0) {
+ el.parentNode.removeChild(el);
+ return;
+ }
+ let permissions = [];
+ for (let item of permissionList) {
+ if(item.type != '2'){
+ permissions.push(item.action);
+ }
+ }
+ if (!permissions.includes(binding.value)) {
+ el.parentNode.removeChild(el);
+ }
+}
+
+export default hasPermission;
diff --git a/src/utils/mixin.js b/src/utils/mixin.js
new file mode 100644
index 0000000..9892910
--- /dev/null
+++ b/src/utils/mixin.js
@@ -0,0 +1,47 @@
+// import Vue from 'vue'
+import { mapState } from "vuex";
+
+// const mixinsComputed = Vue.config.optionMergeStrategies.computed
+// const mixinsMethods = Vue.config.optionMergeStrategies.methods
+
+const mixin = {
+ computed: {
+ ...mapState({
+ layoutMode: state => state.app.layout,
+ navTheme: state => state.app.theme,
+ primaryColor: state => state.app.color,
+ colorWeak: state => state.app.weak,
+ multipage: state => state.app.multipage,//多页签设置
+ fixedHeader: state => state.app.fixedHeader,
+ fixSiderbar: state => state.app.fixSiderbar,
+ contentWidth: state => state.app.contentWidth,
+ autoHideHeader: state => state.app.autoHideHeader,
+ sidebarOpened: state => state.app.sidebar.opened
+ })
+ }
+}
+
+const mixinDevice = {
+ computed: {
+ ...mapState({
+ device: state => state.app.device,
+ })
+ },
+ methods: {
+ isMobile () {
+ return this.device === 'mobile'
+ },
+ isDesktop () {
+ return this.device === 'desktop'
+ },
+ wrapClassNameInfo () {
+ if(this.device === 'desktop') {
+ return 'ant-modal-cust-warp depot-mask'
+ } else {
+ return 'ant-modal-cust-warp'
+ }
+ }
+ }
+}
+
+export { mixin, mixinDevice }
\ No newline at end of file
diff --git a/src/utils/permissions.js b/src/utils/permissions.js
new file mode 100644
index 0000000..e4b60bc
--- /dev/null
+++ b/src/utils/permissions.js
@@ -0,0 +1,8 @@
+export function actionToObject(json) {
+ try {
+ return JSON.parse(json)
+ } catch (e) {
+ console.log('err', e.message)
+ }
+ return []
+}
\ No newline at end of file
diff --git a/src/utils/props-util.js b/src/utils/props-util.js
new file mode 100644
index 0000000..9c94200
--- /dev/null
+++ b/src/utils/props-util.js
@@ -0,0 +1,115 @@
+/**
+ * 该文件截取自 "ant-design-vue/es/_util/props-util.js" 文件,并对其做出特殊修改
+ */
+function classNames() {
+ let classes = []
+
+ for (let i = 0; i < arguments.length; i++) {
+ let arg = arguments[i]
+ if (!arg) continue
+
+ let argType = typeof arg
+
+ if (argType === 'string' || argType === 'number') {
+ classes.push(arg)
+ } else if (Array.isArray(arg) && arg.length) {
+ let inner = classNames.apply(null, arg)
+ if (inner) {
+ classes.push(inner)
+ }
+ } else if (argType === 'object') {
+ for (let key in arg) {
+ if (arg.hasOwnProperty(key) && arg[key]) {
+ classes.push(key)
+ }
+ }
+ }
+ }
+ return classes.join(' ')
+}
+
+const camelizeRE = /-(\w)/g
+
+function camelize(str) {
+ return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''))
+}
+
+
+function objectCamelize(obj) {
+ let res = {}
+ Object.keys(obj).forEach(k => (res[camelize(k)] = obj[k]))
+ return res
+}
+
+function parseStyleText(cssText = '', camel) {
+ const res = {}
+ const listDelimiter = /;(?![^(]*\))/g
+ const propertyDelimiter = /:(.+)/
+ cssText.split(listDelimiter).forEach(function (item) {
+ if (item) {
+ const tmp = item.split(propertyDelimiter)
+ if (tmp.length > 1) {
+ const k = camel ? camelize(tmp[0].trim()) : tmp[0].trim()
+ res[k] = tmp[1].trim()
+ }
+ }
+ })
+ return res
+}
+
+export function getClass(ele) {
+ let data = {}
+ if (ele.data) {
+ data = ele.data
+ } else if (ele.$vnode && ele.$vnode.data) {
+ data = ele.$vnode.data
+ }
+ const tempCls = data.class || {}
+ const staticClass = data.staticClass
+ let cls = {}
+ staticClass &&
+ staticClass.split(' ').forEach(c => {
+ cls[c.trim()] = true
+ })
+ if (typeof tempCls === 'string') {
+ tempCls.split(' ').forEach(c => {
+ cls[c.trim()] = true
+ })
+ } else if (Array.isArray(tempCls)) {
+ classNames(tempCls)
+ .split(' ')
+ .forEach(c => {
+ cls[c.trim()] = true
+ })
+ } else {
+ cls = { ...cls, ...tempCls }
+ }
+ return cls
+}
+
+export function getStyle(ele, camel) {
+
+ getClass(ele)
+
+ let data = {}
+ if (ele.data) {
+ data = ele.data
+ } else if (ele.$vnode && ele.$vnode.data) {
+ data = ele.$vnode.data
+ }
+
+ // update-begin-author:sunjianlei date:20200303 for: style 和 staticStyle 可以共存
+ let style = data.style || {}
+ let staticStyle = data.staticStyle
+ staticStyle = staticStyle ? objectCamelize(data.staticStyle) : {}
+ // update-end-author:sunjianlei date:20200303 for: style 和 staticStyle 可以共存
+
+ if (typeof style === 'string') {
+ style = parseStyleText(style, camel)
+ } else if (camel && style) {
+ // 驼峰化
+ style = objectCamelize(style)
+ }
+ return { ...staticStyle, ...style }
+}
+
diff --git a/src/utils/request.js b/src/utils/request.js
new file mode 100644
index 0000000..b0dbc91
--- /dev/null
+++ b/src/utils/request.js
@@ -0,0 +1,98 @@
+import Vue from 'vue'
+import axios from 'axios'
+import store from '@/store'
+import { VueAxios } from './axios'
+import {Modal, notification} from 'ant-design-vue'
+import { ACCESS_TOKEN } from "@/store/mutation-types"
+
+/**
+ * 【指定 axios的 baseURL】
+ * 如果手工指定 baseURL: '/jshERP-boot'
+ * 则映射后端域名,通过 vue.config.js
+ * @type {*|string}
+ */
+let apiBaseUrl = window._CONFIG['domianURL'] || "/jshERP-boot";
+//console.log("apiBaseUrl= ",apiBaseUrl)
+// 创建 axios 实例
+const service = axios.create({
+ baseURL: apiBaseUrl, // api base_url
+ timeout: 300000 // 请求超时时间
+})
+
+const err = (error) => {
+ if (error.response) {
+ let data = error.response.data
+ const token = Vue.ls.get(ACCESS_TOKEN)
+ switch (error.response.status) {
+ case 403:
+ notification.error({ message: '系统提示', description: '拒绝访问',duration: 4})
+ break
+ case 500:
+ if(token && data==="loginOut"){
+ Modal.error({
+ title: '登录已过期',
+ content: '很抱歉,登录已过期,请重新登录',
+ okText: '重新登录',
+ mask: false,
+ onOk: () => {
+ Vue.ls.remove(ACCESS_TOKEN)
+ window.location.reload()
+ }
+ })
+ }
+ break
+ case 404:
+ notification.error({ message: '系统提示', description:'很抱歉,资源未找到!',duration: 4})
+ break
+ case 504:
+ notification.error({ message: '系统提示', description: '网络超时'})
+ break
+ case 401:
+ notification.error({ message: '系统提示', description:'未授权,请重新登录',duration: 4})
+ if (token) {
+ store.dispatch('Logout').then(() => {
+ setTimeout(() => {
+ window.location.reload()
+ }, 1500)
+ })
+ }
+ break
+ default:
+ notification.error({
+ message: '系统提示',
+ description: data.message,
+ duration: 4
+ })
+ break
+ }
+ }
+ return Promise.reject(error)
+};
+
+// request interceptor
+service.interceptors.request.use(config => {
+ const token = Vue.ls.get(ACCESS_TOKEN)
+ if (token) {
+ config.headers[ 'X-Access-Token' ] = token // 让每个请求携带自定义 token 请根据实际情况自行修改
+ }
+ return config
+},(error) => {
+ return Promise.reject(error)
+})
+
+// response interceptor
+service.interceptors.response.use((response) => {
+ return response.data
+ }, err)
+
+const installer = {
+ vm: {},
+ install (Vue, router = {}) {
+ Vue.use(VueAxios, router, service)
+ }
+}
+
+export {
+ installer as VueAxios,
+ service as axios
+}
\ No newline at end of file
diff --git a/src/utils/storage.js b/src/utils/storage.js
new file mode 100644
index 0000000..b3c29ab
--- /dev/null
+++ b/src/utils/storage.js
@@ -0,0 +1,78 @@
+/**
+ * Set storage
+ *
+ * @param name
+ * @param content
+ * @param maxAge
+ */
+export const setStore = (name, content, maxAge = null) => {
+ if (!global.window || !name) {
+ return;
+ }
+
+ if (typeof content !== 'string') {
+ content = JSON.stringify(content)
+ }
+
+ let storage = global.window.localStorage
+
+ storage.setItem(name, content)
+ if (maxAge && !isNaN(parseInt(maxAge))) {
+ let timeout = parseInt(new Date().getTime() / 1000)
+ storage.setItem(`${name}_expire`, timeout + maxAge)
+ }
+};
+
+/**
+ * Get storage
+ *
+ * @param name
+ * @returns {*}
+ */
+export const getStore = name => {
+ if (!global.window || !name) {
+ return;
+ }
+
+ let content = window.localStorage.getItem(name)
+ let _expire = window.localStorage.getItem(`${name}_expire`)
+
+ if (_expire) {
+ let now = parseInt(new Date().getTime() / 1000)
+ if (now > _expire) {
+ return;
+ }
+ }
+
+ try {
+ return JSON.parse(content)
+ } catch (e) {
+ return content
+ }
+};
+
+/**
+ * Clear storage
+ *
+ * @param name
+ */
+export const clearStore = name => {
+ if (!global.window || !name) {
+ return;
+ }
+
+ window.localStorage.removeItem(name)
+ window.localStorage.removeItem(`${name}_expire`)
+};
+
+/**
+ * Clear all storage
+ */
+export const clearAll = () => {
+ if (!global.window || !name) {
+ return;
+ }
+
+ window.localStorage.clear()
+}
+
diff --git a/src/utils/util.js b/src/utils/util.js
new file mode 100644
index 0000000..1306f46
--- /dev/null
+++ b/src/utils/util.js
@@ -0,0 +1,733 @@
+import { isURL } from '@/utils/validate'
+import { downFilePost} from '@/api/manage'
+import Vue from 'vue'
+import introJs from 'intro.js'
+
+export function timeFix() {
+ const time = new Date()
+ const hour = time.getHours()
+ return hour < 9 ? '早上好' : (hour <= 11 ? '上午好' : (hour <= 13 ? '中午好' : (hour < 20 ? '下午好' : '晚上好')))
+}
+
+export function welcome() {
+ const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了']
+ let index = Math.floor((Math.random()*arr.length))
+ return arr[index]
+}
+
+/**
+ * 触发 window.resize
+ */
+export function triggerWindowResizeEvent() {
+ let event = document.createEvent('HTMLEvents')
+ event.initEvent('resize', true, true)
+ event.eventType = 'message'
+ window.dispatchEvent(event)
+}
+
+/**
+ * 过滤对象中为空的属性
+ * @param obj
+ * @returns {*}
+ */
+export function filterObj(obj) {
+ if (!(typeof obj == 'object')) {
+ return;
+ }
+
+ for ( let key in obj) {
+ if (obj.hasOwnProperty(key)
+ && (obj[key] == null || obj[key] == undefined || obj[key] === '')) {
+ delete obj[key];
+ }
+ }
+ return obj;
+}
+
+/**
+ * 时间格式化
+ * @param value
+ * @param fmt
+ * @returns {*}
+ */
+export function formatDate(value, fmt) {
+ let regPos = /^\d+(\.\d+)?$/;
+ if(regPos.test(value)){
+ //如果是数字
+ let getDate = new Date(value);
+ let o = {
+ 'M+': getDate.getMonth() + 1,
+ 'd+': getDate.getDate(),
+ 'h+': getDate.getHours(),
+ 'm+': getDate.getMinutes(),
+ 's+': getDate.getSeconds(),
+ 'q+': Math.floor((getDate.getMonth() + 3) / 3),
+ 'S': getDate.getMilliseconds()
+ };
+ if (/(y+)/.test(fmt)) {
+ fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
+ }
+ for (let k in o) {
+ if (new RegExp('(' + k + ')').test(fmt)) {
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
+ }
+ }
+ return fmt;
+ }else{
+ //TODO
+ value = value.trim();
+ return value.substr(0,fmt.length);
+ }
+}
+
+// 生成首页路由
+export function generateIndexRouter(data) {
+ let indexRouter = generateChildRouters(data)
+ indexRouter.splice(0,0, {
+ path: '/',
+ name: '首页',
+ component: () => import('@/components/layouts/TabLayout'),
+ meta: {
+ title: '首页',
+ icon: 'icon-present',
+ url: '/dashboard/analysis'
+ },
+ redirect: '/dashboard/analysis'
+ })
+ return indexRouter;
+}
+
+// 生成嵌套路由(子路由)
+
+function generateChildRouters (data) {
+ const routers = [];
+ for (let item of data) {
+ let componentPath = "";
+ item.route = "1";
+ if(item.component.indexOf("layouts")>=0){
+ componentPath = () => import('@/components'+item.component);
+ } else {
+ componentPath = () => import('@/views'+item.component);
+ }
+ // eslint-disable-next-line
+ let URL = (item.url|| '').replace(/{{([^}}]+)?}}/g, (s1, s2) => eval(s2)) // URL支持{{ window.xxx }}占位符变量
+ if (isURL(URL)) {
+ item.url = URL;
+ }
+ let componentName =''
+ if(item.component) {
+ let index = item.component.lastIndexOf("\/");
+ componentName = item.component.substring(index + 1, item.component.length);
+ }
+ let menu = {
+ path: item.url,
+ name: item.text,
+ meta: {
+ id: item.id,
+ title: item.text,
+ icon: item.icon,
+ url: item.url,
+ componentName:componentName,
+ internalOrExternal:true,
+ keepAlive: true
+ }
+ }
+ if(item.component.indexOf("IframePageView")>-1){
+ //给带iframe的页面进行改造
+ menu.iframeComponent = componentPath
+ } else {
+ menu.component = componentPath
+ }
+ if (item.children && item.children.length > 0) {
+ menu.children = [...generateChildRouters( item.children)];
+ }
+ //--update-begin----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
+ //判断是否生成路由
+ if(item.route && item.route === '0'){
+ //console.log(' 不生成路由 item.route: '+item.route);
+ //console.log(' 不生成路由 item.path: '+item.path);
+ }else{
+ routers.push(menu);
+ }
+ //--update-end----author:scott---date:20190320------for:根据后台菜单配置,判断是否路由菜单字段,动态选择是否生成路由(为了支持参数URL菜单)------
+ }
+ return routers
+}
+
+/**
+ * 深度克隆对象、数组
+ * @param obj 被克隆的对象
+ * @return 克隆后的对象
+ */
+export function cloneObject(obj) {
+ return JSON.parse(JSON.stringify(obj))
+}
+
+/**
+ * 随机生成数字
+ *
+ * 示例:生成长度为 12 的随机数:randomNumber(12)
+ * 示例:生成 3~23 之间的随机数:randomNumber(3, 23)
+ *
+ * @param1 最小值 | 长度
+ * @param2 最大值
+ * @return int 生成后的数字
+ */
+export function randomNumber() {
+ // 生成 最小值 到 最大值 区间的随机数
+ const random = (min, max) => {
+ return Math.floor(Math.random() * (max - min + 1) + min)
+ }
+ if (arguments.length === 1) {
+ let [length] = arguments
+ // 生成指定长度的随机数字,首位一定不是 0
+ let nums = [...Array(length).keys()].map((i) => (i > 0 ? random(0, 9) : random(1, 9)))
+ return parseInt(nums.join(''))
+ } else if (arguments.length >= 2) {
+ let [min, max] = arguments
+ return random(min, max)
+ } else {
+ return Number.NaN
+ }
+}
+
+/**
+ * 随机生成字符串
+ * @param length 字符串的长度
+ * @param chats 可选字符串区间(只会生成传入的字符串中的字符)
+ * @return string 生成的字符串
+ */
+export function randomString(length, chats) {
+ if (!length) length = 1
+ if (!chats) chats = '0123456789qwertyuioplkjhgfdsazxcvbnm'
+ let str = ''
+ for (let i = 0; i < length; i++) {
+ let num = randomNumber(0, chats.length - 1)
+ str += chats[num]
+ }
+ return str
+}
+
+/**
+ * 随机生成uuid
+ * @return string 生成的uuid
+ */
+export function randomUUID() {
+ let chats = '0123456789abcdef'
+ return randomString(32, chats)
+}
+
+/**
+ * 下划线转驼峰
+ * @param string
+ * @returns {*}
+ */
+export function underLine2CamelCase(string){
+ return string.replace( /_([a-z])/g, function( all, letter ) {
+ return letter.toUpperCase();
+ });
+}
+
+/**
+ * 判断是否显示办理按钮
+ * @param bpmStatus
+ * @returns {*}
+ */
+export function showDealBtn(bpmStatus){
+ if(bpmStatus!="1"&&bpmStatus!="3"&&bpmStatus!="4"){
+ return true;
+ }
+ return false;
+}
+
+/**
+ * 增强CSS,可以在页面上输出全局css
+ * @param css 要增强的css
+ * @param id style标签的id,可以用来清除旧样式
+ */
+export function cssExpand(css, id) {
+ let style = document.createElement('style')
+ style.type = "text/css"
+ style.innerHTML = `@charset "UTF-8"; ${css}`
+ // 清除旧样式
+ if (id) {
+ let $style = document.getElementById(id)
+ if ($style != null) $style.outerHTML = ''
+ style.id = id
+ }
+ // 应用新样式
+ document.head.appendChild(style)
+}
+
+
+/** 用于js增强事件,运行JS代码,可以传参 */
+// options 所需参数:
+// 参数名 类型 说明
+// vm VueComponent vue实例
+// event Object event对象
+// jsCode String 待执行的js代码
+// errorMessage String 执行出错后的提示(控制台)
+export function jsExpand(options = {}) {
+
+ // 绑定到window上的keyName
+ let windowKeyName = 'J_CLICK_EVENT_OPTIONS'
+ if (typeof window[windowKeyName] != 'object') {
+ window[windowKeyName] = {}
+ }
+
+ // 随机生成JS增强的执行id,防止冲突
+ let id = randomString(16, 'qwertyuioplkjhgfdsazxcvbnm'.toUpperCase())
+ // 封装按钮点击事件
+ let code = `
+ (function (o_${id}) {
+ try {
+ (function (globalEvent, vm) {
+ ${options.jsCode}
+ })(o_${id}.event, o_${id}.vm)
+ } catch (e) {
+ o_${id}.error(e)
+ }
+ o_${id}.done()
+ })(window['${windowKeyName}']['EVENT_${id}'])
+ `
+ // 创建script标签
+ const script = document.createElement('script')
+ // 将需要传递的参数挂载到window对象上
+ window[windowKeyName]['EVENT_' + id] = {
+ vm: options.vm,
+ event: options.event,
+ // 当执行完成时,无论如何都会调用的回调事件
+ done() {
+ // 执行完后删除新增的 script 标签不会撤销执行结果(已产生的结果不会被撤销)
+ script.outerHTML = ''
+ delete window[windowKeyName]['EVENT_' + id]
+ },
+ // 当js运行出错的时候调用的事件
+ error(e) {
+ console.group(`${options.errorMessage || '用户自定义JS增强代码运行出错'}(${new Date()})`)
+ console.error(e)
+ console.groupEnd()
+ }
+ }
+ // 将事件挂载到document中
+ script.innerHTML = code
+ document.body.appendChild(script)
+}
+
+/**
+ * 如果值不存在就 push 进数组,反之不处理
+ * @param array 要操作的数据
+ * @param value 要添加的值
+ * @param key 可空,如果比较的是对象,可能存在地址不一样但值实际上是一样的情况,可以传此字段判断对象中唯一的字段,例如 id。不传则直接比较实际值
+ * @returns {boolean} 成功 push 返回 true,不处理返回 false
+ */
+export function pushIfNotExist(array, value, key) {
+ for (let item of array) {
+ if (key && (item[key] === value[key])) {
+ return false
+ } else if (item === value) {
+ return false
+ }
+ }
+ array.push(value)
+ return true
+}
+
+/**
+ * 可用于判断是否成功
+ * @type {symbol}
+ */
+export const succeedSymbol = Symbol()
+/**
+ * 可用于判断是否失败
+ * @type {symbol}
+ */
+export const failedSymbol = Symbol()
+
+/**
+ * 使 promise 无论如何都会 resolve,除非传入的参数不是一个Promise对象或返回Promise对象的方法
+ * 一般用在 Promise.all 中
+ *
+ * @param promise 可传Promise对象或返回Promise对象的方法
+ * @returns {Promise}
+ */
+export function alwaysResolve(promise) {
+ return new Promise((resolve, reject) => {
+ let p = promise
+ if (typeof promise === 'function') {
+ p = promise()
+ }
+ if (p instanceof Promise) {
+ p.then(data => {
+ resolve({ type: succeedSymbol, data })
+ }).catch(error => {
+ resolve({ type: failedSymbol, error })
+ })
+ } else {
+ reject('alwaysResolve: 传入的参数不是一个Promise对象或返回Promise对象的方法')
+ }
+ })
+}
+
+/**
+ * 简单实现防抖方法
+ *
+ * 防抖(debounce)函数在第一次触发给定的函数时,不立即执行函数,而是给出一个期限值(delay),比如100ms。
+ * 如果100ms内再次执行函数,就重新开始计时,直到计时结束后再真正执行函数。
+ * 这样做的好处是如果短时间内大量触发同一事件,只会执行一次函数。
+ *
+ * @param fn 要防抖的函数
+ * @param delay 防抖的毫秒数
+ * @returns {Function}
+ */
+export function simpleDebounce(fn, delay = 100) {
+ let timer = null
+ return function () {
+ let args = arguments
+ if (timer) {
+ clearTimeout(timer)
+ }
+ timer = setTimeout(() => {
+ fn.apply(null, args)
+ }, delay)
+ }
+}
+
+/**
+ * 不用正则的方式替换所有值
+ * @param text 被替换的字符串
+ * @param checker 替换前的内容
+ * @param replacer 替换后的内容
+ * @returns {String} 替换后的字符串
+ */
+export function replaceAll(text, checker, replacer) {
+ let lastText = text
+ text = text.replace(checker, replacer)
+ if (lastText !== text) {
+ return replaceAll(text, checker, replacer)
+ }
+ return text
+}
+
+/**
+ * 转换商品扩展字段的格式
+ * @param thisRows
+ * @param checker
+ * @param replacer
+ * @returns {string}
+ */
+export function getMpListShort(thisRows, checker, replacer) {
+ let mPropertyListShort = ''
+ let anotherNameStr = ''
+ for (let i = 0; i < thisRows.length; i++) {
+ anotherNameStr += thisRows[i].anotherName + ",";
+ }
+ if (anotherNameStr) {
+ mPropertyListShort = anotherNameStr.substring(0, anotherNameStr.length - 1);
+ }
+ return mPropertyListShort
+}
+
+/**
+ * js获取当前年份, 格式“yyyy”
+ */
+export function getNowFormatYear() {
+ let date = new Date();
+ return date.getFullYear();
+}
+
+/**
+ * js获取当前月份, 格式“yyyy-MM”
+ */
+export function getNowFormatMonth() {
+ let date = new Date();
+ let seperator1 = "-";
+ let month = date.getMonth() + 1;
+ if (month >= 1 && month <= 9) {
+ month = "0" + month;
+ }
+ return date.getFullYear() + seperator1 + month;
+}
+
+/**
+ * js获取当前日期, 格式“yyyy-MM-dd”
+ */
+export function getFormatDate() {
+ let date = new Date();
+ let seperator1 = "-";
+ let year = date.getFullYear();
+ let month = date.getMonth() + 1;
+ let strDate = date.getDate();
+ if (month >= 1 && month <= 9) {
+ month = "0" + month;
+ }
+ if (strDate >= 0 && strDate <= 9) {
+ strDate = "0" + strDate;
+ }
+ return year + seperator1 + month + seperator1 + strDate;
+}
+
+/**
+ * js获取当前时间, 格式“yyyy-MM-dd HH:MM:SS”
+ */
+export function getNowFormatDateTime() {
+ let date = new Date();
+ let seperator1 = "-";
+ let seperator2 = ":";
+ let month = date.getMonth() + 1;
+ let strDate = date.getDate();
+ let strHours = date.getHours();
+ let strMinutes = date.getMinutes();
+ let strSeconds = date.getSeconds();
+ if (month >= 1 && month <= 9) {
+ month = "0" + month;
+ }
+ if (strDate >= 0 && strDate <= 9) {
+ strDate = "0" + strDate;
+ }
+ if (strHours >= 0 && strHours <= 9) {
+ strHours = "0" + strHours;
+ }
+ if (strMinutes >= 0 && strMinutes <= 9) {
+ strMinutes = "0" + strMinutes;
+ }
+ if (strSeconds >= 0 && strSeconds <= 9) {
+ strSeconds = "0" + strSeconds;
+ }
+ return date.getFullYear() + seperator1 + month + seperator1 + strDate
+ + " " + strHours + seperator2 + strMinutes
+ + seperator2 + strSeconds;
+}
+
+/**
+ * js获取当前时间, 格式“yyyyMMddHHMMSS”
+ */
+export function getNowFormatStr() {
+ let date = new Date();
+ let year = date.getFullYear();
+ let month = date.getMonth() + 1;
+ let strDate = date.getDate();
+ let strHours = date.getHours();
+ let strMinutes = date.getMinutes();
+ let strSeconds = date.getSeconds();
+ if (month >= 1 && month <= 9) {
+ month = "0" + month;
+ }
+ if (strDate >= 0 && strDate <= 9) {
+ strDate = "0" + strDate;
+ }
+ if (strHours >= 0 && strHours <= 9) {
+ strHours = "0" + strHours;
+ }
+ if (strMinutes >= 0 && strMinutes <= 9) {
+ strMinutes = "0" + strMinutes;
+ }
+ if (strSeconds >= 0 && strSeconds <= 9) {
+ strSeconds = "0" + strSeconds;
+ }
+ return year +''+ month +''+ strDate +''+ strHours +''+ strMinutes +''+ strSeconds;
+}
+
+/**
+ * js获取N天前的日期, 格式“yyyy-MM-dd”
+ */
+export function getBeforeFormatDate(day) {
+ let currentDate = new Date();
+ let thirtyDaysAgo = new Date(currentDate.getTime() - day * 24 * 60 * 60 * 1000);
+ let seperator1 = "-";
+ let month = thirtyDaysAgo.getMonth() + 1;
+ let strDate = thirtyDaysAgo.getDate();
+ if (month >= 1 && month <= 9) {
+ month = "0" + month;
+ }
+ if (strDate >= 0 && strDate <= 9) {
+ strDate = "0" + strDate;
+ }
+ return thirtyDaysAgo.getFullYear() + seperator1 + month + seperator1 + strDate
+}
+
+/**
+ * js获取N月前的日期, 格式“yyyy-MM-dd”
+ */
+export function getPrevMonthFormatDate(monthNum) {
+ let prevMonth = new Date(); // 当前日期
+ prevMonth.setMonth(prevMonth.getMonth() - monthNum); // 设置为前一个月
+ let seperator1 = "-";
+ let month = prevMonth.getMonth() + 1;
+ let strDate = prevMonth.getDate();
+ if (month >= 1 && month <= 9) {
+ month = "0" + month;
+ }
+ if (strDate >= 0 && strDate <= 9) {
+ strDate = "0" + strDate;
+ }
+ return prevMonth.getFullYear() + seperator1 + month + seperator1 + strDate
+}
+
+/**
+ * 自定义大数加法函数,两个数字相加
+ * @param a
+ * @param b
+ * @returns {string}
+ */
+export function addBigNumbers(a, b) {
+ a = a.toString();
+ b = b.toString();
+ // 反转字符串,从个位开始计算
+ let aRev = a.split('').reverse();
+ let bRev = b.split('').reverse();
+ const maxLength = Math.max(aRev.length, bRev.length);
+ let result = [];
+ let carry = 0;
+ for (let i = 0; i < maxLength; i++) {
+ const digitA = i < aRev.length ? parseInt(aRev[i]) : 0;
+ const digitB = i < bRev.length ? parseInt(bRev[i]) : 0;
+ const sum = digitA + digitB + carry;
+ result.push(sum % 10);
+ carry = Math.floor(sum / 10);
+ }
+ // 处理最后的进位
+ if (carry > 0) {
+ result.push(carry);
+ }
+ // 反转回来得到正确的结果
+ return result.reverse().join('');
+}
+
+/**
+ * JS中根据指定值删除数组中的元素
+ * @param arrylist
+ * @param val
+ */
+export function removeByVal(arrylist, val) {
+ for(var i = 0; i < arrylist .length; i++) {
+ if(arrylist [i] == val) {
+ arrylist .splice(i, 1);
+ break;
+ }
+ }
+}
+
+export function getCheckFlag(multiBillType, multiLevelApprovalFlag, prefixNo) {
+ if(multiLevelApprovalFlag==='1') {
+ //开启
+ if(multiBillType) {
+ let multiBillTypeArr = multiBillType.split(',')
+ return multiBillTypeArr.indexOf(prefixNo) <= -1
+ } else {
+ return true
+ }
+ } else {
+ //关闭
+ return true
+ }
+}
+
+/**
+ * 将字符串中单个金额中的数值转为负数
+ * @param str
+ * @returns {Array}
+ */
+export function changeListFmtMinus(str) {
+ let newArr = new Array()
+ if(str) {
+ let arr = []
+ if(str.indexOf(',')>-1) {
+ arr = str.split(',')
+ } else {
+ arr = str
+ }
+ for(let i=0; i{
+ if (!data) {
+ this.$message.warning("文件下载失败")
+ return
+ }
+ if (typeof window.navigator.msSaveBlob !== 'undefined') {
+ window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls')
+ }else{
+ let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
+ let link = document.createElement('a')
+ link.style.display = 'none'
+ link.href = url
+ link.setAttribute('download', fileName + '_' + getNowFormatStr()+'.xls')
+ document.body.appendChild(link)
+ link.click()
+ document.body.removeChild(link); //下载完成移除元素
+ window.URL.revokeObjectURL(url); //释放掉blob对象
+ }
+ })
+}
+
+/**
+ * 新手引导步骤
+ * @param module 这个变量可以用来存取版本号, 系统更新时候改变相应值
+ * @param cur_version 这个变量可以用来存取版本号, 系统更新时候改变相应值
+ */
+export function handleIntroJs(module, cur_version) {
+ //每个页面设置不同的缓存变量名称,不可以重复,有新版本时,更新cur_version
+ //有新版本更新时才出现一次引导页, 第二次进入进不再出现, 这里有缓存来判断
+ let introJsObj = introJs()
+ if(module !== 'indexChart') {
+ let idElement = '#' + module
+ introJsObj = introJs(idElement)
+ }
+ if (Vue.ls.get('intro_cache_' + module) === cur_version) {
+ return;
+ }
+ introJsObj.setOptions({
+ prevLabel: '← 上一步',
+ nextLabel: '下一步 →',
+ doneLabel: '知道了',
+ exitOnOverlayClick: false //点击空白区域是否关闭提示组件
+ }).oncomplete(function(){
+ //点击跳过按钮后执行的事件(这里保存对应的版本号到缓存,并且设置有效期为100天)
+ Vue.ls.set('intro_cache_' + module, cur_version, 100 * 24 * 60 * 60 * 1000);
+ }).onexit(function(){
+ //点击结束按钮后, 执行的事件
+ Vue.ls.set('intro_cache_' + module, cur_version, 100 * 24 * 60 * 60 * 1000);
+ }).start()
+}
+
+/**
+ * 回车后自动跳到下一个input
+ */
+export function autoJumpNextInput(domInfo) {
+ let domIndex = 0
+ let inputs = document.getElementById(domInfo).getElementsByTagName('input')
+ inputs[domIndex].focus()
+ document.getElementById(domInfo).addEventListener('keydown',function(e){
+ if(e.keyCode === 13){
+ domIndex++
+ if(domIndex === inputs.length) {
+ domIndex = 0
+ }
+ inputs[domIndex].focus()
+ }
+ })
+ for(let i=0; i
+
+ 404 page
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/AllocationOutList.vue b/src/views/bill/AllocationOutList.vue
new file mode 100644
index 0000000..9c270af
--- /dev/null
+++ b/src/views/bill/AllocationOutList.vue
@@ -0,0 +1,254 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/AssembleList.vue b/src/views/bill/AssembleList.vue
new file mode 100644
index 0000000..65999ef
--- /dev/null
+++ b/src/views/bill/AssembleList.vue
@@ -0,0 +1,254 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/DisassembleList.vue b/src/views/bill/DisassembleList.vue
new file mode 100644
index 0000000..f3a474a
--- /dev/null
+++ b/src/views/bill/DisassembleList.vue
@@ -0,0 +1,254 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/OtherInList.vue b/src/views/bill/OtherInList.vue
new file mode 100644
index 0000000..43793d0
--- /dev/null
+++ b/src/views/bill/OtherInList.vue
@@ -0,0 +1,367 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
待入库({{waitTotal}})
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/OtherOutList.vue b/src/views/bill/OtherOutList.vue
new file mode 100644
index 0000000..b8a60e3
--- /dev/null
+++ b/src/views/bill/OtherOutList.vue
@@ -0,0 +1,367 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
待出库({{waitTotal}})
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/PurchaseApplyList.vue b/src/views/bill/PurchaseApplyList.vue
new file mode 100644
index 0000000..8405e24
--- /dev/null
+++ b/src/views/bill/PurchaseApplyList.vue
@@ -0,0 +1,257 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+ 部分采购
+ 完成采购
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
转采购订单
+
+ 强制结单
+
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 完成采购
+ 部分采购
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/PurchaseBackList.vue b/src/views/bill/PurchaseBackList.vue
new file mode 100644
index 0000000..e15dd02
--- /dev/null
+++ b/src/views/bill/PurchaseBackList.vue
@@ -0,0 +1,330 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+ 部分出库
+ 完成出库
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
+ 强制结单
+
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 完成出库
+ 部分出库
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/PurchaseInList.vue b/src/views/bill/PurchaseInList.vue
new file mode 100644
index 0000000..633894e
--- /dev/null
+++ b/src/views/bill/PurchaseInList.vue
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 有欠款
+ 无欠款
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+ 部分入库
+ 完成入库
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
转采购退货
+
+ 强制结单
+
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+
+ {{value}}
+
+
+ {{value}}
+
+ {{value}}
+
+
+ 未审核
+ 已审核
+ 完成入库
+ 部分入库
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/PurchaseOrderList.vue b/src/views/bill/PurchaseOrderList.vue
new file mode 100644
index 0000000..1a245a0
--- /dev/null
+++ b/src/views/bill/PurchaseOrderList.vue
@@ -0,0 +1,335 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+ 部分采购
+ 完成采购
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
转采购入库
+
+ 强制结单
+
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 完成采购
+ 部分采购
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/RetailBackList.vue b/src/views/bill/RetailBackList.vue
new file mode 100644
index 0000000..1aa7343
--- /dev/null
+++ b/src/views/bill/RetailBackList.vue
@@ -0,0 +1,310 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initRetail(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/RetailOutList.vue b/src/views/bill/RetailOutList.vue
new file mode 100644
index 0000000..ce599bc
--- /dev/null
+++ b/src/views/bill/RetailOutList.vue
@@ -0,0 +1,310 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initRetail(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
转零售退货
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/SaleBackList.vue b/src/views/bill/SaleBackList.vue
new file mode 100644
index 0000000..1faf715
--- /dev/null
+++ b/src/views/bill/SaleBackList.vue
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+ 部分入库
+ 完成入库
+
+
+
+
+
+
+
+ {{ item.text }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
+ 强制结单
+
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 完成入库
+ 部分入库
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/SaleOrderList.vue b/src/views/bill/SaleOrderList.vue
new file mode 100644
index 0000000..c190202
--- /dev/null
+++ b/src/views/bill/SaleOrderList.vue
@@ -0,0 +1,378 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+ 部分销售
+ 完成销售
+
+
+
+
+
+
+
+ {{ item.text }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
转销售出库
+
转采购订单-以销定购
+
+ 强制结单
+
+
+ 强制结单-以销定购
+
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 完成销售
+ 部分销售
+ 审核中
+
+
+ 未采购
+ 完成采购
+ 部分采购
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/SaleOutList.vue b/src/views/bill/SaleOutList.vue
new file mode 100644
index 0000000..6fefea2
--- /dev/null
+++ b/src/views/bill/SaleOutList.vue
@@ -0,0 +1,373 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 有欠款
+ 无欠款
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+ 部分出库
+ 完成出库
+
+
+
+
+
+
+
+ {{ item.text }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
转销售退货
+
+ 强制结单
+
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ 复制
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+
+ {{value}}
+
+
+ {{value}}
+
+ {{value}}
+
+
+ 未审核
+ 已审核
+ 完成出库
+ 部分出库
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/BatchSetDepot.vue b/src/views/bill/dialog/BatchSetDepot.vue
new file mode 100644
index 0000000..f638978
--- /dev/null
+++ b/src/views/bill/dialog/BatchSetDepot.vue
@@ -0,0 +1,120 @@
+
+
+
+
+
+ 关闭
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/BatchWaitBillList.vue b/src/views/bill/dialog/BatchWaitBillList.vue
new file mode 100644
index 0000000..d941c6d
--- /dev/null
+++ b/src/views/bill/dialog/BatchWaitBillList.vue
@@ -0,0 +1,233 @@
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
批量{{queryParam.type}}
+
注意:含有序列号、批号商品或部分入库状态不能批量{{queryParam.type}},需要到新增界面关联单据
+
+
+
+
+ {{record.number}}
+ {{record.number}}
+
+
+
+ 已审核
+ 部分入库
+ 部分出库
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/BillDetail.vue b/src/views/bill/dialog/BillDetail.vue
new file mode 100644
index 0000000..541903f
--- /dev/null
+++ b/src/views/bill/dialog/BillDetail.vue
@@ -0,0 +1,2123 @@
+
+
+
+
+ 取消(ESC)
+
+ 三联打印-新版
+ 三联打印
+
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+ 普通打印
+
+
+ 导出
+ 导出
+ 导出
+ 导出
+ 导出
+ 导出
+ 导出
+ 导出
+
+ 反审核
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.payType}}
+
+
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+ {{model.getAmount}}
+
+
+
+
+ {{model.backAmount}}
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+
+ {{item.number}}
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+ {{model.getAmount}}
+
+
+
+
+ {{model.backAmount}}
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkApply}}
+
+
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.discount}}%
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.discountLastMoney}}
+
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.discount}}%
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.discountLastMoney}}
+
+
+
+
+ {{model.otherMoney}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.deposit}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+ {{model.debt}}
+
+
+
+
+
+ {{item.number}}
+
+
+
+
+
+
+
+
+ {{item.billNo}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.discount}}%
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.discountLastMoney}}
+
+
+
+
+ {{model.otherMoney}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+ {{model.debt}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.salesManStr}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.discount}}%
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.discountLastMoney}}
+
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.discount}}%
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.discountLastMoney}}
+
+
+
+
+ {{model.otherMoney}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.deposit}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+ {{model.debt}}
+
+
+
+
+
+ {{item.number}}
+
+
+
+
+
+
+
+ {{model.salesManStr}}
+
+
+
+
+
+ {{item.billNo}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.discount}}%
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.discountLastMoney}}
+
+
+
+
+ {{model.otherMoney}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+ {{model.debt}}
+
+
+
+
+ {{model.salesManStr}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}} {{model.billType}}
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}} {{model.billType}}
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+ {{model.operTimeStr}}
+
+
+
+
+ {{model.number}}
+
+
+
+
+ {{model.linkNumber}}
+
+
+
+
+
+
+
+ {{record.barCode}}
+
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/BillPrintIframe.vue b/src/views/bill/dialog/BillPrintIframe.vue
new file mode 100644
index 0000000..bdece39
--- /dev/null
+++ b/src/views/bill/dialog/BillPrintIframe.vue
@@ -0,0 +1,83 @@
+
+
+
+
+ 取消(ESC)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/BillPrintProIframe.vue b/src/views/bill/dialog/BillPrintProIframe.vue
new file mode 100644
index 0000000..0e69e9f
--- /dev/null
+++ b/src/views/bill/dialog/BillPrintProIframe.vue
@@ -0,0 +1,80 @@
+
+
+
+ 取消(ESC)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/HistoryBillList.vue b/src/views/bill/dialog/HistoryBillList.vue
new file mode 100644
index 0000000..1bd4d1a
--- /dev/null
+++ b/src/views/bill/dialog/HistoryBillList.vue
@@ -0,0 +1,299 @@
+
+
+
+
+ 关闭
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="loadSupplier(organLabel)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+ {{record.number}}
+
+
+ 未审核
+ 已审核
+ 完成采购
+ 完成销售
+ 部分采购
+ 部分销售
+ 审核中
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/ImportItemModal.vue b/src/views/bill/dialog/ImportItemModal.vue
new file mode 100644
index 0000000..d542590
--- /dev/null
+++ b/src/views/bill/dialog/ImportItemModal.vue
@@ -0,0 +1,125 @@
+
+
+
+
+ 关闭
+
+
+
+
+
+ 明细Excel模板[下载]
+
+
+
+ 导入
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/LinkBillList.vue b/src/views/bill/dialog/LinkBillList.vue
new file mode 100644
index 0000000..1c59e1d
--- /dev/null
+++ b/src/views/bill/dialog/LinkBillList.vue
@@ -0,0 +1,463 @@
+
+
+
+
+ 关闭(ESC)
+ 返回单据列表
+ 确定
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+ {{record.number}}
+ {{record.number}}
+
+
+
+ 未审核
+ 已审核
+ 完成采购
+ 完成采购
+ 完成销售
+ 部分采购
+ 部分采购
+ 部分销售
+ 已审核
+ 已审核
+
+
+ 未采购
+ 完成采购
+ 部分采购
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/ManyAccountModal.vue b/src/views/bill/dialog/ManyAccountModal.vue
new file mode 100644
index 0000000..336e1d3
--- /dev/null
+++ b/src/views/bill/dialog/ManyAccountModal.vue
@@ -0,0 +1,196 @@
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/dialog/WaitBillList.vue b/src/views/bill/dialog/WaitBillList.vue
new file mode 100644
index 0000000..d103aa0
--- /dev/null
+++ b/src/views/bill/dialog/WaitBillList.vue
@@ -0,0 +1,332 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+ {{record.number}}
+ {{record.number}}
+
+
+
+ 已审核
+ 部分入库
+ 部分出库
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/mixins/BillListMixin.js b/src/views/bill/mixins/BillListMixin.js
new file mode 100644
index 0000000..bd57418
--- /dev/null
+++ b/src/views/bill/mixins/BillListMixin.js
@@ -0,0 +1,1040 @@
+import Vue from 'vue'
+import { getAction, postAction } from '@/api/manage'
+import { FormTypes } from '@/utils/JEditableTableUtil'
+import { findBillDetailByNumber, findBySelectSup, findBySelectCus, findBySelectRetail, getUserList, getAccount,
+ waitBillCount, getCurrentSystemConfig, getPlatformConfigByKey, getPersonByNumType } from '@/api/api'
+import { getCheckFlag, getFormatDate, getMpListShort, getPrevMonthFormatDate } from '@/utils/util'
+import moment from 'moment'
+import pick from 'lodash.pick'
+
+export const BillListMixin = {
+ data () {
+ return {
+ /* 原始审核是否开启 */
+ checkFlag: true,
+ /* 单据Excel是否开启 */
+ isShowExcel: false,
+ //以销定购的场景开关
+ purchaseBySaleFlag: false,
+ //商品价格含税开关
+ materialPriceTaxFlag: false,
+ setTimeFlag: null,
+ waitTotal: 0,
+ dateFormat: 'YYYY-MM-DD',
+ billExcelUrl: '',
+ defaultDepotId: '',
+ supList: [],
+ cusList: [],
+ retailList: [],
+ salesManList: [],
+ userList: [],
+ accountList: [],
+ // 实际索引
+ settingDataIndex: [],
+ // 存储展开的行key
+ expandedRowKeys: [],
+ // 实际列
+ columns:[],
+ // 明细表头
+ detailColumns:[],
+ // 列定义
+ defDetailColumns: [],
+ retailOutColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ retailBackColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ purchaseApplyColumns: [
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '已采购', dataIndex: 'finishNumber'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ purchaseOrderColumns: [
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '已采购', dataIndex: 'finishNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '税率(%)', dataIndex: 'taxRate'},
+ { title: '税额', dataIndex: 'taxMoney'},
+ { title: '价税合计', dataIndex: 'taxLastMoney'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ purchaseInColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '已入库', dataIndex: 'finishNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '税率(%)', dataIndex: 'taxRate'},
+ { title: '税额', dataIndex: 'taxMoney'},
+ { title: '价税合计', dataIndex: 'taxLastMoney'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ purchaseBackColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '已出库', dataIndex: 'finishNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '税率(%)', dataIndex: 'taxRate'},
+ { title: '税额', dataIndex: 'taxMoney'},
+ { title: '价税合计', dataIndex: 'taxLastMoney'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ saleOrderColumns: [
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '已采购', dataIndex: 'finishPurchaseNumber'},
+ { title: '已销售', dataIndex: 'finishNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '税率(%)', dataIndex: 'taxRate'},
+ { title: '税额', dataIndex: 'taxMoney'},
+ { title: '价税合计', dataIndex: 'taxLastMoney'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ saleOutColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '已出库', dataIndex: 'finishNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '税率(%)', dataIndex: 'taxRate'},
+ { title: '税额', dataIndex: 'taxMoney'},
+ { title: '价税合计', dataIndex: 'taxLastMoney'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ saleBackColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '已入库', dataIndex: 'finishNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '税率(%)', dataIndex: 'taxRate'},
+ { title: '税额', dataIndex: 'taxMoney'},
+ { title: '价税合计', dataIndex: 'taxLastMoney'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ otherInColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ otherOutColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '序列号', dataIndex: 'snList', width:300},
+ { title: '批号', dataIndex: 'batchNumber'},
+ { title: '有效期', dataIndex: 'expirationDate'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ allocationOutColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '调入仓库', dataIndex: 'anotherDepotName'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '重量', dataIndex: 'weight'},
+ { title: '仓位货架', dataIndex: 'position'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ assembleColumns: [
+ { title: '商品类型', dataIndex: 'mType'},
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ disassembleColumns: [
+ { title: '商品类型', dataIndex: 'mType'},
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '颜色', dataIndex: 'color'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ stockCheckReplayColumns: [
+ { title: '仓库名称', dataIndex: 'depotName'},
+ { title: '条码', dataIndex: 'barCode'},
+ { title: '名称', dataIndex: 'name'},
+ { title: '规格', dataIndex: 'standard'},
+ { title: '型号', dataIndex: 'model'},
+ { title: '品牌', dataIndex: 'brand'},
+ { title: '制造商', dataIndex: 'mfrs'},
+ { title: '扩展1', dataIndex: 'otherField1'},
+ { title: '扩展2', dataIndex: 'otherField2'},
+ { title: '扩展3', dataIndex: 'otherField3'},
+ { title: '库存', dataIndex: 'stock'},
+ { title: '单位', dataIndex: 'unit'},
+ { title: '多属性', dataIndex: 'sku'},
+ { title: '数量', dataIndex: 'operNumber'},
+ { title: '单价', dataIndex: 'unitPrice'},
+ { title: '金额', dataIndex: 'allPrice'},
+ { title: '备注', dataIndex: 'remark'}
+ ],
+ quickBtn: {
+ retailBack: '',
+ purchaseOrder: '',
+ purchaseIn: '',
+ purchaseBack: '',
+ saleOut: '',
+ saleBack: ''
+ },
+ queryParam: {
+ beginTime: getPrevMonthFormatDate(3),
+ endTime: getFormatDate(),
+ createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())]
+ }
+ }
+ },
+ computed: {
+ importExcelUrl: function(){
+ return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+ },
+ isBatchDelEnabled: function () {
+ for (let i = 0; i < this.selectedRowKeys.length; i++) {
+ if (!this.selectionRows[i].actionsEnabled.delete) {
+ return false;
+ }
+ }
+ return true;
+ }
+ },
+ created() {
+ this.initColumnsSetting()
+ this.isShowExcel = Vue.ls.get('isShowExcel');
+ },
+ methods: {
+ loadData(arg) {
+ // 重置展开状态
+ this.expandedRowKeys = []
+ if (arg === 1) {
+ this.ipagination.current = 1
+ }
+ let params = this.getQueryParams() //查询条件
+ this.loading = true
+ getAction(this.url.list, params).then((res) => {
+ if (res.code===200) {
+ this.dataSource = res.data.rows
+ this.ipagination.total = res.data.total
+ this.tableAddTotalRow(this.columns, this.dataSource)
+ } else if(res.code===510){
+ this.$message.warning(res.data)
+ } else {
+ this.$message.warning(res.data.message)
+ }
+ this.loading = false
+ this.onClearSelected()
+ })
+ },
+ myHandleAdd() {
+ this.$refs.modalForm.action = "add";
+ if(this.btnEnableList.indexOf(2)===-1) {
+ this.$refs.modalForm.isCanCheck = false
+ }
+ this.handleAdd();
+ },
+ myHandleCopyAdd(record) {
+ this.$refs.modalForm.action = "copyAdd";
+ if(this.btnEnableList.indexOf(2)===-1) {
+ this.$refs.modalForm.isCanCheck = false
+ }
+ //复制单据的时候需要移除关联单据的相关信息
+ record.linkNumber = ''
+ record.billType = ''
+ record.deposit = ''
+ this.$refs.modalForm.edit(record);
+ this.$refs.modalForm.title = "复制新增";
+ this.$refs.modalForm.disableSubmit = false;
+ //开启明细的编辑模式
+ this.$refs.modalForm.rowCanEdit = true
+ let columnIndex = record.subType === '组装单' || record.subType === '拆卸单'?2:1
+ this.$refs.modalForm.materialTable.columns[columnIndex].type = FormTypes.popupJsh
+ },
+ myHandleEdit(record) {
+ if(record.status === '0') {
+ this.$refs.modalForm.action = "edit";
+ if(this.btnEnableList.indexOf(2)===-1) {
+ this.$refs.modalForm.isCanCheck = false
+ }
+ //查询单条单据信息
+ findBillDetailByNumber({ number: record.number }).then((res) => {
+ if (res && res.code === 200) {
+ let item = res.data
+ this.handleEdit(item)
+ }
+ })
+ } else {
+ this.$message.warning("抱歉,只有未审核的单据才能编辑,请先进行反审核!")
+ }
+ },
+ myHandleDelete(record) {
+ if(record.status === '0') {
+ this.handleDelete(record.id)
+ } else {
+ this.$message.warning("抱歉,只有未审核的单据才能删除,请先进行反审核!")
+ }
+ },
+ myHandleDetail(record, type, prefixNo) {
+ if(this.btnEnableList.indexOf(7)===-1) {
+ this.$refs.modalDetail.isCanBackCheck = false
+ }
+ this.handleDetail(record, type, prefixNo);
+ },
+ batchForceClose: function () {
+ if(!this.url.forceCloseBatch){
+ this.$message.error("请设置url.forceCloseBatch属性!")
+ return
+ }
+ if (this.selectedRowKeys.length <= 0) {
+ this.$message.warning('请选择一条记录!')
+ } else {
+ let ids = "";
+ for (let a = 0; a < this.selectedRowKeys.length; a++) {
+ ids += this.selectedRowKeys[a] + ","
+ }
+ let that = this
+ this.$confirm({
+ title: "确认强制结单",
+ content: "是否强制结单选中数据?",
+ onOk: function () {
+ that.loading = true
+ postAction(that.url.forceCloseBatch, {ids: ids}).then((res) => {
+ if(res.code === 200){
+ that.loadData()
+ } else {
+ that.$message.warning(res.data.message)
+ }
+ }).finally(() => {
+ that.loading = false
+ });
+ }
+ });
+ }
+ },
+ batchForceClosePurchase: function () {
+ if(!this.url.forceClosePurchaseBatch){
+ this.$message.error("请设置url.forceClosePurchaseBatch属性!")
+ return
+ }
+ if (this.selectedRowKeys.length <= 0) {
+ this.$message.warning('请选择一条记录!')
+ } else {
+ let ids = "";
+ for (let a = 0; a < this.selectedRowKeys.length; a++) {
+ ids += this.selectedRowKeys[a] + ","
+ }
+ let that = this
+ this.$confirm({
+ title: "确认强制结单(以销定购)",
+ content: "是否强制结单选中数据?",
+ onOk: function () {
+ that.loading = true
+ postAction(that.url.forceClosePurchaseBatch, {ids: ids}).then((res) => {
+ if(res.code === 200){
+ that.loadData()
+ } else {
+ that.$message.warning(res.data.message)
+ }
+ }).finally(() => {
+ that.loading = false
+ });
+ }
+ });
+ }
+ },
+ handleApprove(record) {
+ this.$refs.modalForm.action = "approve";
+ this.$refs.modalForm.edit(record);
+ this.$refs.modalForm.title = "审核";
+ },
+ searchReset() {
+ this.queryParam = {
+ type: this.queryParam.type,
+ subType: this.queryParam.subType,
+ beginTime: getPrevMonthFormatDate(3),
+ endTime: getFormatDate(),
+ createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())]
+ }
+ this.loadData(1)
+ },
+ onDateChange: function (value, dateString) {
+ this.queryParam.beginTime=dateString[0]
+ this.queryParam.endTime=dateString[1]
+ if(dateString[0] && dateString[1]) {
+ this.queryParam.createTimeRange = [moment(dateString[0]), moment(dateString[1])]
+ }
+ },
+ onDateOk(value) {
+ console.log(value);
+ },
+ initSystemConfig() {
+ getCurrentSystemConfig().then((res) => {
+ if(res.code === 200 && res.data){
+ let multiBillType = res.data.multiBillType
+ let multiLevelApprovalFlag = res.data.multiLevelApprovalFlag
+ this.checkFlag = getCheckFlag(multiBillType, multiLevelApprovalFlag, this.prefixNo)
+ this.purchaseBySaleFlag = res.data.purchaseBySaleFlag==='1'?true:false
+ this.inOutManageFlag = res.data.inOutManageFlag==='1'?true:false
+ this.materialPriceTaxFlag = res.data.materialPriceTaxFlag==='1'?true:false
+ }
+ })
+ getPlatformConfigByKey({ "platformKey": "bill_excel_url" }).then((res) => {
+ if (res && res.code === 200) {
+ if(res.data.platformValue) {
+ this.billExcelUrl = res.data.platformValue
+ }
+ }
+ })
+ },
+ initSupplier() {
+ let that = this;
+ findBySelectSup({limit:1}).then((res)=>{
+ if(res) {
+ that.supList = res;
+ }
+ });
+ },
+ initCustomer() {
+ let that = this;
+ findBySelectCus({limit:1}).then((res)=>{
+ if(res) {
+ that.cusList = res;
+ }
+ });
+ },
+ initRetail() {
+ let that = this;
+ findBySelectRetail({limit:1}).then((res)=>{
+ if(res) {
+ that.retailList = res;
+ }
+ });
+ },
+ initSalesman() {
+ let that = this;
+ getPersonByNumType({type:1}).then((res)=>{
+ if(res) {
+ that.salesManList = res;
+ }
+ });
+ },
+ getDepotData() {
+ getAction('/depot/findDepotByCurrentUser').then((res)=>{
+ if(res.code === 200){
+ this.depotList = res.data;
+ }else{
+ this.$message.info(res.data);
+ }
+ })
+ },
+ initUser() {
+ getUserList({}).then((res)=>{
+ if(res) {
+ this.userList = res;
+ }
+ });
+ },
+ initAccount() {
+ getAccount({}).then((res)=>{
+ if(res && res.code === 200) {
+ this.accountList = res.data.accountList
+ }
+ })
+ },
+ initWaitBillCount(type, subType, status) {
+ waitBillCount({search: {
+ type: type, subType: subType, status: status
+ }}).then((res)=>{
+ if(res && res.code === 200) {
+ this.waitTotal = res.data.total
+ }
+ })
+ },
+ //加载初始化列
+ initColumnsSetting(){
+ let columnsStr = Vue.ls.get(this.prefixNo)
+ if(columnsStr && columnsStr.indexOf(',')>-1) {
+ this.settingDataIndex = columnsStr.split(',')
+ } else {
+ this.settingDataIndex = this.defDataIndex
+ }
+ this.columns = this.defColumns.filter(item => {
+ if(this.purchaseBySaleFlag) {
+ //以销定购-开启
+ return this.settingDataIndex.includes(item.dataIndex)
+ } else {
+ //以销定购-关闭
+ if(this.prefixNo === 'CGDD') {
+ //采购订单只显示除了关联订单之外的列
+ if(item.dataIndex!=='linkNumber') {
+ return this.settingDataIndex.includes(item.dataIndex)
+ }
+ } else {
+ return this.settingDataIndex.includes(item.dataIndex)
+ }
+ }
+ })
+ },
+ //加载快捷按钮:转入库、转出库等
+ initQuickBtn() {
+ let btnStrList = Vue.ls.get('winBtnStrList') //按钮功能列表 JSON字符串
+ if (btnStrList) {
+ for (let i = 0; i < btnStrList.length; i++) {
+ if (btnStrList[i].btnStr) {
+ this.quickBtn.retailBack = btnStrList[i].url === '/bill/retail_back'?btnStrList[i].btnStr:this.quickBtn.retailBack
+ this.quickBtn.purchaseOrder = btnStrList[i].url === '/bill/purchase_order'?btnStrList[i].btnStr:this.quickBtn.purchaseOrder
+ this.quickBtn.purchaseIn = btnStrList[i].url === '/bill/purchase_in'?btnStrList[i].btnStr:this.quickBtn.purchaseIn
+ this.quickBtn.purchaseBack = btnStrList[i].url === '/bill/purchase_back'?btnStrList[i].btnStr:this.quickBtn.purchaseBack
+ this.quickBtn.saleOut = btnStrList[i].url === '/bill/sale_out'?btnStrList[i].btnStr:this.quickBtn.saleOut
+ this.quickBtn.saleBack = btnStrList[i].url === '/bill/sale_back'?btnStrList[i].btnStr:this.quickBtn.saleBack
+ }
+ }
+ }
+ },
+ handleSearchSupplier(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectSup({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.supList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchCustomer(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectCus({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.cusList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchRetail(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectRetail({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.retailList = res;
+ }
+ })
+ },500)
+ },
+ getDepotByCurrentUser() {
+ getAction('/depot/findDepotByCurrentUser').then((res) => {
+ if (res.code === 200) {
+ if (res.data.length === 1) {
+ this.defaultDepotId = res.data[0].id+''
+ } else {
+ for (let i = 0; i < res.data.length; i++) {
+ if(res.data[i].isDefault){
+ this.defaultDepotId = res.data[i].id+''
+ }
+ }
+ }
+ }
+ })
+ },
+ //跳转到下一个单据页面
+ transferBill(type, quickBtnStr) {
+ if (this.selectedRowKeys.length <= 0) {
+ this.$message.warning('请选择一条记录!')
+ } else if (this.selectedRowKeys.length > 1) {
+ this.$message.warning('只能选择一条记录!')
+ } else {
+ let info = this.selectionRows[0]
+ if(info.status === '1' || info.status === '3') {
+ let linkType = 'basic'
+ if(type === '转采购订单-以销定购') {
+ linkType = 'purchase'
+ } else {
+ linkType = 'basic'
+ }
+ let param = {
+ headerId: info.id,
+ mpList : '',
+ linkType: linkType
+ }
+ getAction('/depotItem/getDetailList', param).then((res) => {
+ if (res.code === 200) {
+ let deposit = info.changeAmount - info.finishDeposit
+ let transferParam = {
+ list: res.data.rows,
+ number: info.number,
+ organId: info.organId,
+ discountMoney: info.discountMoney,
+ deposit: deposit,
+ remark: info.remark,
+ accountId: info.accountId,
+ salesMan: info.salesMan
+ }
+ if(type === '转采购订单-以销定购') {
+ let list = transferParam.list
+ list.forEach(item => {
+ item.finishNumber = item.finishPurchaseNumber
+ })
+ this.$refs.transferPurchaseModalForm.action = "add"
+ this.$refs.transferPurchaseModalForm.transferParam = transferParam
+ this.$refs.transferPurchaseModalForm.defaultDepotId = this.defaultDepotId
+ this.$refs.transferPurchaseModalForm.add()
+ this.$refs.transferPurchaseModalForm.title = type
+ if(quickBtnStr.indexOf(2)===-1) {
+ this.$refs.transferPurchaseModalForm.isCanCheck = false
+ }
+ } else {
+ this.$refs.transferModalForm.action = "add"
+ this.$refs.transferModalForm.transferParam = transferParam
+ this.$refs.transferModalForm.defaultDepotId = this.defaultDepotId
+ this.$refs.transferModalForm.materialPriceTaxFlag = this.materialPriceTaxFlag
+ this.$refs.transferModalForm.add()
+ this.$refs.transferModalForm.title = type
+ if(quickBtnStr.indexOf(2)===-1) {
+ this.$refs.transferModalForm.isCanCheck = false
+ }
+ }
+ }
+ })
+ } else {
+ this.$message.warning('该状态不能' + type + '!')
+ }
+ }
+ },
+ //列设置更改事件
+ onColChange (checkedValues) {
+ this.columns = this.defColumns.filter(item => {
+ return checkedValues.includes(item.dataIndex)
+ })
+ let columnsStr = checkedValues.join()
+ Vue.ls.set(this.prefixNo, columnsStr)
+ },
+ //恢复默认
+ handleRestDefault() {
+ Vue.ls.remove(this.prefixNo)
+ this.initColumnsSetting()
+ },
+ //导出单据
+ handleExport() {
+ let search = this.getQueryParams().search
+ this.$refs.billExcelIframe.show(this.model, this.billExcelUrl + '?search=' + search + '&type=1', 150)
+ this.$refs.billExcelIframe.title = "确认导出"
+ },
+ // 展开/折叠行
+ onExpand(expanded, record) {
+ if (expanded) {
+ this.expandedRowKeys = [...new Set([...this.expandedRowKeys, record.id])]
+ let showType = 'basic'
+ if(record.subType === '采购' || record.subType === '采购退货' || record.subType === '销售' || record.subType === '销售退货') {
+ if (record.status === '3') {
+ showType = 'other'
+ }
+ } else {
+ if (record.status === '3') {
+ showType = 'basic'
+ } else if (record.purchaseStatus === '3') {
+ showType = 'purchase'
+ }
+ }
+ let params = {
+ headerId: record.id,
+ mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
+ linkType: showType,
+ isReadOnly: '0'
+ }
+ let url = '/depotItem/getDetailList'
+ this.requestSubTableData(record, url, params)
+ } else {
+ this.expandedRowKeys = this.expandedRowKeys.filter(key => key !== record.id)
+ }
+ },
+ requestSubTableData(record, url, params, success) {
+ record.loading = true
+ getAction(url, params).then(res => {
+ if(res && res.code === 200){
+ record.childrens = res.data.rows
+ this.initSetting(record, record.childrens)
+ record.loading = false
+ typeof success === 'function' ? success(res) : ''
+ }
+ }).finally(() => {
+ record.loading = false
+ })
+ },
+ initSetting(record, ds) {
+ if (this.prefixNo === 'LSCK') {
+ this.defDetailColumns = this.retailOutColumns
+ } else if (this.prefixNo === 'LSTH') {
+ this.defDetailColumns = this.retailBackColumns
+ } else if (this.prefixNo === 'QGD') {
+ this.defDetailColumns = this.purchaseApplyColumns
+ } else if (this.prefixNo === 'CGDD') {
+ this.defDetailColumns = this.purchaseOrderColumns
+ } else if (this.prefixNo === 'CGRK') {
+ this.defDetailColumns = this.purchaseInColumns
+ } else if (this.prefixNo === 'CGTH') {
+ this.defDetailColumns = this.purchaseBackColumns
+ } else if (this.prefixNo === 'XSDD') {
+ this.defDetailColumns = this.saleOrderColumns
+ } else if (this.prefixNo === 'XSCK') {
+ this.defDetailColumns = this.saleOutColumns
+ } else if (this.prefixNo === 'XSTH') {
+ this.defDetailColumns = this.saleBackColumns
+ } else if (this.prefixNo === 'QTRK') {
+ this.defDetailColumns = this.otherInColumns
+ } else if (this.prefixNo === 'QTCK') {
+ this.defDetailColumns = this.otherOutColumns
+ } else if (this.prefixNo === 'DBCK') {
+ this.defDetailColumns = this.allocationOutColumns
+ } else if (this.prefixNo === 'ZZD') {
+ this.defDetailColumns = this.assembleColumns
+ } else if (this.prefixNo === 'CXD') {
+ this.defDetailColumns = this.disassembleColumns
+ } else if (this.prefixNo === 'PDFP') {
+ this.defDetailColumns = this.stockCheckReplayColumns
+ }
+ //动态替换扩展字段
+ this.handleChangeOtherField()
+ //判断序列号、批号、有效期、多属性、重量、仓位货架、扩展、备注等是否有值
+ let needAddkeywords = []
+ for (let i = 0; i < ds.length; i++) {
+ if(ds[i].snList) {
+ needAddkeywords.push('snList')
+ }
+ if(ds[i].batchNumber) {
+ needAddkeywords.push('batchNumber')
+ }
+ if(ds[i].expirationDate) {
+ needAddkeywords.push('expirationDate')
+ }
+ if(ds[i].sku) {
+ needAddkeywords.push('sku')
+ }
+ if(ds[i].weight) {
+ needAddkeywords.push('weight')
+ }
+ if(ds[i].position) {
+ needAddkeywords.push('position')
+ }
+ if(ds[i].brand) {
+ needAddkeywords.push('brand')
+ }
+ if(ds[i].mfrs) {
+ needAddkeywords.push('mfrs')
+ }
+ if(ds[i].otherField1) {
+ needAddkeywords.push('otherField1')
+ }
+ if(ds[i].otherField2) {
+ needAddkeywords.push('otherField2')
+ }
+ if(ds[i].otherField3) {
+ needAddkeywords.push('otherField3')
+ }
+ if(ds[i].taxRate) {
+ needAddkeywords.push('taxRate')
+ }
+ if(ds[i].remark) {
+ needAddkeywords.push('remark')
+ }
+ }
+ let currentCol = []
+ if(record.status === '3' || record.purchaseStatus === '3') {
+ //部分采购|部分销售的时候显示全部列
+ for(let i=0; i-1) {
+ let info = {}
+ info.title = this.defDetailColumns[i].title
+ info.dataIndex = this.defDetailColumns[i].dataIndex
+ if(this.defDetailColumns[i].width) {
+ info.width = this.defDetailColumns[i].width
+ }
+ currentCol.push(info)
+ }
+ }
+ this.detailColumns = currentCol
+ }
+ },
+ //动态替换扩展字段
+ handleChangeOtherField() {
+ let mpStr = getMpListShort(Vue.ls.get('materialPropertyList'))
+ if(mpStr) {
+ let mpArr = mpStr.split(',')
+ if(mpArr.length ===3) {
+ for (let i = 0; i < this.defDetailColumns.length; i++) {
+ if(this.defDetailColumns[i].dataIndex === 'otherField1') {
+ this.defDetailColumns[i].title = mpArr[0]
+ }
+ if(this.defDetailColumns[i].dataIndex === 'otherField2') {
+ this.defDetailColumns[i].title = mpArr[1]
+ }
+ if(this.defDetailColumns[i].dataIndex === 'otherField3') {
+ this.defDetailColumns[i].title = mpArr[2]
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/views/bill/mixins/BillModalMixin.js b/src/views/bill/mixins/BillModalMixin.js
new file mode 100644
index 0000000..9f2fb19
--- /dev/null
+++ b/src/views/bill/mixins/BillModalMixin.js
@@ -0,0 +1,1278 @@
+import { FormTypes, getListData } from '@/utils/JEditableTableUtil'
+import { findBySelectCus, findBySelectRetail, findBySelectSup, findStockByDepotAndBarCode, getAccount,
+ getBatchNumberList, getCurrentSystemConfig, getMaterialByBarCode, getPersonByNumType, getPlatformConfigByKey } from '@/api/api'
+import { getAction } from '@/api/manage'
+import { getCheckFlag, getMpListShort, getNowFormatDateTime } from '@/utils/util'
+import { USER_INFO } from '@/store/mutation-types'
+import Vue from 'vue'
+
+export const BillModalMixin = {
+ data() {
+ return {
+ action: '',
+ manyAccountBtnStatus: false,
+ supList: [],
+ cusList: [],
+ retailList: [],
+ personList: {
+ options: [],
+ value: ''
+ },
+ currentSelectDepotId: '',
+ transferParam: {},
+ defaultDepotId: '',
+ depotList: [],
+ accountList: [],
+ accountIdList: [],
+ accountMoneyList: [],
+ billUnitPirce: '',
+ scanBarCode: '',
+ scanStatus: true,
+ billStatus: '0',
+ minWidth: 1100,
+ isCanCheck: true,
+ quickBtn: {
+ vendor: false,
+ customer: false,
+ member: false,
+ account: false,
+ depot: false
+ },
+ billPrintFlag: false,
+ /* 是否显示打印按钮 */
+ isShowPrintBtn: true,
+ /* 原始审核是否开启 */
+ checkFlag: true,
+ //零收付款的场景开关
+ zeroChangeAmountFlag: false,
+ //商品价格含税开关
+ materialPriceTaxFlag: false,
+ setTimeFlag: null,
+ validatorRules:{
+ price:{
+ rules: [
+ { pattern: /^(([0-9][0-9]*)|([0]\.\d{0,4}|[0-9][0-9]*\.\d{0,4}))$/, message: '金额格式不正确!' }
+ ]
+ }
+ },
+ spans: {
+ labelCol1: {span: 2},
+ wrapperCol1: {span: 22},
+ //1_5: 分为1.5列(相当于占了2/3)
+ labelCol1_5: { span: 3 },
+ wrapperCol1_5: { span: 21 },
+ labelCol2: {span: 4},
+ wrapperCol2: {span: 20},
+ labelCol3: {span: 6},
+ wrapperCol3: {span: 18},
+ labelCol6: {span: 12},
+ wrapperCol6: {span: 12}
+ },
+ };
+ },
+ created () {
+ let realScreenWidth = window.screen.width
+ this.width = realScreenWidth<1500?'1200px':'1550px'
+ this.minWidth = realScreenWidth<1500?1150:1500
+ },
+ mounted() {
+ document.getElementById(this.prefixNo).addEventListener('keydown', this.handleOkKey)
+ },
+ beforeDestroy() {
+ document.getElementById(this.prefixNo).removeEventListener('keydown', this.handleOkKey)
+ },
+ computed: {
+ readOnly: function() {
+ return this.action !== "add" && this.action !== "edit";
+ }
+ },
+ methods: {
+ // 快捷键
+ handleOkKey(e) {
+ const key = window.event.keyCode ? window.event.keyCode : window.event.which
+ if (key === 83 && e.ctrlKey) {
+ //保存 CTRL+S
+ this.handleOkOnly()
+ e.preventDefault()
+ }
+ },
+ addInit(amountNum) {
+ getAction('/sequence/buildNumber').then((res) => {
+ if (res && res.code === 200) {
+ this.model.defaultNumber = amountNum + res.data.defaultNumber
+ this.form.setFieldsValue({'number':amountNum + res.data.defaultNumber})
+ }
+ })
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'operTime':getNowFormatDateTime(), 'discount': 0,
+ 'discountMoney': 0, 'discountLastMoney': 0, 'otherMoney': 0, 'changeAmount': 0, 'debt': 0})
+ })
+ this.$nextTick(() => {
+ getAccount({}).then((res)=>{
+ if(res && res.code === 200) {
+ for (const item of res.data.accountList) {
+ if(item.isDefault){
+ this.form.setFieldsValue({'accountId': item.id})
+ }
+ }
+ //数据从前一个页面带过来的情况
+ if(this.transferParam && this.transferParam.accountId) {
+ this.form.setFieldsValue({'accountId': this.transferParam.accountId})
+ }
+ }
+ })
+ })
+ this.accountIdList = []
+ this.accountMoneyList = []
+ this.manyAccountBtnStatus = false
+ },
+ copyAddInit(amountNum) {
+ getAction('/sequence/buildNumber').then((res) => {
+ if (res && res.code === 200) {
+ this.form.setFieldsValue({'number':amountNum + res.data.defaultNumber})
+ }
+ })
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'operTime':getNowFormatDateTime()})
+ })
+ },
+ /** 查询某个tab的数据 */
+ requestSubTableData(url, params, tab, success) {
+ tab.loading = true
+ getAction(url, params).then(res => {
+ if(res && res.code === 200){
+ tab.dataSource = res.data.rows
+ for(let i=0; i {
+ tab.loading = false
+ })
+ },
+ //改变字段的状态,1-显示 0-隐藏
+ changeFormTypes(columns, key, type) {
+ for(let i=0; i {
+ if(res.code === 200 && res.data){
+ let multiBillType = res.data.multiBillType
+ let multiLevelApprovalFlag = res.data.multiLevelApprovalFlag
+ this.checkFlag = getCheckFlag(multiBillType, multiLevelApprovalFlag, this.prefixNo)
+ this.purchaseBySaleFlag = res.data.purchaseBySaleFlag==='1'?true:false
+ this.inOutManageFlag = res.data.inOutManageFlag==='1'?true:false
+ this.zeroChangeAmountFlag = res.data.zeroChangeAmountFlag==='1'?true:false
+ this.materialPriceTaxFlag = res.data.materialPriceTaxFlag==='1'?true:false
+ if(res.data.auditPrintFlag==='1') {
+ if(this.model.status === '0' || this.model.status === '9') {
+ this.isShowPrintBtn = false
+ } else {
+ this.isShowPrintBtn = true
+ }
+ } else {
+ this.isShowPrintBtn = true
+ }
+ }
+ })
+ },
+ initSupplier(isChecked) {
+ let that = this;
+ findBySelectSup({organId: this.model.organId, limit:1}).then((res)=>{
+ if(res) {
+ that.supList = res
+ if(isChecked && res.length>0) {
+ that.form.setFieldsValue({'organId': res[0].id})
+ }
+ }
+ });
+ },
+ initCustomer(isChecked) {
+ let that = this;
+ findBySelectCus({organId: this.model.organId, limit:1}).then((res)=>{
+ if(res) {
+ that.cusList = res
+ if(isChecked && res.length>0) {
+ that.form.setFieldsValue({'organId': res[0].id})
+ }
+ }
+ });
+ },
+ initRetail(isChecked) {
+ let that = this;
+ findBySelectRetail({organId: this.model.organId, limit:1}).then((res)=>{
+ if(res) {
+ that.retailList = res
+ if(isChecked && res.length>0) {
+ that.form.setFieldsValue({'organId': res[0].id})
+ }
+ }
+ });
+ },
+ initSalesman() {
+ let that = this;
+ getPersonByNumType({type:1}).then((res)=>{
+ if(res) {
+ that.personList.options = res;
+ }
+ });
+ },
+ initDepot() {
+ let that = this;
+ getAction('/depot/findDepotByCurrentUser').then((res) => {
+ if(res.code === 200){
+ let arr = res.data
+ for(let item of that.materialTable.columns){
+ if(item.key == 'depotId' || item.key == 'anotherDepotId') {
+ item.options = []
+ for(let i=0; i{
+ if(res && res.code === 200) {
+ let list = res.data.accountList
+ let lastId = list.length>0?list[0].id:''
+ getCurrentSystemConfig().then((res) => {
+ if (res.code === 200 && res.data) {
+ let multiAccountFlag = res.data.multiAccountFlag
+ if(multiAccountFlag==='1') {
+ list.splice(0,0,{id: 0, name: '多账户'})
+ }
+ }
+ that.accountList = list
+ if(isChecked) {
+ that.form.setFieldsValue({'accountId': lastId})
+ }
+ })
+ }
+ })
+ },
+ handleSearchSupplier(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectSup({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.supList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchCustomer(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectCus({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.cusList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchRetail(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectRetail({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.retailList = res;
+ }
+ })
+ },500)
+ },
+ handleManyAccount(){
+ this.selectAccount(0)
+ },
+ selectAccount(value){
+ if(value === 0) { //多账户
+ this.$refs.manyAccountModalForm.edit(this.accountIdList, this.accountMoneyList)
+ this.$refs.manyAccountModalForm.title = "多账户结算"
+ this.manyAccountBtnStatus = true
+ } else {
+ this.accountIdList = []
+ this.accountMoneyList = []
+ this.manyAccountBtnStatus = false
+ }
+ },
+ manyAccountModalFormOk(idList, moneyList, allPrice) {
+ this.accountIdList = idList
+ this.accountMoneyList = moneyList
+ let discountLastMoney = this.form.getFieldValue('discountLastMoney')-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let debt = (discountLastMoney + otherMoney - allPrice).toFixed(2)
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'changeAmount':allPrice, 'debt':debt})
+ });
+ },
+ addSupplier() {
+ this.$refs.vendorModalForm.add();
+ this.$refs.vendorModalForm.title = "新增供应商";
+ this.$refs.vendorModalForm.disableSubmit = false;
+ },
+ addCustomer() {
+ this.$refs.customerModalForm.add();
+ this.$refs.customerModalForm.title = "新增客户(提醒:如果找不到新添加的客户,请到用户管理检查是否分配了该客户权限)";
+ this.$refs.customerModalForm.disableSubmit = false;
+ },
+ addMember() {
+ this.$refs.memberModalForm.add();
+ this.$refs.memberModalForm.title = "新增会员";
+ this.$refs.memberModalForm.disableSubmit = false;
+ },
+ handleBatchSetDepot() {
+ this.$refs.batchSetDepotModalForm.add();
+ this.$refs.batchSetDepotModalForm.title = "批量切换仓库";
+ this.$refs.batchSetDepotModalForm.disableSubmit = false;
+ },
+ addDepot() {
+ this.$refs.depotModalForm.add();
+ this.$refs.depotModalForm.title = "新增仓库";
+ this.$refs.depotModalForm.disableSubmit = false;
+ },
+ addAccount() {
+ this.$refs.accountModalForm.add();
+ this.$refs.accountModalForm.title = "新增结算账户";
+ this.$refs.accountModalForm.disableSubmit = false;
+ },
+ vendorModalFormOk() {
+ this.initSupplier(1)
+ },
+ customerModalFormOk() {
+ this.initCustomer(1)
+ },
+ memberModalFormOk() {
+ this.initRetail(1)
+ },
+ batchSetDepotModalFormOk(depotId) {
+ this.getAllTable().then(tables => {
+ return getListData(this.form, tables)
+ }).then(allValues => {
+ //获取单据明细列表信息
+ let detailArr = allValues.tablesValue[0].values
+ let barCodes = ''
+ for(let detail of detailArr){
+ barCodes += detail.barCode + ','
+ }
+ if(barCodes) {
+ barCodes = barCodes.substring(0, barCodes.length-1)
+ }
+ let param = {
+ barCode: barCodes,
+ organId: this.form.getFieldValue('organId'),
+ depotId: depotId,
+ mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
+ prefixNo: this.prefixNo
+ }
+ getMaterialByBarCode(param).then((res) => {
+ if (res && res.code === 200) {
+ let mList = res.data
+ //构造新的列表数组,用于存放单据明细信息
+ let newDetailArr = []
+ if(mList && mList.length) {
+ for (let i = 0; i < detailArr.length; i++) {
+ let item = detailArr[i]
+ item.depotId = depotId
+ for (let j = 0; j < mList.length; j++) {
+ if(mList[j].mBarCode === item.barCode) {
+ item.stock = mList[j].stock
+ }
+ }
+ newDetailArr.push(item)
+ }
+ } else {
+ for (let i = 0; i < detailArr.length; i++) {
+ let item = detailArr[i]
+ item.depotId = depotId
+ newDetailArr.push(item)
+ }
+ }
+ this.materialTable.dataSource = newDetailArr
+ }
+ })
+ })
+ },
+ depotModalFormOk() {
+ this.initDepot()
+ },
+ accountModalFormOk() {
+ this.initAccount(1)
+ },
+ workflowModalFormOk() {
+ this.close()
+ },
+ onAdded(event) {
+ let that = this
+ const { row, target } = event
+ target.setValues([{rowKey: row.id, values: {operNumber:0}}])
+ //自动下滑到最后一行
+ setTimeout(function(){
+ that.$refs.materialDataTable.resetScrollTop((target.rows.length+1)*that.$refs.materialDataTable.rowHeight)
+ },1000)
+ if(this.currentSelectDepotId) {
+ //如果单据选择过仓库,则直接从当前选择的仓库加载
+ target.setValues([{rowKey: row.id, values: {depotId: this.currentSelectDepotId}}])
+ } else {
+ getAction('/depot/findDepotByCurrentUser').then((res) => {
+ if (res.code === 200) {
+ let arr = res.data
+ if(arr.length===1) {
+ target.setValues([{rowKey: row.id, values: {depotId: arr[0].id+''}}])
+ } else {
+ for (let i = 0; i < arr.length; i++) {
+ if(arr[i].isDefault){
+ target.setValues([{rowKey: row.id, values: {depotId: arr[i].id+''}}])
+ }
+ }
+ }
+ }
+ })
+ }
+ },
+ //单元值改变一个字符就触发一次
+ onValueChange(event) {
+ let that = this
+ const { type, row, column, value, target } = event
+ let param,snList,batchNumber,operNumber,unitPrice,allPrice,taxRate,taxMoney,taxLastMoney
+ switch(column.key) {
+ case "depotId":
+ that.currentSelectDepotId = row.depotId
+ if(row.barCode){
+ that.getStockByDepotBarCode(row, target)
+ }
+ break;
+ case "barCode":
+ param = {
+ barCode: value,
+ organId: this.form.getFieldValue('organId'),
+ mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
+ prefixNo: this.prefixNo
+ }
+ getMaterialByBarCode(param).then((res) => {
+ if (res && res.code === 200) {
+ let mList = res.data
+ if (value.indexOf(',') > -1) {
+ //多个条码
+ this.$refs.materialDataTable.getValues((error, values) => {
+ values.pop() //移除最后一行数据
+ let mArr = values
+ for (let i = 0; i < mList.length; i++) {
+ let mInfo = mList[i]
+ this.changeColumnShow(mInfo)
+ let mObj = this.parseInfoToObj(mInfo)
+ mObj.depotId = mInfo.depotId
+ mObj.stock = mInfo.stock
+ mObj.snList = ''
+ mObj.batchNumber = ''
+ mObj.expirationDate = ''
+ mArr.push(mObj)
+ }
+ let allPriceTotal = 0
+ let taxLastMoneyTotal = 0
+ for (let j = 0; j < mArr.length; j++) {
+ allPriceTotal += mArr[j].allPrice-0
+ taxLastMoneyTotal += mArr[j].taxLastMoney-0
+ //组合和拆分单据给商品类型进行重新赋值
+ if(j===0) {
+ mArr[0].mType = '组合件'
+ } else {
+ mArr[j].mType = '普通子件'
+ }
+ }
+ this.materialTable.dataSource = mArr
+ if(this.prefixNo ==='LSCK' || this.prefixNo ==='LSTH') {
+ target.statisticsColumns.allPrice = allPriceTotal
+ } else {
+ target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
+ }
+ that.autoChangePrice(target)
+ //强制渲染
+ target.$forceUpdate()
+ })
+ } else {
+ //单个条码
+ let depotIdSelected = this.prefixNo !== 'CGDD' && this.prefixNo !== 'XSDD'? row.depotId: ''
+ findStockByDepotAndBarCode({ depotId: depotIdSelected, barCode: row.barCode }).then((res) => {
+ if (res && res.code === 200) {
+ let mArr = []
+ let mInfo = mList[0]
+ this.changeColumnShow(mInfo)
+ let mInfoEx = this.parseInfoToObj(mInfo)
+ mInfoEx.stock = res.data.stock
+ mInfoEx.snList = ''
+ mInfoEx.batchNumber = ''
+ mInfoEx.expirationDate = ''
+ let mObj = {
+ rowKey: row.id,
+ values: mInfoEx
+ }
+ mArr.push(mObj)
+ target.setValues(mArr);
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ target.autoSelectBySpecialKey('operNumber', row.orderNum)
+ //强制渲染
+ target.$forceUpdate()
+ }
+ })
+ }
+ }
+ });
+ break;
+ case "snList":
+ snList = value
+ if(snList) {
+ snList = snList.replaceAll(',',',')
+ let snArr = snList.split(',')
+ operNumber = snArr.length
+ taxRate = row.taxRate-0 //税率
+ unitPrice = row.unitPrice-0 //单价
+ allPrice = (unitPrice*operNumber).toFixed(2)-0
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ taxLastMoney = allPrice
+ } else {
+ taxMoney =((taxRate*0.01)*allPrice).toFixed(2)-0
+ taxLastMoney = (allPrice + taxMoney).toFixed(2)-0
+ }
+ target.setValues([{rowKey: row.id, values: {operNumber: operNumber, allPrice: allPrice, taxMoney: taxMoney, taxLastMoney: taxLastMoney}}])
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ }
+ break;
+ case "batchNumber":
+ //只针对零售出库、销售出库、采购退货、其它出库
+ if(this.prefixNo === 'LSCK' || this.prefixNo === 'XSCK' || this.prefixNo === 'CGTH' || this.prefixNo === 'QTCK') {
+ batchNumber = value
+ let depotItemId = ''
+ if(this.model.id) {
+ //只有在保存之后的编辑页面下才获取明细id
+ let rowId = row.id
+ if(rowId.length<=19) {
+ depotItemId = rowId-0
+ }
+ }
+ getBatchNumberList({name:'', depotItemId: depotItemId, depotId: row.depotId, barCode: row.barCode, batchNumber: batchNumber}).then((res) => {
+ if (res && res.code === 200) {
+ if(res.data && res.data.rows) {
+ let info = res.data.rows[0]
+ let preNumber = row.preNumber-0 //原数量
+ let finishNumber = row.finishNumber-0 //已出库
+ let totalNum = info.totalNum-0 //批次数量
+ if(preNumber > 0) {
+ if(totalNum > preNumber - finishNumber) {
+ operNumber = preNumber - finishNumber
+ } else {
+ operNumber = totalNum
+ }
+ } else {
+ operNumber = totalNum
+ }
+ taxRate = row.taxRate-0 //税率
+ unitPrice = row.unitPrice-0 //单价
+ allPrice = (unitPrice*operNumber).toFixed(2)-0
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ taxLastMoney = allPrice
+ } else {
+ taxMoney =((taxRate*0.01)*allPrice).toFixed(2)-0
+ taxLastMoney = (allPrice + taxMoney).toFixed(2)-0
+ }
+ target.setValues([{rowKey: row.id, values: {expirationDate: info.expirationDateStr, operNumber: operNumber,
+ allPrice: allPrice, taxMoney: taxMoney, taxLastMoney: taxLastMoney}}])
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ }
+ }
+ })
+ }
+ break;
+ case "operNumber":
+ operNumber = value-0
+ taxRate = row.taxRate-0 //税率
+ unitPrice = row.unitPrice-0 //单价
+ allPrice = (unitPrice*operNumber).toFixed(2)-0
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ taxLastMoney = allPrice
+ } else {
+ taxMoney =((taxRate*0.01)*allPrice).toFixed(2)-0
+ taxLastMoney = (allPrice + taxMoney).toFixed(2)-0
+ }
+ target.setValues([{rowKey: row.id, values: {allPrice: allPrice, taxMoney: taxMoney, taxLastMoney: taxLastMoney}}])
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ break;
+ case "unitPrice":
+ operNumber = row.operNumber-0 //数量
+ unitPrice = value-0 //单价
+ taxRate = row.taxRate-0 //税率
+ allPrice = (unitPrice*operNumber).toFixed(2)-0
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ taxLastMoney = allPrice
+ } else {
+ taxMoney =((taxRate*0.01)*allPrice).toFixed(2)-0
+ taxLastMoney = (allPrice + taxMoney).toFixed(2)-0
+ }
+ target.setValues([{rowKey: row.id, values: {allPrice: allPrice, taxMoney: taxMoney, taxLastMoney: taxLastMoney}}])
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ break;
+ case "allPrice":
+ operNumber = row.operNumber-0 //数量
+ taxRate = row.taxRate-0 //税率
+ allPrice = value-0
+ unitPrice = (allPrice/operNumber).toFixed(4)-0 //单价
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ taxLastMoney = allPrice
+ } else {
+ taxMoney =((taxRate*0.01)*allPrice).toFixed(2)-0
+ taxLastMoney = (allPrice + taxMoney).toFixed(2)-0
+ }
+ target.setValues([{rowKey: row.id, values: {unitPrice: unitPrice, taxMoney: taxMoney, taxLastMoney: taxLastMoney}}])
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ break;
+ case "taxRate":
+ operNumber = row.operNumber-0 //数量
+ allPrice = row.allPrice-0
+ unitPrice = row.unitPrice-0
+ taxRate = value-0 //税率
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ taxLastMoney = allPrice
+ } else {
+ taxMoney =((taxRate*0.01)*allPrice).toFixed(2)-0
+ taxLastMoney = (allPrice + taxMoney).toFixed(2)-0
+ }
+ target.setValues([{rowKey: row.id, values: {taxMoney: taxMoney, taxLastMoney: taxLastMoney}}])
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ break;
+ case "taxLastMoney":
+ operNumber = row.operNumber-0 //数量
+ taxLastMoney = value-0
+ taxRate = row.taxRate-0 //税率
+ if(this.materialPriceTaxFlag) {
+ allPrice = taxLastMoney
+ unitPrice = (taxLastMoney/operNumber).toFixed(4)-0
+ if(taxRate) {
+ let realAllPrice = (allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ } else {
+ //税率为0的情况,特殊处理
+ taxMoney = 0
+ }
+ } else {
+ if(taxRate) {
+ unitPrice = (taxLastMoney/operNumber/(1+taxRate*0.01)).toFixed(4)-0
+ allPrice = (unitPrice*operNumber).toFixed(2)-0
+ taxMoney =(taxLastMoney-allPrice).toFixed(2)-0
+ } else {
+ //税率为0的情况,特殊处理
+ allPrice = taxLastMoney
+ unitPrice = (allPrice/operNumber).toFixed(4)-0 //单价
+ taxMoney = 0
+ }
+ }
+ target.setValues([{rowKey: row.id, values: {unitPrice: unitPrice, allPrice: allPrice, taxMoney: taxMoney}}])
+ target.recalcAllStatisticsColumns()
+ that.autoChangePrice(target)
+ break;
+ }
+ },
+ //转为商品对象
+ parseInfoToObj(mInfo) {
+ return {
+ barCode: mInfo.mBarCode,
+ name: mInfo.name,
+ standard: mInfo.standard,
+ model: mInfo.model,
+ color: mInfo.color,
+ brand: mInfo.brand,
+ mfrs: mInfo.mfrs,
+ otherField1: mInfo.otherField1,
+ otherField2: mInfo.otherField2,
+ otherField3: mInfo.otherField3,
+ unit: mInfo.commodityUnit,
+ sku: mInfo.sku,
+ operNumber: 1,
+ unitPrice: mInfo.billPrice,
+ allPrice: mInfo.billPrice,
+ taxRate: mInfo.taxRate,
+ taxMoney: mInfo.taxMoney,
+ taxLastMoney: mInfo.taxLastMoney
+ }
+ },
+ //使得型号、颜色、扩展信息、sku等为隐藏
+ changeColumnHide() {
+ this.changeFormTypes(this.materialTable.columns, 'model', 0)
+ this.changeFormTypes(this.materialTable.columns, 'color', 0)
+ this.changeFormTypes(this.materialTable.columns, 'brand', 0)
+ this.changeFormTypes(this.materialTable.columns, 'mfrs', 0)
+ this.changeFormTypes(this.materialTable.columns, 'otherField1', 0)
+ this.changeFormTypes(this.materialTable.columns, 'otherField2', 0)
+ this.changeFormTypes(this.materialTable.columns, 'otherField3', 0)
+ this.changeFormTypes(this.materialTable.columns, 'sku', 0)
+ },
+ //使得sku、序列号、批号、到期日等为显示
+ changeColumnShow(info) {
+ if(info.model) {
+ this.changeFormTypes(this.materialTable.columns, 'model', 1)
+ }
+ if(info.color) {
+ this.changeFormTypes(this.materialTable.columns, 'color', 1)
+ }
+ if(info.brand) {
+ this.changeFormTypes(this.materialTable.columns, 'brand', 1)
+ }
+ if(info.mfrs) {
+ this.changeFormTypes(this.materialTable.columns, 'mfrs', 1)
+ }
+ if(info.otherField1) {
+ this.changeFormTypes(this.materialTable.columns, 'otherField1', 1)
+ }
+ if(info.otherField2) {
+ this.changeFormTypes(this.materialTable.columns, 'otherField2', 1)
+ }
+ if(info.otherField3) {
+ this.changeFormTypes(this.materialTable.columns, 'otherField3', 1)
+ }
+ if(info.sku) {
+ this.changeFormTypes(this.materialTable.columns, 'sku', 1)
+ }
+ if(info.enableSerialNumber === "1") {
+ //如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
+ if(this.inOutManageFlag && (this.prefixNo === 'CGRK' || this.prefixNo === 'CGTH' || this.prefixNo === 'XSCK' || this.prefixNo === 'XSTH')) {
+ //跳过
+ } else {
+ this.changeFormTypes(this.materialTable.columns, 'snList', 1)
+ }
+ }
+ if(info.enableBatchNumber === "1") {
+ //如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
+ if(this.inOutManageFlag && (this.prefixNo === 'CGRK' || this.prefixNo === 'CGTH' || this.prefixNo === 'XSCK' || this.prefixNo === 'XSTH')) {
+ //跳过
+ } else {
+ this.changeFormTypes(this.materialTable.columns, 'batchNumber', 1)
+ this.changeFormTypes(this.materialTable.columns, 'expirationDate', 1)
+ }
+ }
+ },
+ //删除一行或多行的时候触发
+ onDeleted(ids, target) {
+ target.recalcAllStatisticsColumns()
+ this.autoChangePrice(target)
+ },
+ //根据仓库和条码查询库存
+ getStockByDepotBarCode(row, target){
+ findStockByDepotAndBarCode({ depotId: row.depotId, barCode: row.barCode }).then((res) => {
+ if (res && res.code === 200) {
+ target.setValues([{rowKey: row.id, values: {stock: res.data.stock}}])
+ target.recalcAllStatisticsColumns()
+ }
+ })
+ },
+ //改变优惠、本次付款、欠款的值
+ autoChangePrice(target) {
+ let allTaxLastMoney = target.statisticsColumns.taxLastMoney-0
+ let discount = this.form.getFieldValue('discount')-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let deposit = this.form.getFieldValue('deposit')
+ let discountMoney = (discount*0.01*allTaxLastMoney).toFixed(2)-0
+ let discountLastMoney = (allTaxLastMoney-discountMoney).toFixed(2)-0
+ let changeAmountNew = (discountLastMoney + otherMoney).toFixed(2)-0
+ if(deposit) {
+ changeAmountNew = (changeAmountNew - deposit).toFixed(2)-0
+ }
+ this.$nextTick(() => {
+ changeAmountNew = this.prefixNo === 'CGDD' || this.prefixNo === 'XSDD'?0:changeAmountNew
+ this.form.setFieldsValue({'discount':discount,'discountMoney':discountMoney,'discountLastMoney':discountLastMoney,
+ 'changeAmount':changeAmountNew,'debt':0})
+ this.setZeroChangeAmount()
+ });
+ },
+ //改变优惠率
+ onChangeDiscount(e) {
+ const value = e.target.value-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let deposit = this.form.getFieldValue('deposit')
+ let allTaxLastMoney = this.$refs.materialDataTable.statisticsColumns.taxLastMoney-0
+ let discountMoneyNew = (allTaxLastMoney*value*0.01).toFixed(2)-0
+ let discountLastMoneyNew = (allTaxLastMoney - discountMoneyNew).toFixed(2)-0
+ let changeAmountNew = (discountLastMoneyNew + otherMoney).toFixed(2)-0
+ if(deposit) {
+ changeAmountNew = (changeAmountNew - deposit).toFixed(2)-0
+ }
+ this.$nextTick(() => {
+ changeAmountNew = this.prefixNo === 'CGDD' || this.prefixNo === 'XSDD'?0:changeAmountNew
+ this.form.setFieldsValue({'discountMoney':discountMoneyNew,'discountLastMoney':discountLastMoneyNew,
+ 'changeAmount':changeAmountNew,'debt':0})
+ this.setZeroChangeAmount()
+ });
+ },
+ //改变付款优惠
+ onChangeDiscountMoney(e) {
+ const value = e.target.value-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let deposit = this.form.getFieldValue('deposit')
+ let allTaxLastMoney = this.$refs.materialDataTable.statisticsColumns.taxLastMoney-0
+ let discountNew = (value/allTaxLastMoney*100).toFixed(2)-0
+ let discountLastMoneyNew = (allTaxLastMoney - value).toFixed(2)-0
+ let changeAmountNew = (discountLastMoneyNew + otherMoney).toFixed(2)-0
+ if(deposit) {
+ changeAmountNew = (changeAmountNew - deposit).toFixed(2)-0
+ }
+ this.$nextTick(() => {
+ changeAmountNew = this.prefixNo === 'CGDD' || this.prefixNo === 'XSDD'?0:changeAmountNew
+ this.form.setFieldsValue({'discount':discountNew,'discountLastMoney':discountLastMoneyNew,
+ 'changeAmount':changeAmountNew,'debt':0})
+ this.setZeroChangeAmount()
+ });
+ },
+ //其它费用
+ onChangeOtherMoney(e) {
+ const value = e.target.value-0
+ let discountLastMoney = this.form.getFieldValue('discountLastMoney')-0
+ let deposit = this.form.getFieldValue('deposit')
+ let changeAmountNew = (discountLastMoney + value).toFixed(2)-0
+ if(deposit) {
+ changeAmountNew = (changeAmountNew - deposit).toFixed(2)-0
+ }
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'changeAmount':changeAmountNew, 'debt':0})
+ this.setZeroChangeAmount()
+ });
+ },
+ //改变扣除订金
+ onChangeDeposit(e){
+ const value = e.target.value-0
+ let discountLastMoney = this.form.getFieldValue('discountLastMoney')-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let changeAmountNew = (discountLastMoney + otherMoney).toFixed(2)-0
+ if(value) {
+ changeAmountNew = (changeAmountNew - value).toFixed(2)-0
+ }
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'changeAmount':changeAmountNew, 'debt':0})
+ this.setZeroChangeAmount()
+ });
+ },
+ //改变本次付款
+ onChangeChangeAmount(e) {
+ const value = e.target.value-0
+ let discountLastMoney = this.form.getFieldValue('discountLastMoney')-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let deposit = this.form.getFieldValue('deposit')
+ let debtNew = (discountLastMoney + otherMoney - value).toFixed(2)-0
+ if(deposit) {
+ debtNew = (debtNew - deposit).toFixed(2)-0
+ }
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'debt':debtNew})
+ });
+ },
+ //切换客户信息改变商品单价
+ handleOrganChange(value) {
+ let organId = value
+ this.getAllTable().then(tables => {
+ return getListData(this.form, tables)
+ }).then(allValues => {
+ let detailArr = allValues.tablesValue[0].values
+ let barCodeStr = ''
+ for(let detail of detailArr){
+ if(detail.barCode) {
+ barCodeStr += detail.barCode + ','
+ }
+ }
+ if(barCodeStr) {
+ let param = {
+ barCode: barCodeStr,
+ organId: organId,
+ mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
+ prefixNo: this.prefixNo
+ }
+ getMaterialByBarCode(param).then((res) => {
+ if (res && res.code === 200) {
+ let allLastMoney = 0
+ let allTaxLastMoney = 0
+ //获取单据明细列表信息
+ let detailArr = allValues.tablesValue[0].values
+ //构造新的列表数组,用于存放单据明细信息
+ let newDetailArr = []
+ for(let detail of detailArr){
+ if(detail.barCode) {
+ //如果条码重复,就在给原来的数量加1
+ let mList = res.data
+ for (let i = 0; i < mList.length; i++) {
+ if(detail.barCode === mList[i].mBarCode) {
+ //由于改变了商品单价,需要同时更新相关金额和价税合计
+ let taxRate = detail.taxRate-0 //税率
+ detail.unitPrice = mList[i].billPrice-0 //单价
+ detail.allPrice = (detail.unitPrice*detail.operNumber).toFixed(2)-0
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (detail.allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ detail.taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ detail.taxLastMoney = detail.allPrice
+ } else {
+ detail.taxMoney = ((taxRate*0.01)*detail.allPrice).toFixed(2)-0
+ detail.taxLastMoney = (detail.allPrice + detail.taxMoney).toFixed(2)-0
+ }
+ }
+ }
+ newDetailArr.push(detail)
+ }
+ }
+ this.materialTable.dataSource = newDetailArr
+ //更新优惠后金额、本次付款等信息
+ for(let newDetail of newDetailArr){
+ allLastMoney = allLastMoney + (newDetail.allPrice-0)
+ allTaxLastMoney = allTaxLastMoney + (newDetail.taxLastMoney-0)
+ }
+ let discount = this.form.getFieldValue('discount')-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let deposit = this.form.getFieldValue('deposit')
+ let discountMoney = (discount*0.01*allTaxLastMoney).toFixed(2)-0
+ let discountLastMoney = (allTaxLastMoney-discountMoney).toFixed(2)-0
+ let changeAmountNew = (discountLastMoney + otherMoney).toFixed(2)-0
+ if(deposit) {
+ changeAmountNew = (changeAmountNew - deposit).toFixed(2)-0
+ }
+ this.$nextTick(() => {
+ changeAmountNew = this.prefixNo === 'XSDD'?0:changeAmountNew
+ this.form.setFieldsValue({'discount':discount,'discountMoney':discountMoney,'discountLastMoney':discountLastMoney,
+ 'changeAmount':changeAmountNew,'debt':0})
+ this.setZeroChangeAmount()
+ });
+ }
+ })
+ }
+ })
+ },
+ //切换收付款的金额为0
+ setZeroChangeAmount() {
+ if(this.prefixNo === 'CGRK'||this.prefixNo === 'CGTH'||this.prefixNo === 'XSCK'||this.prefixNo === 'XSTH') {
+ if(this.zeroChangeAmountFlag) {
+ let oldChangeAmount = this.form.getFieldValue('changeAmount')-0
+ this.form.setFieldsValue({'changeAmount':0, 'debt':oldChangeAmount})
+ }
+ }
+ },
+ scanEnter() {
+ this.scanStatus = false
+ this.$nextTick(() => {
+ this.$refs.scanBarCode.focus()
+ })
+ },
+ //扫码之后回车
+ scanPressEnter() {
+ let that = this
+ if(this.scanBarCode) {
+ this.getAllTable().then(tables => {
+ return getListData(this.form, tables)
+ }).then(allValues => {
+ let param = {
+ barCode: this.scanBarCode.trim(),
+ organId: this.form.getFieldValue('organId'),
+ mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
+ prefixNo: this.prefixNo
+ }
+ getMaterialByBarCode(param).then((res) => {
+ if (res && res.code === 200) {
+ let hasFinished = false
+ let allLastMoney = 0
+ let allTaxLastMoney = 0
+ //获取单据明细列表信息
+ let detailArr = allValues.tablesValue[0].values
+ //构造新的列表数组,用于存放单据明细信息
+ let newDetailArr = []
+ let hasAdd = false
+ for(let detail of detailArr){
+ if(detail.barCode) {
+ //如果扫码结果和条码重复,就在给原来的数量加1
+ if(detail.barCode === this.scanBarCode.trim() && !hasAdd) {
+ detail.operNumber = (detail.operNumber-0)+1
+ //由于改变了商品数量,需要同时更新相关金额和价税合计
+ let taxRate = detail.taxRate-0 //税率
+ let unitPrice = detail.unitPrice-0 //单价
+ detail.allPrice = (unitPrice*detail.operNumber).toFixed(2)-0
+ if(this.materialPriceTaxFlag) {
+ let realAllPrice = (detail.allPrice/(1+taxRate*0.01)).toFixed(2)-0
+ detail.taxMoney = (realAllPrice*taxRate*0.01).toFixed(2)-0
+ detail.taxLastMoney = detail.allPrice
+ } else {
+ detail.taxMoney = ((taxRate*0.01)*detail.allPrice).toFixed(2)-0
+ detail.taxLastMoney = (detail.allPrice + detail.taxMoney).toFixed(2)-0
+ }
+ hasFinished = true
+ hasAdd = true
+ }
+ //如果扫码结果和序列号重复,就直接跳过
+ if(detail.snList === this.scanBarCode.trim()) {
+ this.$message.warning('抱歉,已经扫描过该序列号!');
+ hasFinished = true
+ }
+ newDetailArr.push(detail)
+ }
+ }
+ if(!hasFinished) {
+ //将扫码的条码对应的商品加入列表
+ let item = {}
+ let mList = res.data
+ if(mList && mList.length>0) {
+ let mInfo = mList[0]
+ this.changeColumnShow(mInfo)
+ item.depotId = mInfo.depotId
+ item.barCode = mInfo.mBarCode
+ item.name = mInfo.name
+ item.standard = mInfo.standard
+ item.model = mInfo.model
+ item.color = mInfo.color
+ item.materialOther = mInfo.materialOther
+ item.stock = mInfo.stock
+ item.unit = mInfo.commodityUnit
+ item.sku = mInfo.sku
+ if(mInfo.mBarCode !== this.scanBarCode.trim()) {
+ if(this.prefixNo ==='LSCK' || this.prefixNo ==='CGTH' || this.prefixNo ==='XSCK' || this.prefixNo ==='QTCK') {
+ //此时给序列号赋值
+ item.snList = this.scanBarCode.trim()
+ }
+ }
+ item.operNumber = 1
+ item.unitPrice = mInfo.billPrice
+ item.allPrice = mInfo.billPrice
+ item.taxRate = mInfo.taxRate
+ item.taxMoney = mInfo.taxMoney
+ item.taxLastMoney = mInfo.taxLastMoney
+ newDetailArr.push(item)
+ } else {
+ this.$message.warning('抱歉,此条码不存在商品信息!');
+ }
+ }
+ //组合和拆分单据给商品类型进行重新赋值
+ for(let i=0; i< newDetailArr.length; i++) {
+ if(i===0) {
+ newDetailArr[0].mType = '组合件'
+ } else {
+ newDetailArr[i].mType = '普通子件'
+ }
+ }
+ this.materialTable.dataSource = newDetailArr
+ //更新优惠后金额、本次付款等信息
+ for(let newDetail of newDetailArr){
+ allLastMoney = allLastMoney + (newDetail.allPrice-0)
+ allTaxLastMoney = allTaxLastMoney + (newDetail.taxLastMoney-0)
+ }
+ let discount = this.form.getFieldValue('discount')-0
+ let otherMoney = this.form.getFieldValue('otherMoney')?this.form.getFieldValue('otherMoney')-0:0
+ let deposit = this.form.getFieldValue('deposit')
+ let discountMoney = (discount*0.01*allTaxLastMoney).toFixed(2)-0
+ let discountLastMoney = (allTaxLastMoney-discountMoney).toFixed(2)-0
+ let changeAmountNew = (discountLastMoney + otherMoney).toFixed(2)-0
+ if(deposit) {
+ changeAmountNew = (changeAmountNew - deposit).toFixed(2)-0
+ }
+ if(this.prefixNo === 'LSCK' || this.prefixNo === 'LSTH') {
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'changeAmount':allLastMoney,'getAmount':allLastMoney,'backAmount':0})
+ });
+ } else {
+ this.$nextTick(() => {
+ changeAmountNew = this.prefixNo === 'CGDD' || this.prefixNo === 'XSDD'?0:changeAmountNew
+ this.form.setFieldsValue({'discount':discount,'discountMoney':discountMoney,'discountLastMoney':discountLastMoney,
+ 'changeAmount':changeAmountNew,'debt':0})
+ });
+ }
+ //置空扫码的内容
+ this.scanBarCode = ''
+ this.$refs.scanBarCode.focus()
+ //自动下滑到最后一行
+ setTimeout(function(){
+ that.$refs.materialDataTable.resetScrollTop((newDetailArr.length+1)*that.$refs.materialDataTable.rowHeight)
+ },1000)
+ }
+ })
+ })
+ }
+ },
+ stopScan() {
+ this.scanStatus = true
+ this.scanBarCode = ''
+ },
+ onImport(prefixNo) {
+ this.$refs.importItemModalForm.add(prefixNo);
+ },
+ importItemModalFormOk(data) {
+ this.materialTable.dataSource = data
+ this.$nextTick(() => {
+ let discountLastMoney = 0
+ for (let i = 0; i < data.length; i++) {
+ discountLastMoney += data[i].taxLastMoney
+ this.changeColumnShow(data[i])
+ }
+ let changeAmount = 0
+ let debt = 0
+ if(this.prefixNo === 'CGRK' || this.prefixNo === 'XSCK') {
+ if(this.zeroChangeAmountFlag) {
+ changeAmount = 0
+ debt = discountLastMoney
+ } else {
+ changeAmount = discountLastMoney
+ debt = 0
+ }
+ }
+ this.form.setFieldsValue({'discountLastMoney':discountLastMoney, 'changeAmount':changeAmount, 'debt': debt})
+ });
+ },
+ //保存并审核
+ handleOkAndCheck() {
+ this.billStatus = '1'
+ this.handleOk()
+ },
+ //仅保存
+ handleOkOnly() {
+ this.billStatus = '0'
+ this.handleOk()
+ },
+ //发起流程
+ handleWorkflow() {
+ if(this.model && this.model.number) {
+ getPlatformConfigByKey({ "platformKey": "send_workflow_url" }).then((res) => {
+ if (res && res.code === 200) {
+ let sendWorkflowUrl = res.data.platformValue + '&no=' + this.model.number + '&type=1'
+ this.$refs.modalWorkflow.show(this.model, sendWorkflowUrl, this.model.number, 1, 320)
+ this.$refs.modalWorkflow.title = "发起流程"
+ }
+ })
+ } else {
+ this.$message.warning('请先保存单据后再提交流程!');
+ }
+ },
+ //三联打印新版
+ handlePrintPro(billType) {
+ if(this.model.id) {
+ getPlatformConfigByKey({"platformKey": "bill_print_pro_url"}).then((res)=> {
+ if (res && res.code === 200) {
+ let billPrintUrl = res.data.platformValue + '&no=' + this.model.number
+ let billPrintHeight = document.documentElement.clientHeight - 260
+ this.$refs.modalPrintPro.show(this.model, billPrintUrl, billPrintHeight)
+ this.$refs.modalPrintPro.title = billType + "-三联打印-新版"
+ }
+ })
+ } else {
+ this.$message.warning('请先保存单据后再打印!');
+ }
+ },
+ //三联打印
+ handlePrint(billType) {
+ if(this.model.id) {
+ getPlatformConfigByKey({"platformKey": "bill_print_url"}).then((res)=> {
+ if (res && res.code === 200) {
+ let billPrintUrl = res.data.platformValue + '&no=' + this.model.number
+ let billPrintHeight = this.materialTable.dataSource.length*50 + 600
+ this.$refs.modalPrint.show(this.model, billPrintUrl, billPrintHeight)
+ this.$refs.modalPrint.title = billType + "-三联打印"
+ }
+ })
+ } else {
+ this.$message.warning('请先保存单据后再打印!');
+ }
+ },
+ //加载平台配置信息
+ initPlatform() {
+ getPlatformConfigByKey({"platformKey": "bill_print_flag"}).then((res)=> {
+ if (res && res.code === 200) {
+ this.billPrintFlag = res.data.platformValue==='1'?true:false
+ }
+ })
+ },
+ //加载快捷按钮:供应商、客户、会员、结算账户、仓库
+ initQuickBtn() {
+ let btnStrList = Vue.ls.get('winBtnStrList') //按钮功能列表 JSON字符串
+ if (btnStrList) {
+ for (let i = 0; i < btnStrList.length; i++) {
+ if (btnStrList[i].btnStr) {
+ this.quickBtn.vendor = btnStrList[i].url === '/system/vendor'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.vendor
+ this.quickBtn.customer = btnStrList[i].url === '/system/customer'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.customer
+ this.quickBtn.member = btnStrList[i].url === '/system/member'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.member
+ this.quickBtn.account = btnStrList[i].url === '/system/account'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.account
+ this.quickBtn.depot = btnStrList[i].url === '/system/depot'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.depot
+ }
+ }
+ }
+ },
+ //动态替换扩展字段
+ handleChangeOtherField() {
+ let mpStr = getMpListShort(Vue.ls.get('materialPropertyList'))
+ if(mpStr) {
+ let mpArr = mpStr.split(',')
+ if(mpArr.length ===3) {
+ for (let i = 0; i < this.materialTable.columns.length; i++) {
+ if(this.materialTable.columns[i].key === 'otherField1') {
+ this.materialTable.columns[i].title = mpArr[0]
+ }
+ if(this.materialTable.columns[i].key === 'otherField2') {
+ this.materialTable.columns[i].title = mpArr[1]
+ }
+ if(this.materialTable.columns[i].key === 'otherField3') {
+ this.materialTable.columns[i].title = mpArr[2]
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/views/bill/modules/AllocationOutModal.vue b/src/views/bill/modules/AllocationOutModal.vue
new file mode 100644
index 0000000..559ac95
--- /dev/null
+++ b/src/views/bill/modules/AllocationOutModal.vue
@@ -0,0 +1,275 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/AssembleModal.vue b/src/views/bill/modules/AssembleModal.vue
new file mode 100644
index 0000000..69bea47
--- /dev/null
+++ b/src/views/bill/modules/AssembleModal.vue
@@ -0,0 +1,291 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/DisassembleModal.vue b/src/views/bill/modules/DisassembleModal.vue
new file mode 100644
index 0000000..0ff3912
--- /dev/null
+++ b/src/views/bill/modules/DisassembleModal.vue
@@ -0,0 +1,290 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/OtherInModal.vue b/src/views/bill/modules/OtherInModal.vue
new file mode 100644
index 0000000..9bc9cce
--- /dev/null
+++ b/src/views/bill/modules/OtherInModal.vue
@@ -0,0 +1,358 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addSupplier">
新增供应商
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+ 导入明细
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/OtherOutModal.vue b/src/views/bill/modules/OtherOutModal.vue
new file mode 100644
index 0000000..286e144
--- /dev/null
+++ b/src/views/bill/modules/OtherOutModal.vue
@@ -0,0 +1,358 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addCustomer">
新增客户
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+ 导入明细
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/PurchaseApplyModal.vue b/src/views/bill/modules/PurchaseApplyModal.vue
new file mode 100644
index 0000000..2634986
--- /dev/null
+++ b/src/views/bill/modules/PurchaseApplyModal.vue
@@ -0,0 +1,296 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+ 历史单据
+
+
+
+ 导入明细
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/PurchaseBackModal.vue b/src/views/bill/modules/PurchaseBackModal.vue
new file mode 100644
index 0000000..d973f0f
--- /dev/null
+++ b/src/views/bill/modules/PurchaseBackModal.vue
@@ -0,0 +1,481 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addSupplier">
新增供应商
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/PurchaseInModal.vue b/src/views/bill/modules/PurchaseInModal.vue
new file mode 100644
index 0000000..934d101
--- /dev/null
+++ b/src/views/bill/modules/PurchaseInModal.vue
@@ -0,0 +1,546 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addSupplier">
新增供应商
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+ 历史单据
+
+
+
+ 导入明细
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/PurchaseOrderModal.vue b/src/views/bill/modules/PurchaseOrderModal.vue
new file mode 100644
index 0000000..8ea4bef
--- /dev/null
+++ b/src/views/bill/modules/PurchaseOrderModal.vue
@@ -0,0 +1,484 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addSupplier">
新增供应商
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+ 历史单据
+
+
+
+ 导入明细
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/RetailBackModal.vue b/src/views/bill/modules/RetailBackModal.vue
new file mode 100644
index 0000000..327aaf6
--- /dev/null
+++ b/src/views/bill/modules/RetailBackModal.vue
@@ -0,0 +1,457 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addMember">
新增会员
+
e.preventDefault()" @click="initRetail(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 单据金额
+
+
+
+
+
+ 付款金额
+
+
+
+
+
+ 找零
+
+
+
+
+
+ 付款账户
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/RetailOutModal.vue b/src/views/bill/modules/RetailOutModal.vue
new file mode 100644
index 0000000..646c6fb
--- /dev/null
+++ b/src/views/bill/modules/RetailOutModal.vue
@@ -0,0 +1,447 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addMember">
新增会员
+
e.preventDefault()" @click="initRetail(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.text }}
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 单据金额
+
+
+
+
+
+ 收款金额
+
+
+
+
+
+ 找零
+
+
+
+
+
+ 收款账户
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/SaleBackModal.vue b/src/views/bill/modules/SaleBackModal.vue
new file mode 100644
index 0000000..95148ab
--- /dev/null
+++ b/src/views/bill/modules/SaleBackModal.vue
@@ -0,0 +1,492 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addCustomer">
新增客户
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/SaleOrderModal.vue b/src/views/bill/modules/SaleOrderModal.vue
new file mode 100644
index 0000000..f9c42a7
--- /dev/null
+++ b/src/views/bill/modules/SaleOrderModal.vue
@@ -0,0 +1,391 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addCustomer">
新增客户
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+ 历史单据
+
+
+
+ 导入明细
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bill/modules/SaleOutModal.vue b/src/views/bill/modules/SaleOutModal.vue
new file mode 100644
index 0000000..f0b1b5a
--- /dev/null
+++ b/src/views/bill/modules/SaleOutModal.vue
@@ -0,0 +1,564 @@
+
+
+
+ 取消
+ 三联打印-新版
+ 三联打印
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addCustomer">
新增客户
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 扫码录入
+
+
+
+
+
+ 收起扫码
+
+
+
+
+ 历史单据
+
+
+
+ 导入明细
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initDepot">
刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount(0)">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/dashboard/Analysis.vue b/src/views/dashboard/Analysis.vue
new file mode 100644
index 0000000..5d73c71
--- /dev/null
+++ b/src/views/dashboard/Analysis.vue
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/dashboard/IndexChart.vue b/src/views/dashboard/IndexChart.vue
new file mode 100644
index 0000000..e7e29e7
--- /dev/null
+++ b/src/views/dashboard/IndexChart.vue
@@ -0,0 +1,328 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/exception/403.vue b/src/views/exception/403.vue
new file mode 100644
index 0000000..e9fc399
--- /dev/null
+++ b/src/views/exception/403.vue
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/exception/404.vue b/src/views/exception/404.vue
new file mode 100644
index 0000000..bc747b5
--- /dev/null
+++ b/src/views/exception/404.vue
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/exception/500.vue b/src/views/exception/500.vue
new file mode 100644
index 0000000..a36cabe
--- /dev/null
+++ b/src/views/exception/500.vue
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/exception/ExceptionPage.vue b/src/views/exception/ExceptionPage.vue
new file mode 100644
index 0000000..0550d5e
--- /dev/null
+++ b/src/views/exception/ExceptionPage.vue
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
{{ config[type].title }}
+
{{ config[type].desc }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/exception/type.js b/src/views/exception/type.js
new file mode 100644
index 0000000..3fc7b1f
--- /dev/null
+++ b/src/views/exception/type.js
@@ -0,0 +1,19 @@
+const types = {
+ 403: {
+ img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
+ title: '403',
+ desc: '抱歉,你无权访问该页面'
+ },
+ 404: {
+ img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
+ title: '404',
+ desc: '抱歉,你访问的页面不存在或仍在开发中'
+ },
+ 500: {
+ img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
+ title: '500',
+ desc: '抱歉,服务器出错了'
+ }
+}
+
+export default types
\ No newline at end of file
diff --git a/src/views/financial/AdvanceInList.vue b/src/views/financial/AdvanceInList.vue
new file mode 100644
index 0000000..d678f3c
--- /dev/null
+++ b/src/views/financial/AdvanceInList.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initRetail(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/GiroList.vue b/src/views/financial/GiroList.vue
new file mode 100644
index 0000000..56d6ffa
--- /dev/null
+++ b/src/views/financial/GiroList.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/ItemInList.vue b/src/views/financial/ItemInList.vue
new file mode 100644
index 0000000..34eabb1
--- /dev/null
+++ b/src/views/financial/ItemInList.vue
@@ -0,0 +1,250 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/ItemOutList.vue b/src/views/financial/ItemOutList.vue
new file mode 100644
index 0000000..cb388f1
--- /dev/null
+++ b/src/views/financial/ItemOutList.vue
@@ -0,0 +1,250 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/MoneyInList.vue b/src/views/financial/MoneyInList.vue
new file mode 100644
index 0000000..a31b9f6
--- /dev/null
+++ b/src/views/financial/MoneyInList.vue
@@ -0,0 +1,271 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initCustomer(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
待收款({{waitTotal}})
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/MoneyOutList.vue b/src/views/financial/MoneyOutList.vue
new file mode 100644
index 0000000..f69c639
--- /dev/null
+++ b/src/views/financial/MoneyOutList.vue
@@ -0,0 +1,270 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier(0)">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+ 未审核
+ 审核中
+ 已审核
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
待付款({{waitTotal}})
+
删除
+
审核
+
反审核
+
导出
+
+
+
+
+
+
+
+
+ 查看
+
+ 编辑
+
+ myHandleDelete(record)">
+ 删除
+
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/dialog/DebtBillList.vue b/src/views/financial/dialog/DebtBillList.vue
new file mode 100644
index 0000000..f49bcfc
--- /dev/null
+++ b/src/views/financial/dialog/DebtBillList.vue
@@ -0,0 +1,241 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+ {{record.number}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/dialog/FinancialDetail.vue b/src/views/financial/dialog/FinancialDetail.vue
new file mode 100644
index 0000000..1de6c71
--- /dev/null
+++ b/src/views/financial/dialog/FinancialDetail.vue
@@ -0,0 +1,571 @@
+
+
+
+ 取消(ESC)
+
+ 打印
+ 打印
+ 打印
+ 打印
+ 打印
+ 打印
+
+ 反审核
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.handsPersonName}}
+
+
+
+
+ {{model.billTimeStr}}
+
+
+
+
+ {{model.billNo}}
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.totalPrice}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.handsPersonName}}
+
+
+
+
+ {{model.billTimeStr}}
+
+
+
+
+ {{model.billNo}}
+
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.handsPersonName}}
+
+
+
+
+ {{model.billTimeStr}}
+
+
+
+
+ {{model.billNo}}
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.handsPersonName}}
+
+
+
+
+ {{model.billTimeStr}}
+
+
+
+
+ {{model.billNo}}
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.handsPersonName}}
+
+
+
+
+ {{model.billTimeStr}}
+
+
+
+
+ {{model.billNo}}
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.totalPrice}}
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{model.organName}}
+
+
+
+
+ {{model.handsPersonName}}
+
+
+
+
+ {{model.billTimeStr}}
+
+
+
+
+ {{model.billNo}}
+
+
+
+
+
+
+
+
+ {{model.remark}}
+
+
+
+
+
+
+ {{model.accountName}}
+
+
+
+
+ {{model.totalPrice}}
+
+
+
+
+ {{model.discountMoney}}
+
+
+
+
+ {{model.changeAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/dialog/WaitNeedList.vue b/src/views/financial/dialog/WaitNeedList.vue
new file mode 100644
index 0000000..16929f0
--- /dev/null
+++ b/src/views/financial/dialog/WaitNeedList.vue
@@ -0,0 +1,245 @@
+
+
+
+
+ 取消(ESC)
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+ {{actionType}}
+
+
+
+ 注意:具体欠款详情,请到报表查询 中的{{organType}}对账 查看
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/mixins/FinancialListMixin.js b/src/views/financial/mixins/FinancialListMixin.js
new file mode 100644
index 0000000..555566c
--- /dev/null
+++ b/src/views/financial/mixins/FinancialListMixin.js
@@ -0,0 +1,264 @@
+import { findFinancialDetailByNumber, findBySelectSup, findBySelectCus, findBySelectOrgan, findBySelectRetail, getUserList, getPersonByType,
+ getAccount, getCurrentSystemConfig, getPlatformConfigByKey, findInOutItemByParam, getNeedCount } from '@/api/api'
+import { getCheckFlag, getFormatDate, getPrevMonthFormatDate } from '@/utils/util'
+import Vue from 'vue'
+import moment from 'moment'
+
+export const FinancialListMixin = {
+ data () {
+ return {
+ /* 原始审核是否开启 */
+ checkFlag: true,
+ /* 单据Excel是否开启 */
+ isShowExcel: false,
+ setTimeFlag: null,
+ billExcelUrl: '',
+ prefixNo: '',
+ waitTotal: 0,
+ supList: [],
+ cusList: [],
+ organList: [],
+ retailList: [],
+ userList: [],
+ personList: [],
+ accountList: [],
+ inOutItemList: [],
+ queryParam: {
+ beginTime: getPrevMonthFormatDate(3),
+ endTime: getFormatDate(),
+ createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())]
+ }
+ }
+ },
+ computed: {
+ importExcelUrl: function(){
+ return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+ },
+
+ isBatchDelEnabled: function () {
+ for (let i = 0; i < this.selectedRowKeys.length; i++) {
+ if (!this.selectionRows[i].actionsEnabled.delete) {
+ return false;
+ }
+ }
+ return true;
+ }
+ },
+ created() {
+ this.isShowExcel = Vue.ls.get('isShowExcel');
+ },
+ methods: {
+ myHandleAdd() {
+ this.$refs.modalForm.action = "add"
+ this.$refs.modalForm.actionWithOrgan = false
+ if(this.btnEnableList.indexOf(2)===-1) {
+ this.$refs.modalForm.isCanCheck = false
+ }
+ this.handleAdd();
+ },
+ myHandleAddWithOrgan() {
+ this.$refs.modalForm.action = "add"
+ this.$refs.modalForm.actionWithOrgan = true
+ if(this.btnEnableList.indexOf(2)===-1) {
+ this.$refs.modalForm.isCanCheck = false
+ }
+ this.handleAdd();
+ },
+ myHandleEdit(record) {
+ if(record.status === '0') {
+ this.$refs.modalForm.action = "edit";
+ if(this.btnEnableList.indexOf(2)===-1) {
+ this.$refs.modalForm.isCanCheck = false
+ }
+ //查询单条财务信息
+ findFinancialDetailByNumber({ billNo: record.billNo }).then((res) => {
+ if (res && res.code === 200) {
+ let item = res.data
+ this.handleEdit(item)
+ }
+ })
+ } else {
+ this.$message.warning("抱歉,只有未审核的单据才能编辑,请先进行反审核!")
+ }
+ },
+ myHandleDelete(record) {
+ if(record.status === '0') {
+ this.handleDelete(record.id)
+ } else {
+ this.$message.warning("抱歉,只有未审核的单据才能删除,请先进行反审核!")
+ }
+ },
+ myHandleDetail(record, type, prefixNo) {
+ if(this.btnEnableList.indexOf(7)===-1) {
+ this.$refs.modalDetail.isCanBackCheck = false
+ }
+ this.handleDetail(record, type, prefixNo);
+ },
+ handleApprove(record) {
+ this.$refs.modalForm.action = "approve";
+ this.$refs.modalForm.edit(record);
+ this.$refs.modalForm.title = "审核";
+ },
+ searchReset() {
+ this.queryParam = {
+ type: this.queryParam.type,
+ beginTime: getPrevMonthFormatDate(3),
+ endTime: getFormatDate(),
+ createTimeRange: [moment(getPrevMonthFormatDate(3)), moment(getFormatDate())]
+ }
+ this.loadData(1);
+ },
+ initSystemConfig() {
+ getCurrentSystemConfig().then((res) => {
+ if(res.code === 200 && res.data){
+ let multiBillType = res.data.multiBillType
+ let multiLevelApprovalFlag = res.data.multiLevelApprovalFlag
+ this.checkFlag = getCheckFlag(multiBillType, multiLevelApprovalFlag, this.prefixNo)
+ }
+ })
+ getPlatformConfigByKey({ "platformKey": "bill_excel_url" }).then((res) => {
+ if (res && res.code === 200) {
+ if(res.data.platformValue) {
+ this.billExcelUrl = res.data.platformValue
+ }
+ }
+ })
+ },
+ initSupplier() {
+ let that = this;
+ findBySelectSup({limit:1}).then((res)=>{
+ if(res) {
+ that.supList = res;
+ }
+ });
+ },
+ initCustomer() {
+ let that = this;
+ findBySelectCus({limit:1}).then((res)=>{
+ if(res) {
+ that.cusList = res;
+ }
+ });
+ },
+ initOrgan() {
+ let that = this;
+ findBySelectOrgan({limit:1}).then((res)=>{
+ if(res) {
+ that.organList = res;
+ }
+ });
+ },
+ initRetail() {
+ let that = this;
+ findBySelectRetail({limit:1}).then((res)=>{
+ if(res) {
+ that.retailList = res;
+ }
+ });
+ },
+ initUser() {
+ getUserList({}).then((res)=>{
+ if(res) {
+ this.userList = res;
+ }
+ });
+ },
+ initPerson() {
+ let that = this;
+ getPersonByType({type:'财务员'}).then((res)=>{
+ if(res && res.code === 200) {
+ that.personList = res.data.personList;
+ }
+ })
+ },
+ initAccount() {
+ getAccount({}).then((res)=>{
+ if(res && res.code === 200) {
+ this.accountList = res.data.accountList
+ }
+ })
+ },
+ initInOutItem(type) {
+ findInOutItemByParam({type:type}).then((res)=>{
+ if(res) {
+ this.inOutItemList = res
+ }
+ })
+ },
+ initGetNeedCount(type) {
+ getNeedCount({type: type}).then((res)=>{
+ if(res && res.code === 200) {
+ this.waitTotal = res.data.needCount
+ }
+ })
+ },
+ handleSearchSupplier(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectSup({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.supList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchCustomer(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectCus({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.cusList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchOrgan(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectOrgan({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.organList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchRetail(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectRetail({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.retailList = res;
+ }
+ })
+ },500)
+ },
+ onDateChange: function (value, dateString) {
+ this.queryParam.beginTime=dateString[0]
+ this.queryParam.endTime=dateString[1]
+ if(dateString[0] && dateString[1]) {
+ this.queryParam.createTimeRange = [moment(dateString[0]), moment(dateString[1])]
+ }
+ },
+ onDateOk(value) {
+ console.log(value);
+ },
+ //导出单据
+ handleExport() {
+ let search = this.getQueryParams().search
+ this.$refs.billExcelIframe.show(this.model, this.billExcelUrl + '?search=' + search + '&type=2', 150)
+ this.$refs.billExcelIframe.title = "确认导出"
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/views/financial/mixins/FinancialModalMixin.js b/src/views/financial/mixins/FinancialModalMixin.js
new file mode 100644
index 0000000..ff0c84f
--- /dev/null
+++ b/src/views/financial/mixins/FinancialModalMixin.js
@@ -0,0 +1,463 @@
+import {findBySelectSup,findBySelectCus,findBySelectRetail,findBySelectOrgan,getPlatformConfigByKey,getAccount,
+ getPersonByType,findInOutItemByParam,getCurrentSystemConfig} from '@/api/api'
+import { getAction } from '@/api/manage'
+import { getCheckFlag, getNowFormatDateTime } from "@/utils/util"
+import { USER_INFO } from "@/store/mutation-types"
+import Vue from 'vue'
+
+export const FinancialModalMixin = {
+ data() {
+ return {
+ action: '',
+ actionWithOrgan: false,
+ supList: [],
+ cusList: [],
+ retailList: [],
+ organList: [],
+ personList: [],
+ accountList: [],
+ billStatus: '0',
+ isCanCheck: true,
+ quickBtn: {
+ vendor: false,
+ customer: false,
+ account: false,
+ person: false,
+ inOutItem: false
+ },
+ /* 原始审核是否开启 */
+ checkFlag: true,
+ setTimeFlag: null,
+ spans: {
+ labelCol1: {span: 2},
+ wrapperCol1: {span: 22},
+ //1_5: 分为1.5列(相当于占了2/3)
+ labelCol1_5: { span: 3 },
+ wrapperCol1_5: { span: 21 },
+ labelCol2: {span: 4},
+ wrapperCol2: {span: 20},
+ labelCol3: {span: 6},
+ wrapperCol3: {span: 18},
+ labelCol6: {span: 12},
+ wrapperCol6: {span: 12}
+ },
+ };
+ },
+ created () {
+ let realScreenWidth = window.screen.width
+ this.width = realScreenWidth<1500?'1200px':'1550px'
+ this.minWidth = realScreenWidth<1500?1150:1500
+ },
+ mounted() {
+ document.getElementById(this.prefixNo).addEventListener('keydown', this.handleOkKey)
+ },
+ beforeDestroy() {
+ document.getElementById(this.prefixNo).removeEventListener('keydown', this.handleOkKey)
+ },
+ computed: {
+ readOnly: function() {
+ return this.action !== "add" && this.action !== "edit";
+ }
+ },
+ methods: {
+ // 快捷键
+ handleOkKey(e) {
+ const key = window.event.keyCode ? window.event.keyCode : window.event.which
+ if (key === 83 && e.ctrlKey) {
+ //保存 CTRL+S
+ this.handleOk()
+ e.preventDefault()
+ }
+ },
+ addInit(amountNum) {
+ getAction('/sequence/buildNumber').then((res) => {
+ if (res && res.code === 200) {
+ this.form.setFieldsValue({'billNo':amountNum + res.data.defaultNumber})
+ }
+ })
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'billTime':getNowFormatDateTime(), 'totalPrice': 0, 'discountMoney': 0, 'changeAmount': 0})
+ })
+ this.$nextTick(() => {
+ getAccount({}).then((res)=>{
+ if(res && res.code === 200) {
+ for (const item of res.data.accountList) {
+ if(item.isDefault){
+ this.form.setFieldsValue({'accountId': item.id})
+ }
+ }
+ }
+ })
+ })
+ },
+ initSystemConfig() {
+ getCurrentSystemConfig().then((res) => {
+ if(res.code === 200 && res.data){
+ let multiBillType = res.data.multiBillType
+ let multiLevelApprovalFlag = res.data.multiLevelApprovalFlag
+ this.checkFlag = getCheckFlag(multiBillType, multiLevelApprovalFlag, this.prefixNo)
+ }
+ })
+ },
+ initSupplier() {
+ let that = this;
+ findBySelectSup({organId: this.model.organId, limit:1}).then((res)=>{
+ if(res) {
+ that.supList = res;
+ }
+ });
+ },
+ initCustomer() {
+ let that = this;
+ findBySelectCus({organId: this.model.organId, limit:1}).then((res)=>{
+ if(res) {
+ that.cusList = res;
+ }
+ });
+ },
+ initOrgan() {
+ let that = this;
+ findBySelectOrgan({organId: this.model.organId, limit:1}).then((res)=>{
+ if(res) {
+ that.organList = res;
+ }
+ });
+ },
+ initRetail() {
+ let that = this;
+ findBySelectRetail({organId: this.model.organId, limit:1}).then((res)=>{
+ if(res) {
+ that.retailList = res;
+ }
+ });
+ },
+ initPerson() {
+ let that = this;
+ getPersonByType({type:'财务员'}).then((res)=>{
+ if(res && res.code === 200) {
+ that.personList = res.data.personList;
+ }
+ })
+ },
+ initInOutItem(type) {
+ let that = this;
+ findInOutItemByParam({type:type}).then((res)=>{
+ if(res) {
+ for(let item of that.accountTable.columns){
+ if(item.key == 'inOutItemId') {
+ item.options = []
+ for(let i=0; i{
+ if(res && res.code === 200) {
+ that.accountList = res.data.accountList;
+ }
+ })
+ },
+ //账户-用于明细
+ initDetailAccount(){
+ let that = this;
+ getAccount({}).then((res)=>{
+ if(res && res.code === 200) {
+ let list = res.data.accountList;
+ for(let item of that.accountTable.columns){
+ if(item.key == 'accountId') {
+ item.options = []
+ for(let i=0; i{
+ findBySelectSup({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.supList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchCustomer(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectCus({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.cusList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchOrgan(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectOrgan({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.organList = res;
+ }
+ })
+ },500)
+ },
+ handleSearchRetail(value) {
+ let that = this
+ if(this.setTimeFlag != null){
+ clearTimeout(this.setTimeFlag);
+ }
+ this.setTimeFlag = setTimeout(()=>{
+ findBySelectRetail({key: value, limit:1}).then((res) => {
+ if(res) {
+ that.retailList = res;
+ }
+ })
+ },500)
+ },
+ //选择供应商或客户的触发事件
+ onChangeOrgan(value) {
+ this.accountTable.dataSource = []
+ },
+ addSupplier() {
+ this.$refs.vendorModalForm.add();
+ this.$refs.vendorModalForm.title = "新增";
+ this.$refs.vendorModalForm.disableSubmit = false;
+ },
+ addCustomer() {
+ this.$refs.customerModalForm.add();
+ this.$refs.customerModalForm.title = "新增客户(提醒:如果找不到新添加的客户,请到用户管理检查是否分配了该客户权限)";
+ this.$refs.customerModalForm.disableSubmit = false;
+ },
+ addAccount() {
+ this.$refs.accountModalForm.add();
+ this.$refs.accountModalForm.title = "新增结算账户";
+ this.$refs.accountModalForm.disableSubmit = false;
+ },
+ addPerson() {
+ this.$refs.personModalForm.add();
+ this.$refs.personModalForm.title = "新增经手人";
+ this.$refs.personModalForm.disableSubmit = false;
+ },
+ addInOutItem(type) {
+ this.$refs.inOutItemModalForm.add(type);
+ this.$refs.inOutItemModalForm.title = "新增收支项目";
+ this.$refs.inOutItemModalForm.disableSubmit = false;
+ },
+ vendorModalFormOk() {
+ this.initSupplier()
+ },
+ customerModalFormOk() {
+ this.initCustomer()
+ },
+ accountModalFormOk() {
+ this.initAccount()
+ },
+ personModalFormOk() {
+ this.initPerson()
+ },
+ inOutItemModalFormOk(type) {
+ this.initInOutItem(type)
+ },
+ workflowModalFormOk() {
+ this.close()
+ },
+ waitNeedListOk(organType, organId, selectBillRows) {
+ if(organId) {
+ this.form.setFieldsValue({'organId': organId})
+ if(organType === '供应商') {
+ findBySelectSup({organId: organId, limit:1}).then((res)=> {
+ this.supList = res && Array.isArray(res) ? res : [];
+ })
+ } else if(organType === '客户') {
+ findBySelectCus({organId: organId, limit:1}).then((res)=> {
+ this.cusList = res && Array.isArray(res) ? res : [];
+ })
+ }
+ }
+ if (selectBillRows && selectBillRows.length > 0) {
+ this.requestSubTableDataEx(selectBillRows, this.accountTable);
+ } else {
+ this.selectBeginNeed(organType)
+ }
+ },
+ onAdded(event) {
+ let that = this
+ const { row, target } = event
+ //自动下滑到最后一行
+ setTimeout(function(){
+ that.$refs.accountDataTable.resetScrollTop((target.rows.length+1)*that.$refs.accountDataTable.rowHeight)
+ },1000)
+ },
+ //删除一行或多行的时候触发
+ onDeleted(ids, target) {
+ target.recalcAllStatisticsColumns()
+ this.autoChangeAmount(target)
+ },
+ //单元值改变一个字符就触发一次
+ onValueChange(event) {
+ let that = this
+ const { type, row, column, value, target } = event
+ switch(column.key) {
+ case "eachAmount":
+ target.recalcAllStatisticsColumns()
+ that.autoChangeAmount(target)
+ break;
+ }
+ },
+ //改变本次欠款的值
+ autoChangeAmount(target) {
+ let allEachAmount = target.statisticsColumns.eachAmount-0
+ let discountMoney = this.form.getFieldValue('discountMoney')-0
+ if(!discountMoney) {
+ discountMoney = 0
+ }
+ let changeAmount = (allEachAmount-discountMoney).toFixed(2)
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'totalPrice':allEachAmount, 'changeAmount':changeAmount})
+ });
+ },
+ //改变优惠金额
+ onChangeDiscountMoney(e) {
+ const value = e.target.value-0
+ let totalPrice = this.form.getFieldValue('totalPrice')-0
+ let changeAmount = (totalPrice-value).toFixed(2)
+ this.$nextTick(() => {
+ this.form.setFieldsValue({'changeAmount':changeAmount})
+ });
+ },
+ //选择欠款单据
+ debtBillListOk(selectBillRows) {
+ if(selectBillRows && selectBillRows.length>0) {
+ this.requestSubTableDataEx(selectBillRows, this.accountTable);
+ }
+ },
+ /** 查询某个tab的数据,给明细里面的金额赋值 */
+ requestSubTableDataEx(selectBillRows, tab, success) {
+ tab.loading = true
+ let listEx = []
+ let changeAmount = 0
+ for(let i=0; i {
+ this.form.setFieldsValue({'totalPrice':changeAmount.toFixed(2), 'changeAmount':changeAmount.toFixed(2)})
+ });
+ typeof success === 'function' ? success(res) : ''
+ tab.loading = false
+ },
+ //选择期初
+ selectBeginNeed(type) {
+ let that = this
+ let info = type === '供应商'? '付款':'收款'
+ let organId = this.form.getFieldValue('organId')
+ if(organId){
+ this.$confirm({
+ title: "确认操作",
+ content: "是否选择期初金额,对期初进行" + info + "?",
+ onOk: function () {
+ let listEx = []
+ let info = {}
+ info.billNumber = 'QiChu'
+ getAction('/supplier/getBeginNeedByOrganId', {'organId': organId}).then((res)=>{
+ if(res.code === 200){
+ info.needDebt = res.data.needDebt?res.data.needDebt:0
+ info.finishDebt = res.data.finishDebt
+ info.eachAmount = res.data.eachAmount
+ listEx.push(info)
+ that.accountTable.dataSource = listEx
+ let changeAmount = info.eachAmount
+ if(changeAmount) {
+ changeAmount = changeAmount.toFixed(2)
+ }
+ that.$nextTick(() => {
+ that.form.setFieldsValue({'totalPrice':changeAmount, 'changeAmount':changeAmount})
+ })
+ }else{
+ that.$message.info(res.data)
+ }
+ })
+ }
+ })
+ } else {
+ that.$message.warning('请选择' + type + '!');
+ }
+ },
+ //选择-待收款或者待付款
+ handleWaitNeed(type) {
+ this.$refs.waitNeedList.show(type)
+ },
+ //保存并审核
+ handleOkAndCheck() {
+ this.billStatus = '1'
+ this.handleOk()
+ },
+ //仅保存
+ handleOkOnly() {
+ this.billStatus = '0'
+ this.handleOk()
+ },
+ //发起流程
+ handleWorkflow() {
+ if(this.model && this.model.billNo) {
+ getPlatformConfigByKey({ "platformKey": "send_workflow_url" }).then((res) => {
+ if (res && res.code === 200) {
+ let sendWorkflowUrl = res.data.platformValue + '&no=' + this.model.billNo + '&type=2'
+ this.$refs.modalWorkflow.show(this.model, sendWorkflowUrl, this.model.billNo, 2, 320)
+ this.$refs.modalWorkflow.title = "发起流程"
+ }
+ })
+ } else {
+ this.$message.warning('请先保存单据后再提交流程!');
+ }
+ },
+ //加载快捷按钮:供应商、客户、结算账户、经手人
+ initQuickBtn() {
+ let btnStrList = Vue.ls.get('winBtnStrList') //按钮功能列表 JSON字符串
+ if (btnStrList) {
+ for (let i = 0; i < btnStrList.length; i++) {
+ if (btnStrList[i].btnStr) {
+ this.quickBtn.vendor = btnStrList[i].url === '/system/vendor'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.vendor
+ this.quickBtn.customer = btnStrList[i].url === '/system/customer'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.customer
+ this.quickBtn.account = btnStrList[i].url === '/system/account'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.account
+ this.quickBtn.person = btnStrList[i].url === '/system/person'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.person
+ this.quickBtn.inOutItem = btnStrList[i].url === '/system/in_out_item'?btnStrList[i].btnStr.indexOf(1)>-1:this.quickBtn.inOutItem
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/views/financial/modules/AdvanceInModal.vue b/src/views/financial/modules/AdvanceInModal.vue
new file mode 100644
index 0000000..65e7e18
--- /dev/null
+++ b/src/views/financial/modules/AdvanceInModal.vue
@@ -0,0 +1,251 @@
+
+
+
+ 取消
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initRetail">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addPerson">
新增经手人
+
e.preventDefault()" @click="initPerson">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/modules/GiroModal.vue b/src/views/financial/modules/GiroModal.vue
new file mode 100644
index 0000000..8b4b1c8
--- /dev/null
+++ b/src/views/financial/modules/GiroModal.vue
@@ -0,0 +1,265 @@
+
+
+
+ 取消
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addPerson">
新增经手人
+
e.preventDefault()" @click="initPerson">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/modules/ItemInModal.vue b/src/views/financial/modules/ItemInModal.vue
new file mode 100644
index 0000000..d9df4e7
--- /dev/null
+++ b/src/views/financial/modules/ItemInModal.vue
@@ -0,0 +1,287 @@
+
+
+
+ 取消
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addPerson">
新增经手人
+
e.preventDefault()" @click="initPerson">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initInOutItem('in')">
刷新列表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/modules/ItemOutModal.vue b/src/views/financial/modules/ItemOutModal.vue
new file mode 100644
index 0000000..d671e41
--- /dev/null
+++ b/src/views/financial/modules/ItemOutModal.vue
@@ -0,0 +1,288 @@
+
+
+
+ 取消
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addPerson">
新增经手人
+
e.preventDefault()" @click="initPerson">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+ e.preventDefault()" @click="initInOutItem('out')">
刷新列表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/modules/MoneyInModal.vue b/src/views/financial/modules/MoneyInModal.vue
new file mode 100644
index 0000000..c5d37fe
--- /dev/null
+++ b/src/views/financial/modules/MoneyInModal.vue
@@ -0,0 +1,321 @@
+
+
+
+ 取消
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addCustomer">
新增客户
+
e.preventDefault()" @click="initCustomer">
刷新
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addPerson">
新增经手人
+
e.preventDefault()" @click="initPerson">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+ 选择单据
+
+
+ 选择期初
+
+
+
+
+
+
+ 待收款
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/financial/modules/MoneyOutModal.vue b/src/views/financial/modules/MoneyOutModal.vue
new file mode 100644
index 0000000..951206d
--- /dev/null
+++ b/src/views/financial/modules/MoneyOutModal.vue
@@ -0,0 +1,328 @@
+
+
+
+ 取消
+ 保存并审核
+ 保存(Ctrl+S)
+
+ 提交流程
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addSupplier">
新增供应商
+
e.preventDefault()" @click="initSupplier">
刷新
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addPerson">
新增经手人
+
e.preventDefault()" @click="initPerson">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+ 选择单据
+
+
+ 选择期初
+
+
+
+
+
+
+ 待付款
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addAccount">
新增
+
e.preventDefault()" @click="initAccount">
刷新
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/MaterialAttributeList.vue b/src/views/material/MaterialAttributeList.vue
new file mode 100644
index 0000000..1d9b244
--- /dev/null
+++ b/src/views/material/MaterialAttributeList.vue
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/MaterialCategoryList.vue b/src/views/material/MaterialCategoryList.vue
new file mode 100644
index 0000000..c6657b3
--- /dev/null
+++ b/src/views/material/MaterialCategoryList.vue
@@ -0,0 +1,520 @@
+
+
+
+
+
+
+
+ 添加类别
+ 批量删除
+ 刷新
+
+
+
+
+ 当前选择:
{{ getCurrSelectedTitle() }}
+
取消选择
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请先选择一个类别!
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/MaterialList.vue b/src/views/material/MaterialList.vue
new file mode 100644
index 0000000..20c61d9
--- /dev/null
+++ b/src/views/material/MaterialList.vue
@@ -0,0 +1,545 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
启用
+
禁用
+
导入
+
导出
+
批量编辑
+
修正库存
+
修正成本
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+ 列设置
+
+
+
+
+
+
+ 编辑
+
+ 复制
+
+
+
+
+
+
+
+
+
+
+
+
+ {{record.mBarCode}}
+
+
+ {{record.name}}
+ 序
+ 批
+
+
+
+ {{text}}
+
+
+
+
+ {{text}}
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/MaterialPropertyList.vue b/src/views/material/MaterialPropertyList.vue
new file mode 100644
index 0000000..ff7c689
--- /dev/null
+++ b/src/views/material/MaterialPropertyList.vue
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/modules/BatchSetInfoModal.vue b/src/views/material/modules/BatchSetInfoModal.vue
new file mode 100644
index 0000000..14f45d4
--- /dev/null
+++ b/src/views/material/modules/BatchSetInfoModal.vue
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/modules/BatchSetPriceModal.vue b/src/views/material/modules/BatchSetPriceModal.vue
new file mode 100644
index 0000000..1298e83
--- /dev/null
+++ b/src/views/material/modules/BatchSetPriceModal.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/modules/BatchSetStockModal.vue b/src/views/material/modules/BatchSetStockModal.vue
new file mode 100644
index 0000000..c172698
--- /dev/null
+++ b/src/views/material/modules/BatchSetStockModal.vue
@@ -0,0 +1,101 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/modules/MaterialAttributeModal.vue b/src/views/material/modules/MaterialAttributeModal.vue
new file mode 100644
index 0000000..5b4ef63
--- /dev/null
+++ b/src/views/material/modules/MaterialAttributeModal.vue
@@ -0,0 +1,225 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+ handleClose(tag)">
+ {{ tag }}
+
+
+
+
+ 请输入属性值
+
+
+
+
+ 注意:属性值请用竖线隔开,比如:红色|橙色|黄色|绿色
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/modules/MaterialCategoryModal.vue b/src/views/material/modules/MaterialCategoryModal.vue
new file mode 100644
index 0000000..9192778
--- /dev/null
+++ b/src/views/material/modules/MaterialCategoryModal.vue
@@ -0,0 +1,178 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/modules/MaterialModal.vue b/src/views/material/modules/MaterialModal.vue
new file mode 100644
index 0000000..9d518c4
--- /dev/null
+++ b/src/views/material/modules/MaterialModal.vue
@@ -0,0 +1,1359 @@
+
+
+
+ 取消
+ 保存(Ctrl+S)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="addUnit">
新增多单位
+
+
+ {{ item.name }}
+
+
+
+
+ 多单位
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+
+
+ 有
+ 无
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initMaterialAttribute">没找到?点此刷新列表
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ 采购价-批量
+ 零售价-批量
+ 销售价-批量
+ 最低售价-批量
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 期初库存-批量
+ 最低安全库存-批量
+ 最高安全库存-批量
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 图片最多4张,且单张大小不超过1M
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/material/modules/MaterialPropertyModal.vue b/src/views/material/modules/MaterialPropertyModal.vue
new file mode 100644
index 0000000..fb1963b
--- /dev/null
+++ b/src/views/material/modules/MaterialPropertyModal.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+ {{model.nativeName}}
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/AccountReport.vue b/src/views/report/AccountReport.vue
new file mode 100644
index 0000000..e2d81c1
--- /dev/null
+++ b/src/views/report/AccountReport.vue
@@ -0,0 +1,210 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+
+
+
+ 本月发生总额:{{allMonthAmount}},当前总余额:{{allCurrentAmount}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+ {{record.id?'流水':''}}
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/AllocationDetail.vue b/src/views/report/AllocationDetail.vue
new file mode 100644
index 0000000..3d35f41
--- /dev/null
+++ b/src/views/report/AllocationDetail.vue
@@ -0,0 +1,377 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 总数量:{{operNumberTotalStr}},总金额:{{allPriceTotalStr}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+ {{record.number}}
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/BuyInReport.vue b/src/views/report/BuyInReport.vue
new file mode 100644
index 0000000..5e0a5a9
--- /dev/null
+++ b/src/views/report/BuyInReport.vue
@@ -0,0 +1,363 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 实际采购金额:{{realityPriceTotal}}
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/CustomerAccount.vue b/src/views/report/CustomerAccount.vue
new file mode 100644
index 0000000..96c24d9
--- /dev/null
+++ b/src/views/report/CustomerAccount.vue
@@ -0,0 +1,311 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initCustomer">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ {{firstTotal}} {{lastTotal}}
+
+
+
+
+
+
+
+
+ 有欠款
+ 无欠款
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+ {{record.id?'详情':''}}
+
+
+ 期末应收
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/InDetail.vue b/src/views/report/InDetail.vue
new file mode 100644
index 0000000..983307f
--- /dev/null
+++ b/src/views/report/InDetail.vue
@@ -0,0 +1,414 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 总数量:{{operNumberTotalStr}},总金额:{{allPriceTotalStr}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+ {{record.number}}
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/InMaterialCount.vue b/src/views/report/InMaterialCount.vue
new file mode 100644
index 0000000..4a6e26f
--- /dev/null
+++ b/src/views/report/InMaterialCount.vue
@@ -0,0 +1,354 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 入库总数量:{{numSumTotalStr}},入库总金额:{{priceSumTotalStr}}
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/InOutStockReport.vue b/src/views/report/InOutStockReport.vue
new file mode 100644
index 0000000..cb13aec
--- /dev/null
+++ b/src/views/report/InOutStockReport.vue
@@ -0,0 +1,369 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 本期总结存:{{totalStockStr}},总结存金额:{{totalCountMoneyStr}}
+
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{record.id?'分布':''}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{text}}
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/MaterialStock.vue b/src/views/report/MaterialStock.vue
new file mode 100644
index 0000000..b58632d
--- /dev/null
+++ b/src/views/report/MaterialStock.vue
@@ -0,0 +1,369 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 总库存:{{currentStock}},总库存金额:{{currentStockPrice}},总重量:{{currentWeight}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 隐藏
+ 显示
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/OutDetail.vue b/src/views/report/OutDetail.vue
new file mode 100644
index 0000000..f349cb5
--- /dev/null
+++ b/src/views/report/OutDetail.vue
@@ -0,0 +1,414 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 总数量:{{operNumberTotalStr}},总金额:{{allPriceTotalStr}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+ {{record.number}}
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/OutMaterialCount.vue b/src/views/report/OutMaterialCount.vue
new file mode 100644
index 0000000..8508399
--- /dev/null
+++ b/src/views/report/OutMaterialCount.vue
@@ -0,0 +1,355 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 出库总数量:{{numSumTotalStr}},出库总金额:{{priceSumTotalStr}}
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initOrgan">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/RetailOutReport.vue b/src/views/report/RetailOutReport.vue
new file mode 100644
index 0000000..56dbcdc
--- /dev/null
+++ b/src/views/report/RetailOutReport.vue
@@ -0,0 +1,366 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 实际零售金额:{{realityPriceTotal}}
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initRetail">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/SaleOutReport.vue b/src/views/report/SaleOutReport.vue
new file mode 100644
index 0000000..c5ee8e2
--- /dev/null
+++ b/src/views/report/SaleOutReport.vue
@@ -0,0 +1,366 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ 实际销售金额:{{realityPriceTotal}}
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initCustomer">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/StockWarningReport.vue b/src/views/report/StockWarningReport.vue
new file mode 100644
index 0000000..25b167d
--- /dev/null
+++ b/src/views/report/StockWarningReport.vue
@@ -0,0 +1,260 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ depot.depotName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/VendorAccount.vue b/src/views/report/VendorAccount.vue
new file mode 100644
index 0000000..233f220
--- /dev/null
+++ b/src/views/report/VendorAccount.vue
@@ -0,0 +1,311 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
e.preventDefault()" @click="initSupplier">
刷新列表
+
+
+ {{ item.supplier }}
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+ {{firstTotal}} {{lastTotal}}
+
+
+
+
+
+
+
+
+ 有欠款
+ 无欠款
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+ {{record.id?'详情':''}}
+
+
+ 期末应付
+
+
+
+
+
+
+
+
+
+ {{ props.value-1 }}条/页
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/modules/AccountInOutList.vue b/src/views/report/modules/AccountInOutList.vue
new file mode 100644
index 0000000..2eec39e
--- /dev/null
+++ b/src/views/report/modules/AccountInOutList.vue
@@ -0,0 +1,286 @@
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+ 导出
+
+
+
+
+
+
+
+ {{record.number}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 恢复默认列配置:恢复默认
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/modules/DebtAccountList.vue b/src/views/report/modules/DebtAccountList.vue
new file mode 100644
index 0000000..ebecae6
--- /dev/null
+++ b/src/views/report/modules/DebtAccountList.vue
@@ -0,0 +1,209 @@
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 打印
+ 导出
+ {{historyText}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/modules/HistoryFinancialList.vue b/src/views/report/modules/HistoryFinancialList.vue
new file mode 100644
index 0000000..44529ae
--- /dev/null
+++ b/src/views/report/modules/HistoryFinancialList.vue
@@ -0,0 +1,233 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+ 未审核
+ 已审核
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{text}}
+
+
+ 未审核
+ 已审核
+ 审核中
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/modules/MaterialDepotStockList.vue b/src/views/report/modules/MaterialDepotStockList.vue
new file mode 100644
index 0000000..c5b7268
--- /dev/null
+++ b/src/views/report/modules/MaterialDepotStockList.vue
@@ -0,0 +1,126 @@
+
+
+
+
+ 取消(ESC)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/modules/MaterialDepotStockListWithTime.vue b/src/views/report/modules/MaterialDepotStockListWithTime.vue
new file mode 100644
index 0000000..bc21801
--- /dev/null
+++ b/src/views/report/modules/MaterialDepotStockListWithTime.vue
@@ -0,0 +1,132 @@
+
+
+
+
+ 取消(ESC)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/report/modules/MaterialInOutList.vue b/src/views/report/modules/MaterialInOutList.vue
new file mode 100644
index 0000000..9840e70
--- /dev/null
+++ b/src/views/report/modules/MaterialInOutList.vue
@@ -0,0 +1,202 @@
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+ 导出
+
+
+
+
+
+
+
+ {{record.number}}
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/AccountList.vue b/src/views/system/AccountList.vue
new file mode 100644
index 0000000..84c8c27
--- /dev/null
+++ b/src/views/system/AccountList.vue
@@ -0,0 +1,181 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ handleSetDefault(record.id)">
+ 设为默认
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+ 是
+ 否
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/CustomerList.vue b/src/views/system/CustomerList.vue
new file mode 100644
index 0000000..29f3f9b
--- /dev/null
+++ b/src/views/system/CustomerList.vue
@@ -0,0 +1,245 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
启用
+
禁用
+
导入
+
导出
+
+
+
+
+
+ 分配用户
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/DepotList.vue b/src/views/system/DepotList.vue
new file mode 100644
index 0000000..1d7c357
--- /dev/null
+++ b/src/views/system/DepotList.vue
@@ -0,0 +1,213 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 分配用户
+
+ handleSetDefault(record.id)">
+ 设为默认
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+ 是
+ 否
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/FunctionList.vue b/src/views/system/FunctionList.vue
new file mode 100644
index 0000000..9b4b0ac
--- /dev/null
+++ b/src/views/system/FunctionList.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/InOutItemList.vue b/src/views/system/InOutItemList.vue
new file mode 100644
index 0000000..4eef109
--- /dev/null
+++ b/src/views/system/InOutItemList.vue
@@ -0,0 +1,156 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请选择
+ 收入
+ 支出
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/LogList.vue b/src/views/system/LogList.vue
new file mode 100644
index 0000000..aa1e1ad
--- /dev/null
+++ b/src/views/system/LogList.vue
@@ -0,0 +1,206 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请选择
+ 试用租户
+ 付费租户
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/MemberList.vue b/src/views/system/MemberList.vue
new file mode 100644
index 0000000..dc71eae
--- /dev/null
+++ b/src/views/system/MemberList.vue
@@ -0,0 +1,231 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
启用
+
禁用
+
导入
+
导出
+
修正预付款
+
+
+
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/MsgList.vue b/src/views/system/MsgList.vue
new file mode 100644
index 0000000..cc3af50
--- /dev/null
+++ b/src/views/system/MsgList.vue
@@ -0,0 +1,171 @@
+
+
+
+
+ 关闭
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+ 全部标注已读
+
+
+
+
+
+
+
+
+ {{text}}
+ {{text}}
+
+
+ 查看
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/OrganizationList.vue b/src/views/system/OrganizationList.vue
new file mode 100644
index 0000000..3137377
--- /dev/null
+++ b/src/views/system/OrganizationList.vue
@@ -0,0 +1,525 @@
+
+
+
+
+
+
+
+ 添加机构
+ 批量删除
+ 刷新
+ 提示:机构可录入公司部门或门店
+
+
+
+
+ 当前选择:
{{ getCurrSelectedTitle() }}
+
取消选择
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请先选择一个机构!
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/PersonList.vue b/src/views/system/PersonList.vue
new file mode 100644
index 0000000..ea320df
--- /dev/null
+++ b/src/views/system/PersonList.vue
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请选择
+ 销售员
+ 财务员
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/PlatformConfigList.vue b/src/views/system/PlatformConfigList.vue
new file mode 100644
index 0000000..9ddd95b
--- /dev/null
+++ b/src/views/system/PlatformConfigList.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/PluginList.vue b/src/views/system/PluginList.vue
new file mode 100644
index 0000000..7f9d8a0
--- /dev/null
+++ b/src/views/system/PluginList.vue
@@ -0,0 +1,262 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+ 填写插件激活码
+ 填写手机端激活码
+
+
+
+
+
+
+
+
+
+
+ 请选择需要导入的插件jar包
+
+ 上传插件包
+
+
+
+
+
+
+
+ 上传页面
+
+ startPlugin(record.pluginDescriptor.pluginId)">
+ 开启
+
+
+ stopPlugin(record.pluginDescriptor.pluginId)">
+ 停止
+
+
+ uninstallPlugin(record.pluginDescriptor.pluginId)">
+ 卸载
+
+
+
+ {{linkUrl(record)}}
+
+
+ 启用
+ 停止
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/RoleList.vue b/src/views/system/RoleList.vue
new file mode 100644
index 0000000..5233e4e
--- /dev/null
+++ b/src/views/system/RoleList.vue
@@ -0,0 +1,240 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 分配功能
+
+ 分配按钮
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+ 保存角色已经操作成功!现在继续分配功能 吗?
+
+
+
+ 数据类型
+
+
+
+
+
+ 价格屏蔽
+
+
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+ 分配功能已经操作成功!现在继续分配按钮 吗?
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/SystemConfigList.vue b/src/views/system/SystemConfigList.vue
new file mode 100644
index 0000000..45db3bc
--- /dev/null
+++ b/src/views/system/SystemConfigList.vue
@@ -0,0 +1,542 @@
+
+
+
+
+
+
+
+
基本资料
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
配置信息
+
+
+
+
+ (启用后,需要到用户管理 进行分配仓库 ,针对专人管理仓库的场景)
+
+
+
+
+
+ (启用后,需要到用户管理 进行分配客户 ,针对销售员只能看自己客户的场景)
+
+
+
+
+
+ (启用后,单据支持负库存 录入,不会再提示库存不足)
+
+
+
+
+
+ (启用后,根据销售订单 来定制采购订单 ,进货后再发给客户)
+
+
+
+
+
+ (启用后,允许当前单据超出关联单据 的商品数量进行出入库)
+
+
+
+
+
+ (启用后,会根据单据录入自动更新商品单价,默认是启用状态)
+
+
+
+
+
+ (启用后,只有已审核 的单据才能产生库存,涉及库存查询的相关报表。启用或关闭后需到商品管理 批量修正库存 ,请按实际业务谨慎操作)
+
+
+
+
+
+ (启用后,采购销售相关单据都需经过其它出入库 单据,才能产生库存。启用或关闭后需到商品管理 批量修正库存 ,请按实际业务谨慎操作)
+
+
+
+
+
+ (启用后,采购订单、采购入库、采购退货、销售订单、销售出库、销售退货等单据的结算账户可以进行多账户选择)
+
+
+
+
+
+ (默认为关闭状态,代表成本价等于商品信息页面录入的采购价。开启之后将通过移动平均来计算成本价,需到商品管理 批量修正成本 ,请按实际业务谨慎操作)
+
+
+
+
+
+ (启用后,零售管理、采购管理、销售管理和仓库管理下的单据,都需要先审核之后才能进行打印)
+
+
+
+
+
+ (启用后,销售出库单据新建时默认本次收款 为0,采购入库单据同理)
+
+
+
+
+
+ (启用后,客户的销售出库的单价不会从该客户历史单据的单价获取,而是只从商品信息获取)
+
+
+
+
+
+ (启用后,商品中录入的价格变成含税价格,在单据录入中包含了税额)
+
+
+
+
+
+
+
+ {{ item.value }}
+
+
+ (启用后,多级审核需配置流程,开启后需刷新浏览器才能看到效果)点此刷新
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/TenantList.vue b/src/views/system/TenantList.vue
new file mode 100644
index 0000000..0b9387e
--- /dev/null
+++ b/src/views/system/TenantList.vue
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 试用租户
+ 付费租户
+
+
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+
+
+ 试用租户
+ 付费租户
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/UnitList.vue b/src/views/system/UnitList.vue
new file mode 100644
index 0000000..f278068
--- /dev/null
+++ b/src/views/system/UnitList.vue
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/UserList.vue b/src/views/system/UserList.vue
new file mode 100644
index 0000000..56f1651
--- /dev/null
+++ b/src/views/system/UserList.vue
@@ -0,0 +1,198 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+
+
+
+
+
+
+
+
+
+
+ 分配仓库
+
+ 分配客户
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+ 重置密码
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/VendorList.vue b/src/views/system/VendorList.vue
new file mode 100644
index 0000000..7257b1f
--- /dev/null
+++ b/src/views/system/VendorList.vue
@@ -0,0 +1,204 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查询
+ 重置
+
+ {{ toggleSearchStatus ? '收起' : '展开' }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
新增
+
删除
+
启用
+
禁用
+
导入
+
导出
+
+
+
+
+
+ 编辑
+
+ handleDelete(record.id)">
+ 删除
+
+
+
+
+ 启用
+ 禁用
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/AccountModal.vue b/src/views/system/modules/AccountModal.vue
new file mode 100644
index 0000000..777b2a9
--- /dev/null
+++ b/src/views/system/modules/AccountModal.vue
@@ -0,0 +1,150 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/CustomerModal.vue b/src/views/system/modules/CustomerModal.vue
new file mode 100644
index 0000000..17d8f5a
--- /dev/null
+++ b/src/views/system/modules/CustomerModal.vue
@@ -0,0 +1,223 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/CustomerUserModal.vue b/src/views/system/modules/CustomerUserModal.vue
new file mode 100644
index 0000000..afa44a1
--- /dev/null
+++ b/src/views/system/modules/CustomerUserModal.vue
@@ -0,0 +1,172 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/DepotModal.vue b/src/views/system/modules/DepotModal.vue
new file mode 100644
index 0000000..f8b0a6e
--- /dev/null
+++ b/src/views/system/modules/DepotModal.vue
@@ -0,0 +1,170 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.userName }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/DepotUserModal.vue b/src/views/system/modules/DepotUserModal.vue
new file mode 100644
index 0000000..aa298ab
--- /dev/null
+++ b/src/views/system/modules/DepotUserModal.vue
@@ -0,0 +1,172 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/FunctionModal.vue b/src/views/system/modules/FunctionModal.vue
new file mode 100644
index 0000000..6d62bb5
--- /dev/null
+++ b/src/views/system/modules/FunctionModal.vue
@@ -0,0 +1,257 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/FunctionTreeModal.vue b/src/views/system/modules/FunctionTreeModal.vue
new file mode 100644
index 0000000..e2fc9b4
--- /dev/null
+++ b/src/views/system/modules/FunctionTreeModal.vue
@@ -0,0 +1,154 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/InOutItemModal.vue b/src/views/system/modules/InOutItemModal.vue
new file mode 100644
index 0000000..2eaf1aa
--- /dev/null
+++ b/src/views/system/modules/InOutItemModal.vue
@@ -0,0 +1,150 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+ 收入
+ 支出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/MemberModal.vue b/src/views/system/modules/MemberModal.vue
new file mode 100644
index 0000000..b50592e
--- /dev/null
+++ b/src/views/system/modules/MemberModal.vue
@@ -0,0 +1,182 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/OrganizationModal.vue b/src/views/system/modules/OrganizationModal.vue
new file mode 100644
index 0000000..e63a981
--- /dev/null
+++ b/src/views/system/modules/OrganizationModal.vue
@@ -0,0 +1,179 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/PersonModal.vue b/src/views/system/modules/PersonModal.vue
new file mode 100644
index 0000000..45ec1e7
--- /dev/null
+++ b/src/views/system/modules/PersonModal.vue
@@ -0,0 +1,151 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+ 销售员
+ 财务员
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/PlatformConfigModal.vue b/src/views/system/modules/PlatformConfigModal.vue
new file mode 100644
index 0000000..5217c25
--- /dev/null
+++ b/src/views/system/modules/PlatformConfigModal.vue
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/PluginAppModal.vue b/src/views/system/modules/PluginAppModal.vue
new file mode 100644
index 0000000..7f15dfc
--- /dev/null
+++ b/src/views/system/modules/PluginAppModal.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/PluginModal.vue b/src/views/system/modules/PluginModal.vue
new file mode 100644
index 0000000..5782603
--- /dev/null
+++ b/src/views/system/modules/PluginModal.vue
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/RoleFunctionModal.vue b/src/views/system/modules/RoleFunctionModal.vue
new file mode 100644
index 0000000..2a22428
--- /dev/null
+++ b/src/views/system/modules/RoleFunctionModal.vue
@@ -0,0 +1,219 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/RoleModal.vue b/src/views/system/modules/RoleModal.vue
new file mode 100644
index 0000000..fea3d9a
--- /dev/null
+++ b/src/views/system/modules/RoleModal.vue
@@ -0,0 +1,188 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+ 全部数据
+ 本机构数据
+ 个人数据
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/RolePushBtnModal.vue b/src/views/system/modules/RolePushBtnModal.vue
new file mode 100644
index 0000000..322350d
--- /dev/null
+++ b/src/views/system/modules/RolePushBtnModal.vue
@@ -0,0 +1,314 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{ !checked ? '全选' : '全取消' }}
+
+
+ {{ !editChecked ? '全选-编辑' : '全取消-编辑' }}
+
+
+ {{ !auditChecked ? '全选-审核' : '全取消-审核' }}
+
+
+ {{ !unAuditChecked ? '全选-反审核' : '全取消-反审核' }}
+
+
+ {{ !exportChecked ? '全选-导出' : '全取消-导出' }}
+
+
+
+
+
+
+
+
+
+
+ 编辑
+ 审核
+ 反审核
+ 导出
+ 启用禁用
+ 打印
+ 作废
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/TenantModal.vue b/src/views/system/modules/TenantModal.vue
new file mode 100644
index 0000000..fa67514
--- /dev/null
+++ b/src/views/system/modules/TenantModal.vue
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+
+
+
+ 试用租户
+ 付费租户
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/UnitModal.vue b/src/views/system/modules/UnitModal.vue
new file mode 100644
index 0000000..9904787
--- /dev/null
+++ b/src/views/system/modules/UnitModal.vue
@@ -0,0 +1,219 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+ =
+
+
+
+
+
+
+ =
+
+
+
+
+
+
+ =
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/UserCustomerModal.vue b/src/views/system/modules/UserCustomerModal.vue
new file mode 100644
index 0000000..04a7c35
--- /dev/null
+++ b/src/views/system/modules/UserCustomerModal.vue
@@ -0,0 +1,144 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/UserDepotModal.vue b/src/views/system/modules/UserDepotModal.vue
new file mode 100644
index 0000000..34a33d5
--- /dev/null
+++ b/src/views/system/modules/UserDepotModal.vue
@@ -0,0 +1,181 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/UserModal.vue b/src/views/system/modules/UserModal.vue
new file mode 100644
index 0000000..983d6bf
--- /dev/null
+++ b/src/views/system/modules/UserModal.vue
@@ -0,0 +1,222 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.name }}
+
+
+ {{ tenantRoleName }}
+
+
+
+
+
+
+
+
+
+
+ 是
+ 否
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/UserResetModal.vue b/src/views/system/modules/UserResetModal.vue
new file mode 100644
index 0000000..80ab3c0
--- /dev/null
+++ b/src/views/system/modules/UserResetModal.vue
@@ -0,0 +1,110 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/VendorModal.vue b/src/views/system/modules/VendorModal.vue
new file mode 100644
index 0000000..9e3092c
--- /dev/null
+++ b/src/views/system/modules/VendorModal.vue
@@ -0,0 +1,218 @@
+
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/system/modules/icon/Icon.less b/src/views/system/modules/icon/Icon.less
new file mode 100644
index 0000000..5e37187
--- /dev/null
+++ b/src/views/system/modules/icon/Icon.less
@@ -0,0 +1,35 @@
+@active-color: #4a4a48;
+ul {
+ max-height: 700px;
+ overflow-y: auto;
+ padding-left: .5rem;
+ i {
+ font-size: 1.5rem;
+ border: 1px solid #f1f1f1;
+ padding: .2rem;
+ margin: .3rem;
+ cursor: pointer;
+ &.active, &:hover {
+ border-radius: 2px;
+ border-color: @active-color;
+ background-color: @active-color;
+ color: #fff;
+ transition: all .3s;
+ }
+ }
+ li {
+ list-style: none;
+ float: left;
+ width: 5%;
+ text-align: center;
+ cursor: pointer;
+ color: #555;
+ transition: color .3s ease-in-out,background-color .3s ease-in-out;
+ position: relative;
+ margin: 3px 0;
+ border-radius: 4px;
+ background-color: #fff;
+ overflow: hidden;
+ padding: 10px 0 0;
+ }
+}
diff --git a/src/views/system/modules/icon/Icons.vue b/src/views/system/modules/icon/Icons.vue
new file mode 100644
index 0000000..4b18ced
--- /dev/null
+++ b/src/views/system/modules/icon/Icons.vue
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/user/Login.vue b/src/views/user/Login.vue
new file mode 100644
index 0000000..ce3fa38
--- /dev/null
+++ b/src/views/user/Login.vue
@@ -0,0 +1,506 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 记住密码
+
+ 注册租户
+
+
+
+
+ 登 录
+
+
+
+
+
+
+ © 2015-2030 Powered By
+ 官方网站
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/user/Register.vue b/src/views/user/Register.vue
new file mode 100644
index 0000000..1801369
--- /dev/null
+++ b/src/views/user/Register.vue
@@ -0,0 +1,363 @@
+
+
+
+
+
+
+
+
+
+
+
+
强度:{{ passwordLevelName }}
+
+
+ 请至少输入 6 个字符。请不要使用容易被猜到的密码。
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 注册租户
+
+ 使用已有租户登录
+
+
+
+
+
+ © 2015-2030 Powered By
+ 官方网站
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vue.config.js b/vue.config.js
new file mode 100644
index 0000000..2776216
--- /dev/null
+++ b/vue.config.js
@@ -0,0 +1,58 @@
+const path = require('path')
+const CompressionPlugin = require('compression-webpack-plugin')
+
+function resolve (dir) {
+ return path.join(__dirname, dir)
+}
+
+// vue.config.js
+module.exports = {
+ // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
+ productionSourceMap: false,
+ configureWebpack: config => {
+ // 生产环境取消 console.log
+ if (process.env.NODE_ENV === 'production') {
+ config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
+ }
+ },
+ chainWebpack: (config) => {
+ config.resolve.alias
+ .set('@$', resolve('src'))
+ .set('@api', resolve('src/api'))
+ .set('@assets', resolve('src/assets'))
+ .set('@comp', resolve('src/components'))
+ .set('@views', resolve('src/views'))
+ // 生产环境,开启js\css压缩
+ if (process.env.NODE_ENV === 'production') {
+ config.plugin('compressionPlugin').use(new CompressionPlugin({
+ test: /\.(js|css|less)$/, // 匹配文件名
+ threshold: 10240, // 对超过10k的数据压缩
+ deleteOriginalAssets: false // 删除源文件
+ }))
+ }
+ },
+ css: {
+ loaderOptions: {
+ less: {
+ modifyVars: {
+ /* less 变量覆盖,用于自定义 ant design 主题 */
+ 'primary-color': '#1890FF',
+ 'link-color': '#1890FF',
+ 'border-radius-base': '4px'
+ },
+ javascriptEnabled: true
+ }
+ }
+ },
+ devServer: {
+ port: 3001,
+ proxy: {
+ '/jshERP-boot': {
+ target: 'http://localhost:9999', // 请求本地 需要jshERP-boot后台项目
+ ws: false,
+ changeOrigin: true
+ }
+ }
+ },
+ lintOnSave: undefined
+}
diff --git a/yarn b/yarn
new file mode 100644
index 0000000..e69de29