this.ds is undefined

本文探讨了在开发过程中遇到的JS布局错误,并详细解释了如何通过引入store来解决问题。文章强调了store在实现数据管理和状态管理中的关键作用,以及在避免布局混乱时的重要性。同时,提供了一个简单的示例来展示store的正确使用方法。
	//fields end
    	InpatientViewPanel.superclass.constructor.call(this,{
    		region:"center",
    		height:400,
    		title:"医院住院病人信息",
    		viewConfig: {
    		        forceFit: true
    		},
    		//store:new Ext.data.Store({
    		//	fields:this.fields,
    		//	autoLoad:false,
    	//	//	url:"test.action"
    	//	}),
    		colModel:this.columnModel  
    	});

在之前只是想写一个页面暂时不写后台,但是这个时候出现一个错误this.ds is undefined,布局也是乱的,

后来才发现需要写一个store(注意上面注释的是在报错之前没有写) ,之后加上store后就OK了,随便写一个地址,autoLoad为false就好 了,


// prng4.js - uses Arcfour as a PRNG function Arcfour() { this.i = 0; this.j = 0; this.S = new Array(); } // Initialize arcfour context from key, an array of ints, each from [0..255] function ARC4init(key) { var i, j, t; for(i = 0; i < 256; ++i) this.S[i] = i; j = 0; for(i = 0; i < 256; ++i) { j = (j + this.S[i] + key[i % key.length]) & 255; t = this.S[i]; this.S[i] = this.S[j]; this.S[j] = t; } this.i = 0; this.j = 0; } function ARC4next() { var t; this.i = (this.i + 1) & 255; this.j = (this.j + this.S[this.i]) & 255; t = this.S[this.i]; this.S[this.i] = this.S[this.j]; this.S[this.j] = t; return this.S[(t + this.S[this.i]) & 255]; } Arcfour.prototype.init = ARC4init; Arcfour.prototype.next = ARC4next; // Plug in your RNG constructor here function prng_newstate() { return new Arcfour(); } // Pool size must be a multiple of 4 and greater than 32. // An array of bytes the size of the pool will be passed to init() var rng_psize = 256; var rng_state; var rng_pool; var rng_pptr; // Mix in a 32-bit integer into the pool function rng_seed_int(x) { rng_pool[rng_pptr++] ^= x & 255; rng_pool[rng_pptr++] ^= (x >> 8) & 255; rng_pool[rng_pptr++] ^= (x >> 16) & 255; rng_pool[rng_pptr++] ^= (x >> 24) & 255; if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; } // Mix in the current time (w/milliseconds) into the pool function rng_seed_time() { rng_seed_int(new Date().getTime()); } // Initialize the pool with junk if needed. if(rng_pool == null) { rng_pool = new Array(); rng_pptr = 0; var t; while(rng_pptr < rng_psize) { // extract some randomness from Math.random() t = Math.floor(65536 * Math.random()); rng_pool[rng_pptr++] = t >>> 8; rng_pool[rng_pptr++] = t & 255; } rng_pptr = 0; rng_seed_time(); //rng_seed_int(window.screenX); //rng_seed_int(window.screenY); } function rng_get_byte() { if(rng_state == null) { rng_seed_time(); rng_state = prng_newstate(); rng_state.init(rng_pool); for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) rng_pool[rng_pptr] = 0; rng_pptr = 0; //rng_pool = null; } // TODO: allow reseeding after first request return rng_state.next(); } function rng_get_bytes(ba) { var i; for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); } function SecureRandom() {} SecureRandom.prototype.nextBytes = rng_get_bytes; var dbits; // JavaScript engine analysis var canary = 0xdeadbeefcafe; var j_lm = ((canary&0xffffff)==0xefcafe); // (public) Constructor function BigInteger(a,b,c) { if(a != null) if("number" == typeof a) this.fromNumber(a,b,c); else if(b == null && "string" != typeof a) this.fromString(a,256); else this.fromString(a,b); } // return new, unset BigInteger function nbi() { return new BigInteger(null); } // am: Compute w_j += (x*this_i), propagate carries, // c is initial carry, returns final carry. // c < 3*dvalue, x < 2*dvalue, this_i < dvalue // We need to select the fastest one that works in this environment. // am1: use a single mult and divide to get the high bits, // max digit bits should be 26 because // max internal value = 2*dvalue^2-2*dvalue (< 2^53) function am1(i,x,w,j,c,n) { while(--n >= 0) { var v = x*this[i++]+w[j]+c; c = Math.floor(v/0x4000000); w[j++] = v&0x3ffffff; } return c; } // am2 avoids a big mult-and-extract completely. // Max digit bits should be <= 30 because we do bitwise ops // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) function am2(i,x,w,j,c,n) { var xl = x&0x7fff, xh = x>>15; while(--n >= 0) { var l = this[i]&0x7fff; var h = this[i++]>>15; var m = xh*l+h*xl; l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); w[j++] = l&0x3fffffff; } return c; } // Alternately, set max digit bits to 28 since some // browsers slow down when dealing with 32-bit numbers. function am3(i,x,w,j,c,n) { var xl = x&0x3fff, xh = x>>14; while(--n >= 0) { var l = this[i]&0x3fff; var h = this[i++]>>14; var m = xh*l+h*xl; l = xl*l+((m&0x3fff)<<14)+w[j]+c; c = (l>>28)+(m>>14)+xh*h; w[j++] = l&0xfffffff; } return c; } BigInteger.prototype.am = am3; dbits = 28; BigInteger.prototype.DB = dbits; BigInteger.prototype.DM = ((1<<dbits)-1); BigInteger.prototype.DV = (1<<dbits); var BI_FP = 52; BigInteger.prototype.FV = Math.pow(2,BI_FP); BigInteger.prototype.F1 = BI_FP-dbits; BigInteger.prototype.F2 = 2*dbits-BI_FP; // Digit conversions var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; var BI_RC = new Array(); var rr,vv; rr = "0".charCodeAt(0); for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv; rr = "a".charCodeAt(0); for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; rr = "A".charCodeAt(0); for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; function int2char(n) { return BI_RM.charAt(n); } function intAt(s,i) { var c = BI_RC[s.charCodeAt(i)]; return (c==null)?-1:c; } // (protected) copy this to r function bnpCopyTo(r) { for(var i = this.t-1; i >= 0; --i) r[i] = this[i]; r.t = this.t; r.s = this.s; } // (protected) set from integer value x, -DV <= x < DV function bnpFromInt(x) { this.t = 1; this.s = (x<0)?-1:0; if(x > 0) this[0] = x; else if(x < -1) this[0] = x+DV; else this.t = 0; } // return bigint initialized to value function nbv(i) { var r = nbi(); r.fromInt(i); return r; } // (protected) set from string and radix function bnpFromString(s,b) { var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 256) k = 8; // byte array else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else { this.fromRadix(s,b); return; } this.t = 0; this.s = 0; var i = s.length, mi = false, sh = 0; while(--i >= 0) { var x = (k==8)?s[i]&0xff:intAt(s,i); if(x < 0) { if(s.charAt(i) == "-") mi = true; continue; } mi = false; if(sh == 0) this[this.t++] = x; else if(sh+k > this.DB) { this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh; this[this.t++] = (x>>(this.DB-sh)); } else this[this.t-1] |= x<<sh; sh += k; if(sh >= this.DB) sh -= this.DB; } if(k == 8 && (s[0]&0x80) != 0) { this.s = -1; if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh; } this.clamp(); if(mi) BigInteger.ZERO.subTo(this,this); } // (protected) clamp off excess high words function bnpClamp() { var c = this.s&this.DM; while(this.t > 0 && this[this.t-1] == c) --this.t; } // (public) return string representation in given radix function bnToString(b) { if(this.s < 0) return "-"+this.negate().toString(b); var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else return this.toRadix(b); var km = (1<<k)-1, d, m = false, r = "", i = this.t; var p = this.DB-(i*this.DB)%k; if(i-- > 0) { if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } while(i >= 0) { if(p < k) { d = (this[i]&((1<<p)-1))<<(k-p); d |= this[--i]>>(p+=this.DB-k); } else { d = (this[i]>>(p-=k))&km; if(p <= 0) { p += this.DB; --i; } } if(d > 0) m = true; if(m) r += int2char(d); } } return m?r:"0"; } // (public) -this function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } // (public) |this| function bnAbs() { return (this.s<0)?this.negate():this; } // (public) return + if this > a, - if this < a, 0 if equal function bnCompareTo(a) { var r = this.s-a.s; if(r != 0) return r; var i = this.t; r = i-a.t; if(r != 0) return (this.s<0)?-r:r; while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; return 0; } // returns bit length of the integer x function nbits(x) { var r = 1, t; if((t=x>>>16) != 0) { x = t; r += 16; } if((t=x>>8) != 0) { x = t; r += 8; } if((t=x>>4) != 0) { x = t; r += 4; } if((t=x>>2) != 0) { x = t; r += 2; } if((t=x>>1) != 0) { x = t; r += 1; } return r; } // (public) return the number of bits in "this" function bnBitLength() { if(this.t <= 0) return 0; return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); } // (protected) r = this << n*DB function bnpDLShiftTo(n,r) { var i; for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; for(i = n-1; i >= 0; --i) r[i] = 0; r.t = this.t+n; r.s = this.s; } // (protected) r = this >> n*DB function bnpDRShiftTo(n,r) { for(var i = n; i < this.t; ++i) r[i-n] = this[i]; r.t = Math.max(this.t-n,0); r.s = this.s; } // (protected) r = this << n function bnpLShiftTo(n,r) { var bs = n%this.DB; var cbs = this.DB-bs; var bm = (1<<cbs)-1; var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i; for(i = this.t-1; i >= 0; --i) { r[i+ds+1] = (this[i]>>cbs)|c; c = (this[i]&bm)<<bs; } for(i = ds-1; i >= 0; --i) r[i] = 0; r[ds] = c; r.t = this.t+ds+1; r.s = this.s; r.clamp(); } // (protected) r = this >> n function bnpRShiftTo(n,r) { r.s = this.s; var ds = Math.floor(n/this.DB); if(ds >= this.t) { r.t = 0; return; } var bs = n%this.DB; var cbs = this.DB-bs; var bm = (1<<bs)-1; r[0] = this[ds]>>bs; for(var i = ds+1; i < this.t; ++i) { r[i-ds-1] |= (this[i]&bm)<<cbs; r[i-ds] = this[i]>>bs; } if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<<cbs; r.t = this.t-ds; r.clamp(); } // (protected) r = this - a function bnpSubTo(a,r) { var i = 0, c = 0, m = Math.min(a.t,this.t); while(i < m) { c += this[i]-a[i]; r[i++] = c&this.DM; c >>= this.DB; } if(a.t < this.t) { c -= a.s; while(i < this.t) { c += this[i]; r[i++] = c&this.DM; c >>= this.DB; } c += this.s; } else { c += this.s; while(i < a.t) { c -= a[i]; r[i++] = c&this.DM; c >>= this.DB; } c -= a.s; } r.s = (c<0)?-1:0; if(c < -1) r[i++] = this.DV+c; else if(c > 0) r[i++] = c; r.t = i; r.clamp(); } // (protected) r = this * a, r != this,a (HAC 14.12) // "this" should be the larger one if appropriate. function bnpMultiplyTo(a,r) { var x = this.abs(), y = a.abs(); var i = x.t; r.t = i+y.t; while(--i >= 0) r[i] = 0; for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); r.s = 0; r.clamp(); if(this.s != a.s) BigInteger.ZERO.subTo(r,r); } // (protected) r = this^2, r != this (HAC 14.16) function bnpSquareTo(r) { var x = this.abs(); var i = r.t = 2*x.t; while(--i >= 0) r[i] = 0; for(i = 0; i < x.t-1; ++i) { var c = x.am(i,x[i],r,2*i,0,1); if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { r[i+x.t] -= x.DV; r[i+x.t+1] = 1; } } if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); r.s = 0; r.clamp(); } // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) // r != q, this != m. q or r may be null. function bnpDivRemTo(m,q,r) { var pm = m.abs(); if(pm.t <= 0) return; var pt = this.abs(); if(pt.t < pm.t) { if(q != null) q.fromInt(0); if(r != null) this.copyTo(r); return; } if(r == null) r = nbi(); var y = nbi(), ts = this.s, ms = m.s; var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } var ys = y.t; var y0 = y[ys-1]; if(y0 == 0) return; var yt = y0*(1<<this.F1)+((ys>1)?y[ys-2]>>this.F2:0); var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2; var i = r.t, j = i-ys, t = (q==null)?nbi():q; y.dlShiftTo(j,t); if(r.compareTo(t) >= 0) { r[r.t++] = 1; r.subTo(t,r); } BigInteger.ONE.dlShiftTo(ys,t); t.subTo(y,y); // "negative" y so we can replace sub with am later while(y.t < ys) y[y.t++] = 0; while(--j >= 0) { // Estimate quotient digit var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out y.dlShiftTo(j,t); r.subTo(t,r); while(r[i] < --qd) r.subTo(t,r); } } if(q != null) { r.drShiftTo(ys,q); if(ts != ms) BigInteger.ZERO.subTo(q,q); } r.t = ys; r.clamp(); if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder if(ts < 0) BigInteger.ZERO.subTo(r,r); } // (public) this mod a function bnMod(a) { var r = nbi(); this.abs().divRemTo(a,null,r); if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); return r; } // Modular reduction using "classic" algorithm function Classic(m) { this.m = m; } function cConvert(x) { if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); else return x; } function cRevert(x) { return x; } function cReduce(x) { x.divRemTo(this.m,null,x); } function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } Classic.prototype.convert = cConvert; Classic.prototype.revert = cRevert; Classic.prototype.reduce = cReduce; Classic.prototype.mulTo = cMulTo; Classic.prototype.sqrTo = cSqrTo; // (protected) return "-1/this % 2^DB"; useful for Mont. reduction // justification: // xy == 1 (mod m) // xy = 1+km // xy(2-xy) = (1+km)(1-km) // x[y(2-xy)] = 1-k^2m^2 // x[y(2-xy)] == 1 (mod m^2) // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. // JS multiply "overflows" differently from C/C++, so care is needed here. function bnpInvDigit() { if(this.t < 1) return 0; var x = this[0]; if((x&1) == 0) return 0; var y = x&3; // y == 1/x mod 2^2 y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 // last step - calculate inverse mod DV directly; // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits // we really want the negative inverse, and -DV < y < DV return (y>0)?this.DV-y:-y; } // Montgomery reduction function Montgomery(m) { this.m = m; this.mp = m.invDigit(); this.mpl = this.mp&0x7fff; this.mph = this.mp>>15; this.um = (1<<(m.DB-15))-1; this.mt2 = 2*m.t; } // xR mod m function montConvert(x) { var r = nbi(); x.abs().dlShiftTo(this.m.t,r); r.divRemTo(this.m,null,r); if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); return r; } // x/R mod m function montRevert(x) { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } // x = x/R mod m (HAC 14.32) function montReduce(x) { while(x.t <= this.mt2) // pad x so am has enough room later x[x.t++] = 0; for(var i = 0; i < this.m.t; ++i) { // faster way of calculating u0 = x[i]*mp mod DV var j = x[i]&0x7fff; var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; // use am to combine the multiply-shift-add into one call j = i+this.m.t; x[j] += this.m.am(0,u0,x,i,0,this.m.t); // propagate carry while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } } x.clamp(); x.drShiftTo(this.m.t,x); if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); } // r = "x^2/R mod m"; x != r function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } // r = "xy/R mod m"; x,y != r function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } Montgomery.prototype.convert = montConvert; Montgomery.prototype.revert = montRevert; Montgomery.prototype.reduce = montReduce; Montgomery.prototype.mulTo = montMulTo; Montgomery.prototype.sqrTo = montSqrTo; // (protected) true iff this is even function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) function bnpExp(e,z) { if(e > 0xffffffff || e < 1) return BigInteger.ONE; var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; g.copyTo(r); while(--i >= 0) { z.sqrTo(r,r2); if((e&(1<<i)) > 0) z.mulTo(r2,g,r); else { var t = r; r = r2; r2 = t; } } return z.revert(r); } // (public) this^e % m, 0 <= e < 2^32 function bnModPowInt(e,m) { var z; if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); return this.exp(e,z); } // protected BigInteger.prototype.copyTo = bnpCopyTo; BigInteger.prototype.fromInt = bnpFromInt; BigInteger.prototype.fromString = bnpFromString; BigInteger.prototype.clamp = bnpClamp; BigInteger.prototype.dlShiftTo = bnpDLShiftTo; BigInteger.prototype.drShiftTo = bnpDRShiftTo; BigInteger.prototype.lShiftTo = bnpLShiftTo; BigInteger.prototype.rShiftTo = bnpRShiftTo; BigInteger.prototype.subTo = bnpSubTo; BigInteger.prototype.multiplyTo = bnpMultiplyTo; BigInteger.prototype.squareTo = bnpSquareTo; BigInteger.prototype.divRemTo = bnpDivRemTo; BigInteger.prototype.invDigit = bnpInvDigit; BigInteger.prototype.isEven = bnpIsEven; BigInteger.prototype.exp = bnpExp; // public BigInteger.prototype.toString = bnToString; BigInteger.prototype.negate = bnNegate; BigInteger.prototype.abs = bnAbs; BigInteger.prototype.compareTo = bnCompareTo; BigInteger.prototype.bitLength = bnBitLength; BigInteger.prototype.mod = bnMod; BigInteger.prototype.modPowInt = bnModPowInt; // "constants" BigInteger.ZERO = nbv(0); BigInteger.ONE = nbv(1); var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var b64pad="="; function hex2b64(h) { var i; var c; var ret = ""; for(i = 0; i+3 <= h.length; i+=3) { c = parseInt(h.substring(i,i+3),16); ret += b64map.charAt(c >> 6) + b64map.charAt(c & 63); } if(i+1 == h.length) { c = parseInt(h.substring(i,i+1),16); ret += b64map.charAt(c << 2); } else if(i+2 == h.length) { c = parseInt(h.substring(i,i+2),16); ret += b64map.charAt(c >> 2) + b64map.charAt((c & 3) << 4); } while((ret.length & 3) > 0) ret += b64pad; return ret; } // convert a base64 string to hex function b64tohex(s) { var ret = "" var i; var k = 0; // b64 state, 0-3 var slop; for(i = 0; i < s.length; ++i) { if(s.charAt(i) == b64pad) break; v = b64map.indexOf(s.charAt(i)); if(v < 0) continue; if(k == 0) { ret += int2char(v >> 2); slop = v & 3; k = 1; } else if(k == 1) { ret += int2char((slop << 2) | (v >> 4)); slop = v & 0xf; k = 2; } else if(k == 2) { ret += int2char(slop); ret += int2char(v >> 2); slop = v & 3; k = 3; } else { ret += int2char((slop << 2) | (v >> 4)); ret += int2char(v & 0xf); k = 0; } } if(k == 1) ret += int2char(slop << 2); return ret; } // convert a base64 string to a byte/number array function b64toBA(s) { //piggyback on b64tohex for now, optimize later var h = b64tohex(s); var i; var a = new Array(); for(i = 0; 2*i < h.length; ++i) { a[i] = parseInt(h.substring(2*i,2*i+2),16); } return a; } // Depends on jsbn.js and rng.js // Version 1.1: support utf-8 encoding in pkcs1pad2 // convert a (hex) string to a bignum object function parseBigInt(str,r) { return new BigInteger(str,r); } function linebrk(s,n) { var ret = ""; var i = 0; while(i + n < s.length) { ret += s.substring(i,i+n) + "\n"; i += n; } return ret + s.substring(i,s.length); } function byte2Hex(b) { if(b < 0x10) return "0" + b.toString(16); else return b.toString(16); } // PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint function pkcs1pad2(s,n) { if(n < s.length + 11) { // TODO: fix for utf-8 alert("Message too long for RSA"); return null; } var ba = new Array(); var i = s.length - 1; while(i >= 0 && n > 0) { var c = s.charCodeAt(i--); if(c < 128) { // encode using utf-8 ba[--n] = c; } else if((c > 127) && (c < 2048)) { ba[--n] = (c & 63) | 128; ba[--n] = (c >> 6) | 192; } else { ba[--n] = (c & 63) | 128; ba[--n] = ((c >> 6) & 63) | 128; ba[--n] = (c >> 12) | 224; } } ba[--n] = 0; var rng = new SecureRandom(); var x = new Array(); while(n > 2) { // random non-zero pad x[0] = 0; while(x[0] == 0) rng.nextBytes(x); ba[--n] = x[0]; } ba[--n] = 2; ba[--n] = 0; return new BigInteger(ba); } // "empty" RSA key constructor function RSAKey() { this.n = null; this.e = 0; this.d = null; this.p = null; this.q = null; this.dmp1 = null; this.dmq1 = null; this.coeff = null; } // Set the public key fields N and e from hex strings function RSASetPublic(N,E) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); } else alert("Invalid RSA public key"); } // Perform raw public operation on "x": return x^e (mod n) function RSADoPublic(x) { return x.modPowInt(this.e, this.n); } // Return the PKCS#1 RSA encryption of "text" as an even-length hex string function RSAEncrypt(text) { var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3); if(m == null) return null; var c = this.doPublic(m); if(c == null) return null; var h = c.toString(16); if((h.length & 1) == 0) return h; else return "0" + h; } // Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string //function RSAEncryptB64(text) { // var h = this.encrypt(text); // if(h) return hex2b64(h); else return null; //} // protected RSAKey.prototype.doPublic = RSADoPublic; // public RSAKey.prototype.setPublic = RSASetPublic; RSAKey.prototype.encrypt = RSAEncrypt; //RSAKey.prototype.encrypt_b64 = RSAEncryptB64; function jiami(mod,key){ var rsaKey = new RSAKey(); rsaKey.setPublic(b64tohex(mod), b64tohex(key)); var enPassword = hex2b64(rsaKey.encrypt("222222")); } jiami("AKOwMuspyLv1ikxYDimf6OgY/HmRJpFIrsrDrPt3twvBTdAjK9RduNIULmm0qfevprEUWnLC+o20k38acWrHAwIQTXuRflj16u4QyrDRScbWfqAaYs44Ls2Q3TghQJHajDlvWwLMLx0eeDZH75/MxHHSrEQJGJH9PYbY+6FJPRe/","AQAB"); -->Js运行成功! -->输出:undefined 怎么输出没有值
09-21
<template> <div class="app-container table-page-content"> <div class="search-container filter-container-v2" style="margin-bottom: 10px" > <!-- :model="formInline" --> <el-form ref="queryForm" :inline="true" label-position="top" size="mini"> <el-form-item v-for="(item, index) in searchItems" :key="item.name" :label="item.label" :prop="item.name" :rules="item.rules" :class=" item.type == 'daterange' ? 'search-form-item-double search-form-item-daterange' : 'search-form-item' " > <template slot="label"> {{ item.label }} </template> <!-- <template v-if="item.type == 'input'"> <el-input v-model.trim="formInline[item.name]" :placeholder="item.placeholder" maxlength="64" clearable @keyup.enter.native="() => handleFilter()" > <el-button v-if="!item.hideButton" slot="append" icon="el-icon-search" @click="() => handleFilter()" /> </el-input> </template> --> <!-- ip: undefined, type: undefined, dispatchType: undefined, status: undefined, --> <template v-if="item.type == 'input'"> <el-input v-model.trim="listQuery[item.name]" :placeholder="item.placeholder" maxlength="64" clearable > </el-input> </template> <!-- <template v-if="item.type == 'select'"> <el-select v-model="formInline[item.name]" :placeholder="item.placeholder" clearable @focus="handleSelectQueue(item.name)" :filterable="item.filterable ? true : false" > <template v-for="option in item.options"> <el-option :key="option.value" :label="option.label" :value="option.value" /> </template> </el-select> </template> --> <template v-if="item.type == 'select'"> <el-select v-model.trim="listQuery[item.name]" :placeholder="item.placeholder" clearable > <template v-for="option in item.options"> <el-option :key="option.value" :label="option.label" :value="option.value" /> </template> </el-select> </template> </el-form-item> <el-form-item class="search-btns"> <!-- <el-button type="primary" @click="() => handleFilter()" >查询</el-button > --> <el-button type="primary" @click="() => handleFilterItems()" >查询</el-button > <el-button plain @click="reset">重置</el-button> </el-form-item> </el-form> </div> <div class="filter-container"> <el-button v-if="switchBtnVisiable" v-waves style="margin-left: 10px" size="mini" class="filter-item" type="primary" icon="el-icon-plus" @click="handleCreate" >添加</el-button > <el-popconfirm v-if="switchBtnVisiable && startDispatchVisiable" icon="el-icon-info" confirm-button-text="确认" title="请确认是否开始调度?" @onConfirm="operate(1)" > <el-button v-waves slot="reference" style=" margin-left: 10px; padding-top: 7px !important; padding-bottom: 7px !important; " size="mini" class="filter-item" icon="el-icon-video-play" >开始调度</el-button > </el-popconfirm> <el-popconfirm v-if="switchBtnVisiable && closeDispatchVisiable" icon="el-icon-info" confirm-button-text="确认" title="确认停止调度?这将停止新增任务的派发,但不会影响当前执行中的任务。" @onConfirm="operate(2)" > <el-button v-waves slot="reference" style=" margin-left: 10px; padding-top: 7px !important; padding-bottom: 7px !important; " size="mini" class="filter-item" icon="el-icon-video-pause" type="warning" >停止调度</el-button > </el-popconfirm> <el-popconfirm v-if="switchBtnVisiable && closeDispatchVisiable" icon="el-icon-info" confirm-button-text="确认" title="确认停止调度及任务?这将停止新增任务的派发并终止当前所有执行中的任务,请谨慎操作!" @onConfirm="operate(3)" > <el-button v-waves slot="reference" style=" margin-left: 10px; padding-top: 7px !important; padding-bottom: 7px !important; " size="mini" class="filter-item" icon="el-icon-video-pause" type="danger" >停止调度及任务</el-button > </el-popconfirm> <el-button :disabled="refreshBtn" style=" margin-left: 10px; padding-top: 6px !important; padding-bottom: 6px !important; " size="mini" class="filter-item" @click="getList" ><icon-font icon="icon-dataopsshuaxin" style="font-size: 16px" /></el-button> </div> <div class="table-container"> <el-table v-loading="listLoading" :data="list" size="small" header-row-class-name="table-header" style="width: 100%;" height="100%" fit highlight-current-row @selection-change="handleSelectionChange" > <el-table-column type="selection" align="center"></el-table-column> <el-table-column label="执行器名称" align="center" prop="ip" min-width="115px" /> <el-table-column label="当前任务数" align="center" prop="runningCount" sortable width="110px" /> <el-table-column label="周期任务数" align="center" prop="cycleTaskCount" sortable width="110px" /> <el-table-column label="补数任务数" align="center" prop="dataTaskCount" sortable width="110px" /> <el-table-column label="SQL任务数" align="center" prop="sqlCount" sortable width="110px" /> <el-table-column label="脚本任务数" align="center" prop="scriptCount" sortable width="110px" /> <!-- <el-table-column label="IP" align="center" prop="ip" /> <el-table-column label="端口号" align="center" prop="jmxPort" width="100px" /> --> <el-table-column label="执行器类型" align="center" prop="type" width="120px" > <template slot-scope="scope"> {{ scope.row.type === "LT3_TASK" ? "LT3_TASK" : "" }} </template> </el-table-column> <el-table-column :filters="filters" :filter-method="filterHandler" label="脚本集群名称" align="center" prop="dispatchType" width="140px" > <template slot-scope="scope"> {{ dispatchTypeMap[scope.row.dispatchType] }} </template> </el-table-column> <el-table-column label="并发数" align="center" prop="taskParallel" width="140px" > <template slot-scope="scope"> {{ scope.row.taskParallel }} </template> </el-table-column> <!-- <el-table-column label="角色" align="center" width="120px"> <template slot-scope="scope"> <el-tag v-if="scope.row.executorState.leader === true" type="success" >Leader</el-tag > <el-tag v-if="scope.row.executorState.leader === false" type="success" >Member</el-tag > </template> </el-table-column> --> <el-table-column label="角色" align="center" width="120px"> <template slot-scope="scope"> <el-tag type="success">{{ scope.row.type }}</el-tag> </template> </el-table-column> <el-table-column label="运行状态" align="center" width="80px"> <template slot-scope="scope"> <el-tag v-if="scope.row.executorState.live === true" type="success" >运行</el-tag > <el-tag v-if="scope.row.executorState.live === false" type="danger" >异常</el-tag > </template> </el-table-column> <el-table-column label="是否启用" align="center" width="80px"> <template slot-scope="scope"> <el-popconfirm v-if="switchBtnVisiable" :title="`请确认是否${ scope.row.status ? '停用' : '启用' }当前执行器`" icon="el-icon-info" confirm-button-text="确认" @onConfirm="handleUpdateState(scope.row)" > <el-switch slot="reference" :disabled="true" :width="30" v-model="scope.row.status" :active-value="true" :inactive-value="false" class="el-switch-mini" /> </el-popconfirm> <span v-else>{{ scope.row.status ? "启用" : "停用" }}</span> </template> </el-table-column> <el-table-column label="操作" align="center" class-name="small-padding" width="145px" fixed="right" > <template slot-scope="scope"> <el-button v-if="scope.row.executorState.live == true" type="text" size="mini" @click="checkRunTaskList(scope.row.id, scope.row.ip)" >详情</el-button > <el-button v-if="switchBtnVisiable" type="text" size="mini" @click="handleUpdate(scope.row)" >编辑</el-button > <ds-pop-comfirm v-if="switchBtnVisiable" @on-ok="handleDelete(scope.row)" > <el-button type="text" style="margin-left: 10px" size="mini" >删除</el-button > </ds-pop-comfirm> </template> </el-table-column> </el-table> </div> <div class="pagination-container"> <div> <el-button size="mini" type="success" icon="el-icon-open" @click="changeExecutorStatus(1)" >启动</el-button > <el-button size="mini" type="danger" icon="el-icon-open" @click="changeExecutorStatus(0)" >禁止</el-button > </div> <el-pagination v-show="total > 0" :current-page="listQuery.pageNum" :pager-count="5" :page-sizes="[10, 20, 50, 100]" :page-size="listQuery.pageSize" :total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange" @current-change="handleCurrentChange" /> </div> <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :close-on-click-modal="false" width="560px" > <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="100px" style="width: 400px" > <el-form-item label="执行器名称" prop="name"> <el-input v-model="temp.name" maxlength="30" /> </el-form-item> <el-form-item label="IP地址" prop="ip"> <el-input v-model="temp.ip" maxlength="30" /> </el-form-item> <el-form-item label="端口" prop="jmxPort"> <el-input v-model="temp.jmxPort" maxlength="30" /> </el-form-item> <el-form-item label="并发数" prop="taskParallel"> <el-input-number v-model="temp.taskParallel" controls-position="right" ></el-input-number> </el-form-item> <!-- <el-form-item label="执行器类型" prop="type"> <el-select v-model="temp.type" placeholder="请选择执行器类型" class="filter-item" style="width: 200px" > <el-option label="TASK" value="TASK" /> <el-option label="SCRIPT" value="SCRIPT" /> <el-option label="PY_SPARK" value="PY_SPARK" /> <el-option label="LT3_TASK" value="LT3_TASK" /> <el-option label="LT3_SCRIPT" value="LT3_SCRIPT" /> <el-option label="R" value="R" /> </el-select> </el-form-item> --> <el-form-item label="角色" prop="type"> <el-select v-model="temp.type" placeholder="请选择执行器类型" class="filter-item" style="width: 200px" > <el-option label="Master" value="Master" /> <el-option label="Worker" value="Worker" /> </el-select> </el-form-item> <el-form-item label="脚本集群名称" prop="dispatchType"> <el-select v-model="temp.dispatchType" placeholder="请选择脚本集群名称" class="filter-item" style="width: 200px" > <el-option v-for="item in dispatchTypeOptions" :key="item.value" :label="item.label" :value="item.value" /> </el-select> </el-form-item> <el-form-item label="描述" prop="description"> <el-input v-model="temp.description" maxlength="64" /> </el-form-item> <el-form-item label="是否启用" label-width="110px"> <el-switch v-model="temp.status" :active-value="true" :inactive-value="false" /> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button @click="dialogFormVisible = false">取消</el-button> <el-button v-if="dialogStatus == 'create'" :disabled="!submitBtn" type="primary" @click="createData" >确定</el-button > <el-button v-else :disabled="!submitBtn" type="primary" @click="updateData" >确定</el-button > </div> </el-dialog> <el-dialog :visible.sync="runTaskDialogFormVisible" :title="`正在执行的任务列表-${this.currentExecutorName}`" width="70%" > <!-- <div class="count-class"> <el-tag>正在运行的任务数</el-tag> <span>{{ runningTaskCount }}</span> </div> <div class="count-class"> <el-tag>节点类型统计</el-tag> <span>{{ nodeTypeCount }}</span> </div> <div class="count-class"> <el-tag>实例类型统计</el-tag> <span>{{ instanceTypeCount }}</span> </div> <div class="count-class"> <el-tag>计算资源统计</el-tag> <span>{{ queueCount }}</span> </div> --> <div class="count-class"> <el-button :disabled="taskRefresh" type="primary" @click="checkRunTaskList(currentId, currentExecutorName)" >刷新</el-button > </div> <div> <el-table v-loading="runTaskListLoading" :data="runTaskList" border stripe highlight-current-row label-width="100px" width="100%" class="count-class" > <el-table-column label="实例ID" align="center" prop="id" width="90px" /> <el-table-column label="项目名称" align="center" prop="projectName" /> <el-table-column label="所属环境" align="center" prop="envString" :filters="[ { text: '2016-05-01', value: '2016-05-01' }, { text: '2016-05-02', value: '2016-05-02' }, ]" :filter-method="filterNodeTypeTag" /> <el-table-column label="任务名称" align="center" prop="name" /> <el-table-column :filters="nodeTypeTags" :filter-method="filterNodeTypeTag" label="节点类型" align="center" prop="nodeTypeString" width="100px" /> <el-table-column :filters="instanceTypeTags" :filter-method="filterInstanceTypeTag" label="实例类型" align="center" prop="taskInstanceTypeString" width="100px" /> <el-table-column label="开始执行时间" align="center" prop="startTime" width="150px" /> <el-table-column :filters="queueTags" :filter-method="filterQueueTag" label="计算资源" align="center" prop="yarnQueueName" width="90px" /> <el-table-column label="实例状态" align="center" prop="statusString" width="70px" /> </el-table> <!-- <div slot="footer" class="dialog-footer"> <el-button :disabled="taskRefresh" type="primary" @click="checkRunTaskList(currentId)">刷新</el-button> </div> --> </div> </el-dialog> </div> </template> <script> import { listExecutor, editExecutor, delExecutor, listRunTaskList, operateDispatchSwitch, setExecutorState, dispatchSwitch, changeStatus, getDispatchType, } from "@/api/ops"; import waves from "@/directive/waves"; // 水波纹指令 import { dispatchTypeMap } from "@/views/dev/utils/model"; import { accessDict } from "./access"; import buttonIsAccess from "@/mixins/buttonIsAccess.js"; export default { name: "Executor", mixins: [buttonIsAccess], directives: { waves, }, data() { return { currentExecutorName: "", currentSelectIds: [], currentId: undefined, submitBtn: true, // 防止重复提交 refreshBtn: true, taskRefresh: true, runningTaskCount: 0, list: null, total: null, listLoading: true, dialogStatus: "", dialogFormVisible: false, runTaskDialogFormVisible: false, runTaskListLoading: true, runTaskList: [], nodeTypeTags: [], queueTags: [], instanceTypeTags: [], nodeTypeCount: "", instanceTypeCount: "", queueCount: "", executorDetail: undefined, temp: { id: undefined, name: undefined, type: undefined, ip: undefined, jmxPort: undefined, description: undefined, status: true, dispatchType: undefined, taskParallel: undefined, }, listQuery: { ip: undefined, type: undefined, dispatchType: undefined, status: undefined, pageNum: 1, pageSize: 10, }, textMap: { update: "编辑", create: "新增", }, rules: { name: [ { required: true, message: "请输入执行器名称", trigger: "blur" }, ], ip: [{ required: true, message: "请输入IP", trigger: "blur" }], type: [ { required: true, message: "请选择执行器类型", trigger: "blur" }, ], description: [ { required: true, message: "请输入执行器描述", trigger: "blur" }, ], jmxPort: [ { required: true, message: "请输入端口号", trigger: "blur" }, { pattern: /^[0-9]+$/, message: "请输入数字" }, ], taskParallel: [ { required: true, message: "请选择并发数", trigger: "blur" }, ], }, switchBtnVisiable: false, startDispatchVisiable: false, closeDispatchVisiable: false, dispatchTypeMap, dispatchTypeOptions: [ // { value: 5, label: "普通脚本集群" }, // { value: 6, label: "模型脚本集群" }, // { value: 4, label: "Spark脚本集群" }, // { value: 7, label: "R脚本任务集群" }, // { value: 8, label: "Neo4j-community集群" }, // { value: 11, label: "Neo4j-relative集群" }, // { value: 9, label: "新账务核心集群" }, // { value: 10, label: "数据集成集群" }, // { value: 12, label: "AI脚本集群" }, // { value: 13, label: "风控生产模型脚本集群" }, // { value: 14, label: "风控生产Spark脚本集群" }, ], searchItems: [ { name: "ip", label: "ip地址", type: "input", placeholder: "请输入ip地址", hideButton: true, }, { name: "status", label: "状态", type: "select", placeholder: "请选择状态", options: [ { value: "1", label: "启动", }, { value: "0", label: "禁用", }, ], }, { name: "type", label: "角色", type: "select", placeholder: "请选择角色", options: [ { value: "Master", label: "Master", }, { value: "Worker", label: "Worker", }, ], }, { name: "dispatchType", label: "脚本集群", type: "select", placeholder: "请选择脚本集群", options: this.dispatchTypeOptions, }, ], }; }, computed: { filters() { const filterList = []; if (this.list && this.list.length > 0) { this.list.map((item) => { if ( filterList.findIndex((a) => a.value === item.dispatchType) === -1 ) { filterList.push({ text: this.dispatchTypeMap[item.dispatchType], value: item.dispatchType, }); } }); } return filterList; }, }, created() { this.switchBtnVisiable = this.buttonIsAccess(accessDict.change); getDispatchType().then((response) => { this.dispatchTypeOptions = response.data; console.log("response", response.data); }); this.getList(); this.getDispatchSwitch(); }, methods: { reset() { this.$nextTick(() => { this.$refs["queryForm"].resetFields(); }); }, handleFilterItems() { this.$refs["queryForm"].validate((valid) => { if (valid) { console.log("valid", valid); } else { return; } }); }, changeExecutorStatus(status) { if (this.currentSelectIds.length) { changeStatus({ ids: this.currentSelectIds, status }).then(() => { this.$notify({ title: "成功", message: "操作成功", type: "success", duration: 2000, }); }); } else { this.$notify({ title: "提示", message: "请选择执行器", type: "warning", duration: 2000, }); } }, handleSelectionChange(val) { this.currentSelectIds = val.map((item) => { return item.id; }); }, filterHandler(value, row, column) { const property = column["property"]; return row[property] === value; }, getList() { this.refreshBtn = true; this.listLoading = true; listExecutor(this.listQuery).then((response) => { this.refreshBtn = false; this.list = response.data.list; console.log("res", response.data.list); this.total = response.data.total; this.listLoading = false; }); }, getDispatchSwitch() { dispatchSwitch().then((response) => { if (response.data === true) { this.closeDispatchVisiable = true; this.startDispatchVisiable = false; } else { this.closeDispatchVisiable = false; this.startDispatchVisiable = true; } }); }, checkRunTaskList(currentId, currentName) { this.currentExecutorName = currentName; this.taskRefresh = true; this.currentId = currentId; this.runTaskDialogFormVisible = true; listRunTaskList(currentId).then((response) => { // this.executorDetail = response.data this.runTaskListLoading = false; this.taskRefresh = false; this.runTaskList = response.data.list; this.runningTaskCount = response.data.count; this.instanceTypeCount = JSON.stringify( response.data.instanceTypeCount ); this.instanceTypeCount = this.instanceTypeCount .replace("{", "") .replace("}", "") .replace(/\"/g, ""); this.nodeTypeCount = JSON.stringify(response.data.typeCount); this.nodeTypeCount = this.nodeTypeCount .replace("{", "") .replace("}", "") .replace(/\"/g, ""); this.queueCount = JSON.stringify(response.data.queueCount); this.queueCount = this.queueCount .replace("{", "") .replace("}", "") .replace(/\"/g, ""); this.nodeTypeTags = response.data.nodeTypeTags; this.queueTags = response.data.queueTags; this.instanceTypeTags = response.data.instanceTypeTags; }); }, operate(type) { const stopTask = type === 3; if (type === 3) { type = 2; } operateDispatchSwitch(type, stopTask) .then(() => { const running = type === 1; this.$store.dispatch("setGlobalScheduling", running); this.$notify({ title: "成功", message: "更新成功", type: "success", duration: 2000, }); if (running === true) { this.closeDispatchVisiable = true; this.startDispatchVisiable = false; } else { this.closeDispatchVisiable = false; this.startDispatchVisiable = true; } }) .catch((err) => {}); }, getSummaries(param) { const { columns, data } = param; const sums = []; columns.forEach((column, index) => { if (index === 0) { sums[index] = "总数"; return; } const values = data.map((item) => Number(item[column.property])); if (!values.every((value) => isNaN(value))) { sums[index] = values.reduce((prev, curr) => { const value = Number(curr); if (!isNaN(value)) { return prev + curr; } else { return prev; } }, 0); sums[index] += " 个"; } else { sums[index] = ""; } }); return sums; }, handleUpdateState(row) { const params = { id: row.id, status: !row.status, }; setExecutorState(params).then(() => { row.status = !row.status; this.$notify({ title: "成功", message: "修改成功", type: "success", duration: 2000, }); }); }, handleCurrentChange(val) { this.listQuery.pageNum = val; this.getList(); }, handleUpdate(row) { this.temp = Object.assign({}, row); // copy obj this.dialogStatus = "update"; this.dialogFormVisible = true; this.submitBtn = true; this.$nextTick(() => { this.$refs["dataForm"].clearValidate(); }); }, updateData() { this.$refs["dataForm"].validate((valid) => { if (valid) { this.submitBtn = false; const tempData = Object.assign({}, this.temp); editExecutor(tempData).then(() => { this.handleCurrentChange(this.listQuery.pageNum); this.dialogFormVisible = false; this.submitBtn = true; this.$notify({ title: "成功", message: "更新成功", type: "success", duration: 2000, }).catch((err) => { this.submitBtn = true; }); }); } }); }, handleCreate() { this.resetTemp(); this.dialogStatus = "create"; this.dialogFormVisible = true; this.submitBtn = true; this.$nextTick(() => { this.$refs["dataForm"].clearValidate(); }); }, createData() { this.$refs["dataForm"].validate((valid) => { if (valid) { this.submitBtn = false; editExecutor(this.temp) .then(() => { this.handleFilter(); this.dialogFormVisible = false; this.submitBtn = true; this.$notify({ title: "成功", message: "创建成功", type: "success", duration: 2000, }); }) .catch((err) => { this.submitBtn = true; }); } }); }, handleDelete(row) { delExecutor(row.id).then(() => { this.$notify({ title: "成功", message: "删除成功", type: "success", duration: 2000, }); this.handleCurrentChange(this.listQuery.pageNum); }); }, resetTemp() { this.temp = { id: undefined, name: undefined, type: undefined, ip: undefined, jmxPort: undefined, description: undefined, status: true, }; }, handleFilter() { this.listQuery.pageNum = 1; this.getList(); }, handleSizeChange(val) { this.listQuery.pageSize = val; this.getList(); }, filterNodeTypeTag(value, row) { return row.nodeTypeString === value; }, filterQueueTag(value, row) { return row.yarnQueueName === value; }, filterInstanceTypeTag(value, row) { return row.taskInstanceTypeString === value; }, filterHandler(value, row, column) { const property = column["property"]; return row[property] === value; }, }, }; </script> <style lang="scss" scoped> .count-class { margin-bottom: 10px; } .filter-container { text-align: right; background: #fff; min-height: initial !important; padding: 5px 10px; } .filter-container .filter-item { margin-bottom: 0; } ::v-deep .el-switch.is-disabled { opacity: 1 !important; } ::v-deep .el-switch.is-disabled .el-switch__core, .el-switch.is-disabled .el-switch__label { cursor: pointer !important; } .pagination-container { display: flex; justify-content: space-between; align-items: center; } // .task-autocomplete { width: auto !important; min-width: 200px; } .el-cascader-max60-tip-text { &::after { content: "最大时间跨度 60天"; font-size: 12px; color: #aaaaaa; position: absolute; bottom: 0px; left: 4px; z-index: 1; } } ::v-deep .el-range-editor--mini .el-range-separator { min-width: fit-content; width: 20px; } .el-range-editor--mini .el-range-separator { width: 20px; } .search-form-item { width: 12.5% !important; margin-right: 0 !important; padding-right: 4px; padding-left: 4px; } @media (max-width: 1191px) { .search-form-item { width: 25% !important; } .search-form-item-double.search-form-item-daterange { width: 25% !important; } .search-form-item-double { width: 50% !important; } .search-btns { width: 24% !important; } } @media (min-width: 1192px) and (max-width: 1505px) { .search-form-item { width: 16.666666% !important; } .search-form-item-double.search-form-item-daterange { width: 16.666666% !important; } .search-form-item-double { width: 33.3333333% !important; } .search-btns { width: 16% !important; } } @media screen and (min-width: 2560px) and (max-width: 3071px) { .search-form-item { width: 10% !important; } .search-form-item-double.search-form-item-daterange { width: 10% !important; } .search-form-item-double { width: 20% !important; } .search-btns { width: 9% !important; } } @media (min-width: 3072px) { .search-form-item { width: 8.333333% !important; } .search-form-item-double.search-form-item-daterange { width: 8.333333% !important; } .search-form-item-double { width: 16.666666% !important; } .search-btns { width: 8.2% !important; } } </style> 这段代码中的searchItems的 { name: "dispatchType", label: "脚本集群", type: "select", placeholder: "请选择脚本集群", options: this.dispatchTypeOptions, },这一项数据的options的dispatchTypeOptions的值是通过接口获取的,但是接口获取了后,界面的<template v-if="item.type == 'select'"> <el-select v-model.trim="listQuery[item.name]" :placeholder="item.placeholder" clearable > <template v-for="option in item.options"> <el-option :key="option.value" :label="option.label" :value="option.value" /> </template> </el-select> </template>选择框的选项没有,是因为什么,怎么改
09-04
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' compiling ds18b20.c... ds18b20.h(1): error: #77-D: this declaration has no storage class or type specifier *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' ds18b20.h(1): error: #65: expected a ";" *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' ds18b20.h(1): error: #26: too many characters in character constant *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' ds18b20.h(1): warning: #192-D: unrecognized character escape sequence *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' ds18b20.h(1): warning: #192-D: unrecognized character escape sequence *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' ds18b20.h(1): warning: #192-D: unrecognized character escape sequence *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' ds18b20.h(1): error: #26: too many characters in character constant *** Using Compiler 'V5.06 update 7 (build 960)', folder: 'D:\qianrushi.app\ARM\bianyiqi\Bin' ds18b20.h(3): error: #10: "#" not expected here ds18b20.c(67): error: #254: type name is not allowed ds18b20.h(5): error: #10: "#" not expected here ds18b20.c(67): error: #65: expected a ";" ds18b20.h(7): error: #10: "#" not expected here ds18b20.c(67): error: #20: identifier "i" is undefined ds18b20.h(9): error: #10: "#" not expected here ds18b20.c(99): error: #254: type name is not allowed ds18b20.h(11): error: #10: "#" not expected here ds18b20.c(99): error: #65: expected a ";" ds18b20.h(13): error: #10: "#" not expected here ds18b20.c(99): error: #20: identifier "i" is undefined ds18b20.h(15): error: #10: "#" not expected here ds18b20.c(181): error: #254: type name is not allowed ds18b20.h(17): error: #10: "#" not expected here ds18b20.c(181): error: #65: expected a ";" ds18b20.h(19): error: #10: "#" not expected here ds18b20.c(181): error: #20: identifier "i" is undefined ds18b20.h(22): warning: #1-D: last line of file ends without a newline "ds18b20.c" - 9 Error(s), 0 Warning(s). ds18b20.c(52): warning: #12-D: parsing restarts here after previous syntax error delay_us(400); ds18b20.c(53): error: #169: expected a declaration return 0; // ??? ds18b20.c(54): error: #169: expected a declaration } ds18b20.c(131): warning: #12-D: parsing restarts here after previous syntax error delay_us(55); // ?????? ds18b20.c(132): error: #169: expected a declaration } ds18b20.c(135): error: #169: expected a declaration } ds18b20.c(184): warning: #12-D: parsing restarts here after previous syntax error return temperature; ds18b20.c(185): error: #169: expected a declaration } ds18b20.c: 7 warnings, 18 errors "ds18b20.c" - 18 Error(s), 7 Warning(s).
06-22
/* USER CODE BEGIN Header */ /** ****************************************************************************** * @file tim.c * @brief This file provides code for the configuration * of the TIM instances. ****************************************************************************** * @attention * * Copyright (c) 2025 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** */ /* USER CODE END Header */ /* Includes ------------------------------------------------------------------*/ #include "tim.h" /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ TIM_HandleTypeDef htim1; /* TIM1 init function */ void MX_TIM1_Init(void) { /* USER CODE BEGIN TIM1_Init 0 */ /* USER CODE END TIM1_Init 0 */ TIM_ClockConfigTypeDef sClockSourceConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; /* USER CODE BEGIN TIM1_Init 1 */ /* USER CODE END TIM1_Init 1 */ htim1.Instance = TIM1; htim1.Init.Prescaler = 99; htim1.Init.CounterMode = TIM_COUNTERMODE_UP; htim1.Init.Period = 65535; htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim1.Init.RepetitionCounter = 0; htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim1) != HAL_OK) { Error_Handler(); } sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK) { Error_Handler(); } sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK) { Error_Handler(); } /* USER CODE BEGIN TIM1_Init 2 */ /* USER CODE END TIM1_Init 2 */ } void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle) { if(tim_baseHandle->Instance==TIM1) { /* USER CODE BEGIN TIM1_MspInit 0 */ /* USER CODE END TIM1_MspInit 0 */ /* TIM1 clock enable */ __HAL_RCC_TIM1_CLK_ENABLE(); /* USER CODE BEGIN TIM1_MspInit 1 */ /* USER CODE END TIM1_MspInit 1 */ } } void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle) { if(tim_baseHandle->Instance==TIM1) { /* USER CODE BEGIN TIM1_MspDeInit 0 */ /* USER CODE END TIM1_MspDeInit 0 */ /* Peripheral clock disable */ __HAL_RCC_TIM1_CLK_DISABLE(); /* USER CODE BEGIN TIM1_MspDeInit 1 */ /* USER CODE END TIM1_MspDeInit 1 */ } } /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ 以上是代码,以下是编译结果,请给出解决方法*** Using Compiler 'V5.06 update 4 (build 422)', folder: 'D:\Users\h1800\Desktop\wc\ARM\ARMCC\Bin' Rebuild target 'A1' assembling startup_stm32f411xe.s... compiling font.c... compiling tim.c... ../Core/Inc/tim.h(35): error: #20: identifier "TIM_HandleTypeDef" is undefined extern TIM_HandleTypeDef htim1; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(27): error: #20: identifier "TIM_HandleTypeDef" is undefined TIM_HandleTypeDef htim1; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(37): error: #20: identifier "TIM_ClockConfigTypeDef" is undefined TIM_ClockConfigTypeDef sClockSourceConfig = {0}; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(38): error: #20: identifier "TIM_MasterConfigTypeDef" is undefined TIM_MasterConfigTypeDef sMasterConfig = {0}; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(45): error: #20: identifier "TIM_COUNTERMODE_UP" is undefined htim1.Init.CounterMode = TIM_COUNTERMODE_UP; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(47): error: #20: identifier "TIM_CLOCKDIVISION_DIV1" is undefined htim1.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(49): error: #20: identifier "TIM_AUTORELOAD_PRELOAD_DISABLE" is undefined htim1.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(50): warning: #223-D: function "HAL_TIM_Base_Init" declared implicitly if (HAL_TIM_Base_Init(&htim1) != HAL_OK) ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(54): error: #20: identifier "TIM_CLOCKSOURCE_INTERNAL" is undefined sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(55): warning: #223-D: function "HAL_TIM_ConfigClockSource" declared implicitly if (HAL_TIM_ConfigClockSource(&htim1, &sClockSourceConfig) != HAL_OK) ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(59): error: #20: identifier "TIM_TRGO_RESET" is undefined sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(60): error: #20: identifier "TIM_MASTERSLAVEMODE_DISABLE" is undefined sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(61): warning: #223-D: function "HAL_TIMEx_MasterConfigSynchronization" declared implicitly if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK) ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(71): error: #20: identifier "TIM_HandleTypeDef" is undefined void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle) ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c(87): error: #20: identifier "TIM_HandleTypeDef" is undefined void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle) ..\..\..\stm32f411ceu6_lcd - -\A1\Core\Src\tim.c: 3 warnings, 12 errors compiling ds18b20.c... compiling stm32f4xx_hal_msp.c... compiling delay.c... compiling stm32f4xx_it.c... compiling main.c... ../Core/Src/main.c(129): warning: #223-D: function "DS18B20_ReadTemperature" declared implicitly temp = DS18B20_ReadTemperature(); ../Core/Src/main.c: 1 warning, 0 errors compiling tft.c... ..\stm32F411\tft.c(392): warning: #167-D: argument of type "char *" is incompatible with parameter of type "const uint8_t *" TFT_DrawString(x, y, str, color, bg_color, font_size); ..\stm32F411\tft.c: 1 warning, 0 errors compiling spi.c... compiling stm32f4xx_hal_rcc.c... compiling stm32f4xx_hal_rcc_ex.c... compiling stm32f4xx_hal_spi.c... compiling stm32f4xx_hal_flash.c... compiling stm32f4xx_hal_gpio.c... compiling stm32f4xx_hal_flash_ramfunc.c... compiling stm32f4xx_hal_pwr_ex.c... compiling stm32f4xx_hal_flash_ex.c... compiling stm32f4xx_hal_pwr.c... compiling stm32f4xx_hal_dma.c... compiling stm32f4xx_hal.c... compiling stm32f4xx_hal_cortex.c... compiling stm32f4xx_hal_exti.c... compiling font.c... compiling stm32f4xx_hal_dma_ex.c... compiling dht11.c... ..\app\DHT11\dht11.h(8): error: #20: identifier "TIM_HandleTypeDef" is undefined extern TIM_HandleTypeDef htim1; ../Core/Inc/tim.h(35): error: #20: identifier "TIM_HandleTypeDef" is undefined extern TIM_HandleTypeDef htim1; ..\app\DHT11\dht11.c(9): warning: #223-D: function "__HAL_TIM_SET_COUNTER" declared implicitly __HAL_TIM_SET_COUNTER(&htim1,differ); ..\app\DHT11\dht11.c(10): warning: #223-D: function "HAL_TIM_Base_Start" declared implicitly HAL_TIM_Base_Start(&htim1); ..\app\DHT11\dht11.c(13): warning: #223-D: function "__HAL_TIM_GET_COUNTER" declared implicitly differ = __HAL_TIM_GET_COUNTER(&htim1); ..\app\DHT11\dht11.c(15): warning: #223-D: function "HAL_TIM_Base_Stop" declared implicitly HAL_TIM_Base_Stop(&htim1); ..\app\DHT11\dht11.c: 4 warnings, 2 errors compiling system_stm32f4xx.c... compiling tft.c... ..\app\lcd\tft.c(392): warning: #167-D: argument of type "char *" is incompatible with parameter of type "const uint8_t *" TFT_DrawString(x, y, str, color, bg_color, font_size); ..\app\lcd\tft.c: 1 warning, 0 errors "A1\A1.axf" - 14 Error(s), 10 Warning(s). Target not created. Build Time Elapsed: 00:00:04
11-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值