window.__AllJsAndCss__ = true ;/*! jQuery v3.1.1 | (c) jQuery Foundation | jquery.org/license */ ! function (a, b) { "use strict"; "object" == typeof module && "object" == typeof module.exports ? module.exports = a.document ? b(a, !0) : function (a) { if (!a.document) throw new Error("jQuery requires a window with a document"); return b(a) } : b(a) }("undefined" != typeof window ? window : this, function (a, b) { "use strict"; var c = [], d = a.document, e = Object.getPrototypeOf, f = c.slice, g = c.concat, h = c.push, i = c.indexOf, j = {}, k = j.toString, l = j.hasOwnProperty, m = l.toString, n = m.call(Object), o = {}; function p(a, b) { //b = b || d; //var c = b.createelement("script"); //c.text = a, //b.head.appendchild(c).parentnode.removechild(c) } var q = "3.1.1", r = function (a, b) { return new r.fn.init(a, b) }, s = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, t = /^-ms-/, u = /-([a-z])/g, v = function (a, b) { return b.toUpperCase() }; r.fn = r.prototype = { jquery: q, constructor: r, length: 0, toArray: function () { return f.call(this) }, get: function (a) { return null == a ? f.call(this) : a < 0 ? this[a + this.length] : this[a] }, pushStack: function (a) { var b = r.merge(this.constructor(), a); return b.prevObject = this, b }, each: function (a) { return r.each(this, a) }, map: function (a) { return this.pushStack(r.map(this, function (b, c) { return a.call(b, c, b) })) }, slice: function () { return this.pushStack(f.apply(this, arguments)) }, first: function () { return this.eq(0) }, last: function () { return this.eq(-1) }, eq: function (a) { var b = this.length, c = +a + (a < 0 ? b : 0); return this.pushStack(c >= 0 && c < b ? [this[c]] : []) }, end: function () { return this.prevObject || this.constructor() }, push: h, sort: c.sort, splice: c.splice }, r.extend = r.fn.extend = function () { var a, b, c, d, e, f, g = arguments[0] || {}, h = 1, i = arguments.length, j = !1; for ("boolean" == typeof g && (j = g, g = arguments[h] || {}, h++), "object" == typeof g || r.isFunction(g) || (g = {}), h === i && (g = this, h--) ; h < i; h++) if (null != (a = arguments[h])) for (b in a) c = g[b], d = a[b], g !== d && (j && d && (r.isPlainObject(d) || (e = r.isArray(d))) ? (e ? (e = !1, f = c && r.isArray(c) ? c : []) : f = c && r.isPlainObject(c) ? c : {}, g[b] = r.extend(j, f, d)) : void 0 !== d && (g[b] = d)); return g }, r.extend({ expando: "jQuery" + (q + Math.random()).replace(/\D/g, ""), isReady: !0, error: function (a) { throw new Error(a) }, noop: function () { }, isFunction: function (a) { return "function" === r.type(a) }, isArray: Array.isArray, isWindow: function (a) { return null != a && a === a.window }, isNumeric: function (a) { var b = r.type(a); return ("number" === b || "string" === b) && !isNaN(a - parseFloat(a)) }, isPlainObject: function (a) { var b, c; return !(!a || "[object Object]" !== k.call(a)) && (!(b = e(a)) || (c = l.call(b, "constructor") && b.constructor, "function" == typeof c && m.call(c) === n)) }, isEmptyObject: function (a) { var b; for (b in a) return !1; return !0 }, type: function (a) { return null == a ? a + "" : "object" == typeof a || "function" == typeof a ? j[k.call(a)] || "object" : typeof a }, globalEval: function (a) { p(a) }, camelCase: function (a) { return a.replace(t, "ms-").replace(u, v) }, nodeName: function (a, b) { return a.nodeName && a.nodeName.toLowerCase() === b.toLowerCase() }, each: function (a, b) { var c, d = 0; if (w(a)) { for (c = a.length; d < c; d++) if (b.call(a[d], d, a[d]) === !1) break } else for (d in a) if (b.call(a[d], d, a[d]) === !1) break; return a }, trim: function (a) { return null == a ? "" : (a + "").replace(s, "") }, makeArray: function (a, b) { var c = b || []; return null != a && (w(Object(a)) ? r.merge(c, "string" == typeof a ? [a] : a) : h.call(c, a)), c }, inArray: function (a, b, c) { return null == b ? -1 : i.call(b, a, c) }, merge: function (a, b) { for (var c = +b.length, d = 0, e = a.length; d < c; d++) a[e++] = b[d]; return a.length = e, a }, grep: function (a, b, c) { for (var d, e = [], f = 0, g = a.length, h = !c; f < g; f++) d = !b(a[f], f), d !== h && e.push(a[f]); return e }, map: function (a, b, c) { var d, e, f = 0, h = []; if (w(a)) for (d = a.length; f < d; f++) e = b(a[f], f, c), null != e && h.push(e); else for (f in a) e = b(a[f], f, c), null != e && h.push(e); return g.apply([], h) }, guid: 1, proxy: function (a, b) { var c, d, e; if ("string" == typeof b && (c = a[b], b = a, a = c), r.isFunction(a)) return d = f.call(arguments, 2), e = function () { return a.apply(b || this, d.concat(f.call(arguments))) }, e.guid = a.guid = a.guid || r.guid++, e }, now: Date.now, support: o }), "function" == typeof Symbol && (r.fn[Symbol.iterator] = c[Symbol.iterator]), r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (a, b) { j["[object " + b + "]"] = b.toLowerCase() }); function w(a) { var b = !!a && "length" in a && a.length, c = r.type(a); return "function" !== c && !r.isWindow(a) && ("array" === c || 0 === b || "number" == typeof b && b > 0 && b - 1 in a) } var x = function (a) { var b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u = "sizzle" + 1 * new Date, v = a.document, w = 0, x = 0, y = ha(), z = ha(), A = ha(), B = function (a, b) { return a === b && (l = !0), 0 }, C = {}.hasOwnProperty, D = [], E = D.pop, F = D.push, G = D.push, H = D.slice, I = function (a, b) { for (var c = 0, d = a.length; c < d; c++) if (a[c] === b) return c; return -1 }, J = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", K = "[\\x20\\t\\r\\n\\f]", L = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", M = "\\[" + K + "*(" + L + ")(?:" + K + "*([*^$|!~]?=)" + K + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + L + "))|)" + K + "*\\]", N = ":(" + L + ")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + M + ")*)|.*)\\)|)", O = new RegExp(K + "+", "g"), P = new RegExp("^" + K + "+|((?:^|[^\\\\])(?:\\\\.)*)" + K + "+$", "g"), Q = new RegExp("^" + K + "*," + K + "*"), R = new RegExp("^" + K + "*([>+~]|" + K + ")" + K + "*"), S = new RegExp("=" + K + "*([^\\]'\"]*?)" + K + "*\\]", "g"), T = new RegExp(N), U = new RegExp("^" + L + "$"), V = { ID: new RegExp("^#(" + L + ")"), CLASS: new RegExp("^\\.(" + L + ")"), TAG: new RegExp("^(" + L + "|[*])"), ATTR: new RegExp("^" + M), PSEUDO: new RegExp("^" + N), CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + K + "*(even|odd|(([+-]|)(\\d*)n|)" + K + "*(?:([+-]|)" + K + "*(\\d+)|))" + K + "*\\)|)", "i"), bool: new RegExp("^(?:" + J + ")$", "i"), needsContext: new RegExp("^" + K + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + K + "*((?:-\\d)?\\d*)" + K + "*\\)|)(?=[^-]|$)", "i") }, W = /^(?:input|select|textarea|button)$/i, X = /^h\d$/i, Y = /^[^{]+\{\s*\[native \w/, Z = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, $ = /[+~]/, _ = new RegExp("\\\\([\\da-f]{1,6}" + K + "?|(" + K + ")|.)", "ig"), aa = function (a, b, c) { var d = "0x" + b - 65536; return d !== d || c ? b : d < 0 ? String.fromCharCode(d + 65536) : String.fromCharCode(d >> 10 | 55296, 1023 & d | 56320) }, ba = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, ca = function (a, b) { return b ? "\0" === a ? "\ufffd" : a.slice(0, -1) + "\\" + a.charCodeAt(a.length - 1).toString(16) + " " : "\\" + a }, da = function () { m() }, ea = ta(function (a) { return a.disabled === !0 && ("form" in a || "label" in a) }, { dir: "parentNode", next: "legend" }); try { G.apply(D = H.call(v.childNodes), v.childNodes), D[v.childNodes.length].nodeType } catch (fa) { G = { apply: D.length ? function (a, b) { F.apply(a, H.call(b)) } : function (a, b) { var c = a.length, d = 0; while (a[c++] = b[d++]); a.length = c - 1 } } } function ga(a, b, d, e) { var f, h, j, k, l, o, r, s = b && b.ownerDocument, w = b ? b.nodeType : 9; if (d = d || [], "string" != typeof a || !a || 1 !== w && 9 !== w && 11 !== w) return d; if (!e && ((b ? b.ownerDocument || b : v) !== n && m(b), b = b || n, p)) { if (11 !== w && (l = Z.exec(a))) if (f = l[1]) { if (9 === w) { if (!(j = b.getElementById(f))) return d; if (j.id === f) return d.push(j), d } else if (s && (j = s.getElementById(f)) && t(b, j) && j.id === f) return d.push(j), d } else { if (l[2]) return G.apply(d, b.getElementsByTagName(a)), d; if ((f = l[3]) && c.getElementsByClassName && b.getElementsByClassName) return G.apply(d, b.getElementsByClassName(f)), d } if (c.qsa && !A[a + " "] && (!q || !q.test(a))) { if (1 !== w) s = b, r = a; else if ("object" !== b.nodeName.toLowerCase()) { (k = b.getAttribute("id")) ? k = k.replace(ba, ca) : b.setAttribute("id", k = u), o = g(a), h = o.length; while (h--) o[h] = "#" + k + " " + sa(o[h]); r = o.join(","), s = $.test(a) && qa(b.parentNode) || b } if (r) try { return G.apply(d, s.querySelectorAll(r)), d } catch (x) { } finally { k === u && b.removeAttribute("id") } } } return i(a.replace(P, "$1"), b, d, e) } function ha() { var a = []; function b(c, e) { return a.push(c + " ") > d.cacheLength && delete b[a.shift()], b[c + " "] = e } return b } function ia(a) { return a[u] = !0, a } function ja(a) { var b = n.createElement("fieldset"); try { return !!a(b) } catch (c) { return !1 } finally { b.parentNode && b.parentNode.removeChild(b), b = null } } function ka(a, b) { var c = a.split("|"), e = c.length; while (e--) d.attrHandle[c[e]] = b } function la(a, b) { var c = b && a, d = c && 1 === a.nodeType && 1 === b.nodeType && a.sourceIndex - b.sourceIndex; if (d) return d; if (c) while (c = c.nextSibling) if (c === b) return -1; return a ? 1 : -1 } function ma(a) { return function (b) { var c = b.nodeName.toLowerCase(); return "input" === c && b.type === a } } function na(a) { return function (b) { var c = b.nodeName.toLowerCase(); return ("input" === c || "button" === c) && b.type === a } } function oa(a) { return function (b) { return "form" in b ? b.parentNode && b.disabled === !1 ? "label" in b ? "label" in b.parentNode ? b.parentNode.disabled === a : b.disabled === a : b.isDisabled === a || b.isDisabled !== !a && ea(b) === a : b.disabled === a : "label" in b && b.disabled === a } } function pa(a) { return ia(function (b) { return b = +b, ia(function (c, d) { var e, f = a([], c.length, b), g = f.length; while (g--) c[e = f[g]] && (c[e] = !(d[e] = c[e])) }) }) } function qa(a) { return a && "undefined" != typeof a.getElementsByTagName && a } c = ga.support = {}, f = ga.isXML = function (a) { var b = a && (a.ownerDocument || a).documentElement; return !!b && "HTML" !== b.nodeName }, m = ga.setDocument = function (a) { var b, e, g = a ? a.ownerDocument || a : v; return g !== n && 9 === g.nodeType && g.documentElement ? (n = g, o = n.documentElement, p = !f(n), v !== n && (e = n.defaultView) && e.top !== e && (e.addEventListener ? e.addEventListener("unload", da, !1) : e.attachEvent && e.attachEvent("onunload", da)), c.attributes = ja(function (a) { return a.className = "i", !a.getAttribute("className") }), c.getElementsByTagName = ja(function (a) { return a.appendChild(n.createComment("")), !a.getElementsByTagName("*").length }), c.getElementsByClassName = Y.test(n.getElementsByClassName), c.getById = ja(function (a) { return o.appendChild(a).id = u, !n.getElementsByName || !n.getElementsByName(u).length }), c.getById ? (d.filter.ID = function (a) { var b = a.replace(_, aa); return function (a) { return a.getAttribute("id") === b } }, d.find.ID = function (a, b) { if ("undefined" != typeof b.getElementById && p) { var c = b.getElementById(a); return c ? [c] : [] } }) : (d.filter.ID = function (a) { var b = a.replace(_, aa); return function (a) { var c = "undefined" != typeof a.getAttributeNode && a.getAttributeNode("id"); return c && c.value === b } }, d.find.ID = function (a, b) { if ("undefined" != typeof b.getElementById && p) { var c, d, e, f = b.getElementById(a); if (f) { if (c = f.getAttributeNode("id"), c && c.value === a) return [f]; e = b.getElementsByName(a), d = 0; while (f = e[d++]) if (c = f.getAttributeNode("id"), c && c.value === a) return [f] } return [] } }), d.find.TAG = c.getElementsByTagName ? function (a, b) { return "undefined" != typeof b.getElementsByTagName ? b.getElementsByTagName(a) : c.qsa ? b.querySelectorAll(a) : void 0 } : function (a, b) { var c, d = [], e = 0, f = b.getElementsByTagName(a); if ("*" === a) { while (c = f[e++]) 1 === c.nodeType && d.push(c); return d } return f }, d.find.CLASS = c.getElementsByClassName && function (a, b) { if ("undefined" != typeof b.getElementsByClassName && p) return b.getElementsByClassName(a) }, r = [], q = [], (c.qsa = Y.test(n.querySelectorAll)) && (ja(function (a) { o.appendChild(a).innerHTML = "", a.querySelectorAll("[msallowcapture^='']").length && q.push("[*^$]=" + K + "*(?:''|\"\")"), a.querySelectorAll("[selected]").length || q.push("\\[" + K + "*(?:value|" + J + ")"), a.querySelectorAll("[id~=" + u + "-]").length || q.push("~="), a.querySelectorAll(":checked").length || q.push(":checked"), a.querySelectorAll("a#" + u + "+*").length || q.push(".#.+[+~]") }), ja(function (a) { a.innerHTML = ""; var b = n.createElement("input"); b.setAttribute("type", "hidden"), a.appendChild(b).setAttribute("name", "D"), a.querySelectorAll("[name=d]").length && q.push("name" + K + "*[*^$|!~]?="), 2 !== a.querySelectorAll(":enabled").length && q.push(":enabled", ":disabled"), o.appendChild(a).disabled = !0, 2 !== a.querySelectorAll(":disabled").length && q.push(":enabled", ":disabled"), a.querySelectorAll("*,:x"), q.push(",.*:") })), (c.matchesSelector = Y.test(s = o.matches || o.webkitMatchesSelector || o.mozMatchesSelector || o.oMatchesSelector || o.msMatchesSelector)) && ja(function (a) { c.disconnectedMatch = s.call(a, "*"), s.call(a, "[s!='']:x"), r.push("!=", N) }), q = q.length && new RegExp(q.join("|")), r = r.length && new RegExp(r.join("|")), b = Y.test(o.compareDocumentPosition), t = b || Y.test(o.contains) ? function (a, b) { var c = 9 === a.nodeType ? a.documentElement : a, d = b && b.parentNode; return a === d || !(!d || 1 !== d.nodeType || !(c.contains ? c.contains(d) : a.compareDocumentPosition && 16 & a.compareDocumentPosition(d))) } : function (a, b) { if (b) while (b = b.parentNode) if (b === a) return !0; return !1 }, B = b ? function (a, b) { if (a === b) return l = !0, 0; var d = !a.compareDocumentPosition - !b.compareDocumentPosition; return d ? d : (d = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1, 1 & d || !c.sortDetached && b.compareDocumentPosition(a) === d ? a === n || a.ownerDocument === v && t(v, a) ? -1 : b === n || b.ownerDocument === v && t(v, b) ? 1 : k ? I(k, a) - I(k, b) : 0 : 4 & d ? -1 : 1) } : function (a, b) { if (a === b) return l = !0, 0; var c, d = 0, e = a.parentNode, f = b.parentNode, g = [a], h = [b]; if (!e || !f) return a === n ? -1 : b === n ? 1 : e ? -1 : f ? 1 : k ? I(k, a) - I(k, b) : 0; if (e === f) return la(a, b); c = a; while (c = c.parentNode) g.unshift(c); c = b; while (c = c.parentNode) h.unshift(c); while (g[d] === h[d]) d++; return d ? la(g[d], h[d]) : g[d] === v ? -1 : h[d] === v ? 1 : 0 }, n) : n }, ga.matches = function (a, b) { return ga(a, null, null, b) }, ga.matchesSelector = function (a, b) { if ((a.ownerDocument || a) !== n && m(a), b = b.replace(S, "='$1']"), c.matchesSelector && p && !A[b + " "] && (!r || !r.test(b)) && (!q || !q.test(b))) try { var d = s.call(a, b); if (d || c.disconnectedMatch || a.document && 11 !== a.document.nodeType) return d } catch (e) { } return ga(b, n, null, [a]).length > 0 }, ga.contains = function (a, b) { return (a.ownerDocument || a) !== n && m(a), t(a, b) }, ga.attr = function (a, b) { (a.ownerDocument || a) !== n && m(a); var e = d.attrHandle[b.toLowerCase()], f = e && C.call(d.attrHandle, b.toLowerCase()) ? e(a, b, !p) : void 0; return void 0 !== f ? f : c.attributes || !p ? a.getAttribute(b) : (f = a.getAttributeNode(b)) && f.specified ? f.value : null }, ga.escape = function (a) { return (a + "").replace(ba, ca) }, ga.error = function (a) { throw new Error("Syntax error, unrecognized expression: " + a) }, ga.uniqueSort = function (a) { var b, d = [], e = 0, f = 0; if (l = !c.detectDuplicates, k = !c.sortStable && a.slice(0), a.sort(B), l) { while (b = a[f++]) b === a[f] && (e = d.push(f)); while (e--) a.splice(d[e], 1) } return k = null, a }, e = ga.getText = function (a) { var b, c = "", d = 0, f = a.nodeType; if (f) { if (1 === f || 9 === f || 11 === f) { if ("string" == typeof a.textContent) return a.textContent; for (a = a.firstChild; a; a = a.nextSibling) c += e(a) } else if (3 === f || 4 === f) return a.nodeValue } else while (b = a[d++]) c += e(b); return c }, d = ga.selectors = { cacheLength: 50, createPseudo: ia, match: V, attrHandle: {}, find: {}, relative: { ">": { dir: "parentNode", first: !0 }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: !0 }, "~": { dir: "previousSibling" } }, preFilter: { ATTR: function (a) { return a[1] = a[1].replace(_, aa), a[3] = (a[3] || a[4] || a[5] || "").replace(_, aa), "~=" === a[2] && (a[3] = " " + a[3] + " "), a.slice(0, 4) }, CHILD: function (a) { return a[1] = a[1].toLowerCase(), "nth" === a[1].slice(0, 3) ? (a[3] || ga.error(a[0]), a[4] = +(a[4] ? a[5] + (a[6] || 1) : 2 * ("even" === a[3] || "odd" === a[3])), a[5] = +(a[7] + a[8] || "odd" === a[3])) : a[3] && ga.error(a[0]), a }, PSEUDO: function (a) { var b, c = !a[6] && a[2]; return V.CHILD.test(a[0]) ? null : (a[3] ? a[2] = a[4] || a[5] || "" : c && T.test(c) && (b = g(c, !0)) && (b = c.indexOf(")", c.length - b) - c.length) && (a[0] = a[0].slice(0, b), a[2] = c.slice(0, b)), a.slice(0, 3)) } }, filter: { TAG: function (a) { var b = a.replace(_, aa).toLowerCase(); return "*" === a ? function () { return !0 } : function (a) { return a.nodeName && a.nodeName.toLowerCase() === b } }, CLASS: function (a) { var b = y[a + " "]; return b || (b = new RegExp("(^|" + K + ")" + a + "(" + K + "|$)")) && y(a, function (a) { return b.test("string" == typeof a.className && a.className || "undefined" != typeof a.getAttribute && a.getAttribute("class") || "") }) }, ATTR: function (a, b, c) { return function (d) { var e = ga.attr(d, a); return null == e ? "!=" === b : !b || (e += "", "=" === b ? e === c : "!=" === b ? e !== c : "^=" === b ? c && 0 === e.indexOf(c) : "*=" === b ? c && e.indexOf(c) > -1 : "$=" === b ? c && e.slice(-c.length) === c : "~=" === b ? (" " + e.replace(O, " ") + " ").indexOf(c) > -1 : "|=" === b && (e === c || e.slice(0, c.length + 1) === c + "-")) } }, CHILD: function (a, b, c, d, e) { var f = "nth" !== a.slice(0, 3), g = "last" !== a.slice(-4), h = "of-type" === b; return 1 === d && 0 === e ? function (a) { return !!a.parentNode } : function (b, c, i) { var j, k, l, m, n, o, p = f !== g ? "nextSibling" : "previousSibling", q = b.parentNode, r = h && b.nodeName.toLowerCase(), s = !i && !h, t = !1; if (q) { if (f) { while (p) { m = b; while (m = m[p]) if (h ? m.nodeName.toLowerCase() === r : 1 === m.nodeType) return !1; o = p = "only" === a && !o && "nextSibling" } return !0 } if (o = [g ? q.firstChild : q.lastChild], g && s) { m = q, l = m[u] || (m[u] = {}), k = l[m.uniqueID] || (l[m.uniqueID] = {}), j = k[a] || [], n = j[0] === w && j[1], t = n && j[2], m = n && q.childNodes[n]; while (m = ++n && m && m[p] || (t = n = 0) || o.pop()) if (1 === m.nodeType && ++t && m === b) { k[a] = [w, n, t]; break } } else if (s && (m = b, l = m[u] || (m[u] = {}), k = l[m.uniqueID] || (l[m.uniqueID] = {}), j = k[a] || [], n = j[0] === w && j[1], t = n), t === !1) while (m = ++n && m && m[p] || (t = n = 0) || o.pop()) if ((h ? m.nodeName.toLowerCase() === r : 1 === m.nodeType) && ++t && (s && (l = m[u] || (m[u] = {}), k = l[m.uniqueID] || (l[m.uniqueID] = {}), k[a] = [w, t]), m === b)) break; return t -= e, t === d || t % d === 0 && t / d >= 0 } } }, PSEUDO: function (a, b) { var c, e = d.pseudos[a] || d.setFilters[a.toLowerCase()] || ga.error("unsupported pseudo: " + a); return e[u] ? e(b) : e.length > 1 ? (c = [a, a, "", b], d.setFilters.hasOwnProperty(a.toLowerCase()) ? ia(function (a, c) { var d, f = e(a, b), g = f.length; while (g--) d = I(a, f[g]), a[d] = !(c[d] = f[g]) }) : function (a) { return e(a, 0, c) }) : e } }, pseudos: { not: ia(function (a) { var b = [], c = [], d = h(a.replace(P, "$1")); return d[u] ? ia(function (a, b, c, e) { var f, g = d(a, null, e, []), h = a.length; while (h--) (f = g[h]) && (a[h] = !(b[h] = f)) }) : function (a, e, f) { return b[0] = a, d(b, null, f, c), b[0] = null, !c.pop() } }), has: ia(function (a) { return function (b) { return ga(a, b).length > 0 } }), contains: ia(function (a) { return a = a.replace(_, aa), function (b) { return (b.textContent || b.innerText || e(b)).indexOf(a) > -1 } }), lang: ia(function (a) { return U.test(a || "") || ga.error("unsupported lang: " + a), a = a.replace(_, aa).toLowerCase(), function (b) { var c; do if (c = p ? b.lang : b.getAttribute("xml:lang") || b.getAttribute("lang")) return c = c.toLowerCase(), c === a || 0 === c.indexOf(a + "-"); while ((b = b.parentNode) && 1 === b.nodeType); return !1 } }), target: function (b) { var c = a.location && a.location.hash; return c && c.slice(1) === b.id }, root: function (a) { return a === o }, focus: function (a) { return a === n.activeElement && (!n.hasFocus || n.hasFocus()) && !!(a.type || a.href || ~a.tabIndex) }, enabled: oa(!1), disabled: oa(!0), checked: function (a) { var b = a.nodeName.toLowerCase(); return "input" === b && !!a.checked || "option" === b && !!a.selected }, selected: function (a) { return a.parentNode && a.parentNode.selectedIndex, a.selected === !0 }, empty: function (a) { for (a = a.firstChild; a; a = a.nextSibling) if (a.nodeType < 6) return !1; return !0 }, parent: function (a) { return !d.pseudos.empty(a) }, header: function (a) { return X.test(a.nodeName) }, input: function (a) { return W.test(a.nodeName) }, button: function (a) { var b = a.nodeName.toLowerCase(); return "input" === b && "button" === a.type || "button" === b }, text: function (a) { var b; return "input" === a.nodeName.toLowerCase() && "text" === a.type && (null == (b = a.getAttribute("type")) || "text" === b.toLowerCase()) }, first: pa(function () { return [0] }), last: pa(function (a, b) { return [b - 1] }), eq: pa(function (a, b, c) { return [c < 0 ? c + b : c] }), even: pa(function (a, b) { for (var c = 0; c < b; c += 2) a.push(c); return a }), odd: pa(function (a, b) { for (var c = 1; c < b; c += 2) a.push(c); return a }), lt: pa(function (a, b, c) { for (var d = c < 0 ? c + b : c; --d >= 0;) a.push(d); return a }), gt: pa(function (a, b, c) { for (var d = c < 0 ? c + b : c; ++d < b;) a.push(d); return a }) } }, d.pseudos.nth = d.pseudos.eq; for (b in { radio: !0, checkbox: !0, file: !0, password: !0, image: !0 }) d.pseudos[b] = ma(b); for (b in { submit: !0, reset: !0 }) d.pseudos[b] = na(b); function ra() { } ra.prototype = d.filters = d.pseudos, d.setFilters = new ra, g = ga.tokenize = function (a, b) { var c, e, f, g, h, i, j, k = z[a + " "]; if (k) return b ? 0 : k.slice(0); h = a, i = [], j = d.preFilter; while (h) { c && !(e = Q.exec(h)) || (e && (h = h.slice(e[0].length) || h), i.push(f = [])), c = !1, (e = R.exec(h)) && (c = e.shift(), f.push({ value: c, type: e[0].replace(P, " ") }), h = h.slice(c.length)); for (g in d.filter) !(e = V[g].exec(h)) || j[g] && !(e = j[g](e)) || (c = e.shift(), f.push({ value: c, type: g, matches: e }), h = h.slice(c.length)); if (!c) break } return b ? h.length : h ? ga.error(a) : z(a, i).slice(0) }; function sa(a) { for (var b = 0, c = a.length, d = ""; b < c; b++) d += a[b].value; return d } function ta(a, b, c) { var d = b.dir, e = b.next, f = e || d, g = c && "parentNode" === f, h = x++; return b.first ? function (b, c, e) { while (b = b[d]) if (1 === b.nodeType || g) return a(b, c, e); return !1 } : function (b, c, i) { var j, k, l, m = [w, h]; if (i) { while (b = b[d]) if ((1 === b.nodeType || g) && a(b, c, i)) return !0 } else while (b = b[d]) if (1 === b.nodeType || g) if (l = b[u] || (b[u] = {}), k = l[b.uniqueID] || (l[b.uniqueID] = {}), e && e === b.nodeName.toLowerCase()) b = b[d] || b; else { if ((j = k[f]) && j[0] === w && j[1] === h) return m[2] = j[2]; if (k[f] = m, m[2] = a(b, c, i)) return !0 } return !1 } } function ua(a) { return a.length > 1 ? function (b, c, d) { var e = a.length; while (e--) if (!a[e](b, c, d)) return !1; return !0 } : a[0] } function va(a, b, c) { for (var d = 0, e = b.length; d < e; d++) ga(a, b[d], c); return c } function wa(a, b, c, d, e) { for (var f, g = [], h = 0, i = a.length, j = null != b; h < i; h++) (f = a[h]) && (c && !c(f, d, e) || (g.push(f), j && b.push(h))); return g } function xa(a, b, c, d, e, f) { return d && !d[u] && (d = xa(d)), e && !e[u] && (e = xa(e, f)), ia(function (f, g, h, i) { var j, k, l, m = [], n = [], o = g.length, p = f || va(b || "*", h.nodeType ? [h] : h, []), q = !a || !f && b ? p : wa(p, m, a, h, i), r = c ? e || (f ? a : o || d) ? [] : g : q; if (c && c(q, r, h, i), d) { j = wa(r, n), d(j, [], h, i), k = j.length; while (k--) (l = j[k]) && (r[n[k]] = !(q[n[k]] = l)) } if (f) { if (e || a) { if (e) { j = [], k = r.length; while (k--) (l = r[k]) && j.push(q[k] = l); e(null, r = [], j, i) } k = r.length; while (k--) (l = r[k]) && (j = e ? I(f, l) : m[k]) > -1 && (f[j] = !(g[j] = l)) } } else r = wa(r === g ? r.splice(o, r.length) : r), e ? e(null, g, r, i) : G.apply(g, r) }) } function ya(a) { for (var b, c, e, f = a.length, g = d.relative[a[0].type], h = g || d.relative[" "], i = g ? 1 : 0, k = ta(function (a) { return a === b }, h, !0), l = ta(function (a) { return I(b, a) > -1 }, h, !0), m = [function (a, c, d) { var e = !g && (d || c !== j) || ((b = c).nodeType ? k(a, c, d) : l(a, c, d)); return b = null, e }]; i < f; i++) if (c = d.relative[a[i].type]) m = [ta(ua(m), c)]; else { if (c = d.filter[a[i].type].apply(null, a[i].matches), c[u]) { for (e = ++i; e < f; e++) if (d.relative[a[e].type]) break; return xa(i > 1 && ua(m), i > 1 && sa(a.slice(0, i - 1).concat({ value: " " === a[i - 2].type ? "*" : "" })).replace(P, "$1"), c, i < e && ya(a.slice(i, e)), e < f && ya(a = a.slice(e)), e < f && sa(a)) } m.push(c) } return ua(m) } function za(a, b) { var c = b.length > 0, e = a.length > 0, f = function (f, g, h, i, k) { var l, o, q, r = 0, s = "0", t = f && [], u = [], v = j, x = f || e && d.find.TAG("*", k), y = w += null == v ? 1 : Math.random() || .1, z = x.length; for (k && (j = g === n || g || k) ; s !== z && null != (l = x[s]) ; s++) { if (e && l) { o = 0, g || l.ownerDocument === n || (m(l), h = !p); while (q = a[o++]) if (q(l, g || n, h)) { i.push(l); break } k && (w = y) } c && ((l = !q && l) && r--, f && t.push(l)) } if (r += s, c && s !== r) { o = 0; while (q = b[o++]) q(t, u, g, h); if (f) { if (r > 0) while (s--) t[s] || u[s] || (u[s] = E.call(i)); u = wa(u) } G.apply(i, u), k && !f && u.length > 0 && r + b.length > 1 && ga.uniqueSort(i) } return k && (w = y, j = v), t }; return c ? ia(f) : f } return h = ga.compile = function (a, b) { var c, d = [], e = [], f = A[a + " "]; if (!f) { b || (b = g(a)), c = b.length; while (c--) f = ya(b[c]), f[u] ? d.push(f) : e.push(f); f = A(a, za(e, d)), f.selector = a } return f }, i = ga.select = function (a, b, c, e) { var f, i, j, k, l, m = "function" == typeof a && a, n = !e && g(a = m.selector || a); if (c = c || [], 1 === n.length) { if (i = n[0] = n[0].slice(0), i.length > 2 && "ID" === (j = i[0]).type && 9 === b.nodeType && p && d.relative[i[1].type]) { if (b = (d.find.ID(j.matches[0].replace(_, aa), b) || [])[0], !b) return c; m && (b = b.parentNode), a = a.slice(i.shift().value.length) } f = V.needsContext.test(a) ? 0 : i.length; while (f--) { if (j = i[f], d.relative[k = j.type]) break; if ((l = d.find[k]) && (e = l(j.matches[0].replace(_, aa), $.test(i[0].type) && qa(b.parentNode) || b))) { if (i.splice(f, 1), a = e.length && sa(i), !a) return G.apply(c, e), c; break } } } return (m || h(a, n))(e, b, !p, c, !b || $.test(a) && qa(b.parentNode) || b), c }, c.sortStable = u.split("").sort(B).join("") === u, c.detectDuplicates = !!l, m(), c.sortDetached = ja(function (a) { return 1 & a.compareDocumentPosition(n.createElement("fieldset")) }), ja(function (a) { return a.innerHTML = "", "#" === a.firstChild.getAttribute("href") }) || ka("type|href|height|width", function (a, b, c) { if (!c) return a.getAttribute(b, "type" === b.toLowerCase() ? 1 : 2) }), c.attributes && ja(function (a) { return a.innerHTML = "", a.firstChild.setAttribute("value", ""), "" === a.firstChild.getAttribute("value") }) || ka("value", function (a, b, c) { if (!c && "input" === a.nodeName.toLowerCase()) return a.defaultValue }), ja(function (a) { return null == a.getAttribute("disabled") }) || ka(J, function (a, b, c) { var d; if (!c) return a[b] === !0 ? b.toLowerCase() : (d = a.getAttributeNode(b)) && d.specified ? d.value : null }), ga }(a); r.find = x, r.expr = x.selectors, r.expr[":"] = r.expr.pseudos, r.uniqueSort = r.unique = x.uniqueSort, r.text = x.getText, r.isXMLDoc = x.isXML, r.contains = x.contains, r.escapeSelector = x.escape; var y = function (a, b, c) { var d = [], e = void 0 !== c; while ((a = a[b]) && 9 !== a.nodeType) if (1 === a.nodeType) { if (e && r(a).is(c)) break; d.push(a) } return d }, z = function (a, b) { for (var c = []; a; a = a.nextSibling) 1 === a.nodeType && a !== b && c.push(a); return c }, A = r.expr.match.needsContext, B = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i, C = /^.[^:#\[\.,]*$/; function D(a, b, c) { return r.isFunction(b) ? r.grep(a, function (a, d) { return !!b.call(a, d, a) !== c }) : b.nodeType ? r.grep(a, function (a) { return a === b !== c }) : "string" != typeof b ? r.grep(a, function (a) { return i.call(b, a) > -1 !== c }) : C.test(b) ? r.filter(b, a, c) : (b = r.filter(b, a), r.grep(a, function (a) { return i.call(b, a) > -1 !== c && 1 === a.nodeType })) } r.filter = function (a, b, c) { var d = b[0]; return c && (a = ":not(" + a + ")"), 1 === b.length && 1 === d.nodeType ? r.find.matchesSelector(d, a) ? [d] : [] : r.find.matches(a, r.grep(b, function (a) { return 1 === a.nodeType })) }, r.fn.extend({ find: function (a) { var b, c, d = this.length, e = this; if ("string" != typeof a) return this.pushStack(r(a).filter(function () { for (b = 0; b < d; b++) if (r.contains(e[b], this)) return !0 })); for (c = this.pushStack([]), b = 0; b < d; b++) r.find(a, e[b], c); return d > 1 ? r.uniqueSort(c) : c }, filter: function (a) { return this.pushStack(D(this, a || [], !1)) }, not: function (a) { return this.pushStack(D(this, a || [], !0)) }, is: function (a) { return !!D(this, "string" == typeof a && A.test(a) ? r(a) : a || [], !1).length } }); var E, F = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, G = r.fn.init = function (a, b, c) { var e, f; if (!a) return this; if (c = c || E, "string" == typeof a) { if (e = "<" === a[0] && ">" === a[a.length - 1] && a.length >= 3 ? [null, a, null] : F.exec(a), !e || !e[1] && b) return !b || b.jquery ? (b || c).find(a) : this.constructor(b).find(a); if (e[1]) { if (b = b instanceof r ? b[0] : b, r.merge(this, r.parseHTML(e[1], b && b.nodeType ? b.ownerDocument || b : d, !0)), B.test(e[1]) && r.isPlainObject(b)) for (e in b) r.isFunction(this[e]) ? this[e](b[e]) : this.attr(e, b[e]); return this } return f = d.getElementById(e[2]), f && (this[0] = f, this.length = 1), this } return a.nodeType ? (this[0] = a, this.length = 1, this) : r.isFunction(a) ? void 0 !== c.ready ? c.ready(a) : a(r) : r.makeArray(a, this) }; G.prototype = r.fn, E = r(d); var H = /^(?:parents|prev(?:Until|All))/, I = { children: !0, contents: !0, next: !0, prev: !0 }; r.fn.extend({ has: function (a) { var b = r(a, this), c = b.length; return this.filter(function () { for (var a = 0; a < c; a++) if (r.contains(this, b[a])) return !0 }) }, closest: function (a, b) { var c, d = 0, e = this.length, f = [], g = "string" != typeof a && r(a); if (!A.test(a)) for (; d < e; d++) for (c = this[d]; c && c !== b; c = c.parentNode) if (c.nodeType < 11 && (g ? g.index(c) > -1 : 1 === c.nodeType && r.find.matchesSelector(c, a))) { f.push(c); break } return this.pushStack(f.length > 1 ? r.uniqueSort(f) : f) }, index: function (a) { return a ? "string" == typeof a ? i.call(r(a), this[0]) : i.call(this, a.jquery ? a[0] : a) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1 }, add: function (a, b) { return this.pushStack(r.uniqueSort(r.merge(this.get(), r(a, b)))) }, addBack: function (a) { return this.add(null == a ? this.prevObject : this.prevObject.filter(a)) } }); function J(a, b) { while ((a = a[b]) && 1 !== a.nodeType); return a } r.each({ parent: function (a) { var b = a.parentNode; return b && 11 !== b.nodeType ? b : null }, parents: function (a) { return y(a, "parentNode") }, parentsUntil: function (a, b, c) { return y(a, "parentNode", c) }, next: function (a) { return J(a, "nextSibling") }, prev: function (a) { return J(a, "previousSibling") }, nextAll: function (a) { return y(a, "nextSibling") }, prevAll: function (a) { return y(a, "previousSibling") }, nextUntil: function (a, b, c) { return y(a, "nextSibling", c) }, prevUntil: function (a, b, c) { return y(a, "previousSibling", c) }, siblings: function (a) { return z((a.parentNode || {}).firstChild, a) }, children: function (a) { return z(a.firstChild) }, contents: function (a) { return a.contentDocument || r.merge([], a.childNodes) } }, function (a, b) { r.fn[a] = function (c, d) { var e = r.map(this, b, c); return "Until" !== a.slice(-5) && (d = c), d && "string" == typeof d && (e = r.filter(d, e)), this.length > 1 && (I[a] || r.uniqueSort(e), H.test(a) && e.reverse()), this.pushStack(e) } }); var K = /[^\x20\t\r\n\f]+/g; function L(a) { var b = {}; return r.each(a.match(K) || [], function (a, c) { b[c] = !0 }), b } r.Callbacks = function (a) { a = "string" == typeof a ? L(a) : r.extend({}, a); var b, c, d, e, f = [], g = [], h = -1, i = function () { for (e = a.once, d = b = !0; g.length; h = -1) { c = g.shift(); while (++h < f.length) f[h].apply(c[0], c[1]) === !1 && a.stopOnFalse && (h = f.length, c = !1) } a.memory || (c = !1), b = !1, e && (f = c ? [] : "") }, j = { add: function () { return f && (c && !b && (h = f.length - 1, g.push(c)), function d(b) { r.each(b, function (b, c) { r.isFunction(c) ? a.unique && j.has(c) || f.push(c) : c && c.length && "string" !== r.type(c) && d(c) }) }(arguments), c && !b && i()), this }, remove: function () { return r.each(arguments, function (a, b) { var c; while ((c = r.inArray(b, f, c)) > -1) f.splice(c, 1), c <= h && h-- }), this }, has: function (a) { return a ? r.inArray(a, f) > -1 : f.length > 0 }, empty: function () { return f && (f = []), this }, disable: function () { return e = g = [], f = c = "", this }, disabled: function () { return !f }, lock: function () { return e = g = [], c || b || (f = c = ""), this }, locked: function () { return !!e }, fireWith: function (a, c) { return e || (c = c || [], c = [a, c.slice ? c.slice() : c], g.push(c), b || i()), this }, fire: function () { return j.fireWith(this, arguments), this }, fired: function () { return !!d } }; return j }; function M(a) { return a } function N(a) { throw a } function O(a, b, c) { var d; try { a && r.isFunction(d = a.promise) ? d.call(a).done(b).fail(c) : a && r.isFunction(d = a.then) ? d.call(a, b, c) : b.call(void 0, a) } catch (a) { c.call(void 0, a) } } r.extend({ Deferred: function (b) { var c = [["notify", "progress", r.Callbacks("memory"), r.Callbacks("memory"), 2], ["resolve", "done", r.Callbacks("once memory"), r.Callbacks("once memory"), 0, "resolved"], ["reject", "fail", r.Callbacks("once memory"), r.Callbacks("once memory"), 1, "rejected"]], d = "pending", e = { state: function () { return d }, always: function () { return f.done(arguments).fail(arguments), this }, "catch": function (a) { return e.then(null, a) }, pipe: function () { var a = arguments; return r.Deferred(function (b) { r.each(c, function (c, d) { var e = r.isFunction(a[d[4]]) && a[d[4]]; f[d[1]](function () { var a = e && e.apply(this, arguments); a && r.isFunction(a.promise) ? a.promise().progress(b.notify).done(b.resolve).fail(b.reject) : b[d[0] + "With"](this, e ? [a] : arguments) }) }), a = null }).promise() }, then: function (b, d, e) { var f = 0; function g(b, c, d, e) { return function () { var h = this, i = arguments, j = function () { var a, j; if (!(b < f)) { if (a = d.apply(h, i), a === c.promise()) throw new TypeError("Thenable self-resolution"); j = a && ("object" == typeof a || "function" == typeof a) && a.then, r.isFunction(j) ? e ? j.call(a, g(f, c, M, e), g(f, c, N, e)) : (f++, j.call(a, g(f, c, M, e), g(f, c, N, e), g(f, c, M, c.notifyWith))) : (d !== M && (h = void 0, i = [a]), (e || c.resolveWith)(h, i)) } }, k = e ? j : function () { try { j() } catch (a) { r.Deferred.exceptionHook && r.Deferred.exceptionHook(a, k.stackTrace), b + 1 >= f && (d !== N && (h = void 0, i = [a]), c.rejectWith(h, i)) } }; b ? k() : (r.Deferred.getStackHook && (k.stackTrace = r.Deferred.getStackHook()), a.setTimeout(k)) } } return r.Deferred(function (a) { c[0][3].add(g(0, a, r.isFunction(e) ? e : M, a.notifyWith)), c[1][3].add(g(0, a, r.isFunction(b) ? b : M)), c[2][3].add(g(0, a, r.isFunction(d) ? d : N)) }).promise() }, promise: function (a) { return null != a ? r.extend(a, e) : e } }, f = {}; return r.each(c, function (a, b) { var g = b[2], h = b[5]; e[b[1]] = g.add, h && g.add(function () { d = h }, c[3 - a][2].disable, c[0][2].lock), g.add(b[3].fire), f[b[0]] = function () { return f[b[0] + "With"](this === f ? void 0 : this, arguments), this }, f[b[0] + "With"] = g.fireWith }), e.promise(f), b && b.call(f, f), f }, when: function (a) { var b = arguments.length, c = b, d = Array(c), e = f.call(arguments), g = r.Deferred(), h = function (a) { return function (c) { d[a] = this, e[a] = arguments.length > 1 ? f.call(arguments) : c, --b || g.resolveWith(d, e) } }; if (b <= 1 && (O(a, g.done(h(c)).resolve, g.reject), "pending" === g.state() || r.isFunction(e[c] && e[c].then))) return g.then(); while (c--) O(e[c], h(c), g.reject); return g.promise() } }); var P = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; r.Deferred.exceptionHook = function (b, c) { a.console && a.console.warn && b && P.test(b.name) && a.console.warn("jQuery.Deferred exception: " + b.message, b.stack, c) }, r.readyException = function (b) { a.setTimeout(function () { throw b }) }; var Q = r.Deferred(); r.fn.ready = function (a) { return Q.then(a)["catch"](function (a) { r.readyException(a) }), this }, r.extend({ isReady: !1, readyWait: 1, holdReady: function (a) { a ? r.readyWait++ : r.ready(!0) }, ready: function (a) { (a === !0 ? --r.readyWait : r.isReady) || (r.isReady = !0, a !== !0 && --r.readyWait > 0 || Q.resolveWith(d, [r])) } }), r.ready.then = Q.then; function R() { d.removeEventListener("DOMContentLoaded", R), a.removeEventListener("load", R), r.ready() } "complete" === d.readyState || "loading" !== d.readyState && !d.documentElement.doScroll ? a.setTimeout(r.ready) : (d.addEventListener("DOMContentLoaded", R), a.addEventListener("load", R)); var S = function (a, b, c, d, e, f, g) { var h = 0, i = a.length, j = null == c; if ("object" === r.type(c)) { e = !0; for (h in c) S(a, b, h, c[h], !0, f, g) } else if (void 0 !== d && (e = !0, r.isFunction(d) || (g = !0), j && (g ? (b.call(a, d), b = null) : (j = b, b = function (a, b, c) { return j.call(r(a), c) })), b)) for (; h < i; h++) b(a[h], c, g ? d : d.call(a[h], h, b(a[h], c))); return e ? a : j ? b.call(a) : i ? b(a[0], c) : f }, T = function (a) { return 1 === a.nodeType || 9 === a.nodeType || !+a.nodeType }; function U() { this.expando = r.expando + U.uid++ } U.uid = 1, U.prototype = { cache: function (a) { var b = a[this.expando]; return b || (b = {}, T(a) && (a.nodeType ? a[this.expando] = b : Object.defineProperty(a, this.expando, { value: b, configurable: !0 }))), b }, set: function (a, b, c) { var d, e = this.cache(a); if ("string" == typeof b) e[r.camelCase(b)] = c; else for (d in b) e[r.camelCase(d)] = b[d]; return e }, get: function (a, b) { return void 0 === b ? this.cache(a) : a[this.expando] && a[this.expando][r.camelCase(b)] }, access: function (a, b, c) { return void 0 === b || b && "string" == typeof b && void 0 === c ? this.get(a, b) : (this.set(a, b, c), void 0 !== c ? c : b) }, remove: function (a, b) { var c, d = a[this.expando]; if (void 0 !== d) { if (void 0 !== b) { r.isArray(b) ? b = b.map(r.camelCase) : (b = r.camelCase(b), b = b in d ? [b] : b.match(K) || []), c = b.length; while (c--) delete d[b[c]] } (void 0 === b || r.isEmptyObject(d)) && (a.nodeType ? a[this.expando] = void 0 : delete a[this.expando]) } }, hasData: function (a) { var b = a[this.expando]; return void 0 !== b && !r.isEmptyObject(b) } }; var V = new U, W = new U, X = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, Y = /[A-Z]/g; function Z(a) { return "true" === a || "false" !== a && ("null" === a ? null : a === +a + "" ? +a : X.test(a) ? JSON.parse(a) : a) } function $(a, b, c) { var d; if (void 0 === c && 1 === a.nodeType) if (d = "data-" + b.replace(Y, "-$&").toLowerCase(), c = a.getAttribute(d), "string" == typeof c) { try { c = Z(c) } catch (e) { } W.set(a, b, c) } else c = void 0; return c } r.extend({ hasData: function (a) { return W.hasData(a) || V.hasData(a) }, data: function (a, b, c) { return W.access(a, b, c) }, removeData: function (a, b) { W.remove(a, b) }, _data: function (a, b, c) { return V.access(a, b, c) }, _removeData: function (a, b) { V.remove(a, b) } }), r.fn.extend({ data: function (a, b) { var c, d, e, f = this[0], g = f && f.attributes; if (void 0 === a) { if (this.length && (e = W.get(f), 1 === f.nodeType && !V.get(f, "hasDataAttrs"))) { c = g.length; while (c--) g[c] && (d = g[c].name, 0 === d.indexOf("data-") && (d = r.camelCase(d.slice(5)), $(f, d, e[d]))); V.set(f, "hasDataAttrs", !0) } return e } return "object" == typeof a ? this.each(function () { W.set(this, a) }) : S(this, function (b) { var c; if (f && void 0 === b) { if (c = W.get(f, a), void 0 !== c) return c; if (c = $(f, a), void 0 !== c) return c } else this.each(function () { W.set(this, a, b) }) }, null, b, arguments.length > 1, null, !0) }, removeData: function (a) { return this.each(function () { W.remove(this, a) }) } }), r.extend({ queue: function (a, b, c) { var d; if (a) return b = (b || "fx") + "queue", d = V.get(a, b), c && (!d || r.isArray(c) ? d = V.access(a, b, r.makeArray(c)) : d.push(c)), d || [] }, dequeue: function (a, b) { b = b || "fx"; var c = r.queue(a, b), d = c.length, e = c.shift(), f = r._queueHooks(a, b), g = function () { r.dequeue(a, b) }; "inprogress" === e && (e = c.shift(), d--), e && ("fx" === b && c.unshift("inprogress"), delete f.stop, e.call(a, g, f)), !d && f && f.empty.fire() }, _queueHooks: function (a, b) { var c = b + "queueHooks"; return V.get(a, c) || V.access(a, c, { empty: r.Callbacks("once memory").add(function () { V.remove(a, [b + "queue", c]) }) }) } }), r.fn.extend({ queue: function (a, b) { var c = 2; return "string" != typeof a && (b = a, a = "fx", c--), arguments.length < c ? r.queue(this[0], a) : void 0 === b ? this : this.each(function () { var c = r.queue(this, a, b); r._queueHooks(this, a), "fx" === a && "inprogress" !== c[0] && r.dequeue(this, a) }) }, dequeue: function (a) { return this.each(function () { r.dequeue(this, a) }) }, clearQueue: function (a) { return this.queue(a || "fx", []) }, promise: function (a, b) { var c, d = 1, e = r.Deferred(), f = this, g = this.length, h = function () { --d || e.resolveWith(f, [f]) }; "string" != typeof a && (b = a, a = void 0), a = a || "fx"; while (g--) c = V.get(f[g], a + "queueHooks"), c && c.empty && (d++, c.empty.add(h)); return h(), e.promise(b) } }); var _ = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, aa = new RegExp("^(?:([+-])=|)(" + _ + ")([a-z%]*)$", "i"), ba = ["Top", "Right", "Bottom", "Left"], ca = function (a, b) { return a = b || a, "none" === a.style.display || "" === a.style.display && r.contains(a.ownerDocument, a) && "none" === r.css(a, "display") }, da = function (a, b, c, d) { var e, f, g = {}; for (f in b) g[f] = a.style[f], a.style[f] = b[f]; e = c.apply(a, d || []); for (f in b) a.style[f] = g[f]; return e }; function ea(a, b, c, d) { var e, f = 1, g = 20, h = d ? function () { return d.cur() } : function () { return r.css(a, b, "") }, i = h(), j = c && c[3] || (r.cssNumber[b] ? "" : "px"), k = (r.cssNumber[b] || "px" !== j && +i) && aa.exec(r.css(a, b)); if (k && k[3] !== j) { j = j || k[3], c = c || [], k = +i || 1; do f = f || ".5", k /= f, r.style(a, b, k + j); while (f !== (f = h() / i) && 1 !== f && --g) } return c && (k = +k || +i || 0, e = c[1] ? k + (c[1] + 1) * c[2] : +c[2], d && (d.unit = j, d.start = k, d.end = e)), e } var fa = {}; function ga(a) { var b, c = a.ownerDocument, d = a.nodeName, e = fa[d]; return e ? e : (b = c.body.appendChild(c.createElement(d)), e = r.css(b, "display"), b.parentNode.removeChild(b), "none" === e && (e = "block"), fa[d] = e, e) } function ha(a, b) { for (var c, d, e = [], f = 0, g = a.length; f < g; f++) d = a[f], d.style && (c = d.style.display, b ? ("none" === c && (e[f] = V.get(d, "display") || null, e[f] || (d.style.display = "")), "" === d.style.display && ca(d) && (e[f] = ga(d))) : "none" !== c && (e[f] = "none", V.set(d, "display", c))); for (f = 0; f < g; f++) null != e[f] && (a[f].style.display = e[f]); return a } r.fn.extend({ show: function () { return ha(this, !0) }, hide: function () { return ha(this) }, toggle: function (a) { return "boolean" == typeof a ? a ? this.show() : this.hide() : this.each(function () { ca(this) ? r(this).show() : r(this).hide() }) } }); var ia = /^(?:checkbox|radio)$/i, ja = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i, ka = /^$|\/(?:java|ecma)script/i, la = { option: [1, ""], thead: [1, "", "
"], col: [2, "", "
"], tr: [2, "", "
"], td: [3, "", "
"], _default: [0, "", ""] }; la.optgroup = la.option, la.tbody = la.tfoot = la.colgroup = la.caption = la.thead, la.th = la.td; function ma(a, b) { var c; return c = "undefined" != typeof a.getElementsByTagName ? a.getElementsByTagName(b || "*") : "undefined" != typeof a.querySelectorAll ? a.querySelectorAll(b || "*") : [], void 0 === b || b && r.nodeName(a, b) ? r.merge([a], c) : c } function na(a, b) { for (var c = 0, d = a.length; c < d; c++) V.set(a[c], "globalEval", !b || V.get(b[c], "globalEval")) } var oa = /<|&#?\w+;/; function pa(a, b, c, d, e) { for (var f, g, h, i, j, k, l = b.createDocumentFragment(), m = [], n = 0, o = a.length; n < o; n++) if (f = a[n], f || 0 === f) if ("object" === r.type(f)) r.merge(m, f.nodeType ? [f] : f); else if (oa.test(f)) { g = g || l.appendChild(b.createElement("div")), h = (ja.exec(f) || ["", ""])[1].toLowerCase(), i = la[h] || la._default, g.innerHTML = i[1] + r.htmlPrefilter(f) + i[2], k = i[0]; while (k--) g = g.lastChild; r.merge(m, g.childNodes), g = l.firstChild, g.textContent = "" } else m.push(b.createTextNode(f)); l.textContent = "", n = 0; while (f = m[n++]) if (d && r.inArray(f, d) > -1) e && e.push(f); else if (j = r.contains(f.ownerDocument, f), g = ma(l.appendChild(f), "script"), j && na(g), c) { k = 0; while (f = g[k++]) ka.test(f.type || "") && c.push(f) } return l } ! function () { var a = d.createDocumentFragment(), b = a.appendChild(d.createElement("div")), c = d.createElement("input"); c.setAttribute("type", "radio"), c.setAttribute("checked", "checked"), c.setAttribute("name", "t"), b.appendChild(c), o.checkClone = b.cloneNode(!0).cloneNode(!0).lastChild.checked, b.innerHTML = "", o.noCloneChecked = !!b.cloneNode(!0).lastChild.defaultValue }(); var qa = d.documentElement, ra = /^key/, sa = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, ta = /^([^.]*)(?:\.(.+)|)/; function ua() { return !0 } function va() { return !1 } function wa() { try { return d.activeElement } catch (a) { } } function xa(a, b, c, d, e, f) { var g, h; if ("object" == typeof b) { "string" != typeof c && (d = d || c, c = void 0); for (h in b) xa(a, h, c, d, b[h], f); return a } if (null == d && null == e ? (e = c, d = c = void 0) : null == e && ("string" == typeof c ? (e = d, d = void 0) : (e = d, d = c, c = void 0)), e === !1) e = va; else if (!e) return a; return 1 === f && (g = e, e = function (a) { return r().off(a), g.apply(this, arguments) }, e.guid = g.guid || (g.guid = r.guid++)), a.each(function () { r.event.add(this, b, e, d, c) }) } r.event = { global: {}, add: function (a, b, c, d, e) { var f, g, h, i, j, k, l, m, n, o, p, q = V.get(a); if (q) { c.handler && (f = c, c = f.handler, e = f.selector), e && r.find.matchesSelector(qa, e), c.guid || (c.guid = r.guid++), (i = q.events) || (i = q.events = {}), (g = q.handle) || (g = q.handle = function (b) { return "undefined" != typeof r && r.event.triggered !== b.type ? r.event.dispatch.apply(a, arguments) : void 0 }), b = (b || "").match(K) || [""], j = b.length; while (j--) h = ta.exec(b[j]) || [], n = p = h[1], o = (h[2] || "").split(".").sort(), n && (l = r.event.special[n] || {}, n = (e ? l.delegateType : l.bindType) || n, l = r.event.special[n] || {}, k = r.extend({ type: n, origType: p, data: d, handler: c, guid: c.guid, selector: e, needsContext: e && r.expr.match.needsContext.test(e), namespace: o.join(".") }, f), (m = i[n]) || (m = i[n] = [], m.delegateCount = 0, l.setup && l.setup.call(a, d, o, g) !== !1 || a.addEventListener && a.addEventListener(n, g)), l.add && (l.add.call(a, k), k.handler.guid || (k.handler.guid = c.guid)), e ? m.splice(m.delegateCount++, 0, k) : m.push(k), r.event.global[n] = !0) } }, remove: function (a, b, c, d, e) { var f, g, h, i, j, k, l, m, n, o, p, q = V.hasData(a) && V.get(a); if (q && (i = q.events)) { b = (b || "").match(K) || [""], j = b.length; while (j--) if (h = ta.exec(b[j]) || [], n = p = h[1], o = (h[2] || "").split(".").sort(), n) { l = r.event.special[n] || {}, n = (d ? l.delegateType : l.bindType) || n, m = i[n] || [], h = h[2] && new RegExp("(^|\\.)" + o.join("\\.(?:.*\\.|)") + "(\\.|$)"), g = f = m.length; while (f--) k = m[f], !e && p !== k.origType || c && c.guid !== k.guid || h && !h.test(k.namespace) || d && d !== k.selector && ("**" !== d || !k.selector) || (m.splice(f, 1), k.selector && m.delegateCount--, l.remove && l.remove.call(a, k)); g && !m.length && (l.teardown && l.teardown.call(a, o, q.handle) !== !1 || r.removeEvent(a, n, q.handle), delete i[n]) } else for (n in i) r.event.remove(a, n + b[j], c, d, !0); r.isEmptyObject(i) && V.remove(a, "handle events") } }, dispatch: function (a) { var b = r.event.fix(a), c, d, e, f, g, h, i = new Array(arguments.length), j = (V.get(this, "events") || {})[b.type] || [], k = r.event.special[b.type] || {}; for (i[0] = b, c = 1; c < arguments.length; c++) i[c] = arguments[c]; if (b.delegateTarget = this, !k.preDispatch || k.preDispatch.call(this, b) !== !1) { h = r.event.handlers.call(this, b, j), c = 0; while ((f = h[c++]) && !b.isPropagationStopped()) { b.currentTarget = f.elem, d = 0; while ((g = f.handlers[d++]) && !b.isImmediatePropagationStopped()) b.rnamespace && !b.rnamespace.test(g.namespace) || (b.handleObj = g, b.data = g.data, e = ((r.event.special[g.origType] || {}).handle || g.handler).apply(f.elem, i), void 0 !== e && (b.result = e) === !1 && (b.preventDefault(), b.stopPropagation())) } return k.postDispatch && k.postDispatch.call(this, b), b.result } }, handlers: function (a, b) { var c, d, e, f, g, h = [], i = b.delegateCount, j = a.target; if (i && j.nodeType && !("click" === a.type && a.button >= 1)) for (; j !== this; j = j.parentNode || this) if (1 === j.nodeType && ("click" !== a.type || j.disabled !== !0)) { for (f = [], g = {}, c = 0; c < i; c++) d = b[c], e = d.selector + " ", void 0 === g[e] && (g[e] = d.needsContext ? r(e, this).index(j) > -1 : r.find(e, this, null, [j]).length), g[e] && f.push(d); f.length && h.push({ elem: j, handlers: f }) } return j = this, i < b.length && h.push({ elem: j, handlers: b.slice(i) }), h }, addProp: function (a, b) { Object.defineProperty(r.Event.prototype, a, { enumerable: !0, configurable: !0, get: r.isFunction(b) ? function () { if (this.originalEvent) return b(this.originalEvent) } : function () { if (this.originalEvent) return this.originalEvent[a] }, set: function (b) { Object.defineProperty(this, a, { enumerable: !0, configurable: !0, writable: !0, value: b }) } }) }, fix: function (a) { return a[r.expando] ? a : new r.Event(a) }, special: { load: { noBubble: !0 }, focus: { trigger: function () { if (this !== wa() && this.focus) return this.focus(), !1 }, delegateType: "focusin" }, blur: { trigger: function () { if (this === wa() && this.blur) return this.blur(), !1 }, delegateType: "focusout" }, click: { trigger: function () { if ("checkbox" === this.type && this.click && r.nodeName(this, "input")) return this.click(), !1 }, _default: function (a) { return r.nodeName(a.target, "a") } }, beforeunload: { postDispatch: function (a) { void 0 !== a.result && a.originalEvent && (a.originalEvent.returnValue = a.result) } } } }, r.removeEvent = function (a, b, c) { a.removeEventListener && a.removeEventListener(b, c) }, r.Event = function (a, b) { return this instanceof r.Event ? (a && a.type ? (this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || void 0 === a.defaultPrevented && a.returnValue === !1 ? ua : va, this.target = a.target && 3 === a.target.nodeType ? a.target.parentNode : a.target, this.currentTarget = a.currentTarget, this.relatedTarget = a.relatedTarget) : this.type = a, b && r.extend(this, b), this.timeStamp = a && a.timeStamp || r.now(), void (this[r.expando] = !0)) : new r.Event(a, b) }, r.Event.prototype = { constructor: r.Event, isDefaultPrevented: va, isPropagationStopped: va, isImmediatePropagationStopped: va, isSimulated: !1, preventDefault: function () { var a = this.originalEvent; this.isDefaultPrevented = ua, a && !this.isSimulated && a.preventDefault() }, stopPropagation: function () { var a = this.originalEvent; this.isPropagationStopped = ua, a && !this.isSimulated && a.stopPropagation() }, stopImmediatePropagation: function () { var a = this.originalEvent; this.isImmediatePropagationStopped = ua, a && !this.isSimulated && a.stopImmediatePropagation(), this.stopPropagation() } }, r.each({ altKey: !0, bubbles: !0, cancelable: !0, changedTouches: !0, ctrlKey: !0, detail: !0, eventPhase: !0, metaKey: !0, pageX: !0, pageY: !0, shiftKey: !0, view: !0, "char": !0, charCode: !0, key: !0, keyCode: !0, button: !0, buttons: !0, clientX: !0, clientY: !0, offsetX: !0, offsetY: !0, pointerId: !0, pointerType: !0, screenX: !0, screenY: !0, targetTouches: !0, toElement: !0, touches: !0, which: function (a) { var b = a.button; return null == a.which && ra.test(a.type) ? null != a.charCode ? a.charCode : a.keyCode : !a.which && void 0 !== b && sa.test(a.type) ? 1 & b ? 1 : 2 & b ? 3 : 4 & b ? 2 : 0 : a.which } }, r.event.addProp), r.each({ mouseenter: "mouseover", mouseleave: "mouseout", pointerenter: "pointerover", pointerleave: "pointerout" }, function (a, b) { r.event.special[a] = { delegateType: b, bindType: b, handle: function (a) { var c, d = this, e = a.relatedTarget, f = a.handleObj; return e && (e === d || r.contains(d, e)) || (a.type = f.origType, c = f.handler.apply(this, arguments), a.type = b), c } } }), r.fn.extend({ on: function (a, b, c, d) { return xa(this, a, b, c, d) }, one: function (a, b, c, d) { return xa(this, a, b, c, d, 1) }, off: function (a, b, c) { var d, e; if (a && a.preventDefault && a.handleObj) return d = a.handleObj, r(a.delegateTarget).off(d.namespace ? d.origType + "." + d.namespace : d.origType, d.selector, d.handler), this; if ("object" == typeof a) { for (e in a) this.off(e, b, a[e]); return this } return b !== !1 && "function" != typeof b || (c = b, b = void 0), c === !1 && (c = va), this.each(function () { r.event.remove(this, a, c, b) }) } }); var ya = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, za = /\s*$/g; function Da(a, b) { return r.nodeName(a, "table") && r.nodeName(11 !== b.nodeType ? b : b.firstChild, "tr") ? a.getElementsByTagName("tbody")[0] || a : a } function Ea(a) { return a.type = (null !== a.getAttribute("type")) + "/" + a.type, a } function Fa(a) { var b = Ba.exec(a.type); return b ? a.type = b[1] : a.removeAttribute("type"), a } function Ga(a, b) { var c, d, e, f, g, h, i, j; if (1 === b.nodeType) { if (V.hasData(a) && (f = V.access(a), g = V.set(b, f), j = f.events)) { delete g.handle, g.events = {}; for (e in j) for (c = 0, d = j[e].length; c < d; c++) r.event.add(b, e, j[e][c]) } W.hasData(a) && (h = W.access(a), i = r.extend({}, h), W.set(b, i)) } } function Ha(a, b) { var c = b.nodeName.toLowerCase(); "input" === c && ia.test(a.type) ? b.checked = a.checked : "input" !== c && "textarea" !== c || (b.defaultValue = a.defaultValue) } function Ia(a, b, c, d) { b = g.apply([], b); var e, f, h, i, j, k, l = 0, m = a.length, n = m - 1, q = b[0], s = r.isFunction(q); if (s || m > 1 && "string" == typeof q && !o.checkClone && Aa.test(q)) return a.each(function (e) { var f = a.eq(e); s && (b[0] = q.call(this, e, f.html())), Ia(f, b, c, d) }); if (m && (e = pa(b, a[0].ownerDocument, !1, a, d), f = e.firstChild, 1 === e.childNodes.length && (e = f), f || d)) { for (h = r.map(ma(e, "script"), Ea), i = h.length; l < m; l++) j = e, l !== n && (j = r.clone(j, !0, !0), i && r.merge(h, ma(j, "script"))), c.call(a[l], j, l); if (i) for (k = h[h.length - 1].ownerDocument, r.map(h, Fa), l = 0; l < i; l++) j = h[l], ka.test(j.type || "") && !V.access(j, "globalEval") && r.contains(k, j) && (j.src ? r._evalUrl && r._evalUrl(j.src) : p(j.textContent.replace(Ca, ""), k)) } return a } function Ja(a, b, c) { for (var d, e = b ? r.filter(b, a) : a, f = 0; null != (d = e[f]) ; f++) c || 1 !== d.nodeType || r.cleanData(ma(d)), d.parentNode && (c && r.contains(d.ownerDocument, d) && na(ma(d, "script")), d.parentNode.removeChild(d)); return a } r.extend({ htmlPrefilter: function (a) { return a.replace(ya, "<$1>") }, clone: function (a, b, c) { var d, e, f, g, h = a.cloneNode(!0), i = r.contains(a.ownerDocument, a); if (!(o.noCloneChecked || 1 !== a.nodeType && 11 !== a.nodeType || r.isXMLDoc(a))) for (g = ma(h), f = ma(a), d = 0, e = f.length; d < e; d++) Ha(f[d], g[d]); if (b) if (c) for (f = f || ma(a), g = g || ma(h), d = 0, e = f.length; d < e; d++) Ga(f[d], g[d]); else Ga(a, h); return g = ma(h, "script"), g.length > 0 && na(g, !i && ma(a, "script")), h }, cleanData: function (a) { for (var b, c, d, e = r.event.special, f = 0; void 0 !== (c = a[f]) ; f++) if (T(c)) { if (b = c[V.expando]) { if (b.events) for (d in b.events) e[d] ? r.event.remove(c, d) : r.removeEvent(c, d, b.handle); c[V.expando] = void 0 } c[W.expando] && (c[W.expando] = void 0) } } }), r.fn.extend({ detach: function (a) { return Ja(this, a, !0) }, remove: function (a) { return Ja(this, a) }, text: function (a) { return S(this, function (a) { return void 0 === a ? r.text(this) : this.empty().each(function () { 1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || (this.textContent = a) }) }, null, a, arguments.length) }, append: function () { return Ia(this, arguments, function (a) { if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { var b = Da(this, a); b.appendChild(a) } }) }, prepend: function () { return Ia(this, arguments, function (a) { if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { var b = Da(this, a); b.insertBefore(a, b.firstChild) } }) }, before: function () { return Ia(this, arguments, function (a) { this.parentNode && this.parentNode.insertBefore(a, this) }) }, after: function () { return Ia(this, arguments, function (a) { this.parentNode && this.parentNode.insertBefore(a, this.nextSibling) }) }, empty: function () { for (var a, b = 0; null != (a = this[b]) ; b++) 1 === a.nodeType && (r.cleanData(ma(a, !1)), a.textContent = ""); return this }, clone: function (a, b) { return a = null != a && a, b = null == b ? a : b, this.map(function () { return r.clone(this, a, b) }) }, html: function (a) { return S(this, function (a) { var b = this[0] || {}, c = 0, d = this.length; if (void 0 === a && 1 === b.nodeType) return b.innerHTML; if ("string" == typeof a && !za.test(a) && !la[(ja.exec(a) || ["", ""])[1].toLowerCase()]) { a = r.htmlPrefilter(a); try { for (; c < d; c++) b = this[c] || {}, 1 === b.nodeType && (r.cleanData(ma(b, !1)), b.innerHTML = a); b = 0 } catch (e) { } } b && this.empty().append(a) }, null, a, arguments.length) }, replaceWith: function () { var a = []; return Ia(this, arguments, function (b) { var c = this.parentNode; r.inArray(this, a) < 0 && (r.cleanData(ma(this)), c && c.replaceChild(b, this)) }, a) } }), r.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function (a, b) { r.fn[a] = function (a) { for (var c, d = [], e = r(a), f = e.length - 1, g = 0; g <= f; g++) c = g === f ? this : this.clone(!0), r(e[g])[b](c), h.apply(d, c.get()); return this.pushStack(d) } }); var Ka = /^margin/, La = new RegExp("^(" + _ + ")(?!px)[a-z%]+$", "i"), Ma = function (b) { var c = b.ownerDocument.defaultView; return c && c.opener || (c = a), c.getComputedStyle(b) }; ! function () { function b() { if (i) { i.style.cssText = "box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%", i.innerHTML = "", qa.appendChild(h); var b = a.getComputedStyle(i); c = "1%" !== b.top, g = "2px" === b.marginLeft, e = "4px" === b.width, i.style.marginRight = "50%", f = "4px" === b.marginRight, qa.removeChild(h), i = null } } var c, e, f, g, h = d.createElement("div"), i = d.createElement("div"); i.style && (i.style.backgroundClip = "content-box", i.cloneNode(!0).style.backgroundClip = "", o.clearCloneStyle = "content-box" === i.style.backgroundClip, h.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute", h.appendChild(i), r.extend(o, { pixelPosition: function () { return b(), c }, boxSizingReliable: function () { return b(), e }, pixelMarginRight: function () { return b(), f }, reliableMarginLeft: function () { return b(), g } })) }(); function Na(a, b, c) { var d, e, f, g, h = a.style; return c = c || Ma(a), c && (g = c.getPropertyValue(b) || c[b], "" !== g || r.contains(a.ownerDocument, a) || (g = r.style(a, b)), !o.pixelMarginRight() && La.test(g) && Ka.test(b) && (d = h.width, e = h.minWidth, f = h.maxWidth, h.minWidth = h.maxWidth = h.width = g, g = c.width, h.width = d, h.minWidth = e, h.maxWidth = f)), void 0 !== g ? g + "" : g } function Oa(a, b) { return { get: function () { return a() ? void delete this.get : (this.get = b).apply(this, arguments) } } } var Pa = /^(none|table(?!-c[ea]).+)/, Qa = { position: "absolute", visibility: "hidden", display: "block" }, Ra = { letterSpacing: "0", fontWeight: "400" }, Sa = ["Webkit", "Moz", "ms"], Ta = d.createElement("div").style; function Ua(a) { if (a in Ta) return a; var b = a[0].toUpperCase() + a.slice(1), c = Sa.length; while (c--) if (a = Sa[c] + b, a in Ta) return a } function Va(a, b, c) { var d = aa.exec(b); return d ? Math.max(0, d[2] - (c || 0)) + (d[3] || "px") : b } function Wa(a, b, c, d, e) { var f, g = 0; for (f = c === (d ? "border" : "content") ? 4 : "width" === b ? 1 : 0; f < 4; f += 2) "margin" === c && (g += r.css(a, c + ba[f], !0, e)), d ? ("content" === c && (g -= r.css(a, "padding" + ba[f], !0, e)), "margin" !== c && (g -= r.css(a, "border" + ba[f] + "Width", !0, e))) : (g += r.css(a, "padding" + ba[f], !0, e), "padding" !== c && (g += r.css(a, "border" + ba[f] + "Width", !0, e))); return g } function Xa(a, b, c) { var d, e = !0, f = Ma(a), g = "border-box" === r.css(a, "boxSizing", !1, f); if (a.getClientRects().length && (d = a.getBoundingClientRect()[b]), d <= 0 || null == d) { if (d = Na(a, b, f), (d < 0 || null == d) && (d = a.style[b]), La.test(d)) return d; e = g && (o.boxSizingReliable() || d === a.style[b]), d = parseFloat(d) || 0 } return d + Wa(a, b, c || (g ? "border" : "content"), e, f) + "px" } r.extend({ cssHooks: { opacity: { get: function (a, b) { if (b) { var c = Na(a, "opacity"); return "" === c ? "1" : c } } } }, cssNumber: { animationIterationCount: !0, columnCount: !0, fillOpacity: !0, flexGrow: !0, flexShrink: !0, fontWeight: !0, lineHeight: !0, opacity: !0, order: !0, orphans: !0, widows: !0, zIndex: !0, zoom: !0 }, cssProps: { "float": "cssFloat" }, style: function (a, b, c, d) { if (a && 3 !== a.nodeType && 8 !== a.nodeType && a.style) { var e, f, g, h = r.camelCase(b), i = a.style; return b = r.cssProps[h] || (r.cssProps[h] = Ua(h) || h), g = r.cssHooks[b] || r.cssHooks[h], void 0 === c ? g && "get" in g && void 0 !== (e = g.get(a, !1, d)) ? e : i[b] : (f = typeof c, "string" === f && (e = aa.exec(c)) && e[1] && (c = ea(a, b, e), f = "number"), null != c && c === c && ("number" === f && (c += e && e[3] || (r.cssNumber[h] ? "" : "px")), o.clearCloneStyle || "" !== c || 0 !== b.indexOf("background") || (i[b] = "inherit"), g && "set" in g && void 0 === (c = g.set(a, c, d)) || (i[b] = c)), void 0) } }, css: function (a, b, c, d) { var e, f, g, h = r.camelCase(b); return b = r.cssProps[h] || (r.cssProps[h] = Ua(h) || h), g = r.cssHooks[b] || r.cssHooks[h], g && "get" in g && (e = g.get(a, !0, c)), void 0 === e && (e = Na(a, b, d)), "normal" === e && b in Ra && (e = Ra[b]), "" === c || c ? (f = parseFloat(e), c === !0 || isFinite(f) ? f || 0 : e) : e } }), r.each(["height", "width"], function (a, b) { r.cssHooks[b] = { get: function (a, c, d) { if (c) return !Pa.test(r.css(a, "display")) || a.getClientRects().length && a.getBoundingClientRect().width ? Xa(a, b, d) : da(a, Qa, function () { return Xa(a, b, d) }) }, set: function (a, c, d) { var e, f = d && Ma(a), g = d && Wa(a, b, d, "border-box" === r.css(a, "boxSizing", !1, f), f); return g && (e = aa.exec(c)) && "px" !== (e[3] || "px") && (a.style[b] = c, c = r.css(a, b)), Va(a, c, g) } } }), r.cssHooks.marginLeft = Oa(o.reliableMarginLeft, function (a, b) { if (b) return (parseFloat(Na(a, "marginLeft")) || a.getBoundingClientRect().left - da(a, { marginLeft: 0 }, function () { return a.getBoundingClientRect().left })) + "px" }), r.each({ margin: "", padding: "", border: "Width" }, function (a, b) { r.cssHooks[a + b] = { expand: function (c) { for (var d = 0, e = {}, f = "string" == typeof c ? c.split(" ") : [c]; d < 4; d++) e[a + ba[d] + b] = f[d] || f[d - 2] || f[0]; return e } }, Ka.test(a) || (r.cssHooks[a + b].set = Va) }), r.fn.extend({ css: function (a, b) { return S(this, function (a, b, c) { var d, e, f = {}, g = 0; if (r.isArray(b)) { for (d = Ma(a), e = b.length; g < e; g++) f[b[g]] = r.css(a, b[g], !1, d); return f } return void 0 !== c ? r.style(a, b, c) : r.css(a, b) }, a, b, arguments.length > 1) } }); function Ya(a, b, c, d, e) { return new Ya.prototype.init(a, b, c, d, e) } r.Tween = Ya, Ya.prototype = { constructor: Ya, init: function (a, b, c, d, e, f) { this.elem = a, this.prop = c, this.easing = e || r.easing._default, this.options = b, this.start = this.now = this.cur(), this.end = d, this.unit = f || (r.cssNumber[c] ? "" : "px") }, cur: function () { var a = Ya.propHooks[this.prop]; return a && a.get ? a.get(this) : Ya.propHooks._default.get(this) }, run: function (a) { var b, c = Ya.propHooks[this.prop]; return this.options.duration ? this.pos = b = r.easing[this.easing](a, this.options.duration * a, 0, 1, this.options.duration) : this.pos = b = a, this.now = (this.end - this.start) * b + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), c && c.set ? c.set(this) : Ya.propHooks._default.set(this), this } }, Ya.prototype.init.prototype = Ya.prototype, Ya.propHooks = { _default: { get: function (a) { var b; return 1 !== a.elem.nodeType || null != a.elem[a.prop] && null == a.elem.style[a.prop] ? a.elem[a.prop] : (b = r.css(a.elem, a.prop, ""), b && "auto" !== b ? b : 0) }, set: function (a) { r.fx.step[a.prop] ? r.fx.step[a.prop](a) : 1 !== a.elem.nodeType || null == a.elem.style[r.cssProps[a.prop]] && !r.cssHooks[a.prop] ? a.elem[a.prop] = a.now : r.style(a.elem, a.prop, a.now + a.unit) } } }, Ya.propHooks.scrollTop = Ya.propHooks.scrollLeft = { set: function (a) { a.elem.nodeType && a.elem.parentNode && (a.elem[a.prop] = a.now) } }, r.easing = { linear: function (a) { return a }, swing: function (a) { return .5 - Math.cos(a * Math.PI) / 2 }, _default: "swing" }, r.fx = Ya.prototype.init, r.fx.step = {}; var Za, $a, _a = /^(?:toggle|show|hide)$/, ab = /queueHooks$/; function bb() { $a && (a.requestAnimationFrame(bb), r.fx.tick()) } function cb() { return a.setTimeout(function () { Za = void 0 }), Za = r.now() } function db(a, b) { var c, d = 0, e = { height: a }; for (b = b ? 1 : 0; d < 4; d += 2 - b) c = ba[d], e["margin" + c] = e["padding" + c] = a; return b && (e.opacity = e.width = a), e } function eb(a, b, c) { for (var d, e = (hb.tweeners[b] || []).concat(hb.tweeners["*"]), f = 0, g = e.length; f < g; f++) if (d = e[f].call(c, b, a)) return d } function fb(a, b, c) { var d, e, f, g, h, i, j, k, l = "width" in b || "height" in b, m = this, n = {}, o = a.style, p = a.nodeType && ca(a), q = V.get(a, "fxshow"); c.queue || (g = r._queueHooks(a, "fx"), null == g.unqueued && (g.unqueued = 0, h = g.empty.fire, g.empty.fire = function () { g.unqueued || h() }), g.unqueued++, m.always(function () { m.always(function () { g.unqueued--, r.queue(a, "fx").length || g.empty.fire() }) })); for (d in b) if (e = b[d], _a.test(e)) { if (delete b[d], f = f || "toggle" === e, e === (p ? "hide" : "show")) { if ("show" !== e || !q || void 0 === q[d]) continue; p = !0 } n[d] = q && q[d] || r.style(a, d) } if (i = !r.isEmptyObject(b), i || !r.isEmptyObject(n)) { l && 1 === a.nodeType && (c.overflow = [o.overflow, o.overflowX, o.overflowY], j = q && q.display, null == j && (j = V.get(a, "display")), k = r.css(a, "display"), "none" === k && (j ? k = j : (ha([a], !0), j = a.style.display || j, k = r.css(a, "display"), ha([a]))), ("inline" === k || "inline-block" === k && null != j) && "none" === r.css(a, "float") && (i || (m.done(function () { o.display = j }), null == j && (k = o.display, j = "none" === k ? "" : k)), o.display = "inline-block")), c.overflow && (o.overflow = "hidden", m.always(function () { o.overflow = c.overflow[0], o.overflowX = c.overflow[1], o.overflowY = c.overflow[2] })), i = !1; for (d in n) i || (q ? "hidden" in q && (p = q.hidden) : q = V.access(a, "fxshow", { display: j }), f && (q.hidden = !p), p && ha([a], !0), m.done(function () { p || ha([a]), V.remove(a, "fxshow"); for (d in n) r.style(a, d, n[d]) })), i = eb(p ? q[d] : 0, d, m), d in q || (q[d] = i.start, p && (i.end = i.start, i.start = 0)) } } function gb(a, b) { var c, d, e, f, g; for (c in a) if (d = r.camelCase(c), e = b[d], f = a[c], r.isArray(f) && (e = f[1], f = a[c] = f[0]), c !== d && (a[d] = f, delete a[c]), g = r.cssHooks[d], g && "expand" in g) { f = g.expand(f), delete a[d]; for (c in f) c in a || (a[c] = f[c], b[c] = e) } else b[d] = e } function hb(a, b, c) { var d, e, f = 0, g = hb.prefilters.length, h = r.Deferred().always(function () { delete i.elem }), i = function () { if (e) return !1; for (var b = Za || cb(), c = Math.max(0, j.startTime + j.duration - b), d = c / j.duration || 0, f = 1 - d, g = 0, i = j.tweens.length; g < i; g++) j.tweens[g].run(f); return h.notifyWith(a, [j, f, c]), f < 1 && i ? c : (h.resolveWith(a, [j]), !1) }, j = h.promise({ elem: a, props: r.extend({}, b), opts: r.extend(!0, { specialEasing: {}, easing: r.easing._default }, c), originalProperties: b, originalOptions: c, startTime: Za || cb(), duration: c.duration, tweens: [], createTween: function (b, c) { var d = r.Tween(a, j.opts, b, c, j.opts.specialEasing[b] || j.opts.easing); return j.tweens.push(d), d }, stop: function (b) { var c = 0, d = b ? j.tweens.length : 0; if (e) return this; for (e = !0; c < d; c++) j.tweens[c].run(1); return b ? (h.notifyWith(a, [j, 1, 0]), h.resolveWith(a, [j, b])) : h.rejectWith(a, [j, b]), this } }), k = j.props; for (gb(k, j.opts.specialEasing) ; f < g; f++) if (d = hb.prefilters[f].call(j, a, k, j.opts)) return r.isFunction(d.stop) && (r._queueHooks(j.elem, j.opts.queue).stop = r.proxy(d.stop, d)), d; return r.map(k, eb, j), r.isFunction(j.opts.start) && j.opts.start.call(a, j), r.fx.timer(r.extend(i, { elem: a, anim: j, queue: j.opts.queue })), j.progress(j.opts.progress).done(j.opts.done, j.opts.complete).fail(j.opts.fail).always(j.opts.always) } r.Animation = r.extend(hb, { tweeners: { "*": [function (a, b) { var c = this.createTween(a, b); return ea(c.elem, a, aa.exec(b), c), c }] }, tweener: function (a, b) { r.isFunction(a) ? (b = a, a = ["*"]) : a = a.match(K); for (var c, d = 0, e = a.length; d < e; d++) c = a[d], hb.tweeners[c] = hb.tweeners[c] || [], hb.tweeners[c].unshift(b) }, prefilters: [fb], prefilter: function (a, b) { b ? hb.prefilters.unshift(a) : hb.prefilters.push(a) } }), r.speed = function (a, b, c) { var e = a && "object" == typeof a ? r.extend({}, a) : { complete: c || !c && b || r.isFunction(a) && a, duration: a, easing: c && b || b && !r.isFunction(b) && b }; return r.fx.off || d.hidden ? e.duration = 0 : "number" != typeof e.duration && (e.duration in r.fx.speeds ? e.duration = r.fx.speeds[e.duration] : e.duration = r.fx.speeds._default), null != e.queue && e.queue !== !0 || (e.queue = "fx"), e.old = e.complete, e.complete = function () { r.isFunction(e.old) && e.old.call(this), e.queue && r.dequeue(this, e.queue) }, e }, r.fn.extend({ fadeTo: function (a, b, c, d) { return this.filter(ca).css("opacity", 0).show().end().animate({ opacity: b }, a, c, d) }, animate: function (a, b, c, d) { var e = r.isEmptyObject(a), f = r.speed(b, c, d), g = function () { var b = hb(this, r.extend({}, a), f); (e || V.get(this, "finish")) && b.stop(!0) }; return g.finish = g, e || f.queue === !1 ? this.each(g) : this.queue(f.queue, g) }, stop: function (a, b, c) { var d = function (a) { var b = a.stop; delete a.stop, b(c) }; return "string" != typeof a && (c = b, b = a, a = void 0), b && a !== !1 && this.queue(a || "fx", []), this.each(function () { var b = !0, e = null != a && a + "queueHooks", f = r.timers, g = V.get(this); if (e) g[e] && g[e].stop && d(g[e]); else for (e in g) g[e] && g[e].stop && ab.test(e) && d(g[e]); for (e = f.length; e--;) f[e].elem !== this || null != a && f[e].queue !== a || (f[e].anim.stop(c), b = !1, f.splice(e, 1)); !b && c || r.dequeue(this, a) }) }, finish: function (a) { return a !== !1 && (a = a || "fx"), this.each(function () { var b, c = V.get(this), d = c[a + "queue"], e = c[a + "queueHooks"], f = r.timers, g = d ? d.length : 0; for (c.finish = !0, r.queue(this, a, []), e && e.stop && e.stop.call(this, !0), b = f.length; b--;) f[b].elem === this && f[b].queue === a && (f[b].anim.stop(!0), f.splice(b, 1)); for (b = 0; b < g; b++) d[b] && d[b].finish && d[b].finish.call(this); delete c.finish }) } }), r.each(["toggle", "show", "hide"], function (a, b) { var c = r.fn[b]; r.fn[b] = function (a, d, e) { return null == a || "boolean" == typeof a ? c.apply(this, arguments) : this.animate(db(b, !0), a, d, e) } }), r.each({ slideDown: db("show"), slideUp: db("hide"), slideToggle: db("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function (a, b) { r.fn[a] = function (a, c, d) { return this.animate(b, a, c, d) } }), r.timers = [], r.fx.tick = function () { var a, b = 0, c = r.timers; for (Za = r.now() ; b < c.length; b++) a = c[b], a() || c[b] !== a || c.splice(b--, 1); c.length || r.fx.stop(), Za = void 0 }, r.fx.timer = function (a) { r.timers.push(a), a() ? r.fx.start() : r.timers.pop() }, r.fx.interval = 13, r.fx.start = function () { $a || ($a = a.requestAnimationFrame ? a.requestAnimationFrame(bb) : a.setInterval(r.fx.tick, r.fx.interval)) }, r.fx.stop = function () { a.cancelAnimationFrame ? a.cancelAnimationFrame($a) : a.clearInterval($a), $a = null }, r.fx.speeds = { slow: 600, fast: 200, _default: 400 }, r.fn.delay = function (b, c) { return b = r.fx ? r.fx.speeds[b] || b : b, c = c || "fx", this.queue(c, function (c, d) { var e = a.setTimeout(c, b); d.stop = function () { a.clearTimeout(e) } }) }, function () { var a = d.createElement("input"), b = d.createElement("select"), c = b.appendChild(d.createElement("option")); a.type = "checkbox", o.checkOn = "" !== a.value, o.optSelected = c.selected, a = d.createElement("input"), a.value = "t", a.type = "radio", o.radioValue = "t" === a.value }(); var ib, jb = r.expr.attrHandle; r.fn.extend({ attr: function (a, b) { return S(this, r.attr, a, b, arguments.length > 1) }, removeAttr: function (a) { return this.each(function () { r.removeAttr(this, a) }) } }), r.extend({ attr: function (a, b, c) { var d, e, f = a.nodeType; if (3 !== f && 8 !== f && 2 !== f) return "undefined" == typeof a.getAttribute ? r.prop(a, b, c) : (1 === f && r.isXMLDoc(a) || (e = r.attrHooks[b.toLowerCase()] || (r.expr.match.bool.test(b) ? ib : void 0)), void 0 !== c ? null === c ? void r.removeAttr(a, b) : e && "set" in e && void 0 !== (d = e.set(a, c, b)) ? d : (a.setAttribute(b, c + ""), c) : e && "get" in e && null !== (d = e.get(a, b)) ? d : (d = r.find.attr(a, b), null == d ? void 0 : d)) }, attrHooks: { type: { set: function (a, b) { if (!o.radioValue && "radio" === b && r.nodeName(a, "input")) { var c = a.value; return a.setAttribute("type", b), c && (a.value = c), b } } } }, removeAttr: function (a, b) { var c, d = 0, e = b && b.match(K); if (e && 1 === a.nodeType) while (c = e[d++]) a.removeAttribute(c) } }), ib = { set: function (a, b, c) { return b === !1 ? r.removeAttr(a, c) : a.setAttribute(c, c), c } }, r.each(r.expr.match.bool.source.match(/\w+/g), function (a, b) { var c = jb[b] || r.find.attr; jb[b] = function (a, b, d) { var e, f, g = b.toLowerCase(); return d || (f = jb[g], jb[g] = e, e = null != c(a, b, d) ? g : null, jb[g] = f), e } }); var kb = /^(?:input|select|textarea|button)$/i, lb = /^(?:a|area)$/i; r.fn.extend({ prop: function (a, b) { return S(this, r.prop, a, b, arguments.length > 1) }, removeProp: function (a) { return this.each(function () { delete this[r.propFix[a] || a] }) } }), r.extend({ prop: function (a, b, c) { var d, e, f = a.nodeType; if (3 !== f && 8 !== f && 2 !== f) return 1 === f && r.isXMLDoc(a) || (b = r.propFix[b] || b, e = r.propHooks[b]), void 0 !== c ? e && "set" in e && void 0 !== (d = e.set(a, c, b)) ? d : a[b] = c : e && "get" in e && null !== (d = e.get(a, b)) ? d : a[b] }, propHooks: { tabIndex: { get: function (a) { var b = r.find.attr(a, "tabindex"); return b ? parseInt(b, 10) : kb.test(a.nodeName) || lb.test(a.nodeName) && a.href ? 0 : -1 } } }, propFix: { "for": "htmlFor", "class": "className" } }), o.optSelected || (r.propHooks.selected = { get: function (a) { var b = a.parentNode; return b && b.parentNode && b.parentNode.selectedIndex, null }, set: function (a) { var b = a.parentNode; b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex) } }), r.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () { r.propFix[this.toLowerCase()] = this }); function mb(a) { var b = a.match(K) || []; return b.join(" ") } function nb(a) { return a.getAttribute && a.getAttribute("class") || "" } r.fn.extend({ addClass: function (a) { var b, c, d, e, f, g, h, i = 0; if (r.isFunction(a)) return this.each(function (b) { r(this).addClass(a.call(this, b, nb(this))) }); if ("string" == typeof a && a) { b = a.match(K) || []; while (c = this[i++]) if (e = nb(c), d = 1 === c.nodeType && " " + mb(e) + " ") { g = 0; while (f = b[g++]) d.indexOf(" " + f + " ") < 0 && (d += f + " "); h = mb(d), e !== h && c.setAttribute("class", h) } } return this }, removeClass: function (a) { var b, c, d, e, f, g, h, i = 0; if (r.isFunction(a)) return this.each(function (b) { r(this).removeClass(a.call(this, b, nb(this))) }); if (!arguments.length) return this.attr("class", ""); if ("string" == typeof a && a) { b = a.match(K) || []; while (c = this[i++]) if (e = nb(c), d = 1 === c.nodeType && " " + mb(e) + " ") { g = 0; while (f = b[g++]) while (d.indexOf(" " + f + " ") > -1) d = d.replace(" " + f + " ", " "); h = mb(d), e !== h && c.setAttribute("class", h) } } return this }, toggleClass: function (a, b) { var c = typeof a; return "boolean" == typeof b && "string" === c ? b ? this.addClass(a) : this.removeClass(a) : r.isFunction(a) ? this.each(function (c) { r(this).toggleClass(a.call(this, c, nb(this), b), b) }) : this.each(function () { var b, d, e, f; if ("string" === c) { d = 0, e = r(this), f = a.match(K) || []; while (b = f[d++]) e.hasClass(b) ? e.removeClass(b) : e.addClass(b) } else void 0 !== a && "boolean" !== c || (b = nb(this), b && V.set(this, "__className__", b), this.setAttribute && this.setAttribute("class", b || a === !1 ? "" : V.get(this, "__className__") || "")) }) }, hasClass: function (a) { var b, c, d = 0; b = " " + a + " "; while (c = this[d++]) if (1 === c.nodeType && (" " + mb(nb(c)) + " ").indexOf(b) > -1) return !0; return !1 } }); var ob = /\r/g; r.fn.extend({ val: function (a) { var b, c, d, e = this[0]; { if (arguments.length) return d = r.isFunction(a), this.each(function (c) { var e; 1 === this.nodeType && (e = d ? a.call(this, c, r(this).val()) : a, null == e ? e = "" : "number" == typeof e ? e += "" : r.isArray(e) && (e = r.map(e, function (a) { return null == a ? "" : a + "" })), b = r.valHooks[this.type] || r.valHooks[this.nodeName.toLowerCase()], b && "set" in b && void 0 !== b.set(this, e, "value") || (this.value = e)) }); if (e) return b = r.valHooks[e.type] || r.valHooks[e.nodeName.toLowerCase()], b && "get" in b && void 0 !== (c = b.get(e, "value")) ? c : (c = e.value, "string" == typeof c ? c.replace(ob, "") : null == c ? "" : c) } } }), r.extend({ valHooks: { option: { get: function (a) { var b = r.find.attr(a, "value"); return null != b ? b : mb(r.text(a)) } }, select: { get: function (a) { var b, c, d, e = a.options, f = a.selectedIndex, g = "select-one" === a.type, h = g ? null : [], i = g ? f + 1 : e.length; for (d = f < 0 ? i : g ? f : 0; d < i; d++) if (c = e[d], (c.selected || d === f) && !c.disabled && (!c.parentNode.disabled || !r.nodeName(c.parentNode, "optgroup"))) { if (b = r(c).val(), g) return b; h.push(b) } return h }, set: function (a, b) { var c, d, e = a.options, f = r.makeArray(b), g = e.length; while (g--) d = e[g], (d.selected = r.inArray(r.valHooks.option.get(d), f) > -1) && (c = !0); return c || (a.selectedIndex = -1), f } } } }), r.each(["radio", "checkbox"], function () { r.valHooks[this] = { set: function (a, b) { if (r.isArray(b)) return a.checked = r.inArray(r(a).val(), b) > -1 } }, o.checkOn || (r.valHooks[this].get = function (a) { return null === a.getAttribute("value") ? "on" : a.value }) }); var pb = /^(?:focusinfocus|focusoutblur)$/; r.extend(r.event, { trigger: function (b, c, e, f) { var g, h, i, j, k, m, n, o = [e || d], p = l.call(b, "type") ? b.type : b, q = l.call(b, "namespace") ? b.namespace.split(".") : []; if (h = i = e = e || d, 3 !== e.nodeType && 8 !== e.nodeType && !pb.test(p + r.event.triggered) && (p.indexOf(".") > -1 && (q = p.split("."), p = q.shift(), q.sort()), k = p.indexOf(":") < 0 && "on" + p, b = b[r.expando] ? b : new r.Event(p, "object" == typeof b && b), b.isTrigger = f ? 2 : 3, b.namespace = q.join("."), b.rnamespace = b.namespace ? new RegExp("(^|\\.)" + q.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, b.result = void 0, b.target || (b.target = e), c = null == c ? [b] : r.makeArray(c, [b]), n = r.event.special[p] || {}, f || !n.trigger || n.trigger.apply(e, c) !== !1)) { if (!f && !n.noBubble && !r.isWindow(e)) { for (j = n.delegateType || p, pb.test(j + p) || (h = h.parentNode) ; h; h = h.parentNode) o.push(h), i = h; i === (e.ownerDocument || d) && o.push(i.defaultView || i.parentWindow || a) } g = 0; while ((h = o[g++]) && !b.isPropagationStopped()) b.type = g > 1 ? j : n.bindType || p, m = (V.get(h, "events") || {})[b.type] && V.get(h, "handle"), m && m.apply(h, c), m = k && h[k], m && m.apply && T(h) && (b.result = m.apply(h, c), b.result === !1 && b.preventDefault()); return b.type = p, f || b.isDefaultPrevented() || n._default && n._default.apply(o.pop(), c) !== !1 || !T(e) || k && r.isFunction(e[p]) && !r.isWindow(e) && (i = e[k], i && (e[k] = null), r.event.triggered = p, e[p](), r.event.triggered = void 0, i && (e[k] = i)), b.result } }, simulate: function (a, b, c) { var d = r.extend(new r.Event, c, { type: a, isSimulated: !0 }); r.event.trigger(d, null, b) } }), r.fn.extend({ trigger: function (a, b) { return this.each(function () { r.event.trigger(a, b, this) }) }, triggerHandler: function (a, b) { var c = this[0]; if (c) return r.event.trigger(a, b, c, !0) } }), r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "), function (a, b) { r.fn[b] = function (a, c) { return arguments.length > 0 ? this.on(b, null, a, c) : this.trigger(b) } }), r.fn.extend({ hover: function (a, b) { return this.mouseenter(a).mouseleave(b || a) } }), o.focusin = "onfocusin" in a, o.focusin || r.each({ focus: "focusin", blur: "focusout" }, function (a, b) { var c = function (a) { r.event.simulate(b, a.target, r.event.fix(a)) }; r.event.special[b] = { setup: function () { var d = this.ownerDocument || this, e = V.access(d, b); e || d.addEventListener(a, c, !0), V.access(d, b, (e || 0) + 1) }, teardown: function () { var d = this.ownerDocument || this, e = V.access(d, b) - 1; e ? V.access(d, b, e) : (d.removeEventListener(a, c, !0), V.remove(d, b)) } } }); var qb = a.location, rb = r.now(), sb = /\?/; r.parseXML = function (b) { var c; if (!b || "string" != typeof b) return null; try { c = (new a.DOMParser).parseFromString(b, "text/xml") } catch (d) { c = void 0 } return c && !c.getElementsByTagName("parsererror").length || r.error("Invalid XML: " + b), c }; var tb = /\[\]$/, ub = /\r?\n/g, vb = /^(?:submit|button|image|reset|file)$/i, wb = /^(?:input|select|textarea|keygen)/i; function xb(a, b, c, d) { var e; if (r.isArray(b)) r.each(b, function (b, e) { c || tb.test(a) ? d(a, e) : xb(a + "[" + ("object" == typeof e && null != e ? b : "") + "]", e, c, d) }); else if (c || "object" !== r.type(b)) d(a, b); else for (e in b) xb(a + "[" + e + "]", b[e], c, d) } r.param = function (a, b) { var c, d = [], e = function (a, b) { var c = r.isFunction(b) ? b() : b; d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(null == c ? "" : c) }; if (r.isArray(a) || a.jquery && !r.isPlainObject(a)) r.each(a, function () { e(this.name, this.value) }); else for (c in a) xb(c, a[c], b, e); return d.join("&") }, r.fn.extend({ serialize: function () { return r.param(this.serializeArray()) }, serializeArray: function () { return this.map(function () { var a = r.prop(this, "elements"); return a ? r.makeArray(a) : this }).filter(function () { var a = this.type; return this.name && !r(this).is(":disabled") && wb.test(this.nodeName) && !vb.test(a) && (this.checked || !ia.test(a)) }).map(function (a, b) { var c = r(this).val(); return null == c ? null : r.isArray(c) ? r.map(c, function (a) { return { name: b.name, value: a.replace(ub, "\r\n") } }) : { name: b.name, value: c.replace(ub, "\r\n") } }).get() } }); var yb = /%20/g, zb = /#.*$/, Ab = /([?&])_=[^&]*/, Bb = /^(.*?):[ \t]*([^\r\n]*)$/gm, Cb = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, Db = /^(?:GET|HEAD)$/, Eb = /^\/\//, Fb = {}, Gb = {}, Hb = "*/".concat("*"), Ib = d.createElement("a"); Ib.href = qb.href; function Jb(a) { return function (b, c) { "string" != typeof b && (c = b, b = "*"); var d, e = 0, f = b.toLowerCase().match(K) || []; if (r.isFunction(c)) while (d = f[e++]) "+" === d[0] ? (d = d.slice(1) || "*", (a[d] = a[d] || []).unshift(c)) : (a[d] = a[d] || []).push(c) } } function Kb(a, b, c, d) { var e = {}, f = a === Gb; function g(h) { var i; return e[h] = !0, r.each(a[h] || [], function (a, h) { var j = h(b, c, d); return "string" != typeof j || f || e[j] ? f ? !(i = j) : void 0 : (b.dataTypes.unshift(j), g(j), !1) }), i } return g(b.dataTypes[0]) || !e["*"] && g("*") } function Lb(a, b) { var c, d, e = r.ajaxSettings.flatOptions || {}; for (c in b) void 0 !== b[c] && ((e[c] ? a : d || (d = {}))[c] = b[c]); return d && r.extend(!0, a, d), a } function Mb(a, b, c) { var d, e, f, g, h = a.contents, i = a.dataTypes; while ("*" === i[0]) i.shift(), void 0 === d && (d = a.mimeType || b.getResponseHeader("Content-Type")); if (d) for (e in h) if (h[e] && h[e].test(d)) { i.unshift(e); break } if (i[0] in c) f = i[0]; else { for (e in c) { if (!i[0] || a.converters[e + " " + i[0]]) { f = e; break } g || (g = e) } f = f || g } if (f) return f !== i[0] && i.unshift(f), c[f] } function Nb(a, b, c, d) { var e, f, g, h, i, j = {}, k = a.dataTypes.slice(); if (k[1]) for (g in a.converters) j[g.toLowerCase()] = a.converters[g]; f = k.shift(); while (f) if (a.responseFields[f] && (c[a.responseFields[f]] = b), !i && d && a.dataFilter && (b = a.dataFilter(b, a.dataType)), i = f, f = k.shift()) if ("*" === f) f = i; else if ("*" !== i && i !== f) { if (g = j[i + " " + f] || j["* " + f], !g) for (e in j) if (h = e.split(" "), h[1] === f && (g = j[i + " " + h[0]] || j["* " + h[0]])) { g === !0 ? g = j[e] : j[e] !== !0 && (f = h[0], k.unshift(h[1])); break } if (g !== !0) if (g && a["throws"]) b = g(b); else try { b = g(b) } catch (l) { return { state: "parsererror", error: g ? l : "No conversion from " + i + " to " + f } } } return { state: "success", data: b } } r.extend({ active: 0, lastModified: {}, etag: {}, ajaxSettings: { url: qb.href, type: "GET", isLocal: Cb.test(qb.protocol), global: !0, processData: !0, async: !0, contentType: "application/x-www-form-urlencoded; charset=UTF-8", accepts: { "*": Hb, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /\bxml\b/, html: /\bhtml/, json: /\bjson\b/ }, responseFields: { xml: "responseXML", text: "responseText", json: "responseJSON" }, converters: { "* text": String, "text html": !0, "text json": JSON.parse, "text xml": r.parseXML }, flatOptions: { url: !0, context: !0 } }, ajaxSetup: function (a, b) { return b ? Lb(Lb(a, r.ajaxSettings), b) : Lb(r.ajaxSettings, a) }, ajaxPrefilter: Jb(Fb), ajaxTransport: Jb(Gb), ajax: function (b, c) { "object" == typeof b && (c = b, b = void 0), c = c || {}; var e, f, g, h, i, j, k, l, m, n, o = r.ajaxSetup({}, c), p = o.context || o, q = o.context && (p.nodeType || p.jquery) ? r(p) : r.event, s = r.Deferred(), t = r.Callbacks("once memory"), u = o.statusCode || {}, v = {}, w = {}, x = "canceled", y = { readyState: 0, getResponseHeader: function (a) { var b; if (k) { if (!h) { h = {}; while (b = Bb.exec(g)) h[b[1].toLowerCase()] = b[2] } b = h[a.toLowerCase()] } return null == b ? null : b }, getAllResponseHeaders: function () { return k ? g : null }, setRequestHeader: function (a, b) { return null == k && (a = w[a.toLowerCase()] = w[a.toLowerCase()] || a, v[a] = b), this }, overrideMimeType: function (a) { return null == k && (o.mimeType = a), this }, statusCode: function (a) { var b; if (a) if (k) y.always(a[y.status]); else for (b in a) u[b] = [u[b], a[b]]; return this }, abort: function (a) { var b = a || x; return e && e.abort(b), A(0, b), this } }; if (s.promise(y), o.url = ((b || o.url || qb.href) + "").replace(Eb, qb.protocol + "//"), o.type = c.method || c.type || o.method || o.type, o.dataTypes = (o.dataType || "*").toLowerCase().match(K) || [""], null == o.crossDomain) { j = d.createElement("a"); try { j.href = o.url, j.href = j.href, o.crossDomain = Ib.protocol + "//" + Ib.host != j.protocol + "//" + j.host } catch (z) { o.crossDomain = !0 } } if (o.data && o.processData && "string" != typeof o.data && (o.data = r.param(o.data, o.traditional)), Kb(Fb, o, c, y), k) return y; l = r.event && o.global, l && 0 === r.active++ && r.event.trigger("ajaxStart"), o.type = o.type.toUpperCase(), o.hasContent = !Db.test(o.type), f = o.url.replace(zb, ""), o.hasContent ? o.data && o.processData && 0 === (o.contentType || "").indexOf("application/x-www-form-urlencoded") && (o.data = o.data.replace(yb, "+")) : (n = o.url.slice(f.length), o.data && (f += (sb.test(f) ? "&" : "?") + o.data, delete o.data), o.cache === !1 && (f = f.replace(Ab, "$1"), n = (sb.test(f) ? "&" : "?") + "_=" + rb++ + n), o.url = f + n), o.ifModified && (r.lastModified[f] && y.setRequestHeader("If-Modified-Since", r.lastModified[f]), r.etag[f] && y.setRequestHeader("If-None-Match", r.etag[f])), (o.data && o.hasContent && o.contentType !== !1 || c.contentType) && y.setRequestHeader("Content-Type", o.contentType), y.setRequestHeader("Accept", o.dataTypes[0] && o.accepts[o.dataTypes[0]] ? o.accepts[o.dataTypes[0]] + ("*" !== o.dataTypes[0] ? ", " + Hb + "; q=0.01" : "") : o.accepts["*"]); for (m in o.headers) y.setRequestHeader(m, o.headers[m]); if (o.beforeSend && (o.beforeSend.call(p, y, o) === !1 || k)) return y.abort(); if (x = "abort", t.add(o.complete), y.done(o.success), y.fail(o.error), e = Kb(Gb, o, c, y)) { if (y.readyState = 1, l && q.trigger("ajaxSend", [y, o]), k) return y; o.async && o.timeout > 0 && (i = a.setTimeout(function () { y.abort("timeout") }, o.timeout)); try { k = !1, e.send(v, A) } catch (z) { if (k) throw z; A(-1, z) } } else A(-1, "No Transport"); function A(b, c, d, h) { var j, m, n, v, w, x = c; k || (k = !0, i && a.clearTimeout(i), e = void 0, g = h || "", y.readyState = b > 0 ? 4 : 0, j = b >= 200 && b < 300 || 304 === b, d && (v = Mb(o, y, d)), v = Nb(o, v, y, j), j ? (o.ifModified && (w = y.getResponseHeader("Last-Modified"), w && (r.lastModified[f] = w), w = y.getResponseHeader("etag"), w && (r.etag[f] = w)), 204 === b || "HEAD" === o.type ? x = "nocontent" : 304 === b ? x = "notmodified" : (x = v.state, m = v.data, n = v.error, j = !n)) : (n = x, !b && x || (x = "error", b < 0 && (b = 0))), y.status = b, y.statusText = (c || x) + "", j ? s.resolveWith(p, [m, x, y]) : s.rejectWith(p, [y, x, n]), y.statusCode(u), u = void 0, l && q.trigger(j ? "ajaxSuccess" : "ajaxError", [y, o, j ? m : n]), t.fireWith(p, [y, x]), l && (q.trigger("ajaxComplete", [y, o]), --r.active || r.event.trigger("ajaxStop"))) } return y }, getJSON: function (a, b, c) { return r.get(a, b, c, "json") }, getScript: function (a, b) { return r.get(a, void 0, b, "script") } }), r.each(["get", "post"], function (a, b) { r[b] = function (a, c, d, e) { return r.isFunction(c) && (e = e || d, d = c, c = void 0), r.ajax(r.extend({ url: a, type: b, dataType: e, data: c, success: d }, r.isPlainObject(a) && a)) } }), r._evalUrl = function (a) { return r.ajax({ url: a, type: "GET", dataType: "script", cache: !0, async: !1, global: !1, "throws": !0 }) }, r.fn.extend({ wrapAll: function (a) { var b; return this[0] && (r.isFunction(a) && (a = a.call(this[0])), b = r(a, this[0].ownerDocument).eq(0).clone(!0), this[0].parentNode && b.insertBefore(this[0]), b.map(function () { var a = this; while (a.firstElementChild) a = a.firstElementChild; return a }).append(this)), this }, wrapInner: function (a) { return r.isFunction(a) ? this.each(function (b) { r(this).wrapInner(a.call(this, b)) }) : this.each(function () { var b = r(this), c = b.contents(); c.length ? c.wrapAll(a) : b.append(a) }) }, wrap: function (a) { var b = r.isFunction(a); return this.each(function (c) { r(this).wrapAll(b ? a.call(this, c) : a) }) }, unwrap: function (a) { return this.parent(a).not("body").each(function () { r(this).replaceWith(this.childNodes) }), this } }), r.expr.pseudos.hidden = function (a) { return !r.expr.pseudos.visible(a) }, r.expr.pseudos.visible = function (a) { return !!(a.offsetWidth || a.offsetHeight || a.getClientRects().length) }, r.ajaxSettings.xhr = function () { try { return new a.XMLHttpRequest } catch (b) { } }; var Ob = { 0: 200, 1223: 204 }, Pb = r.ajaxSettings.xhr(); o.cors = !!Pb && "withCredentials" in Pb, o.ajax = Pb = !!Pb, r.ajaxTransport(function (b) { var c, d; if (o.cors || Pb && !b.crossDomain) return { send: function (e, f) { var g, h = b.xhr(); if (h.open(b.type, b.url, b.async, b.username, b.password), b.xhrFields) for (g in b.xhrFields) h[g] = b.xhrFields[g]; b.mimeType && h.overrideMimeType && h.overrideMimeType(b.mimeType), b.crossDomain || e["X-Requested-With"] || (e["X-Requested-With"] = "XMLHttpRequest"); for (g in e) h.setRequestHeader(g, e[g]); c = function (a) { return function () { c && (c = d = h.onload = h.onerror = h.onabort = h.onreadystatechange = null, "abort" === a ? h.abort() : "error" === a ? "number" != typeof h.status ? f(0, "error") : f(h.status, h.statusText) : f(Ob[h.status] || h.status, h.statusText, "text" !== (h.responseType || "text") || "string" != typeof h.responseText ? { binary: h.response } : { text: h.responseText }, h.getAllResponseHeaders())) } }, h.onload = c(), d = h.onerror = c("error"), void 0 !== h.onabort ? h.onabort = d : h.onreadystatechange = function () { 4 === h.readyState && a.setTimeout(function () { c && d() }) }, c = c("abort"); try { h.send(b.hasContent && b.data || null) } catch (i) { if (c) throw i } }, abort: function () { c && c() } } }), r.ajaxPrefilter(function (a) { a.crossDomain && (a.contents.script = !1) }), r.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /\b(?:java|ecma)script\b/ }, converters: { "text script": function (a) { return r.globalEval(a), a } } }), r.ajaxPrefilter("script", function (a) { void 0 === a.cache && (a.cache = !1), a.crossDomain && (a.type = "GET") }), r.ajaxTransport("script", function (a) { if (a.crossDomain) { var b, c; return { send: function (e, f) { b = r("", start) + 9; while (runCode[start] != '<') { start--; } index = end; RunAt[start + "-" + end] = sCode; }); return RunAt; } fn.Start = function (QueryString) { var self = this; var div = document.createElement("div"); div.style.cssText = "width:800px;height:600px;background-color:rgb(34,40,48)"; var dlg = new CLDialog(div); dlg.CreateHeader(self.DirInfo.Name); dlg.CreateBody(); dlg.Header.ondblclick = function () { dlg.MaximizeOrReset(); } var Body = dlg.Body; dlg.EnableMove(); Body.style.height = "calc(100% - 45px)"; var iframe = document.createElement("iframe"); iframe.style.cssText = "width:100%;height:100%;border:none;"; Body.appendChild(iframe); if (!QueryString) { iframe.setAttribute("src", self.url); } else { iframe.setAttribute("src", self.url + "?" + QueryString); } } fn.Debug = function (QueryString) { var self = this; if (self.ext != "cml") { self.Start(QueryString); return; } self.Save(function (Code) { var url; if (!QueryString) { url = self.url; } else { url = self.url + "?" + QueryString; } var Names = Object.keys(Code.RunAt); self.V8Debugger = new V8Debugger(null, url, function () { self.V8Debugger.Maximize(); self.V8Debugger.Ele.style.boxShadow = "0 0 20px 0 rgba(13,176,166,.3)"; }); self.V8Debugger.sourceType = "html"; var RunDebugMsg = self.V8Debugger.RunDebugMsg; var LineMap = {}; self.V8Debugger.RunDebugMsg = function (Msg) { if (Msg.debugMsg.body && Msg.debugMsg.body.script && Msg.debugMsg.body.script.name && Names.indexOf(Msg.debugMsg.body.script.name) >= 0) { var Name = Msg.debugMsg.body.script.name; var At = Name.split("-")[0] * 1; if (!LineMap[Name]) { var index = 0; var line = 0; while (index < At) { line++; index = Code.Text.indexOf("\n", index + 1); } LineMap[Name] = line - 1; } Msg.debugMsg.body.sourceLine += LineMap[Name]; } RunDebugMsg.call(this, Msg); } var GetScript = self.V8Debugger.GetScript; self.V8Debugger.GetScript = function (V8Handle, scriptId, scriptName) { if (Names.indexOf(scriptName) >= 0) { return { V8Handle: V8Handle, id: scriptId, name: scriptName, source: Code.Text }; } else { var script = GetScript.call(this, V8Handle, scriptId, scriptName); script.javascript = true; return script; } } var GetCallStack = self.V8Debugger.GetCallStack; self.V8Debugger.GetCallStack = function (V8Handle, CallStack) { var stack = GetCallStack.call(this, V8Handle, CallStack); for (var i = 0; i < stack.length; i++) { stack[i].line += LineMap[stack[i].scriptName]; } return stack; } var SetBreakPoint = self.V8Debugger.SetBreakPoint; self.V8Debugger.SetBreakPoint = function (V8Handle, Info) { if (Names.indexOf(Info.sourceName) >= 0) { Info.lineNumber -= LineMap[Info.sourceName]; } var breakInfo = SetBreakPoint.call(this, V8Handle, Info); if (breakInfo) { breakInfo.lineNumber += LineMap[Info.sourceName]; } return breakInfo; } }); } }()); ;(function () { var g_Forms = null; var g_AllForms = null; var g_CLApps = null; var g_DepartmentList = null; var g_FormerParts = null; var g_UserList = null; var g_FormerUsers = null; var g_RoleList = null; var g_currentUserId = null; var g_IsAdmin = null; var g_RelevantDataTable = null; var g_FormsDetails = null; var g_FlowClasses = null; var g_CorpId = null; var g_Users_Map = null; var Version = "1.01"; var CLApp = window.CLApp = function () { } CLApp.GetCorpId = function () { return CLTop.g_CorpId; } CLApp.SetLocalStore_ = function (UpdateData) { var LocalStore = localStorage.getItem("LocalStore"); if (LocalStore != null && LocalStore.length != 0) { if (LocalStore[0] != "{") { LocalStore = CLUnZip(LocalStore); } LocalStore = JSON.parse(LocalStore); if (LocalStore.CLCorpId != CLCorpId()) { CLApp.ResetLocalStore(); return; } } if (LocalStore == null) { LocalStore = { CLCorpId: CLCorpId(), g_DepartmentList: [], g_DepartmentListDel: [], g_UserList: [], g_UserListLeave: [], g_RoleList: [], g_AllForms: [], g_CLApps: [], Version: Version }; } else { if (LocalStore.Version != Version) { CLApp.ResetLocalStore(); return; } } var map_users = {}; var map_departs = {}; var map_apps = {}; var map_forms = {}; var map_users_leave = {}; var map_departs_del = {}; LocalStore.g_UserList.forEach(function (ele) { map_users[ele.userid] = ele; }); UpdateData.g_UserList.forEach(function (ele) { map_users[ele.userid] = ele; }); LocalStore.g_DepartmentList.forEach(function (ele) { map_departs[ele.id] = ele; }); UpdateData.g_DepartmentList.forEach(function (ele) { map_departs[ele.id] = ele; }); LocalStore.g_CLApps.forEach(function (ele) { map_apps[ele.ID] = ele; }); UpdateData.g_CLApps.forEach(function (ele) { map_apps[ele.ID] = ele; }); LocalStore.g_AllForms.forEach(function (ele) { map_forms[ele.ID] = ele; }); UpdateData.g_AllForms.forEach(function (ele) { map_forms[ele.ID] = ele; }); CLTop.g_RelevantDataTable = UpdateData.g_RelevantDataTable; CLTop.g_IsAdmin = UpdateData.g_IsAdmin; CLTop.g_RoleList = UpdateData.g_RoleList; CLTop.g_currentUserId = UpdateData.g_currentUserId; CLTop.g_CorpId = UpdateData.g_CorpId; var Deleted = UpdateData.g_Deleted; for (var i = 0; i < CLTop.g_RoleList.length; i++) { var has = false; for (var j = 0; LocalStore != null && j < LocalStore.g_RoleList.length; j++) { if (LocalStore.g_RoleList[j].ID == CLTop.g_RoleList[i].ID) { has = true; LocalStore.g_RoleList[j] = CLTop.g_RoleList[i]; } } if (!has) { LocalStore.g_RoleList.push(CLTop.g_RoleList[i]); } } UpdateData.g_UserListLeave.forEach(function (ele) { map_users_leave[ele.userid] = ele; delete map_users[ele.userid]; }); UpdateData.g_DepartmentListDel.forEach(function (ele) { map_departs_del[ele.id] = ele; delete map_departs[ele.id]; }); LocalStore.g_UserListLeave.forEach(function (ele) { map_users_leave[ele.userid] = ele; }); LocalStore.g_DepartmentListDel.forEach(function (ele) { map_departs_del[ele.id] = ele; }); UpdateData.g_Deleted.forEach(function (ele) { delete map_apps[ele]; delete map_forms[ele]; }); LocalStore.g_DepartmentList = (function () { var list = []; for (var key in map_departs) { list.push(map_departs[key]); } return list; }()); LocalStore.g_DepartmentListDel = (function () { var list = []; for (var key in map_departs_del) { list.push(map_departs_del[key]); } return list; }()); LocalStore.g_UserList = (function () { var list = []; for (var key in map_users) { list.push(map_users[key]); } return list; }()); LocalStore.g_UserListLeave = (function () { var list = []; for (var key in map_users_leave) { list.push(map_users_leave[key]); } return list; }()); LocalStore.g_CLApps = (function () { var list = []; for (var key in map_apps) { list.push(map_apps[key]); } return list; }()); LocalStore.g_AllForms = (function () { var list = []; for (var key in map_forms) { list.push(map_forms[key]); } return list; }()); if ((UpdateData.g_DepartmentList.length + UpdateData.g_DepartmentListDel.length + UpdateData.g_UserList.length + UpdateData.g_UserListLeave.length + UpdateData.g_RoleList.length + UpdateData.g_AllForms.length + UpdateData.g_CLApps.length != 0) || Deleted.length != 0) { CLDelay(function () { var str = JSON.stringify(LocalStore); if (str.length >= 2 * 1048576) { str = CLZip(str); } if (str.length < 2 * 1048576) { var dt = new Date(); dt.setFullYear(dt.getFullYear() + 1); var sCookie = "g_CLAppLocalStoreUpdateDt=" + encodeURIComponent(UpdateData.g_CLAppLocalStoreUpdateDt) + "; expires=" + dt.toGMTString() + "; path=/" + CLCorpId(); document.cookie = sCookie; } else { CLShowMsg("由于表单和员工数据过大,需要升级服务器以提高效率"); } localStorage.setItem("LocalStore", str); }, 10); } else { var dt = new Date(); dt.setFullYear(dt.getFullYear() + 1); var sCookie = "g_CLAppLocalStoreUpdateDt=" + encodeURIComponent(UpdateData.g_CLAppLocalStoreUpdateDt) + "; expires=" + dt.toGMTString() + "; path=/" + CLCorpId(); document.cookie = sCookie; } UpdateData.g_DepartmentList = CLTop.g_DepartmentList = LocalStore.g_DepartmentList; UpdateData.g_DepartmentListDel = CLTop.g_FormerParts = LocalStore.g_DepartmentListDel; UpdateData.g_UserList = CLTop.g_UserList = LocalStore.g_UserList; UpdateData.g_UserListLeave = CLTop.g_FormerUsers = LocalStore.g_UserListLeave; UpdateData.g_RoleList = CLTop.g_RoleList = LocalStore.g_RoleList; UpdateData.g_AllForms = CLTop.g_AllForms = LocalStore.g_AllForms; UpdateData.g_CLApps = CLTop.g_CLApps = LocalStore.g_CLApps; } CLApp.SetLocalStore = function (UpdateData) { try { CLApp.SetLocalStore_(UpdateData); } catch (e) { CLApp.ResetLocalStore(); } } CLApp.ResetLocalStore = function () { CLApp.ClearLocalStore(); var url = "/" + CLCorpId() + "/api/CLFlow.chx?Function=HttpGetLocalStore"; var Json = HttpGet(url, null, false, true); if (Json.code == 0) { CLApp.SetLocalStore(Json.data); } } CLApp.ClearLocalStore = function () { var dt = new Date(); dt.setFullYear(dt.getFullYear() + 1); document.cookie = "g_CLAppLocalStoreUpdateDt=-1; expires=" + dt.toGMTString() + "; path=/" + CLCorpId(); document.cookie = "g_FileUpdateInfoUpdateDt=-1; expires=" + dt.toGMTString() + "; path=/"; localStorage.clear(); } CLApp.getUserList = function () { return CLTop.g_UserList; } CLApp.GetDepartUsers = function (departId, recursion, bRetId) { var key = "DepartUsers_" + departId + "_" + (recursion ? "1" : "0") + "-" + (bRetId ? "1" : "0"); if (CLTop[key]) { return CLTop[key]; } var tree = CLApp.getDepartTree()[0]; var IDs = []; var IsChild = false; function getDeparts(tree) { if (IsChild || tree.ID == departId) { if (tree.ID == departId) { IsChild = true; } IDs.push(tree.ID); for (var i = 0; i < tree.SubNode.length; i++) { getDeparts(tree.SubNode[i]); } if (tree.ID == departId) { IsChild = false; } } else { for (var i = 0; i < tree.SubNode.length; i++) { getDeparts(tree.SubNode[i]); } } } if (recursion) { getDeparts(tree); } else { IDs = [departId] } var Users = []; var userList = CLApp.getUserList(); for (var i = 0; i < userList.length; i++) { var department = userList[i].department for (var j = 0; j < department.length ; j++) { if (IDs.indexOf(department[j]) >= 0) { if (bRetId) { Users.push(userList[i].userid); } else { Users.push(userList[i]); } } } } CLTop[key] = Users; return Users; } CLApp.getUserListLeave = function () { return CLTop.g_FormerUsers; } CLApp.getDepartmentList = function () { return CLTop.g_DepartmentList; } CLApp.getRoleList = function () { return CLTop.g_RoleList; } CLApp.getCurrentUserId = function () { return CLTop.g_currentUserId; } CLApp.getCurrentUser = function () { if (CLTop.g_currentUserId == '----') { return { userid: "----", name: "----", jobnumber: "----", mobile: "----", avatar: "https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3409707861,1819603587&fm=26&gp=0.jpg", isAdmin: false, department: [888], } } if (CLTop.g_currentUserId) { return CLApp.getMemberById(CLTop.g_currentUserId); } else { return null; } } //员工姓名 CLTop.g_MemberMap = { }; CLApp.getMemberById = function (Id) { Id = typeof Id == "string" ? Id : Id + ""; if (CLTop.g_MemberMap[Id] !== undefined) { return CLTop.g_MemberMap[Id]; } for (var i = 0; CLTop.g_UserList && i < CLTop.g_UserList.length; i++) { if (Id == CLTop.g_UserList[i].userid) { CLTop.g_MemberMap[Id] = CLTop.g_UserList[i]; break; } } for (var i = 0; CLTop.g_MemberMap[Id] === undefined && CLTop.g_FormerUsers && i < CLTop.g_FormerUsers.length; i++) { if (Id == CLTop.g_FormerUsers[i].userid) { CLTop.g_MemberMap[Id] = CLTop.g_FormerUsers[i]; break; } } if (CLTop.g_MemberMap[Id] === undefined) { CLTop.g_MemberMap[Id] = null; } return CLTop.g_MemberMap[Id]; } CLApp.getUserById = CLApp.getMemberById; CLApp.getMemberNameById = function (Id) { if (!Id) { return ""; } var Member = CLApp.getMemberById(Id); return Member == null ? Id : Member.name; } CLApp.getUserNameById = CLApp.getMemberNameById; CLApp.extendDepartRoot = function (Ids) { if (Ids == null) { return; } var tempIds = [].concat(Ids); for (var i = 0; i < Ids.length; i++) { var id = Ids[i]; while (id) { var part = CLApp.getDepartmentById(id); id = part ? part.parentid : null; if (id && Ids.indexOf(id) < 0 && tempIds.indexOf(id) < 0) { tempIds.push(id); } } } return tempIds; } CLApp.getDepartTree = function (Ids) { var tempTable = []; for (var i = 0; CLTop.g_DepartmentList && i < CLTop.g_DepartmentList.length; i++) { if (Ids == null || Ids.indexOf(CLTop.g_DepartmentList[i].id) >= 0) { tempTable.push({ ID: CLTop.g_DepartmentList[i].id, Name: CLTop.g_DepartmentList[i].name, ParentID: CLTop.g_DepartmentList[i].parentid }); } } return CLTableToTree(tempTable); } //部门名称 CLTop.g_DepartmentMap = null; CLApp.getDepartmentById = function (Id) { if (!CLTop.g_DepartmentMap) { CLTop.g_DepartmentMap = { }; for (var i = 0; CLTop.g_DepartmentList && i < CLTop.g_DepartmentList.length; i++) { var id = CLTop.g_DepartmentList[i].id; CLTop.g_DepartmentMap[id] = CLTop.g_DepartmentList[i]; } for (var i = 0; i < CLTop.g_FormerUsers.length; i++) { var id = CLTop.g_FormerUsers[i].id; CLTop.g_DepartmentMap[id] = CLTop.g_FormerUsers[i]; } } return CLTop.g_DepartmentMap[Id]; } CLApp.getDepartmentNameById = function (Id) { if (Id == null) { return ""; } Id *= 1; var Depart = CLApp.getDepartmentById(Id); return Depart == null ? "??????" : Depart.name; } CLApp.extendRoleRoot = function (Ids) { if (Ids == null) { return; } var tempIds = [].concat(Ids); for (var i = 0; i < Ids.length; i++) { var id = Ids[i]; while (id) { var role = CLApp.getRoleById(id); id = role ? role.ParentID : null; if (id && Ids.indexOf(id) < 0 && tempIds.indexOf(id) < 0) { tempIds.push(id); } } } return tempIds; } CLApp.getRoleTree = function (Ids) { if (Ids == null) { return CLTableToTree(CLTop.g_RoleList, null); } else { var tempTable = []; for (var i = 0; CLTop.g_RoleList && i < CLTop.g_RoleList.length; i++) { if (Ids == null || Ids.indexOf(CLTop.g_RoleList[i].ID) >= 0) { tempTable.push(CLTop.g_RoleList[i]); } } return CLTableToTree(tempTable, null); } } CLApp.getRoleById = function (Id) { for (var i = 0; CLTop.g_RoleList && i < CLTop.g_RoleList.length; i++) { if (CLTop.g_RoleList[i].ID == Id) { return CLTop.g_RoleList[i]; } } } CLApp.getFormById = function (FormId) { if (CLTop.g_AllForms[FormId]) { return CLTop.g_AllForms[FormId]; } for (var i = 0; CLTop.g_AllForms && i < CLTop.g_AllForms.length; i++) { if (CLTop.g_AllForms[i].ID == FormId) { CLTop.g_AllForms[FormId] = CLTop.g_AllForms[i]; return CLTop.g_AllForms[i]; } } } CLApp.TableName = function (FormId) { if (/^DataField_[0-9]*$/.test(FormId)) { FormId = FormId.replace("DataField_", ""); } var Form = CLApp.getFormById(FormId); if (Form) { return Form.Name; } else { var info = CLApp.getFieldInfo(FormId); return info == null ? FormId : info.Name; } } var g_AllFieldsInfo = null; CLApp.getFieldInfo = function (Id) { if (Id == "createDt") { return { ID: Id, Name: "提交时间", className: "提交时间" }; } if (Id == "updateDt") { return { ID: Id, Name: "更新时间", className: "更新时间" }; } if (Id == "Submiter") { return { ID: Id, Name: "提交人", className: "成员单选" }; } if (Id == "iFlowStatus") { return { ID: Id, Name: "流程状态", className: "流程状态" }; } if (Id == null) { return null; } if (Id == "") { return { ID: Id, Name: Id, className: "单行文本" }; } if (/^DataField_[0-9]*$/.test(Id)) { Id = Id.replace("DataField_", ""); } else if (/^SubTable_[0-9]*$/.test(Id)) { Id = Id.replace("SubTable_", ""); } else if (!/^[0-9]*$/.test(Id)) { return; } if (CLTop.g_AllFieldsInfo == null) { CLTop.g_AllFieldsInfo = { }; var AllForms = CLApp.getAllForms(); for (var i = 0; i < AllForms.length ; i++) { var table = AllForms[i].Name; var Fields = AllForms[i].Fields; if (Fields == null) { continue; } for (var j = 0; j < Fields.length; j++) { var field = Fields[j]; field.fullName = table + "." + field.Name; field.TableID = AllForms[i].ID; CLTop.g_AllFieldsInfo[field.ID] = field; if (field.className == "子表单") { var subFields = field.Field; for (var k = 0; k < subFields.length; k++) { var ffield = subFields[k]; ffield.TableID = field.ID; ffield.fullName = field.Name + "." + ffield.Name; CLTop.g_AllFieldsInfo[ffield.ID] = ffield; } } } } } if (CLTop.g_AllFieldsInfo[Id] == null) { return null; } var o = CLTop.g_AllFieldsInfo[Id]; var r = { ID: Id, Name: o.Name, TableID: o.TableID, className: o.className, Rules: o.Rules, enableUpdate: o.enableUpdate, fullName: o.fullName, Visible: o.Visible }; if (o.ParentID) { r.ParentID = o.ParentID; } return r; } var g_AllTablesInfo = null; CLApp.GetFormOrSubTableById = function (Id) { if (CLTop.g_AllTablesInfo == null) { CLTop.g_AllTablesInfo = { }; } if (/^SubTable_[0-9]*$/.test(Id)) { Id = Id.replace("SubTable_", ""); } if (/^DataTable_[0-9]*$/.test(Id)) { Id = Id.replace("DataTable_", ""); } if (CLTop.g_AllTablesInfo[Id] != null) { return CLTop.g_AllTablesInfo[Id]; } var AllForms = CLApp.getAllForms(); for (var i = 0; i < AllForms.length ; i++) { CLTop.g_AllTablesInfo[AllForms[i].ID] = AllForms[i]; var Fields = AllForms[i].Fields; if (Fields == null) { continue; } for (var j = 0; j < Fields.length; j++) { if (Fields[j].className == "子表单") { CLTop.g_AllTablesInfo[Fields[j].ID] = { ID: Fields[j].ID, Name: Fields[j].Name, className: "子表单", Fields: Fields[j].Field || [] } } } } return CLTop.g_AllTablesInfo[Id]; } CLApp.FindAppAndShareForms = function (FormId) { var Form = CLApp.getFormById(FormId); return CLApp.getFormsByAppId(Form.AppId); } CLApp.getForms = function (FormId) { return CLApp.FindAppAndShareForms(FormId); } CLApp.getFormsByAppId = function (AppId) { var AllForms = CLApp.getAllForms(); var ret = []; for (var i = 0; i < AllForms.length; i++) { if (AllForms[i].IsShare || (AllForms[i].AppId != null && AllForms[i].AppId == AppId)) { ret.push(AllForms[i]); } } return ret; } CLApp.setForm = function (Form) { for (var i = 0; i < CLTop.g_AllForms.length; i++) { if (CLTop.g_AllForms[i].ID == Form.ID) { Form.AppId = CLTop.g_AllForms[i].AppId; CLTop.g_AllForms[i] = Form; } } if (!CLTop.g_AllFieldsInfo) { return; } var Fields = Form.Fields; if (Fields == null) { return; } for (var j = 0; j < Fields.length; j++) { Fields[j] = CLClone(Fields[j]); CLTop.g_AllFieldsInfo[Fields[j].ID] = Fields[j]; Fields[j].FormID = Form.ID; if (Fields[j].className == "子表单") { var subFields = Fields[j].Field; for (var k = 0; k < subFields.length; k++) { CLTop.g_AllFieldsInfo[subFields[k].ID] = Fields[j].Field[k]; CLTop.g_AllFieldsInfo[subFields[k].ID].FormID = Fields[j].ID; } } } } CLApp.getAllForms = function () { return CLTop.g_AllForms; } CLApp.getFrmShowInfo = function (Id, V) { var Url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpGetShowInfo&ID=" + Id + "&v=" + V; var Info; return HttpGet(Url, function (Json) { if (Json.code == 0) { Info = Json.data; } else { CLShowMsg(Json.msg); } }, { }, false, true); return Info; } CLApp.Get = function (url) { var ele; HttpGet(url, function (Json) { if (Json.code == 0) { ele = JSON.parse(Json.data); } else { CLShowMsg(Json.msg); } }, false, true); return ele } CLApp.getFlowClassById = function (Id, Success) { if (CLTop.g_FlowClasses == null) { CLTop.g_FlowClasses = { }; } if (CLTop.g_FlowClasses[Id] != null) { Success(CLTop.g_FlowClasses[Id]); return; } else { var Url = "/" + CLCorpId() + "/api/Flow.chx?Function=HttpGetFlowClass&ID=" + Id; return HttpGet(Url, function (Json) { if (Json.code == 0) { CLTop.g_FlowClasses[Id] = Json.data; Success(CLTop.g_FlowClasses[Id]); } else { CLShowMsg(Json.msg); } }, true, true); } } CLApp.IsAdmin = function () { return CLTop.g_IsAdmin; } CLApp.GetCLApp = function (Id) { var Apps = CLTop.g_CLApps; for (var i = 0; i < Apps.length; i++) { if (Apps[i].ID == Id) { return Apps[i]; } } } CLApp.HasAuth = function (Range, User, addAdmin) { if (CLApp.IsAdmin() && addAdmin) { return true; } if (Range == null) { return false; } for (var i = 0; Range["Parts"] && i < Range["Parts"].length; i++) { if (User["department"].indexOf(Range["Parts"][i] * 1) >= 0) { return true; } } var RolesIDs = User["Roles"]; for (var i = 0; Range["Roles"] && i < Range["Roles"].length; i++) { if (RolesIDs && RolesIDs.indexOf(Range["Roles"][i]) >= 0) { return true; } } if (Range["Members"] && Range["Members"].indexOf(User["userid"]) >= 0) { return true; } for (var i = 0; Range["Dynamic"] && i < Range["Dynamic"].length; i++) { if (Range["Dynamic"][i] == "当前用户") { return true; } } return false; } CLApp.CalcAuth = function (DataRange, AuthName, dataLine, addAdmin) { if (CLApp.IsAdmin() && addAdmin) { return true; } if (DataRange == null) { return false; } var User = CLApp.getCurrentUser(); if (AuthName == "添加" || AuthName == "复制") { if (CLApp.HasAuth(DataRange["Submit"], User, addAdmin)) { return true; } if (CLApp.HasAuth(DataRange["Admin"], User, addAdmin)) { return true; } var Other = DataRange["Other"]; for (var i = 0; Other && i < Other.length; i++) { if (Other[i]["Options"].indexOf(AuthName) >= 0) { if (CLApp.HasAuth(Other[i]["Range"], User, addAdmin)) { return true; } } } } if (AuthName == "编辑" || AuthName == "删除") { if (CLApp.HasAuth(DataRange["Admin"], User, addAdmin)) { return true; } if (CLApp.HasAuth(DataRange["Own"], User, addAdmin) && (dataLine == null || dataLine["Submiter"] == User["userid"])) { return true; } if (dataLine == null) { return false; } var Other = DataRange["Other"]; for (var i = 0; Other && i < Other.length; i++) { if (Other[i]["Options"].indexOf(AuthName) >= 0) { if (CLApp.HasAuth(Other[i]["Range"], User, addAdmin)) { return true; } } } } if (AuthName == "终止流程" || AuthName == "激活流程" || AuthName == "调整流程负责人" || AuthName == "导入" || AuthName == "导出") { if (CLApp.HasAuth(DataRange["Admin"], User, addAdmin)) { return true; } if (dataLine == null) { return false; } var Other = DataRange["Other"]; for (var i = 0; Other && i < Other.length; i++) { if (Other[i]["Options"].indexOf(AuthName) >= 0) { if (CLApp.HasAuth(Other[i]["Range"], User, addAdmin)) { return true; } } } } return false; } CLApp.CalcFields = function (DataRange) { if (CLApp.IsAdmin()) { return null; } if (DataRange == null) { return null; } var User = CLApp.getCurrentUser(); if (CLApp.HasAuth(DataRange["Admin"], User, true)) { return null; } if (CLApp.HasAuth(DataRange["Own"], User, true)) { return null; } if (CLApp.HasAuth(DataRange["Submit"], User, true) && DataRange.Op == "提交") { return null; } var read = false; if (CLApp.HasAuth(DataRange["Read"], User, true)) { read = true; } var Other = DataRange["Other"]; var MapFields = null; for (var i = 0; Other && i < Other.length; i++) { if (CLApp.HasAuth(Other[i].Range, User, true)) { if ((Other[i]["Options"].indexOf("添加") >= 0 && DataRange.Op == "提交") || ((Other[i]["Options"].indexOf("编辑") >= 0 || Other[i]["Options"].indexOf("查看") >= 0 || Other[i]["Options"].indexOf("导出") >= 0) && DataRange.Op != "提交")) { var Fields = Other[i].Fields; MapFields = MapFields ? MapFields : { }; for (var j = 0; j < Fields.length; j++) { if (MapFields[Fields[j].ID] == null) { MapFields[Fields[j].ID] = { Read: Fields[j].Read || read, Write: Fields[j].Write } } else { MapFields[Fields[j].ID].Read = MapFields[Fields[j].ID].Read || Fields[j].Read; MapFields[Fields[j].ID].Write = MapFields[Fields[j].ID].Write || Fields[j].Write; } } } } } return MapFields; } CLApp.ConvertData = function (className, sData) { if (className == "成员单选" || className == "提交人") { return CLApp.getMemberNameById(sData); } if (className == "部门单选") { return CLApp.getDepartmentNameById(sData); } if (className == "成员多选") { var jData; try { jData = JSON.parse(sData); } catch (e) { jData = [sData]; } if (jData == null) { jData = []; } var arr = []; for (var i = 0; i < jData.length; i++) { var R = CLApp.getMemberNameById(jData[i]); if (R) { arr.push(R); } } return arr.toString(); } if (className == "部门多选") { var jData; try { jData = JSON.parse(sData); } catch (e) { jData = [sData]; } if (jData == null) { jData = []; } var arr = []; for (var i = 0; i < jData.length; i++) { var R = CLApp.getDepartmentNameById(jData[i]); if (R) { arr.push(R); } } return arr.toString(); } if (className == "复选框组" || className == "下拉复选框") { var jData; try { jData = JSON.parse(sData); } catch (e) { jData = [sData]; } if (jData == null) { return "NULL"; } return jData; } if (className == "手写签名") { if (sData == null) { return ""; } var Val = JSON.parse(sData); var svg = document.createElement("svg"); svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svg.setAttribute("version", "1.1"); svg.style.position = "relative"; var height = 60; var width = 120; svg.setAttribute("width", 120); svg.setAttribute("height", 60); var Lines = Val.Lines; var sLines = ""; for (var i = 0; i < Lines.length; i++) { var Pointers = Lines[i]; for (var j = 0; j < Pointers.length - 1; j++) { sLines += ""; } } svg.innerHTML = sLines; return "
" + svg.outerHTML + "
"; } if (className == "流程状态") { if (sData * 1 == -1) { return "已暂存" } else { return ["运行中", "已完成", "已终止", "已存档"][(sData * 1) - 1]; } } return sData; } CLApp.RunSource = function (ID, Success, Vars, Async, file) { var url = "/" + CLCorpId() + "/api/RunSource.chx?Function=HttpRunSource" if (Async === false) { url += "&Data=" + encodeURIComponent(JSON.stringify({ ID: ID, Vars: Vars })); HttpGet(url, function (Json) { Success(Json); }, false, true); } else { return HttpPost(url, function (Json) { Success(Json); }, { ID: ID, Vars: Vars }, Async, null, null, file, file && file.name); } } CLApp.Filter = function (lines, filter) { if (!filter || !filter.Items || filter.Items.length == 0) { return lines; } var all = filter.Operator == "所有"; var Items = filter.Items; var items = [].concat(Items); items.forEach(function (ele, index) { var className = ele.className; var Val = ele.Val; var Field = ele.ID; var o = { } if (className.indexOf("时间") >= 0) { function GetDate(sVal) { if (sVal == "今天") { var v1 = new Date(); v1 = Date.Parse(v1.Format("yyyy-MM-dd 00:00:00")); var v2 = new Date(v1); v2.getDate(v2.getDate() + 1); return ({ v1: v1.Format("yyyy-MM-dd 00:00:00"), v2: v2.Format("yyyy-MM-dd 00:00:00") }); } if (sVal == WS("昨天")) { var v1 = new Date(); v1.setDate(v1.getDate() - 1); v1 = Date.Parse(v1.Format("yyyy-MM-dd 00:00:00")); var v2 = new Date(v1); v2.getDate(v2.getDate() + 1); return ({ v1: v1.Format("yyyy-MM-dd 00:00:00"), v2: v2.Format("yyyy-MM-dd 00:00:00") }); } if (sVal == WS("本周")) { var v1 = new Date(); v1.setDate(v1.getDate() - v1.getDay()); v1 = Date.Parse(v1.Format("yyyy-MM-dd 00:00:00")); var v2 = new Date(v1); v2.getDate(v2.getDate() + 7); return ({ v1: v1.Format("yyyy-MM-dd 00:00:00"), v2: v2.Format("yyyy-MM-dd 00:00:00") }); } if (sVal == WS("上周")) { var v1 = new Date(); v1.setDate(dt.getDate() - 7 - dt.getDay()); v1 = Date.Parse(v1.Format("yyyy-MM-dd 00:00:00")); var v2 = new Date(v1); v2.getDate(v2.getDate() + 7); return ({ v1: v1.Format("yyyy-MM-dd 00:00:00"), v2: v2.Format("yyyy-MM-dd 00:00:00") }); } if (sVal == WS("本月")) { var v1 = new Date(); v1 = Date.Parse(v1.Format("yyyy-MM-01 00:00:00")); var v2 = new Date(v1); v2.setMonth(v2.getMonth() + 1); return ({ v1: v1.Format("yyyy-MM-dd 00:00:00"), v2: v2.Format("yyyy-MM-dd 00:00:00") }); } if (sVal == WS("上月")) { var dt = new Date(); dt.setDate(0); v1 = Date.Parse(v1.Format("yyyy-MM-01 00:00:00")); v1.setMonth(v1.getMonth() - 1); var v2 = new Date(v1); v2.setMonth(v2.getMonth() + 1); return ({ v1: v1.Format("yyyy-MM-dd 00:00:00"), v2: v2.Format("yyyy-MM-dd 00:00:00") }); } var v1 = Date.Parse(sVal); var v2 = new Date(v1); v2.getDate(v2.getDate() + 1); return ({ v1: v1.Format("yyyy-MM-dd 00:00:00"), v2: v2.Format("yyyy-MM-dd 00:00:00") }); } (function () { if (ele.Operator == "等于") { if (!Val) { o.func = function () { return true; } } else { var dType = Val.DataType; var jVal = Val.sValue; if (!dType) { o.func = function () { return true; } } if (dType == "今天" || dType == "昨天" || dType == "本周" || dType == "上周" || dType == "本月" || dType == "上月" ) { var Dt = GetDate(); o.func = function (line) { return line[Field] >= Dt.v1 && line[Field] < Dt.v2; } } else { if (!jVal) { o.func = function (line) { return true; } } else { var Dt = GetDate(jVal); o.func = function (line) { return line[Field] >= Dt.v1 && line[Field] < Dt.v2; } } } } } }()); (function () { if (ele.Operator == "不等于") { if (!Val) { o.func = function () { return true; } } else { var dType = Val.DataType; var jVal = Val.sValue; if (!dType) { o.func = function () { return true; } } if (dType == "今天" || dType == "昨天" || dType == "本周" || dType == "上周" || dType == "本月" || dType == "上月" ) { var Dt = GetDate(); o.func = function (line) { return line[Field] < Dt.v1 || line[Field] >= Dt.v2; } } else { if (!jVal) { o.func = function (line) { return true; } } else { var Dt = GetDate(jVal); o.func = function (line) { return line[Field] < Dt.v1 || line[Field] >= Dt.v2; } } } } } }()); (function () { if (ele.Operator == "大于等于") { if (!Val) { o.func = function () { return true; } } else { var dType = Val.DataType; var jVal = Val.sValue; if (!dType) { o.func = function () { return true; } } if (dType == "今天" || dType == "昨天" || dType == "本周" || dType == "上周" || dType == "本月" || dType == "上月" ) { var Dt = GetDate(); o.func = function (line) { return line[Field] >= Dt.v1; } } else { if (!jVal) { o.func = function (line) { return true; } } else { var Dt = GetDate(jVal); o.func = function (line) { return line[Field] >= Dt.v1; } } } } } }()); (function () { if (ele.Operator == "小于等于") { if (!Val) { o.func = function () { return true; } } else { var dType = Val.DataType; var jVal = Val.sValue; if (!dType) { o.func = function () { return true; } } if (dType == "今天" || dType == "昨天" || dType == "本周" || dType == "上周" || dType == "本月" || dType == "上月" ) { var Dt = GetDate(); o.func = function (line) { return line[Field] < Dt.v2; } } else { if (!jVal) { o.func = function (line) { return true; } } else { var Dt = GetDate(jVal); o.func = function (line) { return line[Field] < Dt.v2; } } } } } }()); (function () { if (ele.Operator == "为空") { o.func = function (line) { return line[Field] == null; } } }()); (function () { if (ele.Operator == "不为空") { o.func = function (line) { return line[Field] != null; } } }()); } if (className == "成员单选" || className == "提交人" || className == "部门单选" || className == "流水号" || className == "单行文本" || className == "多行文本" || className == "单选按钮组" || className == "下拉框" || className == "流程状态") { (function () { if (ele.Operator == "等于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] == Val; } } } if (ele.Operator == "不等于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] != Val; } } } if (ele.Operator == "等于任意一个") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { var vv = line[Field]; for (var i = 0; i < Val.length ; i++) { if (vv == Val[i]) { return true; } } } } } if (ele.Operator == "不等于任意一个") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { var vv = line[Field]; for (var i = 0; i < Val.length ; i++) { if (vv == Val[i]) { return false; } } return true; } } } if (ele.Operator == "包含") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { var vv = line[Field]; return vv && vv.indexOf(Val) >= 0; } } } if (ele.Operator == "不包含") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { var vv = line[Field]; return vv && vv.indexOf(Val) < 0; } } } if (ele.Operator == "为空") { o.func = function (line) { return line[Field] == null; } } if (ele.Operator == "不为空") { o.func = function (line) { return line[Field] != null; } } }()); } if (className == "数字") { (function () { if (ele.Operator == "等于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] == Val; } } } if (ele.Operator == "不等于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] != Val; } } } if (ele.Operator == "大于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] - 0 > Val; } } } if (ele.Operator == "大于等于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] - 0 >= Val; } } } if (ele.Operator == "小于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] - 0 < Val; } } } if (ele.Operator == "小于等于") { if (!Val) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] - 0 <= Val; } } } if (ele.Operator == "选择范围") { if (!Val || Val.Min == null || Val.Max == null ) { o.func = function () { return true; } } else { o.func = function (line) { return line[Field] - 0 >= Val && line[Field] - 0 < Val; } } } if (ele.Operator == "为空") { o.func = function (line) { return line[Field] == null; } } if (ele.Operator == "不为空") { o.func = function (line) { return line[Field] != null; } } }()); } if (className == "附件上传" || className == "手写签名") { if (ele.Operator == "为空") { o.func = function (line) { return line[Field] == null; } } if (ele.Operator == "不为空") { o.func = function (line) { return line[Field] != null; } } } items[index] = o; }); if (all) { var out = []; for (var i = 0; i < lines.length ; i++) { var line = lines[i]; for (var j = 0; j < items.length ; j++) { if (!items[j].func(line)) { line = null; break; } } if (line) { out.push(line); } } return out; } else { var out = []; for (var i = 0; i < lines.length ; i++) { var line = lines[i]; for (var j = 0; j < items.length ; j++) { if (items[j].func(line)) { out.push(line); break; } } } return out; } } CLApp.PcScan = function (event, Success) { var ID = CLMakeId(); var Menu = { "style": { "padding": "10px 10px 0 10px", "overflow-y": "auto", "height": "195px" }, Items: [] }; var _CLMenu = new CLMenu(Menu); _CLMenu.Div.style.textAlign = "center"; var qrcode = new QRCode(_CLMenu.Div, { width: 148,//设置宽高 height: 148 }); var ID = CLMakeId(); _CLMenu.Reset(event); var url = CLHost + "/" + CLCorpId() + "/View/Form/StartScan.cml?ID=" + ID; qrcode.makeCode(url); var span = document.createElement("span"); span.style.color = "#777"; span.style.fontSize = "12px"; span.innerHTML = "请使用钉钉完成扫码"; _CLMenu.Div.appendChild(span); var time = new Date(); var timeout; var close = _CLMenu.Close; _CLMenu.Close = function () { clearTimeout(timeout); close.call(_CLMenu); } function GetScanResult() { var Url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpGetScanResult"; var Load = HttpPost(Url, function (Json) { if (new Date() - time > 600000) { _CLMenu.Close(); return; } if (Json.data != null) { Success(Json.data); _CLMenu.Close(); } else { timeout = setTimeout(function () { clearTimeout(timeout); GetScanResult(); }, 500); } }, { ID: ID }); Load.Stop(); } GetScanResult(); } CLApp.InputDlg = function (targer, Title, Value, Placeholder, End) { var dlg = CLAutoDialog(440, 152, targer); var Div = dlg.Div; Div.style.padding = "20px 20px 15px"; Div.innerHTML = "

" + Title + "

"; var nameInput = document.createElement("input"); nameInput.style.height = "30px"; nameInput.style.width = "100%"; nameInput.value = Value; nameInput.setAttribute("placeholder", Placeholder); Div.appendChild(nameInput); nameInput.focus(); var Bottom = document.createElement("div"); Bottom.style.textAlign = "right"; Bottom.style.marginTop = "10px"; Div.appendChild(Bottom); var Btn = document.createElement("div"); Btn.className = "CLBtnCancel"; Btn.innerHTML = "取消"; Btn.onclick = function () { dlg.Close(); } Btn.style.margin = "0 5px 0 0"; Bottom.appendChild(Btn); Btn = document.createElement("div"); Btn.className = "CLBtnGreen"; Btn.style.margin = "0 0 0 5px"; Btn.innerHTML = "确定"; Btn.onclick = function () { var Value = nameInput.value; if (End(Value) !== false) { dlg.Close(); } } Bottom.appendChild(Btn); return dlg; } CLApp.NameDlg = CLApp.InputDlg; CLApp.CreateDateTable = function (minWillStart, maxWillFinish, maxFinish, hasNotFinish, offset, count) { var dtStart = Date.Parse(minWillStart); var dtEnd = Date.Parse(maxWillFinish); var dtRealEnd = Date.Parse(maxFinish); if (dtRealEnd > dtEnd) { dtEnd = dtRealEnd; } var dtNow = new Date(); if (dtEnd < new Date() && hasNotFinish) { dtEnd = dtNow; } var list = []; var dt = dtStart; while (dt.getDay() != 0) { dt.setDate(dt.getDate() - 1); } while (dtEnd.getDay() != 6) { dtEnd.setDate(dtEnd.getDate() + 1); } var WeekDay = ["日", "一", "二", "三", "四", "五", "六"]; var week; if (!offset) { offset = 0; } if (!count) { count = 0x7fffffff; } var iTotal = (dtEnd - dtStart) / 1000 / 3600 / 24; dt.setDate(dt.getDate() + offset); for (; dt <= dtEnd; dt.setDate(dt.getDate() + 1)) { if (dt.getDay() == 0) { week = dt.toString("yyyy/M/d 周") + WeekDay[dt.getDay()]; } list.push({ Date: dt.toString("yyyy/M/d"), Week: week, Day: dt.getDate(), WeekDay: WeekDay[dt.getDay()], }); if (list.length == count) { break; } } if (list[0]) { list[0].iTotal = iTotal; } return list; } CLApp.GetFormDataUpdateLog = function (ID, FormID, Success, Async) { var url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpGetDataLog"; HttpPost(url, function (Json) { if (Json.code == 0) { var data = Json.data; var Lines = []; var prev = { }; for (var i = 0; i < data.length; i++) { var o = JSON.parse(data[i].Result); var Deletes = o.Deletes; if (!Deletes) { Deletes = []; } Deletes.some(function (data) { if (!o["SubTable_" + data.FormID]) { o["SubTable_" + data.FormID] = []; } }); var line = { }; line.ID = data[i].ID; line.DataID = data[i].FormDataID; line.Changes = []; for (var key in o) { var info; if (/^SubTable_[0-9]*$/.test(key)) { info = CLApp.GetFormOrSubTableById(key); } else { info = CLApp.getFieldInfo(key); } if (info == null) { continue; } if (prev[key] == o[key]) { continue; } if (key == "createDt" || key == "updateDt" || key == "Submiter") { continue; } var change = { ID: key, Name: info.Name, className: info.className, prevValue: prev[key] == null ? "" : CLApp.ConvertData(info.className, prev[key]), oValue: o[key], Value: CLApp.ConvertData(info.className, o[key]) }; line.Changes.push(change); if (info.className == "子表单") { if (!!prev[key]) { var oPrev = prev[key]; prev[key] = []; oPrev.forEach(function (ele) { if (!ele.Del) { ele = CLClone(ele); delete ele.Add; prev[key].push(CLClone(ele)); } }); if (i == 1 && prev[key][0] && prev[key][0].ID == null) { var IDs = []; o[key].forEach(function (ele) { IDs.push(ele.ID); }); Deletes.some(function (data) { if (data.FormID == info.ID) { IDs.push(data.ID); } }); CLQuickSort(IDs, function (e1, e2) { return CLStrCmp(e1, e2); }); prev[key].forEach(function (ele, index) { ele.ID = IDs[index]; oPrev[index].ID = IDs[index]; }); } else if (info.Name == "关键工艺路线") { var Arr = []; var oIDs = []; prev[key].forEach(function (ele) { if (!ele.ID) { Arr.push(ele); } else { oIDs.push(ele.ID); } }); if (Arr.length > 0) { var IDs = []; o[key].forEach(function (ele) { if (oIDs.indexOf(ele.ID) < 0) { IDs.push(ele.ID); } }); Deletes.some(function (data) { if (data.FormID == info.ID) { if (oIDs.indexOf(data.ID) < 0) { IDs.push(data.ID); } } }); if (IDs.length == Arr.length) { CLQuickSort(IDs, function (e1, e2) { return CLStrCmp(e1, e2); }); CLQuickSort(Arr, function (e1, e2) { if (e1.Index != null && e2.Index != null) { return e1.Index - e2.Index; } else { return 0; } }); Arr.forEach(function (ele, index) { ele.ID = IDs[index]; }); } } } o[key].some(function (nV, j) { var has = false; prev[key].some(function (oV, i) { if (oV.ID == nV.ID) { var changes = { }; for (var key in nV) { if (nV[key] !== undefined && nV[key] != oV[key]) { changes[key] = oV[key]; oV[key] = nV[key]; } } oV.changes = changes; has = true; return true; } }); if (!has) { var nl = CLClone(nV); nl.Add = true; prev[key].push(nl); } }); Deletes.some(function (data) { if (data.FormID == info.ID) { prev[key].some(function (line, index) { if (line.ID == data.ID) { prev[key][index].Del = true; return true; } }); } }); CLQuickSort(prev[key], function (e1, e2) { if (e1.Index == e2.Index) { if (e1.Del == e2.Del) { return 0; } else if (e1.Del > e2.Del) { return -1; } else { return 1; } } else { return e1.Index - e2.Index; } }); change.Value = prev[key]; } else { prev[key] = change.oValue; change.Value = prev[key]; } } else { prev[key] = o[key]; } } line.createDt = data[i].createDt; line.Submiter = data[i].Submiter; if (line.Changes.length > 0) { Lines.push(line); } } Json.data = Lines; Success(Json); } else { Json.data = []; Success(Json); } }, { ID: ID, FormID: FormID }, Async); } CLApp.MemberDlg = function (ID, Success) { var Range = { Members: typeof ID == "string" ? [ID] : ID }; FrmCtrls.MemberDialog({ Parts: [], Roles: [], Members: [], Dynamic: [] }, typeof ID != "string", Range, true, function (Val) { Success(typeof ID == "string" ? Val.Members[0] : Val.Members); }); } CLApp.SelectImage = function (AppId, Func) { var dlgDiv = document.createElement("div"); dlgDiv.style.cssText = "width:800px;height:600px"; var dlg = new CLDialog(dlgDiv); dlg.CreateAll("选择图片", function () { var Items = _Assets.getSelect(); for (var i = 0; i < Items.length; i++) { var DirInfo = Items[i].Dir; var index = DirInfo.Name.lastIndexOf("."); if (index < 0) { continue; } var ext = DirInfo.Name.substr(index + 1); if (ext == "png" || ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "bmp") { Func(CLHost + "/" + CLCorpId() + "/Assets/" + DirInfo.ID.replace(/\\/g, "/")); return; } } }); var _Assets = new Assets(dlg.Body, AppId); _Assets.OnlyDir = true; _Assets.EnablePushState(); _Assets.OpenDir(); _Assets.OpenFile = function (DirInfo) { Func(CLHost + "/" + CLCorpId() + "/Assets/" + DirInfo.ID.replace(/\\/g, "/")); dlg.Close(); } } CLApp.GetLockSock = function () { if (CLTop.lockSock == null || CLTop.lockSock.Invoke == null) { CLTop.lockSock = CLTop.CLGetSocket(); CLTop.lockSock.EnableLoading(false); CLTop.lockSock.Funcs = []; CLTop.lockSock.Push = function (func) { if (CLTop.lockSock.FirstConnecte === undefined) { func(); } else { CLTop.lockSock.Funcs.push(func); } } CLTop.lockSock.Remove = function (func) { var Funcs = CLTop.lockSock.Funcs; var index = Funcs.indexOf(func); if (index >= 0) { Funcs.splice(index, 1); } } CLTop.lockSock.FirstConnecte = true; CLTop.lockSock.OnConnected = function () { delete CLTop.lockSock.FirstConnecte; CLTop.lockSock.Funcs.forEach(function (func) { func(); }); CLTop.lockSock.Funcs.length = 0; } } return CLTop.lockSock; } CLApp.PageUnLock = function () { if (CLTop.lockSock != null) { var Funcs = CLTop.lockSock.Funcs; for (var i = 0; Funcs && i < Funcs.length; i++) { var func = Funcs[i]; if (func.__Page__ && func.locked) { func.UnLock(); } } } } CLApp.PageReLock = function () { if (CLTop.lockSock != null) { var Funcs = CLTop.lockSock.Funcs; for (var i = 0; Funcs && i < Funcs.length; i++) { var func = Funcs[i]; if (func.__Page__ && !func.locked) { func(); } } } } CLApp.CreateMenu = function (width, height, btn) { var self = this; width = width == null ? "246px" : width + "px"; height = height == null ? "105px" : height + "px"; var dataMenu = { "style": { "width": width, "height": height, "padding": "8px", "overflow": "hidden", }, "Items": [ ] } var menu = new CLMenu(dataMenu, btn); menu.addFilter(btn); var close = menu.Close; var onclick = btn.onclick; btn.onclick = null; menu.Close = function () { btn.onclick = onclick; close.call(this); } var box = menu.Div.parentNode; box.onmouseup = function (e) { e.stopPropagation(); } return menu; } CLApp.RichEdit = function (sHtml, changed, Ele, resizeType) { var IsDlg = Ele == null; function ResetEditor(eleEdit, sHtml, AppId) { CLLoad("/kindeditor/kindeditor-all-min.js", "1.5"); var width = eleEdit.offsetWidth; var height = eleEdit.offsetHeight; KindEditor.options.htmlTags['td,th'] = [ 'id', 'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.background', '.border', '.width' ] KindEditor.options.htmlTags['script'] = ["id", "class", "src", "type"]; KindEditor.colorpicker = function (config) { var colorVal = config.selectedColor || "#4A4A4A"; var _color = new CLTop.CLColors(ke.cmd.val(name) || "#4A4A4A"); var div = document.body.lastChild; var self = this; div.onclick = div.onmousedown = function (e) { e.stopPropagation(); } _color.End = function (color) { config.click(color); } return { remove: function () { } } } var ke = eleEdit.KingEditor = KindEditor.create(eleEdit, { allowFileManager: true, basePath: "/kindeditor/", width: eleEdit.parentNode.offsetWidth, height: eleEdit.parentNode.offsetHeight, resizeType: resizeType == null ? 0 : resizeType, zIndex: 2147483646, items: [ 'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor', 'link', 'unlink', '|'//, 'about' ] , afterBlur: function () { if (!IsDlg) { var html = ke.html(); changed(html); } } }); function func(name) { var knode = ke.toolbar.get(name); var colorVal = ke.cmd.val(name) || "#4A4A4A"; var _color = new CLTop.CLColors(ke.cmd.val(name) || "#4A4A4A"); _color.End = function (color) { ke.exec(name, color); } } ke._handlers["clickToolbarhilitecolor"] = [function () { func('hilitecolor'); }]; ke._handlers["clickToolbarforecolor"] = [function () { func('forecolor'); }]; var design = ke.edit.design; ke.edit.design = function (nSource) { var textarea = ke.edit.textarea[0]; if (nSource && ke.CLEditer) { textarea.value = ke.CLEditer.getOriginalCode(); ke.CLEditer.Pos = ke.CLEditer.getCursor(); design.call(ke.edit, nSource); textarea.parentNode.classList.remove("Vs"); } else { design.call(ke.edit, nSource); textarea.style.display = "none"; var ele = textarea.previousSibling; textarea.parentNode.classList.add("Vs"); if (!ke.CLEditer) { var mixedMode = { name: "html", }; var html = ke.html(); var editer = ke.CLEditer = new CLCodeEditor(textarea.parentNode, mixedMode); editer.cusCopy = false; ke.CLEditer.setSize(ele.style.width, ele.style.height); ke.CLEditer.setValue(html); } else { ke.CLEditer.setSize(ele.style.width, ele.style.height); if (ke.CLEditer.Pos) { ke.CLEditer.setCursor(ke.CLEditer.Pos); } } ke.CLEditer.focus(); } } var fhtml = ke.edit.html; ke.edit.html = function (val, isFull) { if (this.designMode || !ke.CLEditer) { return fhtml.call(this, val, isFull); } else { if (val === undefined) { return ke.CLEditer.getOriginalCode(); } else { ke.CLEditer.setValue(val); return this; } } } var insertHtml = ke.insertHtml; ke.insertHtml = function (html) { var R = insertHtml.apply(this, arguments); if (html.match(/class="prettyprint[^"]*"/)) { var iframe = eleEdit.parentNode.getElementsByClassName("ke-edit-iframe")[0]; iframe.contentWindow.prettyPrint && iframe.contentWindow.prettyPrint(); } return R; } if (navigator.userAgent.indexOf("QQBrowser") > 0) { var iframe = eleEdit.parentNode.getElementsByClassName("ke-edit-iframe")[0]; iframe.contentWindow.addEventListener("paste", function (e) { var item = e.clipboardData.items[0]; if (item && item.kind == "file" && item.type.indexOf("image/") == 0) { var file = item.getAsFile(); var reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (r) { //eleEdit.KingEditor.insertHtml(""); } } e.stopPropagation(); }, true); } ke.html(sHtml); } var dlg; if (Ele == null) { var div = document.createElement("div"); div.style.cssText = "width:800px;min-width:800px;height:600px"; dlg = new CLDialog(div); dlg.CreateAll("编辑文本", function () { var sHtml = editor.KingEditor.html(); changed(sHtml); }); dlg.onsizeChanged = dlg.resize = function () { editor.KingEditor.resize(dlg.Body.offsetWidth - 40, dlg.Body.offsetHeight - 30); } dlg.EnableMove(); dlg.Body.style.position = "relative"; dlg.Body.style.overflow = "auto"; var editor = document.createElement("div"); editor.style.cssText = "width:100%;height:100%"; dlg.Body.appendChild(editor); editor.id = CLMakeId(); dlg.Header.ondblclick = function () { dlg.MaximizeOrReset(); } Ele = editor; } ResetEditor(Ele, sHtml); return dlg; } CLApp.WaterInfoDlg = function (waterInfo, Success, editCode) { var dlgDiv = document.createElement("div"); dlgDiv.style.cssText = "width:500px;height:600px;min-width:500px;max-width:500px;min-height:600px;max-height:600px;"; var dlg = new CLDialog(dlgDiv); dlg.CreateAll("设置水印", function () { var waterInfo = Info(); Success(waterInfo); }); dlg.EnableMove(); var Body = dlg.Body; Body.style.cursor = "default"; Body.style.paddingTop = "10px"; var label = document.createElement("div"); label.style.lineHeight = "30px"; label.innerHTML = "位置:"; Body.appendChild(label); var xList = new CLList([ { ID: "靠左", Name: "靠左" }, { ID: "居中", Name: "居中" }, { ID: "靠右", Name: "靠右" }, ], Body, false, function (Item, ItemData) { Item.style.display = "inline-block"; Item.style.width = "25%"; }); xList.canLost = false; xList.OnSelected = function () { show(Info()); } var xInput = document.createElement("input"); xInput.style.cssText = "width:80px;height:25px;line-height:25px;vertical-align:top;"; xInput.setAttribute("placeholder", "边距:0px"); var reg = /^[0-9]+(\.?[0-9]*)((px?)|(%?))$/; xInput.oninput = function () { if (!!xInput.value && !reg.test(xInput.value)) { xInput.value = xInput.oValue; } else { xInput.oValue = xInput.value; } } xInput.onchange = function () { var waterInfo = Info(); show(waterInfo); } Body.lastChild.appendChild(xInput); var yList = new CLList([ { ID: "顶部", Name: "顶部" }, { ID: "居中", Name: "居中" }, { ID: "底部", Name: "底部" }, ], Body, false, function (Item, ItemData) { Item.style.display = "inline-block"; Item.style.width = "25%"; }); var yInput = xInput.cloneNode(); yInput.oninput = function () { if (!!yInput.value && !reg.test(yInput.value)) { yInput.value = yInput.oValue; } else { yInput.oValue = yInput.value; } }; yInput.onchange = function () { var waterInfo = Info(); show(waterInfo); } Body.lastChild.appendChild(yInput); yList.canLost = false; yList.OnSelected = function () { show(Info()); } Body.lastChild.style.cssFloat = "none"; var btn = document.createElement("div"); btn.style.cssFloat = "right"; btn.style.cursor = "pointer"; btn.style.color = "#600"; btn.innerHTML = "删除"; btn.onclick = function () { var waterInfo = Info(); delete waterInfo.Src; delete waterInfo.Dynamic; delete box.Url; delete box.Code; delete box.Dynamic; show(waterInfo); } label.appendChild(btn); var IsDynamic = !!waterInfo && !!waterInfo.Dynamic; var dynamicBtn; if (!waterInfo || !waterInfo.Dynamic) { btn = btn.cloneNode(); btn.onclick = function () { CLOpenFile(function (file) { if (file.size > 80 * 1024) { CLShowMsg("上传图片不能大于80K"); } else if (file.name.toLocaleLowerCase().lastIndexOf(".png") != file.name.length - 4) { CLShowMsg("只支持PNG图片"); } else { var reader = new FileReader(); reader.onload = function () { var waterInfo = Info(); delete waterInfo.Src; waterInfo.Src = { Url: reader.result }; show(waterInfo); } reader.readAsDataURL(file); } }, "image/png", false); } btn.innerHTML = "上传"; btn.style.color = "#0db3a6"; btn.style.marginRight = "20px"; label.appendChild(btn); btn = btn.cloneNode(); btn.innerHTML = "公式"; btn.style.color = "#0db3a6"; btn.style.marginRight = "20px"; label.appendChild(btn); btn.onclick = function () { var waterInfo = Info(); editCode(waterInfo.Src.Code, function (Code) { waterInfo.Src.Code = Code; show(waterInfo); }); } } else { dynamicBtn = btn.cloneNode(); dynamicBtn.style.color = "#0db3a6"; dynamicBtn.style.marginRight = "20px"; label.appendChild(dynamicBtn); var selector = new CLSelect(null, dynamicBtn); selector.AddItems(["当前用户", "当前部门", "无"]); selector.SetValue(waterInfo.Dynamic); selector.onchanged = function () { var waterInfo = Info(); waterInfo.Dynamic = selector.GetValue(); show(waterInfo); } } var checkBox = new CLCheckBox("重复", label); checkBox.onchanged = function () { var waterInfo = Info(); show(waterInfo); } label.lastChild.style.cssText = "display:inline-block;color:#0db3a6;float:right;height:30px;line-height:30px;margin-right:20px"; label.lastChild.firstChild.style.marginTop = "7px"; label = label.cloneNode(); label.style.marginBottom = "5px"; label.innerHTML = "尺寸:(单位:px,像素;%,百分比)"; Body.appendChild(label); divWidth = label.cloneNode(); divWidth.style.lineHeight = "25px"; divWidth.style.marginBottom = "15px"; divWidth.style.display = "inline-block"; divWidth.style.marginLeft = "20px"; divWidth.innerHTML = "宽:"; var wInput = xInput.cloneNode(); wInput.setAttribute("placeholder", "例:50%"); wInput.oninput = function () { if (!!wInput.value && !reg.test(wInput.value)) { wInput.value = wInput.oValue; } else { wInput.oValue = wInput.value; } }; wInput.onchange = function () { var waterInfo = Info(); show(waterInfo); } divWidth.appendChild(wInput); Body.appendChild(divWidth); divHeight = divWidth.cloneNode(); divHeight.innerHTML = "高:"; var hInput = xInput.cloneNode(); hInput.setAttribute("placeholder", "例:50%"); hInput.oninput = function () { if (!!hInput.value && !reg.test(hInput.value)) { hInput.value = hInput.oValue; } else { hInput.oValue = hInput.value; } }; hInput.onchange = function () { var waterInfo = Info(); show(waterInfo); } divHeight.appendChild(hInput); hInput.style.marginRight = "15px"; var text = document.createTextNode("透明度:"); divHeight.appendChild(text); var pInput = hInput.cloneNode(); pInput.oninput = function () { if (!!pInput.value && !/^[0-9]+(\.?[0-9]*)(%?)$/.test(pInput.value)) { pInput.value = pInput.oValue; } else { pInput.oValue = pInput.value; } }; pInput.onchange = function () { var waterInfo = Info(); show(waterInfo); } divHeight.appendChild(pInput); Body.appendChild(divHeight); var box = document.createElement("div"); box.style.height = "1525px"; box.style.border = "1px solid #e0e0e0"; box.style.position = "relative"; box.style.zoom = ".2"; Body.appendChild(box); function Info() { var waterInfo = { Position: { xFloat: xList.getSelIds()[0], xMargin: xInput.value, yFloat: yList.getSelIds()[0], yMargin: yInput.value }, Size: { Width: wInput.value, Height: hInput.value }, Repeat: checkBox.checked, Opacity: pInput.value }; if (!IsDynamic) { waterInfo.Src = { }; if (!!box.Url) { waterInfo.Src.Url = box.Url; } if (!!box.Code) { waterInfo.Src.Code = box.Code; } } else { waterInfo.Dynamic = box.Dynamic; } return waterInfo; } var showFlag = false; function show(waterInfo) { if (!showFlag) { showFlag = true; } else { return; } var Url = ""; if (!!waterInfo.Src && !!waterInfo.Src.Url) { if (box.Url != waterInfo.Src.Url) { Url = CLGetObjectURL(new CLBase64().blobUrl(waterInfo.Src.Url)); } box.Url = waterInfo.Src.Url; delete box.Code; } else if (!!waterInfo.Src && !!waterInfo.Src.Code) { if (box.Code == null) { Url += "/CLUI/Icon/File/Fun.png "; } delete box.Src; box.Code = waterInfo.Src.Code; } else if (!!waterInfo.Dynamic) { if (box.Dynamic == null) { Url += "/View/CLApp/img/dynamic.png"; } box.Dynamic = waterInfo.Dynamic; dynamicBtn.innerHTML = !waterInfo.Dynamic || waterInfo.Dynamic == "无" ? "设置" : waterInfo.Dynamic; } else { box.style.background = ""; box.style.backgroundSize = ""; showFlag = false; return; } if (!!Url) { box.style.backgroundImage = "url(" + Url + ")"; } xList.Select(waterInfo.Position.xFloat); yList.Select(waterInfo.Position.yFloat); if (!!waterInfo.Position.xMargin) { xInput.value = waterInfo.Position.xMargin; xInput.oValue = waterInfo.Position.xMargin; } else { xInput.value = ""; xInput.oValue = ""; } if (!!waterInfo.Position.yMargin) { yInput.value = waterInfo.Position.yMargin; yInput.oValue = waterInfo.Position.yMargin; } else { yInput.value = ""; yInput.oValue = ""; } var backgroundPosition = ""; if (waterInfo.Position.xFloat == "靠左") { backgroundPosition += " left "; } if (waterInfo.Position.xFloat == "居中") { backgroundPosition += " center "; } if (waterInfo.Position.xFloat == "靠右") { backgroundPosition += " right "; } if (!!waterInfo.Position.xMargin && waterInfo.Position.xFloat != "居中") { backgroundPosition += " " + waterInfo.Position.xMargin + " "; } if (waterInfo.Position.yFloat == "顶部") { backgroundPosition += " top "; } if (waterInfo.Position.yFloat == "居中") { backgroundPosition += " center "; } if (waterInfo.Position.yFloat == "底部") { backgroundPosition += " bottom "; } if (!!waterInfo.Position.yMargin && waterInfo.Position.yFloat != "居中") { backgroundPosition += " " + waterInfo.Position.yMargin + " "; } box.style["background-position"] = backgroundPosition; checkBox.Checked = waterInfo.Repeat; if (waterInfo.Repeat) { box.style.backgroundRepeat = " repeat "; } else { box.style.backgroundRepeat = " no-repeat "; } var backgroundSize = ""; if (!!waterInfo.Size.Width) { wInput.value = waterInfo.Size.Width; wInput.oValue = waterInfo.Size.Width; backgroundSize += waterInfo.Size.Width + " "; } else { wInput.value = ""; wInput.oValue = ""; backgroundSize += " auto "; } if (!!waterInfo.Size.Height) { hInput.value = waterInfo.Size.Height; hInput.oValue = waterInfo.Size.Height; backgroundSize += waterInfo.Size.Height + " "; } else { hInput.value = ""; hInput.oValue = ""; backgroundSize += " auto "; } box.style.backgroundSize = backgroundSize; if (!!waterInfo.Opacity) { box.style.opacity = parseFloat(waterInfo.Opacity) / 100; pInput.value = waterInfo.Opacity; pInput.oValue = waterInfo.Opacity; } else { box.style.opacity = 1; pInput.value = ""; pInput.oValue = ""; } showFlag = false; } if (!waterInfo || !waterInfo.Size) { waterInfo = Info(); } show(waterInfo); } CLApp.StyleSheetDlg = function (styleSheet, End) { var divDlg = document.createElement("div"); divDlg.style.cssText = "width:800px;height:400px"; var dlg = new CLDialog(divDlg); dlg.CreateAll("设置样式", function () { styleSheet = cssCode.getOriginalCode(); End(styleSheet); }); dlg.Header.ondblclick = function () { dlg.MaximizeOrReset(); } dlg.EnableMove(dlg.Header); var cssCode = new CLCodeEditor(dlg.Body, "style/css"); dlg.onsizeChanged = function () { cssCode.editor.setSize('auto', '100%'); } cssCode.cusCopy = false; cssCode.setValue(styleSheet); Object.defineProperty(dlg, "Value", { get: function () { return cssCode.getOriginalCode(); } }); return dlg; } CLApp.UrlAuth = function (url, app) { if (url.indexOf("?") < 0) { url += "?"; } else { url += "&"; } url += "SysId=" + app; return "/" + CLCorpId() + "/api/CLAuth.cml?url=" + encodeURIComponent(url); } CLApp.MakeId = function (Count) { var url = "/" + CLCorpId() + "/api/CLApp.chx?Function=HttpMakeID"; var R = null; HttpPost(url, function (Json) { if (Json.code == 0) { R = Json.data; } else { CLShowMsg(Json.msg); } }, { Count: !Count ? 1 : Count }, false); return !Count ? R[0] : R; } CLCodeEditor.prototype.Translate = function (Val) { var self = this; if (/^DataField_[0-9]+$/.test(Val) || /^SubTable_[0-9]+$/.test(Val)) { var info = CLApp.getFieldInfo(Val); if (!info) { return Val; } else { return info.Name; } } else if (/^DataTable_[0-9]+$/.test(Val)) { var name = CLApp.TableName(Val.substt(10)); if (!name) { return Val; } else { return name; } } return Val; } var Create = CLCodeEditor.prototype.Create; CLCodeEditor.prototype.Create = function () { var self = this; var R = Create.apply(self, arguments); var down; var timeout; function mousedown() { down = true; } function mouseup() { down = false; } function mouseover(e) { function func() { if (down) { return; } if (ele.classList.contains("cm-property")) { var code = ele.innerHTML; var Val = self.Translate(code); if (code != Val) { var text = document.createElement("div"); var title = new CLTitle(ele, text, false); text.style.padding = "3px 5px"; text.innerHTML = Val; var box = document.body.lastChild; box.style.left = X + "px"; box.style.top = Y + "px"; box.classList.add("TitleToast"); } } } if (timeout != null) { clearTimeout(timeout); timeout = null; } var X = e.clientX; var Y = e.clientY; var ele = e.srcElement; timeout = setTimeout(function () { clearTimeout(timeout); timeout = null; if (e.clientX == X && e.clientY == Y) { func(ele); } }, 300); } window.addEventListener("mousedown", mousedown); window.addEventListener("mouseup", mouseup); self.Ele.addEventListener("mouseover", mouseover); var timer = setInterval(function () { if (!self.Ele.isConnected) { clearInterval(timer); window.removeEventListener("mousedown", mousedown); window.removeEventListener("mouseup", mouseup); self.Ele.removeEventListener("mouseover", mouseover); } }, 100); return R; } CLCodeEditor.prototype.Title = function (Mark) { if (Mark.className == "Field" && Mark.FieldData) { var field = CLApp.getFieldInfo(Mark.FieldData.ID); return field && field.fullName ? field.fullName : ""; } else { return ""; } } var time = setTimeout(function () { var lock = CLApp.GetLockSock(); clearTimeout(time); var closed = null; var SessionId = null; var func = function () { lock.Invoke("api::WSPageLock", "WSLock", [], function (data) { if (data.R == true) { closed = data.Msg[0]; SessionId = data.Msg[1]; func.locked = true; } func.UnLock = function () { if (closed != null && closed != 0) { if (lock.Invoke) { lock.Invoke("api::WSPageLock", "WSUnLock", [SessionId, closed], function (data) { delete func.locked; }); } } } addEventListener("beforeunload", function () { func.UnLock(); }, true); }); }; func.__Page__ = true; lock.Push(func); }, 100); }()); ;(function () { CLLoad(document.curPath + "/CLAppTreeView.css"); window.CLAppTreeView = function (Ele, DirList) { var self = this; self.DirList = DirList; DirTreeView.call(this, Ele); Ele.parentNode.classList.add("CLAppTreeView"); } var fn = CLAppTreeView.prototype = Object.create(DirTreeView.prototype); fn.getLeftTree = function () { var list = []; var self = this; var DirList = self.DirList; for (var i = 0; i < DirList.length; i++) { if (DirList[i].Type == 0) { list.push(DirList[i]); } } var treeData = CLTableToTree(list, null)[0]; return [treeData] } fn.GetDirInfo = function (DirInfo, Success) { var self = this; var Dirs = []; var Id = DirInfo.ID; var DirList = self.DirList; for (var i = 0; i < DirList.length; i++) { if (DirList[i].ParentID == Id) { Dirs.push(DirList[i]); } } Success(Dirs); } fn.GetDesktopApps = function (Success) { var Dirs = []; var self = this; var DirList = self.DirList; for (var i = 0; i < DirList.length; i++) { if (DirList[i].ParentID == DirList[0].ID) { Dirs.push(DirList[i]); } } Success(Dirs); } fn.GetPathInfo = function (DirInfo, Success) { var self = this; var DirList = self.DirList; var Dirs = [DirList[0]]; if (DirInfo.ParentID != null) { var Id = new CLBase64().decode(DirInfo.ID); var Ids = Id.split("/"); Id = ""; for (var i = 1; i < Ids.length; i++) { Id += "/" + Ids[i]; Dirs.push(self.GetDirById(new CLBase64().encode(Id))); } } Success(Dirs); } fn.GetDirById = function (Id, End) { var self = this; var DirList = self.DirList; for (var i = 0; i < DirList.length; i++) { if (DirList[i].ID == Id) { return DirList[i]; } } return null; } fn.OnDirCreated = function (divDir) { var self = this; var Dir = divDir.Dir; divDir.dataMenu = { "style": { "width": "180px", "max-height": "100%", "overflow-y": "auto", }, "Items": [] }; divDir.classList.remove("Js"); divDir.classList.add(Dir.contentType); divDir.oncontextmenu = function (e) { divDir.dataMenu.Items = self.GetDirMenuItems(divDir.dataMenu.Items, divDir); divDir._CLMenu = new CLMenu(divDir.dataMenu); divDir._CLMenu.Reset(e); e.preventDefault(); e.stopPropagation(); } } fn.EnableMenu = function () { var self = this; self.Ele.oncontextmenu = function (e) { e.preventDefault(); } } //搜素 fn.Search = function (sVal) { var self = this; self.leftTree.Search(sVal); if (sVal.length == 0) { self.leftTree.getItemById(self.current().ID).Open(); } } fn.OnlyDir = false; }()); ;(function () { var g_ExplorerUrl = null; window.CLDisk = function (Ele, url, Path) { var self = this; self.Ele = Ele; while (Path && Path[Path.length - 1] == "\\") { Path = Path.substr(0, Path.length - 1); } self.Path = Path; var index = url.indexOf("?"); if (index > 0) { url = url.substr(0, index); } self.forceWsWriteFile = true; if (url.toLowerCase().lastIndexOf(".lor") == url.length - 4) { if (url.indexOf("ws") != 0) { if (url.indexOf("/") == 0 && url[1] != "/") { url = CLDefSockUrl() + url; self.forceWsWriteFile = false; } else if (url.indexOf("http:") == 0) { if (url.indexOf(CLHost) == 0) { url = CLDefSockUrl() + url.substr(CLHost.length); self.forceWsWriteFile = false; } else { url = url.replace("http:", "ws:"); } } else if (url.indexOf("https:") == 0) { if (url.indexOf(CLHost) == 0) { url = CLDefSockUrl() + url.substr(CLHost.length); self.forceWsWriteFile = false; } else { url = url.replace("https:", "wss:"); } } else { if (CLHost.indexOf("http:") == 0) { if (url.indexOf("//") == 0) { url = "ws:" + url; } else { url = "ws://" + url; } } else if (CLHost.indexOf("https:") == 0) { if (url.indexOf("//") == 0) { url = "wss:" + url; } else { url = "wss://" + url; } } } } } else if (/^(?:(?:[A-Z]:)|\\\\[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3})/.test(url)) { self.IsLocal = true; self.forceWsWriteFile = true; url = url.replace(/\\/g, "/"); while (url[url.length - 1] == "\\") { url = url.substr(0, url.length - 1); } } else { self.IsWeb = true; url = CLDefSockUrl() + "/" + url; } self.url = url; self.CalcLeftTree(function () { DirTreeView.call(self, Ele); self.IsCreated = true; if (self.OnCreated != null) { for (var i = 0; i < self.OnCreated.length; i++) { self.OnCreated[i](); } } if (!!self.Path) { self.OpenDir({ ID: Path, Path: Path, Type: 0 }); } else { var item = self.leftTree.getItemById("pc"); var GetDirInfo = self.GetDirInfo; self.GetDirInfo = function (DirInfo, Success) { GetDirInfo.call(self, DirInfo, function (DirInfos) { Success(DirInfos); self.GetDirInfo = function (DirInfo, Success) { self.GetDirInfo = GetDirInfo; Success(DirInfos); } self.leftTree.Select("pc"); }); } item.Open(); } CLEnableDragFiles(self.View, function (e) { if (self.IsLocal) { var df = e.dataTransfer; var files = []; for (var i = 0; i < df.items.length; i++) { var item = df.items[i]; var entry = item.webkitGetAsEntry(); if (item.kind === "file") { files.push(entry.fullPath.substr(1).replace(/\//g,"\\")); } } self.WsGetDragPath(files, function (Data) { self.WsWatcherPause(function () { var load = self.GetSock().Invoke(self.Handle(), "WSPasteDirsEx", [self.GetPosition(), self.current().Path, Data.Type == "COPY", Data.Root, files], function (data) { if (!data.R) { self.onerror(data.Msg); } CLShowProgress(self.Ele); self.SyncCurrent(); }, self.Src()); if (load) { load.SetContainer(self.Ele); } }); }); } else { CLQueryDragFiles(e, function (files) { self.UploadFiles(files); }); } }, function (e) { if (e.type == "dragenter") { } }); }); } var fn = CLDisk.prototype = Object.create(DirTreeView.prototype); fn.constructor = CLDisk; fn.dataLeftTree = null; fn.RootDir = null; fn.IsLocal = false; fn.IsWeb = false; fn.IsBusying = false; fn.forceWsWriteFile = false; fn.WaterId = undefined; fn.WaterInfo = undefined; fn.Filter = "[\s\S]*"; fn.DefViewType = null; fn.Handle = function () { var self = this; if (self.IsWeb) { return "api::WSDisk"; }else if (!self.IsLocal) { return "api::WSNetDisk"; } else { return "ShareDisk"; } } fn.Src = function () { var self = this; if (self.IsLocal) { return CLHost + CLSysHelperUrl(); } else { return; } } fn.getLeftTree = function () { var self = this; return [self.dataLeftTree]; } fn.IsCreated = false; fn.OnCreated = null; fn.PrepareData = function (data) { var self = this; if (data.length == null) { if (!data.ParentID) { data.ParentID = "pc"; } data.ID = data.ID.toLocaleLowerCase(); } else { var match = new RegExp(self.Filter, "i"); for (var i = 0; i < data.length ; i++) { if (!data[i].ParentID) { data[i].ParentID = "pc"; } if (data[i].Name == ".Water" || (data[i].Type != 0 && !match.test(data[i].Path))) { data.splice(i, 1); i--; continue; } data[i].ID = data[i].ID.toLocaleLowerCase(); } if (self.OnlyDir) { for (var i = 0; i < data.length ; i++) { if (data[i].Type != 0) { data.splice(i, 1); i--; } } } } } fn.EnableBrowserPushState = function (Dir) { var self = this; if (self.IsCreated) { DirTreeView.prototype.EnableBrowserPushState.call(self, Dir); } else { if (self.OnCreated == null) { self.OnCreated = [function () { DirTreeView.prototype.EnableBrowserPushState.call(self, Dir); }]; } else { self.OnCreated.push( function () { DirTreeView.prototype.EnableBrowserPushState.call(self,Dir); }); } } } fn.EnablePushState = function () { var self = this; if (self.IsCreated) { DirTreeView.prototype.EnablePushState.call(self); self.OpenDir(null); } else { if (self.OnCreated == null) { self.OnCreated = [function () { DirTreeView.prototype.EnablePushState.call(self); self.OpenDir(self.RootDir); }]; } else { self.OnCreated.push(function () { DirTreeView.prototype.EnablePushState.call(self); self.OpenDir(self.RootDir); }); } } } fn.ShowPathInfo = function (PathInfo) { var self = this; self.pathDiv.innerHTML = ""; var dir = self.current(); var label = document.createElement("span"); label.className = "Label"; self.pathDiv.appendChild(label); var name = self.GetPosition(); name = name.substr(name.lastIndexOf('/') + 1); if (!self.IsLocal && !self.IsWeb) { name = name.substr(0, name.length - 4); } var path = ""; label.path = path; if (name[name.length - 1] == ':') { name = name.substr(0, name.length - 1); } label.innerHTML = name + "://" if (!self.Path) { label.onclick = function () { self.OpenDir({ ID: "pc", Path: "", Name: name }); }; } if (!!dir.Path) { var dirs = dir.Path.split("\\"); for (var i = 0; i < dirs.length; i++) { label = label.cloneNode(); label.innerHTML = dirs[i]; path += dirs[i]; label.path = path; label.Name = dirs[i]; if (i != dirs.length - 1 || dirs.length == 1) { label.innerHTML += "/"; path += "/"; } if (path.length >= (self.Path && (self.Path.length + 1) || 0)) { label.onclick = function () { self.OpenDir({ ID: this.path.replace(/\//g, "\\"), Path: this.path.replace(/\//g, "\\"), Name: this.Name }); } } self.pathDiv.appendChild(label); } } } fn.showType = function (type) { var self = this; if (type === undefined) { return self.__viewType__ == null ? "详细信息" : self.__viewType__; } else { if (type == "详细信息") { CLLocalRemove(self.GetPosition() + "\\" + self.current().ID); self.__viewType__ = "详细信息"; self.syncShowType(); } else { self.__viewType__ = type; self.syncShowType(); CLLocalSave(self.GetPosition() + "\\" + self.current().ID, type, function () { }); } } } fn.syncShowType = function () { var self = this; var classList = self.View.classList; for (var i = 0; i < classList.length; i++) { if (classList[i].indexOf("-") >= 0) { classList.remove(classList[i]); break; } } var type = self.showType(); if (type == "超大图标") { classList.add("Jumbo-View"); } if (type == "大图标") { classList.add("Extral-View"); } if (type == "中等图标") { classList.add("Large-View"); } if (type == "小图标") { classList.add("Small-View"); } if (type == "详细信息") { classList.add("List-View"); } } fn.IconSize = function () { var self = this; var type = self.showType(); if (type == "超大图标") { return 4; } if (type == "大图标") { return 3; } if (type == "中等图标") { return 2; } if (type == "小图标") { return 1; } if (type == "详细信息") { return 1; } } fn.WatcherId = null; fn.GetDirInfo = function (DirInfo, Success) { var self = this; function func(data) { self.PrepareData(data); CLQuickSort(data, function (e1, e2) { if (e1.Type > e2.Type) { return 1; } else if (e1.Type < e2.Type) { return -1; } else if (e1.Type == e2.Type) { return self.NameCmp(e1.Name, e2.Name); } }); CLLocalGet(self.GetPosition() + "\\" + DirInfo.ID, function (Val) { self.__viewType__ = Val || self.DefViewType; self.syncShowType(); Success(data); }); } var load; if (self.IsLocal) { load = self.GetSock().Invoke(self.Handle(), "WSWatcher", [self.GetPosition(), DirInfo.Path, self.WatcherId], function (data) { if (data.R) { func(data.Msg.Dirs); self.WatcherId = data.Msg.watcherId; self.GetSock().EnableLoading(false); } else { Success(); self.onerror(data.Msg); } }, self.Src()); if (load) { load.SetContainer(self.Ele); } } else { load = self.GetSock().Invoke(self.Handle(), "WSQuery", [self.GetPosition(), DirInfo.Path], function (data) { if (data.R) { func(data.Msg); } else { self.onerror(data.Msg); } self.GetSock().EnableLoading(false); }, self.Src()); if (load) { load.SetContainer(self.Ele); } } } fn.GetDesktopApps = function (Success) { Success([]); } fn.GetPathInfo = function (DirInfo, Success) { var self = this; Success(DirInfo.ID); } function IsWin() { var agent = navigator.userAgent.toLowerCase(); if (agent.indexOf("win32") >= 0 || agent.indexOf("wow32") >= 0) { return true; } if (agent.indexOf("win64") >= 0 || agent.indexOf("wow64") >= 0) { return true; } return false; } fn.clearView = function () { var self = this; self.View.innerHTML = ""; self.View.__ArrayIcon__ = []; self.AssocIconMap = {}; } fn.WsAssocIcon = function (Path,Success) { var self = this; if (self.IsLocal) { //Large: 0(32 * 32),Small: 1(16 * 16),ExtralArge: 2(48 * 48),Jumbo: 4(256 * 256) var args = []; var func; if (Path[0] == '*') { args.push(""); } else { args.push(self.GetPosition()); } args.push(Path); args.push(self.IconSize()); func = "WSAssocIconEx"; var load = self.GetSock().Invoke(self.Handle(), func, args, function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }, self.Src()); if (load) { load.Stop(); } } } fn.SetDirIcon = function (divDir) { var self = this; if (!divDir || divDir.Dir.Type == 0) { return; } var ext; var index = divDir.Dir.ID.lastIndexOf("."); if (index < 0) { ext = "."; } else { ext = divDir.Dir.ID.substr(index).toLocaleLowerCase(); } if (/(\.png)|(\.jpg)|(\.jpeg)|(\.bmp)|(\.gif)|(\.svg)/.test(ext) && self.IsWeb) { CLExplorer.prototype.SetDirIcon.call(self, divDir, CLHost + "/" + self.GetPosition() + "/" + divDir.Dir.Path.replaceAll("\\","/")); return; } if (!self.AssocIconMap) { self.AssocIconMap = { }; } self.AssocIconMap.__Size__ = self.IconSize(); if (!!self.AssocIconMap[ext]) { CLExplorer.prototype.SetDirIcon.call(self, divDir, self.AssocIconMap[ext]); if (self.View.__ArrayIcon__) { self.SetDirIcon(self.View.__ArrayIcon__.splice(0, 1)[0]); } return; } if (divDir.Dir.Type == 1) { if (self.__WaitIcon__) { if (!self.View.__ArrayIcon__) { self.View.__ArrayIcon__ = []; } self.View.__ArrayIcon__.push(divDir); } else { self.__WaitIcon__ = true; self.WsAssocIcon((ext == '.exe' || ext == '.lnk') ? divDir.Dir.ID : "*" + ext, function (src) { if (!!src) { src = CLGetObjectURL(new CLBase64().blobUrl(src)); } if (!!src && !(ext == '.exe' || ext == '.lnk')) { self.AssocIconMap[ext] = src; } CLExplorer.prototype.SetDirIcon.call(self, divDir, src); self.__WaitIcon__ = false; if (self.View.__ArrayIcon__) { self.SetDirIcon(self.View.__ArrayIcon__.splice(0, 1)[0]); } }); } } } fn.OnDirCreated = function (divDir) { var self = this; var Dir = divDir.Dir; divDir.dataMenu = { "style": { "width": "180px", "max-height": "100%", "overflow-y": "auto", }, "Items": [] }; var Items = divDir.dataMenu.Items; if (!self.IsLocal) { Items.push({ "Text": Dir.Type == 0 ? "打开" : "在线打开", "Enable": true, "CallBack": function (e) { if (Dir.Type == 0) { self.OpenDir(Dir); } else { self.OpenFile(Dir); } divDir._CLMenu.Close(); } }); } if (Dir.Type == 1 && IsWin()) { Items.push({ "Text": "本地打开", "Enable": true, "CallBack": function (e) { if (self.IsLocal) { var src = self.fUrl(Dir); CLLocalOpen(src, src.substr(src.lastIndexOf("\\") + 1)); } else if (!self.IsWeb) { var index = Dir.Path.lastIndexOf("."); var name = ""; if (index > 0) { name = Dir.object.ID + Dir.Path.substr(index); } else { name = Dir.object.ID; } var url = CLHost + "/" + CLCorpId() + "/" + self.GetPosition() + "?f=" + encodeURIComponent(Dir.Path) + "&FName=" + name; CLLocalOpen(url, name); } else { var url = CLHost + "/" + Dir.Path; CLLocalOpen(url, name); } divDir._CLMenu.Close(); } }); Items.push({ "Text": "打开方式", "Enable": true, "CallBack": function () { }, "OnCreated": function (Item) { var right = document.createElement("span"); right.style.cssText = "font-family:CLFont;position:absolute;color:#bbccdd;right:10px;"; right.innerHTML = ""; Item.appendChild(right); Item.onmouseenter = function () { var Item = this; var index = Dir.Path.lastIndexOf("."); var fName; if (!self.IsLocal) { if (self.IsWeb) { fName = Dir.Path; } else { if (index > 0) { fName = Dir.object.ID + Dir.Path.substr(index); } else { fName = Dir.object.ID; } } } var index = Dir.Path.lastIndexOf("."); if (index < 0) { return; } else { var load = CLAssocEnumHandlers(Dir.Path.substr(index), function (items) { if (!items || items.length == 0) { return; } var dataMenu = { Items: [] }; var Sub = divDir._CLMenu.SubMenu(dataMenu, Item); for (var i = 0; i < items.length; i++) { var item = document.createElement("div"); item.className = "Item"; //item.style.width = "160px"; item.data = items[i]; var icon = document.createElement("img"); icon.style.cssText = "width:15px;height:15px;margin:10px 5px 0 0;"; icon.style.verticalAlign = "top"; icon.src = items[i].Icon; item.appendChild(icon); var name = document.createElement("span"); name.innerHTML = items[i].Desc; item.appendChild(name); item.onclick = function (e) { var item = e.currentTarget; if (self.IsLocal) { var src = self.fUrl(Dir); CLLocalOpenWith(src, src.substr(src.lastIndexOf("\\") + 1), this.data.Name); } else { var src = CLHost + "/" + CLCorpId() + "/" + self.GetPosition() + "?f=" + encodeURIComponent(Dir.Path) + "&FName=FName"; CLLocalOpenWith(src, fName, this.data.Name); } Sub.Close(); } Sub.Div.appendChild(item); } item = document.createElement("div"); item.style.paddingLeft = "35px"; item.innerHTML = "选择默认程序(C)"; item.onclick = function (e) { var item = e.currentTarget; if (!self.IsLocal) { var src = CLHost + "/" + CLCorpId() + "/" + self.GetPosition() + "?f=" + encodeURIComponent(Dir.Path) + "&FName=FName"; CLOpenAs_RunDLL(src, fName); } else { CLOpenAs_RunDLL(Dir.Path, fName); } Sub.Close(); } Sub.Div.appendChild(item); Sub.Div.style.height = ""; Sub.Reset(); }); load.Stop(); } } } }); } if (!self.IsLocal && !self.IsWeb) { if (Dir.Type == 1) { Items.push({ "Text": "查看历史版本", "Enable": true, "CallBack": function (e) { self.QueryVersions(Dir.Path, function (Versions) { self.ShowVersions(Dir, Versions); }); divDir._CLMenu.Close(); } }); } Items.push({ "Text": "下载", "Enable": true, "CallBack": function (e) { var Dirs = []; var Items = self.getSelect(); for (var i = 0; i < Items.length; i++) { Dirs.push(Items[i].Dir); } self.Download(Dirs); divDir._CLMenu.Close(); } }); } Items.push({ "Text": "剪切", "Enable": true, "CallBack": function (e) { var Dirs = []; var Items = self.getSelect(); for (var i = 0; i < Items.length; i++) { Dirs.push(Items[i].Dir); } self.Cut(Dirs); divDir._CLMenu.Close(); } }); Items.push({ "Text": "复制", "Enable": true, "CallBack": function (e) { var Dirs = []; var Items = self.getSelect(); for (var i = 0; i < Items.length; i++) { Dirs.push(Items[i].Dir); } self.Copy(Dirs); divDir._CLMenu.Close(); } }); if (!self.IsLocal && !self.IsWeb) { Items.push({ "Text": "权限", "Enable": true, "CallBack": function (e) { self.AccessDlg(Dir); divDir._CLMenu.Close(); } }); } Items.push({ "Text": "重命名", "Enable": true, "CallBack": function (e) { divDir._CLMenu.Close(); self.StartRenameDir(divDir); } }, { "Text": "删除", "Enable": true, "CallBack": function (e) { var Dirs = []; var Items = self.getSelect(); for (var i = 0; i < Items.length; i++) { Dirs.push(Items[i].Dir); } self.DeleteDirs(Dirs, function () { for (; Items.length != 0;) { Items[0].remove() } }); divDir._CLMenu.Close(); } }); divDir.oncontextmenu = function (e) { e.preventDefault(); e.stopPropagation(); divDir.dataMenu.Items = self.GetDirMenuItems(divDir.dataMenu.Items, divDir); divDir._CLMenu = new CLMenu(divDir.dataMenu); if (self.Ele.__Scope__) { divDir._CLMenu.Box.parentNode.classList.add(self.Ele.__Scope__); } divDir._CLMenu.Reset(e); } self.SetDirIcon(divDir); } fn.EnableMenu = function () { var self = this; var dataItem; (function () { self.Ele.dataMenu = { "style": { "width": "180px", "max-height": "100%", "overflow-y": "auto", }, "Items": [] } var Items = self.Ele.dataMenu.Items; Items.push({ "Text": "查看", "Enable": true, "OnCreated": function (Item) { var right = document.createElement("span"); right.style.cssText = "font-family:CLFont;position:absolute;color:#bbccdd;right:10px;"; right.innerHTML = ""; Item.appendChild(right); var title; var Box; Item.onmouseenter = function (e) { var items = ["超大图标", "大图标", "中等图标", "小图标", "详细信息"]; var Menu = document.createElement("div"); Menu.className = "CLMenu IconList"; for (var i = 0; i < items.length; i++) { var item = document.createElement("div"); item.className = "Item"; item.data = items[i]; var check = document.createElement("div"); check.style.cssText = "width:5px;height:5px;border-radius:5px;background:#00557c;display:inline-block;margin-top:12px;position:relative;left:-5px;top:-2px"; if (items[i] != self.showType()) { check.style.opacity = 0; } item.appendChild(check); var name = document.createElement("span"); name.innerHTML = items[i]; name.style.position = "relative"; item.appendChild(name); item.onclick = function (e) { var item = e.currentTarget; self.showType(item.data); if (self.IconSize() > self.AssocIconMap.__Size__) { self.AssocIconMap = {}; self.View.querySelectorAll(".Item").forEach(function (divDir) { self.SetDirIcon(divDir); }); } title.Close(); } Menu.appendChild(item); } title = new CLTop.CLTitle(Item, Menu); Box = Menu.parentNode; var rect = e.currentTarget.getBoundingClientRectEx(); Box.style.left = rect.right - 15 + "px"; Box.style.top = rect.top + "px"; var boxRect = Box.getBoundingClientRectEx(); if (boxRect.right > CLTop.innerWidth) { Box.style.left = ""; Box.style.right = CLTop.innerWidth - rect.left + "px"; } if (boxRect.bottom > CLTop.innerHeight) { Box.style.top = ""; Box.style.bottom = 0; } } Item.onmouseleave = function (e) { var rect = Box.getBoundingClientRectEx(); if (!(e.clientX >= rect.left && e.clientX <= rect.right && e.clientY >= rect.top && e.clientY <= rect.bottom)) { title.Close(); } } } }); if (CLApp.IsAdmin() && !self.IsLocal && !self.IsWeb) { Items.push({ "Text": "动态水印", "Enable": true, "CallBack": function (e) { self.WsReadWaterInfo(function (waterInfo) { if (!waterInfo) { waterInfo = { Dynamic: "当前用户", Size: {}, Position: { xFloat: "居中", yFloat: "居中" } }; } CLApp.WaterInfoDlg(waterInfo, function (waterInfo) { if (!waterInfo.Dynamic) { waterInfo = undefined; } self.WsWriteWaterInfo(waterInfo); }); }); CLMenu.GetInstance(e.currentTarget).Close(); } }); } Items.push({ "Text": "刷新", "Enable": true, "CallBack": function (e) { self.SyncCurrent(); CLMenu.GetInstance(e.currentTarget).Close(); } }); dataItem = { "Text": "粘贴", "Enable": false, "CallBack": function (e) { if (!self.IsLocal) { self.Paste(self.current()); } else { var Data = this.Data; self.WsWatcherPause(function () { var load = self.GetSock().Invoke(self.Handle(), "WSPasteDirsEx", [self.GetPosition(), self.current().Path, Data.Type == "COPY", Data.Root, Data.Dirs], function (data) { if (!data.R) { self.onerror(data.Msg); } CLShowProgress(self.Ele); self.SyncCurrent(); }, self.Src()); if (load) { load.SetContainer(self.Ele); } }); } CLMenu.GetInstance(e.currentTarget).Close(); } } Items.push(dataItem); Items.push({ "Text": "新建目录", "Enable": true, "CallBack": function (e) { var curPath = self.current(); self.CreateDir(curPath, function (Dir) { var div = self.AppendDir(Dir); self.StartRenameDir(div); }); CLMenu.GetInstance(e.currentTarget).Close(); } }); if (self.IsLocal) { Items.push({ "Text": "弹出", "Enable": true, "CallBack": function (e) { var curPath = self.current(); CLLocalOpenDir(self.url.replace(/\//g, "\\") + "\\" + curPath.Path); CLMenu.GetInstance(e.currentTarget).Close(); } }); Items.push({ "Text": "退出", "Enable": true, "CallBack": function (e) { self.WsNetReuse(function () { self.SyncCurrent(); }); CLMenu.GetInstance(e.currentTarget).Close(); } }); } }()); self.Ele.oncontextmenu = function (e) { e.preventDefault(); if (self.IsBusying) { return; } if (!self.IsLocal) { dataItem.Enable = self.copyData != null || self.cutData != null; var _CLMenu = new CLMenu(self.Ele.dataMenu); if (self.Ele.__Scope__) { _CLMenu.Box.parentNode.classList.add(self.Ele.__Scope__); } _CLMenu.Reset(e); } else { self.WsGetClipboardPath(function (Data) { if (Data && Data.Dirs && !!Data.Type && Data.Dirs.length > 0) { dataItem.Enable = true; dataItem.Data = Data; } else { dataItem.Enable = false; delete dataItem.Data; } var _CLMenu = new CLMenu(self.Ele.dataMenu); if (self.Ele.__Scope__) { _CLMenu.Box.parentNode.classList.add(self.Ele.__Scope__); } _CLMenu.Reset(e); }); } } } fn.Download = function (Dirs) { var self = this; if (!self.IsLocal && !self.IsWeb) { var url = "/" + CLCorpId() + "/api/NetDisk.chx?Function=HttpDownload"; HttpPost(url, function (Json) { if (Json.code == -1) { CLShowMsg(Json.msg); } else { var blob = new CLBase64().blob(Json.data); var Name = Dirs[0].Name; if (Dirs.length > 1 || Dirs[0].Type == 0 || Json.IsZip) { var index = Name.lastIndexOf("."); if (index >= 0) { Name = Name.substr(0, index) + ".zip"; } else { Name = Name + ".zip"; } } CLSaveAsLocal(Name, blob); } }, { Position: self.GetPosition(), Dirs: Dirs }); } } fn.__DirLoading__ = null; fn.__DirTimer__ = null; fn.SyncCurrent = function () { var self = this; var curPath = self.current(); if (self.__DirLoading__ == null) { self.__DirLoading__ = {}; } if (self.__DirTimer__ == null) { self.__DirTimer__ = {}; } function sync() { self.GetSock().EnableLoading(false); self.__DirLoading__[curPath.ID] = true; self.GetDirInfo(curPath, function (dirs) { delete self.__DirLoading__[curPath.ID]; if (curPath.ID != self.current().ID) { return; } self.SyncCurrentWithDirs(dirs); }); } if (self.__DirLoading__[curPath.ID]) { if (self.__DirTimer__[curPath.ID] != null) { clearInterval(self.__DirTimer__[curPath.ID]); } self.__DirTimer__[curPath.ID] = setInterval(function () { if (!self.View.isConnected) { clearInterval(self.__DirTimer__[curPath.ID]); return; } if (!self.__DirLoading__[curPath.ID]) { clearInterval(self.__DirTimer__[curPath.ID]); delete self.__DirTimer__[curPath.ID]; sync(); } }, 100); } else { sync(); } } fn.OpenDir = function (DirInfo, bPushState) { var self = this; self.GetSock().EnableLoading(true); DirTreeView.prototype.OpenDir.call(self, DirInfo, bPushState); } fn.OpenFile = function (DirInfo) { var self = this; if (self.IsWeb) { var url = CLHost + "/" + self.GetPosition() + "/" + DirInfo.Path + "?v=" + DirInfo.updateDt; open(url); } else if (self.IsLocal) { var src = self.fUrl(DirInfo); CLLocalOpen(src, src.substr(src.lastIndexOf("\\") + 1)); } else { var host = self.url.substr(self.url.indexOf(":") + 1); host = host.substr(0, host.indexOf(":")); var url = host + "/" + CLCorpId() + "/NetDisk/" + self.GetPosition() + "/f/" + encodeURIComponent(DirInfo.Path); open(url); } } fn.fUrl = function (DirInfo) { var self = this; var root = self.GetPosition(); root = root.replace(/\//g, "\\"); while (root[root.length - 1] == "\\") { root = root.substr(0, root.length - 1); } var path = DirInfo.Path; path = path.replace(/\//g, "\\"); while (path[path.length - 1] == "\\") { path = path.substr(0, path.length - 1); } while (path[0] == "\\") { path = path.substr(1, path.length - 1); } return root + "\\" + path; } fn.CalcLeftTree = function (Success) { var self = this; var name; if (!self.Path) { name = self.GetPosition(); name = name.substr(name.lastIndexOf('/') + 1); name = name.substr(name.lastIndexOf('/') + 1); if (!self.IsLocal && !self.IsWeb) { name = name.substr(0, name.length - 4); } } else { name = self.Path.substr(self.Path.lastIndexOf("\\") + 1); } self.dataLeftTree = { ID: !self.Path ? "pc" : self.Path, Type: 0, Path: !self.Path ? "" : self.Path, Name: name, Cnt: 1 } self.RootDir = { ID: !self.Path ? "pc" : self.Path, Type: 0, Path: !self.Path ? "" : self.Path, Name: name } Success(); } fn.CreateDir = function (DirInfo, Success) { var self = this; function func(data) { if (data.R) { self.PrepareData(data.Msg); var Item = self.leftTree.getItemById(DirInfo == null ? "pc" : DirInfo.ID); if (Item != null) { Item.addChild(CLClone(data.Msg)); } Success(data.Msg); } else { self.onerror(data.Msg); } } var load = self.GetSock().Invoke(self.Handle(), "WSCreate", [self.GetPosition(), DirInfo == null ? "" : DirInfo.Path, "未命名", false], function (data) { func(data); }, self.Src()); if (load) { load.SetContainer(self.Ele); } } //删除目录 fn.DeleteDirs = function (DirInfos, Success, flag) { var self = this; if (!flag) { CLConfirm(function () { self.DeleteDirs(DirInfos, Success, true); }, "删除后将无法恢复,你确定要继续吗"); return; } var dirs = []; for (var i = 0; i < DirInfos.length; i++) { dirs.push(DirInfos[i].Path); } function func(data) { if (data.R) { for (var i = 0; i < DirInfos.length; i++) { var Item = self.leftTree.getItemById(DirInfos[i].ID); if (Item != null) { Item.Remove(); } } Success(); } else { self.onerror(data.Msg); } } var load = self.GetSock().Invoke(self.Handle(), "WSDelete", [self.GetPosition(), dirs, self.WatcherId], function (data) { func(data); CLShowProgress(self.Ele, "", 0, null, null, "正在删除"); }, self.Src()); if (load) { load.SetContainer(self.Ele); } } //粘贴 fn.Paste = function (DestDir) { var self = this; if (!self.IsLocal) { if (self.IsBusying) { CLShowMsg("你现在很忙..."); return; } self.IsBusying = true; var data = { DestDir: DestDir } var Dirs = []; if (self.cutData != null) { for (var i = 0; i < self.cutData.length; i++) { Dirs.push(self.cutData[i].ID); } } if (self.copyData != null) { for (var i = 0; i < self.copyData.length; i++) { Dirs.push(self.copyData[i].ID); } } function func(data) { if (data.R) { self.PrepareData(data.Msg); CLQuickSort(data.Msg, function (e1, e2) { if (e1.Type > e2.Type) { return 1; } else if (e1.Type < e2.Type) { return -1; } else if (e1.Type == e2.Type) { return self.NameCmp(e1.Name, e2.Name); } }); if (self.cutData != null) { for (var i = 0; i < self.cutData.length; i++) { self.leftTree.getItemById(self.cutData[i].ID).Remove(); } } var select = self.getSelect().length == 0; var Item = self.leftTree.getItemById(DestDir.ID); for (var i = 0; i < data.Msg.length; i++) { var div = self.AppendDir(data.Msg[i]); if (select) { self.Select(div); } } for (var i = 0; i < data.Msg.length ; i++) { if (Item != null) { Item.addChild(CLClone(data.Msg[i])); } } self.cutData = null; } else { self.onerror(data.Msg); } } var load = self.GetSock().Invoke(self.Handle(), "WSPasteDirs", [self.GetPosition(), DestDir.Path, Dirs, self.copyData != null], function (data) { func(data); self.IsBusying = false; }, self.Src()); if (load) { load.SetContainer(self.Ele); } } else { self.WsWatcherPause(function () { var load = self.GetSock().Invoke(self.Handle(), "WSPasteDirsEx", [self.GetPosition(), self.current().Path], function (data) { if (!data.R) { self.onerror(data.Msg); } CLShowProgress(self.Ele); self.SyncCurrent(); }, self.Src()); if (load) { load.SetContainer(self.Ele); } }); } } fn.Copy = function (Dirs) { var self = this; if (self.IsLocal) { var dirs = []; for (var i = 0; i < Dirs.length; i++) { dirs.push((self.GetPosition() + "\\" + Dirs[i].Path).replace(/\//g, "\\")); } self.WsSetClipboardPath("COPY", dirs); } else { CLExplorer.prototype.Copy.call(self, Dirs); } } fn.Cut = function (Dirs) { var self = this; if (self.IsLocal) { var dirs = []; for (var i = 0; i < Dirs.length; i++) { dirs.push((self.GetPosition() + "\\" + Dirs[i].Path).replace(/\//g, "\\")); } self.WsSetClipboardPath("CUT", dirs); } else { CLExplorer.prototype.Cut.call(self, Dirs); } } //重命名目录 fn.RenameDir = function (DirInfo, Success) { var self = this; function func(data) { if (data.R) { var Item = self.leftTree.getItemById(DirInfo.ID); var index = DirInfo.ID.lastIndexOf("\\"); if (index < 0) { DirInfo.ID = DirInfo.Name; } else { DirInfo.ID = DirInfo.ID.substr(0, index + 1) + DirInfo.Name; } DirInfo.Path = DirInfo.ID; if (Item != null) { var ItemData = Item.ItemData; ItemData.Name = DirInfo.Name; Item.Name.innerText = ItemData.Name; ItemData.ID = DirInfo.ID; ItemData.Path = DirInfo.ID; Item.id = Item.id.substr(0, Item.id.indexOf("_", 6) + 1) + DirInfo.ID; } Success(true); } else { Success(false); self.onerror(data.Msg); } } var load; self.WsWatcherPause(function () { load = self.GetSock().Invoke(self.Handle(), "WSRename", [self.GetPosition(), DirInfo.ID, DirInfo.Name], function (data) { func(data); self.WsWatcherContinue(); }, self.Src()); }); if (load) { load.SetContainer(self.Ele); } } fn.showLeftTree = function () { var self = this; var Id; if (self.leftTree) { Id = self.leftTree.GetSelected(); } DirTreeView.prototype.showLeftTree.call(self); if (Id) { self.leftTree.Select(Id); self.leftTree.getItemById(Id).Open(); } } fn.OnlyDir = false; fn.Sock = null; fn.url = null;//ws://0.0.0.0:80/hello.lor fn.sockTimer = null; fn.GetPosition = function () { var self = this; if (self.IsWeb) { return self.url.substr(CLDefSockUrl().length + 1); }else if (!self.IsLocal) { return self.url.substr(self.url.lastIndexOf('/') + 1); } else { return self.url; } } fn.GetSock = function () { var self = this; if (self.Sock != null && self.Sock.Invoke == null) { if (self.Sock.Close) { self.Sock.Close(); clearInterval(self.sockTimer); } } if (self.Sock != null && self.Sock.Invoke == null) { self.Sock = null; } if (self.Sock == null) { if (self.url == null) { self.Sock = CLGetSocket(); } else { if (!self.IsLocal) { var host = self.url.substr(0, self.url.indexOf('/', 6)); if (!!host) { host += "/" + CLCorpId(); } self.Sock = CLGetSocket(host); } else { self.Sock = CLGetSocket("ws://127.0.0.1:999"); self.Sock.WebSocket.onerror = function (event) { if (!self.Sock.WebSocket || !self.Sock.WebSocket.IsOpen) { CLConfirm(function () { location.href = "/api/CLLocalService.chx?Function=HttpGetFile"; }, "
需要安装本地服务【CLLocalService】,你确定要安装吗?
"); } if (self.Sock.Close) { self.Sock.Close(); } self.Sock = null; if (self.Ele.Loading) { self.Ele.Loading.Stop(); } } } } var Invoke = self.Sock.Invoke; self.Sock.Invoke = function (Handler, Function, arguments, Success, Src, flag) { var sock = this; return Invoke.call(this, Handler, Function, arguments, function (data) { if (data.Msg && data.Msg.match && data.Msg.match(/^ERROR\:.*加载失败,请稍后再试$/) && !flag) { var t = setTimeout(function () { clearTimeout(t); Invoke.call(sock, Handler, Function, arguments, Success, Src, true); }, 300); } else { if (Success) { Success(data); } } }, Src, flag); } self.Sock.EnableLoading(true); self.Sock.timeout = 7200 * 1000; self.sockTimer = setInterval(function () { if (!self.Ele.isConnected) { if (self.Sock && self.Sock.Close) { self.Sock.Close(); } clearInterval(self.sockTimer); } }, 300); } self.Sock.OnMsg = function (Msg) { self.SockMsg(Msg); } return self.Sock; } fn.ShowProgress = function (path, progress, total, index) { var self = this; CLShowProgress(self.Ele, path, progress, total, index); } fn.AllocBuffer = function (Success) { var self = this; var load = self.GetSock().Invoke(self.Handle(), "WSAllocBuffer", [self.GetPosition()], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }, self.Src()); if (load) { load.SetContainer(self.Ele); } } fn.SendBytes = 0; fn.WriteBuffer = function (ID, data, Success) { var self = this; if (data == null) { self.SendBytes = 0; self.GetSock().Invoke(self.Handle(), "WSWriteBuffer", [self.GetPosition(), ID], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }, self.Src()); } else { self.GetSock().SendBuf(data, function () { self.SendBytes += data.byteLength; if (self.SendBytes > 1024 * 1024 * 10) { self.SendBytes = 0; self.GetSock().Invoke(self.Handle(), "WSWriteBuffer", [self.GetPosition(), ID], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }, self.Src()); } else { Success(data.Msg); } }); } } fn.CommitBuffer = function (fullPath, ID, Success) { var self = this; var Src = self.WaterInfo == null ? null : self.WaterInfo.Src; if (typeof Src == "function" && self.WaterInfo) { self.WaterInfo.Src = Src(); } self.GetSock().Invoke(self.Handle(), "WSCommitBuffer", [self.GetPosition(), fullPath, ID, self.WaterId, self.WaterInfo], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }, self.Src()); if (self.WaterInfo) { self.WaterInfo.Src = Src; } } fn.WsWriteFile = function (ID, file, Success) { var self = this; var reader = new FileReader(); var len = 65532; //如果文件太大,截取内容小会出现假死现象,因为js执行是同步的 var total = file.file.size; var cuLoaded = 0; var dt = new Date(); var temp = 0; reader.onload = function (event) { cuLoaded += event.loaded; self.WriteBuffer(ID, reader.result, function () { if (cuLoaded < total) { readBlob(cuLoaded); var name = file.path.substr(1); var ss = (new Date() - dt) / 1000; if (ss > 0.05) { name += ">(" + ((cuLoaded - temp) / 1024 / 1024 / ss).toFixed(2) + "M/S)"; dt = new Date(); temp = cuLoaded; self.ShowProgress(name, cuLoaded / total); } } else { cuLoaded = total; self.WriteBuffer(ID, null, function () { var name = file.path.substr(1); self.ShowProgress(name, 1); Success(); }); } }); } //指定开始位置,分块读取文件 function readBlob(start) { //指定开始位置和结束位置读取文件 var blob = file.file.slice(start, start + len); reader.readAsArrayBuffer(blob); } readBlob(0); } fn.WriteFile = fn.WsWriteFile; fn.UploadFile = function (file, path, Success) { var self = this; if (self.IsLocal && !self.forceWsWriteFile) { var from = g_ExplorerUrl + "\\" + file.path; from = from.replace(/\//g, "\\"); var to = self.GetPosition() + "\\" + path; to = to.replace(/\//g, "\\"); self.WsAsyncCopy(from, to, function () { self.ShowProgress(file.path, 1); Success(); }); } else { self.AllocBuffer(function (ID) { if (!self.forceWsWriteFile) { self.WriteFile(ID, file, function () { self.CommitBuffer(path, ID, function () { self.ShowProgress(file.path, 1); Success(); }); }); } else { self.WsWriteFile(ID, file, function () { self.CommitBuffer(path, ID, function () { self.ShowProgress(file.path, 1); Success(); }); }); } }); } } fn.UploadFiles = function (files) { var self = this; if (!self.current()) { var tm = 0; var t = setInterval(function () { if (self.current()) { clearInterval(t); self.UploadFiles(files); } else { tm++; if (tm > 300) { clearInterval(t); } } }, 10); return; } if (self.IsBusying) { CLShowMsg("你现在很忙..."); return; } self.WsWatcherPause(); self.IsBusying = true; var onerror = self.onerror; var fPath = self.current().Path; var ShowProgress = self.ShowProgress; self.onerror = function (msg) { onerror.call(self, msg); self.onerror = onerror; CLShowProgress(self.Ele); self.ShowProgress = ShowProgress; self.IsBusying = false; } var total = files.length; self.GetSock().EnableLoading(false); function Upload() { self.ShowProgress = function (path, progress) { ShowProgress.call(self, path, progress, total, total - files.length + 1); } self.UploadFile(files[0], fPath + "\\" + files[0].path.replace(/\//g, "\\"), function () { var fName = files[0].path; var index = fName.indexOf("/", 1); if (index > 0) { fName = fName.substring(1, index); } files.splice(0, 1); if (files.length == 0) { self.onerror = onerror; self.ShowProgress = ShowProgress; CLShowProgress(self.Ele); self.WsWatcherContinue(); self.IsBusying = false; } else { Upload(); } var id = fPath; if (!!id) { id += "\\"; } id += fName; if (!self.leftTree.getItemById(id)){ self.SyncCurrent(); } }); } Upload(); } fn.QueryVersions = function (fullPath, Success) { var self = this; var load = self.GetSock().Invoke("api::WSNetDisk", "WSQueryVersions", [self.GetPosition(), fullPath], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }); if (load) { load.SetContainer(self.Ele); } } fn.ShowVersions = function (Dir, Versions) { var self = this; var style = CLTop.document.getElementById("CLDiskVersionsDlgStyle"); if (style == null) { style = CLTop.document.createElement("style"); style.id = "NCLDiskVersionsDlgStyle"; style.innerHTML = ".CLDialogBg .CLExplorer .List-View .Item>div::before{height:40px;width:25px;float:left;margin:5px 15px 5px 5px}"; CLTop.document.head.appendChild(style); } var dlgDiv = document.createElement("div"); dlgDiv.style.cssText = "width:450px;height:400px"; var dlg = new CLDialog(dlgDiv); dlgDiv.classList.add("CLExplorer"); dlg.CreateAll("历史版本", function () { }); dlg.EnableMove(); dlg.Body.classList.add("View"); dlg.Body.classList.add("List-View"); dlg.Body.style.position = "relative"; dlg.Body.style.left = "0"; dlg.Body.style.top = "0"; function showVersion(Version) { var item = document.createElement("div"); item.className = "Item " + self.GetExtClass(Dir.Path.substr(Dir.Path.lastIndexOf(".") + 1)); item.data = Version; item.ondblclick = function () { open("/" + CLCorpId() + "/" + self.GetPosition() + "?f=" + Dir.Path + "&v=" + encodeURIComponent(this.data.ID)); } dlg.Body.appendChild(item); var div = document.createElement("div"); div.style.width = "100%"; item.appendChild(div); var divDt = document.createElement("div"); divDt.style.padding = "0px"; divDt.style.lineHeight = "25px"; divDt.style.fontWeight = "900"; divDt.style.color = "#000"; divDt.innerHTML = Date.Parse(Version.createDt).Format("M月d日 dddd hh:mm:ss"); div.appendChild(divDt); var divAuthor = divDt.cloneNode(); divAuthor.style.fontWeight = ""; divAuthor.style.color = "#7E8082"; divAuthor.innerHTML = Version.Author; div.appendChild(divAuthor); item.oncontextmenu = function (e) { e.preventDefault(); var Menu = { "style": { "width": "180px", "max-height": "100%", "overflow-y": "auto", }, "Items": [] }; var data = this.data; var Items = Menu.Items; Items.push({ "Text": "还原", "Enable": true, "CallBack": function (e) { var curPath = self.current(); self.ResetTo(Dir, data.ID, function (hasVer) { if (hasVer) { var Ver = CLClone(data); data.Author = CLApp.getCurrentUser().name; data.createDt = new Date().toString("yyyy-MM-dd HH:mm:ss.fff"); showVersion(data); dlg.Body.insertBefore(dlg.Body.lastChild, dlg.Body.firstChild); } }); _CLMenu.Close(); } }); var _CLMenu = new CLTop.CLMenu(Menu); _CLMenu.Reset(e); } } for (var i = 0; i < Versions.length; i++) { showVersion(Versions[i]); } } fn.ResetTo = function (Dir, Ver, Success) { var self = this; var self = this; var load = self.GetSock().Invoke("api::WSNetDisk", "WSResetTo", [self.GetPosition(), Dir.Path, Ver], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }); if (load) { load.SetContainer(self.Ele); } } fn.onerror = function (msg) { CLShowMsg(msg); } fn.GetAccess = function (path, Success) { var self = this; var load = self.GetSock().Invoke("api::WSNetDisk", "WSGetAccess", [self.GetPosition(), path], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }); if (load) { load.SetContainer(self.Ele); } } fn.SetAccess = function (path, Access, Success) { var self = this; var load = self.GetSock().Invoke("api::WSNetDisk", "WSSetAccess", [self.GetPosition(), path, Access], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }); if (load) { load.SetContainer(self.Ele); } } fn.AccessDlg = function (Dir) { var self = this; var dlgDiv = document.createElement("div"); dlgDiv.style.cssText = "width:800px;height:800px;margin:30px auto"; var dlg = new CLDialog(dlgDiv); dlgDiv.style.animation = "none"; var SetAccess; dlg.CreateAll("权限设置", function () { if (SetAccess) { SetAccess(); } }); dlg.EnableMove(); dlg.Header.ondblclick = function () { dlg.MaximizeOrReset(); } dlg.Body.style.overflow = "auto"; function DynamicIdToName(Dynamic) { for (var i = 0; Dynamic != null && i < Dynamic.length ; i++) { Dynamic[i] = FrmCtrls.getDynamicNameById(Dynamic[i]); } return Dynamic; } function DynamicNameToId(Dynamic) { for (var i = 0; Dynamic != null && i < Dynamic.length ; i++) { Dynamic[i] = FrmCtrls.getDynamicIdByName(Dynamic[i]); } return Dynamic; } function ShowAccess(Name, oAccess, Desc, Set) { var divRange = document.createElement("div"); divRange.style.cssText = "padding: 15px 0;border-bottom: 1px solid #e0e0e0;position:relative"; dlg.Body.appendChild(divRange); var title = document.createElement("div"); title.style.lineHeight = "36px"; title.innerHTML = Name; divRange.appendChild(title); var divDesc = document.createElement("div"); divDesc.style.color = "grey"; divDesc.style.marginBottom = "5px"; divDesc.innerHTML = Desc; divRange.appendChild(divDesc); var divHandle = document.createElement("div"); divHandle.style.cssText = "min-height:80px;margin-bottom: 10px;overflow: auto;line-height:30px"; divRange.appendChild(divHandle); FrmDesigner.ShowHandlers(oAccess, divHandle); var addBtn = document.createElement("div"); addBtn.innerHTML = "点击选择成员"; addBtn.style.cssText = "cursor:pointer;color:#178cdf;display:inline-block"; addBtn.onclick = function () { var tempAuth = CLClone(oAccess); if (tempAuth == null) { tempAuth = {}; } tempAuth.Dynamic = DynamicNameToId(CLClone(tempAuth.Dynamic)); FrmCtrls.MemberRangeDialog(tempAuth, function (Access) { Access.Dynamic = DynamicIdToName(Access.Dynamic); FrmDesigner.ShowHandlers(Access, divHandle); if (divHandle.childNodes.length == 0) { divHandle.appendChild(addBtn); divHandle.onclick = null; divHandle.style.cursor = ""; } else { divHandle.onclick = addBtn.onclick; divHandle.style.cursor = "pointer"; } oAccess = Access; Set(Access); }); } if (divHandle.childNodes.length == 0) { divHandle.appendChild(addBtn); divHandle.onclick = null; divHandle.style.cursor = ""; } else { divHandle.onclick = addBtn.onclick; divHandle.style.cursor = "pointer"; } } self.GetAccess(Dir.Path, function (all) { if (all == null) { all = {}; } ShowAccess("写入权限", all.Write, "拥有该权限的用户可以创建文件夹,可以上传文件,可以还原历史版本,但不可用删除文件,不可以移动文件", function (access) { all.Write = access; }); ShowAccess("读取权限", all.Read, "拥有该权限的用户仅可以查看和下载文件", function (access) { all.Read = access; }); ShowAccess("移动权限", all.Move, "拥有该权限的用户仅可以移动文件", function (access) { all.Move = access; }); ShowAccess("删除权限", all.Delete, "拥有该权限的用户仅可以删除文件", function (access) { all.Delete = access; }); ShowAccess("完全控制权限", all.All, "拥有该权限的用户可以对文件进行一切操作", function (access) { all.All = access; }); SetAccess = function () { self.SetAccess(Dir.Path, all, function () { CLShowMsg("操作成功.",false); }); } }); } fn.AddSearchResault = function (Resault) { var self = this; if (!self.AsyncId) { return; } var divDir = self.AppendDir(Resault); var Items = divDir.dataMenu.Items; Items.splice(1, 0, { "Text": "打开文件" + (Resault.Type == 0 ? "夹" : "") + "位置", "Enable": true, "Dir": Resault, "CallBack": function (e) { var Dir = this.Dir; var Path; var index = Dir.Path.lastIndexOf("\\"); self.OpenDir({ Path: index < 0 ? "" : Dir.Path.substr(0, index), }); } }); } fn.WsSearch = function (Path, value, Success) { var self = this; var load = self.GetSock().Invoke(self.Handle(), "WSSearch", [self.GetPosition(), Path, value], function (data) { if (data.R) { Success(data.Msg); } else { self.onerror(data.Msg); } }, self.Src()); if (load) { load.SetContainer(self.View); } } fn.AsyncId = null; fn.SockMsg = function (data) { var self = this; if (self.IsBusying) { return; } if (Array.isArray(data)) { data.forEach(function (data) { self.SockMsg(data); }); return; } if (data.Function == "Added" && !!data.Dir.ID) { self.PrepareData(data.Dir); self.UpdateDir(data.Dir); } if (data.Function == "Changed" && !!data.Dir.ID) { self.PrepareData(data.Dir); self.UpdateDir(data.Dir); } if (data.Function == "Renamed") { self.SyncCurrent(); } if (data.Function == "Removed" && !!data.Dir.ID) { self.PrepareData(data.Dir); var item = self.leftTree.getItemById(data.Dir.ID); if (item) { item.remove(); } var childNodes = self.View.childNodes; for (var i = 0; i < childNodes.length; i++) { if (childNodes[i].Dir.ID == data.Dir.ID) { childNodes[i].remove(); break; } } } if (data.Function == "ShowProgress") { CLShowProgress(self.Ele, data.Path, data.Progress, data.Total, data.Index, data.Title); } } fn.WsAsyncContinue = function () { var self = this; if (self.AsyncId) { var load = self.GetSock().Invoke(self.Handle(), "WSAsyncContinue", [self.AsyncId], function (data) { }, self.Src()); if (load) { load.Stop(); } } } fn.WsAsyncSearch = function (Path, value, Callback) { var self = this; var load; self.WsAsyncStop(function () { self.View.setAttribute("empty", "正在搜索..."); self.GetSock().EnableLoading(false); self.IsBusying = true; self.GetSock().Invoke(self.Handle(), "WSAsyncSearch", [self.GetPosition(), Path, value], function (data) { if (data.R) { self.AsyncId = data.Msg; } else { self.onerror(data.Msg); } }, self.Src()); self.SockMsg = function (Msg) { if ((Array.isArray(Msg) && !!Msg[0] && !!Msg[0].ID) || !!Msg.ID) { Callback(Msg); self.WsAsyncContinue(); } else { if (Msg.Function == "AsyncEnd") { self.AsyncId = null; self.IsBusying = false; CLShowMsg(Msg.Msg, false); self.View.setAttribute("empty", "没有与搜索条件匹配的项."); } else { CLDisk.prototype.SockMsg.call(this, Msg); } } } }); } fn.WsAsyncStop = function (End) { var self = this; if (self.AsyncId) { self.SockMsg = function (Msg) { if (Msg.Function == "AsyncEnd") { self.AsyncId = null; self.IsBusying = false; End(); } else { CLDisk.prototype.SockMsg.call(this, Msg); } } var load = self.GetSock().Invoke(self.Handle(), "WSAsyncStop", [self.AsyncId], function (data) { if (!data.R) { self.onerror(data.Msg); } }, self.Src()); self.AsyncId = null; if (load) { load.SetContainer(self.Ele); } } else { if (End) { End(); } } } fn.WsGetDragRoot = function (Success) { var self = this; if (self.IsLocal) { var load = self.GetSock().Invoke(self.Handle(), "WSGetDragRoot", [], function (data) { if (data.R) { var url = data.Msg.replace(/\//g, "\\"); url = decodeURIComponent(url); Success(url); } else { CLShowMsg(data.Msg); } }, self.Src()); if (load) { load.Stop(); } } else { Success(""); } } fn.WsGetClipboardPath = function (Success) { var self = this; if (self.IsLocal) { var load = self.GetSock().Invoke(self.Handle(), "WSGetClipboardPath", [], function (data) { if (data.R) { Success(data.Msg); } else { CLShowMsg(data.Msg); } }, self.Src()); if (load) { load.Stop(); } } else { Success(); } } fn.WsEmptyClipboard = function () { var self = this; self.GetSock().Invoke(self.Handle(), "WSEmptyClipboard", [from, to], function (data) { }, self.Src()); } fn.WsSetClipboardPath = function (type, Dirs) { var self = this; self.GetSock().Invoke(self.Handle(), "WSSetClipboardPath", [type, Dirs], function (data) { if (!data.R) { CLShowMsg(data.Msg); } }, self.Src()); } fn.WsGetDragPath = function (Dirs, Success) { var self = this; self.GetSock().EnableLoading(true); self.GetSock().Invoke(self.Handle(), "WSGetDragPath", [Dirs], function (data) { if (!data.R) { CLShowMsg(data.Msg); } else { Success(data.Msg); } }, self.Src()); } fn.WsWatcherPause = function (Success) { var self = this; if (self.IsLocal) { self.GetSock().Invoke(self.Handle(), "WSWatcherPause", [self.WatcherId], function (data) { Success && Success(); }, self.Src()); } else { Success && Success(); } } fn.WsWatcherContinue = function () { var self = this; self.GetSock().Invoke(self.Handle(), "WSWatcherContinue", [self.WatcherId], function (data) { }, self.Src()); } fn.oItems = null; fn.Search = function (value) { var self = this; value = value == null ? null : value.trim(); if (!self.oItems) { self.oItems = self.View.querySelectorAll(".Item"); } var HasDir = false; self.View.setAttribute("empty", "这个文件夹是空的"); for (var i = 0; self.oItems && i < self.oItems.length; i++) { if (self.oItems[i].Dir.Type == 0) { HasDir = true; } } if (!HasDir) { if (!value) { if (value !== null) { self.View.innerHTML = ""; for (var i = 0; self.oItems && i < self.oItems.length; i++) { self.View.appendChild(self.oItems[i]); } self.oItems = null; } } else { var Resault = []; for (var i = 0; self.oItems && i < self.oItems.length; i++) { if (self.oItems[i].Dir.Name.indexOf(value) >= 0) { Resault.push(self.oItems[i]); } } self.View.innerHTML = ""; for (var i = 0; i < Resault.length; i++) { self.View.appendChild(Resault[i]); } } } else { if (!value) { self.WsAsyncStop(function () { self.WsWatcherContinue(); if (value !== null) { self.View.innerHTML = ""; for (var i = 0; self.oItems && i < self.oItems.length; i++) { self.View.appendChild(self.oItems[i]); } self.oItems = null; } }); } else { var cur = self.current(); self.View.innerHTML = ""; self.WsWatcherPause(); self.WsAsyncSearch(!cur ? "" : cur.Path, value, function (data) { if (Array.isArray(data)) { data.forEach(function (ele) { self.AddSearchResault(ele); }); } else { self.AddSearchResault(data); } if (self.View.childNodes.length >= 2000) { self.WsAsyncStop(function () { CLShowMsg("查询结果太多,但显示了2000条..."); }); } }); } } } fn.UpdateDir = function (Dir) { var self = this; var Items = self.View.querySelectorAll(".Item"); var before = null; var divDir = null; if (Dir.ParentID != self.current().ID) { return; } var Item = self.leftTree.getItemById(self.current().ID); if (!self.leftTree.getItemById(Dir.ID)) { Item.addChild(CLClone(Dir)); } for (var i = 0; i < Items.length; i++) { if (Dir.ID == Items[i].Dir.ID) { divDir = Items[i]; } } if (!divDir) { divDir = self.AppendDir(Dir); } } fn.WriteWater = function (WaterInfo, WaterId) { var self = this; self.WaterId = WaterId; self.WaterInfo = WaterInfo; } fn.WsWriteWaterInfo = function (WaterInfo) { var self = this; var path = self.current().Path; var load = self.GetSock().Invoke(self.Handle(), "WSWriteWaterInfo", [self.GetPosition(), path, WaterInfo], function (data) { if (!data.R) { CLShowMsg(data.Msg); } }, self.Src()); if (load) { load.Stop(); } } fn.WsReadWaterInfo = function (Success) { var self = this; var path = self.current().Path; var load = self.GetSock().Invoke(self.Handle(), "WSReadWaterInfo", [self.GetPosition(), path], function (data) { if (!data.R) { CLShowMsg(data.Msg); } else { Success(data.Msg); } }, self.Src()); if (load) { load.Stop(); } } fn.WsNetReuse = function (Success) { var self = this; var path = self.current().Path; CLShowProgress(self.Ele, "正在退出", 0, 0, 0, ""); var tm = 0; var timer = setInterval(function () { tm += 50; CLShowProgress(self.Ele); CLShowProgress(self.Ele, "正在退出", tm / 15000, 0, 0, ""); if (tm >= 15000) { clearInterval(timer); CLShowProgress(self.Ele); } }, 50); var load = self.GetSock().Invoke(self.Handle(), "WSNetReuse", [self.GetPosition(), path], function (data) { if (!data.R) { CLShowMsg(data.Msg); } else { Success(); } }, self.Src()); if (load) { load.Stop(); } } fn.GetExtClass = function (ext) { var self = this; if (self.IsLocal) { return "Unknown"; } else { return CLExplorer.prototype.GetExtClass.call(self, ext); } } CLDisk.Upload = function (file, Lor, toPath, Success, Container) { function Speed(o) { var e = o.e; var dt = o.dt; var bytes = o.bytes; var tm = dt; dt = o.dt = new Date(); tm = dt - tm; var sp = (e.loaded - bytes) * 1000 / tm; bytes = o.bytes = e.loaded; if (sp > 1024 * 1024) { sp /= 1024 * 1024; sp = sp.toFixed(2) + "MB/S"; } else if (sp > 1024) { sp /= 1024; sp = sp.toFixed(2) + "KB/S"; } else { sp = sp.toFixed(2) + "B/S"; } var info = "正在下载(" + sp + ")"; } var url = "/" + CLCorpId() + "/api/NetDisk.chx?Function=HttpUploadTo"; var o = { dt: new Date(), bytes: 0 }; HttpPost(url, function (json) { CLShowProgress(Container || document.body); if (json.code == 0) { var host = "//" + location.hostname + (!!location.port ? (":" + location.port) : "") var url = host + "/" + CLCorpId() + "/NetDisk/" + Lor + "/f/" + encodeURIComponent(toPath); url += "?v=" + json.data; Success(url); } else { CLShowMsg(json.msg); } }, { Position: Lor, toPath: toPath, Info: file.Info }, true, null, null, file, file.name, function (e) { CLShowProgress(Container || document.body); o.e = e; var info = Speed(o); CLShowProgress(Container || document.body, info, e.loaded / e.total, 0, 0, info); }); } CLDisk.Delete = function (Lor, Src) { var url = "/" + CLCorpId() + "/api/NetDisk.chx?Function=HttpDeleteFrom"; var index = Src.indexOf("/f/") if (index > 0) { Src = Src.substr(index + 3); index = Src.indexOf("?"); if (index > 0) { Src = Src.substr(0, index); Src = decodeURIComponent(Src); } HttpPost(url, function () { }, { Position: Lor, fromPath: Src }); } } }()); ;(function (e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.dd = t() : e.dd = t() })(this, function () { return function (e) { function t(r) { if (n[r]) return n[r].exports; var o = n[r] = { i: r, l: !1, exports: {} }; return e[r].call(o.exports, o, o.exports, t), o.l = !0, o.exports } var n = {}; return t.m = e, t.c = n, t.i = function (e) { return e }, t.d = function (e, n, r) { t.o(e, n) || Object.defineProperty(e, n, { configurable: !1, enumerable: !0, get: r }) }, t.n = function (e) { var n = e && e.__esModule ? function () { return e.default } : function () { return e }; return t.d(n, "a", n), n }, t.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, t.p = "", t(t.s = 570) }([ function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(2), o = n(160), i = n(2); t.ENV_ENUM = i.ENV_ENUM; var a = n(3); n(166), t.ddSdk = new a.Sdk(r.getENV(), o.log) }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), t.addWatchParamsDeal = function (e) { var t = Object.assign({}, e); return t.watch = !0, t }, t.addDefaultCorpIdParamsDeal = function (e) { var t = Object.assign({}, e); return t.corpId = "corpId", t }, t.genDefaultParamsDealFn = function (e) { var t = Object.assign({}, e); return function (e) { return Object.assign(t, e) } }, t.forceChangeParamsDealFn = function (e) { var t = Object.assign({}, e); return function (e) { return Object.assign(e, t) } }, t.genBoolResultDealFn = function (e) { return function (t) { var n = Object.assign({}, t); return e.forEach(function (e) { void 0 !== n[e] && (n[e] = !!n[e]) }), n } }, t.genBizStoreParamsDealFn = function (e) { var t = Object.assign({}, e); return "string" != typeof t.params ? (t.params = JSON.stringify(t), t) : t } }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(3), o = n(3); t.ENV_ENUM = o.ENV_ENUM, t.APP_TYPE = o.APP_TYPE; var i = n(163); t.getUA = function () { var e = ""; try { "undefined" != typeof navigator && (e = navigator && (navigator.userAgent || navigator.swuserAgent) || "") } catch (t) { e = "" } return e }, t.getENV = function () { var e = t.getUA(), n = /DingTalk/i.test(e) || i.default.isDingTalk, o = /iPhone|iPad|iPod|iOS/i.test(e) && n || i.default.isWeexiOS, a = /Android/i.test(e) && n || i.default.isWeexAndroid, s = /Nebula/i.test(e) && n || "object" == typeof dd && "function" == typeof dd.dtBridge, d = /dd-web/i.test(e), u = r.APP_TYPE.WEB; d ? u = r.APP_TYPE.WEBVIEW_IN_MINIAPP : s ? u = r.APP_TYPE.MINI_APP : (i.default.isWeexiOS || i.default.isWeexAndroid) && (u = r.APP_TYPE.WEEX); var c, l = "*", f = e.match(/AliApp\(\w+\/([a-zA-Z0-9.-]+)\)/); null === f && (f = e.match(/DingTalk\/([a-zA-Z0-9.-]+)/)); var v; f && f[1] && (v = f[1]); var p = ""; if ("undefined" != typeof name && (p = name), p) try { var _ = JSON.parse(p); _.hostVersion && (v = _.hostVersion), l = _.language || navigator.language || "*", c = _.containerId } catch (e) { } var E, N = !!c; return E = o ? r.ENV_ENUM.ios : a ? r.ENV_ENUM.android : N ? r.ENV_ENUM.pc : r.ENV_ENUM.notInDingTalk, { platform: E, version: v, appType: u, language: l } } }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(169); t.APP_TYPE = r.APP_TYPE, t.LogLevel = r.LogLevel, t.isFunction = r.isFunction, t.compareVersion = r.compareVersion, t.ENV_ENUM = r.ENV_ENUM; var o = function () { function e(e, t) { var n = this; this.configJsApiList = [], this.hadConfig = !1, this.p = {}, this.config$ = new Promise(function (e, t) { n.p.reject = t, n.p.resolve = e }), this.logQueue = [], this.devConfig = { debug: !1 }, this.platformConfigMap = {}, this.invokeAPIConfigMapByMethod = {}, this.isBridgeDrity = !0, this.getExportSdk = function () { return n.exportSdk }, this.setAPI = function (e, t) { n.invokeAPIConfigMapByMethod[e] = t }, this.setPlatform = function (e) { n.isBridgeDrity = !0, n.platformConfigMap[e.platform] = e, e.platform === n.env.platform && e.bridgeInit().catch(function (e) { n.customLog(r.LogLevel.WARNING, ["auto bridgeInit error", e || ""]) }) }, this.getPlatformConfigMap = function () { return n.platformConfigMap }, this.deleteApiConfig = function (e, t) { var r = n.invokeAPIConfigMapByMethod[e]; r && delete r[t] }, this.invokeAPI = function (e, t, o) { void 0 === t && (t = {}), void 0 === o && (o = !0), n.customLog(r.LogLevel.INFO, ['==> "' + e + '" params: ', t]); var i = +new Date, a = i + "_" + Math.floor(1e3 * Math.random()); return n.devConfig.onBeforeInvokeAPI && n.devConfig.onBeforeInvokeAPI({ invokeId: a, method: e, params: t, startTime: i }), !1 === n.devConfig.isAuthApi && (o = !1), n.bridgeInitFn().then(function (s) { var d = n.invokeAPIConfigMapByMethod[e], u = !0 === n.devConfig.isDisableDeal || n.devConfig.disbaleDealApiWhiteList && -1 !== n.devConfig.disbaleDealApiWhiteList.indexOf(e); if (d || !o) { var c; if (d && (c = d[n.env.platform]), c || !o) { var l = {}; l = !u && c && c.paramsDeal && r.isFunction(c.paramsDeal) ? c.paramsDeal(t) : Object.assign({}, t); var f = function (e) { return !u && c && c.resultDeal && r.isFunction(c.resultDeal) ? c.resultDeal(e) : e }; if (r.isFunction(l.onSuccess)) { var v = l.onSuccess; l.onSuccess = function (e) { v(f(e)) } } return s(e, l).then(f, function (t) { var i = n.hadConfig && void 0 === n.isReady && -1 !== n.configJsApiList.indexOf(e), a = "object" == typeof t && "string" == typeof t.errorCode && t.errorCode === r.ERROR_CODE.no_permission, d = "object" == typeof t && "string" == typeof t.errorCode && t.errorCode === r.ERROR_CODE.cancel, u = c && c.vs && n.env.version && r.compareVersion(n.env.version, c.vs), v = (n.env.platform === r.ENV_ENUM.ios || n.env.platform === r.ENV_ENUM.android) && i && a, p = n.env.platform === r.ENV_ENUM.pc && i && (u && !d && o || a); return v || p ? n.config$.then(function () { return s(e, l).then(f) }) : Promise.reject(t) }).then(function (o) { return n.devConfig.onAfterInvokeAPI && n.devConfig.onAfterInvokeAPI({ invokeId: a, method: e, params: t, payload: o, isSuccess: !0, startTime: i, duration: +new Date - i }), n.customLog(r.LogLevel.INFO, ['<== "' + e + '" success result: ', o]), o }, function (o) { return n.devConfig.onAfterInvokeAPI && n.devConfig.onAfterInvokeAPI({ invokeId: a, method: e, params: t, payload: o, startTime: i, duration: +new Date - i, isSuccess: !1 }), n.customLog(r.LogLevel.WARNING, ['<== "' + e + '" fail result: ', o]), Promise.reject(o) }) } var p = '"' + e + '" do not support the current platform (' + n.env.platform + ")"; return n.customLog(r.LogLevel.ERROR, [p]), Promise.reject({ errorCode: r.ERROR_CODE.jsapi_internal_error, errorMessage: p }) } var p = "This API method is not configured for the platform (" + n.env.platform + ")"; return n.customLog(r.LogLevel.ERROR, [p]), Promise.reject({ errorCode: r.ERROR_CODE.jsapi_internal_error, errorMessage: p }) }) }, this.customLog = function (e, t) { var r = { level: e, text: t, time: new Date }; !0 === n.devConfig.debug ? n.customLogInstance(r) : n.logQueue.push(r) }, this.clearLogQueue = function () { n.logQueue.forEach(function (e) { n.customLogInstance(e) }), n.logQueue = [] }, this.customLogInstance = t, this.env = e, this.bridgeInitFn = function () { if (n.bridgeInitFnPromise && !n.isBridgeDrity) return n.bridgeInitFnPromise; n.isBridgeDrity = !1; var t = n.platformConfigMap[e.platform]; if (t) n.bridgeInitFnPromise = t.bridgeInit().catch(function (e) { return n.customLog(r.LogLevel.ERROR, ["\b\b\b\b\bJsBridge initialization fails, jsapi will not work"]), Promise.reject(e) }); else { var o = "Do not support the current environment:" + e.platform; n.customLog(r.LogLevel.WARNING, [o]), n.bridgeInitFnPromise = Promise.reject(new Error(o)) } return n.bridgeInitFnPromise }; var o = function (e) { void 0 === e && (e = {}), n.devConfig = Object.assign(n.devConfig, e), !0 === e.debug && n.clearLogQueue(), e.extraPlatform && n.setPlatform(e.extraPlatform) }; this.exportSdk = { config: function (t) { void 0 === t && (t = {}); var i = !0; Object.keys(t).forEach(function (e) { -1 === ["debug", "usePromise"].indexOf(e) && (i = !1) }), i ? (n.customLog(r.LogLevel.WARNING, ["This is a deprecated feature, recommend use dd.devConfig"]), o(t)) : n.hadConfig ? n.customLog(r.LogLevel.WARNING, ["Config has been executed"]) : (t.jsApiList && (n.configJsApiList = t.jsApiList), n.hadConfig = !0, n.bridgeInitFn().then(function (r) { var o = n.platformConfigMap[e.platform], i = t; o.authParamsDeal && (i = o.authParamsDeal(i)), r(o.authMethod, i).then(function (e) { n.isReady = !0, n.p.resolve(e) }).catch(function (e) { n.isReady = !1, n.p.reject(e) }) }, function () { n.customLog(r.LogLevel.ERROR, ['\b\b\b\b\bJsBridge initialization failed and "dd.config" failed to call']) })) }, devConfig: o, ready: function (e) { !1 === n.hadConfig ? (n.customLog(r.LogLevel.WARNING, ["You don 't use a dd.config, so you don't need to wrap dd.ready, recommend remove dd.ready"]), n.bridgeInitFn().then(function () { e() })) : n.config$.then(function (t) { e() }) }, error: function (e) { n.config$.catch(function (t) { e(t) }) }, on: function (t, r) { n.bridgeInitFn().then(function () { n.platformConfigMap[e.platform].event.on(t, r) }) }, off: function (t, r) { n.bridgeInitFn().then(function () { n.platformConfigMap[e.platform].event.off(t, r) }) }, env: e, checkJsApi: function (t) { void 0 === t && (t = {}); var o = {}; return t.jsApiList && t.jsApiList.forEach(function (t) { var i = n.invokeAPIConfigMapByMethod[t]; if (i) { var a = i[e.platform]; a && a.vs && e.version && r.compareVersion(e.version, a.vs) && (o[t] = !0) } o[t] || (o[t] = !1) }), Promise.resolve(o) }, _invoke: function (e, t) { return void 0 === t && (t = {}), n.invokeAPI(e, t, !1) } } } return e }(); t.Sdk = o }, function (e, t, n) { (function (t, n) { e.exports = n() })(0, function () { return function (e) { function t(r) { if (n[r]) return n[r].exports; var o = n[r] = { i: r, l: !1, exports: {} }; return e[r].call(o.exports, o, o.exports, t), o.l = !0, o.exports } var n = {}; return t.m = e, t.c = n, t.i = function (e) { return e }, t.d = function (e, n, r) { t.o(e, n) || Object.defineProperty(e, n, { configurable: !1, enumerable: !0, get: r }) }, t.n = function (e) { var n = e && e.__esModule ? function () { return e.default } : function () { return e }; return t.d(n, "a", n), n }, t.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, t.p = "", t(t.s = 579) }({ 179: function (e, t, n) { "use strict"; var r = n(181); e.exports = r }, 181: function (e, t, n) { "use strict"; var r = n(183), o = n(184), i = n(182), a = n(185), s = new i, d = !1, u = "", c = null, l = {}, f = /{.*}/; try { var v = window.name.match(f); if (v && v[0]) var l = JSON.parse(v[0]) } catch (e) { l = {} } l.hostOrigin && ".dingtalk.com" === l.hostOrigin.split(":")[1].slice(0 - ".dingtalk.com".length) && l.containerId && (d = !0, u = l.hostOrigin, c = l.containerId); var p = {}, _ = new Promise(function (e, t) { p._resolve = e, p._reject = t }), E = {}, N = null; window.top !== window && (N = window.top, p._resolve()), E[a.SYS_INIT] = function (e) { N = e.frameWindow, p._resolve(), e.respond({}) }, window.addEventListener("message", function (e) { var t = e.data, n = e.origin; if (n === u) if ("response" === t.type && t.msgId) { var r = t.msgId, i = s.getMsyById(r); i && i.receiveResponse(t.body, !t.success) } else if ("event" === t.type && t.msgId) { var r = t.msgId, i = s.getMsyById(r); i && i.receiveEvent(t.eventName, t.body) } else if ("request" === t.type && t.msgId) { var i = new o(e.source, n, t); E[i.methodName] && E[i.methodName](i) } }), t.invokeAPI = function (e, t) { var n = new r(c, e, t); return d && _.then(function () { N && N.postMessage(n.getPayload(), u), s.addPending(n) }), n }; var P = null; t.addEventListener = function (e, n) { P || (P = t.invokeAPI(a.SYS_EVENT, {})), P.addEventListener(e, n) }, t.removeEventListener = function (e, t) { P && P.removeEventListener(e, t) } }, 182: function (e, t, n) { "use strict"; var r = function () { this.pendingMsgs = {} }; r.prototype.addPending = function (e) { this.pendingMsgs[e.id] = e; var t = function () { delete this.pendingMsgs[e.id], e.removeEventListener("_finish", t) }.bind(this); e.addEventListener("_finish", t) }, r.prototype.getMsyById = function (e) { return this.pendingMsgs[e] }, e.exports = r }, 183: function (e, t, n) { "use strict"; var r = n(574), o = n(573), i = 0, a = Math.floor(1e3 * Math.random()), s = function () { return 1e3 * (1e3 * a + Math.floor(1e3 * Math.random())) + ++i % 1e3 }, d = { code: 408, reason: "timeout" }, u = { TIMEOUT: "_timeout", FINISH: "_finish" }, c = { timeout: -1 }, l = function (e, t, n, r) { this.id = s(), this.methodName = t, this.containerId = e, this.option = o({}, c, r); var n = n || {}; this._p = {}, this.result = new Promise(function (e, t) { this._p._resolve = e, this._p._reject = t }.bind(this)), this.callbacks = {}, this.plainMsg = this._handleMsg(n), this._eventsHandle = {}, this._timeoutTimer = null, this._initTimeout(), this.isFinish = !1 }; l.prototype._initTimeout = function () { this._clearTimeout(), this.option.timeout > 0 && (this._timeoutTimer = setTimeout(function () { this.receiveEvent(u.TIMEOUT), this.receiveResponse(d, !0) }.bind(this), this.option.timeout)) }, l.prototype._clearTimeout = function () { clearTimeout(this._timeoutTimer) }, l.prototype._handleMsg = function (e) { var t = {}; return Object.keys(e).forEach(function (n) { var o = e[n]; "function" == typeof o && "on" === n.slice(0, 2) ? this.callbacks[n] = o : t[n] = r(o) }.bind(this)), t }, l.prototype.getPayload = function () { return { msgId: this.id, containerId: this.containerId, methodName: this.methodName, body: this.plainMsg, type: "request" } }, l.prototype.receiveEvent = function (e, t) { if (this.isFinish && e !== u.FINISH) return !1; e !== u.FINISH && e !== u.TIMEOUT && this._initTimeout(), Array.isArray(this._eventsHandle[e]) && this._eventsHandle[e].forEach(function (e) { try { e(t) } catch (e) { console.error(t) } }); var n = "on" + e.charAt(0).toUpperCase() + e.slice(1); return this.callbacks[n] && this.callbacks[n](t), !0 }, l.prototype.addEventListener = function (e, t) { if (!e || "function" != typeof t) throw "eventName is null or handle is not a function, addEventListener fail"; Array.isArray(this._eventsHandle[e]) || (this._eventsHandle[e] = []), this._eventsHandle[e].push(t) }, l.prototype.removeEventListener = function (e, t) { if (!e || !t) throw "eventName is null or handle is null, invoke removeEventListener fail"; if (Array.isArray(this._eventsHandle[e])) { var n = this._eventsHandle[e].indexOf(t); -1 !== n && this._eventsHandle[e].splice(n, 1) } }, l.prototype.receiveResponse = function (e, t) { if (!0 === this.isFinish) return !1; this._clearTimeout(); var t = !!t; return t ? this._p._reject(e) : this._p._resolve(e), setTimeout(function () { this.receiveEvent(u.FINISH) }.bind(this), 0), this.isFinish = !0, !0 }, e.exports = l }, 184: function (e, t, n) { "use strict"; var r = function (e, t, n) { if (this._msgId = n.msgId, this.frameWindow = e, this.methodName = n.methodName, this.clientOrigin = t, this.containerId = n.containerId, this.params = n.body, !this._msgId) throw "msgId not exist"; if (!this.frameWindow) throw "frameWindow not exist"; if (!this.methodName) throw "methodName not exits"; if (!this.clientOrigin) throw "clientOrigin not exist"; this.hasResponded = !1 }; r.prototype.respond = function (e, t) { var t = !!t; if (!0 !== this.hasResponded) { var n = { type: "response", success: !t, body: e, msgId: this._msgId }; this.frameWindow.postMessage(n, this.clientOrigin), this.hasResponded = !0 } }, r.prototype.emit = function (e, t) { var n = { type: "event", eventName: e, body: t, msgId: this._msgId }; this.frameWindow.postMessage(n, this.clientOrigin) }, e.exports = r }, 185: function (e, t, n) { "use strict"; e.exports = { SYS_EVENT: "SYS_openAPIContainerInitEvent", SYS_INIT: "SYS_openAPIContainerInit" } }, 4: function (e, t) { var n; n = function () { return this }(); try { n = n || Function("return this")() || (0, eval)("this") } catch (e) { "object" == typeof window && (n = window) } e.exports = n }, 572: function (e, t, n) { (function (e, n) { function r(e, t) { return e.set(t[0], t[1]), e } function o(e, t) { return e.add(t), e } function i(e, t) { for (var n = -1, r = e.length; ++n < r && !1 !== t(e[n], n, e) ;); return e } function a(e, t) { for (var n = -1, r = t.length, o = e.length; ++n < r;) e[o + n] = t[n]; return e } function s(e, t, n, r) { var o = -1, i = e.length; for (r && i && (n = e[++o]) ; ++o < i;) n = t(n, e[o], o, e); return n } function d(e, t) { for (var n = -1, r = Array(e) ; ++n < e;) r[n] = t(n); return r } function u(e) { return e && e.Object === Object ? e : null } function c(e) { var t = !1; if (null != e && "function" != typeof e.toString) try { t = !!(e + "") } catch (e) { } return t } function l(e) { var t = -1, n = Array(e.size); return e.forEach(function (e, r) { n[++t] = [r, e] }), n } function f(e) { var t = -1, n = Array(e.size); return e.forEach(function (e) { n[++t] = e }), n } function v(e) { var t = -1, n = e ? e.length : 0; for (this.clear() ; ++t < n;) { var r = e[t]; this.set(r[0], r[1]) } } function p() { this.__data__ = wt ? wt(null) : {} } function _(e) { return this.has(e) && delete this.__data__[e] } function E(e) { var t = this.__data__; if (wt) { var n = t[e]; return n === Se ? void 0 : n } return Et.call(t, e) ? t[e] : void 0 } function N(e) { var t = this.__data__; return wt ? void 0 !== t[e] : Et.call(t, e) } function P(e, t) { return this.__data__[e] = wt && void 0 === t ? Se : t, this } function h(e) { var t = -1, n = e ? e.length : 0; for (this.clear() ; ++t < n;) { var r = e[t]; this.set(r[0], r[1]) } } function m() { this.__data__ = [] } function M(e) { var t = this.__data__, n = x(t, e); return !(n < 0 || (n == t.length - 1 ? t.pop() : bt.call(t, n, 1), 0)) } function y(e) { var t = this.__data__, n = x(t, e); return n < 0 ? void 0 : t[n][1] } function k(e) { return x(this.__data__, e) > -1 } function g(e, t) { var n = this.__data__, r = x(n, e); return r < 0 ? n.push([e, t]) : n[r][1] = t, this } function b(e) { var t = -1, n = e ? e.length : 0; for (this.clear() ; ++t < n;) { var r = e[t]; this.set(r[0], r[1]) } } function I() { this.__data__ = { hash: new v, map: new (Vt || h), string: new v } } function A(e) { return re(this, e).delete(e) } function S(e) { return re(this, e).get(e) } function V(e) { return re(this, e).has(e) } function U(e, t) { return re(this, e).set(e, t), this } function O(e) { this.__data__ = new h(e) } function j() { this.__data__ = new h } function w(e) { return this.__data__.delete(e) } function $(e) { return this.__data__.get(e) } function D(e) { return this.__data__.has(e) } function C(e, t) { var n = this.__data__; return n instanceof h && n.__data__.length == Ae && (n = this.__data__ = new b(n.__data__)), n.set(e, t), this } function T(e, t, n) { var r = e[t]; Et.call(e, t) && Ee(r, n) && (void 0 !== n || t in e) || (e[t] = n) } function x(e, t) { for (var n = e.length; n--;) if (Ee(e[n][0], t)) return n; return -1 } function F(e, t) { return e && ee(t, Ie(t), e) } function W(e, t, n, r, o, a, s) { var d; if (r && (d = a ? r(e, o, a, s) : r(e)), void 0 !== d) return d; if (!ye(e)) return e; var u = Lt(e); if (u) { if (d = de(e), !t) return Z(e, d) } else { var l = se(e), f = l == we || l == $e; if (Bt(e)) return q(e, t); if (l == Te || l == Ue || f && !a) { if (c(e)) return a ? e : {}; if (d = ue(f ? {} : e), !t) return te(e, F(d, e)) } else { if (!rt[l]) return a ? e : {}; d = ce(e, l, W, t) } } s || (s = new O); var v = s.get(e); if (v) return v; if (s.set(e, d), !u) var p = n ? ne(e) : Ie(e); return i(p || e, function (o, i) { p && (i = o, o = e[i]), T(d, i, W(o, t, n, r, i, e, s)) }), d } function R(e) { return ye(e) ? kt(e) : {} } function L(e, t, n) { var r = t(e); return Lt(e) ? r : a(r, n(e)) } function B(e, t) { return Et.call(e, t) || "object" == typeof e && t in e && null === ie(e) } function z(e) { return At(Object(e)) } function q(e, t) { if (t) return e.slice(); var n = new e.constructor(e.length); return e.copy(n), n } function Y(e) { var t = new e.constructor(e.byteLength); return new Mt(t).set(new Mt(e)), t } function J(e, t) { var n = t ? Y(e.buffer) : e.buffer; return new e.constructor(n, e.byteOffset, e.byteLength) } function G(e, t, n) { return s(t ? n(l(e), !0) : l(e), r, new e.constructor) } function H(e) { var t = new e.constructor(e.source, et.exec(e)); return t.lastIndex = e.lastIndex, t } function K(e, t, n) { return s(t ? n(f(e), !0) : f(e), o, new e.constructor) } function X(e) { return Wt ? Object(Wt.call(e)) : {} } function Q(e, t) { var n = t ? Y(e.buffer) : e.buffer; return new e.constructor(n, e.byteOffset, e.length) } function Z(e, t) { var n = -1, r = e.length; for (t || (t = Array(r)) ; ++n < r;) t[n] = e[n]; return t } function ee(e, t, n, r) { n || (n = {}); for (var o = -1, i = t.length; ++o < i;) { var a = t[o]; T(n, a, r ? r(n[a], e[a], a, n, e) : e[a]) } return n } function te(e, t) { return ee(e, ae(e), t) } function ne(e) { return L(e, Ie, ae) } function re(e, t) { var n = e.__data__; return ve(t) ? n["string" == typeof t ? "string" : "hash"] : n.map } function oe(e, t) { var n = e[t]; return ge(n) ? n : void 0 } function ie(e) { return It(Object(e)) } function ae(e) { return yt(Object(e)) } function se(e) { return Nt.call(e) } function de(e) { var t = e.length, n = e.constructor(t); return t && "string" == typeof e[0] && Et.call(e, "index") && (n.index = e.index, n.input = e.input), n } function ue(e) { return "function" != typeof e.constructor || pe(e) ? {} : R(ie(e)) } function ce(e, t, n, r) { var o = e.constructor; switch (t) { case Le: return Y(e); case Oe: case je: return new o(+e); case Be: return J(e, r); case ze: case qe: case Ye: case Je: case Ge: case He: case Ke: case Xe: case Qe: return Q(e, r); case De: return G(e, r, n); case Ce: case We: return new o(e); case xe: return H(e); case Fe: return K(e, r, n); case Re: return X(e) } } function le(e) { var t = e ? e.length : void 0; return Me(t) && (Lt(e) || be(e) || Ne(e)) ? d(t, String) : null } function fe(e, t) { return !!(t = null == t ? Ve : t) && ("number" == typeof e || nt.test(e)) && e > -1 && e % 1 == 0 && e < t } function ve(e) { var t = typeof e; return "string" == t || "number" == t || "symbol" == t || "boolean" == t ? "__proto__" !== e : null === e } function pe(e) { var t = e && e.constructor; return e === ("function" == typeof t && t.prototype || pt) } function _e(e) { if (null != e) { try { return _t.call(e) } catch (e) { } try { return e + "" } catch (e) { } } return "" } function Ee(e, t) { return e === t || e !== e && t !== t } function Ne(e) { return he(e) && Et.call(e, "callee") && (!gt.call(e, "callee") || Nt.call(e) == Ue) } function Pe(e) { return null != e && Me(Rt(e)) && !me(e) } function he(e) { return ke(e) && Pe(e) } function me(e) { var t = ye(e) ? Nt.call(e) : ""; return t == we || t == $e } function Me(e) { return "number" == typeof e && e > -1 && e % 1 == 0 && e <= Ve } function ye(e) { var t = typeof e; return !!e && ("object" == t || "function" == t) } function ke(e) { return !!e && "object" == typeof e } function ge(e) { return !!ye(e) && (me(e) || c(e) ? Pt : tt).test(_e(e)) } function be(e) { return "string" == typeof e || !Lt(e) && ke(e) && Nt.call(e) == We } function Ie(e) { var t = pe(e); if (!t && !Pe(e)) return z(e); var n = le(e), r = !!n, o = n || [], i = o.length; for (var a in e) !B(e, a) || r && ("length" == a || fe(a, i)) || t && "constructor" == a || o.push(a); return o } var Ae = 200, Se = "__lodash_hash_undefined__", Ve = 9007199254740991, Ue = "[object Arguments]", Oe = "[object Boolean]", je = "[object Date]", we = "[object Function]", $e = "[object GeneratorFunction]", De = "[object Map]", Ce = "[object Number]", Te = "[object Object]", xe = "[object RegExp]", Fe = "[object Set]", We = "[object String]", Re = "[object Symbol]", Le = "[object ArrayBuffer]", Be = "[object DataView]", ze = "[object Float32Array]", qe = "[object Float64Array]", Ye = "[object Int8Array]", Je = "[object Int16Array]", Ge = "[object Int32Array]", He = "[object Uint8Array]", Ke = "[object Uint8ClampedArray]", Xe = "[object Uint16Array]", Qe = "[object Uint32Array]", Ze = /[\\^$.*+?()[\]{}|]/g, et = /\w*$/, tt = /^\[object .+?Constructor\]$/, nt = /^(?:0|[1-9]\d*)$/, rt = {}; rt[Ue] = rt["[object Array]"] = rt[Le] = rt[Be] = rt[Oe] = rt[je] = rt[ze] = rt[qe] = rt[Ye] = rt[Je] = rt[Ge] = rt[De] = rt[Ce] = rt[Te] = rt[xe] = rt[Fe] = rt[We] = rt[Re] = rt[He] = rt[Ke] = rt[Xe] = rt[Qe] = !0, rt["[object Error]"] = rt[we] = rt["[object WeakMap]"] = !1; var ot = { function: !0, object: !0 }, it = ot[typeof t] && t && !t.nodeType ? t : void 0, at = ot[typeof e] && e && !e.nodeType ? e : void 0, st = at && at.exports === it ? it : void 0, dt = u(it && at && "object" == typeof n && n), ut = u(ot[typeof self] && self), ct = u(ot[typeof window] && window), lt = u(ot[typeof this] && this), ft = dt || ct !== (lt && lt.window) && ct || ut || lt || Function("return this")(), vt = Array.prototype, pt = Object.prototype, _t = Function.prototype.toString, Et = pt.hasOwnProperty, Nt = pt.toString, Pt = RegExp("^" + _t.call(Et).replace(Ze, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), ht = st ? ft.Buffer : void 0, mt = ft.Symbol, Mt = ft.Uint8Array, yt = Object.getOwnPropertySymbols, kt = Object.create, gt = pt.propertyIsEnumerable, bt = vt.splice, It = Object.getPrototypeOf, At = Object.keys, St = oe(ft, "DataView"), Vt = oe(ft, "Map"), Ut = oe(ft, "Promise"), Ot = oe(ft, "Set"), jt = oe(ft, "WeakMap"), wt = oe(Object, "create"), $t = _e(St), Dt = _e(Vt), Ct = _e(Ut), Tt = _e(Ot), xt = _e(jt), Ft = mt ? mt.prototype : void 0, Wt = Ft ? Ft.valueOf : void 0; v.prototype.clear = p, v.prototype.delete = _, v.prototype.get = E, v.prototype.has = N, v.prototype.set = P, h.prototype.clear = m, h.prototype.delete = M, h.prototype.get = y, h.prototype.has = k, h.prototype.set = g, b.prototype.clear = I, b.prototype.delete = A, b.prototype.get = S, b.prototype.has = V, b.prototype.set = U, O.prototype.clear = j, O.prototype.delete = w, O.prototype.get = $, O.prototype.has = D, O.prototype.set = C; var Rt = function (e) { return function (e) { return null == e ? void 0 : e.length } }(); yt || (ae = function () { return [] }), (St && se(new St(new ArrayBuffer(1))) != Be || Vt && se(new Vt) != De || Ut && "[object Promise]" != se(Ut.resolve()) || Ot && se(new Ot) != Fe || jt && "[object WeakMap]" != se(new jt)) && (se = function (e) { var t = Nt.call(e), n = t == Te ? e.constructor : void 0, r = n ? _e(n) : void 0; if (r) switch (r) { case $t: return Be; case Dt: return De; case Ct: return "[object Promise]"; case Tt: return Fe; case xt: return "[object WeakMap]" } return t }); var Lt = Array.isArray, Bt = ht ? function (e) { return e instanceof ht } : function (e) { return function () { return !1 } }(); e.exports = W }).call(t, n(577)(e), n(4)) }, 573: function (e, t, n) { function r(e, t, n) { var r = e[t]; m.call(e, t) && d(r, n) && (void 0 !== n || t in e) || (e[t] = n) } function o(e, t, n, o) { n || (n = {}); for (var i = -1, a = t.length; ++i < a;) { var s = t[i]; r(n, s, o ? o(n[s], e[s], s, n, e) : e[s]) } return n } function i(e, t) { return !!(t = null == t ? _ : t) && ("number" == typeof e || P.test(e)) && e > -1 && e % 1 == 0 && e < t } function a(e, t, n) { if (!f(n)) return !1; var r = typeof t; return !!("number" == r ? u(n) && i(t, n.length) : "string" == r && t in n) && d(n[t], e) } function s(e) { var t = e && e.constructor; return e === ("function" == typeof t && t.prototype || h) } function d(e, t) { return e === t || e !== e && t !== t } function u(e) { return null != e && l(g(e)) && !c(e) } function c(e) { var t = f(e) ? M.call(e) : ""; return t == E || t == N } function l(e) { return "number" == typeof e && e > -1 && e % 1 == 0 && e <= _ } function f(e) { var t = typeof e; return !!e && ("object" == t || "function" == t) } var v = n(575), p = n(576), _ = 9007199254740991, E = "[object Function]", N = "[object GeneratorFunction]", P = /^(?:0|[1-9]\d*)$/, h = Object.prototype, m = h.hasOwnProperty, M = h.toString, y = h.propertyIsEnumerable, k = !y.call({ valueOf: 1 }, "valueOf"), g = function (e) { return function (e) { return null == e ? void 0 : e.length } }(), b = function (e) { return p(function (t, n) { var r = -1, o = n.length, i = o > 1 ? n[o - 1] : void 0, s = o > 2 ? n[2] : void 0; for (i = e.length > 3 && "function" == typeof i ? (o--, i) : void 0, s && a(n[0], n[1], s) && (i = o < 3 ? void 0 : i, o = 1), t = Object(t) ; ++r < o;) { var d = n[r]; d && e(t, d) } return t }) }(function (e, t) { if (k || s(t) || u(t)) return void o(t, v(t), e); for (var n in t) m.call(t, n) && r(e, n, t[n]) }); e.exports = b }, 574: function (e, t, n) { function r(e) { return o(e, !0, !0) } var o = n(572); e.exports = r }, 575: function (e, t) { function n(e, t) { for (var n = -1, r = Array(e) ; ++n < e;) r[n] = t(n); return r } function r(e, t) { var r = b(e) || s(e) ? n(e.length, String) : [], o = r.length, a = !!o; for (var d in e) !t && !M.call(e, d) || a && ("length" == d || i(d, o)) || r.push(d); return r } function o(e) { if (!a(e)) return g(e); var t = []; for (var n in Object(e)) M.call(e, n) && "constructor" != n && t.push(n); return t } function i(e, t) { return !!(t = null == t ? _ : t) && ("number" == typeof e || h.test(e)) && e > -1 && e % 1 == 0 && e < t } function a(e) { var t = e && e.constructor; return e === ("function" == typeof t && t.prototype || m) } function s(e) { return u(e) && M.call(e, "callee") && (!k.call(e, "callee") || y.call(e) == E) } function d(e) { return null != e && l(e.length) && !c(e) } function u(e) { return v(e) && d(e) } function c(e) { var t = f(e) ? y.call(e) : ""; return t == N || t == P } function l(e) { return "number" == typeof e && e > -1 && e % 1 == 0 && e <= _ } function f(e) { var t = typeof e; return !!e && ("object" == t || "function" == t) } function v(e) { return !!e && "object" == typeof e } function p(e) { return d(e) ? r(e) : o(e) } var _ = 9007199254740991, E = "[object Arguments]", N = "[object Function]", P = "[object GeneratorFunction]", h = /^(?:0|[1-9]\d*)$/, m = Object.prototype, M = m.hasOwnProperty, y = m.toString, k = m.propertyIsEnumerable, g = function (e, t) { return function (n) { return e(t(n)) } }(Object.keys, Object), b = Array.isArray; e.exports = p }, 576: function (e, t) { function n(e, t, n) { switch (n.length) { case 0: return e.call(t); case 1: return e.call(t, n[0]); case 2: return e.call(t, n[0], n[1]); case 3: return e.call(t, n[0], n[1], n[2]) } return e.apply(t, n) } function r(e, t) { return t = k(void 0 === t ? e.length - 1 : t, 0), function () { for (var r = arguments, o = -1, i = k(r.length - t, 0), a = Array(i) ; ++o < i;) a[o] = r[t + o]; o = -1; for (var s = Array(t + 1) ; ++o < t;) s[o] = r[o]; return s[t] = a, n(e, this, s) } } function o(e, t) { if ("function" != typeof e) throw new TypeError(l); return t = void 0 === t ? t : u(t), r(e, t) } function i(e) { var t = typeof e; return !!e && ("object" == t || "function" == t) } function a(e) { return !!e && "object" == typeof e } function s(e) { return "symbol" == typeof e || a(e) && y.call(e) == _ } function d(e) { return e ? (e = c(e)) === f || e === -f ? (e < 0 ? -1 : 1) * v : e === e ? e : 0 : 0 === e ? e : 0 } function u(e) { var t = d(e), n = t % 1; return t === t ? n ? t - n : t : 0 } function c(e) { if ("number" == typeof e) return e; if (s(e)) return p; if (i(e)) { var t = "function" == typeof e.valueOf ? e.valueOf() : e; e = i(t) ? t + "" : t } if ("string" != typeof e) return 0 === e ? e : +e; e = e.replace(E, ""); var n = P.test(e); return n || h.test(e) ? m(e.slice(2), n ? 2 : 8) : N.test(e) ? p : +e } var l = "Expected a function", f = 1 / 0, v = 1.7976931348623157e308, p = NaN, _ = "[object Symbol]", E = /^\s+|\s+$/g, N = /^[-+]0x[0-9a-f]+$/i, P = /^0b[01]+$/i, h = /^0o[0-7]+$/i, m = parseInt, M = Object.prototype, y = M.toString, k = Math.max; e.exports = o }, 577: function (e, t) { e.exports = function (e) { return e.webpackPolyfill || (e.deprecate = function () { }, e.paths = [], e.children || (e.children = []), Object.defineProperty(e, "loaded", { enumerable: !0, get: function () { return e.l } }), Object.defineProperty(e, "id", { enumerable: !0, get: function () { return e.i } }), e.webpackPolyfill = 1), e } }, 579: function (e, t, n) { e.exports = n(179) } }) }) }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = function (e, t) { return new Promise(function (n, r) { dd.dtBridge({ m: e, args: t, onSuccess: function (e) { "function" == typeof t.onSuccess && t.onSuccess(e), n(e) }, onFail: function (e) { "function" == typeof t.onFail && t.onFail(e), r(e) } }) }) }; t.default = r }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); t.requireModule = function (e) { return "undefined" != typeof __weex_require__ ? __weex_require__("@weex-module/" + e) : "undefined" != typeof weex ? weex.requireModule(e) : void 0 }, t.iosWeexBridge = function () { return Promise.resolve(function (e, n) { return new Promise(function (r, o) { var i = t.requireModule("nuvajs-exec"), a = e.split("."), s = a.pop(), d = a.join("."); i.exec({ plugin: d, action: s, args: n }, function (e) { e && "0" === e.errorCode ? ("function" == typeof n.onSuccess && n.onSuccess(e.result), r(e.result)) : ("function" == typeof n.onFail && n.onFail(e.result), o(e.result)) }) }) }) }, t.androidWeexBridge = function () { return Promise.resolve(function (e, n) { return new Promise(function (r, o) { var i = t.requireModule("nuvajs-exec"), a = e.split("."), s = a.pop(), d = a.join("."); i.exec({ plugin: d, action: s, args: n }, function (e) { var t = {}; try { if (e && e.__message__) if ("object" == typeof e.__message__) t = e.__message__; else try { t = JSON.parse(e.__message__) } catch (n) { "string" == typeof e.__message__ && (t = e.__message__) } } catch (e) { } e && 1 === parseInt(e.__status__ + "", 10) ? ("function" == typeof n.onSuccess && n.onSuccess(t), r(t)) : ("function" == typeof n.onFail && n.onFail(t), o(t)) }) }) }) } }, function (e, t) { var n; n = function () { return this }(); try { n = n || Function("return this")() || (0, eval)("this") } catch (e) { "object" == typeof window && (n = window) } e.exports = n }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), t.on = function (e, t) { document.addEventListener(e, t) }, t.off = function (e, t) { document.removeEventListener(e, t) } }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = function () { }, o = function (e, t) { return new Promise(function (n, o) { var i = t.onSuccess || r, a = t.onFail || r; if (delete t.onSuccess, delete t.onFail, AlipayJSBridge) { var s = e.split("."), d = s.pop() || "", u = s.join("."); AlipayJSBridge.call.apply(null, ["webDdExec", { serviceName: u, actionName: d, args: t }, function (e) { var t = {}, r = e.content; if (r) try { t = JSON.parse(r) } catch (e) { console.error("parse dt api result error", r, e) } e.success ? (i.apply(null, [t]), n(t)) : (a.apply(null, [t]), o(t)) } ]) } else { var c = new Error("Fatal error, cannot find bridge ,current env is WebView in MiniApp"); a(c), o(c) } }) }; t.default = o }, function (e, t, n) { "use strict"; var r = this; Object.defineProperty(t, "__esModule", { value: !0 }); var o = n(6); t.on = function (e, t) { o.requireModule("globalEvent").addEventListener(e, function (e) { var n = { preventDefault: function () { throw new Error("does not support preventDefault") }, detail: e }; t.call(r, n) }) }, t.off = function (e, t) { o.requireModule("globalEvent").removeEventListener(e, t) } }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), t.RUNTIME = { WEB: "Web", WEEX: "Weex", UNKNOWN: "Unknown" }, t.PLATFORM = { MAC: "Mac", WINDOWS: "Windows", IOS: "iOS", ANDROID: "Android", IPAD: "iPad", BROWSER: "Browser", UNKNOWN: "Unknown" }, t.FRAMEWORK = { VUE: "Vue", RAX: "Rax", UNKNOWN: "Unknown" } }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.alipay.pay"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.pay$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.calendar.chooseDateTime"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o[i.ENV_ENUM.android] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o)), t.chooseDateTime$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.calendar.chooseHalfDay"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o[i.ENV_ENUM.android] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o)), t.chooseHalfDay$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.calendar.chooseInterval"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o[i.ENV_ENUM.android] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o)), t.chooseInterval$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.calendar.chooseOneDay"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o[i.ENV_ENUM.android] = { vs: "3.5.0", paramsDeal: a.addDefaultCorpIdParamsDeal }, o)), t.chooseOneDay$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.chat.chooseConversationByCorpId", d = a.genDefaultParamsDealFn({ max: 50 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.6.0", paramsDeal: d }, o)), t.chooseConversationByCorpId$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.chat.locationChatMessage"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.7.6" }, o[i.ENV_ENUM.android] = { vs: "2.7.6" }, o)), t.locationChatMessage$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.chat.openSingleChat"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.4.10" }, o[i.ENV_ENUM.android] = { vs: "3.4.10" }, o)), t.openSingleChat$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.chat.pickConversation"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.2" }, o[i.ENV_ENUM.android] = { vs: "2.4.2" }, o)), t.pickConversation$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.chat.sendEmotion"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.6.12" }, o[i.ENV_ENUM.android] = { vs: "4.6.12" }, o)), t.sendEmotion$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.chat.toConversation"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.toConversation$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.clipboardData.setData"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.7.0" }, o[i.ENV_ENUM.android] = { vs: "2.7.0" }, o[i.ENV_ENUM.pc] = { vs: "4.6.1" }, o)), t.setData$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.contact.choose", d = a.genDefaultParamsDealFn({ multiple: !0, startWithDepartmentId: 0, users: [] }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.choose$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.contact.chooseMobileContacts"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.1" }, o[i.ENV_ENUM.android] = { vs: "3.1" }, o)), t.chooseMobileContacts$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.contact.complexPicker"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.9.0" }, o[i.ENV_ENUM.android] = { vs: "2.9.0" }, o[i.ENV_ENUM.pc] = { vs: "4.3.5" }, o)), t.complexPicker$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.contact.createGroup"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o[i.ENV_ENUM.pc] = { vs: "4.6.1" }, o)), t.createGroup$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.contact.departmentsPicker"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "4.2.5" }, o[i.ENV_ENUM.ios] = { vs: "3.0" }, o[i.ENV_ENUM.android] = { vs: "3.0" }, o)), t.departmentsPicker$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.contact.externalComplexPicker"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "3.0" }, o[i.ENV_ENUM.android] = { vs: "3.0" }, o)), t.externalComplexPicker$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.contact.externalEditForm"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.0" }, o[i.ENV_ENUM.android] = { vs: "3.0" }, o)), t.externalEditForm$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.contact.setRule"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.15" }, o[i.ENV_ENUM.android] = { vs: "2.15" }, o)), t.setRule$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.cspace.chooseSpaceDir"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.6" }, o[i.ENV_ENUM.android] = { vs: "3.5.6" }, o)), t.chooseSpaceDir$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.cspace.delete"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.5.21" }, o[i.ENV_ENUM.android] = { vs: "4.5.21" }, o[i.ENV_ENUM.pc] = { vs: "4.5.21" }, o)), t.delete$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.cspace.preview"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.7.0" }, o[i.ENV_ENUM.android] = { vs: "2.7.0" }, o)), t.preview$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.cspace.saveFile"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.7.6" }, o[i.ENV_ENUM.android] = { vs: "2.7.6" }, o)), t.saveFile$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.customContact.choose", d = a.genDefaultParamsDealFn({ isShowCompanyName: !1, max: 50 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.5.2", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.5.2", paramsDeal: d }, o)), t.choose$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.customContact.multipleChoose", d = a.genDefaultParamsDealFn({ isShowCompanyName: !1, max: 50 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.multipleChoose$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.ding.create"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.1", resultDeal: function (e) { return "" === e ? e = { dingCreateResult: !1 } : "object" == typeof e && (e.dingCreateResult = !!e.dingCreateResult), e } }, o[i.ENV_ENUM.android] = { vs: "3.5.1" }, o[i.ENV_ENUM.pc] = { vs: "4.5.9" }, o)), t.create$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.ding.post"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.post$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.event.notifyWeex"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.5.0" }, o)), t.notifyWeex$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.intent.fetchData"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.7.6" }, o[i.ENV_ENUM.android] = { vs: "2.7.6" }, o)), t.fetchData$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.map.locate"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.locate$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.map.search", d = a.genDefaultParamsDealFn({ scope: 500 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.search$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.map.view"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.view$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.microApp.openApp"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.5.6" }, o[i.ENV_ENUM.android] = { vs: "4.5.6" }, o)), t.openApp$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.navigation.close"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o[i.ENV_ENUM.pc] = { vs: "4.3.5" }, o)), t.close$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.navigation.goBack"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.goBack$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.navigation.hideBar"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.6" }, o[i.ENV_ENUM.android] = { vs: "3.5.6" }, o)), t.hideBar$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.navigation.quit"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o)), t.quit$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.navigation.replace"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.4.6" }, o[i.ENV_ENUM.android] = { vs: "3.4.6" }, o)), t.replace$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.navigation.setIcon", d = a.genDefaultParamsDealFn({ watch: !0, showIcon: !0, iconIndex: 1 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.setIcon$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.navigation.setLeft", d = a.genDefaultParamsDealFn({ watch: !0, show: !0, control: !1, showIcon: !0, text: "" }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.setLeft$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.navigation.setMenu"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0", paramsDeal: a.addWatchParamsDeal }, o[i.ENV_ENUM.android] = { vs: "2.6.0", paramsDeal: a.addWatchParamsDeal }, o)), t.setMenu$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.navigation.setRight", d = a.genDefaultParamsDealFn({ watch: !0, show: !0, control: !1, showIcon: !0, text: "" }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.setRight$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.navigation.setTitle"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.setTitle$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.store.closeUnpayOrder"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.android] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.pc] = { vs: "4.5.3", paramsDeal: a.genBizStoreParamsDealFn }, o)), t.closeUnpayOrder$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.store.createOrder"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.android] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.pc] = { vs: "4.5.3", paramsDeal: a.genBizStoreParamsDealFn }, o)), t.createOrder$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.store.getPayUrl"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.android] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.pc] = { vs: "4.5.3", paramsDeal: a.genBizStoreParamsDealFn }, o)), t.getPayUrl$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.store.inquiry"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.android] = { vs: "4.3.7", paramsDeal: a.genBizStoreParamsDealFn }, o[i.ENV_ENUM.pc] = { vs: "4.5.3", paramsDeal: a.genBizStoreParamsDealFn }, o)), t.inquiry$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.telephone.call"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.call$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.telephone.checkBizCall"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "4.0.0" }, o[i.ENV_ENUM.ios] = { vs: "3.5.6" }, o[i.ENV_ENUM.android] = { vs: "3.5.6" }, o)), t.checkBizCall$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.telephone.quickCallList"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.5.6" }, o[i.ENV_ENUM.ios] = { vs: "3.5.6" }, o[i.ENV_ENUM.android] = { vs: "3.5.6" }, o)), t.quickCallList$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.telephone.showCallMenu"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.showCallMenu$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.user.checkPassword"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.5.8" }, o[i.ENV_ENUM.android] = { vs: "4.5.8" }, o)), t.checkPassword$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.user.get"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.get$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.chosen"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.chosen$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.datepicker"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.datepicker$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.datetimepicker"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.datetimepicker$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.decrypt"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.9.1" }, o[i.ENV_ENUM.android] = { vs: "2.9.1" }, o)), t.decrypt$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.downloadFile"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o)), t.downloadFile$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.encrypt"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.9.1" }, o[i.ENV_ENUM.android] = { vs: "2.9.1" }, o)), t.encrypt$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.isLocalFileExist"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o)), t.isLocalFileExist$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.multiSelect"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.0.0" }, o[i.ENV_ENUM.android] = { vs: "3.0.0" }, o)), t.multiSelect$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.open"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.7.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.open$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.util.openLink", d = a.genDefaultParamsDealFn({ credible: !0, showMenuBar: !0 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.7.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.openLink$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.openLocalFile"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o)), t.openLocalFile$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.openModal"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o)), t.openModal$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.openSlidePanel"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o)), t.openSlidePanel$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.presentWindow"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.presentWindow$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.previewImage"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.7.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.previewImage$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.previewVideo"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.3.7" }, o[i.ENV_ENUM.android] = { vs: "4.3.7" }, o)), t.previewVideo$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.util.scan", d = a.genDefaultParamsDealFn({ type: "qrCode" }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.scan$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.scanCard"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.scanCard$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.setScreenBrightnessAndKeepOn"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.3.3" }, o[i.ENV_ENUM.android] = { vs: "4.3.3" }, o)), t.setScreenBrightnessAndKeepOn$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.util.share", d = a.genDefaultParamsDealFn({ title: "", buttonName: "确定" }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.share$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.systemShare"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.5.11" }, o[i.ENV_ENUM.android] = { vs: "4.5.11" }, o)), t.systemShare$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.timepicker"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.timepicker$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.uploadAttachment"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.7.0" }, o[i.ENV_ENUM.android] = { vs: "2.7.0" }, o)), t.uploadAttachment$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "biz.util.uploadImage", d = a.genDefaultParamsDealFn({ multiple: !1 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.uploadImage$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.uploadImageFromCamera"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.uploadImageFromCamera$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.util.ut", s = function (e) { var t = Object.assign({}, e), n = t.value, r = []; if (n && "object" == typeof n) { for (var o in n) n[o] && r.push(o + "=" + n[o]); n = r.join(",") } return t.value = n || "", t }; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.5.0", paramsDeal: s }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: function (e) { var t = Object.assign({}, e), n = t.value; return n && "object" == typeof n && (n = JSON.stringify(n)), t.value = n, t } }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: s }, o)), t.ut$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.verify.openBindIDCard"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.5.21" }, o[i.ENV_ENUM.android] = { vs: "4.5.21" }, o)), t.openBindIDCard$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "biz.verify.startAuth"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.5.21" }, o[i.ENV_ENUM.android] = { vs: "4.5.21" }, o)), t.startAuth$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "channel.permission.requestAuthCode"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.0.0" }, o[i.ENV_ENUM.android] = { vs: "3.0.0" }, o)), t.requestAuthCode$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.accelerometer.clearShake"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.clearShake$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "device.accelerometer.watchShake"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: function (e) { return a.forceChangeParamsDealFn({ sensitivity: 3.2 })(a.addWatchParamsDeal(e)) } }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: a.addWatchParamsDeal }, o)), t.watchShake$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.download"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.download$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.onPlayEnd"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.onPlayEnd$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.onRecordEnd"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.onRecordEnd$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.pause"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.pause$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.play"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.play$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.resume"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.resume$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.startRecord"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.startRecord$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.stop"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.stop$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.stopRecord"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.stopRecord$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.audio.translateVoice"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.8.0" }, o[i.ENV_ENUM.android] = { vs: "2.8.0" }, o)), t.translateVoice$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.base.getInterface"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.getInterface$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.base.getPhoneInfo"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.5.0" }, o[i.ENV_ENUM.android] = { vs: "3.5.0" }, o)), t.getPhoneInfo$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.base.getUUID"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.getUUID$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.base.getWifiStatus"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.11.0" }, o[i.ENV_ENUM.android] = { vs: "2.11.0" }, o)), t.getWifiStatus$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.connection.getNetworkType"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.getNetworkType$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.geolocation.get"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.get$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.geolocation.start"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.4.7" }, o[i.ENV_ENUM.android] = { vs: "3.4.7" }, o)), t.start$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.geolocation.status"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.4.8" }, o[i.ENV_ENUM.android] = { vs: "3.4.8" }, o)), t.status$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.geolocation.stop"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "3.4.7" }, o[i.ENV_ENUM.android] = { vs: "3.4.7" }, o)), t.stop$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.launcher.checkInstalledApps"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.checkInstalledApps$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.launcher.launchApp"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.launchApp$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.nfc.nfcRead"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.11.0" }, o[i.ENV_ENUM.android] = { vs: "2.11.0" }, o)), t.nfcRead$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.nfc.nfcStop"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.3.9" }, o[i.ENV_ENUM.android] = { vs: "4.3.9" }, o)), t.nfcStop$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.nfc.nfcWrite"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.11.0" }, o[i.ENV_ENUM.android] = { vs: "2.11.0" }, o)), t.nfcWrite$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.notification.actionSheet"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.actionSheet$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "device.notification.alert", d = a.genDefaultParamsDealFn({ title: "", buttonName: "确定" }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.alert$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "device.notification.confirm", d = a.genDefaultParamsDealFn({ title: "", buttonLabels: ["确定", "取消"] }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.confirm$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.notification.extendModal"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.5.0" }, o[i.ENV_ENUM.android] = { vs: "2.5.0" }, o)), t.extendModal$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.notification.hidePreloader"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.hidePreloader$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.notification.modal"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "4.2.5" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.modal$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "device.notification.prompt", d = a.genDefaultParamsDealFn({ title: "", buttonLabels: ["确定", "取消"] }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.7.0" }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.prompt$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "device.notification.showPreloader", d = a.genDefaultParamsDealFn({ text: "加载中...", showIcon: !0 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.showPreloader$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "device.notification.toast", d = a.genDefaultParamsDealFn({ text: "toast", duration: 3, delay: 0 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.pc] = { vs: "2.5.0", paramsDeal: function (e) { return e.icon && !e.type && ("success" === e.icon ? e.type = "success" : "error" === e.icon && (e.type = "error")), e } }, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.toast$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "device.notification.vibrate", d = a.genDefaultParamsDealFn({ duration: 300 }); i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: d }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: d }, o)), t.vibrate$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.screen.insetAdjust"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "4.6.18" }, o)), t.insetAdjust$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.screen.resetView"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.android] = { vs: "4.0.0" }, o[i.ENV_ENUM.ios] = { vs: "4.0.0" }, o)), t.resetView$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "device.screen.rotateView"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.android] = { vs: "4.0.0" }, o[i.ENV_ENUM.ios] = { vs: "4.0.0" }, o)), t.rotateView$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "net.bjGovApn.loginGovNet"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.android] = { vs: "4.5.16" }, o)), t.loginGovNet$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "runtime.message.fetch"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.fetch$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "runtime.message.post"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.post$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "runtime.permission.requestAuthCode", s = function (e) { return Object.assign(e, { url: location.href.split("#")[0] }) }; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.0.0", paramsDeal: s }, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.requestAuthCode$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "runtime.permission.requestOperateAuthCode", s = function (e) { return Object.assign(e, { url: location.href.split("#")[0] }) }; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.pc] = { vs: "3.3.0", paramsDeal: s }, o[i.ENV_ENUM.ios] = { vs: "3.3.0" }, o[i.ENV_ENUM.android] = { vs: "3.3.0" }, o)), t.requestOperateAuthCode$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.input.plain"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.plain$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.nav.close"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.close$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.nav.getCurrentId"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.getCurrentId$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.nav.go"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.go$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.nav.preload"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.preload$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.nav.recycle"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.6.0" }, o[i.ENV_ENUM.android] = { vs: "2.6.0" }, o)), t.recycle$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.progressBar.setColors"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.setColors$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.pullToRefresh.disable"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.disable$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(s, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = n(1), s = "ui.pullToRefresh.enable"; i.ddSdk.setAPI(s, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0", paramsDeal: a.addWatchParamsDeal }, o[i.ENV_ENUM.android] = { vs: "2.4.0", paramsDeal: a.addWatchParamsDeal }, o)), t.enable$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.pullToRefresh.stop"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.stop$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.webViewBounce.disable"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.disable$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "ui.webViewBounce.enable"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.4.0" }, o[i.ENV_ENUM.android] = { vs: "2.4.0" }, o)), t.enable$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "util.domainStorage.getItem"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.9.0" }, o[i.ENV_ENUM.android] = { vs: "2.9.0" }, o)), t.getItem$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "util.domainStorage.removeItem"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.9.0" }, o[i.ENV_ENUM.android] = { vs: "2.9.0" }, o)), t.removeItem$ = r, t.default = r }, function (e, t, n) { "use strict"; function r(e) { return i.ddSdk.invokeAPI(a, e) } Object.defineProperty(t, "__esModule", { value: !0 }); var o, i = n(0), a = "util.domainStorage.setItem"; i.ddSdk.setAPI(a, (o = {}, o[i.ENV_ENUM.ios] = { vs: "2.9.0" }, o[i.ENV_ENUM.android] = { vs: "2.9.0" }, o[i.ENV_ENUM.pc] = { vs: "4.6.9" }, o)), t.setItem$ = r, t.default = r }, function (e, t, n) { "use strict"; var r = n(0), o = n(161), i = Object.assign({}, o, r.ddSdk.getExportSdk()); e.exports = i }, function (e, t, n) { "use strict"; var r = n(154); n(171), e.exports = r }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r; t.h5AndroidbridgeInit = function () { return r || (r = new Promise(function (e, t) { var n = function () { try { window.WebViewJavascriptBridgeAndroid = window.nuva && window.nuva.require(), e() } catch (e) { t(e) } }; window.nuva && (void 0 === window.nuva.isReady || window.nuva.isReady) ? n() : document.addEventListener("runtimeready", function () { n() }, !1) })), r }; var o = function (e, n) { return r || (r = t.h5AndroidbridgeInit()), r.then(function () { return new Promise(function (t, r) { var o = e.split("."), i = o.pop() || "", a = o.join("."), s = function (e) { "function" == typeof n.onSuccess && n.onSuccess(e), t(e) }, d = function (e) { "function" == typeof n.onFail && n.onFail(e), r(e) }; "function" == typeof window.WebViewJavascriptBridgeAndroid && window.WebViewJavascriptBridgeAndroid(s, d, a, i, n) }) }) }; t.default = o }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r; t.h5IosBridgeInit = function () { return r || (r = new Promise(function (e, t) { if ("undefined" != typeof WebViewJavascriptBridge) { try { WebViewJavascriptBridge.init(function (e, t) { }) } catch (e) { return t() } return e() } document.addEventListener("WebViewJavascriptBridgeReady", function () { if ("undefined" == typeof WebViewJavascriptBridge) return t(); try { WebViewJavascriptBridge.init(function (e, t) { }) } catch (e) { return t() } return e() }, !1) })), r }; var o = function (e, n) { return r || (r = t.h5IosBridgeInit()), r.then(function () { var t = Object.assign({}, n); return new Promise(function (n, r) { if (!0 === t.watch) { var o = t.onSuccess; delete t.onSuccess, "undefined" != typeof WebViewJavascriptBridge && WebViewJavascriptBridge.registerHandler(e, function (e, t) { "function" == typeof o && o.call(null, e), t && t({ errorCode: "0", errorMessage: "success" }) }) } void 0 !== window.WebViewJavascriptBridge && window.WebViewJavascriptBridge.callHandler(e, Object.assign({}, t), function (e) { var o = e || {}; "0" === o.errorCode ? ("function" == typeof t.onSuccess && t.onSuccess.call(null, o.result), n(o.result)) : ("-1" === o.errorCode ? "function" == typeof t.onCancel && t.onCancel.call(null, o.result, o.errorCode) : "function" == typeof t.onFail && t.onFail.call(null, o.result, o.errorCode), r(o.result)) }) }) }) }; t.default = o }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), t.h5PcBridgeInit = function () { return Promise.resolve(n(4)) }; var r = function (e, t) { return new Promise(function (r, o) { return n(4).invokeAPI(e, t).result.then(function (e) { return "function" == typeof t.onSuccess && t.onSuccess.call(null, e), r(e) }, function (e) { return "function" == typeof t.onFail && t.onFail.call(null, e), o(e) }) }) }; t.default = r }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), t.on = function (e, t) { n(4).addEventListener(e, t) }, t.off = function (e, t) { n(4).removeEventListener(e, t) } }, function (e, t, n) { "use strict"; function r(e) { return e = "00" + e, e.substring(e.length - 2, e.length) } Object.defineProperty(t, "__esModule", { value: !0 }), t.log = function (e) { console.log.apply(console, [r(e.time.getHours()) + ":" + r(e.time.getMinutes()) + ":" + r(e.time.getSeconds())].concat(e.text)) } }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(2), o = r.getENV(); t.ios = o.platform === r.ENV_ENUM.ios, t.android = o.platform === r.ENV_ENUM.android, t.pc = o.platform === r.ENV_ENUM.pc, t.other = o.platform === r.ENV_ENUM.notInDingTalk, t.compareVersion = function (e, t, n) { function r(e) { return parseInt(e, 10) || 0 } if ("string" != typeof e || "string" != typeof t) return !1; for (var o, i, a = e.split("-")[0].split(".").map(r), s = t.split("-")[0].split(".").map(r) ; o === i && s.length > 0;) o = a.shift(), i = s.shift(); return n ? (i || 0) >= (o || 0) : (i || 0) > (o || 0) }, t.language = o.language, t.version = o.version }, function (e, t, n) { "use strict"; function r(e, t, n) { var r = "Web" === n.platform, i = "iOS" === n.platform, a = "android" === n.platform, s = a || i, d = function () { return r ? window.navigator.userAgent.toLowerCase() : "" }(), u = function () { var e = {}; if (r) { var t = window.name; try { var n = JSON.parse(t); e.containerId = n.containerId, e.version = n.hostVersion, e.language = n.language || "*" } catch (e) { } } return e }(), c = function () { return s ? "DingTalk" === n.appName || "com.alibaba.android.rimet" === n.appName : d.indexOf("dingtalk") > -1 || !!u.containerId }(), l = function () { if (r) { if (u.version) return u.version; var e = d.match(/aliapp\(\w+\/([a-zA-Z0-9.-]+)\)/); null === e && (e = d.match(/dingtalk\/([a-zA-Z0-9.-]+)/)); return e && e[1] || "Unknown" } return n.appVersion }(), f = !!u.containerId, v = /iphone|ipod|ios/.test(d), p = /ipad/.test(d), _ = d.indexOf("android") > -1, E = d.indexOf("mac") > -1 && f, N = d.indexOf("win") > -1 && f, P = !E && !N && f, h = f, m = ""; return m = c ? v || i ? o.PLATFORM.IOS : _ || a ? o.PLATFORM.ANDROID : p ? o.PLATFORM.IPAD : E ? o.PLATFORM.MAC : N ? o.PLATFORM.WINDOWS : P ? o.PLATFORM.BROWSER : o.PLATFORM.UNKNOWN : o.PLATFORM.UNKNOWN, { isDingTalk: c, isWebiOS: v, isWebAndroid: _, isWeexiOS: i, isWeexAndroid: a, isDingTalkPCMac: E, isDingTalkPCWeb: P, isDingTalkPCWindows: N, isDingTalkPC: h, runtime: e, framework: t, platform: m, version: l } } Object.defineProperty(t, "__esModule", { value: !0 }); var o = n(11); t.default = r }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(164), o = n(162), i = n(11), a = r.default().split("."), s = a[0], d = a[1], u = function () { var e = {}; switch (d) { case i.FRAMEWORK.VUE: var t = weex.config, n = t.env; e.platform = n.platform, i.RUNTIME.WEEX === s && (e.appVersion = n.appVersion, e.appName = n.appName); break; case i.FRAMEWORK.RAX: i.RUNTIME.WEEX === s && (e.platform = navigator.platform, e.appName = navigator.appName, e.appVersion = navigator.appVersion); break; case i.FRAMEWORK.UNKNOWN: i.RUNTIME.WEB === s && (e.platform = i.RUNTIME.WEB), i.RUNTIME.UNKNOWN === s && (e.platform = i.RUNTIME.UNKNOWN) } return e }(), c = o.default(s, d, u); t.default = c }, function (e, t, n) { "use strict"; function r(e, t) { for (var n = e.length, r = 0, o = !0; r < n; r++) if (!t[e[r]]) { o = !1; break } return o } function o() { return i && a ? r(c, weex) ? "Web.Vue" : "Web.Unknown" : !i && a ? r(c, weex) ? "Weex.Vue" : "Weex.Unknown" : i && s && !a ? r(d, window) ? "Weex.Rax" : "Weex.Unknown" : i && r(u, window) ? "Web.Unknown" : "Unknown.Unknown" } Object.defineProperty(t, "__esModule", { value: !0 }); var i = "undefined" != typeof window, a = "undefined" != typeof weex, s = "undefined" != typeof callNative, d = ["__weex_config__", "__weex_options__", "__weex_require__"], u = ["localStorage", "location", "navigator", "XMLHttpRequest"], c = ["config", "requireModule", "document"]; t.default = o }, function (e, t, n) { "function" != typeof Promise && n(175) }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), n(165), n(167), n(168) }, function (e, t) { "function" != typeof Object.assign && Object.defineProperty(Object, "assign", { value: function (e, t) { "use strict"; if (null == e) throw new TypeError("Cannot convert undefined or null to object"); for (var n = Object(e), r = 1; r < arguments.length; r++) { var o = arguments[r]; if (null != o) for (var i in o) Object.prototype.hasOwnProperty.call(o, i) && (n[i] = o[i]) } return n }, writable: !0, configurable: !0 }) }, function (e, t) { Object.keys || (Object.keys = function (e) { if (e !== Object(e)) throw new TypeError("Object.keys called on a non-object"); var t, n = []; for (t in e) Object.prototype.hasOwnProperty.call(e, t) && n.push(t); return n }) }, function (e, t, n) { "use strict"; function r(e) { return "function" == typeof e } function o(e, t) { function n(e) { return parseInt(e, 10) || 0 } for (var r = e.split(".").map(n), o = t.split(".").map(n), i = 0; i < r.length; i++) { if (void 0 === o[i]) return !1; if (r[i] < o[i]) return !1; if (r[i] > o[i]) return !0 } return !0 } Object.defineProperty(t, "__esModule", { value: !0 }), t.isFunction = r, t.compareVersion = o; (function (e) { e.cancel = "-1", e.not_exist = "1", e.no_permission = "7", e.jsapi_internal_error = "22" })(t.ERROR_CODE || (t.ERROR_CODE = {})); (function (e) { e.pc = "pc", e.android = "android", e.ios = "ios", e.notInDingTalk = "notInDingTalk" })(t.ENV_ENUM || (t.ENV_ENUM = {})); (function (e) { e.WEB = "WEB", e.MINI_APP = "MINI_APP", e.WEEX = "WEEX", e.WEBVIEW_IN_MINIAPP = "WEBVIEW_IN_MINIAPP" })(t.APP_TYPE || (t.APP_TYPE = {})); (function (e) { e[e.INFO = 1] = "INFO", e[e.WARNING = 2] = "WARNING", e[e.ERROR = 3] = "ERROR" })(t.LogLevel || (t.LogLevel = {})) }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(0), o = n(2), i = n(3), a = n(5), s = n(9), d = n(156), u = n(6), c = n(8), l = n(10); r.ddSdk.setPlatform({ platform: o.ENV_ENUM.android, bridgeInit: function () { var e = o.getENV(); return e.appType === i.APP_TYPE.MINI_APP ? Promise.resolve(a.default) : e.appType === i.APP_TYPE.WEBVIEW_IN_MINIAPP ? Promise.resolve(s.default) : e.appType === i.APP_TYPE.WEEX ? u.androidWeexBridge() : d.h5AndroidbridgeInit().then(function () { return d.default }) }, authMethod: "runtime.permission.requestJsApis", event: { on: function (e, t) { var n = o.getENV(); switch (n.appType) { case i.APP_TYPE.WEB: c.on(e, t); break; case i.APP_TYPE.WEEX: l.on(e, t); break; default: throw new Error("Not support global event in the platfrom: " + n.appType) } }, off: function (e, t) { var n = o.getENV(); switch (n.appType) { case i.APP_TYPE.WEB: c.off(e, t); break; case i.APP_TYPE.WEEX: l.off(e, t); break; default: throw new Error("Not support global event in the platfrom: " + n.appType) } } } }) }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }), n(173), n(170), n(172) }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(0), o = n(2), i = n(3), a = n(5), s = n(9), d = n(157), u = n(6), c = n(8), l = n(10); r.ddSdk.setPlatform({ platform: o.ENV_ENUM.ios, bridgeInit: function () { var e = o.getENV(); return e.appType === i.APP_TYPE.MINI_APP ? Promise.resolve(a.default) : e.appType === i.APP_TYPE.WEBVIEW_IN_MINIAPP ? Promise.resolve(s.default) : e.appType === i.APP_TYPE.WEEX ? u.iosWeexBridge() : d.h5IosBridgeInit().then(function () { return d.default }) }, authMethod: "runtime.permission.requestJsApis", event: { on: function (e, t) { var n = o.getENV(); switch (n.appType) { case i.APP_TYPE.WEB: c.on(e, t); break; case i.APP_TYPE.WEEX: l.on(e, t); break; default: throw new Error("Not support global event in the platfrom: " + n.appType) } }, off: function (e, t) { var n = o.getENV(); switch (n.appType) { case i.APP_TYPE.WEB: c.off(e, t); break; case i.APP_TYPE.WEEX: l.off(e, t); break; default: throw new Error("Not support global event in the platfrom: " + n.appType) } } } }) }, function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(0), o = n(2), i = n(158), a = n(5), s = n(3), d = n(159); r.ddSdk.setPlatform({ platform: o.ENV_ENUM.pc, bridgeInit: function () { switch (o.getENV().appType) { case s.APP_TYPE.MINI_APP: return Promise.resolve(a.default); default: return i.h5PcBridgeInit().then(function () { return i.default }) } }, authMethod: "config", authParamsDeal: function (e) { var t = Object.assign({}, e); return t.url = window.location.href.split("#")[0], t }, event: { on: function (e, t) { if (o.getENV().appType === s.APP_TYPE.WEB) return d.on(e, t) }, off: function (e, t) { if (o.getENV().appType === s.APP_TYPE.WEB) return d.off(e, t) } } }) }, function (e, t) { function n() { throw new Error("setTimeout has not been defined") } function r() { throw new Error("clearTimeout has not been defined") } function o(e) { if (c === setTimeout) return setTimeout(e, 0); if ((c === n || !c) && setTimeout) return c = setTimeout, setTimeout(e, 0); try { return c(e, 0) } catch (t) { try { return c.call(null, e, 0) } catch (t) { return c.call(this, e, 0) } } } function i(e) { if (l === clearTimeout) return clearTimeout(e); if ((l === r || !l) && clearTimeout) return l = clearTimeout, clearTimeout(e); try { return l(e) } catch (t) { try { return l.call(null, e) } catch (t) { return l.call(this, e) } } } function a() { _ && v && (_ = !1, v.length ? p = v.concat(p) : E = -1, p.length && s()) } function s() { if (!_) { var e = o(a); _ = !0; for (var t = p.length; t;) { for (v = p, p = []; ++E < t;) v && v[E].run(); E = -1, t = p.length } v = null, _ = !1, i(e) } } function d(e, t) { this.fun = e, this.array = t } function u() { } var c, l, f = e.exports = {}; (function () { try { c = "function" == typeof setTimeout ? setTimeout : n } catch (e) { c = n } try { l = "function" == typeof clearTimeout ? clearTimeout : r } catch (e) { l = r } })(); var v, p = [], _ = !1, E = -1; f.nextTick = function (e) { var t = new Array(arguments.length - 1); if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n]; p.push(new d(e, t)), 1 !== p.length || _ || o(s) }, d.prototype.run = function () { this.fun.apply(null, this.array) }, f.title = "browser", f.browser = !0, f.env = {}, f.argv = [], f.version = "", f.versions = {}, f.on = u, f.addListener = u, f.once = u, f.off = u, f.removeListener = u, f.removeAllListeners = u, f.emit = u, f.prependListener = u, f.prependOnceListener = u, f.listeners = function (e) { return [] }, f.binding = function (e) { throw new Error("process.binding is not supported") }, f.cwd = function () { return "/" }, f.chdir = function (e) { throw new Error("process.chdir is not supported") }, f.umask = function () { return 0 } }, function (e, t, n) { (function (e, t) { (function (e, t) { t() })(0, function () { "use strict"; function n() { } function r(e, t) { return function () { e.apply(t, arguments) } } function o(e) { if (!(this instanceof o)) throw new TypeError("Promises must be constructed via new"); if ("function" != typeof e) throw new TypeError("not a function"); this._state = 0, this._handled = !1, this._value = void 0, this._deferreds = [], c(e, this) } function i(e, t) { for (; 3 === e._state;) e = e._value; if (0 === e._state) return void e._deferreds.push(t); e._handled = !0, o._immediateFn(function () { var n = 1 === e._state ? t.onFulfilled : t.onRejected; if (null === n) return void (1 === e._state ? a : s)(t.promise, e._value); var r; try { r = n(e._value) } catch (e) { return void s(t.promise, e) } a(t.promise, r) }) } function a(e, t) { try { if (t === e) throw new TypeError("A promise cannot be resolved with itself."); if (t && ("object" == typeof t || "function" == typeof t)) { var n = t.then; if (t instanceof o) return e._state = 3, e._value = t, void d(e); if ("function" == typeof n) return void c(r(n, t), e) } e._state = 1, e._value = t, d(e) } catch (t) { s(e, t) } } function s(e, t) { e._state = 2, e._value = t, d(e) } function d(e) { 2 === e._state && 0 === e._deferreds.length && o._immediateFn(function () { e._handled || o._unhandledRejectionFn(e._value) }); for (var t = 0, n = e._deferreds.length; t < n; t++) i(e, e._deferreds[t]); e._deferreds = null } function u(e, t, n) { this.onFulfilled = "function" == typeof e ? e : null, this.onRejected = "function" == typeof t ? t : null, this.promise = n } function c(e, t) { var n = !1; try { e(function (e) { n || (n = !0, a(t, e)) }, function (e) { n || (n = !0, s(t, e)) }) } catch (e) { if (n) return; n = !0, s(t, e) } } var l = setTimeout; o.prototype.catch = function (e) { return this.then(null, e) }, o.prototype.then = function (e, t) { var r = new this.constructor(n); return i(this, new u(e, t, r)), r }, o.prototype.finally = function (e) { var t = this.constructor; return this.then(function (n) { return t.resolve(e()).then(function () { return n }) }, function (n) { return t.resolve(e()).then(function () { return t.reject(n) }) }) }, o.all = function (e) { return new o(function (t, n) { function r(e, a) { try { if (a && ("object" == typeof a || "function" == typeof a)) { var s = a.then; if ("function" == typeof s) return void s.call(a, function (t) { r(e, t) }, n) } o[e] = a, 0 == --i && t(o) } catch (e) { n(e) } } if (!e || void 0 === e.length) throw new TypeError("Promise.all accepts an array"); var o = Array.prototype.slice.call(e); if (0 === o.length) return t([]); for (var i = o.length, a = 0; a < o.length; a++) r(a, o[a]) }) }, o.resolve = function (e) { return e && "object" == typeof e && e.constructor === o ? e : new o(function (t) { t(e) }) }, o.reject = function (e) { return new o(function (t, n) { n(e) }) }, o.race = function (e) { return new o(function (t, n) { for (var r = 0, o = e.length; r < o; r++) e[r].then(t, n) }) }, o._immediateFn = "function" == typeof e && function (t) { e(t) } || function (e) { l(e, 0) }, o._unhandledRejectionFn = function (e) { "undefined" != typeof console && console && console.warn("Possible Unhandled Promise Rejection:", e) }; var f = function () { if ("undefined" != typeof self) return self; if ("undefined" != typeof window) return window; if (void 0 !== t) return t; throw new Error("unable to locate global object") }(); f.Promise || (f.Promise = o) }) }).call(t, n(177).setImmediate, n(7)) }, function (e, t, n) { (function (e, t) { (function (e, n) { "use strict"; function r(e) { "function" != typeof e && (e = new Function("" + e)); for (var t = new Array(arguments.length - 1), n = 0; n < t.length; n++) t[n] = arguments[n + 1]; var r = { callback: e, args: t }; return u[d] = r, s(d), d++ } function o(e) { delete u[e] } function i(e) { var t = e.callback, r = e.args; switch (r.length) { case 0: t(); break; case 1: t(r[0]); break; case 2: t(r[0], r[1]); break; case 3: t(r[0], r[1], r[2]); break; default: t.apply(n, r) } } function a(e) { if (c) setTimeout(a, 0, e); else { var t = u[e]; if (t) { c = !0; try { i(t) } finally { o(e), c = !1 } } } } if (!e.setImmediate) { var s, d = 1, u = {}, c = !1, l = e.document, f = Object.getPrototypeOf && Object.getPrototypeOf(e); f = f && f.setTimeout ? f : e, "[object process]" === {}.toString.call(e.process) ? function () { s = function (e) { t.nextTick(function () { a(e) }) } }() : ! function () { if (e.postMessage && !e.importScripts) { var t = !0, n = e.onmessage; return e.onmessage = function () { t = !1 }, e.postMessage("", "*"), e.onmessage = n, t } }() ? e.MessageChannel ? function () { var e = new MessageChannel; e.port1.onmessage = function (e) { a(e.data) }, s = function (t) { e.port2.postMessage(t) } }() : l && "onreadystatechange" in l.createElement("script") ? function () { var e = l.documentElement; s = function (t) { var n = l.createElement("script"); n.onreadystatechange = function () { a(t), n.onreadystatechange = null, e.removeChild(n), n = null }, e.appendChild(n) } }() : function () { s = function (e) { setTimeout(a, 0, e) } }() : function () { var t = "setImmediate$" + Math.random() + "$", n = function (n) { n.source === e && "string" == typeof n.data && 0 === n.data.indexOf(t) && a(+n.data.slice(t.length)) }; e.addEventListener ? e.addEventListener("message", n, !1) : e.attachEvent("onmessage", n), s = function (n) { e.postMessage(t + n, "*") } }(), f.setImmediate = r, f.clearImmediate = o } })("undefined" == typeof self ? void 0 === e ? this : e : self) }).call(t, n(7), n(174)) }, function (e, t, n) { (function (e) { function r(e, t) { this._id = e, this._clearFn = t } var o = void 0 !== e && e || "undefined" != typeof self && self || window, i = Function.prototype.apply; t.setTimeout = function () { return new r(i.call(setTimeout, o, arguments), clearTimeout) }, t.setInterval = function () { return new r(i.call(setInterval, o, arguments), clearInterval) }, t.clearTimeout = t.clearInterval = function (e) { e && e.close() }, r.prototype.unref = r.prototype.ref = function () { }, r.prototype.close = function () { this._clearFn.call(o, this._id) }, t.enroll = function (e, t) { clearTimeout(e._idleTimeoutId), e._idleTimeout = t }, t.unenroll = function (e) { clearTimeout(e._idleTimeoutId), e._idleTimeout = -1 }, t._unrefActive = t.active = function (e) { clearTimeout(e._idleTimeoutId); var t = e._idleTimeout; t >= 0 && (e._idleTimeoutId = setTimeout(function () { e._onTimeout && e._onTimeout() }, t)) }, n(176), t.setImmediate = "undefined" != typeof self && self.setImmediate || void 0 !== e && e.setImmediate || this && this.setImmediate, t.clearImmediate = "undefined" != typeof self && self.clearImmediate || void 0 !== e && e.clearImmediate || this && this.clearImmediate }).call(t, n(7)) }, , function (e, t, n) { "use strict"; var r = n(155), o = n(528), i = Object.assign(r, o.apiObj); e.exports = i }, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function (e, t, n) { "use strict"; Object.defineProperty(t, "__esModule", { value: !0 }); var r = n(12), o = n(13), i = n(14), a = n(15), s = n(16), d = n(17), u = n(18), c = n(19), l = n(20), f = n(21), v = n(22), p = n(23), _ = n(24), E = n(25), N = n(26), P = n(27), h = n(28), m = n(29), M = n(30), y = n(31), k = n(32), g = n(33), b = n(34), I = n(35), A = n(36), S = n(37), V = n(38), U = n(39), O = n(40), j = n(41), w = n(42), $ = n(43), D = n(44), C = n(45), T = n(46), x = n(47), F = n(48), W = n(49), R = n(50), L = n(51), B = n(52), z = n(53), q = n(54), Y = n(55), J = n(56), G = n(57), H = n(58), K = n(59), X = n(60), Q = n(61), Z = n(62), ee = n(63), te = n(64), ne = n(65), re = n(66), oe = n(67), ie = n(68), ae = n(69), se = n(70), de = n(71), ue = n(72), ce = n(73), le = n(74), fe = n(75), ve = n(76), pe = n(77), _e = n(78), Ee = n(79), Ne = n(80), Pe = n(81), he = n(82), me = n(83), Me = n(84), ye = n(85), ke = n(86), ge = n(87), be = n(88), Ie = n(89), Ae = n(90), Se = n(91), Ve = n(92), Ue = n(93), Oe = n(94), je = n(95), we = n(96), $e = n(97), De = n(98), Ce = n(99), Te = n(100), xe = n(101), Fe = n(102), We = n(103), Re = n(104), Le = n(105), Be = n(106), ze = n(107), qe = n(108), Ye = n(109), Je = n(110), Ge = n(111), He = n(112), Ke = n(113), Xe = n(114), Qe = n(115), Ze = n(116), et = n(117), tt = n(118), nt = n(119), rt = n(120), ot = n(121), it = n(122), at = n(123), st = n(124), dt = n(125), ut = n(126), ct = n(127), lt = n(128), ft = n(129), vt = n(130), pt = n(131), _t = n(132), Et = n(133), Nt = n(134), Pt = n(135), ht = n(136), mt = n(137), Mt = n(138), yt = n(139), kt = n(140), gt = n(141), bt = n(142), It = n(143), At = n(144), St = n(145), Vt = n(146), Ut = n(147), Ot = n(148), jt = n(149), wt = n(150), $t = n(151), Dt = n(152), Ct = n(153); t.apiObj = { biz: { alipay: { pay: r.pay$ }, calendar: { chooseDateTime: o.chooseDateTime$, chooseHalfDay: i.chooseHalfDay$, chooseInterval: a.chooseInterval$, chooseOneDay: s.chooseOneDay$ }, chat: { chooseConversationByCorpId: d.chooseConversationByCorpId$, locationChatMessage: u.locationChatMessage$, openSingleChat: c.openSingleChat$, pickConversation: l.pickConversation$, sendEmotion: f.sendEmotion$, toConversation: v.toConversation$ }, clipboardData: { setData: p.setData$ }, contact: { choose: _.choose$, chooseMobileContacts: E.chooseMobileContacts$, complexPicker: N.complexPicker$, createGroup: P.createGroup$, departmentsPicker: h.departmentsPicker$, externalComplexPicker: m.externalComplexPicker$, externalEditForm: M.externalEditForm$, setRule: y.setRule$ }, cspace: { chooseSpaceDir: k.chooseSpaceDir$, delete: g.delete$, preview: b.preview$, saveFile: I.saveFile$ }, customContact: { choose: A.choose$, multipleChoose: S.multipleChoose$ }, ding: { create: V.create$, post: U.post$ }, event: { notifyWeex: O.notifyWeex$ }, intent: { fetchData: j.fetchData$ }, map: { locate: w.locate$, search: $.search$, view: D.view$ }, microApp: { openApp: C.openApp$ }, navigation: { close: T.close$, goBack: x.goBack$, hideBar: F.hideBar$, quit: W.quit$, replace: R.replace$, setIcon: L.setIcon$, setLeft: B.setLeft$, setMenu: z.setMenu$, setRight: q.setRight$, setTitle: Y.setTitle$ }, store: { closeUnpayOrder: J.closeUnpayOrder$, createOrder: G.createOrder$, getPayUrl: H.getPayUrl$, inquiry: K.inquiry$ }, telephone: { call: X.call$, checkBizCall: Q.checkBizCall$, quickCallList: Z.quickCallList$, showCallMenu: ee.showCallMenu$ }, user: { checkPassword: te.checkPassword$, get: ne.get$ }, util: { chosen: re.chosen$, datepicker: oe.datepicker$, datetimepicker: ie.datetimepicker$, decrypt: ae.decrypt$, downloadFile: se.downloadFile$, encrypt: de.encrypt$, isLocalFileExist: ue.isLocalFileExist$, multiSelect: ce.multiSelect$, open: le.open$, openLink: fe.openLink$, openLocalFile: ve.openLocalFile$, openModal: pe.openModal$, openSlidePanel: _e.openSlidePanel$, presentWindow: Ee.presentWindow$, previewImage: Ne.previewImage$, previewVideo: Pe.previewVideo$, scan: he.scan$, scanCard: me.scanCard$, setScreenBrightnessAndKeepOn: Me.setScreenBrightnessAndKeepOn$, share: ye.share$, systemShare: ke.systemShare$, timepicker: ge.timepicker$, uploadAttachment: be.uploadAttachment$, uploadImage: Ie.uploadImage$, uploadImageFromCamera: Ae.uploadImageFromCamera$, ut: Se.ut$ }, verify: { openBindIDCard: Ve.openBindIDCard$, startAuth: Ue.startAuth$ } }, channel: { permission: { requestAuthCode: Oe.requestAuthCode$ } }, device: { accelerometer: { clearShake: je.clearShake$, watchShake: we.watchShake$ }, audio: { download: $e.download$, onPlayEnd: De.onPlayEnd$, onRecordEnd: Ce.onRecordEnd$, pause: Te.pause$, play: xe.play$, resume: Fe.resume$, startRecord: We.startRecord$, stop: Re.stop$, stopRecord: Le.stopRecord$, translateVoice: Be.translateVoice$ }, base: { getInterface: ze.getInterface$, getPhoneInfo: qe.getPhoneInfo$, getUUID: Ye.getUUID$, getWifiStatus: Je.getWifiStatus$ }, connection: { getNetworkType: Ge.getNetworkType$ }, geolocation: { get: He.get$, start: Ke.start$, status: Xe.status$, stop: Qe.stop$ }, launcher: { checkInstalledApps: Ze.checkInstalledApps$, launchApp: et.launchApp$ }, nfc: { nfcRead: tt.nfcRead$, nfcStop: nt.nfcStop$, nfcWrite: rt.nfcWrite$ }, notification: { actionSheet: ot.actionSheet$, alert: it.alert$, confirm: at.confirm$, extendModal: st.extendModal$, hidePreloader: dt.hidePreloader$, modal: ut.modal$, prompt: ct.prompt$, showPreloader: lt.showPreloader$, toast: ft.toast$, vibrate: vt.vibrate$ }, screen: { insetAdjust: pt.insetAdjust$, resetView: _t.resetView$, rotateView: Et.rotateView$ } }, net: { bjGovApn: { loginGovNet: Nt.loginGovNet$ } }, runtime: { message: { fetch: Pt.fetch$, post: ht.post$ }, permission: { requestAuthCode: mt.requestAuthCode$, requestOperateAuthCode: Mt.requestOperateAuthCode$ } }, ui: { input: { plain: yt.plain$ }, nav: { close: kt.close$, getCurrentId: gt.getCurrentId$, go: bt.go$, preload: It.preload$, recycle: At.recycle$ }, progressBar: { setColors: St.setColors$ }, pullToRefresh: { disable: Vt.disable$, enable: Ut.enable$, stop: Ot.stop$ }, webViewBounce: { disable: jt.disable$, enable: wt.enable$ } }, util: { domainStorage: { getItem: $t.getItem$, removeItem: Dt.removeItem$, setItem: Ct.setItem$ } } } }, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function (e, t, n) { e.exports = n(179) } ]) }); ;(function () { CLLoad("/View/Flow/FlowCoreEx.css"); window.FlowCoreEx = function (Ele, Editable) { var self = this; self.FlowClass = { ID: CLMakeId(), Name: "未命名流程", FormsID: null, leftX: 0,//所有节点渲染的translateX值 topY: 0,//所有节点渲染的translateY值 Scale: 1,//所有节点渲染的scale值 Count: 0, Version: 1, Steps: [ ] }; self.FlowClass.originalId = self.FlowClass.ID; self.Editable = Editable; self.Ele = Ele; Ele.classList.add("FlowCoreEx"); if (Editable == false) { Ele.classList.add("FlowCoreExNoEditable"); self.LineColor = "#d9d9d9"; } var Bar = self.Bar = document.createElement("div"); Bar.className = "Bar"; Ele.appendChild(Bar); if (Editable == false) { Bar.style.width = "100%"; Bar.style.left = "0"; } if (Editable != false) { var PropDiv = self.PropDiv = document.createElement("div"); PropDiv.setAttribute("tabindex", "1"); PropDiv.className = "Prop"; Ele.appendChild(PropDiv); } var ContainerBg = self.ContainerBg = document.createElement("div"); ContainerBg.style.cssText = "outline:none;"; ContainerBg.setAttribute("tabindex", "0"); ContainerBg.className = "ContainerBg"; Ele.appendChild(ContainerBg); if (Editable == false) { ContainerBg.style.width = "100%"; } self.Container = document.createElement("div"); self.Container.className = "Container"; self.Container.style.cssText = "outline:none;position:absolute;z-index:2;"; ContainerBg.onmousedown = function () { self.Container.focus(); } ContainerBg.appendChild(self.Container); var Canvas = self.Canvas = document.createElement("div"); Canvas.style.cssText = "position:absolute;left:0;top:0;z-index:1;"; ContainerBg.appendChild(Canvas); var svg = document.createElement("svg"); svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svg.setAttribute("version", "1.1"); svg.style.position = "absolute"; svg.style.pointerEvents = "none"; svg.className = "svg_" + CLMakeId(); var style = self.style = document.createElement("style"); document.head.appendChild(style); style.innerHTML = "." + svg.className + ">*{transform:translate(0,0);pointer-events:auto}"; Canvas.appendChild(svg); svg.setAttribute("width", ContainerBg.offsetWidth); svg.setAttribute("height", ContainerBg.offsetHeight); Canvas.innerHTML = svg.outerHTML; if (Editable != false) { self.createBar(); } self.EleContainer = new CLContainer(self.Container, ContainerBg); self.EleContainer.OnScaleChanged = function (Scale) { var svg = Canvas.firstChild; svg.setAttribute("width", ContainerBg.offsetWidth / Scale); svg.setAttribute("height", ContainerBg.offsetHeight / Scale); Canvas.style.cssText = self.Container.style.cssText; Canvas.style.pointerEvents = "none"; Canvas.style.zIndex = "1"; style.sheet.cssRules[0].style.transform = self.EleContainer.MovedTransform(); self.FlowClass.Scale = Scale; if (Bar.scaleDiv == null) { Bar.scaleDiv = document.createElement("span"); Bar.scaleDiv.innerHTML = Scale.toStringEx("0%"); Bar.scaleDiv.style.cssFloat = "right"; Bar.scaleDiv.style.color = "#989"; Bar.appendChild(Bar.scaleDiv); } else { Bar.scaleDiv.innerHTML = Scale.toStringEx("0%"); } } self.EleContainer.OnPosChanging = function (X, Y) { self.FlowClass.leftX = X; self.FlowClass.topY = Y; style.sheet.cssRules[0].style.transform = self.EleContainer.MovedTransform(); style.sheet.cssRules[0].style.pointerEvents = "none"; } self.EleContainer.OnPosChanged = function (X, Y) { self.recordState(); } window.addEventListener("resize", function () { var Scale = self.EleContainer.GetScale(); self.EleContainer.SetScale(Scale); }); self.EleContainer.EnableZoom(); self.EleContainer.EnableContentMove(); if (Editable != false) { self.EnableLineSelect(); self.EnableLineEnterLeave(); self.EnableDeleteLine(); self.EnableDeleteStep(); self.EnableCtrlS(); self.EnableCtrlY(); self.EnableCtrlZ(); self.EnableCtrlF(); self.ContainerBg.addEventListener("mousedown", function (e) { if (e.defaultPrevented == true) { return; } self.SelectStep(); self.SelectLine(); self.FlowProp(); }); } self.EnableCtrlI(); self.setData(); }; (function (SempleFlowClass) { //var SempleFlowClass = (function () { // return { // ID: "10000", // Name: "第一个流程", // FormsID: null, // FormName: null, // leftX: 0,//所有节点渲染的translateX值 // topY: 0,//所有节点渲染的translateY值 // Scale: 1,//所有节点渲染的scale值 // Count: 0, // Version: 1, // TerminateEventHandle: null,//流程终止事件 // StepRejectEventHandle: null,//节点回退事件 // StepJmpEventHandle: null,//节点跳转事件 // Steps: [ // { // ID: "10000", // Name: "未命名", // Type: 1, // NotFindHandler: 0, // Handlers: { // Parts: [ // ], // Roles: [ // ], // Members: [ // ], // Dynamic: [ // ] // }, // ToID: [], // ToIDCase: {}, // ToIDPos: { // }, // ToIDSms: {}, // startEventHandle: null, // endEventHandle: null, // stepRule: null, // DataFields: null, // RejectBtn: true, // HandOverBtn: false, // PosLeft: 100, // PosTop: 100, // zIndex: 0 // } // ] // } //}()); }); var Icons = ["", "", "", "", "", "", ""]; var fn = FlowCoreEx.prototype; fn.Container = null; fn.StartStep = null; fn.FlowClass = null; fn.Editable = true; fn.getElementById = function (Id) { return this.Container.getElementsByClassName(Id)[0] || this.Canvas.firstChild.getElementsByClassName(Id)[0]; } fn.createBar = function () { var self = this; var Bar = self.Bar; var undo = document.createElement("span"); undo.className = "Icon"; undo.style.cursor = "pointer"; undo.style.fontSize = "16px"; undo.innerHTML = ""; undo.style.color = "#989"; undo.onclick = function () { Bar.undo(); } Bar.appendChild(undo); var redo = undo.cloneNode(); redo.innerHTML = ""; redo.onclick = function () { Bar.redo(); } Bar.appendChild(redo); var undoList = []; var redoList = []; Bar.recordState = function () { undoList.push(JSON.stringify(self.getData())); if (undoList.length > 100) { undoList.splice(0, 1); } if (undoList.length > 0) { undo.style.color = "#000"; } else { undo.style.color = "#989"; } if (redoList.length > 0) { redoList = []; redo.style.color = "#989"; } } Bar.undo = function () { if (undoList.length == 0) { return; } var data = undoList[undoList.length - 1]; redoList.push(data); undoList.pop(); self.recordState = function () { } if (undoList.length == 0) { self.setData(); } else { self.setData(JSON.parse(undoList[undoList.length - 1])); } self.recordState = function () { Bar.recordState() } if (undoList.length > 0) { undo.style.color = "#000"; } else { undo.style.color = "#989"; } if (redoList.length > 0) { redo.style.color = "#000"; } else { redo.style.color = "#989"; } } Bar.redo = function () { if (redoList.length == 0) { return; } var data = redoList[redoList.length - 1]; redoList.pop(); self.recordState = function () { } self.setData(JSON.parse(data)); undoList.push(data); self.recordState = function () { Bar.recordState() } if (undoList.length > 0) { undo.style.color = "#000"; } else { undo.style.color = "#989"; } if (redoList.length > 0) { redo.style.color = "#000"; } else { redo.style.color = "#989"; } } function EnableMove(Node) { var helpLabel = EnableMove.helpLabel; if (helpLabel == null) { helpLabel = EnableMove.helpLabel = self.createStep(); helpLabel.style.position = "fixed"; } CLEnableMove(Node, function (Item) { helpLabel.style.zIndex = CLMaxZIndex(); helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; helpLabel.appendChild(Node.cloneNode(true)); helpLabel.lastChild.style.width = "100%"; helpLabel.lastChild.style.height = "48px"; Bar.appendChild(helpLabel); }, function (Item) { helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; }, function (Item) { helpLabel.style.zIndex = ""; helpLabel.lastChild.remove(); var scale = self.EleContainer.GetScale(); var rect = self.Container.getBoundingClientRect(); rect.width *= scale; rect.height *= scale; rect.right = rect.left + rect.width; rect.bottom = rect.top + rect.height; if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) { helpLabel.remove(); return; } if (self.StartStep != null && Node.Type == 0) { CLShowMsg("只能同时有一个经办节点"); helpLabel.remove(); return; } var helpRect = helpLabel.getBoundingClientRect(); var X = helpRect.left + helpRect.width / 2; var Y = helpRect.top + helpRect.height / 2 var Pos = { X: X, Y: Y }; self.EleContainer.ClientToOffset(Pos); Pos.X = Pos.X - helpRect.width / 2; Pos.Y = Pos.Y - helpRect.height / 2; var Step = { ID: CLMakeId(), Type: Node.Type, Name: Node.lastChild.innerHTML, PosLeft: Pos.X, PosTop: Pos.Y, ToID: [] }; if (Node.Type == 0) { self.StartStep = Step; } var divStep = self.createStep(Step); self.Container.focus(); helpLabel.remove(); self.recordState(); }); } var startNode = document.createElement("div"); startNode.className = "Move"; var icon = document.createElement("span"); icon.className = "Icon"; icon.style.color = "#3F80AE"; icon.innerHTML = Icons[0]; startNode.appendChild(icon); var Name = document.createElement("span"); Name.innerHTML = "发起节点"; startNode.Type = 0; startNode.appendChild(Name); Bar.appendChild(startNode); EnableMove(startNode); var flowNode = startNode.cloneNode(true); flowNode.Type = 1; flowNode.firstChild.innerHTML = Icons[1]; flowNode.lastChild.innerHTML = "审批节点"; Bar.appendChild(flowNode); EnableMove(flowNode); var copyNode = startNode.cloneNode(true); copyNode.Type = 2; copyNode.firstChild.innerHTML = Icons[2]; copyNode.lastChild.innerHTML = "抄送节点"; Bar.appendChild(copyNode); EnableMove(copyNode); var endNode = startNode.cloneNode(true); endNode.Type = 3; endNode.firstChild.innerHTML = Icons[3]; endNode.lastChild.innerHTML = "结束节点"; Bar.appendChild(endNode); EnableMove(endNode); var subNode = startNode.cloneNode(true); subNode.Type = 4; subNode.style.width = "110px"; subNode.firstChild.innerHTML = Icons[4]; subNode.lastChild.innerHTML = "子流程节点"; Bar.appendChild(subNode); EnableMove(subNode); var divRight = document.createElement("div"); divRight.style.cssText = "height:100%;display:inline-block;vertical-align:top;float:right"; Bar.appendChild(divRight); var divVersion = document.createElement("div"); divVersion.style.cssText = "height:100%;display:inline-block;vertical-align:top;margin-left:15px;margin-right:8px;"; var divInfo = document.createElement("div"); divInfo.style.cssText = "cursor:pointer;display:inline-block"; divVersion.appendChild(divInfo); divRight.appendChild(divVersion); var Edit = document.createElement("div"); Edit.style.cssText = "font-family:CLFont;padding:0 10px; font-size:16px;display:inline-block;cursor:pointer"; Edit.innerHTML = ""; divVersion.appendChild(Edit); Edit.onclick = function () { self.VersionInfoDialog(); } self.ShowVersion = function () { var AllVersions = self.FlowClass.AllVersions; if (self.FlowClass.IsUsing != 1) { useBtn.style.display = "inline-block"; } else { useBtn.style.display = "none"; } var str = "流程版本V(" + (self.FlowClass.Version == null ? "1" : self.FlowClass.Version) + ")"; if (self.FlowClass.IsUsing == null) { str += "设计"; } else if (self.FlowClass.IsUsing == 0) { str += "历史"; } else if (self.FlowClass.IsUsing == 1) { str += "启用中"; } str += ""; divInfo.innerHTML = str; divInfo.onclick = function (e) { var Menu = { "style": { "width": "200px", "max-height": "100%", "overflow-y": "scroll", }, "Items": [] }; for (var i = AllVersions.length - 1; i > -1; i--) { Menu.Items.push({ "style": { "height": "42px", "line-height": "22px", "padding": "10px 10px 10px 30px", "cursor": "pointer", "position": "relative" }, "Icon": "", "Text": "流程版本(" + AllVersions[i].Version + ")", "Enable": true, "Data": AllVersions[i], "CallBack": function () { window.location.href = "/" + CLCorpId() + "/View/Flow/FlowDesigner.cml?ID=" + this.Data.ID; }, "OnCreated": function (Item) { var Version = this.Data; var str = ""; if (Version.IsUsing == null) { str += "设计"; } else if (Version.IsUsing == 0) { str += "历史"; } else if (Version.IsUsing == 1) { str += "启用中"; } Item.innerHTML += str; Item.lastChild.style.cssFloat = "right"; if (Version.ID == self.FlowClass.ID) { var span = document.createElement("span"); span.style.cssText = "font-family:CLFont;color:#0db3a6;position:absolute;left:10px"; span.innerHTML = ""; Item.insertBefore(span, Item.firstChild); } } }); } var _CLMenu = new CLMenu(Menu, divInfo); } } var Btn = document.createElement("div"); Btn.className = "CLBtn"; Btn.style.height = "30px"; Btn.style.lineHeight = "30px"; Btn.style.width = "80px"; Btn.style.margin = "0 10px"; Btn.innerHTML = "保存"; Btn.onclick = function () { self.Save(); } divRight.appendChild(Btn); var useBtn = Btn.cloneNode(); useBtn.innerHTML = "启用流程"; divRight.appendChild(useBtn); useBtn.onclick = function () { self.Use(); } } fn.VersionInfoDialog = function () { var self = this; var divDlg = document.createElement("div"); divDlg.style.width = "560px"; divDlg.style.height = "415px"; divDlg.style.position = "relative"; var dlg = new CLDialog(divDlg); var textArea; dlg.CreateAll("版本描述", function () { self.FlowClass.VersionInfo = textArea.value; }); dlg.EnableMove(dlg.Header); var Body = dlg.Body; var Label = document.createElement("div"); Label.style.cssText = "margin-top:30px;height:30px;line-height:30px"; Label.innerHTML = "
版本号:
流程版本V(" + (self.FlowClass.Version == null ? "1" : self.FlowClass.Version) + ")"; Body.appendChild(Label); var Label1 = Label.cloneNode(); Label1.appendChild(Label.firstChild.cloneNode()); Label1.firstChild.innerHTML = "版本描述:"; Label1.firstChild.style.cssFloat = "left"; Body.appendChild(Label1); textArea = document.createElement("textarea"); textArea.style.cssText = "resize: none;width: 400px;height:190px;border:1px solid #e0e0e0;padding:10px"; textArea.value = self.FlowClass.VersionInfo == null ? "" : self.FlowClass.VersionInfo Label1.appendChild(textArea); } fn.ShowVersion = function () { } fn.ChangeTo = function (ID) { } fn.Use = function () { var Url = "/" + CLCorpId() + "/api/Flow.chx?Function=HttpUsingFlowClass"; var self = this; HttpPost(Url, function (Json) { if (Json.code == 0) { CLShowMsg(Json.msg, false); self.setData(Json.data); } else { CLShowMsg(Json.msg); } }, { ID: self.FlowClass.ID }); } fn.recordState = function () { if (this.Editable == false) { return; } this.Bar.recordState() } fn.undo = function () { if (this.Editable == false) { return; } this.Bar.undo() } fn.redo = function () { if (this.Editable == false) { return; } this.Bar.redo() } fn.setData = function (FlowClass) { var self = this; self.Container.innerHTML = ""; self.Canvas.firstChild.innerHTML = ""; if (FlowClass == null) { document.title = "流程设计器"; if (self.Editable != false) { self.FlowProp(); } return; } self.FlowClass = FlowClass; var Steps = FlowClass.Steps; var divSteps = []; document.title = self.Editable ? (FlowClass.Name + " | 流程设计") : FlowClass.Name; self.EleContainer.SetScale(FlowClass.Scale == null ? 1 : FlowClass.Scale); self.EleContainer.SetPos(FlowClass.leftX, FlowClass.topY); self.StartStep = null; for (var i = 0; i < Steps.length; i++) { var divStep = self.createStep(Steps[i]); if (Steps[i].Type == 0) { self.StartStep = Steps[i]; } divSteps.push(divStep); } for (var i = 0; i < divSteps.length; i++) { var ToID = divSteps[i].Step.ToID; var ToIDPos = divSteps[i].Step.ToIDPos; if (ToIDPos == null) { ToIDPos = { }; } for (var j = 0; j < ToID.length; j++) { for (var x = 0; x < divSteps.length; x++) { if (divSteps[x].Step.ID == ToID[j]) { var Pos = ToIDPos[ToID[j]]; Pos = Pos == null ? {} : Pos; self.connectStep(divSteps[i], Pos.start, divSteps[x], Pos.end); } } } } if (self.Editable != false) { self.FlowProp(); } self.recordState(); self.ShowVersion(); } fn.getData = function () { var self = this; var Steps = self.FlowClass.Steps = []; var divSteps = self.Container.getElementsByClassName("Step"); for (var i = 0; i < divSteps.length; i++) { Steps.push(divSteps[i].Step); } return self.FlowClass; } fn.createStep = function (Step) { var self = this; function EnableDrag(circle) { var FromX = 0; var FromY = 0; var istartType = 0; var startStep = null; CLEnableMove(circle, function (circle) { FromX = circle.Left + 4 + circle.parentNode.offsetLeft; FromY = circle.Top + 4 + circle.parentNode.offsetTop; istartType = circle.iPos; startStep = circle.parentNode; }, function (circle) { var EndX = circle.Pos.X + 4 + circle.parentNode.offsetLeft; var EndY = circle.Pos.Y + 4 + circle.parentNode.offsetTop; var iEndType = null; var Pos = self.TestStepPos(EndX, EndY); if (Pos != null) { EndX = Pos.X; EndY = Pos.Y; iEndType = Pos.Type; } else { iEndType = istartType; } var Line = self.CalcLine({ X: FromX, Y: FromY }, istartType, { X: EndX, Y: EndY }, iEndType, Pos != null && circle.parentNode == Pos.divStep); Line.ID = "tempLine"; self.DrawLine(Line, true, iEndType); return false; }, function (circle) { self.DeleteLine("tempLine"); var EndX = circle.Pos.X + 5 + circle.parentNode.offsetLeft; var EndY = circle.Pos.Y + 5 + circle.parentNode.offsetTop; var Pos = self.TestStepPos(EndX, EndY); if (Pos != null && startStep != null) { self.connectStep(startStep, istartType, Pos.divStep, Pos.Type); self.recordState(); } return false; }); } var divStep = document.createElement("div"); divStep.className = "Step"; divStep.style.height = "50px"; divStep.style.lineHeight = "48px"; divStep.style.cursor = "default"; Object.defineProperty(divStep, "Scale", { get: function () { return divStep.parentNode.Scale } }); var circleL = divStep.circleL = document.createElement("div"); circleL.className = "Circle Circle0"; circleL.style.left = "-4px"; circleL.Left = -5; Object.defineProperty(circleL, "Top", { get: function () { return (divStep.offsetHeight >> 1) - 4; } }); circleL.style.top = "calc(50% - 4px)"; circleL.iPos = 0; divStep.appendChild(circleL); if (self.Editable != false) { EnableDrag(circleL); } var circleT = divStep.circleT = circleL.cloneNode(); circleT.className = "Circle Circle1"; circleT.style.left = "calc(50% - 4px)"; circleT.style.top = "-4px"; circleT.Top = -5; Object.defineProperty(circleT, "Left", { get: function () { return (divStep.offsetWidth >> 1) - 4; } }); circleT.iPos = 1; if (self.Editable != false) { EnableDrag(circleT); } divStep.appendChild(circleT); var circleR = divStep.circleR = circleL.cloneNode(); circleR.className = "Circle Circle2"; circleR.style.top = "calc(50% - 4px)"; circleR.style.left = "calc(100% - 4px)"; Object.defineProperty(circleR, "Left", { get: function () { return (divStep.offsetWidth) - 3; } }); Object.defineProperty(circleR, "Top", { get: function () { return (divStep.offsetHeight >> 1) - 4; } }); circleR.iPos = 2; if (self.Editable != false) { EnableDrag(circleR); } divStep.appendChild(circleR); var circleB = divStep.circleB = circleL.cloneNode(); circleB.className = "Circle Circle3"; circleB.style.top = "calc(100% - 4px)"; circleB.style.left = "calc(50% - 4px)"; Object.defineProperty(circleB, "Left", { get: function () { return (divStep.offsetWidth >> 1) - 4; } }); Object.defineProperty(circleB, "Top", { get: function () { return (divStep.offsetHeight) - 3; } }); circleB.iPos = 3; if (self.Editable != false) { EnableDrag(circleB); } divStep.appendChild(circleB); if (Step == null) { return divStep; } divStep.Step = Step; divStep.classList.add(Step.ID); divStep.classList.add("Step" + Step.Type); divStep.style.left = Step.PosLeft + "px"; divStep.style.top = Step.PosTop + "px"; var sIcon = Icons[Step.Type]; var sName = Step.Name; var Node = document.createElement("div"); var icon = document.createElement("span"); icon.className = "Icon"; var colors = ["#0db3a6", "#0db3a6", "#178cdf", "#E64340", "#1f2d3d;", "#0db3a6", "#0db3a6"]; icon.style.color = colors[Step.Type]; icon.innerHTML = sIcon; Node.className = "Move"; Node.appendChild(icon); var Name = document.createElement("span"); Name.className = "Name"; Name.innerHTML = sName; Node.Type = 0; Node.appendChild(Name); divStep.appendChild(Node); if (self.Editable != false) { divStep.onmousedown = function (e) { self.SelectStep(Step.ID); } CLEnableMove(divStep, function () { }, function () { var AlignPos = self.Align(divStep); if (AlignPos.Left != null) { divStep.style.left = AlignPos.Left + "px"; } if (AlignPos.Top != null) { divStep.style.top = AlignPos.Top + "px"; } //画线 self.ReDrawLine(divStep); divStep.Step.PosLeft = divStep.offsetLeft; divStep.Step.PosTop = divStep.offsetTop; }, function () { self.clearAlign(); self.recordState(); }); } self.Container.appendChild(divStep); self.onStepCreated(divStep); if ((Step.Type == 4 || Step.Type == 5) && self.Editable != false) { divStep.oncontextmenu = function () { var Menu = { "style": { "width": divStep.offsetWidth * self.EleContainer.GetScale() + "px", "max-height": "100%", "overflow-y": "auto", }, "Items": [ { "style": {}, "Icon": "", "Text": "设计", "Enable": true, "CallBack": function (e) { if (Step.FlowClassID != null) { window.open("/" + CLCorpId() + "/View/Flow/FlowDesigner.cml?ID=" + Step.FlowClassID); } else { CLShowMsg("还没有选择关联流程"); } } }, { "style": {}, "Icon": "", "Text": "复制", "Enable": true, "CallBack": function (e) { var data = CLClone(Step); data.ID = CLMakeId(); data.ToID = []; data.ToIDCase = {}; data.ToIDPos = {}; data.ToIDSms = {}; data.PosLeft += 100; self.createStep(data); } }, { "style": {}, "Icon": "", "Text": "删除", "Enable": true, "CallBack": function (e) { self.DeleteStep(Step.ID); } } ] } new CLMenu(Menu, divStep); var box = document.body.lastChild; return false; } } else if(self.Editable != false) { divStep.oncontextmenu = function () { var Menu = { "style": { "width": divStep.offsetWidth * self.EleContainer.GetScale() + "px", "max-height": "100%", "overflow-y": "auto", }, "Items": [ { "style": {}, "Icon": "", "Text": "预览", "Enable": true, "CallBack": function (e) { if (self.FlowClass.FormsID != null) { FlowCoreEx.ShowForm(self.FlowClass.FormsID, Step.DataFields, Step.TplUse); } _CLMenu.Close(); } }, { "style": {}, "Icon": "", "Text": "复制", "Enable": Step.Type != 0, "CallBack": function (e) { var data = CLClone(Step); data.ID = CLMakeId(); data.ToID = []; data.ToIDCase = {}; data.ToIDPos = {}; data.ToIDSms = {}; data.PosLeft += 100; self.createStep(data); } }, { "style": {}, "Icon": "", "Text": "删除", "Enable": true, "CallBack": function (e) { self.DeleteStep(Step.ID); } } ] } var _CLMenu = new CLMenu(Menu, divStep); var box = document.body.lastChild; return false; } } return divStep; } fn.connectStep = function (startStep, iStartType, endStep, iEndType) { var self = this; var startPos = { X: 0, Y: 0 }; var endPos = { X: 0, Y: 0 }; iStartType = iStartType == null ? 0 : iStartType; iEndType = iEndType == null ? 1 : iEndType; var ToIDPos = startStep.Step.ToIDPos; if (!ToIDPos) { ToIDPos = startStep.Step.ToIDPos = { }; ToIDPos[endStep.Step.ID] = { start: iStartType, end: iEndType } } var Pos = ToIDPos[endStep.Step.ID]; if (!Pos) { Pos = ToIDPos[endStep.Step.ID] = { start: iStartType, end: iEndType } } var circle = startStep.getElementsByClassName("Circle" + iStartType)[0]; startPos.X = circle.Left + 4 + circle.parentNode.offsetLeft; startPos.Y = circle.Top + 4 + circle.parentNode.offsetTop; if (Pos.SOffX) { startPos.X += Pos.SOffX; } if (Pos.SOffY) { startPos.Y += Pos.SOffY; } circle = endStep.getElementsByClassName("Circle" + iEndType)[0]; endPos.X = circle.Left + 4 + circle.parentNode.offsetLeft; endPos.Y = circle.Top + 4 + circle.parentNode.offsetTop; if (Pos.EOffX) { endPos.X += Pos.EOffX; } if (Pos.EOffY) { endPos.Y += Pos.EOffY; } var Line = self.CalcLine(startPos, iStartType, endPos, iEndType, startStep == endStep); Line.ID = startStep.Step.ID + "_" + endStep.Step.ID; self.DrawLine(Line, true, iEndType); if (startStep.ToSteps == null) { startStep.ToSteps = []; } if (endStep.PreSteps == null) { endStep.PreSteps = []; } startStep.ToSteps.push(endStep); endStep.PreSteps.push(startStep); if (startStep.Step.ToID.indexOf(endStep.Step.ID) < 0) { startStep.Step.ToID.push(endStep.Step.ID); } self.onStepConnected(startStep, iStartType, endStep, iEndType); } fn.StepSel = null; fn.updateStepName = function (Step) { var self = this; var divStep = self.Container.getElementsByClassName(Step.ID)[0]; if (divStep != null) { divStep.getElementsByClassName("Name")[0].innerText = Step.Name; self.ReDrawLine(divStep); } } fn.updateLineDesc = function (LineID) { var self = this; var IDs = LineID.split("_"); var Step = self.getElementById(IDs[0]).Step; var Pos = Step.ToIDPos[IDs[1]]; self.DrawLine(self.Lines[LineID], true, Pos.end); } fn.SelectStep = function (StepID) { var self = this; if (self.StepSel == StepID) { return; } var divStep; if (self.StepSel != null) { divStep = self.Container.getElementsByClassName(self.StepSel)[0]; divStep.classList.remove("StepSel"); self.StepSel = null; } divStep = self.Container.getElementsByClassName(StepID)[0]; if (divStep != null) { self.StepSel = StepID; divStep.classList.add("StepSel"); self.OnStepSelected(divStep.Step); } } fn.ReDrawLine = function (moveStep) { var self = this; var PreSteps = moveStep.PreSteps; var ToSteps = moveStep.ToSteps; var startPos = { X: 0, Y: 0 }; var endPos = { X: 0, Y: 0 }; for (var i = 0; PreSteps != null && i < PreSteps.length; i++) { var Pos = PreSteps[i].Step.ToIDPos[moveStep.Step.ID]; var circle = PreSteps[i].getElementsByClassName("Circle" + Pos.start)[0]; startPos.X = circle.Left + 4 + circle.parentNode.offsetLeft; startPos.Y = circle.Top + 4 + circle.parentNode.offsetTop; if (Pos.SOffX) { startPos.X += Pos.SOffX; } if (Pos.SOffY) { startPos.Y += Pos.SOffY; } circle = moveStep.getElementsByClassName("Circle" + Pos.end)[0]; endPos.X = circle.Left + 4 + circle.parentNode.offsetLeft; endPos.Y = circle.Top + 4 + circle.parentNode.offsetTop; if (Pos.EOffX) { endPos.X += Pos.EOffX; } if (Pos.EOffY) { endPos.Y += Pos.EOffY; } var Line = self.CalcLine(startPos, Pos.start, endPos, Pos.end, PreSteps[i] == moveStep); Line.ID = PreSteps[i].Step.ID + "_" + moveStep.Step.ID; self.DrawLine(Line, false, Pos.end); } for (var i = 0; ToSteps != null && i < ToSteps.length; i++) { var Pos = moveStep.Step.ToIDPos[ToSteps[i].Step.ID]; var circle = moveStep.getElementsByClassName("Circle" + Pos.start)[0]; startPos.X = circle.Left + 4 + circle.parentNode.offsetLeft; startPos.Y = circle.Top + 4 + circle.parentNode.offsetTop; if (Pos.SOffX) { startPos.X += Pos.SOffX; } if (Pos.SOffY) { startPos.Y += Pos.SOffY; } circle = ToSteps[i].getElementsByClassName("Circle" + Pos.end)[0]; endPos.X = circle.Left + 4 + circle.parentNode.offsetLeft; endPos.Y = circle.Top + 4 + circle.parentNode.offsetTop; if (Pos.EOffX) { endPos.X += Pos.EOffX; } if (Pos.EOffY) { endPos.Y += Pos.EOffY; } var Line = self.CalcLine(startPos, Pos.start, endPos, Pos.end, moveStep == ToSteps[i]); Line.ID = moveStep.Step.ID + "_" + ToSteps[i].Step.ID; self.DrawLine(Line, false, Pos.end); } self.ShowLine(); } //回调接口 fn.onStepConnected = function (startStep, iStartType, endStep, iEndType) { } //回调接口 fn.onStepCreated = function () { } //回调接口(已实现) fn.OnLineSelected = function (Line) { var self = this; self.SelectStep(); self.LineProp(Line.ID); var moveS = Line.moveS; var moveE = Line.moveE; var IDs = Line.ID.split("_"); if (!moveS) { Line.moveS = moveS = document.createElement("div"); moveS.className = "LMove"; moveS.onselectstart = function () { return false; } (function () { var Step = self.getElementById(IDs[0]).Step; var ToIDPos = Step.ToIDPos[IDs[1]]; var X = 0, Y = 0; CLEnableMove(moveS, function (ele, e) { return true; }, function (ele, e) { X = e.clientX; Y = e.clientY; var Pos = ele.Pos; Pos = { X: Pos.X, Y: Pos.Y }; var Info = self.CalcTypeAndOffset(Step, Pos.X, Pos.Y); ToIDPos.start = Info.Type; ToIDPos.SOffX = Info.OffX; ToIDPos.SOffY = Info.OffY; self.ReDrawLine(self.getElementById(IDs[0])); Line = self.Lines[Line.ID]; ele.style.top = Line[0].Y - 4 + "px"; ele.style.left = Line[0].X - 4 + "px"; return true; }, function (ele) { return true; }, moveS); }()); } if (!moveE) { Line.moveE = moveE = document.createElement("div"); moveE.className = "LMove"; moveE.onselectstart = function () { return false; } (function () { var Step = self.getElementById(IDs[0]).Step; var ToIDPos = Step.ToIDPos[IDs[1]]; var X = 0, Y = 0; CLEnableMove(moveE, function (ele, e) { return true; }, function (ele, e) { X = e.clientX; Y = e.clientY; var Pos = ele.Pos; Pos = { X: Pos.X, Y: Pos.Y }; var Info = self.CalcTypeAndOffset(self.getElementById(IDs[1]).Step, Pos.X, Pos.Y); ToIDPos.end = Info.Type; ToIDPos.EOffX = Info.OffX; ToIDPos.EOffY = Info.OffY; self.ReDrawLine(self.getElementById(IDs[1])); Line = self.Lines[Line.ID]; ele.style.top = Line[Line.length - 1].Y - 4 + "px"; ele.style.left = Line[Line.length - 1].X - 4 + "px"; return true; }, function (ele) { return true; }, moveE); }()); } moveS.style.top = Line[0].Y - 4 + "px"; moveS.style.left = Line[0].X - 4 + "px"; self.Container.appendChild(moveS); moveE.style.top = Line[Line.length - 1].Y - 4 + "px"; moveE.style.left = Line[Line.length - 1].X - 4 + "px"; self.Container.appendChild(moveE); } //回调接口(已实现) fn.OnLineLost = function (Line) { var self = this; if (Line.moveS) { Line.moveS.remove(); } if (Line.moveE) { Line.moveE.remove(); } } //回调接口(已实现) fn.OnStepSelected = function (Step) { var self = this; self.SelectLine(); self.StepProp(Step); } fn.CalcTypeAndOffset = function (Step, X, Y) { var self = this; var Left = Step.PosLeft; var Top = Step.PosTop; var Width = 150; var Height = 50; var Type = 0; var Llist = [ (function () { if (Y >= Top && Y <= Top + Height) { return Math.sqrt(Math.pow(Left - X, 2)); } else { if (Y < Top) { return Math.sqrt(Math.pow(Left - X, 2) + Math.pow(Top - Y, 2)); } else { return Math.sqrt(Math.pow(Left - X, 2) + Math.pow(Top + Height - Y, 2)); } } }()), (function () { if (X >= Left && X <= Left + Width) { return Math.sqrt(Math.pow(Top - Y, 2)); } else { if (X < Left) { return Math.sqrt(Math.pow(Left - X, 2) + Math.pow(Top - Y, 2)); } else { return Math.sqrt(Math.pow(Left + Width - X, 2) + Math.pow(Top - Y, 2)); } } }()), (function () { if (Y >= Top && Y <= Top + Height) { return Math.sqrt(Math.pow(Left + Width - X, 2)); } else { if (Y < Top) { return Math.sqrt(Math.pow(Left + Width - X, 2) + Math.pow(Top - Y, 2)); } else { return Math.sqrt(Math.pow(Left + Width - X, 2) + Math.pow(Top + Height - Y, 2)); } } }()), (function () { if (X >= Left && X <= Left + Width) { return Math.sqrt(Math.pow(Top + Height - Y, 2)); } else { if (X < Left) { return Math.sqrt(Math.pow(Left - X, 2) + Math.pow(Top + Height - Y, 2)); } else { return Math.sqrt(Math.pow(Left + Width - X, 2) + Math.pow(Top + Height - Y, 2)); } } }()) ]; var L = 0x7fffffff; for (var i = 0; i < 4; i++) { if (L > Llist[i]) { Type = i; L = Llist[i]; } } var Plist = [ { X: Left, Y: Top + Height / 2 }, { X: Left + Width / 2, Y: Top }, { X: Left + Width, Y: Top + Height / 2 }, { X: Left + Width / 2, Y: Top + Height }, ]; var OffX = 0; var OffY = 0; var P = Plist[Type]; if (Type % 2) { OffX = X - P.X; if (OffX > Width / 2) { OffX = Width / 2; } if (OffX < -Width / 2) { OffX = -Width / 2; } } else { OffY = Y - P.Y; if (OffY > Height / 2) { OffY = Height / 2; } if (OffY < -Height / 2) { OffY = -Height / 2; } } if (OffX > -2 && OffX < 2) { OffX = 0; } if (OffY > -2 && OffY < 2) { OffY = 0; } return { Type: Type, OffX: OffX, OffY: OffY }; } fn.clearAlign = function () { var self = this; var Aligns = self.Container.getElementsByClassName("Align"); for (var i = 0; i < Aligns.length; i++) { Aligns[i].remove(); i--; } } fn.Align = function (Step) { var self = this; var Rect = { Left: Step.offsetLeft, Top: Step.offsetTop }; var AlignPos = {}; var Steps = self.Container.getElementsByClassName("Step"); for (var i = 0; i < Steps.length; i++) { if (Step == Steps[i]) { continue; } if (Rect.Top >= Steps[i].offsetTop - 10 && Rect.Top <= Steps[i].offsetTop + 10) { AlignPos.Top = Steps[i].offsetTop; AlignPos.TopSteps = [Step]; for (var j = 0; j < Steps.length; j++) { if (Steps[j].offsetTop == AlignPos.Top) { AlignPos.TopSteps.push(Steps[j]); } } } if (Rect.Left >= Steps[i].offsetLeft - 10 && Rect.Left <= Steps[i].offsetLeft + 10) { AlignPos.Left = Steps[i].offsetLeft; AlignPos.LeftSteps = [Step]; for (var j = 0; j < Steps.length; j++) { if (Steps[j].offsetLeft == AlignPos.Left) { AlignPos.LeftSteps.push(Steps[j]); } } } } self.clearAlign(); if (AlignPos.Top != null) { CLQuickSort(AlignPos.TopSteps, function (ele1, ele2) { if (ele1.offsetLeft < ele2.offsetLeft) { return -1; } if (ele1.offsetLeft == ele2.offsetLeft) { return 0; } if (ele1.offsetLeft > ele2.offsetLeft) { return 1; } }) var div = document.createElement("div"); div.className = "Align"; div.style.position = "absolute"; div.style.left = AlignPos.TopSteps[0].offsetLeft + AlignPos.TopSteps[0].offsetWidth + "px"; div.style.width = AlignPos.TopSteps[AlignPos.TopSteps.length - 1].offsetLeft - (AlignPos.TopSteps[0].offsetLeft + AlignPos.TopSteps[0].offsetWidth) + "px"; div.style.height = "1px"; div.style.borderBottom = "1px dashed #E64340"; div.style.top = AlignPos.Top + "px"; self.Container.appendChild(div); div = div.cloneNode(); div.style.top = AlignPos.Top + Step.offsetHeight + "px"; self.Container.appendChild(div); } if (AlignPos.Left != null) { CLQuickSort(AlignPos.LeftSteps, function (ele1, ele2) { if (ele1.offsetTop < ele2.offsetTop) { return -1; } if (ele1.offsetTop == ele2.offsetTop) { return 0; } if (ele1.offsetTop > ele2.offsetTop) { return 1; } }) var div = document.createElement("div"); div.className = "Align"; div.style.position = "absolute"; div.style.left = AlignPos.Left + "px"; div.style.width = "1px"; div.style.top = AlignPos.LeftSteps[0].offsetTop + AlignPos.LeftSteps[0].offsetHeight + "px"; div.style.height = AlignPos.LeftSteps[AlignPos.LeftSteps.length - 1].offsetTop - (AlignPos.LeftSteps[0].offsetTop + AlignPos.LeftSteps[0].offsetHeight) + "px"; div.style.borderLeft = "1px dashed #E64340"; self.Container.appendChild(div); div = div.cloneNode(); div.style.left = AlignPos.Left + Step.offsetWidth + "px"; self.Container.appendChild(div); } return AlignPos; } fn.TestStepPos = function (X, Y) { var self = this; var Steps = self.Container.getElementsByClassName("Step"); var Pos = null; var divStep = null; for (var i = 0; i < Steps.length ; i++) { divStep = Steps[i]; if (X > divStep.offsetLeft && X < divStep.offsetLeft + divStep.offsetWidth / 3 && Y > divStep.offsetTop && Y < divStep.offsetTop + divStep.offsetHeight) { //左边 Pos = { Type: 0 } break; } if (X > divStep.offsetLeft + divStep.offsetWidth - divStep.offsetWidth / 3 && X < divStep.offsetLeft + divStep.offsetWidth && Y > divStep.offsetTop && Y < divStep.offsetTop + divStep.offsetHeight) { //右边 Pos = { Type: 2 } break; } if (Y > divStep.offsetTop && Y < divStep.offsetTop + 25 && X >= divStep.offsetLeft + divStep.offsetWidth / 3 && X <= divStep.offsetLeft + divStep.offsetWidth * 2 / 3) { //上边 Pos = { Type: 1 } break; } if (Y > divStep.offsetTop + 25 && Y < divStep.offsetTop + divStep.offsetHeight && X >= divStep.offsetLeft + divStep.offsetWidth / 3 && X <= divStep.offsetLeft + divStep.offsetWidth * 2 / 3) { //下边 Pos = { Type: 3 } break; } } if (Pos != null) { var circle = divStep.getElementsByClassName("Circle" + Pos.Type)[0]; Pos.X = circle.Left + 4 + circle.parentNode.offsetLeft; Pos.Y = circle.Top + 4 + circle.parentNode.offsetTop; Pos.divStep = divStep; } return Pos; } fn.Lines = {}; fn.LineSel = null; fn.LineColor = "#0db3a6"; fn.LineSelColor = "#2991ff"; fn.LineHoverColor = fn.LineSelColor; fn.CalcLine = function (StartPos, iStartType, EndPos, iEndType, bSelf) { var self = this; var Line = []; Line.Length = function () { var lenth = 0; for (var i = 0; i < Line.length - 1 ; i++) { var Vx = Line[i + 1].X - Line[i].X; var Vy = Line[i + 1].Y - Line[i].Y; var rect = { X: Vx > 0 ? Line[i].X - 3 : Line[i + 1].X - 3, Y: Vy > 0 ? Line[i].Y - 3 : Line[i + 1].Y - 3, Width: Vx > -6 && Vx < 6 ? 6 : (Vx < 0 ? -Vx : Vx), Height: Vy > -6 && Vy < 6 ? 6 : (Vy < 0 ? -Vy : Vy) }; lenth += (rect.Width > rect.Height ? rect.Width : rect.Height); } return lenth; } Line.push({ X: StartPos.X, Y: StartPos.Y }); var vEnd = [2, 3, 0, 1]; var Vx = [-1, 0, 1, 0]; var Vy = [0, -1, 0, 1]; function startV(iType) { return { X: Vx[iType], Y: Vy[iType] } } function endV(iType) { return startV(vEnd[iType]); } var V0 = { X: EndPos.X - StartPos.X, Y: EndPos.Y - StartPos.Y } var Vs = startV(iStartType); if (V0.X * V0.Y == 0) { if (bSelf && V0.X == 0) { //上下方向 Line.push({ X: StartPos.X, Y: StartPos.Y + 20 * Vs.Y }); Line.push({ X: StartPos.X - 95, Y: StartPos.Y + 20 * Vs.Y }); Line.push({ X: StartPos.X - 95, Y: EndPos.Y - 20 * Vs.Y }); Line.push({ X: StartPos.X, Y: EndPos.Y - 20 * Vs.Y }); } if (bSelf && V0.Y == 0) { //左右方向 Line.push({ X: StartPos.X + 20 * Vs.X, Y: StartPos.Y }); Line.push({ X: StartPos.X + 20 * Vs.X, Y: StartPos.Y - 40 }); Line.push({ X: EndPos.X - 20 * Vs.X, Y: StartPos.Y - 40 }); Line.push({ X: EndPos.X - 20 * Vs.X, Y: StartPos.Y }); } //方向位于坐标轴上 Line.push({ X: EndPos.X, Y: EndPos.Y }); return Line; } //起始向量1/4定位;起始向量与V0向量的夹角大于90度时执行 var ValS = V0.X * Vs.X + V0.Y * Vs.Y; if (iEndType == null && ValS < 0) { iEndType = iStartType; } else if (iEndType == null) { iEndType = vEnd[iStartType]; } var Ve = endV(iEndType); var ValE = V0.X * Ve.X + V0.Y * Ve.Y; var ValSE = Vs.X * Ve.X + Vs.Y * Ve.Y; if (ValS < 0) { var X = StartPos.X; var Y = StartPos.Y; if (Vs.X == 0) { Y += 20 * Vs.Y; Line.push({ X: X, Y: Y }); if (ValSE != 0) { X += ValE < 0 && ValSE != 0 ? V0.X >> 1 : V0.X; Line.push({ X: X, Y: Y }); } else if (ValE > 0) { X += V0.X >> 1; Line.push({ X: X, Y: Y }); Line.push({ X: X, Y: V0.Y + StartPos.Y }); } } else { X += 20 * Vs.X; Line.push({ X: X, Y: Y }); if (ValSE != 0) { Y += ValE < 0 && ValSE != 0 ? V0.Y >> 1 : V0.Y; Line.push({ X: X, Y: Y }); } else if (ValE > 0) { Y += V0.Y >> 1; Line.push({ X: X, Y: Y }); Line.push({ X: V0.X + StartPos.X, Y: Y }); } } } else if (ValSE == 0) { if (ValE < 0) { Line.push({ X: StartPos.X + (V0.X * (Vs.X == 0 ? 0 : 1) >> 1), Y: StartPos.Y + (V0.Y * (Vs.Y == 0 ? 0 : 1) >> 1) }); } else { Line.push({ X: StartPos.X + V0.X * (Vs.X == 0 ? 0 : 1), Y: StartPos.Y + V0.Y * (Vs.Y == 0 ? 0 : 1) }); } } else if (ValE > 0 && ValSE > 0) { var X = StartPos.X + (V0.X * (Vs.X == 0 ? 0 : 1) >> 1); var Y = StartPos.Y + (V0.Y * (Vs.Y == 0 ? 0 : 1) >> 1); Line.push({ X: X, Y: Y }); X = EndPos.X - ((Ve.X == 0 ? 0 : 1) * V0.X >> 1); Y = EndPos.Y - ((Ve.Y == 0 ? 0 : 1) * V0.Y >> 1); Line.push({ X: X, Y: Y }); } //终止向量1/4定位;终止向量与V0向量的夹角小于于90度时执行 if (ValE < 0) { var X = EndPos.X; var Y = EndPos.Y; if (Ve.X == 0) { if (ValS > 0 && ValSE != 0) { X -= V0.X; } else if (ValS < 0 && ValSE == 0) { X -= V0.X - 20 * Vs.X; } else { X -= V0.X >> 1 } Y -= 20 * Ve.Y; Line.push({ X: X, Y: Y }); Line.push({ X: EndPos.X, Y: Y }); } else { if (ValS > 0 && ValSE != 0) { Y -= V0.Y; } else if (ValS < 0 && ValSE == 0) { Y -= V0.Y - 20 * Vs.Y; } else { Y -= V0.Y >> 1 } X -= 20 * Ve.X; Line.push({ X: X, Y: Y }); Line.push({ X: X, Y: EndPos.Y }); } } Line.push({ X: EndPos.X, Y: EndPos.Y }); return Line; } function TextWidth(text, cssText) { var span = document.createElement("span"); span.style.cssText = cssText; span.innerHTML = text; document.body.appendChild(span); var R = span.offsetWidth; span.remove(); return R; } fn.DrawLine = function (Line, bShow, iEndType) { var self = this; var svg = self.Canvas.firstChild; var g = svg.getElementsByClassName(Line.ID)[0]; var pathLine; var pathArrow; var text; var IDs = Line.ID.split("_"); var ele = self.Container.getElementsByClassName(IDs[0])[0]; var Step = ele == null ? null : ele.Step; var aligns = { "左": "start", "中": "middle", "右": "end" } var Desc = Step == null || Step.ToIDDesc == null || Step.ToIDDesc[IDs[1]] == null ? "" : Step.ToIDDesc[IDs[1]]; var descValue = typeof Desc == "string" ? Desc : Desc.Value; var alignValue = typeof Desc == "string" ? "middle" : aligns[Desc.Align]; if (self.Lines[Line.ID]) { Line.moveS = self.Lines[Line.ID].moveS; Line.moveE = self.Lines[Line.ID].moveE; } var Ns = "http://www.w3.org/2000/svg"; self.Lines[Line.ID] = Line; if (g == null) { g = document.createElementNS(Ns, "g"); g.classList.add(Line.ID); g.setAttributeNS(Ns, "id", Line.ID); g.classList.add("Line"); svg.appendChild(g); pathLine = document.createElementNS(Ns, "path"); pathLine.setAttributeNS(Ns, "id", "Line_" + Line.ID); pathLine.setAttribute("stroke", self.LineColor); pathLine.setAttribute("stroke-width", "2"); pathLine.setAttribute("fill", "#000"); pathLine.setAttribute("fill-opacity", "0"); g.appendChild(pathLine); text = document.createElement("text"); text.setAttribute("dominant-baseline", "middle"); text.setAttribute("fill", "#909"); text.setAttribute("font-size", "10"); text.setAttribute("font-weight", "900"); g.appendChild(text); var pathArrow = document.createElementNS(Ns, "path"); pathArrow.setAttribute("stroke", self.LineColor); pathArrow.setAttribute("stroke-width", "2"); pathArrow.setAttribute("fill", "#fff"); pathArrow.setAttribute("fill-opacity", "0"); pathArrow.style.pointerEvents = "initial"; g.appendChild(pathArrow); } else { pathLine = g.firstChild; pathArrow = g.lastChild; text = pathLine.nextSibling; } if (Line.ID == self.LineSel) { pathLine.setAttribute("stroke", self.LineSelColor); pathArrow.setAttribute("stroke", self.LineSelColor); } text.setAttribute("text-anchor", alignValue); var offset = "50%"; if (alignValue == "start") { offset = "5"; } if (alignValue == "end") { offset = Line.Length() - 10; } text.setAttribute("textLength", TextWidth(descValue, "font-size:10px;font-weight:900") + "px"); text.innerHTML = ""; var textPath = document.createElementNS("http://www.w3.org/2000/svg", "textPath"); textPath.setAttribute("xlink:href", "#Line_" + Line.ID); textPath.setAttribute("startOffset", offset); textPath.innerHTML = descValue; text.appendChild(textPath); var listArrow = [ //右 [{ X: -6, Y: -6 }, { X: -6, Y: 6 }], //下 [{ X: -6, Y: -6 }, { X: 6, Y: -6 }], //左 [{ X: 6, Y: -6 }, { X: 6, Y: 6 }], //上 [{ X: -6, Y: 6 }, { X: 6, Y: 6 }], ]; var listA = [ "a3 3 0 0 1 3 3",//右下(Va1.X > 0 && Va2.Y > 0), "a3 3 0 0 0 3 -3",//右上(Va1.X > 0 && Va2.Y < 0), "a3 3 0 0 0 -3 3",//左下(Va1.X < 0 && Va2.Y > 0), "a3 3 0 0 1 -3 -3",//左上(Va1.X < 0 && Va2.Y < 0), "a3 3 0 0 0 3 3",//下右 (Va1.Y > 0 && Va2.X > 0) "a3 3 0 0 1 -3 3",//下左 (Va1.Y > 0 && Va2.X < 0) "a3 3 0 0 1 3 -3",//上右 (Va1.Y < 0 && Va2.X > 0) "a3 3 0 0 0 -3 -3"//上左 (Va1.Y < 0 && Va2.X < 0) ]; var d = ""; d += "M" + Line[0].X + "," + Line[0].Y; for (var j = 1; j < Line.length - 1; j++) { var Va1 = { X: Line[j].X - Line[j - 1].X, Y: Line[j].Y - Line[j - 1].Y } var Va2 = { X: Line[j + 1].X - Line[j].X, Y: Line[j + 1].Y - Line[j].Y } var A = ""; var X = Line[j].X; var Y = Line[j].Y; if (Va1.X > 0 && Va2.Y > 0) { A = listA[0]; X -= 3; } if (Va1.X > 0 && Va2.Y < 0) { A = listA[1]; X -= 3; } if (Va1.X < 0 && Va2.Y > 0) { A = listA[2]; X += 3; } if (Va1.X < 0 && Va2.Y < 0) { A = listA[3]; X += 3; } if (Va1.Y > 0 && Va2.X > 0) { A = listA[4]; Y -= 3; } if (Va1.Y > 0 && Va2.X < 0) { A = listA[5]; Y -= 3; } if (Va1.Y < 0 && Va2.X > 0) { A = listA[6]; Y += 3; } if (Va1.Y < 0 && Va2.X < 0) { A = listA[7]; Y += 3; } d += "L" + X + "," + Y + A; } d += "L" + Line[Line.length - 1].X + "," + Line[Line.length - 1].Y; pathLine.setAttribute("d", d); var V0 = Line[Line.length - 1]; var Da = "M" + (V0.X + listArrow[iEndType][0].X) + " " + (V0.Y + listArrow[iEndType][0].Y); Da += "L" + V0.X + " " + V0.Y; Da += "L" + (V0.X + listArrow[iEndType][1].X) + " " + (V0.Y + listArrow[iEndType][1].Y); pathArrow.setAttribute("d", Da); if (bShow != false) { self.Canvas.innerHTML = svg.outerHTML; } } fn.DeleteLine = function (ID) { var self = this; var svg = self.Canvas.firstChild; var gLine = svg.getElementsByClassName(ID)[0]; if (gLine != null) { if (ID.indexOf("_") > 0) { var IDs = ID.split("_"); var divStep = self.Container.getElementsByClassName(IDs[0])[0]; if (divStep != null) { var toStep = self.Container.getElementsByClassName(IDs[1])[0]; divStep.ToSteps.splice(divStep.ToSteps.indexOf(toStep), 1) toStep.PreSteps.splice(toStep.PreSteps.indexOf(divStep), 1) self.onStepDisConnected(divStep.Step, IDs[1]); } } var Line = self.Lines[ID]; if (Line.moveS) { Line.moveS.remove(); } if (Line.moveE) { Line.moveE.remove(); } delete self.Lines[ID]; gLine.remove(); self.recordState(); } } fn.DeleteStep = function (ID) { var self = this; var divStep = self.Container.getElementsByClassName(ID)[0]; var Step = divStep.Step; var ToSteps = divStep.ToSteps; if (Step == self.StartStep) { self.StartStep = null; } for (var i = 0; ToSteps != null && i < ToSteps.length; i++) { self.getElementById(Step.ID + "_" + ToSteps[i].Step.ID).remove(); ToSteps[i].PreSteps.splice(ToSteps[i].PreSteps.indexOf(divStep)); } var PreSteps = divStep.PreSteps; for (var i = 0; PreSteps != null && i < PreSteps.length; i++) { self.getElementById(PreSteps[i].Step.ID + "_" + divStep.Step.ID).remove(); PreSteps[i].ToSteps.splice(PreSteps[i].ToSteps.indexOf(divStep)); self.onStepDisConnected(PreSteps[i].Step, Step.ID); } divStep.remove(); self.recordState(); } //回调接口(已实现) fn.onStepDisConnected = function (Step, targerID) { var self = this; Step.ToID.splice(Step.ToID.indexOf(targerID), 1); if (Step.ToIDCase != null) { delete Step.ToIDCase[targerID]; } if (Step.ToIDPos != null) { delete Step.ToIDPos[targerID]; } if (Step.ToIDSms != null) { delete Step.ToIDSms[targerID]; } if (Step.ToIDDesc != null) { delete Step.ToIDDesc[targerID]; } } fn.ShowLine = function () { var self = this; var svg = self.Canvas.firstChild; self.Canvas.innerHTML = svg.outerHTML; } fn.setLineColor = function (gLine, cssColor) { var pathLine = gLine.firstChild; var pathArrow = gLine.lastChild; pathLine.setAttribute("stroke", cssColor); pathArrow.setAttribute("stroke", cssColor); } fn.SelectLine = function (LineID) { var self = this; if (self.LineSel == LineID) { return; } var svg = self.Canvas.firstChild; if (self.LineSel != null) { var g = svg.getElementsByClassName(self.LineSel)[0]; if (g != null) { var pathLine = g.firstChild; var pathArrow = g.lastChild; pathLine.style.zIndex = ""; pathLine.setAttribute("stroke", self.LineColor); pathArrow.setAttribute("stroke", self.LineColor); self.OnLineLost(self.Lines[self.LineSel]); self.LineSel = null; } } var g = svg.getElementsByClassName(LineID)[0]; if (g != null) { self.LineSel = LineID; var pathLine = g.firstChild; var pathArrow = g.lastChild; pathLine.style.zIndex = "1"; pathLine.setAttribute("stroke", self.LineSelColor); pathArrow.setAttribute("stroke", self.LineSelColor); g.parentNode.appendChild(g); self.OnLineSelected(self.Lines[LineID]); } } fn.EnableLineSelect = function () { var self = this; self.ContainerBg.addEventListener("mousedown", function (e) { var Line = null; if (e.srcElement.tagName == "path") { var g = e.srcElement.parentNode; var lineId = g.getAttribute("id") || g.getAttribute("ID"); if (lineId) { Line = self.Lines[lineId]; } } if (Line != null) { if (e.srcElement.tagName == "path") { self.SelectLine(Line.ID); e.preventDefault(); e.stopPropagation(); } } else { self.SelectLine(); } }); } fn.EnableLineEnterLeave = function () { var self = this; var preLineId = null; self.ContainerBg.addEventListener("mousemove", function (e) { var Pos = { X: e.clientX, Y: e.clientY } self.EleContainer.ClientToOffset(Pos); var Line = null; if (e.srcElement.tagName == "path") { var g = e.srcElement.parentNode; var lineId = g.getAttribute("id") || g.getAttribute("ID"); if (lineId) { Line = self.Lines[lineId]; } } var svg = self.Canvas.firstChild; if (Line != null) { var g = svg.getElementsByClassName(Line.ID)[0]; if (Line.ID == preLineId) { return; } var pathLine; var pathArrow; if (preLineId != self.LineSel) { var preLine = svg.getElementsByClassName(preLineId)[0]; if (preLine != null) { pathLine = preLine.firstChild; pathArrow = preLine.lastChild; pathLine.setAttribute("stroke", self.LineColor); pathArrow.setAttribute("stroke", self.LineColor); } } var preLine = svg.getElementsByClassName(preLineId)[0]; if (preLine != null) { pathLine = preLine.firstChild; pathArrow = preLine.lastChild; pathLine.setAttribute("stroke", self.LineColor); pathArrow.setAttribute("stroke", self.LineColor); } preLineId = Line.ID; if (g != null) { pathLine = g.firstChild; pathArrow = g.lastChild; pathLine.setAttribute("stroke", self.LineHoverColor); pathArrow.setAttribute("stroke", self.LineHoverColor); } } else if (preLineId != null) { if (preLineId != self.LineSel) { var preLine = svg.getElementsByClassName(preLineId)[0]; if (preLine != null) { var pathLine = preLine.firstChild; var pathArrow = preLine.lastChild; pathLine.setAttribute("stroke", self.LineColor); pathArrow.setAttribute("stroke", self.LineColor); } } preLineId = null; } }); } fn.EnableFromLocal = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyO" && e.ctrlKey) { CLOpenFile(function (File, Name) { if (Name.toLocaleLowerCase().lastIndexOf(".json") < 0) { CLShowMsg('不支持该文件格式.'); return; } var reader = new FileReader(); //将文件以文本形式读入页面 reader.readAsText(File); reader.onload = function (f) { var data = null try { var Json = JSON.parse(this.result); if (typeof (Json) != 'object') { CLShowMsg('不支持该文件格式.'); return; } data = self.getData(); self.setData(Json); } catch (e) { CLShowMsg('该文件已损坏.'); if (data != null) { self.setData(data); } throw e; } } }, ".json"); } }); } fn.EnableSaveAsLocal = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyS" && e.ctrlKey && e.altKey) { var data = self.getData(); CLSaveAsLocal(data.Name + ".Json", JSON.stringify(data, null, 4)) } }); } fn.EnableDeleteLine = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "Delete") { if (self.LineSel != null) { self.DeleteLine(self.LineSel); self.LineSel = null; } } }); } fn.EnableDeleteStep = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "Delete") { if (self.StepSel != null) { self.DeleteStep(self.StepSel); self.StepSel = null; } } }); } fn.EnableCtrlS = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyS" && e.ctrlKey && !e.altKey) { self.Save(); e.stopPropagation(); e.preventDefault(); } }); } fn.EnableCtrlY = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyY" && e.ctrlKey) { self.redo(); e.stopPropagation(); e.preventDefault(); } }); } fn.EnableCtrlZ = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyZ" && e.ctrlKey) { self.undo(); e.stopPropagation(); e.preventDefault(); } }); } fn.EnableCtrlN = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyN" && e.ctrlKey) { open("/" + CLCorpId() + "/View/Flow/RunFlow.cml?FlowClassID=" + self.FlowClass.ID); e.stopPropagation(); e.preventDefault(); } }); } fn.EnableCtrlF = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyF" && e.ctrlKey) { self.DesignForm(self.FlowClass.FormsID); e.stopPropagation(); e.preventDefault(); } }); } fn.EnableCtrlI = function () { var self = this; self.ContainerBg.addEventListener("keydown", function (e) { if (e.code == "KeyI" && e.ctrlKey) { if (self.Ele.classList.contains("FlowCoreExAutoStepWidth")) { self.Ele.classList.remove("FlowCoreExAutoStepWidth") } else { self.Ele.classList.add("FlowCoreExAutoStepWidth") } e.stopPropagation(); e.preventDefault(); } }); } fn.Save = function () { var Url = "/" + CLCorpId() + "/api/Flow.chx?Function=HttpSaveFlowClass"; var self = this; HttpPost(Url, function (Json) { if (Json.code == 0) { if ((Json.data != null && Json.data != self.FlowClass.ID) || location.href.indexOf("ID=") < 0) { window.location.href = "/" + CLCorpId() + "/View/Flow/FlowDesigner.cml?ID=" + (Json.data == null ? self.FlowClass.ID : Json.data); } else { CLShowMsg("修改成功",false); } } else { CLShowMsg(Json.msg); } }, JSON.stringify(this.getData())); } FlowCoreEx.Dynamic = [ { ID: "Dynamic_10001", Name: "流程发起人" } ,{ ID: "Dynamic_10002", Name: "所有员工" } , { ID: "Dynamic_10003", Name: "成员字段" } , { ID: "Dynamic_10004", Name: "部门字段" } , { ID: "Dynamic_10005", Name: "部门主管" }]; FlowCoreEx.MemberSel = function (jData, Container, MultiSel, IconText, treeName, limit) { this.Prefix = CLMakeId(); var This = this; var TreeContainer = document.createElement("div"); TreeContainer.style.overflow = "auto"; TreeContainer.style.width = "50%"; TreeContainer.style.height = "100%"; TreeContainer.style.cssFloat = "left"; TreeContainer.style.borderRight = "1px solid rgb(224, 224, 224)"; var Tree = new CLTop.CLTree(jData); Tree.IconText = IconText; Tree.Render(TreeContainer); TreeContainer.lastChild.style.overflow = "auto"; Container.appendChild(TreeContainer); var MemberContainer = TreeContainer.cloneNode(); Tree.OnSelected = function (Item) { var Items = MemberContainer.firstChild.getElementsByClassName("Item"); for (var i = 0; i < Items.length ; i++) { if (Items[i].classList.contains("ItemHidden")) { Items[i].classList.remove("ItemHidden"); } } if (Item.ID == 1) { return; } Items = MemberContainer.firstChild.childNodes; for (var i = 0; i < Items.length; i++) { if (Items[i].ItemData[treeName].indexOf(Item.ID) < 0) { Items[i].classList.add("ItemHidden"); } } } MemberContainer.className = "CLList"; var AllMember = CLApp.getUserList(); AllMember = CLClone(AllMember); for (var i = 0; i < AllMember.length ; i++) { AllMember[i] = { ID: AllMember[i].userid, Name: AllMember[i].name, department: AllMember[i].department, Roles: AllMember[i].Roles }; } //限定范围 if (limit) { function Has(jData, Member, IsSel) { if (Member[treeName].indexOf(jData.ID) >= 0 && IsSel == true) { return true; } var ret = false; var Sel; for (var i = 0; jData.SubNode != null && i < jData.SubNode.length ; i++) { if (IsSel == null) { Sel = jData.SubNode[i].IsSel; } else { Sel = IsSel; } ret = Has(jData.SubNode[i], Member, Sel); if (ret == true) { return true; } } return false; } for (var i = 0; i < AllMember.length ; i++) { if (!Has(jData, AllMember[i], jData.IsSel)) { AllMember.splice(i, 1); i--; } } } var jsMember = this; jsMember.OnSelected = function () { } jsMember.OnLostSelected = function () { } this.Select = function (Id) { List.Select(Id); } this.Selects = function (IDs) { IDs = CLClone(IDs); List.Selects(IDs); } this.UnSelect = function (Id) { List.UnSelect(Id); } this.UnSelects = function (IDs) { IDs = CLClone(IDs); List.UnSelects(Id); } this.Search = function (sValue) { List.Search(sValue); } var List = new CLTop.CLList(AllMember, MemberContainer, true, function (Item, ItemData) { }); List.OnSelected = function (ItemData) { jsMember.OnSelected(ItemData); } List.OnLostSelected = function (ItemData) { jsMember.OnLostSelected(ItemData); } Container.appendChild(MemberContainer); Object.defineProperty(this, "Visible", { get: function () { return this.IsVisible == true; }, set: function (val) { this.IsVisible = (val == true); if (this.IsVisible) { TreeContainer.style.display = "block"; MemberContainer.style.display = "block"; } else { TreeContainer.style.display = "none"; MemberContainer.style.display = "none"; } } }); } FlowCoreEx.DynamicSel = function (jData, Container, FormFields) { this.Prefix = CLMakeId(); var This = this; var divLeft = document.createElement("div"); divLeft.style.width = "33.3%"; divLeft.style.height = "100%"; divLeft.style.cssFloat = "left"; divLeft.style.borderRight = "solid 1px #ccc"; Container.appendChild(divLeft); var LeftList = new CLTop.CLList(jData, divLeft); var divRight = document.createElement("div"); divRight.style.width = "66.7%"; divRight.style.height = "100%"; divRight.style.cssFloat = "left"; Container.appendChild(divRight); var jRList = [ { ID: "发起人_100001", Name: "流程发起人", Type: "流程发起人", }, { ID: "所有员工_100002", Name: "所有员工", Type: "所有员工", } ]; jRList.push({ ID: "发起人" + "|" + "直接部门主管", Name: "直接部门主管", Type: "部门主管", }); jRList.push({ ID: "发起人" + "|" + "上级部门主管", Name: "上级部门主管", Type: "部门主管", }); jRList.push({ ID: "发起人" + "|" + "三级部门主管", Name: "三级部门主管", Type: "部门主管", }); jRList.push({ ID: "发起人" + "|" + "四级部门主管", Name: "四级部门主管", Type: "部门主管", }); jRList.push({ ID: "发起人" + "|" + "五级部门主管", Name: "五级部门主管", Type: "部门主管", }); jRList.push({ ID: "发起人" + "|" + "六级部门主管", Name: "六级部门主管", Type: "部门主管", }); jRList.push({ ID: "发起人" + "|" + "七级部门主管", Name: "七级部门主管", Type: "部门主管", }); var jMList = []; jMList.push({ ID: "发起人", Name: "发起人", Type: null, }); var ID_Names = { "发起人": "发起人" }; for (var i = 0; i < FormFields.length ; i++) { ID_Names[FormFields[i].ID] = FormFields[i].Name; if (FormFields[i].className == "成员单选" || FormFields[i].className == "成员多选") { jRList.push({ ID: FormFields[i].ID, Name: FormFields[i].Name, Type: "成员字段", }); } if (FormFields[i].className == "部门单选" || FormFields[i].className == "部门多选") { jRList.push({ ID: FormFields[i].ID, Name: FormFields[i].Name, Type: "部门字段", }); } if (FormFields[i].className == "成员单选" || FormFields[i].className == "成员多选" || FormFields[i].className == "部门单选" || FormFields[i].className == "部门多选") { jMList.push({ ID: FormFields[i].ID, Name: FormFields[i].Name, Type: null, }); jRList.push({ ID: FormFields[i].ID + "|" + "直接部门主管", Name: "直接部门主管", Type: "部门主管", }); jRList.push({ ID: FormFields[i].ID + "|" + "上级部门主管", Name: "上级部门主管", Type: "部门主管", }); jRList.push({ ID: FormFields[i].ID + "|" + "三级部门主管", Name: "三级部门主管", Type: "部门主管", }); jRList.push({ ID: FormFields[i].ID + "|" + "四级部门主管", Name: "四级部门主管", Type: "部门主管", }); jRList.push({ ID: FormFields[i].ID + "|" + "五级部门主管", Name: "五级部门主管", Type: "部门主管", }); jRList.push({ ID: FormFields[i].ID + "|" + "六级部门主管", Name: "六级部门主管", Type: "部门主管", }); jRList.push({ ID: FormFields[i].ID + "|" + "七级部门主管", Name: "七级部门主管", Type: "部门主管", }); } } var MiddleList = new CLTop.CLList(jMList, divRight); var divMList = divRight.lastChild; divMList.style.display = "none"; divMList.style.width = "50%"; divMList.style.cssFloat = "left"; divMList.style.borderRight = "#e0e00e solid 1px"; MiddleList.OnSelected = function (ItemData) { RightList.Search("★★★"); MiddleList.selItemData = ItemData; nameSpan.innerHTML = ItemData.Name + ":"; var Items = divRight.getElementsByClassName("Item"); for (var i = 0 ; i < Items.length ; i++) { if (Items[i].ItemData.Type == "部门主管" && ItemData.ID + "|" + Items[i].ItemData.Name == Items[i].ItemData.ID) { Items[i].classList.remove("ItemHidden"); } } } var RightList = new CLTop.CLList(jRList, divRight, true); var divRList = divRight.lastChild; divRList.style.cssFloat = "left"; var nameSpan = document.createElement("span"); nameSpan.style.color = "#91a1b7"; nameSpan.style.padding = "0 30px 0 10px"; divRList.insertBefore(nameSpan, divRList.firstChild); RightList.Search("★★★"); LeftList.OnSelected = function (ItemData) { RightList.Search("★★★"); var Items = divRight.getElementsByClassName("Item"); for (var i = 0 ; i < Items.length ; i++) { if (Items[i].ItemData.Type == ItemData.Name && ItemData.Name != "部门主管") { Items[i].classList.remove("ItemHidden"); } } if (ItemData.Name == "部门主管") { divMList.style.display = ""; divRList.style.width = "50%"; nameSpan.style.display = "inline"; if (MiddleList.selItemData == null) { MiddleList.Select("发起人"); } else { MiddleList.OnSelected(MiddleList.selItemData); } } else { nameSpan.style.display = ""; divMList.style.display = "none"; divRList.style.width = "100%"; } } LeftList.Select("Dynamic_10001"); RightList.OnSelected = function (ItemData) { ItemData = CLClone(ItemData); if (ItemData.Type == "部门主管") { ItemData.Name = ID_Names[ItemData.ID.split("|")[0]] + "|" + ItemData.Name; } This.OnSelected(ItemData); } RightList.OnLostSelected = function (ItemData) { This.OnLostSelected(ItemData); } This.OnSelected = function () { } This.OnLostSelected = function () { } This.Select = function (Id) { RightList.Select(Id); } This.Selects = function (IDs) { IDs = CLClone(IDs); for (var i = 0; i < IDs.length; i++) { this.Select(IDs[i]); } } This.UnSelect = function (Id) { RightList.UnSelect(Id); } This.UnSelects = function (IDs) { IDs = CLClone(IDs); for (var i = 0; i < IDs.length; i++) { this.UnSelect(IDs[i]); } } Object.defineProperty(this, "Visible", { get: function () { return this.IsVisible == true; }, set: function (val) { this.IsVisible = (val == true); if (this.IsVisible) { divLeft.style.display = "block"; divRight.style.display = "block"; } else { divLeft.style.display = "none"; divRight.style.display = "none"; } } }); } fn.SelectHandle = function (Handlers, Success, HasDynamic) { var dlg = null; var self = this; if (self.FlowClass.FormsID == null) { CLShowMsg("请先选择表单..."); return; } if (self.FormFields == null) { self.GetFormFields(self.FlowClass.FormsID, function (Fields) { self.FormFields = Fields; self.SelectHandle(Handlers, Success, HasDynamic); }); return; } if (HasDynamic == null) { HasDynamic = true; } var Range = Handlers; if (Range == null) { Range = { Parts: [ ], Roles: [ ], Members: [ ], Dynamic: [ ] } } var MemberRangeSel = document.createElement("div"); MemberRangeSel.style.height = "310px"; MemberRangeSel.style.border = "solid 1px #e0e0e0"; MemberRangeSel.style.borderTop = "none"; var div = document.createElement("div"); div.style.width = "610px"; div.style.height = "575px"; dlg = new CLDialog(div); dlg.CreateAll("成员列表", function () { var Ranges = SelContainer.childNodes; var Handlers = { Parts: [ ], Roles: [ ], Members: [ ], Dynamic: [ ] }; for (var i = 0; i < Ranges.length ; i++) { if (Ranges[i].Type == "Dynamic") { Handlers[Ranges[i].Type].push({ "ID": Ranges[i].Item.ID, "Name": Ranges[i].Item.Name, Type: Ranges[i].Item.Type }); } else if (Ranges[i].Type == "Members") { Handlers[Ranges[i].Type].push(Ranges[i].Item.ID); } else { Handlers[Ranges[i].Type].push({ "ID": Ranges[i].Item.ID, "Name": Ranges[i].Item.Name }); } } Success(Handlers); }); var Body = dlg.Body; var SelContainer = document.createElement("div"); SelContainer.style.height = "80px"; SelContainer.style.marginBottom = "10px"; SelContainer.style.overflow = "auto"; SelContainer.style.border = "solid 1px #e0e0e0"; Body.appendChild(SelContainer); var tableBar = document.createElement("div"); tableBar.style.border = "solid 1px #e0e0e0"; tableBar.style.height = "40px"; tableBar.style.padding = "0 10px"; tableBar.style.lineHeight = "38px"; tableBar.style.position = "relative"; tableBar.style.overflow = "hidden"; tableBar.style.overflowX = "auto"; tableBar.style.whiteSpace = "nowrap"; tableBar.onscroll = function () { input.style.marginRight = -tableBar.scrollLeft + "px"; iconSearch.style.marginRight = -tableBar.scrollLeft + "px"; } Body.appendChild(tableBar); Body.appendChild(MemberRangeSel); var Btn = document.createElement("div"); Btn.className = "BarBtn"; Btn.style.width = "100px"; Btn.style.display = "inline-block"; Btn.style.height = "40px"; Btn.style.textAlign = "center"; Btn.innerHTML = "组织架构"; Btn.style.cursor = "pointer"; Btn.Sel = function () { if (tableBar.SelObj != null) { tableBar.SelObj.Visible = false; } if (tableBar.DepartTree != null) { tableBar.DepartTree.Visible = true; } else { var jData = CLApp.getDepartTree()[0]; var Tree = new CLTop.CLTree(jData); Tree.IconText = ""; Tree.MultiSel = true; Tree.OverFlowAuto = true; Tree.Render(MemberRangeSel); var divTree = MemberRangeSel.lastChild; divTree.style.overflow = "auto"; divTree.style.maxHeight = "100%"; divTree.style.maxWidth = "100%"; Tree.Type = "Parts"; tableBar.DepartTree = Tree; Tree.OnSelected = function (Item) { ItemSel(Item, Tree, ""); } Tree.OnLostSelected = function (Item) { Div = CLTop.document.getElementById("ItemSel_" + Tree.Prefix + "_" + Item.ID); if (Div != null) { SelContainer.removeChild(Div); } } for (var i = 0; i < Range.Parts.length ; i++) { Tree.Select(Range.Parts[i].ID); } } tableBar.SelObj = tableBar.DepartTree; } Btn.onclick = function (e) { if (tableBar.Sel != null) { tableBar.Sel.style.borderBottom = ""; tableBar.Sel.style.color = ""; } var Btn = e.currentTarget; Btn.style.borderBottom = "solid 4px #0DB3A6"; Btn.style.color = "#0DB3A6"; tableBar.Sel = Btn; Btn.Sel(); } function ItemSel(Item, Tree, IconText) { var Div = document.createElement("div"); Div.style.padding = "0 10px"; Div.style.height = "30px"; Div.style.margin = "5px 0 0 5px"; Div.style.lineHeight = "30px"; Div.style.display = "inline-block"; Div.id = "ItemSel_" + Tree.Prefix + "_" + Item.ID; var Icon = document.createElement("div"); Icon.style.cssText = "font-family: CLFont!important;display: inline-block;font-size: 16px;font-weight: 100;margin-right: 5px;"; Icon.style.color = "#0db3a6"; Icon.innerHTML = IconText; Div.appendChild(Icon); var span = document.createElement("span"); span.innerHTML = Item.Name; Div.appendChild(span); var Close = document.createElement("div"); Close.style.cssText = "height: 30px;cursor:pointer; margin-left: 8px;display: inline-block;line-height: 30px;font-size: 18px;color: #333; font-family: 'CLFont'!important;"; Close.innerHTML = ""; Div.appendChild(Close); SelContainer.appendChild(Div); Div.Item = Item; Div.Type = Tree.Type; Close.onclick = function () { Tree.UnSelect(Item.ID); } } tableBar.appendChild(Btn); var cloneBtn = Btn.cloneNode(); cloneBtn.innerHTML = "角色"; cloneBtn.onclick = Btn.onclick; cloneBtn.Sel = function () { if (tableBar.SelObj != null) { tableBar.SelObj.Visible = false; } if (tableBar.RoleTree != null) { tableBar.RoleTree.Visible = true; } else { var jData = CLApp.getRoleTree()[0]; var Tree = new CLTop.CLTree(jData); Tree.IconText = ""; Tree.MultiSel = true; Tree.OverFlowAuto = true; Tree.Render(MemberRangeSel); MemberRangeSel.lastChild.style.overflow = "auto"; MemberRangeSel.lastChild.style.maxHeight = "100%"; Tree.Type = "Roles"; tableBar.RoleTree = Tree; Tree.OnSelected = function (Item) { ItemSel(Item, Tree, ""); } Tree.OnLostSelected = function (Item) { Div = CLTop.document.getElementById("ItemSel_" + Tree.Prefix + "_" + Item.ID); if (Div != null) { SelContainer.removeChild(Div); } } for (var i = 0; i < Range.Roles.length ; i++) { Tree.Select(Range.Roles[i].ID); } } tableBar.SelObj = tableBar.RoleTree; } cloneBtn.Sel(); tableBar.appendChild(cloneBtn); var cloneBtn = Btn.cloneNode(); cloneBtn.innerHTML = "成员"; cloneBtn.onclick = Btn.onclick; cloneBtn.Sel = function () { if (tableBar.SelObj != null) { tableBar.SelObj.Visible = false; } if (tableBar.MemSel != null) { tableBar.MemSel.Visible = true; } else { var jData = CLApp.getDepartTree()[0]; var MemSel = new FlowCoreEx.MemberSel(jData, MemberRangeSel, true, "", "department", false); MemSel.Type = "Members"; tableBar.MemSel = MemSel; MemSel.OnSelected = function (Item) { ItemSel(Item, MemSel, ""); } MemSel.OnLostSelected = function (Item) { Div = CLTop.document.getElementById("ItemSel_" + MemSel.Prefix + "_" + Item.ID); if (Div != null) { SelContainer.removeChild(Div); } } for (var i = 0; i < Range.Members.length ; i++) { MemSel.Select(Range.Members[i].ID || Range.Members[i]); } } tableBar.SelObj = tableBar.MemSel; } cloneBtn.Sel(); tableBar.appendChild(cloneBtn); if (HasDynamic) { var cloneBtn = Btn.cloneNode(); cloneBtn.innerHTML = "动态参数"; cloneBtn.Sel = function () { if (tableBar.SelObj != null) { tableBar.SelObj.Visible = false; } if (tableBar.DynamicSel != null) { tableBar.DynamicSel.Visible = true; } else { var jData = FlowCoreEx.Dynamic; var DynamicSel = new FlowCoreEx.DynamicSel(jData, MemberRangeSel, self.FormFields); DynamicSel.Type = "Dynamic"; tableBar.DynamicSel = DynamicSel; DynamicSel.OnSelected = function (Item) { if (Item.Type == "部门字段") { ItemSel(Item, DynamicSel, ""); } else { ItemSel(Item, DynamicSel, ""); } } DynamicSel.OnLostSelected = function (Item) { Div = CLTop.document.getElementById("ItemSel_" + DynamicSel.Prefix + "_" + Item.ID); if (Div != null) { SelContainer.removeChild(Div); } } for (var i = 0; i < Range.Dynamic.length ; i++) { DynamicSel.Select(Range.Dynamic[i].ID); } } tableBar.SelObj = tableBar.DynamicSel; } cloneBtn.Sel(); cloneBtn.onclick = Btn.onclick; tableBar.appendChild(cloneBtn); } var input = document.createElement("input"); input.style.height = "24px"; input.style.lineHeight = "24px"; input.style.margin = "8px"; input.style.padding = "0 5px 0 15px"; input.style.width = "120px"; input.style.position = "absolute"; input.style.right = "0"; input.style.border = "none"; input.setAttribute("placeholder", "输入名称搜索"); input.oninput = function () { if (tableBar.SelObj != null && tableBar.SelObj.Search != null) { tableBar.SelObj.Search(input.value == null ? "" : input.value); } } tableBar.appendChild(input); var iconSearch = document.createElement("span"); iconSearch.style.cssText = "position: absolute; right: 10px; font-size:12px;font-weight:900; line-height: 40px; color: rgb(137, 137, 137); font-family: CLFont;"; iconSearch.innerHTML = ""; tableBar.appendChild(iconSearch); tableBar.firstChild.onclick({ currentTarget: tableBar.firstChild }); } function PropSplit(Body) { var div = document.createElement("div"); div.classList.add("Split"); Body.appendChild(div); } function PropLabel(Body, Name) { var div = document.createElement("div"); div.classList.add("Label"); div.innerText = Name; Body.appendChild(div); return div; } function PropValue(Body, tag) { var input = document.createElement(tag == null ? "input" : tag); input.classList.add("Value"); Body.appendChild(input); return input; } function PropBtn(Body, Name) { var div = document.createElement("div"); div.classList.add("Value"); div.classList.add("Btn"); div.innerText = Name; Body.appendChild(div); return div; } //流程接口 //回调接口 fn.GetFormTree = function () { } //回调接口 fn.GetFormFields = function (FormsID, Success) { if (FormsID == null) { CLShowMsg("没有设置表单ID"); return } var jForm = CLApp.getFormById(FormsID); var Fields = [].concat(jForm.Fields); Success(Fields); } //Http接口 fn.DesignForm = function (FormsID) { window.open("/" + CLCorpId() + "/View/Form/FrmDesigner.cml?ID=" + FormsID); } //上传图片 fn.UpLoadFile = function (File, ExtInfo, Success, onProgress) { var Url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpUploadFile"; HttpPost(Url, Success, { ExtInfo: ExtInfo }, true, null, null, File, File.name, onProgress); } fn.ParamSetter = function (Name, subFormFields, ParamInfo, End, rPlaceHolder) { var self = this; if (self.FlowClass.FormsID == null) { CLShowMsg("请先选择表单"); return; } if (self.FormFields == null) { self.GetFormFields(self.FlowClass.FormsID, function (Fields) { self.FormFields = Fields; self.ParamSetter(Name, subFormFields, ParamInfo, End, rPlaceHolder); }); return; } CLLoad("/View/Form/lib/Frm/DialogEventHandle.css"); var dlgDiv = document.createElement("div"); dlgDiv.style.cssText = "width:845px;height:700px"; var dlg = new CLDialog(dlgDiv); if (ParamInfo == null) { ParamInfo = []; } var Body; ParamInfo = CLClone(ParamInfo); dlg.CreateAll(Name, function () { for (var j = 0; j < ParamInfo.length; j++) { var bHas = false; for (var i = 0; i < subFormFields.length ; i++) { if (ParamInfo[j].ID == subFormFields[i].ID) { bHas = true; } } if (!bHas) { ParamInfo.splice(j, 1); } } End(ParamInfo); }); Body = dlg.Body; Body.classList.add("Container"); dlgDiv.classList.add("DialogEventHandle"); Body.style.overflow = "auto"; Body.style.maxHeight = "calc(100% - 42px)"; Body.style.display = "block"; var divLabel = document.createElement("div"); divLabel.className = "titleLabel"; divLabel.innerHTML = "需要传递那些字段"; Body.appendChild(divLabel); var spanLabel = document.createElement("div"); spanLabel.className = "addSpan"; spanLabel.innerHTML = "请添加字段"; Body.appendChild(spanLabel); spanLabel.onclick = function (e) { var Menu = { "style": { "max-width": "230px", "max-height": "230px", "overflow": "auto", "margin-top": "15px", "background-color": "#fff", }, "Items": [ ] } var Fields = subFormFields; var listName = ["分割线", "选项卡", "表格控件", "关联查询", "关联数据", "提交时间", "更新时间", "流程状态"]; for (var i = 0; i < Fields.length ; i++) { if (listName.indexOf(Fields[i].className) >= 0) { continue; } var Item = { "style": { "min-width": "230px", "max-width": "230px", }, "Icon": "", "Text": Fields[i].Name, "Node": e.currentTarget, "Data": Fields[i], "CallBack": function (e) { e.currentTarget.Disabled = true; AddUpdateField(this.Data); } } var bHas = false; for (var j = 0; j < ParamInfo.length; j++) { if (ParamInfo[j].ID == Fields[i].ID) { bHas = true; } } Item.Enable = !bHas; Menu.Items.push(Item); } var _CLMenu = new CLMenu(Menu, spanLabel); _CLMenu.EnableSearch(true); } var divFields = document.createElement("div"); divFields.style.cssText = "width:100%;"; Body.appendChild(divFields); function AddUpdateField(Field) { ParamInfo.push({ ID: Field.ID, valType: "流程表单字段值", Val: null, ctrlID: null, className: Field.className }); Body.ShowFields(); } Body.getField = function (Id) { var Fields = subFormFields; for (var i = 0; i < Fields.length; i++) { if (Fields[i].ID == Id) { return Fields[i]; } if (Fields[i].className == "子表单") { var subFields = Fields[i].Field; for (var j = 0; j < subFields.length ; j++) { if (subFields[j].ID == Id) { return subFields[j]; } } } } return null; } Body.ShowFields = function ShowFields() { divFields.innerHTML = ""; var Fields = ParamInfo; for (var i = 0; i < Fields.length; i++) { var Field = Body.getField(Fields[i].ID); if (Fields[i].className == "子表单") { Fields[i].GetSubFields = function () { return this.GetSubFields.Field; } Fields[i].GetSubFields.Field = Field.Field; } if (Field == null) { continue; } var divLine = DialogEventHandle.createValLine(Fields[i], Field.Name, divFields, self.FormFields, rPlaceHolder); divLine.oldRemove = divLine.remove; divLine.remove = function () { ParamInfo.splice(Fields.indexOf(this.ValField), 1); this.oldRemove(); } divLine.Remove = function () { this.remove(); } } } Body.ShowFields(); } fn.QueryStepSource = function (dataSource) { var self = this; var dataForm = { ID: dataSource.ID, Name: dataSource.Name }; var stepId = dataSource.StepID; var Steps = self.FlowClass.Steps; Steps.forEach(function (step) { if (step.ID == stepId) { var arrHandles = [step.endEventHandle, step.submitEventHandle, step.startEventHandle]; for (var x = 0; x < arrHandles.length; x++) { var Handles = arrHandles[x]; if (Handles == null) { continue; } for (var i = Handles.length - 1; i > -1 ; i--) { if (Handles[i].Handle && Handles[i].Handle.dataExcel) { var Output = Handles[i].Handle.dataExcel.Output; if (Output) { var Dims = Output.Dimensions; var Pits = Output.Pointers; var arr = [].concat(Dims).concat(Pits); dataForm.Fields = CLClone(arr); } } } } } }); return dataForm; } fn.QueryFormSource = function (dataSource) { var self = this; var listName = ["分割线", "选项卡", "表格控件", "关联查询", "关联数据", "子表单"]; var formId = dataSource.FormID; var form = CLApp.getFormById(self.FlowClass.FormsID); var dataForm = { ID: dataSource.ID, Name: dataSource.Name, Fields: [] }; var Fields = dataForm.Fields; if (form.ID == formId) { form.Fields.forEach(function (field) { if (listName.indexOf(field.className) < 0) { if (/^[0-9]+$/.test(field.ID)) { Fields.push({ ID: "DataField_" + field.ID, Name: field.Name, className: field.className }); } else { Fields.push({ ID: field.ID, Name: field.Name, className: field.className }); } } }); } else { form.Fields.forEach(function (field) { if (field.ID == formId && field.className == "子表单") { if (field.Field) { field.Field.forEach(function (field) { if (/^[0-9]+$/.test(field.ID)) { Fields.push({ ID: "DataField_" + field.ID, Name: field.Name, className: field.className }); } else { Fields.push({ ID: field.ID, Name: field.Name, className: field.className }); } }); } } }); } return dataForm; } fn.CreateStepSource = function (dataSource, End) { var self = this; var dlgDiv = document.createElement("div"); dlgDiv.style.cssText = "width:600px;height:400px"; var dlg = new CLDialog(dlgDiv); dlg.CreateAll("选择流程节点", function () { dataSource.StepID = dataStep.ID; dataSource.Name = dataStep.Name; End(dataSource); }); dlg.Body.style.overflow = "hidden"; dlg.Body.style.position = "relative"; dlg.EnableMove(); dlg.Header.ondblclick = function () { dlg.MaximizeOrReset(); } var core = new FlowCoreEx(dlg.Body, false); var createStep = core.createStep; var dataStep = null; core.createStep = function () { var divStep = createStep.apply(this, arguments); divStep.onmousedown = function (e) { if (divStep.Step.ID == currentId) { CLShowMsg("不可选择当前节点"); return; } var stepSel = dlg.Body.querySelector(".StepSel"); if (stepSel) { stepSel.classList.remove("StepSel"); stepSel.style.background = ""; } divStep.classList.add("StepSel"); divStep.style.background = "rgba(13,179,166,0.5)"; dataStep = divStep.Step; e.stopImmediatePropagation(); } divStep.ondblclick = function () { if (divStep.Step.ID == currentId) { return; } dataSource.StepID = dataStep.ID; dataSource.Name = dataStep.Name; End(dataSource); dlg.Close(); } return divStep; } core.Container.parentNode.onmousedown = function (e) { var stepSel = dlg.Body.querySelector(".StepSel"); if (stepSel) { stepSel.classList.remove("StepSel"); stepSel.style.background = ""; } dataStep = null; } core.setData(CLClone(self.FlowClass)); core.EleContainer.CenterAll(); } fn.CreateFormSource = function (dataSource, End) { var self = this; var form = CLApp.getFormById(self.FlowClass.FormsID); var Menu = { "style": { "max-height": "100%", "overflow-y": "auto", "min-width": "130px" }, "Items": [] } var Items = Menu.Items; Items.push({ "Text": form.Name, "ID": form.ID, "Enable": true, "CallBack": function (e) { dataSource.FormID = this.ID; dataSource.Name = form.Name; End(dataSource); menu.Close(); } }); form.Fields.forEach(function (field) { if (field.className == "子表单") { Items.push({ "Text": field.Name, "ID": field.ID, "Enable": true, "CallBack": function (e) { dataSource.FormID = this.ID; dataSource.Name = field.Name; End(dataSource); menu.Close(); } }); } }); var menu = new CLMenu(Menu, event == null || event.currentTarget.getBoundingClientRectEx == null ? null : event.currentTarget); } var currentId = null; fn.DialogEventHandle = function (EventHandle, Success, flag) { var self = this; if (self.FlowClass.FormsID == null) { CLShowMsg("请先选择表单"); return; } if (flag !== false) { DialogEventHandle(EventHandle, Success, self.FlowClass.FormsID, false, self); } else { DialogEventHandle(EventHandle, Success, self.FlowClass.FormsID, false); } } //回调接口(已实现) fn.SelectImage = function (Success) { var self = this; } fn.OpenFieldDialog = function (FieldsAuth, End) { if (this.FlowClass.FormsID == null) { CLShowMsg("请先选择表单..."); return; } var self = this; if (self.FormFields == null) { self.GetFormFields(this.FlowClass.FormsID, function (Fields) { self.FormFields = Fields; InitData(Fields); }); } else { InitData(this.FormFields); } function InitData(FormFields) { var BriefNames = ["流水号", "单行文本", "数字", "时间日期", "单选按钮组", "下拉框", "成员单选", "成员多选", "部门单选", "部门多选"]; var divDlg = document.createElement("div"); divDlg.style.cssText = "width:600px;height:600px"; var Dlg = new CLDialog(divDlg); Dlg.CreateAll("字段权限", function () { var Body = Dlg.Body; var FlowTreeLines = Body.getElementsByClassName("Line"); var FormFieldsAuth = []; for (var i = 0; i < FlowTreeLines.length ; i++) { FormFieldsAuth.push({ ID: FlowTreeLines[i].ID, Name: FlowTreeLines[i].Name, className: FlowTreeLines[i].class, Brief: FlowTreeLines[i].BriefBox == null ? false : FlowTreeLines[i].BriefBox.checked, Limit: FlowTreeLines[i].LimitBox == null ? false : FlowTreeLines[i].LimitBox.checked, Read: FlowTreeLines[i].ReadBox.checked, Write: FlowTreeLines[i].WriteBox.checked, }); } console.log(FormFieldsAuth); End(FormFieldsAuth); }); var Body = Dlg.Body; Dlg.EnableMove(); Body.classList.add("FlowFields"); Body.style.overflow = "auto"; var divLines = document.createElement("div"); divLines.style.width = "100%"; divLines.style.overflow = "hidden"; var divTitle = document.createElement("div"); divTitle.className = "Title"; divTitle.style.cssText = "display: inline-block;line-height: 30px;padding-left: 20px;cursor: default;width: 100%;box-sizing: border-box;border-radius: 2px;"; divLines.className = "FLines"; divLines.appendChild(divTitle); var Vars = []; for (var i = 0; i < FormFields.length ; i++) { Vars.push({ ID: FormFields[i].ID, Name: FormFields[i].Name, className: FormFields[i].className, Visible: FormFields[i].Visible != false, Editable: FormFields[i].Editable != false }); if (FormFields[i].className == "子表单") { for (var j = 0; j < FormFields[i].Field.length; j++) { Vars.push({ ID: FormFields[i].Field[j].ID, ParentID: FormFields[i].Field[j].ParentID, Name: FormFields[i].Field[j].Name + "【" + FormFields[i].Name + "】", className: FormFields[i].Field[j].className, Visible: FormFields[i].Field[j].Visible != false, Editable: FormFields[i].Field[j].Editable != false }); } } } var label = document.createElement("label"); label.innerHTML = "表单字段"; divTitle.appendChild(label); divLines.appendChild(divTitle); var BoxAllBrief = document.createElement("div"); BoxAllBrief.style.float = "right"; BoxAllBrief.style.marginRight = "3px"; BoxAllBrief.style.display = "inline-block"; BoxAllBrief.style.width = "55px"; BoxAllBrief.style.height = "30px"; divTitle.appendChild(BoxAllBrief); var BoxAllRead = BoxAllBrief.cloneNode(); BoxAllRead.style.width = ""; divTitle.appendChild(BoxAllRead); var AllReadBox = new CLCheckBox("全选", BoxAllRead); AllReadBox.onchanged = function () { var Items = Body.getElementsByClassName("Line"); var isCheckd = AllReadBox.checked; for (var i = 0; i < Items.length; i++) { if (Items[i].ReadBox != null && Items[i].ReadBox.checked != isCheckd) { Items[i].ReadBox.checked = isCheckd; } } } var BoxAllWrite = BoxAllRead.cloneNode(); BoxAllWrite.style.width = "61px"; divTitle.appendChild(BoxAllWrite); var AllWriteBox = new CLCheckBox("全选 ", BoxAllWrite); AllWriteBox.onchanged = function () { var Items = Body.getElementsByClassName("Line"); var isCheckd = AllWriteBox.checked; for (var i = 0; i < Items.length; i++) { if (Items[i].WriteBox != null && Items[i].WriteBox.checked != isCheckd) { Items[i].WriteBox.checked = isCheckd; } } } function CalcSel(index) { var HasNoChecked = false; var Items = Body.getElementsByClassName("Line"); var Names = ["BriefBox", "ReadBox", "WriteBox"]; for (var i = 0; i < Items.length ; i++) { if (Items[i][Names[index]] != null && Items[i][Names[index]].checked == false) { HasNoChecked = true; } } if (index == 1) { AllReadBox.Checked = !HasNoChecked; } else { AllWriteBox.Checked = !HasNoChecked; } } for (var j = 0; j < Vars.length; j++) { var div = document.createElement("div"); div.innerHTML = Vars[j].Name; div.Name = Vars[j].Name; div.className = "Line"; div.classList.add(Vars[j].ID); div.style.cssText = "position:relative;display: inline-block;line-height: 30px;padding-left: 20px;cursor: default;width: 100%;box-sizing: border-box;border-radius: 2px;"; div.ID = Vars[j].ID; div.class = Vars[j].className; div.classList.add(Vars[j].ID); div.Field = Vars[j]; var BoxCheck = BoxAllBrief.cloneNode(); div.appendChild(BoxCheck); if (Vars[j].ParentID != null) { if (["成员单选", "成员多选", "部门单选", "部门多选", "成员范围"].indexOf(Vars[j].className) >= 0) { div.LimitBox = new CLCheckBox("限定", BoxCheck); } else { BoxCheck.style.display = "inline-block"; BoxCheck.style.width = "55px"; BoxCheck.style.height = "30px"; } } else{ if (BriefNames.indexOf(Vars[j].className) >= 0) { div.BriefBox = new CLCheckBox("简报", BoxCheck); } else { BoxCheck.style.display = "inline-block"; BoxCheck.style.width = "55px"; BoxCheck.style.height = "30px"; } } var BoxRead = BoxAllBrief.cloneNode(); BoxRead.style.float = "right"; BoxRead.style.width = ""; BoxRead.style.marginRight = "3px"; BoxRead.style.display = "inline-block"; div.appendChild(BoxRead); div.ReadBox = new CLCheckBox("可见", BoxRead); if (!Vars[j].Visible) { div.ReadBox.checked = false; div.ReadBox.enable = false; } div.ReadBox.onchanged = function () { CalcSel(1); } var BoxWrite = BoxRead.cloneNode(); div.appendChild(BoxWrite); div.WriteBox = new CLCheckBox("可编辑", BoxWrite); if (!Vars[j].Editable) { div.WriteBox.checked = false; div.WriteBox.enable = false; } div.WriteBox.onchanged = function () { CalcSel(2); } divLines.appendChild(div); } Body.appendChild(divLines); for (var i = 0; FieldsAuth != null && i < FieldsAuth.length; i++) { var divLine = Body.getElementsByClassName(FieldsAuth[i].ID)[0]; if (divLine == null) { FieldsAuth.splice(i, 1); i--; continue; } if (divLine.LimitBox != null) { divLine.LimitBox.checked = FieldsAuth[i].Limit; } if (divLine.BriefBox != null) { divLine.BriefBox.checked = FieldsAuth[i].Brief; } divLine.ReadBox.checked = divLine.ReadBox.enable && FieldsAuth[i].Read; divLine.WriteBox.checked = divLine.WriteBox.enable && FieldsAuth[i].Write; } } } fn.JsCodeDialog = function (Name, Code, End) { var self = this; if (self.FlowClass.FormsID == null) { CLShowMsg("请先选择表单..."); return; } if (self.FormFields == null) { self.GetFormFields(self.FlowClass.FormsID, function (Fields) { self.FormFields = Fields; self.JsCodeDialog(Name, Code, End); }); return; } var divDlg = document.createElement("div"); divDlg.style.cssText = "width:800px;height:600px;position:relative"; var dlg = new CLDialog(divDlg); var Body; dlg.CreateAll(Name, function () { End(codeEditor.getValue()); }); dlg.EnableMove(dlg.Header); dlg.Header.ondblclick = function (e) { dlg.MaximizeOrReset(); codeEditor.editor.setSize('auto', '100%'); } var Body = dlg.Body; Body.style.position = "relative"; var codeDiv = document.createElement("div"); codeDiv.style.cssText = "border:1px solid #e0e0e0;position:absolute;left:0;right:310px;bottom:0;top:0;margin:10px;"; Body.appendChild(codeDiv); var divBar = document.createElement("div"); divBar.style.cssText = "padding:8px;border:1px solid #e0e0e0;position:absolute;right:0;width:300px;bottom:0;top:0;margin:10px 10px 10px 0;overflow:auto"; Body.appendChild(divBar); var codeEditor = new CLCodeEditor(codeDiv, "javascript"); codeEditor.setGlobalScope({}); var BaseControl = ["流水号", "单行文本", "多行文本", "数字", "时间日期", "单选按钮组", "复选框组", "下拉框", "下拉复选框", "附件上传", "子表单", "成员单选", "成员多选", "部门单选", "部门多选" , "提交时间", "更新时间", "提交人", "流程状态" ]; var helpLabel; function getHelpLabel() { if (helpLabel != null) { return helpLabel; } helpLabel = document.createElement("div"); helpLabel.style.cssText = "border:1px dashed #0db3a6;height:30px;line-height:30px;position:fixed;padding:0 8px"; return helpLabel; } function OpenOrClose() { var Value = this.nextSibling; if (Value.style.display == "block") { this.Icon.style.transform = "rotate(-90deg)"; Value.style.display = "none"; } else { Value.style.display = "block"; this.Icon.style.transform = "rotate(0)"; } } var CodeCurrentFields; var Label = PropLabel(divBar, "当前表单字段"); Label.style.cursor = "pointer"; Label.style.marginBottom = "0px"; Label.style.lineHeight = "30px"; Label.onclick = OpenOrClose; var span = document.createElement("span"); span.style.cssText = "transform: rotate(-90deg);display:inline-block;font-family: CLFont;color: #5E6D82;margin-right: 10px;"; span.innerHTML = ""; Label.insertBefore(span, Label.firstChild); Label.Icon = span; var divFormFields = PropValue(divBar, "div"); divFormFields.style.border = "none"; divFormFields.style.display = "none"; divFormFields.style.height = "initial"; divFormFields.style.overflow = "auto"; divFormFields.style.paddingLeft = "15px"; Label.onclick(); var input = document.createElement('input'); input.style.height = "30px"; input.style.position = "absolute"; input.style.right = "50px"; input.style.top = "10px"; input.className = "CLSearch"; input.setAttribute("placeholder", "搜索字段"); input.onmousedown = function (e) { e.stopPropagation(); } dlg.Header.appendChild(input); var Label1 = Label.cloneNode(); Label1.innerHTML = "流程字段"; Label1.onclick = OpenOrClose; divBar.appendChild(Label1); var span1 = span.cloneNode(); span1.innerHTML = ""; Label1.insertBefore(span1, Label1.firstChild); Label1.Icon = span1; var divFlowFields = divFormFields.cloneNode(); divBar.appendChild(divFlowFields); var FlowFields; (function () { if (CodeCurrentFields == null) { CodeCurrentFields = []; var Fields = self.FormFields; for (var i = 0; i < Fields.length; i++) { if (BaseControl.indexOf(Fields[i].className) >= 0) { CodeCurrentFields.push({ TableID: self.FlowClass.FormsID, ID: Fields[i].ID, Name: Fields[i].Name, className: Fields[i].className }); } if (Fields[i].className == "子表单") { var subFields = Fields[i].Field; for (var j = 0; j < subFields.length; j++) { if (BaseControl.indexOf(subFields[j].className) >= 0) { CodeCurrentFields.push({ ID: subFields[j].ID, ParentID: Fields[i].ID, Name: Fields[i].Name + "●" + subFields[j].Name, className: subFields[j].className }); } } } } } var StepClass = ["发起节点", "审批节点", "抄送节点", "结束节点"]; if (FlowFields == null) { FlowFields = []; FlowFields.push({ ID: "creator", Name: "发起人", }); var Steps = self.FlowClass.Steps; for (var i = 0; i < Steps.length; i++) { FlowFields.push({ ID: Steps[i].ID, Name: Steps[i].Name, className: StepClass[Steps[i].Type] }); } } }()); var currentFieldList = new CLTop.CLList(CodeCurrentFields, divFormFields, null, function (Item, itemData) { Item.style.fontSize = "12px"; Item.style.paddingLeft = "15px"; Item.title = itemData.Name; Item.firstChild.style.maxWidth = "calc(100% - 45px)"; Item.firstChild.style.display = "inline-block"; Item.style.position = "relative"; Item.firstChild.classList.add("ellipsis"); Item.style.height = "26px"; var span = document.createElement("span"); span.style.position = "absolute"; span.style.right = "0"; span.style.padding = "0 8px"; span.innerHTML = FrmCtrls.CtrlsProps[itemData.className].Name; span.style.color = FrmCtrls.CtrlsProps[itemData.className].Color; Item.appendChild(span); CLEnableMove(Item, function (Item) { helpLabel = getHelpLabel(); helpLabel.style.color = FrmCtrls.CtrlsProps[itemData.className].Color; helpLabel.style.borderColor = FrmCtrls.CtrlsProps[itemData.className].Color; helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; helpLabel.innerHTML = itemData.Name; helpLabel.style.zIndex = CLMaxZIndex(); document.body.appendChild(helpLabel); }, function (Item) { helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; return false; }, function (Item) { var rect = codeDiv.getBoundingClientRect(); if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) { if (helpLabel != null) { helpLabel.remove(); } return false; } var Mark = { className: "Field", FieldData: { TableID: itemData.TableID, ID: itemData.ID, Name: itemData.Name, className: itemData.className }, Color: helpLabel.style.color } codeEditor.pushMark(Mark); helpLabel.remove(); return false; }); }); var FlowList = new CLTop.CLList(FlowFields, divFlowFields, null, function (Item, itemData) { CLEnableMove(Item, function (Item) { helpLabel = getHelpLabel(); helpLabel.style.color = "#4b7885"; helpLabel.style.borderColor = "#4b7885"; helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; helpLabel.innerHTML = itemData.Name; helpLabel.style.zIndex = CLMaxZIndex(); document.body.appendChild(helpLabel); }, function (Item) { helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; return false; }, function (Item) { var rect = codeDiv.getBoundingClientRect(); if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) { if (helpLabel != null) { helpLabel.remove(); } return false; } var Mark = { className: 'FlowInfo', FieldData: { ID: itemData.ID, Name: itemData.Name, className: itemData.className }, Color: "#4b7885" } codeEditor.pushMark(Mark); helpLabel.remove(); return false; }); }); input.onchange = function () { currentFieldList.Search(input.value); FlowList.Search(input.value); }; codeEditor.replacedWith = function (className, FieldData) { return "V8.get" + className + "(" + JSON.stringify(FieldData) + ")"; } codeEditor.testMark = function (Mark) { for (var i = 0; i < CodeCurrentFields.length; i++) { if (CodeCurrentFields[i].ID == Mark.FieldData.ID) { Mark.FieldData = CodeCurrentFields[i]; return true; } } for (var i = 0; i < FlowFields.length; i++) { if (FlowFields[i].ID == Mark.FieldData.ID) { Mark.FieldData = FlowFields[i]; return true; } } return false; } codeEditor.setValue(Code); var MapR; function SetR(dataSource) { MapR = DataSourceDlg.MapForms(dataSource); } codeEditor.MarkerProps = function (mark) { if (mark.className == "Field") { var field = mark.FieldData; var R = Object.create(null); R.ID = field.ID; R.Name = field.Name; R.className = field.className; R.TableID = field.TableID; R.valueOf = function () { } R.toString = function () { } var field = mark.FieldData; var value = null; if (field.className == "子表单") { R.Load = function () { }; R.Submit = function () { }; } if (field.className == "单行文本" || field.className == "多行文本" || field.className == "时间日期" || field.className == "单选按钮组" || field.className == "下拉框" || field.className == "流水号" || field.className == "成员单选") { R.value = ""; } if (field.className == "数字" || field.className == "部门单选") { R.value = 0; } if (field.className == "附件上传") { R.value = [{ Src: "", Name: "", Size: 0 }]; } if (field.className == "成员多选" || field.className == "复选框组" || field.className == "下拉复选框") { R.value = [0]; } if (field.className == "部门多选") { R.value = [0]; } JsParser.SetReturn(R.valueOf, value); JsParser.SetReturn(R.toString, ""); return R; } if (mark.className == "Table") { var field = mark.FieldData; var R = Object.create(null); R.ID = field.ID; R.Name = field.Name; return R; } if (mark.className == "dataSource") { var R = function () { }; R.Compile = function () { }; JsParser.SetReturn(R.Compile, ""); JsParser.SetReturn(R, MapR[mark.FieldData.ID]()); return R; } } var globalScope = CLClone(CLApp.baseGlobalScope); codeEditor.setGlobalScope(globalScope); } fn.StepProp = function (Step) { var self = this; currentId = Step.ID; self.PropDiv.innerHTML = "
节点属性
"; var divBody = document.createElement("div"); divBody.classList.add("Body"); self.PropDiv.appendChild(divBody); (function (节点ID) { PropLabel(divBody, " 节点ID"); var Value = PropValue(divBody); Value.value = Step.ID; }()); (function (节点名称) { PropSplit(divBody); PropLabel(divBody, " 节点名称"); var Value = PropValue(divBody); Value.value = Step.Name; Value.onchange = function () { Step.Name = Value.value; self.updateStepName(Step); self.recordState(); } }()); (function (负责人) { if (Step.Type == 3 || Step.Type == 4) { return; } PropSplit(divBody); if (Step.Type == 0) { PropLabel(divBody, "经办人"); } if (Step.Type == 1) { PropLabel(divBody, " 负责人"); } if (Step.Type == 2) { PropLabel(divBody, " 抄送人"); } var Value = PropValue(divBody, "div"); Value.style.height = "80px"; Value.style.cursor = "pointer"; Value.style.overflow = "auto"; Value.onclick = function () { self.SelectHandle(Step.Handlers, function (Handlers) { Step.Handlers = Handlers; ShowHandlers(Handlers, Value); self.recordState(); }, null); } function ShowHandlers(Handlers, Container) { Container.innerHTML = ""; if (Handlers == null) { return; } for (var i = 0; i < Handlers.Parts.length; i++) { var Div = document.createElement("div"); Div.style.height = "30px"; Div.style.margin = "5px 0 0 5px"; Div.style.lineHeight = "30px"; Div.style.display = "inline-block"; var Icon = document.createElement("div"); Icon.className = "FontIcon"; Icon.style.margin = ""; Icon.style.color = "#0db3a6"; Icon.innerHTML = ""; Div.appendChild(Icon); var span = document.createElement("span"); span.innerHTML = CLApp.getDepartmentNameById(Handlers.Parts[i].ID); Div.appendChild(span); Container.appendChild(Div); } for (var i = 0; i < Handlers.Roles.length; i++) { var Div = document.createElement("div"); Div.style.padding = "0 10px"; Div.style.height = "30px"; Div.style.margin = "5px 0 0 5px"; Div.style.lineHeight = "30px"; Div.style.display = "inline-block"; var Icon = document.createElement("div"); Icon.className = "FontIcon"; Icon.style.margin = ""; Icon.style.color = "#0db3a6"; Icon.innerHTML = ""; Div.appendChild(Icon); var span = document.createElement("span"); var role = CLApp.getRoleById(Handlers.Roles[i].ID); span.innerHTML = role && role.Name || "???"; Div.appendChild(span); Container.appendChild(Div); } for (var i = 0; i < Handlers.Members.length; i++) { var Div = document.createElement("div"); Div.style.padding = "0 10px"; Div.style.height = "30px"; Div.style.margin = "5px 0 0 5px"; Div.style.lineHeight = "30px"; Div.style.display = "inline-block"; var Icon = document.createElement("div"); Icon.className = "FontIcon"; Icon.style.margin = ""; Icon.style.color = "#0db3a6"; Icon.innerHTML = ""; Div.appendChild(Icon); var span = document.createElement("span"); span.innerHTML = CLApp.getMemberNameById(Handlers.Members[i].ID || Handlers.Members[i]); Div.appendChild(span); Container.appendChild(Div); } for (var i = 0; i < Handlers.Dynamic.length; i++) { var Div = document.createElement("div"); Div.style.padding = "0 10px"; Div.style.height = "30px"; Div.style.margin = "5px 0 0 5px"; Div.style.lineHeight = "30px"; Div.style.display = "inline-block"; var Icon = document.createElement("div"); Icon.className = "FontIcon"; Icon.style.margin = ""; Icon.style.color = "#0db3a6"; Icon.innerHTML = ""; Div.appendChild(Icon); var span = document.createElement("span"); span.innerHTML = Handlers.Dynamic[i].Name; Div.appendChild(span); Container.appendChild(Div); } } ShowHandlers(Step.Handlers, Value); }()); (function (激活规则) { if (Step.Type != 1 && Step.Type != 4) { return; } if (Step.enterRule == null) { Step.enterRule = {}; } PropSplit(divBody); var label = PropLabel(divBody, " 激活规则"); var divValue = PropValue(divBody, "div"); divValue.style.border = "none"; var typeSel = new CLSelect(divValue); typeSel.AddItems([ "当任意节点流入时激活", "当以下节点均完成时激活", "公式编辑" ]); typeSel.onchanged = function () { if (typeSel.selectedIndex == 0) { Btn.style.display = "none"; Value.style.display = "none"; }else if (typeSel.selectedIndex == 1) { Btn.style.display = "none"; Value.style.display = "block"; } else if (typeSel.selectedIndex == 2) { Btn.style.display = "block"; Value.style.display = "none"; } Step.enterRule.Type = typeSel.selectedIndex; self.recordState(); } var Btn = PropBtn(divBody, "fx公式编辑"); Btn.style.cursor = "pointer"; Btn.style.display = "none"; Btn.onclick = function () { if (!__IsDev__) { CLShowMsg("你不是开发者."); return; } self.JsCodeDialog("节点流转规则", Step.enterRule.ruleCode, function (Code) { Step.enterRule.ruleCode = Code; self.recordState(); }); } var Value = PropValue(divBody, "DIV"); Value.style.height = "80px"; Value.style.marginTop = "10px"; Value.style.cursor = "pointer"; Value.style.overflow = "auto"; (function () { var Steps = self.FlowClass.Steps; var Items = []; var Indexes = []; if (Step.enterRule.StepIds == null) { Step.enterRule.StepIds = []; } for (var i = 0; i < Steps.length; i++) { var Item = { ID: Steps[i].ID, Name: Steps[i].Name, toString: function () { return this.Name; } }; if (Step.enterRule.StepIds.indexOf(Item.ID) >= 0) { Indexes.push(i); } Items.push(Item); } var selector = new CLSelect(PropValue, Value); selector.AddItems(Items); selector.EnableSearch(true); selector.EnableMultiSel(true); selector.onchanged = function () { var Val = selector.GetValues(); var html = ""; for (var i = 0; Val != null && i < Val.length; i++) { html += "" + Val[i] + ""; } Value.innerHTML = html; var Indexes = selector.selectedIndexes; var StepIds = []; for (var i = 0; Indexes != null && i < Indexes.length; i++) { StepIds.push(Items[Indexes[i]].ID); } Step.enterRule.StepIds = StepIds; } selector.selectedIndexes = Indexes; }()); typeSel.selectedIndex = Step.enterRule == null || Step.enterRule.Type == null ? 0 : Step.enterRule.Type; }()); (function (延时与超时) { if (Step.Type != 0 && Step.Type != 1) { return; } PropSplit(divBody); PropLabel(divBody, "延时执行(小时)"); var delayValue = PropValue(divBody, "div"); delayValue.classList.add("Btn"); delayValue.innerHTML = "编辑"; delayValue.onclick = function () { if (!__IsDev__) { CLShowMsg("你不是开发者."); return; } self.JsCodeDialog("延时执行", Step.delayTime, function (delayTime) { Step.delayTime = delayTime; self.recordState(); }); } PropSplit(divBody); PropLabel(divBody, "任务时长(小时)"); var timeValue = PropValue(divBody, "div"); timeValue.classList.add("Btn"); timeValue.innerHTML = "编辑"; timeValue.onclick = function () { if (!__IsDev__) { CLShowMsg("你不是开发者."); return; } self.JsCodeDialog("任务时长", Step.taskTime, function (taskTime) { Step.taskTime = taskTime; self.recordState(); }); } PropSplit(divBody); PropLabel(divBody, "超时处理"); var timeOut = PropValue(divBody, "div"); timeOut.style.border = "none"; var timeOutSelector = new CLSelect(timeOut); timeOutSelector.AddItems(["消息提醒", "自动完成", "什么也不做"]); timeOutSelector.onchanged = function () { Step.timeOut = timeOutSelector.GetValue(); } if (Step.timeOut != null) { timeOutSelector.selectedIndex = timeOutSelector.Items.indexOf(Step.timeOut); } else { timeOutSelector.selectedIndex = 0; } }()); (function (节点开始事件) { if (Step.Type != 1) { return; } PropSplit(divBody); var label = PropLabel(divBody, "节点开始事件"); label.innerHTML += (Step.startEventHandle == null ? "" : "(" + Step.startEventHandle.length + ")") var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { self.DialogEventHandle(Step.startEventHandle, function (startEventHandle) { Step.startEventHandle = startEventHandle; label.lastChild.innerHTML = "(" + startEventHandle == null ? "" : startEventHandle.length + ")"; self.recordState(); label.innerHTML = "节点开始事件" + (Step.startEventHandle == null ? "" : "(" + Step.startEventHandle.length + ")"); }); } })(); (function (节点提交事件) { if (Step.Type != 0 && Step.Type != 1) { return; } PropSplit(divBody); var label = PropLabel(divBody, "节点提交事件"); label.innerHTML += (Step.submitEventHandle == null ? "" : "(" + Step.submitEventHandle.length + ")") var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { self.DialogEventHandle(Step.submitEventHandle, function (submitEventHandle) { Step.submitEventHandle = submitEventHandle; label.lastChild.innerHTML = "(" + submitEventHandle == null ? "" : submitEventHandle.length + ")"; self.recordState(); label.innerHTML = "节点提交事件" + (Step.submitEventHandle == null ? "" : "(" + Step.submitEventHandle.length + ")"); }); } }()); (function (节点完成事件) { if (Step.Type != 0 && Step.Type != 1 && Step.Type != 3) { return; } PropSplit(divBody); var label = PropLabel(divBody, "节点完成事件"); label.innerHTML += (Step.endEventHandle == null ? "" : "(" + Step.endEventHandle.length + ")") var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; if (Step.EndUrl != null && Step.EndUrl.length != 0) { if (Step.endEventHandle == null || Step.endEventHandle.length == 0) { Step.endEventHandle = [ { Operator: "URL回调", Handle: Step.EndUrl } ]; } delete Step.EndUrl; } if (Step.EndUrlParam != null && Step.EndUrlParam.constructor == {}.constructor) { if (Step.endEventHandle == null || Step.endEventHandle.length == 0 && Step.EndUrlParam.Wheres != null) { console.log(Step.EndUrlParam); Step.endEventHandle = [ { Operator: "修改数据", Handle: Step.EndUrlParam } ]; } delete Step.EndUrlParam; } Btn.onclick = function () { self.DialogEventHandle(Step.endEventHandle, function (endEventHandle) { Step.endEventHandle = endEventHandle; label.lastChild.innerHTML = "(" + endEventHandle == null ? "" : endEventHandle.length + ")"; self.recordState(); label.innerHTML = "节点完成事件" + (Step.endEventHandle == null ? "" : "(" + Step.endEventHandle.length + ")") }); } }()); (function (节点流转规则) { if (Step.Type != 1) { return; } PropSplit(divBody); PropLabel(divBody, " 节点流转规则"); var divValue = PropValue(divBody, "div"); divValue.style.border = "none"; var typeSel = new CLSelect(divValue); typeSel.AddItems([ "任意负责人提交后进入下一节点", "所有负责人提交后进入下一节点", "公式编辑" ]); var Btn = PropBtn(divBody, "fx公式编辑"); Btn.style.cursor = "pointer"; Btn.style.display = "none"; Btn.onclick = function () { if (!__IsDev__) { CLShowMsg("你不是开发者."); return; } self.JsCodeDialog("节点流转规则", Step.stepRule.Code, function (stepRuleCode) { Step.stepRule.Code = stepRuleCode; self.recordState(); }); } typeSel.onchanged = function () { if (typeSel.selectedIndex == 2) { Btn.style.display = "block"; } else { Btn.style.display = "none"; } if (Step.stepRule == null) { Step.stepRule = { Type: typeSel.selectedIndex } } else { Step.stepRule.Type = typeSel.selectedIndex; } self.recordState(); } typeSel.selectedIndex = Step.stepRule == null || Step.stepRule.Type == null ? (Step.Type == 6 ? 1 : 0) : Step.stepRule.Type; }()); (function (节点操作) { var Value; if (Step.Type == 0 || Step.Type == 1) { PropSplit(divBody); PropLabel(divBody, " 节点操作"); Value = PropValue(divBody, "div"); Value.style.border = "none"; var Btn = new CLCheckBox("暂存", Value); Value.lastChild.style.display = "inline-block"; Value.lastChild.style.margin = "0 5px"; Btn.checked = Step.SaveBtn == null ? false : Step.SaveBtn; Btn.onchanged = function () { Step.SaveBtn = Btn.checked; self.recordState(); } } else { return; } if (Step.Type != 1) { return; } var RejectBtn = new CLCheckBox("回退", Value); Value.lastChild.style.display = "inline-block"; Value.lastChild.style.margin = "0 5px"; RejectBtn.checked = Step.RejectBtn == null ? false : Step.RejectBtn; RejectBtn.onchanged = function () { Step.RejectBtn = RejectBtn.checked; self.recordState(); } var HandOverBtn = new CLCheckBox("转交", Value); HandOverBtn.checked = Step.HandOverBtn == null ? false : Step.HandOverBtn; HandOverBtn.onchanged = function () { Step.HandOverBtn = HandOverBtn.checked; self.recordState(); } Value.lastChild.style.display = "inline-block"; Value.lastChild.style.margin = "0 5px"; }()); (function (回退范围) { if (Step.Type != 1) { return; } PropSplit(divBody); var label = PropLabel(divBody, " 回退范围"); var span = document.createElement("span"); span.style.cssFloat = "right"; span.style.fontFamily = "CLFont"; span.style.cursor = "pointer"; span.style.color = "#0db3a6"; span.style.fontSize = "18px"; span.innerHTML = ""; label.appendChild(span); if (Step.RejectRange == null) { Step.RejectRange = []; } span.onclick = function () { var Items = []; var Steps = self.FlowClass.Steps; for (var i = 0; i < Steps.length; i++) { if (Steps[i].Type > 1) { continue; } Items.push({ "Icon": "", "Text": Steps[i].Name, "Enable": Step.RejectRange.indexOf(Steps[i].ID) < 0, "Data": Steps[i], "CallBack": function (e) { e.currentTarget.Disabled = true; Step.RejectRange.push(this.Data.ID); showRange(); } }); } var Menu = { style: { "max-height": "350px" }, Items: Items } var _CLMenu = new CLMenu(Menu, label); _CLMenu.EnableSearch(true); } var Value = PropValue(divBody, "DIV"); Value.style.height = "80px"; var pointerDiv = document.createElement("div"); pointerDiv.style.height = "28px"; pointerDiv.style.width = "2px"; pointerDiv.style.margin = "3px 0"; pointerDiv.style.verticalAlign = "top"; pointerDiv.style.background = "#0db3a6"; pointerDiv.style.display = "inline-block"; function getStep(Id) { var Steps = self.FlowClass.Steps; for (var i = 0; i < Steps.length; i++) { if (Steps[i].ID == Id) { return Steps[i]; } } } function isLess(rect1, rect2) { var Pos1 = { X: rect1.left + rect1.width / 2, Y: rect1.top + rect1.height / 2 }; if (Pos1.Y < rect2.top) { return true; } else if (Pos1.Y > rect2.bottom) { return false; } else { if (Pos1.X < rect2.left + rect2.width / 2) { return true; } else { return false; } } }; function EnableDrag(stepBtn) { var beforeBtn; CLEnableMove(stepBtn, function (stepBtn, event) { stepBtn.oStyle = stepBtn.style.cssText; Rect = stepBtn.getBoundingClientRect(); stepBtn.style.position = "fixed"; stepBtn.style.zIndex = CLMaxZIndex(); stepBtn.style.left = Rect.left + "px"; stepBtn.style.top = Rect.top + "px"; FromX = event.clientX; FromY = event.clientY; }, function (stepBtn, event) { stepBtn.style.left = event.clientX - FromX + Rect.left + "px"; stepBtn.style.top = event.clientY - FromY + Rect.top + "px"; var dragRect = stepBtn.getBoundingClientRect(); var Btns = stepBtn.parentNode.childNodes; beforeBtn = null; for (var i = Btns.length - 1; i > -1; i--) { var rect = Btns[i].getBoundingClientRect(); if (isLess(dragRect, rect)) { beforeBtn = Btns[i]; } } Value.insertBefore(pointerDiv, beforeBtn); }, function (stepBtn, event) { var rect = Value.getBoundingClientRect(); var dragRect = stepBtn.getBoundingClientRect(); if (dragRect.bottom < rect.top || dragRect.right < rect.left || dragRect.top > rect.bottom || dragRect.left > rect.right) { stepBtn.remove(); } else { if (pointerDiv.parentNode == Value) { Value.insertBefore(stepBtn, pointerDiv); } } pointerDiv.remove(); stepBtn.style.cssText = stepBtn.oStyle; var Range = []; for (var i = 0; i < Value.childNodes.length; i++) { Range.push(Value.childNodes[i].dataId); } Step.RejectRange = Range; showRange(); }); } function showRange() { Value.innerHTML = ""; Value.style.overflow = "auto"; var Range = Step.RejectRange; for (var i = 0; i < Range.length; i++) { var tempStep = getStep(Range[i]); if (tempStep == null) { Range.splice(i, 1); i--; continue; } var divBtn = document.createElement("div"); divBtn.dataId = Range[i]; divBtn.className = "CLBtnGreen"; divBtn.style.width = "initial"; divBtn.style.margin = "0 5px 5px 0"; divBtn.style.padding = "0 5px"; divBtn.style.lineHeight = "30px"; divBtn.style.height = "30px"; divBtn.innerHTML = tempStep.Name; Value.appendChild(divBtn); EnableDrag(divBtn); } } showRange(); }()); (function (转交范围) { if (Step.Type != 1) { return; } PropSplit(divBody); var label = PropLabel(divBody, " 转交范围"); label.innerHTML += (Step.HandOverRange == null ? "" : "(" + (Step.HandOverRange.Parts.length + Step.HandOverRange.Roles.length + Step.HandOverRange.Members.length) + ")"); var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { var HandOverRange = Step.HandOverRange; if (HandOverRange == null) { HandOverRange = { Parts: [ ], Roles: [ ], Members: [ ] }; } self.SelectHandle(HandOverRange, function (HandOverRange) { Step.HandOverRange = HandOverRange; label.innerHTML = (Step.HandOverRange == null ? "转交范围" : "转交范围(" + (Step.HandOverRange.Parts.length + Step.HandOverRange.Roles.length + Step.HandOverRange.Members.length) + ")") }, false); } }()); (function (关联流程) { if (Step.Type != 4) { return; } PropSplit(divBody); PropLabel(divBody, " 关联流程"); var forms = self.GetUsingForms(); var selector = new CLSelect(divBody); selector.EnableSearch(true); var Items = []; var index = -1; forms.forEach(function (form,i) { Items.push({ ID: form.ID, Name: form.Name, FlowClassID: form.FlowClassID, toString: function () { return this.Name; } }); if (form.ID == Step.FormID) { index = i; } }); selector.AddItems(Items); selector.selectedIndex = index; selector.onchanged = function () { var item = Items[selector.selectedIndex]; if (item) { Step.FormID = item.ID; Step.FlowClassID = item.FlowClassID; } else { Step.FormID = null; Step.FlowClassID = null; } } }()); (function (参数设置) { if (Step.Type != 4) { return; } PropSplit(divBody); var label = PropLabel(divBody, "参数设置"); var Btn = PropBtn(divBody, "设置"); if (Step.startParamInfo == null || Step.startParamInfo.length == 0) { label.innerHTML += "(0)"; } else { label.innerHTML += "(1)"; } Btn.onclick = function () { if (Step.FormID == null) { CLShowMsg("还没有选择关联流程"); return; } var FormID = Step.FormID; var subForm = { ID: FormID }; fn.GetFormFields.call(subForm, FormID, function (Fields) { self.ParamSetter("设置子流程的参数", Fields, Step.startParamInfo, function (ParamInfo) { Step.startParamInfo = ParamInfo; self.recordState(); if (Step.startParamInfo == null || Step.startParamInfo.length == 0) { label.innerHTML = "参数设置(0)"; } else { label.innerHTML = "参数设置(1)"; } }, "请选择主流程表单的字段"); }); } }()); (function (返回值设置) { if (Step.Type != 4) { return; } PropSplit(divBody); var label = PropLabel(divBody, "返回值设置"); var Btn = PropBtn(divBody, "设置"); if (Step.retInfo == null || Step.retInfo.ParamInfo == null || Step.retInfo.ParamInfo.length == 0) { label.innerHTML += "(0)"; } else { label.innerHTML += "(1)"; } Btn.onclick = function () { if (Step.FormID == null) { CLShowMsg("还没有选择关联流程"); return; } var FormID = Step.FormID; var sub = new FlowCoreEx(document.createElement("div")); sub.FlowClass = { FormsID: FormID } self.GetFormFields(self.FlowClass.FormsID, function (Fields) { if (Step.retInfo == null) { Step.retInfo = { FormID: FormID, ParamInfo: null } } sub.ParamSetter("设置子流程如何返回", Fields, Step.retInfo.ParamInfo, function (ParamInfo) { Step.retInfo.ParamInfo = ParamInfo; self.recordState(); if (Step.retInfo == null || Step.retInfo.ParamInfo == null || Step.retInfo.ParamInfo.length == 0) { label.innerHTML = "返回值设置(0)"; } else { label.innerHTML = "返回值设置(1)"; } }, "请选择子流程表单的字段"); }); } }()); (function (字段权限) { if (Step.Type == 4) { return; } PropSplit(divBody); PropLabel(divBody, " 字段权限"); var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { self.OpenFieldDialog(Step.DataFields, function (DataFields) { Step.DataFields = DataFields; self.recordState(); }); } }()); (function (模板选择) { if (Step.Type == 4) { return; } PropSplit(divBody); PropLabel(divBody, " 模板选择"); var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { var TplUse = Step.TplUse; if (!TplUse) { TplUse = {}; } var FormId = self.FlowClass.FormsID; FrmDesigner.UseTplDlg(FormId, TplUse, function (TplUse) { Step.TplUse = TplUse; }); } }()); (function (重新进入时) { if (Step.Type != 4) { return; } PropSplit(divBody); PropLabel(divBody, " 重新进入时"); var Value = PropValue(divBody, "div"); Value.style.height = "80px"; Value.style.cursor = "pointer"; Value.style.overflow = "auto"; Value.style.border = "none"; var Boxes = []; var Op = ["新建子流程", "重新开始子流程", "新建子流程并删除原有子流程"]; var index = Op.indexOf(Step.ReEntry); for (var i = 0; i < Op.length; i++) { Boxes[i] = new CLRadioBox(Op[i], Value, false); Boxes[i].Index = i; Boxes[i].onchanged = function () { if (this.checked == true && this.Index != index) { if (index != -1){ Boxes[index].checked = false; } index = this.Index; Step.ReEntry = Op[index]; } } } if (index == -1) { Boxes[0].checked = true; } else { Boxes[index].checked = true; } }()); } fn.FlowProp = function () { var self = this; self.PropDiv.innerHTML = "
流程属性
"; var divBody = document.createElement("div"); divBody.classList.add("Body"); self.PropDiv.appendChild(divBody); (function (流程ID) { PropLabel(divBody, "流程ID"); var Value = PropValue(divBody); Value.value = self.FlowClass.ID; Value.readOnly = true; }()); (function (流程名称) { PropSplit(divBody); PropLabel(divBody, "流程名称"); var Value = PropValue(divBody); Value.value = self.FlowClass.Name; Value.onchange = function () { self.FlowClass.Name = Value.value; document.title = Value.value+" | 流程设计" self.recordState(); } }()); (function (图标设置) { PropSplit(divBody); PropLabel(divBody, "图标设置"); var divValue = PropValue(divBody, "div"); divValue.style.height = "initial"; divValue.style.border = "none"; divValue.style.marginLeft = "15px"; divValue.style.width = "calc(100% - 15px)"; divValue.innerHTML = ""; divValue.firstChild.onclick = function (e) { var Image = e.currentTarget; self.SelectImage(function (src) { Image.setAttribute("src", src); self.FlowClass.Icon = src; }); } divValue.firstChild.onerror = function (e) { e.currentTarget.setAttribute("src", "/img/Miao.png"); e.currentTarget.onerror = null; } }()); (function (终止权限) { PropSplit(divBody); PropLabel(divBody, "终止权限"); var Value = PropValue(divBody, "div"); Value.style.border = "none"; var Btn = new CLCheckBox("允许发起人终止流程", Value); Value.lastChild.style.display = "inline-block"; Value.lastChild.style.margin = "0 5px"; Btn.checked = self.FlowClass.CreatorTerminate == null ? true : self.FlowClass.CreatorTerminate; Btn.onchanged = function () { self.FlowClass.CreatorTerminate = Btn.checked; self.recordState(); } }()); (function (终止事件) { PropSplit(divBody); var label = PropLabel(divBody, "终止事件"); label.innerHTML += (self.FlowClass.TerminateEventHandle == null ? "" : "(" + self.FlowClass.TerminateEventHandle.length + ")") var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { self.DialogEventHandle(self.FlowClass.TerminateEventHandle, function (TerminateEventHandle) { self.FlowClass.TerminateEventHandle = TerminateEventHandle; label.lastChild.innerHTML = "(" + TerminateEventHandle == null ? "" : TerminateEventHandle.length + ")"; self.recordState(); }, false); } }()); (function (回退事件) { PropSplit(divBody); var label = PropLabel(divBody, "回退事件"); label.innerHTML += (self.FlowClass.StepRejectEventHandle == null ? "" : "(" + self.FlowClass.StepRejectEventHandle.length + ")") var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { DialogEventHandle.Scope = function () { return { "G_FromID": "", "G_ToID": [] }; }; self.DialogEventHandle(self.FlowClass.StepRejectEventHandle, function (StepRejectEventHandle) { self.FlowClass.StepRejectEventHandle = StepRejectEventHandle; label.lastChild.innerHTML = "(" + StepRejectEventHandle == null ? "" : StepRejectEventHandle.length + ")"; DialogEventHandle.Scope = function () { return {}; }; self.recordState(); }, false); } }()); (function (跳转事件) { PropSplit(divBody); var label = PropLabel(divBody, "跳转事件"); label.innerHTML += (self.FlowClass.StepJmpEventHandle == null ? "" : "(" + self.FlowClass.StepJmpEventHandle.length + ")") var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { DialogEventHandle.Scope = function () { return { "G_FromID": "", "G_ToID": "" }; }; self.DialogEventHandle(self.FlowClass.StepJmpEventHandle, function (StepJmpEventHandle) { self.FlowClass.StepJmpEventHandle = StepJmpEventHandle; label.lastChild.innerHTML = "(" + StepJmpEventHandle == null ? "" : StepJmpEventHandle.length + ")"; DialogEventHandle.Scope = function () { return {};}; self.recordState(); }, false); } }()); (function (转交事件) { PropSplit(divBody); var label = PropLabel(divBody, "转交事件"); label.innerHTML += (self.FlowClass.HandOverEventHandle == null ? "" : "(" + self.FlowClass.HandOverEventHandle.length + ")") var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { DialogEventHandle.Scope = function () { return { "G_ToUserID": "", "G_TaskID": "" }; }; self.DialogEventHandle(self.FlowClass.HandOverEventHandle, function (HandOverEventHandle) { self.FlowClass.HandOverEventHandle = HandOverEventHandle; label.lastChild.innerHTML = "(" + HandOverEventHandle == null ? "" : HandOverEventHandle.length + ")"; DialogEventHandle.Scope = function () { return {}; }; self.recordState(); }, false); } }()); } fn.LineProp = function (LineID) { var self = this; self.PropDiv.innerHTML = "
连线属性
"; var divBody = document.createElement("div"); divBody.classList.add("Body"); self.PropDiv.appendChild(divBody); var IDs = LineID.split("_"); (function (连线名称) { PropLabel(divBody, "连线名称"); var input = PropValue(divBody); input.readOnly = true; input.value = self.Container.getElementsByClassName(IDs[0])[0].getElementsByClassName("Name")[0].innerText + "->" + self.Container.getElementsByClassName(IDs[1])[0].getElementsByClassName("Name")[0].innerText; }()); (function (连线描述) { PropSplit(divBody); var label = PropLabel(divBody, " 连线描述"); var btns = document.createElement("div"); btns.style.cssFloat = "right"; btns.style.opacity = "0.8"; label.appendChild(btns); var btn = document.createElement("div"); btn.style.margin = "1px 2px"; btn.style.cursor = "pointer"; btn.className = "左 对齐"; btn.style.backgroundImage = "url(/View/Flow/左对齐.png)"; btn.style.height = "18px"; btn.style.width = "18px"; btn.style.display = "inline-block"; btn.style.backgroundRepeat = "no-repeat"; btn.style.backgroundSize = "18px 18px"; btn.onclick = function () { var ele = btns.getElementsByClassName("选中")[0]; ele.classList.remove("选中"); ele.style.backgroundColor = ""; this.classList.add("选中"); this.style.backgroundColor = "rgba(13,179,166,0.5)"; Value.onchange(); } btns.appendChild(btn); btn = btn.cloneNode(); btn.onclick = function () { var ele = btns.getElementsByClassName("选中")[0]; ele.classList.remove("选中"); ele.style.backgroundColor = ""; this.classList.add("选中"); this.style.backgroundColor = "rgba(13,179,166,0.5)"; Value.onchange(); } btn.className = "中 对齐"; btn.style.backgroundImage = "url(/View/Flow/中对齐.png)"; btns.appendChild(btn); btn = btn.cloneNode(); btn.onclick = function () { var ele = btns.getElementsByClassName("选中")[0]; ele.classList.remove("选中"); ele.style.backgroundColor = ""; this.classList.add("选中"); this.style.backgroundColor = "rgba(13,179,166,0.5)"; Value.onchange(); } btn.className = "右 对齐"; btn.style.backgroundImage = "url(/View/Flow/右对齐.png)"; btns.appendChild(btn); var Value = PropValue(divBody); var Step = self.Container.getElementsByClassName(IDs[0])[0].Step; if (Step.ToIDDesc != null && Step.ToIDDesc[IDs[1]]) { var Desc = Step.ToIDDesc[IDs[1]]; if (typeof Desc == "string") { Value.value = Desc; var ele = btns.getElementsByClassName("中")[0]; ele.classList.add("选中"); ele.style.backgroundColor = "rgba(13,179,166,0.5)"; } else { Value.value = Desc.Value; var ele = btns.getElementsByClassName(Desc.Align)[0]; if (!ele) { ele = btns.getElementsByClassName("中")[0]; } ele.classList.add("选中"); ele.style.backgroundColor = "rgba(13,179,166,0.5)"; } } else { var ele = btns.getElementsByClassName("中")[0]; ele.classList.add("选中"); ele.style.backgroundColor = "rgba(13,179,166,0.5)"; } Value.onchange = function () { if (Step.ToIDDesc == null) { Step.ToIDDesc = {}; } Step.ToIDDesc[IDs[1]] = { Value: Value.value, Align: btns.getElementsByClassName("选中")[0].classList[0] }; self.updateLineDesc(LineID); self.recordState(); } }()); (function (节点流转条件) { PropSplit(divBody); var Step = self.Container.getElementsByClassName(IDs[0])[0].Step; var label = PropLabel(divBody, "节点流转条件"); if (Step.ToIDCase != null && Step.ToIDCase[IDs[1]] != null && Step.ToIDCase[IDs[1]].constructor == {}.constructor) { label.innerHTML += "(1)"; } var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { if (!__IsDev__) { CLShowMsg("你不是开发者."); return; } Step.ToIDCase = Step.ToIDCase == null ? {} : Step.ToIDCase; if (Step.Type == 5) { var _FlowCoreEx = new FlowCoreEx(document.createElement("div")); _FlowCoreEx.GetFlowClassById(Step.FlowClassID, function (FlowClass) { _FlowCoreEx.FlowClass = FlowClass; _FlowCoreEx.JsCodeDialog("节点流转条件", Step.ToIDCase[IDs[1]], function (code) { Step.ToIDCase[IDs[1]] = code; self.recordState(); }); }); } else { self.JsCodeDialog("节点流转条件", Step.ToIDCase[IDs[1]], function (code) { Step.ToIDCase[IDs[1]] = code; self.recordState(); }); } } }()); (function (节点通知) { PropSplit(divBody); var Step = self.Container.getElementsByClassName(IDs[0])[0].Step; var label = PropLabel(divBody, "节点通知"); if (Step.ToIDSms != null && Step.ToIDSms[IDs[1]] != null && Step.ToIDSms[IDs[1]].constructor == {}.constructor) { label.innerHTML += "(1)"; } var Btn = PropBtn(divBody, "设置"); Btn.style.cursor = "pointer"; Btn.onclick = function () { if (!__IsDev__) { CLShowMsg("你不是开发者."); return; } Step.ToIDSms = Step.ToIDSms == null ? {} : Step.ToIDSms; self.JsCodeDialog("节点通知", Step.ToIDSms[IDs[1]] == null ? null : Step.ToIDSms[IDs[1]], function (code) { Step.ToIDSms[IDs[1]] = code; self.recordState(); }); } }()); } fn.GetFlowClassById = function (Id, End) { var Url = "/" + CLCorpId() + "/api/Flow.chx?Function=HttpGetFlowClass&ID=" + Id; HttpGet(Url, function (Json) { if (Json.code == 0) { End(Json.data); } else { CLShowMsg(Json.msg); } }, true, true); } FlowCoreEx.ShowForm = function (ID, DataFields, TplUse) { var Box = new CLTop.CLPageBox(); Box.Body.style.padding = "0px"; var Header = Box.Header; Header.Window = CLTop; var divBox = Box.Box; var iFrame = document.createElement("iFrame"); iFrame.style.height = "100%"; iFrame.style.width = "100%"; iFrame.style.border = "none"; Box.Body.appendChild(iFrame); Box.Body.nextSibling.remove(); Box.Body.style.height = "100%"; Box.Body.style.overflow = "hidden"; var divFrame = document.createElement("div"); divFrame.style.height = "100%"; divFrame.style.width = "100%"; divFrame.style.border = "none"; divFrame.style.position = "absolute"; divFrame.style.top = "50px"; divFrame.style.left = "0"; CLEnableMove(Header, function () { divBox.style.opacity = 0.3; divBox.appendChild(divFrame); }, null, function () { divBox.style.opacity = 1; divFrame.remove(); if (divBox.offsetTop < 0) { divBox.style.top = "0px"; } var Rect = divBox.getBoundingClientRect(); if (Rect.right > CLTop.innerWidth) { divBox.style.left = parseInt(divBox.style.left) - Rect.right + CLTop.innerWidth + "px"; } if (Rect.left < 0) { divBox.style.left = parseInt(divBox.style.left) - Rect.left + "px"; } if (Rect.top < 0) { divBox.style.top = parseInt(divBox.style.top) + Rect.top + "px"; } if (Rect.top > CLTop.innerHeight - 50) { divBox.style.top = parseInt(divBox.style.top) - Rect.top + CLTop.innerHeight - 50 + "px"; } }, divBox); if (DataFields == null) { DataFields = []; } iFrame.src = "/" + CLCorpId() + "/View/Form/ShowFrm.cml?ID=" + ID; iFrame.g_DataFields = DataFields; iFrame.g_TplUse = TplUse; } FlowCoreEx.CalcAuth = function (form, Step) { function SetFields(DataFields) { function FindFieldID(ID) { for (var i = 0; DataFields != null && i < DataFields.length ; i++) { if (DataFields[i].ID == ID) { return DataFields[i]; } } return null; } var id = ""; for (var i = 0; i < form.Controls.length ; i++) { var DataField = FindFieldID(form.Controls[i].Data.ID); if (DataField == null || DataField.Read == false) { form.Controls[i].Data.Visible = false; } if (DataField != null && DataField.Write != true) { form.Controls[i].Data.Editable = false; } if (form.Controls[i].Name == "子表单") { for (var j = 0; j < form.Controls[i].Data.Field.length; j++) { DataField = FindFieldID(form.Controls[i].Data.Field[j].Data.ID); if (DataField == null || DataField.Read == false) { form.Controls[i].Data.Field[j].Data.Visible = false; } if (DataField != null && DataField.Write != true) { form.Controls[i].Data.Field[j].Data.Editable = false; form.Controls[i].Data.Field[j].Data.CanDelLine = false; form.Controls[i].Data.Field[j].Data.CanAddLine = false; } if (DataField != null && DataField.Limit == true) { form.Controls[i].Data.Limit = form.Controls[i].Data.Field[j].Data.ID; } } } } } if (Step != null) { form = CLClone(form); SetFields(Step.DataFields); } return form; } }()); ;/// (function () { CLLoad("/View/Form/lib/Frm/DialogEventHandle.css"); var listName = ["子表单", "手写签名", "成员范围", "角色选择", "复选框组", "下拉复选框", "附件上传", "成员多选", "部门多选", "流程状态", "提交人", "提交时间", "更新时间"]; function PropLabel(Body, Name) { var div = document.createElement("div"); div.classList.add("Label"); div.innerText = Name; Body.appendChild(div); return div; } function PropValue(Body, tag) { var input = document.createElement(tag == null ? "input" : tag); input.classList.add("Value"); Body.appendChild(input); return input; } var DialogEventHandle = window.DialogEventHandle = function (EventHandle, Success, FormsID, changeType, FCore) { var FormFields = CLApp.getFormById(FormsID).Fields; var Forms = CLApp.getForms(FormsID); var divDlg = document.createElement("div"); divDlg.style.width = "895px"; divDlg.style.height = "700px"; divDlg.style.position = "relative"; var dlg = new CLDialog(divDlg); var size_handles = []; dlg.onsizeChanged = function () { size_handles.forEach(function (func) { func(); }); } dlg.CreateAll("设置事件操作", function () { var load = new Loading(); var timer = setTimeout(function () { Success(Body.EventHandle); load.Stop(); },10); }); function Save() { Success(Body.EventHandle); } dlg.EnableMove(dlg.Header); var codeEditors = []; dlg.Header.ondblclick = function () { dlg.MaximizeOrReset(); for (var i = 0; i < codeEditors.length; i++) { codeEditors[i].editor.setSize('auto', '100%'); } } if (EventHandle == null) { EventHandle = []; } else { EventHandle = CLClone(EventHandle); } var Header = dlg.Header; var divSel = document.createElement("div"); Header.style.position = "relative"; divSel.style.cssText = "height:30px;line-height:30px;position:absolute;left:50%;transform:translateX(-50%);cursor:pointer;top:13px;font-family:CLFont;color:#0db3a6"; divSel.innerHTML = "添加执行操作"; Header.appendChild(divSel); var opSel = new CLSelect(divSel, divSel); opSel.AddItems([ "新增数据", "修改数据", "删除数据", "公式编辑" ]); if (FCore) { opSel.AddItems([ "数据透视" ]); } //opSel.AddItems([ // "URL回调" //]); var Body = dlg.Body; Body.style.position = "relative"; Body.style.overflow = "auto"; Body.style.overflowX = "hidden"; Body.classList.add("CLEmpty2"); Body.setAttribute("Empty", "请点击【添加执行操作】按钮添加事件处理者"); var BaseControl = ["流水号", "单行文本", "多行文本", "数字", "时间日期", "单选按钮组", "复选框组", "下拉框", "下拉复选框", "附件上传" , "子表单", "成员单选", "成员多选", "部门单选", "部门多选","成员范围" , "提交时间", "更新时间", "提交人", "流程状态" ]; var CodeCurrentFields; var CodeOtherFields; var helpLabel; function getHelpLabel() { if (helpLabel != null) { return helpLabel; } helpLabel = document.createElement("div"); helpLabel.style.cssText = "border:1px dashed #0db3a6;height:30px;line-height:30px;position:fixed;padding:0 8px"; return helpLabel; } function getField(Id, subFlag) { var Fields = Forms[this.FormSel.selectedIndex] == null ? [] : Forms[this.FormSel.selectedIndex].Fields; for (var i = 0; i < Fields.length; i++) { if (Fields[i].ID == Id) { return Fields[i]; } if (Fields[i].className == "子表单") { if (subFlag == true) { if (Fields[i].ID == Id) { return Fields[i]; } } else { var subFields = Fields[i].Field; for (var j = 0; j < subFields.length ; j++) { if (subFields[j].ID == Id) { return subFields[i]; } } } } } return null; } function createEventWheres(divContainer) { var listName = ["分割线", "选项卡", "表格控件", "关联查询", "关联数据", "子表单", "手写签名", "成员范围", "角色选择", "复选框组", "下拉复选框", "附件上传", "成员多选", "部门多选"]; var divLabel = document.createElement("div"); divLabel.className = "titleLabel"; divLabel.innerHTML = "执行条件"; divContainer.appendChild(divLabel); var spanLabel = document.createElement("div"); spanLabel.className = "addSpan"; spanLabel.innerHTML = "请添加执行条件"; divContainer.appendChild(spanLabel); var divEventWheres = document.createElement("div"); divEventWheres.style.cssText = "width:100%;"; divContainer.appendChild(divEventWheres); var Fields = CLClone(FormFields); spanLabel.onclick = function (e) { var EventHandle = divContainer.EventHandle; var Menu = { "style": { "max-height": "230px", "overflow": "auto", "margin-top": "15px", "background-color": "#fff", }, "Items": [ ] } for (var i = 0; i < Fields.length ; i++) { if (listName.indexOf(Fields[i].className) >= 0) { continue; } var Item = { "style": { "min-width": "230px" }, "Icon": "", "Text": Fields[i].Name, "Node": e.currentTarget, "Data": Fields[i], "CallBack": function (e) { e.currentTarget.Disabled = true; AddEventWhere(this.Data); } } var bHas = false; for (var j = 0; j < EventHandle.eventWheres.length; j++) { if (EventHandle.eventWheres[j].ID == Fields[i].ID) { bHas = true; } } Item.Enable = !bHas; Menu.Items.push(Item); } if (changeType) { var Item = { "style": { "min-width": "230px" }, "Icon": "", "Html": "变更类型", "Node": e.currentTarget, "Data": { ID: "changeType", Name: "变更类型", className: "变更类型" }, "CallBack": function (e) { e.currentTarget.Disabled = true; AddEventWhere(this.Data); } } var bHas = false; for (var j = 0; j < EventHandle.eventWheres.length; j++) { if (EventHandle.eventWheres[j].ID == "changeType") { bHas = true; } } Item.Enable = !bHas; Menu.Items.push(Item); } var _CLMenu = new CLMenu(Menu, spanLabel); _CLMenu.EnableSearch(true); } function AddEventWhere(Field) { var EventHandle = divContainer.EventHandle; EventHandle.eventWheres.push({ ID: Field.ID, Operator: null, Val: null, className: Field.className }); divContainer.ShowEventWheres(); } function getField3(Id) { for (var i = 0; i < Fields.length; i++) { if (Fields[i].ID == Id) { return Fields[i]; } } return Id == "changeType" ? { ID: "changeType", Name: "变更类型", className: "变更类型" } : null; } divContainer.ShowEventWheres = function ShowEventWheres() { divEventWheres.innerHTML = ""; var eventWheres = divContainer.EventHandle.eventWheres; var Operators = (function () { var AllUser = CLApp.getUserListLeave().concat(CLApp.getUserList()); function None(Div) { Div.innerHTML = ""; } function Sel(Div) { Getstr(Div); } //Val = [] function MulSel(Div) { Div.innerHTML = ""; var divBlock = document.createElement("div"); divBlock.style.cssText = "line-height:20px;border:1px solid #e0e0e0;"; Div.appendChild(divBlock); var divVals = document.createElement("div"); divVals.style.cssText = "line-height:30px;display:inline-block;vertical-align:top;max-width:150px;text-align:right;overflow:hidden"; divBlock.appendChild(divVals); var input = document.createElement("input"); input.style.cssText = "height:28px;border:none;outline:none;padding:0 8px"; divBlock.appendChild(input); var itemData = Div.Where; if (itemData.Val == null || itemData.Val.constructor != [].constructor) { itemData.Val = []; } function ShowVals() { var Val = itemData.Val; divVals.innerHTML = ""; if (Val.length == 0) { input.setAttribute("placeholder", "请输入文本内容,多个值用'enter'分开"); } else { input.removeAttribute("placeholder"); } for (var i = Val.length - 1; i > -1 ; i--) { var span = document.createElement("span"); span.innerHTML = Val[i]; span.style.cssText = "padding:0 5px;color:#606;float:right"; divVals.appendChild(span); } input.value = ""; input.style.width = divBlock.offsetWidth - divVals.offsetWidth - 2 + "px"; } ShowVals(); input.onkeydown = function (e) { if (e.keyCode == 13) { if (input.value == null || input.value.length == 0) { return; } itemData.Val.push(input.value); ShowVals(); } if (e.keyCode == 8) { if (input.value == null || input.value.length == 0) { itemData.Val.splice(itemData.Val.length - 1); ShowVals(); } } } } //Val = null function Getstr(Div) { Div.innerHTML = ""; var input = document.createElement("input"); input.style.cssText = "height:30px;line-height:28px;width:100%; border: 1px solid #e0e0e0;padding:0 13px;font-size: 14px;"; Div.appendChild(input); var itemData = Div.Where; input.value = itemData.Val == null || itemData.Val.toLocaleUpperCase == null ? "" : itemData.Val; input.onchange = function () { itemData.Val = (input.value.length == 0 ? null : input.value); } } //Val = null function GetNum(Div) { Div.innerHTML = ""; var input = document.createElement("input"); input.style.cssText = "height:30px;line-height:28px;width:100%; border: 1px solid #e0e0e0;padding:0 13px;font-size: 14px;"; Div.appendChild(input); var itemData = Div.Where; input.value = itemData.Val == null || itemData.Val.toFixed == null ? "" : itemData.Val; input.oninput = function () { CLCheckFloat(input, 10); } input.onchange = function () { itemData.Val = input.value.length == 0 ? null : input.value * 1; } } //Val = {Min: null,Max: null } function GetNumRange(Div) { Div.innerHTML = ""; var itemData = Div.Where; var iMin = document.createElement("input"); iMin.style.cssText = "height:30px;line-height:28px;width:calc(50% - 12px); border: 1px solid #e0e0e0;padding:0 13px;font-size: 14px;"; iMin.setAttribute("placeholder", "最小值"); Div.appendChild(iMin); if (itemData.Val == null || itemData.Val.Min == null) { itemData.Val = { Min: null, Max: null }; } iMin.oninput = function () { CLCheckFloat(iMin, 10); } iMin.value = itemData.Val.Min == null ? "" : itemData.Val.Min; iMin.onchange = function () { itemData.Val.Min = iMin.value.length == 0 ? null : iMin.value * 1; } var To = document.createElement("span"); To.style.padding = "0 6px"; To.innerHTML = "~"; Div.appendChild(To); Div.appendChild(To); var iMax = iMin.cloneNode(); iMax.setAttribute("placeholder", "最大值"); iMax.oninput = function () { CLCheckFloat(iMax, 10); } iMax.value = itemData.Val.Max == null ? "" : itemData.Val.Max; iMax.onchange = function () { itemData.Val.Max = iMax.value.length == 0 ? null : iMax.value * 1; } Div.appendChild(iMax); } //Val = null function UserSel(Div) { Div.innerHTML = ""; var itemData = Div.Where; var _CLSelect = new CLSelect(Div); _CLSelect.MultiSel = true; function Show(Val) { if (Val != null) { _CLSelect.SetValues([Val.Name]); } else { _CLSelect.SetValues([]); } } Show(itemData.Val); _CLSelect.OnClick = function () { var Range = { Roles: [], Parts: [], Members: [], Dynamic: [] } Range.Dynamic.Visible = false; FrmCtrls.MemberDialog(Range, false, { Members: itemData.Val == null ? null : [itemData.Val] }, true, function (Val) { itemData.Val = Val.Members[0]; Show(itemData.Val); }); } } //Val = [] function UserMulSel(Div) { Div.innerHTML = ""; var itemData = Div.Where; var _CLSelect = new CLSelect(Div); _CLSelect.MultiSel = true; function Show(Val) { var Names = []; for (var i = 0; Val != null && i < Val.length; i++) { Names.push(CLApp.getMemberNameById(Val[i])); } _CLSelect.SetValues(Names); } Show(itemData.Val); _CLSelect.OnClick = function () { var Range = { Roles: [], Parts: [], Members: [], Dynamic: [] } Range.Dynamic.Visible = false; FrmCtrls.MemberDialog(Range, true, { Members: itemData.Val == null ? null : [itemData.Val] }, true, function (Val) { itemData.Val = Val.Members; Show(itemData.Val); }); } } //Val = null function DepartSel(Div) { Div.innerHTML = ""; var _CLSelect = new CLSelect(Div); var itemData = Div.Where; _CLSelect.SetValue(CLApp.getDepartmentNameById(itemData.Val)); _CLSelect.OnClick = function () { var DepartData = CLApp.getDepartTree()[0]; var _CLTree = new CLTree(DepartData); var divBg = document.createElement("div"); divBg.style.cssText = "position:fixed;top:0;bottom:0;right:0;left:0;"; divBg.style.zIndex = CLTop.CLMaxZIndex(); CLTop.document.body.appendChild(divBg); divBg.Close = function () { if (divBg.parentNode != null) { divBg.parentNode.removeChild(divBg); } } divBg.addEventListener("mousedown", function () { divBg.Close(); window.removeEventListener("unload", divBg.Close); }); window.addEventListener("unload", divBg.Close); var divMenu = document.createElement("div"); divMenu.style.cssText = "position:fixed;background:#fff;overflow:auto;border:solid #e0e0e0 1px;"; divBg.appendChild(divMenu); divMenu.addEventListener("mousedown", function (e) { e.stopPropagation(); }); divMenu.style.maxHeight = "390px"; var divSearch = document.createElement("div"); divSearch.className = "ItemSearch"; divMenu.appendChild(divSearch); var inputSearch = document.createElement("input"); inputSearch.style.height = "29px"; inputSearch.style.lineHeight = "29px"; inputSearch.style.border = "none"; inputSearch.setAttribute("placeholder", "搜索"); inputSearch.style.width = "calc(100% - 7px)"; inputSearch.style.marginLeft = "5px"; inputSearch.value = ""; inputSearch.oninput = function () { _CLTree.Search(inputSearch.value); } divSearch.appendChild(inputSearch); var divClear = document.createElement("div"); divClear.className = "ItemClear"; divClear.innerHTML = "--请选择--"; divMenu.appendChild(divClear); divClear.onclick = function () { itemData.Val = null; _CLSelect.SetValue(""); divBg.Close(); window.removeEventListener("unload", divBg.Close); } function SetPos() { var Rect = Div.getBoundingClientRectEx(); divMenu.style.top = Rect.bottom + "px"; divMenu.style.left = Rect.left + "px"; divMenu.style.minWidth = Rect.width + "px"; divMenu.style.zIndex = CLTop.CLMaxZIndex(); var mRect = divMenu.getBoundingClientRectEx(); if (mRect.bottom > CLTop.innerHeight) { divMenu.style.top = Rect.top - mRect.height + "px"; if (divMenu.offsetTop < 0) { divMenu.style.top = "0px"; } } if (mRect.right > CLTop.innerWidth) { divMenu.style.left = CLTop.innerWidth - divMenu.offsetWidth + "px"; } } divBg.appendChild(divMenu); _CLTree.Render(divMenu); var divTree = divMenu.lastChild; divTree.style.maxHeight = divMenu.offsetHeight - 62 + "px"; divTree.style.overflow = "auto"; _CLTree.Select(itemData.Val); SetPos(); _CLTree.OnSelected = function (ItemData) { itemData.Val = ItemData.ID; _CLSelect.SetValue(ItemData.Name); divBg.Close(); window.removeEventListener("unload", divBg.Close); } } } //Val = [] function DepartMulSel(Div) { Div.innerHTML = ""; var _CLSelect = new CLSelect(Div); _CLSelect.MultiSel = true; var itemData = Div.Where; if (itemData.Val == null || itemData.Val.concat == null) { itemData.Val = []; } function ShowVales() { var IDs = itemData.Val; var Names = []; for (var i = 0; i < IDs.length; i++) { if (IDs[i] != null) { Names.push(CLApp.getDepartmentNameById(IDs[i])); } else { Names.push("未填写"); } } _CLSelect.SetValues(Names); } ShowVales(); _CLSelect.OnClick = function () { var DepartData = CLApp.getDepartTree()[0]; var _CLTree = new CLTree(DepartData); _CLTree.MultiSel = true; var divBg = document.createElement("div"); divBg.style.cssText = "position:fixed;top:0;bottom:0;right:0;left:0;"; divBg.style.zIndex = CLTop.CLMaxZIndex(); CLTop.document.body.appendChild(divBg); divBg.Close = function () { if (divBg.parentNode != null) { divBg.parentNode.removeChild(divBg); } } divBg.addEventListener("mousedown", function () { divBg.Close(); window.removeEventListener("unload", divBg.Close); }); window.addEventListener("unload", divBg.Close); var divMenu = document.createElement("div"); divMenu.style.cssText = "position:fixed;background:#fff;overflow:auto;border:solid #e0e0e0 1px;max-width:100%;"; divBg.appendChild(divMenu); divMenu.style.maxHeight = "390px"; var divSearch = document.createElement("div"); divSearch.className = "ItemSearch"; divMenu.appendChild(divSearch); var inputSearch = document.createElement("input"); inputSearch.style.height = "29px"; inputSearch.style.lineHeight = "29px"; inputSearch.style.border = "none"; inputSearch.setAttribute("placeholder", "搜索"); inputSearch.style.width = "calc(100% - 7px)"; inputSearch.style.marginLeft = "5px"; inputSearch.value = ""; inputSearch.oninput = function () { _CLTree.Search(inputSearch.value); } divSearch.appendChild(inputSearch); divMenu.addEventListener("mousedown", function (e) { e.stopPropagation(); }); var divAll = document.createElement("div"); divAll.className = "ItemClear"; divAll.style.padding = "0 6px 0 20px"; var _AllBox = new CLCheckBox("全选", divAll, true); divMenu.appendChild(divAll); var divNull = document.createElement("div"); divNull.className = "ItemClear"; divNull.style.padding = "0 6px 0 20px"; var _NullBox = new CLCheckBox("未填写", divNull, true); divMenu.appendChild(divNull); if (itemData.Val.indexOf(null) >= 0) { _NullBox.checked = true; } _NullBox.onchanged = function () { if (_NullBox.checked) { itemData.Val.push(null); } else { itemData.Val.splice(itemData.Val.indexOf(null), 1); } if (_CLTree.IsAllSel && _NullBox.checked) { _AllBox.Checked = true; } else { _AllBox.Checked = false; } ShowVales(); } _AllBox.onchanged = function () { if (_AllBox.checked) { _CLTree.SelectAll(); _NullBox.checked = true; } else { _CLTree.UnSelectAll(); _NullBox.checked = false; } ShowVales(); } function SetPos() { var Rect = Div.getBoundingClientRectEx(); divMenu.style.top = Rect.bottom + "px"; divMenu.style.left = Rect.left + "px"; divMenu.style.minWidth = Rect.width + "px"; divMenu.style.zIndex = CLTop.CLMaxZIndex(); var mRect = divMenu.getBoundingClientRectEx(); if (mRect.bottom > CLTop.innerHeight) { divMenu.style.top = Rect.top - mRect.height + "px"; if (divMenu.offsetTop < 0) { divMenu.style.top = "0px"; } } if (mRect.right > CLTop.innerWidth) { divMenu.style.left = CLTop.innerWidth - divMenu.offsetWidth + "px"; } } divBg.appendChild(divMenu); _CLTree.Render(divMenu); var divTree = divMenu.lastChild; divTree.style.maxHeight = divMenu.offsetHeight - 92 + "px"; divTree.style.overflow = "scroll"; SetPos(); _CLTree.OnAllSelected = function () { _CLTree.IsAllSel = true; if (_NullBox.checked) { _AllBox.Checked = true; } } _CLTree.OnLostAllSelected = function () { _CLTree.IsAllSel = false; _AllBox.Checked = false; } for (var i = 0 ; i < itemData.Val.length; i++) { _CLTree.Select(itemData.Val[i]); } _CLTree.OnSelected = function (ItemData) { itemData.Val.push(ItemData.ID); ShowVales(); } _CLTree.OnLostSelected = function (ItemData) { itemData.Val.splice(itemData.Val.indexOf(ItemData.ID), 1); ShowVales(); } } } //Val = {DataType: null,sValue: null} function GetDateTime(Div) { Div.innerHTML = ""; var _CLSelect = new CLSelect(Div); _CLSelect.SearchAble = true; var itemData = Div.Where; _CLSelect.AddItems(["固定值", "今天", "昨天", "本周", "上周", "本月", "上月"]); var divDate = document.createElement("div"); divDate.style.cssText = "height:30px;line-height:28px;width:100%; border: 1px solid #e0e0e0;padding:0 8px;font-size: 14px;margin-top:10px;"; divDate.className = "Dt"; if (itemData.Val == null || itemData.Val.DataType == null) { itemData.Val = { DataType: null, sValue: null }; } Div.appendChild(divDate); _CLSelect.onchanged = function () { itemData.Val.DataType = _CLSelect.GetValue(); if (itemData.Val.DataType == "固定值") { divDate.style.display = "block"; } else { divDate.style.display = "none"; if (itemData.Val.DataType == "今天") { itemData.Val.sValue = new Date().Format("yyyy-MM-dd"); } if (itemData.Val.DataType == "昨天") { } if (itemData.Val.DataType == "本周") { } if (itemData.Val.DataType == "上周") { } if (itemData.Val.DataType == "本月") { } if (itemData.Val.DataType == "上月") { } } } if (itemData.Val.DataType == null) { _CLSelect.selectedIndex = 0; } divDate.id = CLMakeId(); divDate.innerText = (itemData.Val.sValue == null ? "" : itemData.Val.sValue); divDate.onclick = function () { var _dt = CLDate(itemData.Val.sValue, "yyyy-MM-dd", divDate); _dt.onchanged = function () { var sVal = _dt.Value.toString(); itemData.Val.sValue = sVal; divDate.innerHTML = sVal; } } } //Val = {dtStart: null,dtEnd: null} function GetDateTimeRange(Div) { Div.innerHTML = ""; var StartDt = document.createElement("div"); StartDt.style.cssText = "height:30px;line-height:28px;width:100%; border: 1px solid #e0e0e0;padding:0 8px;font-size: 14px;"; StartDt.className = "Dt"; Div.appendChild(StartDt); StartDt.id = CLMakeId(); StartDt.setAttribute("placeholder", "起始日期"); var itemData = Div.Where; if (itemData.Val == null || itemData.Val.dtStart == null) { itemData.Val = { dtStart: null, dtEnd: null }; } StartDt.innerHTML = itemData.Val.dtStart; StartDt.onclick = function () { var _dt = CLDate(itemData.Val.dtStart, "yyyy-MM-dd", StartDt); _dt.onchanged = function () { var sVal = _dt.Value.toString(); itemData.Val.dtStart = sVal; StartDt.innerHTML = sVal; } } var EndDt = StartDt.cloneNode(); Div.appendChild(EndDt); EndDt.id = CLMakeId(); EndDt.style.marginTop = "10px"; EndDt.setAttribute("placeholder", "结束日期"); EndDt.innerHTML = itemData.Val.dtEnd; EndDt.onclick = function () { var _dt = CLDate(itemData.Val.dtEnd, "yyyy-MM-dd", EndDt); _dt.onchanged = function (str) { var sVal = _dt.Value.toString(); itemData.Val.dtEnd = sVal; EndDt.innerHTML = sVal; } } } //Val = null function Status(Div) { Div.innerHTML = ""; var _CLSelect = new CLSelect(Div); _CLSelect.AddItems(["运行中", "已完成", "已终止", "已存档"]); var Where = Div.Where; _CLSelect.EnableClear(true); Where.Val = Where.Val == null ? null : Where.Val; _CLSelect.selectedIndex = (Where.Val == null ? -1 : Where.Val - 1) _CLSelect.onchanged = function () { Where.Val = _CLSelect.selectedIndex == -1 ? null : _CLSelect.selectedIndex + 1; } } //Val = [] function MulStatus(Div) { Div.innerHTML = ""; var _CLSelect = new CLSelect(Div); _CLSelect.AddItems(["运行中", "已完成", "已终止", "已存档"]); var Where = Div.Where; _CLSelect.EnableClear(true); _CLSelect.EnableMultiSel(true); Where.Val = Where.Val == null ? null : Where.Val; _CLSelect.selectedIndex = (Where.Val == null ? -1 : Where.Val - 1) _CLSelect.onchanged = function () { Where.Val = _CLSelect.selectedIndexs.length == 0 ? null : _CLSelect.selectedIndexs; } } function changeType(Div) { Div.innerHTML = ""; var _CLSelect = new CLSelect(Div); _CLSelect.AddItems(["修改", "存档", "回档"]); var Where = Div.Where; _CLSelect.EnableClear(true); Where.Val = Where.Val == null ? null : Where.Val; _CLSelect.selectedIndex = _CLSelect.Items.indexOf(Where.Val); _CLSelect.onchanged = function () { Where.Val = _CLSelect.GetValue(); } } return { 流水号: (function () { return { Items: [ "等于", "不等于", "等于任意一个", "不等于任意一个", "包含", "不包含", "为空", "不为空" ], DefaultIndex: 2, Functors: [ Getstr, Getstr, MulSel, MulSel, Getstr, Getstr, None, None ] } })(), 单行文本: (function () { return { Items: [ "等于", "不等于", "等于任意一个", "不等于任意一个", "包含", "不包含", "为空", "不为空" ], DefaultIndex: 2, Functors: [ Getstr, Getstr, MulSel, MulSel, Getstr, Getstr, None, None ], Icon: FrmCtrls["单行文本"].Icon } })(), 多行文本: (function () { return { Items: [ "包含", "不包含", "为空", "不为空" ], DefaultIndex: 0, Functors: [ Getstr, Getstr, None, None ], Icon: FrmCtrls["多行文本"].Icon } })(), 数字: (function () { return { Items: [ "等于", "不等于", "大于", "大于等于", "小于", "小于等于", "选择范围", "为空", "不为空" ], DefaultIndex: 0, Functors: [ GetNum, GetNum, GetNum, GetNum, GetNum, GetNum, GetNumRange, None, None ], Icon: FrmCtrls["数字"].Icon } })(), 时间日期: (function () { return { Items: [ "等于", "不等于", "大于等于", "小于等于", "选择范围", "为空", "不为空" ], DefaultIndex: 0, Functors: [ GetDateTime, GetDateTime, GetDateTime, GetDateTime, GetDateTimeRange, None, None ], Icon: FrmCtrls["时间日期"].Icon } })(), 单选按钮组: (function () { return { Items: [ "等于", "不等于", "等于任意一个", "不等于任意一个", "包含", "不包含", "为空", "不为空" ], DefaultIndex: 2, Functors: [ Sel, Sel, MulSel, MulSel, MulSel, MulSel, None, None ], Icon: FrmCtrls["单选按钮组"].Icon } })(), 复选框组: (function () { return { Items: [ "包含任意一个", "同时包含", "等于", "为空", "不为空" ], DefaultIndex: 0, Functors: [ MulSel, MulSel, MulSel, None, None ], Icon: FrmCtrls["复选框组"].Icon } })(), 下拉框: (function () { return { Items: [ "等于", "不等于", "等于任意一个", "不等于任意一个", "包含", "不包含", "为空", "不为空" ], DefaultIndex: 2, Functors: [ Sel, Sel, MulSel, MulSel, Getstr, Getstr, None, None ], Icon: FrmCtrls["下拉框"].Icon } })(), 下拉复选框: (function () { return { Items: [ "包含任意一个", "同时包含", "等于", "为空", "不为空" ], DefaultIndex: 0, Functors: [ MulSel, MulSel, MulSel, None, None ], Icon: FrmCtrls["下拉复选框"].Icon } })(), 附件上传: (function () { return { Items: [ "为空", "不为空" ], DefaultIndex: 0, Functors: [ None, None ], Icon: FrmCtrls["附件上传"].Icon } })(), 成员单选: (function () { return { Items: [ "等于", "不等于", "等于任意一个", "不等于任意一个", "为空", "不为空" ], DefaultIndex: 2, Functors: [ UserSel, UserSel, UserMulSel, UserMulSel, None, None ], Icon: FrmCtrls["成员单选"].Icon } })(), 成员多选: (function () { return { Items: [ "包含任意一个", "同时包含", "等于", "为空", "不为空" ], DefaultIndex: 0, Functors: [ UserMulSel, UserMulSel, UserMulSel, None, None ], Icon: FrmCtrls["成员多选"].Icon } })(), 部门单选: (function () { return { Items: [ "等于", "不等于", "等于任意一个", "不等于任意一个", "为空", "不为空" ], DefaultIndex: 2, Functors: [ DepartSel, DepartSel, DepartMulSel, DepartMulSel, None, None ], Icon: FrmCtrls["部门单选"].Icon } })(), 部门多选: (function () { return { Items: [ "包含任意一个", "同时包含", "等于", "为空", "不为空" ], DefaultIndex: 0, Functors: [ DepartMulSel, DepartMulSel, DepartMulSel, None, None ], Icon: FrmCtrls["部门多选"].Icon } })(), 流程状态: (function () { return { Items: [ "等于", "不等于", "等于任意一个", "不等于任意一个", "为空", "不为空" ], DefaultIndex: 0, Functors: [ Status, Status, MulStatus, MulStatus, None, None ] } })(), 变更类型: (function () { return { Items: [ "等于" ], DefaultIndex: 0, Functors: [ changeType ] } })(), } })(); Operators.提交时间 = Operators.时间日期; Operators.更新时间 = Operators.时间日期; Operators.提交人 = Operators.成员单选; for (var i = 0; i < eventWheres.length; i++) { var Field = getField3(eventWheres[i].ID); if (Field == null) { continue; } var divLine = document.createElement("div"); divLine.style.cssText = "width:100%;margin-bottom:10px;line-height:30px"; divEventWheres.appendChild(divLine); divLine.Where = eventWheres[i]; divLine.Field = Field; var FieldDiv = document.createElement("div"); FieldDiv.style.cssText = "width:245px;display:inline-block;line-height:30px;border:solid 1px #d9d9d9;padding:0 8px;vertical-align:top;"; FieldDiv.innerHTML = "" + FrmCtrls[Field.ID == "changeType" ? "单行文本" : Field.className].Icon + "" + Field.Name; divLine.appendChild(FieldDiv); var opSelDiv = document.createElement("div"); opSelDiv.style.cssText = "width:145px;display:inline-block;height:30px;line-height:30px;margin:0 8px;vertical-align:top;color:#0db3a6"; divLine.appendChild(opSelDiv); var divVal = document.createElement("div"); divLine.appendChild(divVal); divLine.divVal = divVal; divVal.style.cssText = "width:275px;display:inline-block;line-height:30px;margin:0 8px 0 16px;vertical-align:top;"; divLine.appendChild(divVal); divVal.Where = eventWheres[i]; var opSel = new CLSelect(opSelDiv); opSel.AddItems(Operators[Field.className].Items); opSel.Operators = Operators[Field.className]; opSel.divVal = divVal; opSel.onchanged = function (This) { This.Operator = This.Operators.Items[This.selectedIndex]; This.Operators.Functors[This.selectedIndex](This.divVal); this.divVal.Where.Operator = This.Operator; } if (divLine.Where.Operator != null) { opSel.selectedIndex = opSel.Items.indexOf(divLine.Where.Operator); } else { opSel.selectedIndex = Operators[Field.className].DefaultIndex; } var delDiv = document.createElement("div"); delDiv.style.cssText = "font-family:CLFont;height:30px;line-height:30px;display:inline-block;padding:3px;font-size:20px;vertical-align:top;color:#3F80AE;cursor:pointer;"; delDiv.onmouseover = function (e) { this.style.color = "#e86261"; this.style.fontWeight = "900"; } delDiv.onmouseleave = function (e) { this.style.color = "#3F80AE"; this.style.fontWeight = "100"; } delDiv.onclick = function (e) { this.parentNode.remove(); } delDiv.innerHTML = ""; var remove = divLine.remove; divLine.remove = function () { eventWheres.splice(eventWheres.indexOf(this.Where), 1); remove.call(this); } divLine.appendChild(delDiv); } } Object.defineProperty(divContainer, "eventWheres", { get: function () { var eventWheres = []; var Lines = divEventWheres.childNodes; for (var i = 0; i < Lines.length; i++) { eventWheres.push(Lines[i].Where); } return eventWheres; } }); return divLabel } function createUpdateFields(divContainer) { var EventHandle = divContainer.EventHandle; var divLabel = document.createElement("div"); divLabel.className = "titleLabel"; divLabel.innerHTML = "修改数据中的那些字段"; divContainer.appendChild(divLabel); var spanLabel = document.createElement("div"); spanLabel.className = "addSpan"; spanLabel.innerHTML = "请添加字段"; divContainer.appendChild(spanLabel); spanLabel.onclick = function (e) { if (divContainer.FormSel.selectedIndex == -1 || divContainer.FormSel.selectedIndex == null) { CLShowMsg("没有选择表单"); return; } var Menu = { "style": { "max-width": "230px", "max-height": "230px", "overflow": "auto", "margin-top": "15px", "background-color": "#fff", }, "Items": [ ] } var listName = ["分割线", "选项卡", "表格控件", "关联查询", "关联数据", "提交时间", "更新时间", "提交人", "流程状态"]; var Fields = Forms[divContainer.FormSel.selectedIndex] == null ? [] : Forms[divContainer.FormSel.selectedIndex].Fields; for (var i = 0; i < Fields.length ; i++) { if (listName.indexOf(Fields[i].className) >= 0) { continue; } var Item = { "style": { "min-width": "230px", "max-width": "230px", }, "Icon": "", "Text": Fields[i].Name, "Node": e.currentTarget, "Data": Fields[i], "CallBack": function (e) { e.currentTarget.Disabled = true; AddUpdateField(this.Data); } } var bHas = false; for (var j = 0; j < EventHandle.updateFields.length; j++) { if (EventHandle.updateFields[j].ID == Fields[i].ID) { bHas = true; } } Item.Enable = !bHas; Menu.Items.push(Item); } var _CLMenu = new CLMenu(Menu, spanLabel); _CLMenu.EnableSearch(true); } var divFields = document.createElement("div"); divFields.style.cssText = "width:100%;"; divContainer.appendChild(divFields); function AddUpdateField(Field) { var Val = { ID: Field.ID, valType: "流程表单字段值", Val: null, ctrlID: null, className: Field.className }; if (Val.className == "子表单") { Val.GetSubFields = function () { return Field.Field; } } EventHandle.updateFields.push(Val); divContainer.ShowFields(); } divContainer.ShowFields = function ShowFields() { divFields.innerHTML = ""; var updateFields = EventHandle.updateFields; for (var i = 0; i < updateFields.length; i++) { var Field = divContainer.getField(updateFields[i].ID); if (Field == null) { continue; } if (updateFields[i].className == "子表单") { updateFields[i].GetSubFields = function () { return Field.Field; } } var divLine = DialogEventHandle.createValLine(updateFields[i], Field.Name, divFields, FormFields, "请选择触发表单的字段", false, true); divLine.Remove = function () { updateFields.splice(updateFields.indexOf(this.ValField), 1); this.remove(); } } } Object.defineProperty(divContainer, "updateFields", { get: function () { var updateFields = []; var Lines = divFields.childNodes; for (var i = 0; i < Lines.length; i++) { updateFields.push(Lines[i].ValField); } return updateFields; } }); return divLabel; } function createWheres(divContainer, title) { var listName = ["分割线", "选项卡", "表格控件", "关联查询", "关联数据", "子表单", "手写签名", "成员范围", "角色选择", "复选框组", "下拉复选框", "附件上传", "成员多选", "部门多选"]; var divLabel = document.createElement("div"); divLabel.style.cssText = "height:30px;line-height:30px;width:100%;color:#5E6D82;cursor:default;margin-top:10px;"; divLabel.innerHTML = title; divContainer.appendChild(divLabel); var spanLabel = document.createElement("div"); spanLabel.style.cssText = "height:30px;line-height:30px;display:inline-block;color:#0db3a6;cursor:pointer;"; spanLabel.innerHTML = "添加过滤条件"; divContainer.appendChild(spanLabel); var divWheres = document.createElement("div"); divWheres.style.cssText = "width:100%;"; divContainer.appendChild(divWheres); spanLabel.onclick = function (e) { if (divContainer.FormSel.selectedIndex == -1 || divContainer.FormSel.selectedIndex == null) { CLShowMsg("没有选择表单"); return; } var Menu = { "style": { "max-width": "230px", "max-height": "230px", "overflow": "auto", "margin-top": "15px", "background-color": "#fff", }, "Items": [ ] } var Fields = Forms[divContainer.FormSel.selectedIndex] == null ? [] : [{ ID: "ID", Name: "ID", className: "单行文本" }].concat(Forms[divContainer.FormSel.selectedIndex].Fields); for (var i = 0; i < Fields.length ; i++) { if (listName.indexOf(Fields[i].className) >= 0) { continue; } var Item = { "style": { "min-width": "230px", "max-width": "230px", }, "Icon": "", "Text": Fields[i].Name, "Node": e.currentTarget, "Data": Fields[i], "CallBack": function (e) { e.currentTarget.Disabled = true; AddWhere(this.Data); } } var bHas = false; var EventHandle = divContainer.EventHandle; for (var j = 0; j < EventHandle.Wheres.length; j++) { if (EventHandle.Wheres[j].ID == Fields[i].ID) { bHas = true; } } Item.Enable = !bHas; Menu.Items.push(Item); } var _CLMenu = new CLMenu(Menu, spanLabel); _CLMenu.EnableSearch(true); } function AddWhere(Field) { var EventHandle = divContainer.EventHandle; EventHandle.Wheres.push({ ID: Field.ID, valType: "流程表单字段值", Val: null, ctrlID: null, className: Field.className }); divContainer.ShowWheres(); } divContainer.ShowWheres = function ShowWheres() { divWheres.innerHTML = ""; var Wheres = divContainer.EventHandle.Wheres; for (var i = 0; i < Wheres.length; i++) { var Field = Wheres[i].ID != "ID" ? divContainer.getField(Wheres[i].ID) : { ID: "ID", Name: "ID", className: "单行文本" }; if (Field == null) { continue; } var divLine = document.createElement("div"); divLine.style.cssText = "width:100%;height:30px;margin-bottom:10px;line-height:30px"; divWheres.appendChild(divLine); divLine.Where = Wheres[i]; divLine.Field = Field; var FieldDiv = document.createElement("div"); FieldDiv.style.cssText = "width:245px;display:inline-block;height:30px;line-height:30px;border:solid 1px #d9d9d9;padding:0 8px;vertical-align:top;"; FieldDiv.innerHTML = "" + FrmCtrls[Field.className].Icon + "" + Field.Name; divLine.appendChild(FieldDiv); var op = document.createElement("div"); op.style.cssText = "height:30px;line-height:30px;display:inline-block;padding:0 16px;vertical-align:top;color:#0db3a6"; op.innerHTML = "等于"; divLine.appendChild(op); var divType = document.createElement("div"); divType.style.cssText = "width:160px;height:30px;display:inline-block;vertical-align:top;"; divLine.appendChild(divType); var typeSel = new CLSelect(divType); typeSel.Where = Wheres[i]; typeSel.divLine = divLine; typeSel.AddItems([ "流程表单字段值", "自定义", "空值" ]); var divVal = document.createElement("div"); divLine.appendChild(divVal); divLine.divVal = divVal; divVal.style.cssText = "width:245px;display:inline-block;height:30px;line-height:30px;margin:0 8px 0 16px;vertical-align:top;"; divLine["流程表单字段值"] = function () { var divLine = this; divLine.divVal.innerHTML = ""; var valSel = new CLSelect(divLine.divVal); divLine.Where.Val = null; var Fields = []; var selIndex = -1; for (var i = 0; i < FormFields.length ; i++) { if (listName.indexOf(FormFields[i].className) >= 0) { continue; } if (!FrmCtrls.CompareAble(FormFields[i].className, divLine.Field.className)) { continue; } Fields.push(FormFields[i]); valSel.AddItems([ FormFields[i].Name ]); if (FormFields[i].ID == divLine.Where.ctrlID) { selIndex = Fields.length - 1; } } valSel.selectedIndex = selIndex; valSel.onchanged = function (This) { divLine.Where.ctrlID = Fields[This.selectedIndex].ID; } } divLine["自定义"] = function () { var divLine = this; divLine.divVal.innerHTML = ""; divLine.Where.ctrlID = null; if (divLine.Field.className == "成员单选" || divLine.Field.className == "提交人") { var Div = document.createElement("div"); var itemData = divLine.Where; Div.style.cssText = "border:1px dashed #e0e0e0;height:30px;width:100%;padding:0 8px;line-height:28px;font-size:5px;cursor:pointer"; divLine.divVal.appendChild(Div); Div.onclick = function () { var Range = { Roles: [], Parts: [], Members: [], Dynamic: [] } Range.Dynamic.Visible = false; FrmCtrls.MemberDialog(Range, false, { Members: itemData.Val == null ? null : [itemData.Val] }, true, function (Val) { itemData.Val = Val.Members[0]; ShowVal(CLApp.getMemberNameById(itemData.Val)); }); } function ShowVal(Name) { if (divLine.Where.Val != null) { Div.innerHTML = ""; var divVal = document.createElement("div"); var Icon = document.createElement("span"); Icon.style.cssText = "font-family:CLFont;color:#f0ad4e;padding-right:8px"; Icon.innerHTML = ""; divVal.appendChild(Icon); var text = document.createElement("span"); var name = Name == null ? CLApp.getMemberNameById(divLine.Where.Val) : Name; text.innerHTML = name == null ? "??????" : name; divVal.appendChild(text); Div.appendChild(divVal); } else { Div.innerHTML = "
点击选择成员
"; } } ShowVal(); } else if (divLine.Field.className == "部门单选") { var Div = document.createElement("div"); Div.style.cssText = "border:1px dashed #e0e0e0;height:30px;width:100%;padding:0 8px;line-height:28px;font-size:5px;cursor:pointer"; divLine.divVal.appendChild(Div); var itemData = divLine.Where; Div.onclick = function () { var DepartData = CLApp.getDepartTree()[0]; var _CLTree = new CLTree(DepartData); var divBg = document.createElement("div"); divBg.style.cssText = "position:fixed;top:0;bottom:0;right:0;left:0;"; divBg.style.zIndex = CLTop.CLMaxZIndex(); CLTop.document.body.appendChild(divBg); divBg.Close = function () { if (divBg.parentNode != null) { divBg.parentNode.removeChild(divBg); } } divBg.addEventListener("mousedown", function () { divBg.Close(); window.removeEventListener("unload", divBg.Close); }); window.addEventListener("unload", divBg.Close); var divMenu = document.createElement("div"); divMenu.style.cssText = "position:fixed;background:#fff;overflow:auto;border:solid #e0e0e0 1px;"; divBg.appendChild(divMenu); divMenu.addEventListener("mousedown", function (e) { e.stopPropagation(); }); divMenu.style.maxHeight = "390px"; var divSearch = document.createElement("div"); divSearch.className = "ItemSearch"; divMenu.appendChild(divSearch); var inputSearch = document.createElement("input"); inputSearch.style.height = "29px"; inputSearch.style.lineHeight = "29px"; inputSearch.style.border = "none"; inputSearch.setAttribute("placeholder", "搜索"); inputSearch.style.width = "calc(100% - 7px)"; inputSearch.style.marginLeft = "5px"; inputSearch.value = ""; inputSearch.oninput = function () { _CLTree.Search(inputSearch.value); } divSearch.appendChild(inputSearch); var divClear = document.createElement("div"); divClear.className = "ItemClear"; divClear.innerHTML = "--请选择--"; divMenu.appendChild(divClear); divClear.onclick = function () { itemData.Val = null; ShowVal(); divBg.Close(); window.removeEventListener("unload", divBg.Close); } function SetPos() { var Rect = Div.getBoundingClientRectEx(); divMenu.style.top = Rect.bottom + "px"; divMenu.style.left = Rect.left + "px"; divMenu.style.minWidth = Rect.width + "px"; divMenu.style.zIndex = CLTop.CLMaxZIndex(); var mRect = divMenu.getBoundingClientRectEx(); if (mRect.bottom > CLTop.innerHeight) { divMenu.style.top = Rect.top - mRect.height + "px"; if (divMenu.offsetTop < 0) { divMenu.style.top = "0px"; } } if (mRect.right > CLTop.innerWidth) { divMenu.style.left = CLTop.innerWidth - divMenu.offsetWidth + "px"; } } divBg.appendChild(divMenu); _CLTree.Render(divMenu); var divTree = divMenu.lastChild; divTree.style.maxHeight = divMenu.offsetHeight - 62 + "px"; divTree.style.overflow = "auto"; _CLTree.Select(itemData.Val); SetPos(); _CLTree.OnSelected = function (ItemData) { itemData.Val = ItemData.ID; ShowVal(); divBg.Close(); window.removeEventListener("unload", divBg.Close); } } function ShowVal() { if (divLine.Where.Val != null) { Div.innerHTML = ""; var divVal = document.createElement("div"); var Icon = document.createElement("span"); Icon.style.cssText = "font-family:CLFont;color:#f0ad4e;padding-right:8px"; Icon.innerHTML = ""; divVal.appendChild(Icon); var text = document.createElement("span"); var name = CLApp.getDepartmentNameById(divLine.Where.Val); text.innerHTML = name == null ? "??????" : name; divVal.appendChild(text); Div.appendChild(divVal); } else { Div.innerHTML = "
点击选择部门
"; } } ShowVal(); } else if (divLine.Field.className == "提交时间" || divLine.Field.className == "更新时间" || divLine.Field.className == "时间日期") { var input = document.createElement("input"); input.style.cssText = "border:1px solid #e0e0e0;height:30px;width:100%;padding:0 8px;cursor:default"; input.readOnly = true; divLine.divVal.appendChild(input); input.value = divLine.Where.Val == null ? "" : divLine.Where.Val; input.id = CLMakeId(); input.onclick = function () { var _dt = CLDate(divLine.Where.Val, "yyyy-MM-dd HH:mm:ss", input); _dt.onchanged = function (sDt) { var sVal = _dt.Value.toString(); divLine.Where.Val = sVal; input.value = sVal; } } } else { var input = document.createElement("input"); input.style.cssText = "border:1px solid #e0e0e0;height:30px;width:100%;padding:0 8px"; divLine.divVal.appendChild(input); input.value = divLine.Where.Val == null ? "" : divLine.Where.Val; if (divLine.Field.className == "数字") { input.oninput = function () { CLCheckFloat(input, 10); } } input.onchange = function () { divLine.Where.Val = input.value == null || input.value.length == 0 ? null : input.value; if (divLine.Field.className == "数字") { divLine.Where.Val = divLine.Where.Val == null ? null : divLine.Where.Val * 1; } } } } divLine["空值"] = function () { var divLine = this; divLine.divVal.innerHTML = ""; divLine.Where.Val = null; } typeSel.onchanged = function (This) { This.Where.valType = This.GetValue(); var divLine = This.divLine; divLine[This.Where.valType](); } typeSel.selectedIndex = typeSel.Items.indexOf(Wheres[i].valType); var delDiv = document.createElement("div"); delDiv.style.cssText = "font-family:CLFont;height:30px;line-height:30px;display:inline-block;padding:3px;font-size:20px;vertical-align:top;color:#3F80AE;cursor:pointer;"; delDiv.onmouseover = function (e) { this.style.color = "#e86261"; this.style.fontWeight = "900"; } delDiv.onmouseleave = function (e) { this.style.color = "#3F80AE"; this.style.fontWeight = "100"; } delDiv.onclick = function (e) { this.parentNode.Remove(); } delDiv.innerHTML = ""; divLine.Remove = function () { Wheres.splice(Wheres.indexOf(this.Where), 1); divWheres.removeChild(this); } divLine.appendChild(delDiv); } } Object.defineProperty(divContainer, "Wheres", { get: function () { var Wheres = []; var Lines = divWheres.childNodes; for (var i = 0; i < Lines.length; i++) { Wheres.push(Lines[i].Where); } return Wheres; } }); return divLabel; } function createFormSel(divContainer) { divContainer.innerHTML = ""; var SelectContainer = document.createElement("div"); SelectContainer.style.cssText = "width:100%;height:30px;"; divContainer.appendChild(SelectContainer); var Sel = divContainer.FormSel = new CLSelect(SelectContainer); Sel.setPlaceholder("选择目标表单"); Sel.EnableClear(true); Sel.EnableSearch(true); divContainer.FormsIndex = -1; var EventHandle = divContainer.EventHandle; for (var i = 0; i < Forms.length; i++) { if (EventHandle.FormID == Forms[i].ID) { divContainer.FormsIndex = i; } Sel.AddItems([Forms[i].Name]); } } function createNewFields(divContainer) { var EventHandle = divContainer.EventHandle; var divLabel = document.createElement("div"); divLabel.className = "titleLabel"; divLabel.innerHTML = "在目标表单中新增数据,字段值设置如下"; divContainer.appendChild(divLabel); var divFields = document.createElement("div"); divFields.style.cssText = "width:100%;"; divContainer.appendChild(divFields); var newFields = EventHandle.newFields; function getVal(Id) { for (var i = 0; i < newFields.length ; i++) { if (newFields[i].ID == Id) { return newFields[i]; } } } var listName = ["分割线", "选项卡", "表格控件", "关联查询", "关联数据", "提交时间", "更新时间", "流程状态"]; divContainer.ShowFields = function ShowFields() { divFields.innerHTML = ""; var ValFields = []; var ValNames = []; var Fields = Forms[divContainer.FormSel.selectedIndex] == null ? [] : Forms[divContainer.FormSel.selectedIndex].Fields; if (ValFields.length == 0) { for (var i = 0; i < Fields.length; i++) { if (listName.indexOf(Fields[i].className) >= 0) { continue; } else { var Val = getVal(Fields[i].ID); if (Val == null) { Val = { ID: Fields[i].ID, valType: "流程表单字段值", Val: null, ctrlID: null, className: Fields[i].className } } if (Fields[i].className == "子表单") { Val.GetSubFields = function () { return Fields[this.GetSubFields.index].Field; } Val.GetSubFields.index = i; } ValFields.push(Val); ValNames.push(Fields[i].Name); } } } for (var i = 0; i < ValFields.length; i++) { var divLine = DialogEventHandle.createValLine(ValFields[i], ValNames[i], divFields, FormFields, "请选择触发表单的字段",true); divLine.Remove = function () { ValFields.splice(ValFields.indexOf(this.ValField), 1); this.remove(); } } } Object.defineProperty(divContainer, "newFields", { get: function () { var newFields = []; var Lines = divFields.childNodes; for (var i = 0; i < Lines.length; i++) { newFields.push(Lines[i].ValField); } return newFields; } }); return divLabel; } Body.新增数据 = function (divContainer) { var EventHandle = divContainer.EventHandle; if (EventHandle == null) { divContainer.EventHandle = EventHandle = { FormID: null, eventWheres: [ //{ID: "",valType: "",Val: null,ctrlID:null,className:null} ], newFields: [ //{ID: "",valType: "",Val: null,ctrlID: null,className:null} ] }; } divContainer.getField = getField; createFormSel(divContainer); divContainer.FormSel.onchanged = function (This) { if (Forms[This.selectedIndex] == null || EventHandle.FormID != Forms[This.selectedIndex].ID) { divContainer.EventHandle = EventHandle = { FormID: Forms[This.selectedIndex] == null ? null : Forms[This.selectedIndex].ID, eventWheres: [ //{ID: "",valType: "",Val: null,ctrlID:null,className:null} ], newFields: [ //{ID: "",valType: "",Val: null,ctrlID: null,className:null} ] } } divContainer.FormsIndex = divContainer.FormSel; divContainer.ShowEventWheres(); divContainer.ShowFields(); } createEventWheres(divContainer); createNewFields(divContainer); divContainer.FormSel.selectedIndex = divContainer.FormsIndex; divContainer.updateHandle = function () { if (divContainer.EventHandle == null) { return; } divContainer.EventHandle.newFields = divContainer.newFields; divContainer.EventHandle.eventWheres = divContainer.eventWheres; } } Body.修改数据 = function (divContainer) { var EventHandle = divContainer.EventHandle; if (EventHandle == null) { divContainer.EventHandle = EventHandle = { FormID: null, Wheres: [ //{ID: "",valType: "",Val: null,ctrlID:null,className:null} ], updateFields: [ //{ID: "",valType: "",Val: null,ctrlID: null,className:null} ], eventWheres: [ //{ID: "",Operator: "",Val: null,className:null} ] }; } divContainer.getField = getField; createFormSel(divContainer); divContainer.FormSel.onchanged = function (This) { if (Forms[This.selectedIndex] == null || EventHandle.FormID != Forms[This.selectedIndex].ID) { divContainer.EventHandle = EventHandle = { FormID: Forms[This.selectedIndex] == null ? null : Forms[This.selectedIndex].ID, Wheres: [ //{ // ID: "", // valType: "", // Val: null, // ctrlID:null //} ], updateFields: [ //{ // ID: "", // valType: "", // Val: null, // ctrlID: null //} ], eventWheres: [ //{ID: "",Operator: "",Val: null} ] } } divContainer.FormsIndex = divContainer.FormSel; divContainer.ShowWheres(); divContainer.ShowEventWheres(); divContainer.ShowFields(); } createEventWheres(divContainer); createWheres(divContainer, "修改表单中的哪些数据"); createUpdateFields(divContainer); divContainer.FormSel.selectedIndex = divContainer.FormsIndex; divContainer.updateHandle = function () { if (divContainer.EventHandle == null) { return; } divContainer.EventHandle.Wheres = divContainer.Wheres; divContainer.EventHandle.updateFields = divContainer.updateFields; divContainer.EventHandle.eventWheres = divContainer.eventWheres; } } Body.删除数据 = function (divContainer) { var EventHandle = divContainer.EventHandle; if (EventHandle == null) { divContainer.EventHandle = EventHandle = { FormID: null, Wheres: [ //{ID: "",valType: "",Val: null,ctrlID:null,className:null} ], eventWheres: [ //{ID: "",valType: "",Val: null,ctrlID:null,className:null} ] }; } divContainer.getField = getField; createFormSel(divContainer); divContainer.FormSel.onchanged = function (This) { if (Forms[This.selectedIndex] == null || EventHandle.FormID != Forms[This.selectedIndex].ID) { divContainer.EventHandle = EventHandle = { FormID: Forms[This.selectedIndex] == null ? null : Forms[This.selectedIndex].ID, Wheres: [ //{ // ID: "", // valType: "", // Val: null, // ctrlID:null //} ], eventWheres: [ //{ID: "",Operator: "",Val: null} ] } } divContainer.FormsIndex = divContainer.FormSel; divContainer.ShowEventWheres(); divContainer.ShowWheres(); } createEventWheres(divContainer); createWheres(divContainer, "修改表单中的哪些数据"); divContainer.FormSel.selectedIndex = divContainer.FormsIndex; divContainer.updateHandle = function () { if (divContainer.EventHandle == null) { return; } divContainer.EventHandle.Wheres = divContainer.Wheres; divContainer.EventHandle.eventWheres = divContainer.eventWheres; } } var MapR; function SetR(dataSource) { MapR = DataSourceDlg.MapForms(dataSource); } Body.公式编辑 = function (divContainer) { divContainer.style.height = "calc(100% - 40px)"; divContainer.style.width = "calc(100% - 300px)"; divContainer.style.overflow = "auto"; divContainer.classList.add("FlowCoreEx"); var divEditor = document.createElement("div"); divEditor.style.cssText = "width:100%;height:100%;overflow:auto;"; divContainer.appendChild(divEditor); divContainer.Open(); var codeEditor = new CLCodeEditor(divEditor, "javascript"); var Items = codeEditor.dataMenu.Items; size_handles.push(function () { codeEditor.editor.setSize('auto', '100%'); }); function SetSource(dataSource, oVars) { if (!dataSource) { dataSource = { ID: CLMakeId(), Name: "未命名", sql: { Marks: [], originalCode: "", runCode: "" } } } new DataSourceDlg(dataSource, oVars, function (dataSource, Vars) { dataSource.Vars = Vars; if (oVars == null) { var dataMark = { FieldData: dataSource, Color: "#0db3a6", className: "dataSource" } codeEditor.pushMark(dataMark); } else { codeEditor.updateMark(dataSource, dataSource.ID); } SetR(dataSource); }); } Items.splice(0, 0, { Text: "插入SQL", Enable: true, CallBack: function (e) { SetSource(); CLMenu.GetInstance(e.currentTarget).Close(); } }); codeEditor.OnRenderMark = function (text) { if (!text.classList.contains("Mark_dataSource")) { return true; } text.style.cursor = "pointer"; var ondblclick = text.ondblclick; text.ondblclick = function (e) { ondblclick.call(text, e); SetSource(text.FieldData, text.FieldData.Vars); } } codeEditors.push(codeEditor); codeEditor.setValue(); var divBar = document.createElement("div"); divBar.style.cssText = "width:300px;height:100%;position:absolute;right:0;top:0;border-left:1px solid #e0e0e0;padding:10px;cursor:default"; divBar.classList.add("Prop"); divBar.style.background = "#fff"; divBar.style.overflow = "auto"; divContainer.appendChild(divBar); function OpenOrClose() { var Value = this.nextSibling; if (Value.style.display == "block") { this.Icon.style.transform = "rotate(-90deg)"; Value.style.display = "none"; } else { Value.style.display = "block"; this.Icon.style.transform = "rotate(0)"; } } var sInput = document.createElement("input"); sInput.classList.add("CLSearch"); sInput.OnInput(function (v) { currentFieldList.Search(sInput.value); otherFieldTree.Search(sInput.value); }); divBar.appendChild(sInput); var Label = PropLabel(divBar, "当前表单字段"); Label.style.cursor = "pointer"; Label.style.marginBottom = "0px"; Label.onclick = OpenOrClose; var span = document.createElement("span"); span.style.cssText = "transform: rotate(-90deg);display:inline-block;font-family: CLFont;color: #5E6D82;margin-right: 10px;"; span.innerHTML = ""; Label.insertBefore(span, Label.firstChild); Label.Icon = span; var divFormFields = PropValue(divBar, "div"); divFormFields.style.border = "none"; divFormFields.style.display = "none"; divFormFields.style.height = "initial"; divFormFields.style.overflow = "auto"; (function () { if (CodeCurrentFields == null) { CodeCurrentFields = []; CodeCurrentFields.push({ TableID: FormsID, ID: "ID", Name: "ID", className: "单行文本" }); var Fields = FormFields; for (var i = 0; i < Fields.length; i++) { if (BaseControl.indexOf(Fields[i].className) >= 0) { CodeCurrentFields.push({ TableID: FormsID, ID: Fields[i].ID, Name: Fields[i].Name, className: Fields[i].className }); } if (Fields[i].className == "子表单") { var subFields = Fields[i].Field; for (var j = 0; j < subFields.length; j++) { if (BaseControl.indexOf(subFields[j].className) >= 0) { CodeCurrentFields.push({ TableID: Fields[i].ID, ID: subFields[j].ID, Name: Fields[i].Name + "●" + subFields[j].Name, className: subFields[j].className }); } } } } } if (CodeOtherFields == null) { CodeOtherFields = { ID: "所有表单", Name: "所有表单", SubNode: [] } for (var i = 0 ; i < Forms.length; i++) { var form = { ID: Forms[i].ID, Name: Forms[i].Name, type: "Table", oSubNode: [ ] } form.oSubNode.push({ ID: "ID", Name: "ID", FullName: Forms[i].Name + "●ID", className: "单行文本", TableID: Forms[i].ID, type: "Field", }); CodeOtherFields.SubNode.push(form); var Fields = Forms[i].Fields; for (var j = 0; Fields != null && j < Fields.length; j++) { var SubTable = null; if (BaseControl.indexOf(Fields[j].className) >= 0) { if (Fields[j].className == "子表单") { SubTable = { ID: Fields[j].ID, Name: Fields[j].Name, type: "Table", oSubNode: [ ] } form.oSubNode.push(SubTable); } else { form.oSubNode.push({ ID: Fields[j].ID, Name: Fields[j].Name, FullName: Forms[i].Name + "●" + Fields[j].Name, className: Fields[j].className, TableID: Forms[i].ID, type: "Field", }); } } if (Fields[j].className == "子表单") { var subFields = Fields[j].Field; SubTable.oSubNode.push({ TableID: Fields[j].ID, ID: "ID", FullName: Fields[j].Name + "●ID", Name: "ID", className: "单行文本", type: "Field" }); for (var x = 0; x < subFields.length; x++) { if (BaseControl.indexOf(subFields[x].className) >= 0) { SubTable.oSubNode.push({ TableID: Fields[j].ID, ID: subFields[x].ID, FullName: Fields[j].Name + "●" + subFields[x].Name, Name: subFields[x].Name, className: subFields[x].className, type: "Field" }); } } } } } } }()); var currentFieldList = new CLList(CodeCurrentFields, divFormFields, null, function (Item, itemData) { Item.style.fontSize = "12px"; Item.style.paddingLeft = "15px"; Item.title = itemData.Name; Item.firstChild.style.maxWidth = "calc(100% - 45px)"; Item.firstChild.style.display = "inline-block"; Item.style.position = "relative"; Item.firstChild.classList.add("ellipsis"); Item.style.height = "26px"; var span = document.createElement("span"); span.style.position = "absolute"; span.style.right = "0"; span.style.padding = "0 8px"; span.innerHTML = FrmCtrls.CtrlsProps[itemData.className].Name; span.style.color = FrmCtrls.CtrlsProps[itemData.className].Color; Item.appendChild(span); CLEnableMove(Item, function (Item) { helpLabel = getHelpLabel(); helpLabel.style.color = FrmCtrls.CtrlsProps[itemData.className].Color; helpLabel.style.borderColor = FrmCtrls.CtrlsProps[itemData.className].Color; helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; helpLabel.innerHTML = itemData.Name; helpLabel.style.zIndex = CLMaxZIndex(); document.body.appendChild(helpLabel); }, function (Item) { helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; return false; }, function (Item) { var rect = divEditor.getBoundingClientRect(); if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) { if (helpLabel != null) { helpLabel.remove(); } return false; } var Mark = { className: "Field", FieldData: { TableID: itemData.TableID, ID: itemData.ID, Name: itemData.Name, className: itemData.className }, Color: helpLabel.style.color } codeEditor.pushMark(Mark); helpLabel.remove(); return false; }); }); Label = PropLabel(divBar, "其他表单字段"); Label.style.marginBottom = "0px"; Label.style.cursor = "pointer"; Label.onclick = OpenOrClose; var span = span.cloneNode(true); Label.insertBefore(span, Label.firstChild); Label.Icon = span; var divotherFields = divFormFields.cloneNode(); divBar.appendChild(divotherFields); var otherFieldTree = new CLTree(CodeOtherFields); otherFieldTree.Editable = false; otherFieldTree.OnItemCreated = function (Item, itemData) { if (itemData.ID == "所有表单") { Item.firstChild.style.display = "none"; } else { Item.firstChild.style.paddingLeft = parseInt(Item.firstChild.style.paddingLeft) - 17 + "px"; } if (itemData.type == "Field") { Item.title = itemData.Name; var divName = Item.querySelector(".Name"); divName.style.maxWidth = "calc(100% - 85px)"; divName.style.display = "inline-block"; Item.firstChild.style.position = "relative"; divName.classList.add("ellipsis"); var span = document.createElement("span"); span.style.position = "absolute"; span.style.right = "0"; span.style.padding = "0 8px"; span.innerHTML = FrmCtrls.CtrlsProps[itemData.className].Name; span.style.color = FrmCtrls.CtrlsProps[itemData.className].Color; Item.firstChild.appendChild(span); } if (itemData.type == "Table") { Item.classList.remove("NoChild"); var open = Item.Open; Item.Open = function () { Item.ItemData.SubNode = []; var data = Item.ItemData.oSubNode; if (data.length == 0) { Item.classList.add("NoChild"); return; } for (var i = 0; i < data.length; i++) { if (data[i] == null) { continue; } Item.addChild(data[i]); } Item.Open = open; if (Item.parentNode != null) { Item.Open(); } } } CLEnableMove(Item, function (Item) { helpLabel = getHelpLabel(); if (itemData.type == "Field") { helpLabel.style.color = FrmCtrls.CtrlsProps[itemData.className].Color; helpLabel.style.borderColor = FrmCtrls.CtrlsProps[itemData.className].Color; } else { helpLabel.style.color = "#660099"; helpLabel.style.borderColor = "#660099"; } helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; helpLabel.innerHTML = itemData.Name; helpLabel.style.zIndex = CLMaxZIndex(); document.body.appendChild(helpLabel); }, function (Item) { helpLabel.style.left = event.clientX - helpLabel.offsetWidth / 2 + "px"; helpLabel.style.top = event.clientY - helpLabel.offsetHeight / 2 + "px"; return false; }, function (Item) { var rect = divEditor.getBoundingClientRect(); if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) { if (helpLabel) { helpLabel.remove(); } return false; } if (itemData.type == "Field") { var Mark = { className: "Field", FieldData: { TableID: itemData.TableID, ID: itemData.ID, Name: itemData.FullName, className: itemData.className }, Color: helpLabel.style.color } } else if (itemData.type == "Table") { var Mark = { className: "Table", FieldData: { ID: itemData.ID, Name: itemData.Name }, Color: helpLabel.style.color } } codeEditor.pushMark(Mark); helpLabel.remove(); return false; }); } otherFieldTree.Render(divotherFields); codeEditor.replacedWith = function (className, FieldData) { if (className == "dataSource") { return "V8.__SourceHelper__(((" + JSON.stringify(FieldData) + ")))"; } else { return "V8.get" + className + "(((" + JSON.stringify(FieldData) + ")))"; } } codeEditor.testMark = function (Mark) { if (Mark.className == "dataSource") { SetR(Mark.FieldData); return true; } for (var i = 0; i < CodeCurrentFields.length; i++) { if (CodeCurrentFields[i].ID == Mark.FieldData.ID) { Mark.FieldData.Name = CodeCurrentFields[i].Name; Mark.FieldData.Name = CodeCurrentFields[i].Name; return true; } } var FieldForms = CodeOtherFields.SubNode; for (var i = 0; i < FieldForms.length; i++) { if (FieldForms[i].ID == Mark.FieldData.ID) { Mark.FieldData.Name = FieldForms[i].Name; return true; } for (var j = 0; j < FieldForms[i].oSubNode.length; j++) { var Field = FieldForms[i].oSubNode[j]; if (Field.ID == Mark.FieldData.ID) { Mark.FieldData.Name = Field.FullName || Field.Name; return true; } if (Field.type == "Table") { var oSubNode = Field.oSubNode; for (var k = 0; k < oSubNode.length; k++) { if (oSubNode[k].ID == Mark.FieldData.ID) { Mark.FieldData.Name = oSubNode[k].FullName; return true; } } } } } return false; } codeEditor.AfterPaste = function () { var Marks = divEditor.querySelectorAll(".Mark_dataSource"); var IDs = []; Marks.forEach(function (text) { var ID = text.FieldData.ID; if (IDs.indexOf(ID) >= 0) { ID = text.FieldData.ID = CLMakeId(); } IDs.push(ID); }); } codeEditor.setValue(divContainer.EventHandle); codeEditor.MarkerProps = function (mark) { if (mark.className == "Field") { var field = mark.FieldData; var R = Object.create(null); R.ID = field.ID; R.Name = field.Name; R.className = field.className; R.TableID = field.TableID; R.valueOf = function () { } R.toString = function () { } var value = null; if (field.className == "子表单") { R.Load = function () { }; R.Submit = function () { }; } if (field.className == "单行文本" || field.className == "多行文本" || field.className == "时间日期" || field.className == "单选按钮组" || field.className == "下拉框" || field.className == "流水号" || field.className == "成员单选") { R.value = ""; } if (field.className == "数字" || field.className == "部门单选") { R.value = 0; } if (field.className == "附件上传") { R.value = []; JsParser.SetElement(R.value, { Src: "", Name: "", Size: 0 }); } if (field.className == "成员多选" || field.className == "复选框组" || field.className == "下拉复选框") { R.value = [""]; } if (field.className == "部门多选") { R.value = [0]; } JsParser.SetReturn(R.valueOf, value); JsParser.SetReturn(R.toString, ""); return R; } if (mark.className == "Table") { var field = mark.FieldData; var R = Object.create(null); R.ID = field.ID; R.Name = field.Name; return R; } if (mark.className == "dataSource") { var R = function () { }; R.Compile = function () { }; JsParser.SetReturn(R.Compile, ""); JsParser.SetReturn(R, MapR[mark.FieldData.ID]()); return R; } } divContainer.updateHandle = function () { divContainer.EventHandle = codeEditor.getValue(); }; var globalScope = CLClone(CLApp.baseGlobalScope); codeEditor.setGlobalScope(globalScope); } Body.数据透视 = function (divContainer) { var EventHandle = divContainer.EventHandle if (EventHandle == null) { divContainer.EventHandle = EventHandle = { eventWheres: [], Vars: [], dataExcel: null } } var dataExcel = EventHandle.dataExcel; var Vars = CLClone(EventHandle.Vars); function EditExcel() { var excelDlg = document.createElement("div"); excelDlg.style.cssText = "position:fixed;top:0;bottom:0;left:0;right:0;background:#fff"; excelDlg.style.zIndex = CLMaxZIndex(); excelDlg.className = "ExcelDlg"; document.body.appendChild(excelDlg); var TopBar = document.createElement("div"); TopBar.className = "TopBar"; excelDlg.appendChild(TopBar); TopBar.innerHTML = ""; var Back = TopBar.getElementsByClassName("Back")[0]; Back.onclick = function () { dataExcel = designer.getData(); excelDlg.remove(); } var Container = document.createElement("div"); Container.style.cssText = "position: absolute;margin-top: 45px;top:0;bottom:0;left:0;right:0;overflow: hidden;"; excelDlg.appendChild(Container); var designer = new ExcelDesigner(Container); designer.Save = function () { dataExcel = designer.getData(); Save(); FCore.Save(); } designer.FlowCore = FCore; designer.AtServer = true; designer.AppId = CLApp.getFormById(FormsID).AppId; designer.setData(dataExcel); var Block = document.createElement("div"); Block.className = "Block"; Block.style.margin = "0 auto"; Block.style.width = "100px"; Block.style.height = "30px"; TopBar.appendChild(Block); var Box = new CLCheckBox("预览效果", Block, true); Box.checked = false; var div = document.createElement("div"); Box.onchanged = function () { if (Box.checked) { var preview = Container.cloneNode(); div.appendChild(preview); document.body.appendChild(div); var data = designer.getData(); var excelDesigner = new ExcelDesigner(preview, false); excelDesigner.setData(data); preview.style.zIndex = CLMaxZIndex(); } else { div.innerHTML = ""; div.remove(); designer.Enter(); } } } createEventWheres(divContainer); divContainer.ShowEventWheres(); divContainer.updateHandle = function () { EventHandle.dataExcel = dataExcel; EventHandle.Vars = Vars; EventHandle.eventWheres = divContainer.eventWheres; } var divLabel = document.createElement("div"); divLabel.className = "titleLabel"; divLabel.innerHTML = "参数传递"; divContainer.appendChild(divLabel); var spanLabel = document.createElement("div"); spanLabel.className = "addSpan"; spanLabel.innerHTML = "请添加要传递的字段"; divContainer.appendChild(spanLabel); spanLabel.onclick = function () { var Fields = FormFields; var Menu = { "style": { "max-height": "230px", "overflow": "auto", "margin-top": "15px", "background-color": "#fff", }, "Items": [ ] } var Items = Menu.Items; var arr = ["单行文本", "多行文本", "数子", "时间日期", "单选按钮组", "复选框组", "下拉框", "下拉复选框", "流水号", "成员单选", "成员多选", "部门单选", "部门多选", "流程状态", "提交时间", "更新时间", "提交人"]; function func(field) { var Enable = true; Vars.some(function (Var) { if (Var.ID == field.ID) { Enable = false; return true; } }); if (arr.indexOf(field.className) >= 0) { Items.push({ Text: field.Name, data: { ID: field.ID, Name: field.Name, className: field.className, ParentID: field.ParentID }, Enable: Enable, CallBack: function (e) { AddVar(this.data); e.currentTarget.Disabled = true; } }); } } Fields.forEach(function (field) { if (field.className == "子表单") { if (field.Field) { var pName = field.Name; field.Field.forEach(function (field) { field = { ID: field.ID, Name: pName + "." + field.Name, className: field.className, ParentID: field.ParentID }; func(field); }); } } else { func(field); } }); new CLMenu(Menu, spanLabel); } var divVars = document.createElement("div"); divContainer.appendChild(divVars); function AddVar(dataVar, bPush) { if (bPush !== false) { Vars.push(dataVar); } var divLine = document.createElement("div"); divLine.style.cssText = "width: 100%; margin-bottom: 10px; line-height: 30px;"; divVars.appendChild(divLine); var label = document.createElement("div"); label.style.cssText = "width: 245px; display: inline-block; line-height: 30px; border: 1px solid rgb(217, 217, 217); padding: 0px 8px; vertical-align: top;" label.innerHTML = "" + FrmCtrls[dataVar.className].Icon + "" + dataVar.Name; divLine.appendChild(label); var op = document.createElement("div"); op.style.cssText = "width: 145px; display: inline-block; height: 30px; line-height: 30px; margin: 0px 8px; vertical-align: top; color: rgb(13, 179, 166);text-align:center"; op.innerHTML = "传递给"; divLine.appendChild(op); var nameDiv = document.createElement("div"); nameDiv.style.cssText = "width: 275px; display: inline-block; line-height: 30px; margin: 0px 8px 0px 16px; vertical-align: top;"; divLine.appendChild(nameDiv); var input = document.createElement("input"); input.style.width = "100%"; input.setAttribute("placeholder", "请输入变量名称"); nameDiv.appendChild(input); input.value = !dataVar.To ? "" : dataVar.To; input.onchange = function () { dataVar.To = input.value; } var Del = document.createElement("div"); Del.style.cssText = "font-family:CLFont;height:30px;line-height:30px;display:inline-block;padding:3px;font-size:20px;vertical-align:top;color:#3F80AE;cursor:pointer;"; Del.onmouseover = function (e) { this.style.color = "#e86261"; this.style.fontWeight = "900"; } Del.onmouseleave = function (e) { this.style.color = "#3F80AE"; this.style.fontWeight = "100"; } Del.onclick = function (e) { this.parentNode.remove(); } Del.innerHTML = ""; divLine.Var = dataVar; var remove = divLine.remove; divLine.remove = function () { Vars.splice(Vars.indexOf(this.Var), 1); remove.call(this); } divLine.appendChild(Del); } Vars.forEach(function (dataVar) { AddVar(dataVar, false); }); divLabel = document.createElement("div"); divLabel.className = "titleLabel"; divLabel.innerHTML = "数据模型"; divContainer.appendChild(divLabel); divContainer.style.height = "calc(100% - 42px)"; var btn = document.createElement("div"); btn.className = "CLBtn"; btn.style.width = "250px"; btn.style.margin = "25px"; btn.innerHTML = "设置"; divContainer.appendChild(btn); btn.onclick = function () { EditExcel(); } } Body.URL回调 = function (divContainer) { var divHandle = divContainer.parentNode; divHandle.style.position = "initial"; divHandle.style.margin = "0"; divHandle.style.marginBottom = "20px"; var inputUrl = document.createElement("input"); inputUrl.style.cssText = "height:30px;width:100%;padding:0 8px;border:#e0e0e0 solid 1px;border-radius:2px"; inputUrl.setAttribute("placeholder", "请输入回调Url"); divContainer.appendChild(inputUrl); inputUrl.value = divContainer.EventHandle == null ? "" : divContainer.EventHandle; divContainer.updateHandle = function () { divContainer.EventHandle = inputUrl.value == null || inputUrl.value.length == 0 ? null : inputUrl.value; } } function isLess(rect1, rect2) { var Pos1 = { X: rect1.left + rect1.width / 2, Y: rect1.top + rect1.height / 2 }; if (Pos1.Y < rect2.top) { return true; } else if (Pos1.Y > rect2.bottom) { return false; } else { if (Pos1.X < rect2.left + rect2.width / 2) { return true; } else { return false; } } }; function EnableMove(dLine) { var cssText = dLine.style.cssText; var beforeItem; var bMove = false; dLine.firstChild.style.cursor = "move"; CLEnableMove(dLine.firstChild, function (move, event) { dLine.style.position = "absolute"; dLine.style.width = "100%"; dLine.style.zIndex = CLMaxZIndex(); bMove = true; event.stopPropagation(); }, function () { }, function () { if (!bMove) { return; } bMove = false; beforeItem = null; var Items = dLine.parentNode.getElementsByClassName("DialogEventHandle"); var dragRect = dLine.getBoundingClientRect(); for (var i = Items.length - 1; i > -1; i--) { var rect = Items[i].getBoundingClientRect(); if (Items[i] == dLine) { continue; } if (isLess(dragRect, rect)) { beforeItem = Items[i]; } } dLine.style.cssText = cssText; dLine.parentNode.insertBefore(dLine, beforeItem); }, dLine); } function OpenHandle(divHandle) { var handleOpen = Body.getElementsByClassName("DialogEventHandleOpen")[0]; if (handleOpen != null) { handleOpen.classList.remove("DialogEventHandleOpen"); } if (divHandle != null) { divHandle.classList.add("DialogEventHandleOpen"); } } //EventHandle = [ // { Operator: "新增数据" }, { Operator: "修改数据" }, { Operator: "删除数据" }//, { Operator: "公式编辑" },{ Operator: "数据透视" },, { Operator: "URL回调"} //] function addHandle(Handle) { if (!Handle.Operator) { return; } var divHandle = document.createElement("div"); divHandle.className = "DialogEventHandle"; Body.appendChild(divHandle); var handleLabel = document.createElement("div"); handleLabel.className = "Label"; handleLabel.style.position = "relative"; handleLabel.innerHTML = "
" + (Handle.Name || Handle.Operator) + "
"; handleLabel.onclick = function () { var handleLabel = this; if (!__IsDev__ && Handle.Operator == "公式编辑") { CLShowMsg("你不是开发者."); return; } if (handleLabel.parentNode.classList.contains("DialogEventHandleOpen")) { OpenHandle(); } else { OpenHandle(handleLabel.parentNode); if (!divContainer.updateHandle) { Body[Handle.Operator](divContainer); } } } divHandle.appendChild(handleLabel); var del = document.createElement("span"); del.className = "Del"; handleLabel.appendChild(del); del.onclick = function (e) { e.stopPropagation(); divHandle.remove(); } var rename = document.createElement("span"); rename.classList.add("Rename"); handleLabel.appendChild(rename); rename.onclick = function (e) { var name = handleLabel.querySelector(".Name"); if (name) { CLStartEdit(name, function (sName) { Handle.Name = sName; }); } e.stopPropagation(); } var copy = document.createElement("span"); copy.classList.add("Copy"); handleLabel.appendChild(copy); copy.onclick = function (e) { var handle = CLClone(divHandle.EventHandle); addHandle(Handle); e.stopImmediatePropagation(); } var divContainer = document.createElement("div"); divContainer.Open = function () { OpenHandle(this.parentNode); } divContainer.Close = function () { OpenHandle(); } divContainer.className = "Container"; divHandle.appendChild(divContainer); divHandle.Container = divContainer; divHandle.Operator = Handle.Operator; divContainer.EventHandle = Handle.Handle; Object.defineProperty(divHandle, "EventHandle", { get: function () { var divHandle = this; var divContainer = divHandle.Container; if (divContainer.updateHandle) { divContainer.updateHandle(); } return { Operator: divHandle.Operator, Name: Handle.Name, Handle: divContainer.EventHandle }; } }); EnableMove(divHandle); } function ShowEventHandle() { for (var i = 0; i < EventHandle.length; i++) { addHandle(EventHandle[i]); } } Object.defineProperty(Body, "EventHandle", { get: function () { var EventHandle = []; var Blocks = Body.getElementsByClassName("DialogEventHandle"); for (var i = 0; i < Blocks.length; i++) { EventHandle.push(Blocks[i].EventHandle); } return EventHandle; } }); opSel.OnMenuCreated = function (divMenu) { var ItemSel = divMenu.getElementsByClassName("ItemSel")[0]; if (ItemSel != null) { ItemSel.classList.remove("ItemSel"); } } opSel.onchanged = function () { addHandle({ Operator: opSel.GetValue() }); opSel.selectedIndex = -1; } ShowEventHandle(); } DialogEventHandle.Scope = function () { return {}; } DialogEventHandle.createValLine = function (ValField, Name, Container, FormFields, rPlaceHolder, hasSub, bCalc) { var divLine = document.createElement("div"); divLine.style.cssText = "width:100%;margin-bottom:10px;line-height:30px;overflow:hidden;user-select:none"; Container.appendChild(divLine); divLine.ValField = ValField; var FieldDiv = document.createElement("div"); FieldDiv.style.cssText = "width:245px;display:inline-block;height:30px;line-height:30px;border:solid 1px #d9d9d9;padding:0 8px;vertical-align:top;"; FieldDiv.innerHTML = "" + FrmCtrls[ValField.className].Icon + "" + Name; divLine.appendChild(FieldDiv); var Icon = FieldDiv.firstChild; if (ValField.className == "子表单") { Icon.innerHTML = ""; Icon.style.cursor = "pointer"; Icon.style.display = "inline-block"; Icon.style.transform = "translate(-5px,2px) rotate(90deg)"; Icon.onclick = function(){ if(!divLine.style.height){ divLine.style.height = "30px"; Icon.style.transform = "rotate(0deg)"; }else{ divLine.style.height = ""; Icon.style.transform = "translate(-5px,2px) rotate(90deg)"; } } } var op = document.createElement("div"); op.style.cssText = "height:30px;line-height:30px;display:inline-block;padding:0 16px;vertical-align:top;color:#0db3a6"; divLine.appendChild(op); if (!bCalc || ValField.className != "数字") { op.innerHTML = "等于"; } else { op.style.width = "120px"; var calcSelector = new CLSelect(op); calcSelector.AddItems(["等于", "自增", "自减"]); if (ValField.Operator == null) { calcSelector.selectedIndex = 0; } else { calcSelector.selectedIndex = calcSelector.Items.indexOf(ValField.Operator); } calcSelector.onchanged = function () { ValField.Operator = calcSelector.Items[calcSelector.selectedIndex]; } } var divType = document.createElement("div"); divType.style.cssText = "width:160px;height:30px;display:inline-block;vertical-align:top;"; divLine.appendChild(divType); var typeSel = new CLSelect(divType); typeSel.ValField = ValField; typeSel.divLine = divLine; if (listName.indexOf(ValField.className) >= 0) { typeSel.AddItems([ "流程表单字段值", "空值" ]); } else { typeSel.AddItems([ "流程表单字段值", "自定义", "空值" ]); } var divVal = document.createElement("div"); divLine.appendChild(divVal); divLine.divVal = divVal; divVal.style.cssText = "width:245px;display:inline-block;height:30px;line-height:30px;margin:0 8px 0 16px;vertical-align:top;"; var delDiv = document.createElement("div"); delDiv.style.cssText = "font-family:CLFont;height:30px;line-height:30px;display:inline-block;padding:3px;font-size:20px;vertical-align:top;color:#3F80AE;cursor:pointer;"; delDiv.onmouseover = function (e) { this.style.color = "#e86261"; this.style.fontWeight = "900"; } delDiv.onmouseleave = function (e) { this.style.color = "#3F80AE"; this.style.fontWeight = "100"; } delDiv.onclick = function (e) { divLine.Remove(); } delDiv.innerHTML = ""; divLine.appendChild(delDiv); divLine["流程表单字段值"] = function () { var divLine = this; divLine.divVal.innerHTML = ""; var valSel = new CLSelect(divLine.divVal); valSel.EnableClear(true); valSel.setPlaceholder(rPlaceHolder); divLine.ValField.Val = null; var Fields = []; var selIndex = -1; var ctrlID = divLine.ValField.ctrlID; var SubInfo = divLine.ValField.SubInfo; if (SubInfo == null) { SubInfo = divLine.ValField.SubInfo = []; } function getVal(Id,Def) { var newFields = SubInfo; for (var j = 0; j < newFields.length ; j++) { if (newFields[j].ID == Id) { return newFields[j]; } } newFields.push(Def); return Def; } for (var i = 0; i < FormFields.length ; i++) { if (ValField.className != "子表单") { if (FormFields[i].className == "子表单" && hasSub) { var subFields = FormFields[i].Field; for (var j = 0; j < subFields.length; j++) { var Field = subFields[j]; if (!FrmCtrls.CompareAble(Field.className, divLine.ValField.className)) { if (Field.className == "成员单选" && divLine.ValField.className == "成员多选") { } else if (Field.className == "部门单选" && divLine.ValField.className == "部门多选") { } else { continue; } } Fields.push({ ID: Field.ID, Name: Field.Name, ParentID: FormFields[i].ID, className: Field.className }); valSel.AddItems([ FormFields[i].Name + "->" + Field.Name ]); if (Field.ID == ctrlID) { selIndex = Fields.length - 1; } } } else { if (!FrmCtrls.CompareAble(FormFields[i].className, divLine.ValField.className)) { if (FormFields[i].className == "成员单选" && divLine.ValField.className == "成员多选") { } else if (FormFields[i].className == "成员单选" && divLine.ValField.className == "部门多选") { } else { continue; } } Fields.push(FormFields[i]); valSel.AddItems([ FormFields[i].Name ]); if (FormFields[i].ID == ctrlID) { selIndex = Fields.length - 1; } } } else { if (FormFields[i].className == "子表单") { Fields.push({ ID: FormFields[i].ID, Name: FormFields[i].Name, SubFields: FormFields[i].Field, className: "子表单" }); valSel.AddItems([ FormFields[i].Name ]); if (FormFields[i].ID == ctrlID) { selIndex = Fields.length - 1; } } } } valSel.onchanged = function (This) { var Field = Fields[This.selectedIndex]; divLine.style.background = ""; if (Field == null) { delete divLine.ValField.ctrlID; delete divLine.ValField.SubInfo; delete divLine.ValField.ctrlParentId; if (divLine.DivSubInfo != null) { divLine.DivSubInfo.remove(); } return; } else { if ((divLine.ValField.className == "成员多选" && Field.className == "成员单选") || (divLine.ValField.className == "部门多选" && Field.className == "部门单选")) { divLine.ValField.ToArayy = true; } else { delete divLine.ValField.ToArayy; } SubInfo = divLine.ValField.SubInfo; if (SubInfo == null) { SubInfo = divLine.ValField.SubInfo = []; } } divLine.ValField.ctrlID = Field.ID; if (Field.ParentID != null) { divLine.ValField.ctrlParentId = Field.ParentID; } else { delete divLine.ValField.ctrlParentId; } if (Field.className == "子表单") { var DivSubInfo = divLine.DivSubInfo; if (DivSubInfo == null) { DivSubInfo = divLine.DivSubInfo = document.createElement("div"); var remove = DivSubInfo.remove; DivSubInfo.remove = function () { remove.call(this); delete divLine.DivSubInfo; } divLine.appendChild(DivSubInfo); } else { DivSubInfo.innerHTML = ""; } var tempFields = divLine.ValField.GetSubFields() for (var i = 0; i < SubInfo.length ; i++) { var bFind = false; for (var j = 0; j < tempFields.length; j++) { if (tempFields[j].ID == SubInfo[i].ID) { bFind = true; } } if (!bFind) { SubInfo.splice(i); i--; } } ShowSubInfo(divLine.ValField.GetSubFields(), Field.SubFields); } } valSel.selectedIndex = selIndex; if (ctrlID && selIndex == -1) { divLine.style.background = "#c00"; } function ShowSubInfo(SubFields, ValFields) { var DivSubInfo = divLine.DivSubInfo; DivSubInfo.innerHTML = ""; for (var i = 0; i < SubFields.length; i++) { CreateLine(SubFields[i]); } function CreateLine(Field) { var Line = document.createElement("div"); Line.style.cssText = "width:100%;height:30px;margin-top:10px;line-height:30px;padding-left:20px"; DivSubInfo.appendChild(Line); Line.ValField = getVal(Field.ID, { ID: Field.ID, valType: "流程表单字段值", Val: null, ctrlID: null, className: Field.className }); var FieldDiv = document.createElement("div"); FieldDiv.style.cssText = "width:225px;display:inline-block;height:30px;line-height:30px;border:solid 1px #d9d9d9;padding:0 8px;vertical-align:top;"; FieldDiv.innerHTML = "" + FrmCtrls[Field.className].Icon + "" + Field.Name; Line.appendChild(FieldDiv); var op = document.createElement("div"); op.style.cssText = "height:30px;line-height:30px;display:inline-block;padding:0 16px;vertical-align:top;color:#0db3a6"; op.innerHTML = "等于"; Line.appendChild(op); var divType = document.createElement("div"); divType.style.cssText = "width:160px;height:30px;display:inline-block;vertical-align:top;"; Line.appendChild(divType); Line.divType = divType; var divVal = document.createElement("div"); Line.appendChild(divVal); Line.divVal = divVal; divVal.style.cssText = "width:245px;display:inline-block;height:30px;line-height:30px;margin:0 8px 0 16px;vertical-align:top;"; var typeSel = new CLSelect(divType); typeSel.Field = Field; typeSel.Line = Line; typeSel.onchanged = function (This) { Line.ValField.valType = This.GetValue(); if (Line.ValField.valType != "流程表单字段值") { divLine[Line.ValField.valType].call(Line); } else { Line["流程表单字段值"](); } } if (listName.indexOf(Field.className) >= 0) { typeSel.AddItems([ "流程表单字段值", "空值" ]); } else { typeSel.AddItems([ "流程表单字段值", "自定义", "空值" ]); } Line["流程表单字段值"] = function () { Line.divVal.innerHTML = ""; var valSel = new CLSelect(Line.divVal); valSel.setPlaceholder("选择触发表单字段"); valSel.EnableClear(true); var Fields = []; var index = -1; for (var i = 0; i < FormFields.length; i++) { if (FormFields[i].className == "子表单") { if (FormFields[i].ID == divLine.ValField.ctrlID) { for (var j = 0; j < ValFields.length; j++) { if (!FrmCtrls.CompareAble(ValFields[j].className, Line.ValField.className)) { if (ValFields[j].className.className == "成员单选" && Line.ValField.className == "成员多选") { } else if (ValFields[j].className.className == "部门单选" && Line.ValField.className == "部门多选") { } else { continue; } } var vField = CLClone(ValFields[j]); vField.ParentID = FormFields[i].ID; Fields.push(vField); valSel.AddItems([ FormFields[i].Name + "->" + vField.Name ]); if (vField.ID == Line.ValField.ctrlID) { index = Fields.length - 1; } } } } else { if (!FrmCtrls.CompareAble(FormFields[i].className, Line.ValField.className)) { if (FormFields[i].className.className == "成员单选" && Line.ValField.className == "成员多选") { } else if (FormFields[i].className.className == "部门单选" && Line.ValField.className == "部门多选") { } else { continue; } } Fields.push(FormFields[i]); if (FormFields[i].ID == Line.ValField.ctrlID) { index = Fields.length - 1; } valSel.AddItems([ FormFields[i].Name ]); } } valSel.selectedIndex = index; valSel.onchanged = function (This) { var Field = Fields[This.selectedIndex]; if (Field == null) { delete Line.ValField.ctrlID; delete Line.ValField.SubInfo; delete Line.ValField.ctrlParentId; if (Line.DivSubInfo != null) { Line.DivSubInfo.remove(); } return; } Line.ValField.ctrlID = Field.ID; if ((Line.ValField.className == "成员多选" && Field.className == "成员单选") || (Line.ValField.className == "部门多选" && Field.className == "部门单选")) { Line.ValField.ToArayy = true; } else { delete Line.ValField.ToArayy; } if (Field.ParentID != null) { Line.ValField.ctrlParentId = Field.ParentID; } else { delete Line.ValField.ctrlParentId; } } } typeSel.selectedIndex = typeSel.Items.indexOf(Line.ValField.valType); } } } divLine["自定义"] = function () { var divLine = this; divLine.divVal.innerHTML = ""; divLine.ValField.ctrlID = null; if (divLine.ValField.className == "成员单选") { var Div = document.createElement("div"); var itemData = divLine.ValField; Div.style.cssText = "border:1px dashed #e0e0e0;height:30px;width:100%;padding:0 8px;line-height:28px;font-size:5px;cursor:pointer"; divLine.divVal.appendChild(Div); Div.onclick = function () { var Range = { Roles: [], Parts: [], Members: [], Dynamic: [] } Range.Dynamic.Visible = false; FrmCtrls.MemberDialog(Range, false, { Members: itemData.Val == null ? null : [itemData.Val] }, true, function (Val) { itemData.Val = Val.Members[0]; ShowVal(CLApp.getMemberNameById(itemData.Val)); }); } function ShowVal(Name) { if (divLine.ValField.Val != null) { Div.innerHTML = ""; var divVal = document.createElement("div"); var Icon = document.createElement("span"); Icon.style.cssText = "font-family:CLFont;color:#f0ad4e;padding-right:8px"; Icon.innerHTML = ""; divVal.appendChild(Icon); var text = document.createElement("span"); var name = Name == null ? CLApp.getMemberNameById(divLine.ValField.Val) : Name; text.innerHTML = name == null ? "??????" : name; divVal.appendChild(text); Div.appendChild(divVal); } else { Div.innerHTML = "
点击选择成员
"; } } ShowVal(); } else if (divLine.ValField.className == "部门单选") { var Div = document.createElement("div"); Div.style.cssText = "border:1px dashed #e0e0e0;height:30px;width:100%;padding:0 8px;line-height:28px;font-size:5px;cursor:pointer"; divLine.divVal.appendChild(Div); var itemData = divLine.ValField; Div.onclick = function () { var DepartData = CLApp.getDepartTree()[0]; var _CLTree = new CLTree(DepartData); var divBg = document.createElement("div"); divBg.style.cssText = "position:fixed;top:0;bottom:0;right:0;left:0;"; divBg.style.zIndex = CLTop.CLMaxZIndex(); CLTop.document.body.appendChild(divBg); divBg.Close = function () { if (divBg.parentNode != null) { divBg.parentNode.removeChild(divBg); } } divBg.addEventListener("mousedown", function () { divBg.Close(); window.removeEventListener("unload", divBg.Close); }); window.addEventListener("unload", divBg.Close); var divMenu = document.createElement("div"); divMenu.style.cssText = "position:fixed;background:#fff;overflow:auto;border:solid #e0e0e0 1px;"; divBg.appendChild(divMenu); divMenu.addEventListener("mousedown", function (e) { e.stopPropagation(); }); divMenu.style.maxHeight = "390px"; var divSearch = document.createElement("div"); divSearch.className = "ItemSearch"; divMenu.appendChild(divSearch); var inputSearch = document.createElement("input"); inputSearch.style.height = "29px"; inputSearch.style.lineHeight = "29px"; inputSearch.style.border = "none"; inputSearch.setAttribute("placeholder", "搜索"); inputSearch.style.width = "calc(100% - 7px)"; inputSearch.style.marginLeft = "5px"; inputSearch.value = ""; inputSearch.oninput = function () { _CLTree.Search(inputSearch.value); } divSearch.appendChild(inputSearch); var divClear = document.createElement("div"); divClear.className = "ItemClear"; divClear.innerHTML = "--请选择--"; divMenu.appendChild(divClear); divClear.onclick = function () { itemData.Val = null; ShowVal(); divBg.Close(); window.removeEventListener("unload", divBg.Close); } function SetPos() { var Rect = Div.getBoundingClientRectEx(); divMenu.style.top = Rect.bottom + "px"; divMenu.style.left = Rect.left + "px"; divMenu.style.minWidth = Rect.width + "px"; divMenu.style.zIndex = CLTop.CLMaxZIndex(); var mRect = divMenu.getBoundingClientRectEx(); if (mRect.bottom > CLTop.innerHeight) { divMenu.style.top = Rect.top - mRect.height + "px"; if (divMenu.offsetTop < 0) { divMenu.style.top = "0px"; } } if (mRect.right > CLTop.innerWidth) { divMenu.style.left = CLTop.innerWidth - divMenu.offsetWidth + "px"; } } divBg.appendChild(divMenu); _CLTree.Render(divMenu); var divTree = divMenu.lastChild; divTree.style.maxHeight = divMenu.offsetHeight - 62 + "px"; divTree.style.overflow = "auto"; _CLTree.Select(itemData.Val); SetPos(); _CLTree.OnSelected = function (ItemData) { itemData.Val = ItemData.ID; ShowVal(); divBg.Close(); window.removeEventListener("unload", divBg.Close); } } function ShowVal() { if (divLine.ValField.Val != null) { Div.innerHTML = ""; var divVal = document.createElement("div"); var Icon = document.createElement("span"); Icon.style.cssText = "font-family:CLFont;color:#f0ad4e;padding-right:8px"; Icon.innerHTML = ""; divVal.appendChild(Icon); var text = document.createElement("span"); var name = CLApp.getDepartmentNameById(divLine.ValField.Val); text.innerHTML = name == null ? "??????" : name; divVal.appendChild(text); Div.appendChild(divVal); } else { Div.innerHTML = "
点击选择部门
"; } } ShowVal(); } else { var input = document.createElement("input"); input.style.cssText = "border:1px solid #e0e0e0;height:30px;width:100%;padding:0 8px"; divLine.divVal.appendChild(input); input.value = divLine.ValField.Val == null ? "" : divLine.ValField.Val; if (divLine.ValField.className == "数字") { input.oninput = function () { CLCheckFloat(input, 10); } } input.onchange = function () { divLine.ValField.Val = input.value == null || input.value.length == 0 ? null : input.value; if (divLine.ValField.className == "数字") { divLine.ValField.Val = divLine.ValField.Val == null ? null : divLine.ValField.Val * 1; } } } } divLine["空值"] = function () { var divLine = this; divLine.divVal.innerHTML = ""; divLine.ValField.Val = null; divLine.ValField.ctrlID = null; delete divLine.ValField.SubInfo; delete divLine.ValField.ctrlParentId; if (divLine.DivSubInfo != null) { divLine.DivSubInfo.remove(); } } typeSel.onchanged = function (This) { This.ValField.valType = This.GetValue(); var divLine = This.divLine; divLine[This.ValField.valType](); } typeSel.selectedIndex = typeSel.Items.indexOf(ValField.valType); return divLine; } }()); ;(function () { function CLComments(Ele, dataId) { var self = this; self.Ele = Ele; self.dataId = dataId; function show(comment) { var ele = Ele.querySelector(".Comment[No='" + comment.ID + "']"); if (!ele) { ele = document.createElement("div"); ele.classList.add("Comment"); ele.setAttribute("No", comment.ID); ele.style.cssText = "position: relative;padding:10px;overflow:hidden"; Ele.firstChild.insertBefore(ele, Ele.firstChild.firstChild); } var html = ""; var user = CLApp.getUserById(comment.Submiter); var name = (user && user.name) || "????????"; var url = (user && user.avatar) || "/img/thu_man.png"; var icon = "
"; icon += "
"; html += icon; html += "
"; html += "" + name + ""; var text = comment.Content; var users = comment.Users; var index = -1; text = text && text.replace(/\uFEFF[\s\S]*\uFEFF/, function (v) { v = v.substr(1, v.length - 2); return "" + v + ""; }); html += "
" + (text || "") + "
"; html += "
"; var picture = comment.Picture; picture = JSON.parse(picture) picture && picture.forEach(function (pic) { var height = "auto"; var size = (Ele.offsetWidth - 20); if (picture.length == 1) { size *= 2; size /= 3; } else { size /= 3; height = size + "px"; } html += ""; }); html += "
"; html += ""; html += "
"; ele.innerHTML = html; var btns = ele.querySelector(".btns"); if (btns) { btns.childNodes[0].onclick = function () { self.showTip(ele, comment); } btns.childNodes[1].onclick = function (e) { var data = {}; data.ID = comment.ID; data.Content = null; data.Picture = null; data.Users = null; var menu = CLConfirm(function () { var url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpSetComment"; HttpPost(url, function (json) { if (json.code == -1) { CLShowMsg(json.msg); } }, { Comment: data, Msg: {} }); }, " 你确定要删除该评论吗?"); menu.Reset(e); } } var pics = ele.querySelectorAll(".Pictures .pic"); pics && pics.forEach(function (img, index) { img.onclick = function () { new CLPreView(picture, index); } }); ele.update = function () { } } var monitor = self.monitor = self.queryComments(function (data) { Ele.innerHTML = "
发表评论
"; Ele.lastChild.onclick = function () { self.showTip(this.lastChild); } data.forEach(function (comment) { show(comment); }); }); monitor.ID = dataId; monitor.OnMsg = function (Msg) { if (Msg.type == "add" || Msg.type == "update") { var Lines = Msg.Lines; Lines.forEach(function (comment) { show(comment); }); } else if (Msg.type == "delete") { var IDs = Msg.IDs; IDs.forEach(function (ID) { var ele = Ele.querySelector(".Comment[No='" + ID + "']"); ele && ele.remove(); }); } } } var fn = CLComments.prototype; fn.dataId = null; fn.queryComments = function (Success) { var vVars = {}; var self = this; vVars.dataId = self.dataId; var monitor = CLConnectMonitor("23042008481324100000", vVars); monitor.OnConnected = function (data) { data.ID = vVars.dataId; monitor.dataComments = data; Success(data); } return monitor; } fn.showTip = function (ele, dataComment) { var self = this; var width = IsMobile() ? innerWidth : ele.offsetWidth; var menu = CLAutoDialog(width, 120, ele); menu.Div.style.boxShadow = "none"; menu.Div.style.border = "1px #0db3a6 solid"; menu.Div.style.borderRadius = "3px"; var box = document.createElement("div"); box.style.cssText = "max-height: 328px;padding: 10px 10px 0;overflow: auto"; var content = document.createElement("div"); content.setAttribute("contenteditable", "true"); content.setAttribute("placeholder", "Ctrl+Enter发送评论,支持@成员"); content.style.cssText = "font-size:12px;line-height:17px;outline-style:none;min-height:70px;position:relative;cursor:text"; content.style["user-select"] = "auto"; content.innerHTML = "


"; content.classList.add("CLPlaceholder"); content.oninput = function (e) { var text = content.innerText.trim(); if (!!text) { content.classList.remove("CLPlaceholder"); } else { content.classList.add("CLPlaceholder"); } if (!ffValue() && !text) { btn.style.opacity = "0.5"; } else { btn.style.opacity = "1"; } menu.Reset(); if (e && e.data == "@") { fUsers(true); } } box.appendChild(content); var Preview = document.createElement("div"); box.appendChild(Preview); menu.Div.appendChild(box); var bottom = document.createElement("div"); bottom.style.cssText = "padding: 8px 10px;line-height: 24px;overflow:hidden"; var lable = document.createElement("div"); lable.style.cssText = "font-family:CLFont;color:#999;float:left"; lable.innerHTML = "@"; var _range = null; function saveRange() { var selection = window.getSelection(); if (!selection.rangeCount) { return; } var range = selection.getRangeAt(0); if (content.contains(range.startContainer) && content.contains(range.endContainer)) { _range = range; } } content.focus(); content.Focus = function () { if (_range) { var selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(_range); } else { content.focus(); } } function fUsers(back) { function insert(user) { var box = document.createElement("span"); box.innerHTML = ""; var span = document.createElement("span"); user = CLApp.getUserById(user); span.innerHTML = "@" + (user ? user.name : "????????"); span.style.color = "#0db3a6"; span.style.margin = "2px"; span.classList.add("user"); span.setAttribute("contenteditable", "false"); span.setAttribute("user", user.userid); box.appendChild(span); box.insertAdjacentHTML("beforeend", ""); _range.insertNode(box); _range.setStartAfter(box); _range.setEndAfter(box); } var task = self.Task([], ""); var unionids = task.participantIds; var users = []; CLTop.g_UserList.forEach(function (user) { if (unionids.indexOf(user.unionid) >= 0) { users.push(user.userid); } }); function MemberDlg(Success) { FrmCtrls.MemberDialog({ Parts: [], Roles: [], Members: users, Dynamic: [] }, typeof ID != "string", {}, true, function (Val) { Success(Val.Members); }); } MemberDlg(function (users) { menu.removeFilter(ele); if (users.length > 0) { if (back) { _range.setStart(_range.endContainer, _range.endOffset - 1); _range.deleteContents(); } users.forEach(function (user) { insert(user); }); content.oninput(); } }); function func() { menu.removeFilter(document.body); var ele = document.body.lastChild; var dlg = CLDialog.current(ele.firstChild); dlg.onclosed = function () { content.Focus(); } menu.addFilter(ele); } menu.addFilter(document.body); if (!IsMobile()) { func(); } else { CLDelay(function () { func(); }, 20); } } function DeleteFile(src) { var url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpDeleteFile"; var load = HttpPost(url, function () { }, { Url: src }); load.Stop(); } function UpLoadFile(file, Success, onProgress) { var url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpUploadFile"; var load = HttpPost(url, Success, {}, true, null, null, file, file.name, function (e) { if (e.IsUpLoad) { onProgress(e); } }); load.Stop(); } function Value(value) { if (value === undefined) { var text = content.innerText; var users = []; var spans = content.querySelectorAll(".user"); for (var i = 0; i < spans.length; i++) { users.push(spans[i].getAttribute("user")); } var files = ffValue(); return { Content: text, Users: users, Picture: files }; } else { var text = value.Content; var users = value.Users; var index = -1; text = text && text.replace(/\uFEFF[\s\S]*\uFEFF/, function (v) { v = v.substr(1, v.length - 2); return "" + v + ""; }); if (text) { content.innerHTML = text; } content.oninput(); var last = content.lastChild; _range.setStartAfter(last); _range.setEndAfter(last); var files = JSON.parse(value.Picture); files && files.forEach(function (file) { var item = new FileItem(file.Src, file.Name, file.Size); item.SetSrc(file.Src); }); menu.Reset(); } } function ffValue() { var Boxes = Preview.childNodes; var jRet = []; for (var i = 0; i < Boxes.length ; i++) { if (Boxes[i].File != null && Boxes[i].File.Src != null) { var Val = Boxes[i].File; Val.Ext = Val.Name.substr(Val.Name.lastIndexOf(".") + 1); jRet.push(Val); } } return jRet.length == 0 ? null : jRet; } function FileItem(url, Name, Size) { var Box = document.createElement("div"); Box.FileInfo = this; Box.File = { Name: Name, Size: Size, } Box.className = "FileBox"; Box.style.cssText = "width:330px;max-width:100%;height:52px;border:solid 1px #e0e0e0;position:relative;margin-bottom: 10px;"; var IconBg = document.createElement("div"); IconBg.style.cssText = "position: absolute;top:0;left:0;padding:8px;height:50px;width:50px"; Box.appendChild(IconBg); var Icon = document.createElement("div"); Icon.style.cssText = "height:100%;width:100%;background-size:100% 100%;"; Icon.style.backgroundImage = "url(" + url + ")"; IconBg.appendChild(Icon); var FileInfo = document.createElement("div"); FileInfo.style.cssText = "padding:5px;position: absolute;top: 0;left: 50px;right: 34px;bottom: 0;line-height: 18px;font-size:12px"; Box.appendChild(FileInfo); var span = document.createElement("span"); span.style.cssText = "overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display:inline-block"; span.innerHTML = Name.substr(0, Name.lastIndexOf(".")); FileInfo.appendChild(span); var spanExt = span.cloneNode(); spanExt.innerHTML = Name.substr(Name.lastIndexOf(".")); FileInfo.appendChild(spanExt); Preview.appendChild(Box); span.style.maxWidth = "calc(100% - " + (spanExt.offsetWidth + 3) + "px)"; var subText = document.createElement("span"); subText.style.cssText = "overflow: hidden;text-overflow: ellipsis;white-space: nowrap;display:inline-block;width:100%"; if (Size / 1024 >= 1024) { subText.innerHTML = (Size / 1024 / 1024).toFixed(2) + "MB"; } else { subText.innerHTML = (Size / 1024).toFixed(2) + "KB"; } FileInfo.appendChild(subText); var Del = document.createElement("div"); Del.className = "ItemDel"; Del.style.cssText = "width:24px;font-family:CLFont;font-size:16px;position:absolute;right:0px;top:8px;cursor:pointer;"; Del.innerHTML = ""; var This = this; Del.onclick = function (e) { This.Close(); content.oninput(); e.stopPropagation(); } Box.Index = function () { var Boxes = Box.parentNode.querySelectorAll(".FileBox"); for (var i = 0; i < Boxes.length ; i++) { if (Box == Boxes[i]) { return i; } } } Box.onclick = function () { var Box = this; var view = new CLPreView(ffValue(), Box.Index()); var ele = document.lastChild; menu.addFilter(ele); view.onclosed = function () { menu.removeFilter(ele); } } this.SetSrc = function (Src) { Box.File.Src = Src; } this.SetSize = function (size) { Size = Box.File.Size = size; if (Size / 1024 >= 1024) { subText.innerHTML = (Size / 1024 / 1024).toFixed(2) + "MB"; } else { subText.innerHTML = (Size / 1024).toFixed(2) + "KB"; } } Box.appendChild(Del); this.Close = function () { Preview.removeChild(Box); content.oninput(); } this.Box = Box; this.Size = Size; } function AddFile(file, Path) { var url = CLGetObjectURL(file); var bDel = false; var fileItem = new FileItem(url, file.name, file.size, file.shortBrief); var divProgressBg = document.createElement("div"); divProgressBg.style.cssText = "height:4px;width:100%;position:absolute;bottom:0;left:0;background:#ccc;border-radius:4px"; fileItem.Box.appendChild(divProgressBg); var divProgress = document.createElement("div"); divProgress.style.cssText = "height:4px;border-radius:4px;background:#1ac4b7;width:0px"; divProgressBg.appendChild(divProgress); menu.Reset(); UpLoadFile(file, function (Json) { if (Json.code == 0) { if (bDel) { CLDeleteObjectByUrl(url); } fileItem.Box.removeChild(divProgressBg); fileItem.SetSrc(Json.data[0]); fileItem.SetSize(Json.size); content.oninput(); } else { fileItem.Close(); CLShowMsg(Json.msg); } }, function (e) { var fProgress = e.loaded / fileItem.Size; if (fProgress > 1) { fProgress = 1; } divProgress.style.width = divProgressBg.offsetWidth * fProgress + "px"; }); } function fFile() { CLOpenFile(function (files, Path) { for (var i = 0; i < files.length; i++) { CLCompressImg(files[i], function (file) { if (file.size > 1024 * 1024 * 4) { CLShowMsg("上传失败,单个文件的上传上限是4M") return; } AddFile(file, Path); }); } }, null, true); } var _a = lable.childNodes[0]; _a.onclick = function () { fUsers(); } var _u = lable.childNodes[1]; _u.onclick = function () { fFile(); } bottom.appendChild(lable); var btn = document.createElement("div"); btn.style.cssFloat = "right"; btn.style.margin = "0"; btn.style.fontSize = "12px"; btn.style.width = "60px"; btn.innerHTML = dataComment ? "保存" : "发送"; btn.className = "CLBtnGreen CLBtnSmall"; btn.style.opacity = "0.5"; bottom.appendChild(btn); btn.onclick = function () { var data = Value(); if (!data.Content && !data.Picture) { return; } if (dataComment) { data.ID = dataComment.ID; data.DataID = dataComment.DataID; } else { data.DataID = self.dataId; } if (!data.DataID) { return; } var Msg = {}; if (data.Users) { Msg.msg = CLApp.getCurrentUser().name + "在评论中提到了你\n"; Msg.url = self.Url || location.href; Msg.url = CLHost + "/" + CLCorpId() + "/api/CLAuth.chx?Function=HttpRedirect&url=" + encodeURIComponent(Msg.url) + "&v=" + CLMakeId(); Msg.users = data.Users; } var url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpSetComment"; HttpPost(url, function (json) { if (json.code == -1) { CLShowMsg(json.msg); } else { content.innerHTML = ""; Preview.innerHTML = ""; menu.Close(); } }, { Comment: data, Msg: Msg }); } menu.Div.appendChild(bottom); menu.Reset(); menu.SetFree(true); saveRange(); function funcSave(e) { saveRange(); } window.addEventListener("mousedown", funcSave, true); menu.onclosed = function () { window.removeEventListener("mousedown", funcSave, true); self.dataComment = Value(); } Value(dataComment || self.dataComment); } fn.Close = function () { var self = this; self.Ele.innerHTML = ""; self.monitor && self.monitor.Close(); } fn.Task = function (users, content) { } window.CLComments = CLComments; }()) ;/// /// /// /// /// /// /// /// /// /// /// (function () { CLLoad("/View/Form/lib/Frm/FrmDesigner.css"); CLLoad("/View/Form/lib/Frm/FrmWheres.js"); CLLoad("/View/Form/lib/Frm/FrmWheres.css"); CLLoad("/CLUI/CLCheckBox/CLCheckBox.css"); CLLoad("/CLUI/CLRadioBox/CLRadioBox.css"); CLLoad("/CLUI/CLOnOff/CLOnOff.css"); CLLoad("/CLUI/CLSelect/CLSelect.css"); window.FrmCtrl = function () { this.__IsFrmCtrl__ = true; } FrmCtrl.IsValue = function (Val) { return Val && Val.__IsFrmCtrl__; } ///////////////////////////////Http接口/////////////////////////////// //获取表单字段 function getFieldsByFormID(FormId) { var Form = CLApp.getFormById(FormId); return Form == null ? [] : [].concat(Form.Fields); } var g_RelevantDataTable = {} function getFormDataByIdAndWheres(_FrmDesigner, ID, Wheres, Fun) { var self = this; if (ID == null) { if (Fun) { Fun.call(self, []); return; } else { return []; } } var DataTable = g_RelevantDataTable["DataTable_" + ID]; if (DataTable == null) { var Url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpGetFormDataByIdAndWheres&Data=" + JSON.stringify({ FormID: ID, Wheres: [] }); HttpPost(Url, function (Json) { if (Json.code != 0) { CLShowMsg(Json.msg); } else { DataTable = g_RelevantDataTable["DataTable_" + ID] = Json.data; } }, {}, false); } var Lines = []; var bAdd = null; for (var i = 0; DataTable != null && i < DataTable.length; i++) { bAdd = true; for (var j = 0; j < Wheres.length; j++) { if (Wheres[j].Value == null || DataTable[i]["DataField_" + Wheres[j].UnionFieldID] != Wheres[j].Value) { bAdd = false; } } if (bAdd) { Lines.push(DataTable[i]); } } if (Fun) { Fun.call(self, Lines); } else { return Lines; } } function getFormDataByIdAndWheresFromSource(_FrmDesigner, ID, Wheres, Fun, bQuery) { var self = this; var DataTable = _FrmDesigner.SourceData == null ? null : _FrmDesigner.SourceData[ID]; function CalcWheres() { var Lines = []; var bAdd = null; for (var i = 0; DataTable != null && i < DataTable.length; i++) { bAdd = true; for (var j = 0; Wheres != null && j < Wheres.length; j++) { var v = DataTable[i][Wheres[j].UnionFieldID]; v = v && v.oVal ? v.oVal : v; if (Wheres[j].Value == null || v != Wheres[j].Value) { bAdd = false; } } if (bAdd) { Lines.push(DataTable[i]); } } Fun.call(self, Lines); } if (bQuery || DataTable == null) { var load = _FrmDesigner.QueryData([ID], false, function (data) { DataTable = _FrmDesigner.SourceData == null ? null : _FrmDesigner.SourceData[ID]; CalcWheres(); }); if (load) { load.Stop(); } } else { CalcWheres(); } } function UpLoadFile(File, ExtInfo, Success, onProgress, WaterId, WaterInfo) { var Url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpUploadFile"; HttpPost(Url, Success, { ExtInfo: ExtInfo, WaterId: WaterId, WaterInfo: WaterInfo }, true, null, null, File, File.name, function (e) { if (e.IsUpLoad) { onProgress(e); } }); } //获取范围 function GetDataFieldRange(ID, FormID, Success) { var Url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpGetDataFieldRange"; var load = HttpPost(Url, function (Json) { var data = Json.data; var Range = []; for (var i = 0; i < data.length; i++) { if (data[i] != null) { Range.push(data[i].Field); } } Success(Range); }, { FieldID: ID, FormID: FormID }); load.Stop(); } ///////////////////////////////Http接口/////////////////////////////// var SingleControls = ["流水号", "单行文本", "多行文本", "数字", "时间日期", "单选按钮组", "复选框组", "下拉框", "下拉复选框", "成员单选", "成员多选", "部门单选", "部门多选"]; var CompareAble = function (className1, className2) { var Array0 = ["时间日期", "提交时间", "更新时间"]; var Array1 = ["流水号", "单行文本", "多行文本", "数字", "时间日期", "单选按钮组", "下拉框"]; var Array2 = ["复选框", "下拉复选框"]; var Array3 = ["成员单选", "提交人"]; if (Array0.indexOf(className1) >= 0 && Array0.indexOf(className2) >= 0) { return true; } if (Array1.indexOf(className1) >= 0 && Array1.indexOf(className2) >= 0) { return true; } if (Array2.indexOf(className1) >= 0 && Array2.indexOf(className2) >= 0) { return true; } if (Array3.indexOf(className1) >= 0 && Array3.indexOf(className2) >= 0) { return true; } return className1 == className2; } var PropSplit = function (Body) { var div = document.createElement("div"); div.classList.add("Split"); Body.appendChild(div); } var PropLabel = function (Body, Name) { var div = document.createElement("div"); div.classList.add("Label"); div.innerText = Name; Body.appendChild(div); return div; } var PropValue = function (Body, tag) { var input = document.createElement(tag == null ? "input" : tag); input.classList.add("Value"); Body.appendChild(input); return input; } var PropBtn = function (Body, Name) { var div = document.createElement("div"); div.classList.add("Value"); div.classList.add("Btn"); div.innerText = Name; Body.appendChild(div); return div; } var ResetCtrl = function (ControlBox, divContext) { if (ControlBox.dataCtrl.Data.ParentID == null) { var box; if (ControlBox.dataCtrl.Name == "子表单") { box = ControlBox.querySelector(".SubTable").parentNode; } var scroll = box ? box.scrollLeft : 0; ControlBox.firstChild.innerHTML = FrmCtrls[ControlBox.dataCtrl.Name].Html(ControlBox.dataCtrl.Data); if (box) { box = ControlBox.querySelector(".SubTable").parentNode; box.scrollLeft = scroll; } } else { ResetCtrl(FrmDesigner.getElementById(ControlBox.dataCtrl.Data.ParentID, divContext)); } if (ControlBox.Reset) { ControlBox.Reset(); } } var PropTitle = function (Body, ControlBox) { var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var Title = PropLabel(Body, "标题"); Title.innerHTML += "
" + ControlBox.dataCtrl.Name + "
"; var ctrlType = Title.lastChild; var downNames = ["流水号", "单行文本", "数字", "单选按钮组", "下拉框"]; var downNames2 = ["复选框组", "下拉复选框"]; var down = document.createElement("span"); down.style.fontFamily = "CLFont"; down.style.cursor = "pointer"; down.style.paddingLeft = "5px"; down.innerHTML = ""; var Menu = { "style": { "width": "120px", "max-height": "100%", }, "Items": [] }; var Items = Menu.Items; function update(className) { CLConfirm(function () { dataCtrl.Name = className; dataCtrl.Data = { ID: Data.ID, Name: Data.Name, ParentID: Data.ParentID }; ResetCtrl(ControlBox, Body); _CLMenu.Close(); }, "

提示

切换控件类型会清除所以配置数据,你确定要继续吗?", null, "380px"); } var _CLMenu; if (downNames.indexOf(dataCtrl.Name) >= 0) { ctrlType.appendChild(down); for (var i = 0; i < downNames.length; i++) { if (downNames[i] != dataCtrl.Name) { Items.push({ Text: downNames[i], "Enable": true, CallBack: function () { if (dataCtrl.Name == this.Text) { return; } else { update(this.Text); } } }); } } down.onclick = function () { var down = this; _CLMenu = new CLMenu(Menu, down.parentNode); } } if (downNames2.indexOf(dataCtrl.Name) >= 0) { ctrlType.appendChild(down); for (var i = 0; i < downNames2.length; i++) { if (downNames2[i] != dataCtrl.Name) { Items.push({ Text: downNames2[i], "Enable": true, CallBack: function () { if (dataCtrl.Name == this.Text) { return; } else { update(this.Text); } } }); } } down.onclick = function () { _CLMenu = new CLMenu(Menu, ctrlType); } }; var Arr = []; function func(ele) { var data = ele.dataCtrl; if (!data || data.Data.ID == Data.ID) { return; } if (data && JSON.stringify(data).indexOf(Data.ID) >= 0) { Arr.push({ ID: data.Data.ID, Name: data.Data.Name, Ele: ele }); } } (function () { var boxes = document.querySelectorAll(".ControlLine"); boxes.forEach(func); boxes = document.querySelectorAll(".ControlBox"); boxes.forEach(func); }()); if (Arr.length > 0) { var ref = document.createElement("span"); ref.style.cssText = "margin:0 7px;font-size:8px;cursor:pointer;color:#749FD1;font-family:CLFont;"; ref.innerHTML = ""; ref.title = "查找引用"; ref.onclick = function () { var div = document.createElement("div"); div.style.cssText = "width:300px;height:400px"; var dlg = new CLDialog(div); dlg.CreateAll("引用详情", function () { }); dlg.Body.style.overflow = "auto"; Arr.forEach(function (data) { var ele = document.createElement("div"); ele.innerHTML = data.Name; ele.ID = data.ID; ele.className = "CLBtnCancel CLBtnSmall"; dlg.Body.appendChild(ele); ele.ondblclick = function () { var ID = this.ID; var box = null; function func(e) { if (box || !e.dataCtrl) { return; } var data = e.dataCtrl.Data; if (data.ID == ID) { box = e; } } var boxes = document.querySelectorAll(".ControlLine"); boxes.forEach(func); if (!box) { boxes = document.querySelectorAll(".ControlBox"); boxes.forEach(func); } dlg.Close(); if (box) { box.scrollIntoView(); box.Select(); FrmDesigner.CtrlProp(box); } } }); } Title.appendChild(ref); } var Name = document.createElement("input"); Name.className = "Value"; Name.value = Data.Name == null ? "" : Data.Name; Name.onchange = function () { Data.Name = Name.value; ResetCtrl(ControlBox, Body); } Body.appendChild(Name); PropSplit(Body); var Title = PropLabel(Body, "别名"); var Rename = PropValue(Body, "input"); Rename.value = Data.Rename == null ? "" : Data.Rename; Body.appendChild(Rename); var Names = ["FormID", "ID", "ParentID", "createDt", "updateDt", "iFlowStatus", "FlowID", "Submiter", "Deletes", "Removes", "Levels", "Index", "Asyc", "changeType", "LockId", "NewLine"]; Rename.onchange = function () { if (Names.indexOf(Rename.value) >= 0) { Rename.value = Data.Rename == null ? "" : Data.Rename; CLShowMsg("系统字段不允许使用"); } else { Data.Rename = Rename.value; ResetCtrl(ControlBox, Body); } } if (Data.ParentID) { PropSplit(Body); PropLabel(Body, "列宽"); var iWidth = document.createElement("input"); iWidth.className = "Value"; iWidth.value = Data.iWidth == null ? "" : Data.iWidth; iWidth.onchange = function () { if (iWidth.value * 1 < 150) { iWidth.value = 150; } Data.iWidth = iWidth.value * 1; ResetCtrl(ControlBox, Body); } iWidth.oninput = function () { CLCheckInt(this, 0, 1000); } Body.appendChild(iWidth); } } var PropNote = function(Body, ControlBox) { var Data = ControlBox.dataCtrl.Data; PropLabel(Body, "描述信息"); var Note = PropValue(Body, "textarea"); Note.className = "Value"; Note.style.height = "120px"; Note.style.lineHeight = "20px"; Note.style.fontSize = "12px"; Note.style.color = "#91A1B7"; Note.value = Data.Note == null ? "" : Data.Note; Note.onchange = function () { Data.Note = Note.value; ResetCtrl(ControlBox, Body); } Body.appendChild(Note); } var PropPlaceholder = function (Body, ControlBox) { var Data = ControlBox.dataCtrl.Data; PropLabel(Body, "提示文字"); var info = PropValue(Body, "input"); info.className = "Value"; info.value = Data.Placeholder == null ? "" : Data.Placeholder; info.onchange = function () { Data.Placeholder = info.value; ResetCtrl(ControlBox, Body); } Body.appendChild(info); } var PropLayout = function (PropBody, ControlBox) { var Data = ControlBox.dataCtrl.Data; PropLabel(PropBody, "布局"); var div = document.createElement("div"); div.style.display = "inline-block"; div.style.height = "30px"; div.style.verticalAlign = "top"; div.style.lineHeight = "30px"; div.innerHTML = "显示宽度占用整行的"; PropBody.appendChild(div); var LayoutSel = new CLSelect(PropBody); LayoutSel.AddItems([ "全部", "1/2", "1/3", "1/4" ]); LayoutSel.onchanged = function (This) { Data.iLayout = This.selectedIndex; } LayoutSel.selectedIndex = Data.iLayout == null ? 0 : Data.iLayout; PropBody.lastChild.style.width = "100px"; PropBody.lastChild.style.cssFloat = "right"; PropBody.lastChild.style.display = "inline-block"; } var PropAuthority = function PropAuthority(PropBody, ControlBox) { PropLabel(PropBody, "字段权限"); var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var Box = new CLCheckBox("可见", PropBody); Box.checked = Data.Visible == null ? true : Data.Visible; Box.onchanged = function (Box) { Data.Visible = Box.checked; ResetCtrl(ControlBox, PropBody); } Box = new CLCheckBox("可编辑", PropBody); Box.checked = Data.Editable == null ? true : Data.Editable; Box.onchanged = function (Box) { Data.Editable = Box.checked; } } var PropDataLoaded = function (PropBody, ControlBox) { PropLabel(PropBody, "数据加载完成事件"); var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var Btn = document.createElement("div"); Btn.className = "Value Btn"; Btn.style.marginTop = "10px"; Btn.innerHTML = "设置"; Btn.onclick = function () { var _CoderEditor = new FrmCoderEditor(dataCtrl, Data.DataLoaded, PropBody, function (Val) { Data.DataLoaded = Val; }, Data.Name); } PropBody.appendChild(Btn); } var LinkageDialog = function (dataCtrl, divContext, bSource) { var Dialog = null; var Data = dataCtrl.Data; if (Data.Linkage == null) { Data.Linkage = {}; } var div = document.createElement("div"); div.style.width = "605px"; div.style.height = "600px"; Dialog = new CLDialog(div); Dialog.CreateAll(bSource ? "数据源联动" : "数据联动", function () { var Item = Sel.Items[Sel.selectedIndex]; if (Item == null) { Item = {}; } Data.Linkage = { FormID: Item.ID, ParentID: Item.ParentID, CurFieldID: Sel1.FieldID, UnionFieldID1: Sel2.FieldID, UnionFieldID2: Sel3.FieldID }; if (Data.Linkage.UnionFieldID2 == null) { Data.Linkage = null; } if (SubInfo != null && Data.Linkage != null) { Data.Linkage.SubInfo = SubInfo; } }); Dialog.EnableMove(); var Header = Dialog.Header; var Body = Dialog.Body; var label = document.createElement("div"); label.innerHTML = bSource ? "联动数据源" : "联动表单"; label.style.fontSize = "14px"; label.style.lineHeight = "25px"; label.style.color = "#333"; Body.appendChild(label); var Sel = new CLSelect(Body); Sel.SelIndex = -1; Sel.EnableClear(true); Sel.EnableSearch(true); Body.lastChild.style.marginTop = "15px"; Sel.setPlaceholder("请选择" + (bSource ? "联动数据源" : "联动表单")); var Forms = null; var _FrmDesigner = FrmDesigner.GetInstance(divContext); if (!bSource) { Forms = [].concat(CLApp.getForms(_FrmDesigner.getData().ID)); } else { Forms = [].concat(_FrmDesigner.getDataForms()); } for (var i = 0; i < Forms.length ; i++) { Sel.AddItems([ { ID: Forms[i].ID, Name:Forms[i].Name, toString: function () { return this.Name; } } ]); if (Data.Linkage.FormID == Forms[i].ID) { Sel.SelIndex = Sel.Items.length - 1; } for (var j = 0; j < Forms[i].Fields.length; j++) { if (Forms[i].Fields[j].className == "子表单" && dataCtrl.Name != "子表单") { Sel.AddItems([ { ID: Forms[i].Fields[j].ID, ParentID: Forms[i].ID, Name: Forms[i].Name + "->" + Forms[i].Fields[j].Name, toString: function () { return this.Name; } } ]); if (Data.Linkage.FormID == Forms[i].Fields[j].ID) { Sel.SelIndex = Sel.Items.length - 1; } } } } label = label.cloneNode(); label.innerHTML = "联动设置"; label.style.marginTop = "15px"; Body.appendChild(label); var Row = document.createElement("div"); Row.style.marginTop = "15px"; Row.style.height = "30px"; var currentSel = document.createElement("div"); currentSel.style.width = "200px"; currentSel.style.display = "inline-block"; var Sel1 = new CLSelect(currentSel); Sel1.setPlaceholder("当前表单字段"); Sel1.SelIndex = -1; Sel1.EnableClear(true); Sel1.EnableSearch(true); var curFields = [].concat(FrmDesigner.getData(divContext).Controls); for (var i = 0; i < curFields.length ; i++) { if (curFields[i].Name == '子表单' && Data.ParentID != null) { var subFields = CLClone(curFields[i].Data.Field); for (var j = 0; j < subFields.length ; j++) { if (SingleControls.indexOf(subFields[j].Name) < 0) { subFields.splice(j, 1); j--; } else { subFields[j].ParentName = curFields[i].Data.Name; } } curFields.splice(i, 1); for (var j = 0; j < subFields.length; j++) { curFields.splice(i + j, 0, subFields[j]); } } if (SingleControls.indexOf(curFields[i].Name) < 0 || curFields[i].Data.ID == Data.ID) { curFields.splice(i, 1); i--; continue; } if (curFields[i].Data.ParentID != null) { Sel1.AddItems([ curFields[i].ParentName + "->" + curFields[i].Data.Name ]); } else { Sel1.AddItems([ curFields[i].Data.Name ]); } if (Data.Linkage.CurFieldID == curFields[i].Data.ID) { Sel1.SelIndex = i; } } Row.appendChild(currentSel); var divText = document.createElement("div"); divText.style.width = "75px"; divText.innerHTML = "的值等于"; divText.style.marginLeft = "8px"; divText.style.lineHeight = "30px"; divText.style.verticalAlign = "top"; divText.style.fontSize = "14px"; divText.style.display = "inline-block"; Row.appendChild(divText); var unionSel = currentSel.cloneNode(); var Sel2 = new CLSelect(unionSel); Sel2.EnableClear(true); Sel2.EnableSearch(true); Sel2.setPlaceholder("联动表单字段"); function SetItem2(Fields) { Sel2.Items = []; Sel2.SelIndex = -1; if (Sel1 && curFields[Sel1.selectedIndex] != null) { for (var i = 0; i < Fields.length ; i++) { if (Sel1.selectedIndex != -1 && CompareAble(Fields[i].className, curFields[Sel1.selectedIndex].Name)) { Sel2.AddItems([ Fields[i].Name ]); if (Data.Linkage.UnionFieldID1 == Fields[i].ID) { Sel2.SelIndex = i; } } else { Fields.splice(i, 1); i--; } } } Sel2.onchanged = function (This) { Sel2.FieldID = Fields[This.selectedIndex] == null ? null : Fields[This.selectedIndex].ID; } Sel2.selectedIndex = Sel2.SelIndex; } Sel1.onchanged = function (This) { Sel1.FieldID = This.selectedIndex == -1 ? null : curFields[This.selectedIndex].Data.ID; var Fields; var Item = Sel.Items[Sel.selectedIndex]; if (Item == null) { Fields = []; } else if (Item.ParentID != null) { var formFields = getFieldsByFormID(Item.ParentID); for (var i = 0; i < formFields.length; i++) { if (formFields[i].ID == Item.ID) { Fields = formFields[i].Field; } } } else { if (!bSource) { Fields = getFieldsByFormID(Item.ID); } else { var _FrmDesigner = FrmDesigner.GetInstance(divContext); Fields = _FrmDesigner.GetFieldsBySourceId(Item.ID); } } SetItem2([].concat(Fields)); } Sel1.selectedIndex = Sel1.SelIndex; Row.appendChild(unionSel); divText = divText.cloneNode(); divText.style.width = "60px"; divText.innerHTML = "的值时"; Row.appendChild(divText); Body.appendChild(Row); Row = Row.cloneNode(); var fieldName = unionSel.cloneNode(); fieldName.style.border = "solid 1px #e0e0e0"; fieldName.style.lineHeight = "30px"; fieldName.style.height = "30px"; fieldName.style.background = "#f6f7f7"; fieldName.style.padding = "0 8px"; fieldName.style.fontSize = "14px"; fieldName.className = "ellipsis"; fieldName.innerHTML = Data.Name; Row.appendChild(fieldName); divText = divText.cloneNode(); divText.style.width = "75px"; divText.innerHTML = "联动显示"; Row.appendChild(divText); unionSel = currentSel.cloneNode(); var ShowSubItems = function () { }; var Sel3 = new CLSelect(unionSel); Sel3.setPlaceholder("联动表单字段"); function SetItem3(Fields) { Sel3.SelIndex = -1; var Item = Sel.Items[Sel.selectedIndex]; if (dataCtrl.Name == '子表单' && Item != null) { Fields = [{ ID: -1, Name: "主表单", className: "子表单", Fields:[] }].concat(Fields); } Sel3.Fields = Fields; if (Sel3) { for (var i = 0; i < Fields.length ; i++) { if (dataCtrl.Name == "下拉复选框" || dataCtrl.Name == "下拉框") { if (Fields[i].className == "单行文本" || Fields[i].className == "数字" || Fields[i].className == "流水号" || Fields[i].className == "下拉框" || Fields[i].className == "复选框组") { Sel3.AddItems([ Fields[i].Name ]); if (Data.Linkage.UnionFieldID2 == Fields[i].ID) { Sel3.SelIndex = i; } } else { Fields.splice(i, 1); i--; } } else { if (CompareAble(Fields[i].className, dataCtrl.Name)) { Sel3.AddItems([ Fields[i].Name ]); if (Data.Linkage.UnionFieldID2 == Fields[i].ID) { Sel3.SelIndex = i; } } else { Fields.splice(i, 1); i--; } } } } Sel3.onchanged = function (This) { Sel3.FieldID = Fields[This.selectedIndex] == null ? null : Fields[This.selectedIndex].ID; ShowSubItems(); } Sel3.selectedIndex = Sel3.SelIndex; } Sel.onchanged = function (This) { if (This.selectedIndex == -1) { SetItem2([]); SetItem3([]); Sel1.selectedIndex = -1; return; } Sel3.Items = []; var Fields; var Item = Sel.Items[This.selectedIndex]; if (Item == null) { Fields = []; } else if (Item.ParentID != null) { var formFields = getFieldsByFormID(Item.ParentID); for (var i = 0; i < formFields.length; i++) { if (formFields[i].ID == Item.ID) { Fields = formFields[i].Field; } } } else { if (!bSource) { Fields = getFieldsByFormID(Item.ID); } else { var _FrmDesigner = FrmDesigner.GetInstance(divContext); Fields = _FrmDesigner.GetFieldsBySourceId(Item.ID); } } SetItem2([].concat(Fields)); SetItem3([].concat(Fields)); } Sel.selectedIndex = Sel.SelIndex; Row.appendChild(unionSel); divText = divText.cloneNode(); divText.style.width = "60px"; divText.innerHTML = "的值"; Row.appendChild(divText); Body.appendChild(Row); var SubInfo; (function () { if (dataCtrl.Name == "子表单") { SubInfo = Data.Linkage.SubInfo; if (SubInfo == null) { SubInfo = []; } else { SubInfo = CLClone(SubInfo); } var divSubInfo = document.createElement("div"); divSubInfo.style.cssText = "width:100%;height:calc(100% - 210px)"; Body.appendChild(divSubInfo); var divLabel = document.createElement("div"); divLabel.style.cssText = "line-height:50px;padding-right:15px;"; divLabel.innerHTML = "子字段数据联动"; var span = document.createElement("span"); span.innerHTML = "添加子字段"; span.style.cssText = "font-family:CLFont;float:right;color:#0db3a6;cursor:pointer"; divLabel.appendChild(span); span.onclick = function () { if (Sel3.selectedIndex == -1 || Sel3.selectedIndex == null) { CLShowMsg("请选择子表单."); return; } var Field = Data.Field; var Menu = { "style": { "width": "180px", "max-height": "100%", "overflow-y": "scroll", }, "Items": [ ] } for (var i = 0; i < Field.length; i++) { Menu.Items.push({ "style": {}, "Icon": "", "Text": Field[i].Data.Name, "ID": Field[i].Data.ID, "Enable": (function () { for (var j = 0; j < SubInfo.length; j++) { if (SubInfo[j].ID == Field[i].Data.ID) { return false; } } return true; }()), "CallBack": function (e) { SubInfo.push({ ID: this.ID, UnionID: null }); e.currentTarget.Disabled = true; ShowSubItems(); } }); } var _CLMenu = new CLMenu(Menu, span); _CLMenu.EnableSearch(true); } divSubInfo.appendChild(divLabel); Body.appendChild(divSubInfo); var divSubItems = document.createElement("div"); divSubItems.style.cssText = "width:100%;max-height:calc(100% - 50px);overflow:auto"; divSubInfo.appendChild(divSubItems); var Linkage = Data.Linkage; ShowSubItems = function () { var Field = Data.Field; divSubItems.innerHTML = ""; function SetItems(selector, className, SelID) { selector.SelIndex = -1; var Fields = []; var Form = Forms[Sel.selectedIndex]; if (Sel3.Fields != null && Sel3.selectedIndex != -1) { if (Sel3.selectedIndex > 0) { Fields = [].concat(Sel3.Fields[Sel3.selectedIndex].Field); } else { Fields = [].concat(Form.Fields); } } selector.Fields = Fields; if (selector) { for (var i = 0; i < Fields.length ; i++) { if (CompareAble(Fields[i].className, className)) { selector.AddItems([ Fields[i].Name ]); if (SelID == Fields[i].ID) { selector.SelIndex = i; } } else { Fields.splice(i, 1); i--; } } } selector.selectedIndex = selector.SelIndex; } for (var i = 0; i < SubInfo.length; i++) { var subRow = Row.cloneNode(); subRow.style.margin = "5px 0"; fieldName = fieldName.cloneNode(); fieldName.innerHTML = (function () { for (var j = 0; j < Field.length ; j++) { if (Field[j].Data.ID == SubInfo[i].ID) { divSubItems.appendChild(subRow); subRow.appendChild(fieldName); divText = divText.cloneNode(); divText.style.width = "75px"; divText.innerHTML = "显示为"; subRow.appendChild(divText); unionSel = currentSel.cloneNode(); subRow.appendChild(unionSel); var Sel = new CLSelect(unionSel); Sel.setPlaceholder("联动表单字段"); Sel.Info = SubInfo[i]; Sel.onchanged = function (This) { var Fields = This.Fields; This.Info.UnionID = Fields[This.selectedIndex] == null ? null : Fields[This.selectedIndex].ID; } SetItems(Sel, Field[j].Name, SubInfo[i].UnionID); var Del = document.createElement("div"); Del.style.cssText = "font-family:CLFont;display:inline-block;line-height:30px;padding:0 15px;vertical-align:top;color:#3F80AE;font-size:18px;cursor:pointer;font-weight:900"; Del.innerHTML = ""; subRow.Info = SubInfo[i] Del.onmouseenter = function () { this.style.color = "#c00"; } Del.onmouseleave = function () { this.style.color = "#3F80AE"; } Del.onclick = function () { var subRow = this.parentNode; subRow.remove(); SubInfo.splice(SubInfo.indexOf(subRow.Info), 1); } subRow.appendChild(Del); return Field[j].Data.Name; } } }()); } } ShowSubItems(); } else { Row = Row.cloneNode(); Row.style.height = "20px"; Body.appendChild(Row); } })(); } var LinkageSourceDlg = function (dataCtrl, divContext) { LinkageDialog.call(this,dataCtrl, divContext, true); } var SetUnionCtrlIds = function (Data, Ctrls) { var div = document.createElement("div"); div.style.width = "590px"; div.style.height = "535px"; var Dialog = new CLDialog(div); Dialog.CreateAll("选项关联设置", function () { for (var i = 0; i < lFieldItems.length ; i++) { Data.Items[i].UnionCtrlIds = lFieldItems[i].UnionCtrlIds } Dialog.Close(); }); var Body = Dialog.Body; var Left = document.createElement("div"); Left.style.cssText = "width:200px;height:400px;float:left"; Body.appendChild(Left); var lTitle = document.createElement("span"); lTitle.innerHTML = "选项"; lTitle.style.lineHeight = "35px"; lTitle.style.padding = "0 5px"; Left.appendChild(lTitle); var lItems = document.createElement("div"); lItems.style.cssText = "width:100%;height:365px;border:1px solid #e0e0e0"; Left.appendChild(lItems); var lFieldItems = []; for (var i = 0; i < Data.Items.length; i++) { if (Data.Items[i].UnionCtrlIds == null) { Data.Items[i].UnionCtrlIds = []; } lFieldItems[i] = { ID: i, Name: Data.Items[i].Name, UnionCtrlIds: CLClone(Data.Items[i].UnionCtrlIds) } } var lList = new CLList(lFieldItems, lItems, null); var Right = document.createElement("div"); Right.style.cssText = "width:340px;height:400px;float:left;margin-left:10px"; Body.appendChild(Right); var rTitle = lTitle.cloneNode(); rTitle.innerHTML = "关联字段"; Right.appendChild(rTitle); var rItems = document.createElement("div"); rItems.style.cssText = "width:100%;height:365px;border:1px solid #e0e0e0"; Right.appendChild(rItems); var rFieldItems = []; var bStart = false; for (var i = 0; i < Ctrls.length; i++) { if (Ctrls[i].Name == "子表单") { rFieldItems.push({ ID: Ctrls[i].Data.ID, Name: Ctrls[i].Data.Name }); for (var j = 0; j < Ctrls[i].Data.Field.length; j++) { rFieldItems.push({ ID: Ctrls[i].Data.Field[j].Data.ID, Name: Ctrls[i].Data.Name + "->" + Ctrls[i].Data.Field[j].Data.Name }); } } else { rFieldItems.push({ ID: Ctrls[i].Data.ID, Name: Ctrls[i].Data.Name }); } } lList.OnSelected = function (lItemData) { rItems.innerHTML = ""; var rList = new CLList(rFieldItems, rItems, true); rList.Selects(lItemData.UnionCtrlIds); lItemData.UnionCtrlIds = rList.getSelIds(); rList.OnSelected = function (rItemData) { if (lItemData.UnionCtrlIds.indexOf(rItemData.ID) < 0) { lItemData.UnionCtrlIds.push(rItemData.ID); } } rList.OnLostSelected = function (rItemData) { if (lItemData.UnionCtrlIds.indexOf(rItemData.ID) >= 0) { lItemData.UnionCtrlIds.splice(lItemData.UnionCtrlIds.indexOf(rItemData.ID), 1); } } } lList.Select(0); } function updataColor(Data) { var style = document.getElementById(Data.ID); if (style == null) { style = document.createElement("style"); style.id = Data.ID; document.head.appendChild(style); } if (Data.Items.length == 2) { if (Data.Items[0].Color != Data.Items[1].Color && Data.Items[0].Color != Data.circleColor && Data.Items[1].Color != Data.circleColor) { style.innerHTML = ".Color" + Data.ID + " .CLOnOff-On{background:" + Data.Items[0].Color + "}\n"; style.innerHTML += ".Color" + Data.ID + " .CLOnOff-Off{background:" + Data.Items[1].Color + "}\n"; style.innerHTML += ".Color" + Data.ID + " .CLOnOff:before{background:" + Data.circleColor + "}"; } else { style.innerHTML = ""; } } } var PropRadioItems = function (PropBody, ControlBox) { var Div = document.createElement("div"); Div.className = "Block"; Div.style.width = "100%"; var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; PropBody.appendChild(Div); function setColor(color) { var colorDiv = this; if (color == null) { colorDiv.style.background = ""; colorDiv.style.color = ""; } else { colorDiv.style.background = color; colorDiv.style.color = color; updataColor(Data); } } var selBox = null; if (Data.IsOnOff) { var Item = document.createElement("div"); Item.className = "PropItem Color" + Data.ID; Item.style.height = "30px"; Item.style.margin = "10px 0"; Div.appendChild(Item); Item.Box = new CLOnOff("", Item); Item.lastChild.style.display = "inline-block" Item.Box.checked = Data.Items[0].Checked; Item.Box.Item = Item; Item.Box.onchanged = function () { if (this.checked) { Data.Items[0].Checked = true; Data.Items[1].Checked = false; this.Item.parentNode.childNodes[1].Box.checked = true; this.Item.parentNode.childNodes[2].Box.checked = false; } else { Data.Items[0].Checked = false; Data.Items[1].Checked = true; this.Item.parentNode.childNodes[1].Box.checked = false; this.Item.parentNode.childNodes[2].Box.checked = true; } ResetCtrl(ControlBox, PropBody); } var colorDiv = document.createElement("div"); colorDiv.setColor = setColor colorDiv.style.lineHeight = "24px"; colorDiv.style.display = "inline-block"; colorDiv.style.verticalAlign = "top"; colorDiv.style.cursor = "pointer"; colorDiv.style.padding = "0 5px"; var Name = document.createElement("div"); Name.innerHTML = "颜色(是)"; colorDiv.appendChild(Name); Item.appendChild(colorDiv); colorDiv.setColor(Data.Items[0].Color); colorDiv.onclick = function () { var colorDiv = this; if (!Data.Items[0].Color) { Data.Items[0].Color = ""; } var _CLColors = new CLColors(Data.Items[0].Color); _CLColors.End = function (color) { Data.Items[0].Color = color; colorDiv.setColor(color); } } colorDiv = colorDiv.cloneNode(); colorDiv.setColor = setColor Name = document.createElement("div"); Name.innerHTML = "颜色(否)"; colorDiv.appendChild(Name); Item.appendChild(colorDiv); colorDiv.setColor(Data.Items[1].Color); colorDiv.onclick = function () { var colorDiv = this; var _CLColors = new CLColors(Data.Items[1].Color); _CLColors.End = function (color) { Data.Items[1].Color = color; colorDiv.setColor(color); } } colorDiv = colorDiv.cloneNode(); colorDiv.setColor = setColor Name = document.createElement("div"); Name.innerHTML = "颜色(圆)"; colorDiv.appendChild(Name); Item.appendChild(colorDiv); colorDiv.setColor(Data.circleColor); colorDiv.onclick = function () { var colorDiv = this; var _CLColors = new CLColors(Data.circleColor); _CLColors.End = function (color) { Data.circleColor = color; colorDiv.setColor(color); } } } for (var i = 0; i < Data.Items.length ; i++) { var Item = document.createElement("div"); Item.className = "PropItem"; Item.Data = Data.Items[i]; Item.Index = function () { var Node = this.parentNode; for (var i = 0; i < Node.childNodes.length; i++) { if (Node.childNodes[i] == this) { return Data.IsOnOff ? i - 1 : i; } } } Item.Box = new CLRadioBox("", Item, true); Item.lastChild.style.width = "20px"; Item.lastChild.style.height = "35px"; Item.lastChild.style.verticalAlign = "top"; Item.lastChild.style.overflow = "hidden"; Item.lastChild.firstChild.style.margin = "7px 5px 0 0"; Item.Box.Item = Item; if (Data.IsOnOff) { Item.Box.enable = false; } else { Item.Box.onchanged = function () { var Item = this.Item; if (Item.Box.checked) { if (selBox && selBox != this) { selBox.checked = false; } selBox = Item.Box; Data.Items[Item.Index()].Checked = true; } else { Data.Items[Item.Index()].Checked = false; } ResetCtrl(ControlBox, PropBody); } } if (Data.Items[i].Checked) { selBox = Item.Box; } Div.appendChild(Item); var Val = document.createElement("input"); Val.className = "Value"; Val.value = Data.Items[i].Name; Val.onchange = function (e) { var Val = e.currentTarget; Data.Items[Val.parentNode.Index()].Name = Val.value; ResetCtrl(ControlBox, PropBody); } Item.appendChild(Val); if (Data.IsOnOff) { continue; } var Move = document.createElement("div"); Move.className = "Move"; Move.innerHTML = ""; CLEnableDragPosition(Item, "PropItem", Move, function () { var divItems = Div.getElementsByClassName("PropItem"); Data.Items = []; for (var i = 0; i < divItems.length; i++) { Data.Items.push(divItems[i].Data); } ResetCtrl(ControlBox, PropBody); }); Item.appendChild(Move); var Sub = document.createElement("div"); Sub.className = "Sub"; Sub.innerHTML = ""; Sub.onclick = function (e) { var Item = e.currentTarget.parentNode; Data.Items.splice(Item.Index(), 1); Item.parentNode.removeChild(Item); ResetCtrl(ControlBox, PropBody); } Item.appendChild(Sub); } if (selBox) { selBox.checked = true; } var Group = document.createElement("div"); Group.className = "Group"; var AddItem = document.createElement("div"); AddItem.className = "AddItem"; AddItem.innerHTML = "添加选项"; AddItem.onclick = function () { var data = { Name: "选项", Checked: false, UnionCtrlIds: [] } if (dataCtrl.Name == "单选按钮组" || dataCtrl.Name == "下拉框") { data.UnionCtrlIds = []; } else { data.Ctrls = []; } Data.Items.push(data); ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); } Group.appendChild(AddItem); Div.appendChild(Group); Group.style.borderBottom = "none"; if (dataCtrl.Name == "单选按钮组" || dataCtrl.Name == "下拉框") { var Union = document.createElement("div"); Union.className = "Value Btn"; Union.innerHTML = "选项关联设置"; Union.onclick = function () { var dataForm = FrmDesigner.getData(Union); if (Data.ParentID == null) { SetUnionCtrlIds(Data, dataForm.Controls); } else { var Ctrls = dataForm.Controls; for (var i = 0; i < Ctrls.length; i++) { if (Data.ParentID == Ctrls[i].Data.ID) { SetUnionCtrlIds(Data, Ctrls[i].Data.Field); } } } } Div.appendChild(Union); } return Div; } var PropCheckBoxItems = function (PropBody, ControlBox) { var Div = document.createElement("div"); Div.style.width = "100%"; var Data = ControlBox.dataCtrl.Data; for (var i = 0; i < Data.Items.length ; i++) { var Item = document.createElement("div"); Item.className = "PropItem"; Item.Data = Data.Items[i]; Item.Index = function () { var Node = this.parentNode; for (var i = 0; i < Node.childNodes.length; i++) { if (Node.childNodes[i] == this) { return i; } } } Item.Box = new CLCheckBox("", Item); Item.Box.Item = Item; Item.Box.checked = Data.Items[i].Checked; Item.Box.onchanged = function () { var Item = this.Item; Data.Items[Item.Index()].Checked = Item.Box.checked; ResetCtrl(ControlBox, PropBody); } var Val = document.createElement("input"); Val.className = "Value"; Val.value = Data.Items[i].Name; Val.onchange = function (e) { var Val = e.currentTarget; Data.Items[Val.parentNode.Index()].Name = Val.value; ResetCtrl(ControlBox, PropBody); } Item.appendChild(Val); var Move = document.createElement("div"); Move.className = "Move"; Move.innerHTML = ""; CLEnableDragPosition(Item, "PropItem", Move, function () { var divItems = Div.getElementsByClassName("PropItem"); Data.Items = []; for (var i = 0; i < divItems.length; i++) { Data.Items.push(divItems[i].Data); } ResetCtrl(ControlBox, PropBody); }); Item.appendChild(Move); var Sub = document.createElement("div"); Sub.className = "Sub"; Sub.innerHTML = ""; Sub.onclick = function (e) { var Item = e.currentTarget.parentNode; Data.Items.splice(Item.Index(), 1); Item.parentNode.removeChild(Item); ResetCtrl(ControlBox, PropBody); } Item.appendChild(Sub); Div.appendChild(Item); } PropBody.appendChild(Div); var Group = document.createElement("div"); Group.className = "Group"; var AddItem = document.createElement("div"); AddItem.className = "AddItem"; AddItem.innerHTML = "添加选项"; AddItem.onclick = function () { Data.Items.push({ Name: "选项", Checked: false, UnionCtrlIds: [] }); ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); } Group.appendChild(AddItem); Div.appendChild(Group); Group.style.borderBottom = "none"; return Div; } var ItemInfoSetter = { 关联其他表单数据: function (ControlBox, Div) { var Data = ControlBox.dataCtrl.Data; if (Data.Items.FormID == null) { Data.Items = {}; } Div = document.createElement("div"); Div.style.width = "100%"; Div.style.marginTop = "15px"; var formSel = new CLSelect(Div); var DivValue = Div.firstChild.firstChild; var _FrmDesigner = FrmDesigner.GetInstance(ControlBox); var Forms = [].concat(CLApp.getForms(_FrmDesigner.getData().ID)); for (var i = 0; i < Forms.length ; i++) { if (Forms[i].ID == Data.Items.FormID) { for (var j = 0; j < Forms[i].Fields.length ; j++) { if (Forms[i].Fields[j].className == "子表单") { for (var k = 0; k < Forms[i].Fields[j].Field.length; k++) { if (Forms[i].Fields[j].Field[k].ID == Data.Items.FieldID) { formSel.SetValue(Forms[i].Name + "->" + Forms[i].Fields[j].Name + "->" + Forms[i].Fields[j].Field[k].Name); } } } if (Forms[i].Fields[j].ID == Data.Items.FieldID) { formSel.SetValue(Forms[i].Name + "->" + Forms[i].Fields[j].Name); } } } } var BaseCtrl = ["流水号", "单行文本", "多行文本", "数字", "时间日期", "单选按钮", "下拉框"]; Div.firstChild.onclick = function () { var Menu = { "style": { "max-height": "250px", "max-width": "250px", "overflow": "auto" }, "Items": [] }; var _Menu = new CLMenu(Menu, Div); divMenu = _Menu.Div; var input = document.createElement("input"); input.style.height = "30px"; input.style.margin = "3px 10px"; input.style.width = "calc(100% - 20px)"; input.className = "CLSearch"; divMenu.appendChild(input); var jTree = { ID: "所有", Name: "所有", SubNode: [ ] } for (var i = 0; i < Forms.length; i++) { var jTable = { ID: Forms[i].ID, Name: Forms[i].Name, IsForm: true, SubNode: [ ] }; jTree.SubNode.push(jTable); for (var j = 0; Forms[i].Fields != null && j < Forms[i].Fields.length; j++) { if (Forms[i].Fields[j].className == "子表单") { var subForm = { ID: Forms[i].Fields[j].ID, Name: Forms[i].Fields[j].Name, IsForm: true, SubNode: [ ] } var subFields = Forms[i].Fields[j].Field; for (var k = 0; k < subFields.length; k++) { if (BaseCtrl.indexOf(subFields[k].className) < 0) { continue; } subForm.SubNode.push({ ID: subFields[k].ID, IsField: true, FormID: subForm.ID, FormName: Forms[i].Name + "->" + subForm.Name, Name: subFields[k].Name, }); } jTable.SubNode.push(subForm); } if (BaseCtrl.indexOf(Forms[i].Fields[j].className) < 0) { continue; } jTable.SubNode.push({ ID: Forms[i].Fields[j].ID, IsField: true, FormID: Forms[i].ID, FormName: Forms[i].Name, Name: Forms[i].Fields[j].Name, }); } } var Tree = new CLTree(jTree); Tree.Editable = false; Tree.OnItemCreated = function (Item, ItemData) { if (ItemData.IsForm) { Item.firstChild.onmousedown = function (e) { if (Item.IsOpen()) { Item.Close(); } else { Item.Open(); } e.stopPropagation(); } } if (ItemData.ID == "所有") { Item.firstChild.style.display = "none"; } else { Item.firstChild.style.paddingLeft = parseInt(Item.firstChild.style.paddingLeft) - 10 + "px"; } } Tree.Render(divMenu); Tree.Select(Data.Items.FieldID); Tree.OnSelected = function (ItemData) { if (ItemData.IsField) { Data.Items = { FormID: ItemData.FormID, FieldID: ItemData.ID } formSel.SetValue(ItemData.FormName + "->" + ItemData.Name); } _Menu.Close(); } divMenu.style.height = "initial"; divMenu.lastChild.style.height = "calc(250px - 38px)"; divMenu.lastChild.style.overflow = "auto"; input.oninput = function () { Tree.Search(input.value); } _Menu.Reset(); } return Div; } , 数据联动: function (ControlBox, Div) { var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; Div = document.createElement("div"); Div.style.width = "100%"; var Btn = document.createElement("div"); Btn.className = "Value Btn"; Btn.innerHTML = "数据联动设置"; Btn.onclick = function () { var Dialog = new LinkageDialog(dataCtrl, Btn); } Div.appendChild(Btn); return Div; } , 公式编辑: function (ControlBox, Div) { var Data = ControlBox.dataCtrl.Data; if (Data.Items.originalCode == null) { Data.Items = {}; } Div = document.createElement("div"); Div.style.width = "100%"; Div.style.marginTop = "15px"; Div.className = "Value Btn"; Div.innerHTML = "fx公式编辑"; Div.onclick = function () { var sHeader = Data.Name + ".条目="; var _CoderEditor = new FrmCoderEditor(ControlBox.dataCtrl, Data.Items, Div, function (Val) { Data.Items = Val; }, sHeader); } return Div; } , 数据源联动: function (ControlBox, Div) { var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; Div = document.createElement("div"); Div.style.width = "100%"; var Btn = document.createElement("div"); Btn.className = "Value Btn"; Btn.innerHTML = "数据源联动设置"; Btn.onclick = function () { var Dialog = new LinkageSourceDlg(dataCtrl, Btn); } Div.appendChild(Btn); return Div; } }; var PropDropDwonItems = function (PropBody, ControlBox) { var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var Sel = new CLSelect(PropBody); var DivSel = PropBody.lastChild; Sel.AddItems([ "自定义", "关联其他表单数据", "数据联动", "公式编辑", "数据源联动", ]); var Div = null; Sel.onchanged = function () { Data.SourceType = Sel.Items[Sel.selectedIndex]; if (Div != null) { Div.remove(); } Div = ItemInfoSetter[Data.SourceType](ControlBox, PropBody); PropBody.insertBefore(Div, DivSel.nextSibling); } ItemInfoSetter["自定义"] = function () { if (Div != null) { Div.remove(); } if (Data.Items.push == null) { Data.Items = []; } return PropRadioItems(PropBody, ControlBox); } var index = Sel.Items.indexOf(Data.SourceType); if (index < 0) { index = 0; } Sel.selectedIndex = index; PropBody.lastChild.style.marginBottom = "15px"; } var PropDropBoxItems = function (PropBody, ControlBox) { var Sel = new CLSelect(PropBody); var DivSel = PropBody.lastChild; Sel.AddItems([ "自定义", "关联其他表单数据", "数据联动", "公式编辑", "数据源联动" ]); PropBody.lastChild.style.marginBottom = "15px"; var Data = ControlBox.dataCtrl.Data; var Div = null; Sel.onchanged = function () { Data.SourceType = Sel.Items[Sel.selectedIndex]; Div = ItemInfoSetter[Data.SourceType](ControlBox, Div); PropBody.insertBefore(Div, DivSel.nextSibling); } ItemInfoSetter["自定义"] = function () { if (Div != null) { Div.parentNode.removeChild(Div); } if (Data.Items.push == null) { Data.Items = []; } return PropCheckBoxItems(PropBody, ControlBox); } var index = Sel.Items.indexOf(Data.SourceType); if (index < 0) { index = 0; } Sel.selectedIndex = index; } function CreateSplitLine0(ele, clr1, title, clr2) { ele.innerHTML = "
" + title + "
"; } function CreateSplitLine1(ele, clr1, title, clr2) { var html = "
" + title + "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine2(ele, clr1, title, clr2) { var html = "
" + title + "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine3(ele, clr1, title, clr2) { var html = "
" + title + "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine4(ele, clr1, title, clr2) { ele.classList.add("Split4"); ele.style.display = "flex"; var html = "
" + title + "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine5(ele, clr1, title, clr2) { var html = "
" + title + "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "" + title + ""; html += "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine6(ele, clr1, title, clr2) { ele.classList.add("Split6"); var html = "
" + title + "
"; html += "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine7(ele, clr1, title, clr2) { ele.classList.add("Split7"); ele.style.display = "flex"; ele.style["justify-content"] = "center"; var html = "
" + title + "" html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine8(ele, clr1, title, clr2) { ele.classList.add("Split8"); ele.style.display = "flex"; ele.style["justify-content"] = "center"; var html = "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
" + title + "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; html += "
"; ele.innerHTML = html; } function CreateSplitLine(Type, ele, clr1, title, clr2) { var func = eval("CreateSplitLine" + Type + ""); func(ele, clr1, title, clr2); } var PropLineType = function (PropBody, ControlBox) { var dataCtrl = ControlBox.dataCtrl; PropLabel(PropBody, "线型"); var Data = dataCtrl.Data; var div = document.createElement("div"); div.className = "SplitBox"; div.style.marginBottom = "10px"; PropBody.appendChild(div); var content = document.createElement("div"); content.className = "Content"; div.appendChild(content); var icon = document.createElement("div"); icon.className = "Icon"; div.appendChild(icon); var box_line = document.createElement("div"); box_line.className = "SplitLine"; content.appendChild(box_line); var note = document.createElement("div"); note.innerHTML = "这里是字段的描述信息"; note.style.cssText = "margin-top: 3px;font-size: 14px;line-height: 20px;color: #5E6D82;transform-origin: 0 50%;transform: scale(.8);width: 125%;"; content.appendChild(note); div.onclick = function () { var Menu = { "style": { "padding": "10px 10px 0 10px", "overflow-y": "auto", "max-height": "350px" }, Items: [] }; var _Menu = new CLMenu(Menu, this); var block = _Menu.Div; block.classList.add("FrmDesigner"); for (var i = 0; i < 9; i++) { var div = document.createElement("div"); div.className = "SplitBox"; div.style.margin = "5px 0"; block.appendChild(div); var content = document.createElement("div"); content.className = "Content"; div.appendChild(content); var line = document.createElement("div"); line.className = "SplitLine"; content.appendChild(line); CreateSplitLine(i, line, Data.themeColor, "字段标题", Data.titleColor); var note = document.createElement("div"); note.innerHTML = "这里是字段的描述信息"; note.style.cssText = "margin-top: 3px;font-size: 14px;line-height: 20px;color: #5E6D82;transform-origin: 0 50%;transform: scale(.8);width: 125%;"; content.appendChild(note); div.index = i; div.onclick = function () { Data.iType = this.index; box_line.innerHTML = ''; box_line.style.cssText = ""; box_line.className = "SplitLine"; CreateSplitLine(Data.iType, box_line, Data.themeColor, "字段标题", Data.titleColor); ResetCtrl(ControlBox, PropBody); _Menu.Close(); } } block.style.height = "initial"; _Menu.Reset(null, true); } var block = PropValue(PropBody, "div"); block.style.border = "none"; block.classList.add("ColorGrp"); var lable = document.createElement("div"); lable.innerHTML = "标题颜色"; lable.style.color = "#333"; lable.style.display = "inline-block"; lable.style.width = "70px"; lable.style.verticalAlign = "top"; lable.className = "text"; block.appendChild(lable); var box = PropValue(block, "div"); box.style.display = "inline-block"; box.style.width = "calc(100% - 70px)"; box.style.verticalAlign = "top"; box.style.position = "relative"; block.classList.add("ColorBox"); var clr1 = document.createElement("div"); if (!Data.titleColor) { Data.titleColor = "#1f2d3d"; } clr1.className = "Color"; clr1.style.background = Data.titleColor; clr1.block = block; clr1.onclick = function () { colorDlg([ "#ffffff", "#909ab8", "#b1d5dd", "#d2ddc0", "#dac1df", "#eeb7c2", "#dddddd", "#3c486c", "#7ea9b3", "#9dab84", "#af84b9", "#d68494", "#969696", "#1f2d3d", "#497884", "#617444", "#7c4988", "#b74b61" ], function (color) { Data.titleColor = color; clr1.style.background = color; CreateSplitLine(Data.iType, box_line, Data.themeColor, "字段标题", Data.titleColor); ResetCtrl(ControlBox, PropBody); }, this.block, Data.titleColor); } box.appendChild(clr1); var click = document.createElement("div"); click.className = "Reset"; click.innerHTML = ""; box.appendChild(click); click.onclick = function () { Data.titleColor = "#1f2d3d"; this.previousSibling.style.background = "#1f2d3d"; CreateSplitLine(Data.iType, box_line, Data.themeColor, "字段标题", Data.titleColor); ResetCtrl(ControlBox, PropBody); } if (!Data.themeColor) { Data.themeColor = "#c5cfdb"; } block = block.cloneNode(true); PropBody.appendChild(block); block.querySelector(".text").innerHTML = "主题颜色"; block.querySelector(".Reset").onclick = function () { Data.themeColor = "#c5cfdb"; this.previousSibling.style.background = "#c5cfdb"; CreateSplitLine(Data.iType, box_line, Data.themeColor, "字段标题", Data.titleColor); ResetCtrl(ControlBox, PropBody); } var clr2 = block.querySelector(".Color"); clr2.style.background = Data.themeColor; clr2.block = block; clr2.onclick = function () { colorDlg([ "#c5cfdb", "#3b75f9", "#0db3a6", "#af84b9", "#d68494", "#f19e4b", "#1f2d3d", "#2354c3", "#00897f", "#7c4988", "#b74b61", "#f47f1f" ], function (color) { Data.themeColor = color; clr2.style.background = color; CreateSplitLine(Data.iType, box_line, Data.themeColor, "字段标题", Data.titleColor); ResetCtrl(ControlBox, PropBody); }, this.block, Data.themeColor); } if (Data.iType === undefined) { Data.iType = 0; } CreateSplitLine(Data.iType, box_line, Data.themeColor, "字段标题", Data.titleColor); function colorDlg(colors, func, ele, color) { CLColors.Dialog({ color:color, colors: colors, onchange: func }, ele); } } var PropTableFields = function (PropBody, ControlBox) { PropLabel(PropBody, "字段"); var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var jFiled = Data.Field; var Div = document.createElement("div"); PropBody.appendChild(Div); for (var i = 0; i < jFiled.length; i++) { var Item = document.createElement("div"); Item.className = "PropItem"; Item.dataCtrl = jFiled[i]; Item.Index = function () { var PropItems = Div.getElementsByClassName("PropItem"); for (var i = 0; i < PropItems.length; i++) { if (PropItems[i] == this) { return i; } } } var Label = document.createElement("div"); Label.className = "Value"; Label.style.marginBottom = "10px"; Label.style.width = "220px"; Label.style.padding = "0 5px"; Label.style.display = "inline-block"; var Icon = document.createElement("div"); Icon.className = "FontIcon"; Icon.innerHTML = FrmCtrls[jFiled[i].Name].Icon; Label.style.cursor = "pointer"; Label.appendChild(Icon); Label.innerHTML += "
" + jFiled[i].Data.Name + "
"; var Move = document.createElement("div"); Move.className = "Move"; Move.style.margin = "0 0 0 3px"; Move.innerHTML = ""; CLEnableDragPosition(Item, "PropItem", Move, function () { var divItems = Div.getElementsByClassName("PropItem"); Data.Field = []; for (var i = 0; i < divItems.length; i++) { Data.Field.push(divItems[i].dataCtrl); } ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); }); Label.appendChild(Move); Item.appendChild(Label); Label.onclick = function (e) { var divFiled = e.currentTarget.parentNode; divFiled.FrmDesigner = FrmDesigner.GetInstance(PropBody); var box = ControlBox.querySelector(".ControlBoxSel"); if (box) { box.classList.remove("ControlBoxSel"); } box = ControlBox.querySelector(".SubTable").lastChild.querySelector(".Column_" + divFiled.dataCtrl.Data.ID); box.classList.add("ControlBoxSel"); FrmDesigner.CtrlProp(PropBody, divFiled); } var Copy = document.createElement("div"); Copy.className = "FontIcon"; Copy.innerHTML = ""; Copy.style.cursor = "pointer"; Item.appendChild(Copy); Copy.onclick = function (e) { var Box = e.currentTarget.parentNode; var dataCtrl = CLClone(Box.dataCtrl); Box.dataCtrl.Data.ID = CLMakeId(); jFiled.splice(Box.Index(), 0, dataCtrl); ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); } var Del = Copy.cloneNode(true); Del.className = "FontIcon"; Del.style.cursor = "pointer"; Del.innerHTML = ""; Del.onclick = function (e) { var Del = e.currentTarget; CLConfirm(function () { jFiled.splice(Del.parentNode.Index(), 1); ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); }, "若删除该字段,其对应的表单数据也会被清除。确定删除?",e,"280px"); } Item.appendChild(Del); Div.appendChild(Item); } var AddFiled = document.createElement("div"); AddFiled.className = "AddItem"; var Icon = document.createElement("div"); Icon.className = "FontIcon"; Icon.innerHTML = ""; AddFiled.appendChild(Icon); AddFiled.style.width = "80px"; AddFiled.innerHTML += "添加字段"; AddFiled.style.display = "inline-block"; AddFiled.onclick = function (e) { var divMenu = document.createElement("div"); divMenu.className = "SelectMenu"; var Item = null; var _CLMenu = null; var Menu = { "style": { "max-height": "350px", "overflow-y": "auto", }, "Items": [] } for (var i = 0; i < FrmCtrls.Categorys.length ; i++) { for (var j = 0; j < FrmCtrls[FrmCtrls.Categorys[i]].length; j++) { var Name = FrmCtrls[FrmCtrls.Categorys[i]][j].Name; if (Name == "子表单" || Name == "分割线" || Name == "选项卡" || Name == "表格控件" || Name == "流水号") { continue; } Menu.Items.push({ ID: Name, Text: Name, Enable: true, CallBack: function (event) { var Item = event.currentTarget; jFiled.push({ Name: this.Text, Data: { ID: CLMakeId(), ParentID: Data.ID, Name: this.Text } }); ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); _CLMenu.Close(); } }); } } _CLMenu = new CLMenu(Menu, e.currentTarget); } Div.appendChild(AddFiled); if (!jFiled || jFiled.length == 0) { var fromMap = document.createElement("div"); fromMap.style.cssText = "color:#0db3a6;line-height:30px;cursor:pointer;display:inline-block;width:115px;margin-left:65px"; fromMap.innerHTML = "从其他它表单构建"; Div.appendChild(fromMap); var FormItems = []; (function () { var dataForm = FrmDesigner.getData(ControlBox); var Forms = [].concat(CLApp.getForms(dataForm.ID)); for (var i = 0; i < Forms.length ; i++) { FormItems.push( { ID: Forms[i].ID, Name: Forms[i].Name, Fields: Forms[i].Fields, toString: function () { return this.Name; } }); } }()); var selector = new CLSelect(null, fromMap); selector.EnableClear(true); selector.EnableSearch(true); selector.AddItems(FormItems); selector.onchanged = function () { var id = null; if (selector.selectedIndex < 0) { return; } else { var Form = FrmDesigner.GetConfig(selector.Items[selector.selectedIndex].ID); var Controls = Form.Controls; var classNames = ["子表单", "分割线", "选项卡", "表格控件", "关联查询", "提交时间", "更新时间", "流程状态"]; var Field = []; for (var i = 0; i < Controls.length; i++) { var Name = Controls[i].Name; if (classNames.indexOf(Name) < 0) { delete Controls[i].Data.iLayout; if (Controls[i].Name == "流水号") { Controls[i].Name = "单行文本"; } Field.push(Controls[i]); } } var dataForm = FrmDesigner.getData(ControlBox); var MapInfo = dataForm.MappingInfo; if (!MapInfo) { dataForm.MappingInfo = MapInfo = {}; } MapInfo[Data.ID] = { FormID: Form.ID }; var sField = JSON.stringify(Field); for (var i = 0; i < Field.length; i++) { var Id = Field[i].Data.ID; var newId = CLMakeId(); MapInfo[Data.ID][newId] = Id; sField = sField.replace(new RegExp(Id, "g"), newId); } Field = JSON.parse(sField); for (var i = 0; i < Field.length; i++) { Field[i].Data.ParentID = Data.ID; jFiled.push(Field[i]); } ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); } } } } var PropConditionDialog = function (ControlBox) { var Dialog = null; var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var div = document.createElement("div"); div.style.width = "520px"; div.style.height = "455px"; Dialog = new CLDialog(div); Dialog.CreateAll("关联条件限定", function () { var Lines = Box.childNodes; var Wheres = []; for (var i = 0; i < Lines.length ; i++) { if (Lines[i].Where != null && Lines[i].Where.FieldID != null && Lines[i].Where.UnionFieldID != null) { Wheres.push(Lines[i].Where); } } Data.Wheres = Wheres; Dialog.Close(); }); var Body = Dialog.Body; var Row = document.createElement("div"); var span = document.createElement("span"); span.innerHTML = "设置多个关联条件限定关联数据"; span.style.color = "#989898"; span.style.fontSize = "12px"; Row.appendChild(span); var Add = document.createElement("span"); Add.style.color = "#178cdf"; Add.style.cursor = "pointer"; Add.innerHTML = "添加关联条件"; Add.style.cssFloat = "right"; span.style.fontSize = "14px"; Row.appendChild(Add); Body.appendChild(Row); var Box = document.createElement("div"); Box.style.width = "480px"; Box.style.height = "290px"; Box.style.margin = "10px 0"; Box.style.overflow = "auto"; Box.style.border = "solid 1px #e0e0e0"; Body.appendChild(Box); function AddWhere(Where) { var divLine = document.createElement("div"); divLine.style.height = "30px"; divLine.style.margin = "5px 0"; var current = document.createElement("div"); current.style.width = "180px"; current.style.height = "30px"; current.style.margin = "0 10px"; current.style.display = "inline-block"; var curSel = new CLSelect(current); curSel.setPlaceholder("当前表单字段"); var curFields = [].concat(FrmDesigner.getData(ControlBox).Controls); var classNames = SingleControls; for (var i = 0; i < curFields.length; i++) { if (curFields[i].Name == '子表单' && Data.ParentID != null) { var subFields = CLClone(curFields[i].Data.Field); for (var j = 0; j < subFields.length ; j++) { if (SingleControls.indexOf(subFields[j].Name) < 0) { subFields.splice(j, 1); j--; } else { subFields[j].ParentName = curFields[i].Data.Name; } } curFields.splice(i, 1); for (var j = 0; j < subFields.length; j++) { curFields.splice(i + j, 0, subFields[j]); } } if (classNames.indexOf(curFields[i].Name) < 0) { curFields.splice(i, 1); i--; continue; } if (curFields[i].Data.ParentID != null) { curSel.AddItems([ curFields[i].ParentName + "->" + curFields[i].Data.Name ]); } else { curSel.AddItems([ curFields[i].Data.Name ]); } } divLine.appendChild(current); var label = document.createElement("div"); label.innerHTML = "值等于"; label.style.lineHeight = "30px"; label.style.verticalAlign = "top"; label.style.display = "inline-block"; divLine.appendChild(label); var union = current.cloneNode(); var unionSel = new CLSelect(union); unionSel.setPlaceholder("关联字段"); divLine.appendChild(union); var unionFields = null; curSel.onchanged = function (This) { unionFields = getFieldsByFormID(Data.UnionForm.ID); unionSel.Items = []; for (var i = 0; i < unionFields.length ; i++) { if (curSel.selectedIndex != -1 && CompareAble(unionFields[i].className, curFields[curSel.selectedIndex].Name)) { unionSel.AddItems([ unionFields[i].Name ]); } else { unionFields.splice(i, 1); i--; } } unionSel.selectedIndex = -1; divLine.Where = { FieldID: curFields[curSel.selectedIndex].Data.ID } if (curSel.selectedIndex == -1) { delete divLine.Where; } unionSel.onchanged = function (This) { divLine.Where.UnionFieldID = unionFields[This.selectedIndex].ID } } if (Where != null) { for (var i = 0; i < curFields.length ; i++) { if (curFields[i].Data.ID == Where.FieldID) { curSel.selectedIndex = i; } } for (var i = 0; i < unionFields.length ; i++) { if (unionFields[i].ID == Where.UnionFieldID) { unionSel.selectedIndex = i; } } } var Del = document.createElement("div"); Del.style.fontFamily = "CLFont"; Del.style.display = "inline-block"; Del.style.verticalAlign = "top"; Del.style.margin = "7px"; Del.style.fontWeight = "100"; Del.style.fontSize = "14px"; Del.style.cursor = "pointer"; Del.style.color = "#b73224"; Del.innerHTML = ""; Del.onclick = function () { divLine.parentNode.removeChild(divLine); } divLine.appendChild(Del); if (Where) { if (divLine.Where != null && divLine.Where.FieldID != null && divLine.Where.UnionFieldID != null) { Box.appendChild(divLine); } } else { Box.appendChild(divLine); } } Add.onclick = function () { AddWhere(); }; var Wheres = Data.Wheres; if (Wheres == null) { Wheres = []; } for (var i = 0; i < Wheres.length ; i++) { AddWhere(Wheres[i]); } } var PropUnionFiled = function (PropBody, ControlBox) { var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var Title = PropLabel(PropBody, "关联字段"); var Add = document.createElement("div"); Add.className = "FontIcon"; Add.style.fontSize = "18px"; Add.style.cssFloat = "right"; Add.style.margin = "0px"; Add.style.color = "#0db3a6"; Add.style.verticalAlign = "middle"; Add.innerHTML = ""; Add.style.cursor = "pointer"; var UnionField = Data.UnionField; Add.onclick = function (e) { var Fields = getFieldsByFormID(Data.UnionForm.ID); Fields = Fields.concat([ { ID: "Submiter", Name: "提交人", className: "提交人" }, { ID: "createDt", Name: "提交时间", className: "提交时间" }, { ID: "updateDt", Name: "更新时间", className: "更新时间" } ]); var Menu = { "style": { "width": "120px", "max-height": "100%", }, "Items": [] }; for (var i = 0; i < Fields.length ; i++) { if (Data.ParentID != null && Fields[i].className == "子表单") { continue; } if (Fields[i].className == "表格控件" || Fields[i].className == "分割线" || Fields[i].className == "选项卡" || Fields[i].className == "关联查询" || Fields[i].className == "关联数据") { continue; } var Enable = true; for (var j = 0; j < UnionField.length; j++) { if (UnionField[j].ID == Fields[i].ID) { Enable = false; break; } } Menu.Items.push({ ID: Fields[i].ID, Text: Fields[i].Name, Name: Fields[i].Name, className: Fields[i].className, Enable: Enable, CallBack: function (e) { var Item = e.currentTarget; if (Item.disabled == true) { return; } UnionField.push({ ID: this.ID, Name: this.Name, className: this.className }); Item.Disabled = true; ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); } }); } new CLMenu(Menu, e.currentTarget); } Title.appendChild(Add); var Div = document.createElement("div"); PropBody.appendChild(Div); for (var i = 0; i < UnionField.length ; i++) { var Item = document.createElement("div"); Item.className = "PropItem"; Item.style.cursor = "move"; Item.style.lineHeight = "30px"; Item.Data = UnionField[i]; var Name = document.createElement("div"); Name.innerHTML = UnionField[i].Name; Name.style.paddingLeft = "10px"; Name.className = "Name"; Item.appendChild(Name); var Edit = document.createElement("div"); Edit.className = "FontIcon"; Edit.style.margin = "0"; Edit.style.position = "absolute"; Edit.style.right = "38px"; Edit.style.cursor = "pointer"; Edit.innerHTML = FrmCtrls["单行文本"].Icon; Edit.onclick = function (e) { var divField = this.parentNode; var Menu = { "style": { "height": "150px", "padding": "10px" }, "Items": [] }; var _CLMenu = new CLMenu(Menu, Item); var Box = _CLMenu.Div; var Row = document.createElement("div"); Row.style.paddingBottom = "5px"; var Label = document.createElement("div"); Label.style.lineHeight = "30px"; Label.innerHTML = "显示名"; Label.style.display = "inline-block"; Label.style.width = "80px"; Row.appendChild(Label); var input = PropValue(Row); input.style.height = "30px"; input.style.width = "100%"; input.value = Item.Data.Name; Box.appendChild(Row); Row = Row.cloneNode(); Row.style.textAlign = "center"; var Btn = document.createElement("div"); Btn.className = "CLBtnCancel"; Btn.innerHTML = "取消"; var Menu = null; Btn.onclick = function () { _CLMenu.Close(); } Row.appendChild(Btn); Btn = document.createElement("div"); Btn.className = "CLBtnGreen"; Btn.innerHTML = "确定"; Btn.onclick = function () { Item.Data.Name = input.value; Item.firstChild.innerText = input.value; ResetCtrl(ControlBox, PropBody); _CLMenu.Close(); } Row.appendChild(Btn); Box.appendChild(Row); _CLMenu.Reset(); } Item.appendChild(Edit); var Del = document.createElement("div"); Del.className = "FontIcon Del"; Del.style.margin = "0"; Del.style.position = "absolute"; Del.style.right = "18px"; Del.style.cursor = "pointer"; Del.innerHTML = ""; Del.index = i; Del.onclick = function (e) { var Del = e.currentTarget; UnionField.splice(Del.index, 1); Del.parentNode.parentNode.removeChild(Del.parentNode); ResetCtrl(ControlBox, PropBody); FrmDesigner.CtrlProp(PropBody, ControlBox); } Item.appendChild(Del); Div.appendChild(Item); CLEnableDragPosition(Item, "PropItem", Item, function () { var divItems = Div.getElementsByClassName("PropItem"); Data.UnionField = []; for (var i = 0; i < divItems.length; i++) { Data.UnionField.push(divItems[i].Data); } ResetCtrl(ControlBox, PropBody); }); } PropSplit(PropBody); PropLabel(PropBody, "关联字段条件限定"); var Union = document.createElement("div"); Union.className = "Value Btn"; Union.innerHTML = "添加关联条件"; Union.onclick = function () { ControlBox.FrmDesigner = FrmDesigner.GetInstance(Union); new PropConditionDialog(ControlBox); }; PropBody.appendChild(Union); } //Range: { Parts: [], Roles: [], Members: [], Dynamic: []},Val:{Members:[],Dynamic:[]} var MemberDialog = function (Range, isMult, Val, realDynamic, End, load) { if (IsMobile() && !load) { load = new Loading(); CLDelay(function () { MemberDialog(Range, isMult, Val, realDynamic, End, load); },10); return; } if (IsMobile()) { load && load.Stop(); var html = H5.Get("/View/Form/Lib/Frm/Dialog/Mobile-User.html?v=1.10"); var div = document.createElement("div"); document.body.appendChild(div); var h5 = H5(div); Range = H5.Clone(Range); delete Range.ControlId; for (var key in Range) { if (!Range[key] || Range[key].length == 0) { delete Range[key]; } } if (Object.keys(Range).length == 0) { Range = null; } h5.SetParam("Range", Range); h5.SetParam("Type", isMult ? "多选" : "单选"); h5.SetParam("End", function (value) { isMult ? End({ Members: value }) : End({ Members: [value] }); }); Val = Val && Val.Members; h5.SetParam("Value", isMult ? Val : Val && Val[0]); h5.Render(html); h5.WaitEvent("closed", function () { div.remove(); }); return; } if (Val == null) { Val = {}; } var dlgDiv = document.createElement("div"); if (IsMobile()) { dlgDiv.style.width = "100%"; dlgDiv.style.height = "100%"; } else { dlgDiv.style.width = "654px"; dlgDiv.style.maxWidth = "100%"; dlgDiv.style.height = "575px"; } var dlg = new CLDialog(dlgDiv, !IsMobile()); var listMember = []; var listDynamic = []; var listRange = []; var listRangeIds = []; dlg.CreateAll("选择成员", function () { var Val = {}; Val.Members = listMember; Val.Dynamic = listDynamic; End(Val); }); var sInput = document.createElement("input"); sInput.className = "CLSearch"; sInput.style.height = "30px"; if (IsMobile()) { sInput.style.width = "100%"; sInput.style.margin = "7px 0"; sInput.style.cssFloat = "left"; dlg.Header.style.position = "relative"; dlg.Header.appendChild(sInput); } else { dlg.EnableMove(); } var Body = dlg.Body; Body.className = "FrmDesignerDialog"; var SelContainer = document.createElement("div"); SelContainer.className = "SelContainer"; Body.appendChild(SelContainer); var tableBar = document.createElement("div"); tableBar.className = "tableBar"; tableBar.style.margin = "0"; Body.appendChild(tableBar); var MainDiv = document.createElement("div"); MainDiv.style.border = "solid 1px #e0e0e0"; MainDiv.style.borderTop = "none"; MainDiv.style.overflow = "hidden"; Body.appendChild(MainDiv); var orgDiv = MainDiv.cloneNode(); orgDiv.style.border = "none"; orgDiv.style.overflow = "auto"; orgDiv.style.height = "100%"; MainDiv.appendChild(orgDiv); var roleDiv = orgDiv.cloneNode(); MainDiv.appendChild(roleDiv); var userDiv = orgDiv.cloneNode(); MainDiv.appendChild(userDiv); var dynamicDiv = orgDiv.cloneNode(); MainDiv.appendChild(dynamicDiv); if (IsMobile()) { MainDiv.style.height = "calc(100% - 160px)"; } else { MainDiv.style.height = "310px"; } MainDiv.style.position = "relative"; var Btns = []; var hasRange = false; var PartIds; var RoleIds; var dynamicList; if (Range.Parts != null && Range.Parts.length != 0) { hasRange = true; PartIds = CLApp.extendDepartRoot(Range.Parts); } if (Range.Roles != null && Range.Roles.length != 0) { hasRange = true; RoleIds = CLApp.extendRoleRoot(Range.Roles); } if (Range.Members != null && Range.Members.length != 0) { hasRange = true; } if (Range.Dynamic != null && Range.Dynamic.length != 0) { hasRange = true; } dynamicList = getDynamic(Range.Dynamic); function getMembers() { var List = []; var userlist = CLApp.getUserList(); for (var i = 0; i < userlist.length; i++) { if (!hasRange) { List.push({ ID: userlist[i].userid, Name: userlist[i].name, TreeID: userlist[i].department, Roles: userlist[i].Roles }); } else { if (Range.Members.indexOf(userlist[i].userid) >= 0) { List.push({ ID: userlist[i].userid, Name: userlist[i].name, TreeID: userlist[i].department }); } else { var find = false; for (var j = 0; !find && Range.Roles && j < Range.Roles.length; j++) { if (userlist[i].Roles.indexOf(Range.Roles[j]) >= 0) { find = true; break; } } for (var j = 0; !find && Range.Parts && j < Range.Parts.length; j++) { if (userlist[i].department.indexOf(Range.Parts[j]) >= 0) { find = true; break; } } for (var j = 0; realDynamic && !find && dynamicList && j < dynamicList.length; j++) { if (userlist[i].userid == dynamicList[j].ID) { find = true; break; } } if (find) { List.push({ ID: userlist[i].userid, Name: userlist[i].name, TreeID: userlist[i].department, Roles: userlist[i].Roles }); } } } } return List; } var users = getMembers(); function getDynamic(Ids) { if (!realDynamic && !hasRange) { return g_Dynamic; } var list = []; for (var i = 0; i < g_Dynamic.length; i++) { if (Ids == null || Ids.indexOf(g_Dynamic[i].ID) >= 0 || !hasRange) { list.push(g_Dynamic[i]); } } return realDynamic ? RealDynamic(list) : g_Dynamic; } function getRoleMembers(RoleIds) { var list = []; for (var i = 0; RoleIds && i < users.length; i++) { if (hasRange) { for (var j = 0; j < RoleIds.length; j++) { if (users[i].Roles && users[i].Roles.indexOf(RoleIds[j]) >= 0) { list.push({ ID: users[i].ID, Name: users[i].Name, TreeID: users[i].Roles }); break; } } } else { list.push({ ID: users[i].ID, Name: users[i].Name, TreeID: users[i].Roles }); } } return list; } function getDepartMembers(partIds) { var list = []; for (var i = 0; partIds && i < users.length; i++) { if (hasRange) { for (var j = 0; j < partIds.length; j++) { if (users[i].TreeID.indexOf(partIds[j]) >= 0) { list.push(users[i]); break; } } } else { list.push(users[i]); } } return list; } var View = null; function SetVal() { orgDiv.IsSetVal = true; roleDiv.IsSetVal = true; userDiv.IsSetVal = true; dynamicDiv.IsSetVal = true; if (isMult) { if (orgDiv.Object) { orgDiv.Object.List.Selects(null); orgDiv.Object.List.Selects(listMember); } if (roleDiv.Object) { roleDiv.Object.List.Selects(null); roleDiv.Object.List.Selects(listMember); } if (userDiv.Object) { userDiv.Object.Selects(null); userDiv.Object.Selects(listMember); } if (realDynamic) { if (dynamicDiv.Object) { dynamicDiv.Object.Selects(null); dynamicDiv.Object.Selects(listMember); } } else { if (dynamicDiv.Object) { dynamicDiv.Object.Selects(null); dynamicDiv.Object.Selects(listDynamic); } } } else { if (orgDiv.Object) { orgDiv.Object.List.Selects(null); orgDiv.Object.List.Select(listMember[0]); } if (roleDiv.Object) { roleDiv.Object.List.Selects(null); roleDiv.Object.List.Select(listMember[0]); } if (userDiv.Object) { userDiv.Object.Selects(null); userDiv.Object.Select(listMember[0]); } if (realDynamic) { if (dynamicDiv.Object) { dynamicDiv.Object.Selects(null); dynamicDiv.Object.Select(listMember[0]); } } else { if (dynamicDiv.Object) { dynamicDiv.Object.Selects(null); dynamicDiv.Object.Select(listDynamic[0]); } } } showVal(); orgDiv.IsSetVal = false; roleDiv.IsSetVal = false; userDiv.IsSetVal = false; dynamicDiv.IsSetVal = false; } function showVal() { SelContainer.innerHTML = ""; var selectedList = new CLTop.CLList(listRange, SelContainer, null, function (Item) { Item.style.display = "inline-block"; Item.style.width = "initial"; Item.style.padding = "0 5px"; var icon = document.createElement("span"); icon.className = "FontIcon"; icon.innerHTML = Item.ItemData.Icon; Item.insertBefore(icon, Item.firstChild); var close = document.createElement("span"); close.className = "FontIcon"; close.innerHTML = ""; close.style.marginLeft = "5px"; close.style.lineHeight = "34px"; close.style.color = "#333"; Item.appendChild(close); close.onclick = function () { var className = Item.ItemData.className; if (className == "Members") { userDiv.Object.UnSelect(Item.ItemData.dataId); } if (className == "Dynamic") { dynamicDiv.Object.UnSelect(Item.ItemData.dataId); } } }); } function OnBtnCreated(divBtn) { divBtn.style.width = "100px"; if (divBtn.Btn.Name == "组织架构") { //获取部门树 var treeData = CLApp.getDepartTree(PartIds)[0]; var obj = orgDiv.Object = new CLTop.CLTreeList(orgDiv, treeData, getDepartMembers(Range.Parts), isMult); obj.List.OnSelected = function (ItemData) { if (orgDiv.IsSetVal) { return; } if (!isMult) { listMember = [ItemData.ID]; listDynamic = []; listRange = [ { ID: "Members" + ItemData.ID, Name: CLApp.getMemberNameById(ItemData.ID), className: "Members", Icon: "", dataId: ItemData.ID } ]; listRangeIds = ["Members" + ItemData.ID]; } else { if (listMember.indexOf(ItemData.ID) < 0) { listMember.push(ItemData.ID); } if (listRangeIds.indexOf("Members" + ItemData.ID) < 0) { listRangeIds.push("Members" + ItemData.ID); listRange.push({ ID: "Members" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: CLApp.getMemberNameById(ItemData.ID), className: "Members" }); } } SetVal(); } obj.List.OnLostSelected = function (ItemData) { if (orgDiv.IsSetVal) { return; } if (isMult) { if (listMember.indexOf(ItemData.ID) >= 0) { listMember.splice(listMember.indexOf(ItemData.ID), 1); } var index = listRangeIds.indexOf("Members" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } } else { listRangeIds = []; listRange = []; listMember = []; } SetVal(); } divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = orgDiv; View.style.display = "block"; } obj.List.Selects(Val.Members); } if (divBtn.Btn.Name == "角色") { var treeData = CLApp.getRoleTree(RoleIds)[0]; var obj = roleDiv.Object = new CLTop.CLTreeList(roleDiv, treeData, getRoleMembers(Range.Roles), isMult); obj.Tree.Ele.classList.add("RoleTree"); divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = roleDiv; View.style.display = "block"; } obj.List.OnSelected = function (ItemData) { if (roleDiv.IsSetVal) { return; } if (!isMult) { listMember = [ItemData.ID]; listDynamic = []; listRange = [ { ID: "Members" + ItemData.ID, Name: CLApp.getMemberNameById(ItemData.ID), className: "Members", Icon: "", dataId: ItemData.ID } ]; listRangeIds = ["Members" + ItemData.ID]; } else { if (listMember.indexOf(ItemData.ID) < 0) { listMember.push(ItemData.ID); } if (listRangeIds.indexOf("Members" + ItemData.ID) < 0) { listRangeIds.push("Members" + ItemData.ID); listRange.push({ ID: "Members" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: CLApp.getMemberNameById(ItemData.ID), className: "Members" }); } } SetVal(); } obj.List.OnLostSelected = function (ItemData) { if (roleDiv.IsSetVal) { return; } if (isMult) { if (listMember.indexOf(ItemData.ID) >= 0) { listMember.splice(listMember.indexOf(ItemData.ID), 1); } var index = listRangeIds.indexOf("Members" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } } else { listRangeIds = []; listRange = []; listMember = []; } SetVal(); } obj.List.Selects(Val.Members); } if (divBtn.Btn.Name == "成员") { var obj = userDiv.Object = new CLTop.CLList(getMembers(), userDiv, isMult); obj.OnSelected = function (ItemData) { if (userDiv.IsSetVal) { return; } if (!isMult) { listMember = [ItemData.ID]; listDynamic = []; listRange = [ { ID: "Members" + ItemData.ID, Name: CLApp.getMemberNameById(ItemData.ID), className: "Members", Icon: "", dataId: ItemData.ID } ]; listRangeIds = ["Members" + ItemData.ID]; } else { if (listMember.indexOf(ItemData.ID) < 0) { listMember.push(ItemData.ID); } if (listRangeIds.indexOf("Members" + ItemData.ID) < 0) { listRangeIds.push("Members" + ItemData.ID); listRange.push({ ID: "Members" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: CLApp.getMemberNameById(ItemData.ID), className: "Members" }); } } SetVal(); } obj.OnLostSelected = function (ItemData) { if (userDiv.IsSetVal) { return; } if (isMult) { if (listMember.indexOf(ItemData.ID) >= 0) { listMember.splice(listMember.indexOf(ItemData.ID), 1); } var index = listRangeIds.indexOf("Members" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } } else { listRangeIds = []; listRange = []; listMember = []; } SetVal(); } divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = userDiv; View.style.display = "block"; } obj.Selects(Val.Members); } if (divBtn.Btn.Name == "动态参数") { var obj = dynamicDiv.Object = new CLTop.CLList(dynamicList, dynamicDiv, isMult); obj.OnSelected = function (ItemData) { if (dynamicDiv.IsSetVal) { return; } if (!isMult) { listMember = realDynamic ? [ItemData.ID] : []; listDynamic = realDynamic ? [] : [ItemData.ID]; listRange = [ { ID: (realDynamic ? "Members" : "Dynamic") + ItemData.ID, Name: realDynamic ? CLApp.getMemberNameById(ItemData.ID) : getDynamicNameById(ItemData.ID), className: (realDynamic ? "Members" : "Dynamic"), Icon: "", dataId: ItemData.ID } ]; listRangeIds = [(realDynamic ? "Members" : "Dynamic") + ItemData.ID]; } else { if (realDynamic) { if (listMember.indexOf(ItemData.ID) < 0) { listMember.push(ItemData.ID); } } else { if (listDynamic.indexOf(ItemData.ID) < 0) { listDynamic.push(ItemData.ID); } } if (listRangeIds.indexOf((realDynamic ? "Members" : "Dynamic") + ItemData.ID) < 0) { listRangeIds.push((realDynamic ? "Members" : "Dynamic") + ItemData.ID); listRange.push({ ID: (realDynamic ? "Members" : "Dynamic") + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: realDynamic ? CLApp.getMemberNameById(ItemData.ID) : getDynamicNameById(ItemData.ID), className: (realDynamic ? "Members" : "Dynamic") }); } } SetVal(); } obj.OnLostSelected = function (ItemData) { if (dynamicDiv.IsSetVal) { return; } if (isMult) { if (realDynamic) { if (listMember.indexOf(ItemData.ID) >= 0) { listMember.splice(listMember.indexOf(ItemData.ID), 1); } } else { if (listDynamic.indexOf(ItemData.ID) >= 0) { listDynamic.splice(listDynamic.indexOf(ItemData.ID), 1); } } var index = listRangeIds.indexOf((realDynamic ? "Members" : "Dynamic") + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } } else { listRangeIds = []; listRange = []; listDynamic = []; } SetVal(); } divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = dynamicDiv; View.style.display = "block"; } obj.Selects(Val.Dynamic); } } if (!hasRange || (Range.Parts != null && Range.Parts.length != 0)) { if (Range.Parts != null && Range.Parts.Visible != false) { Btns.push({ Name: "组织架构", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); } } if (!hasRange || (Range.Roles != null && Range.Roles.length != 0)) { if (Range.Roles != null && Range.Roles.Visible != false) { Btns.push({ Name: "角色", Type: "角色", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); } } Btns.push({ Name: "成员", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); if (!hasRange || (Range.Dynamic != null && Range.Dynamic.length != 0 && dynamicList.length != 0)) { if (Range.Dynamic != null && Range.Dynamic.Visible != false) { Btns.push({ Name: "动态参数", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); } } var _CLBtnGroup = new CLBtnGroup(tableBar, Btns); _CLBtnGroup.OnSelected = function (divBtn) { divBtn.Call(); } tableBar.lastChild.className = "CLTab"; tableBar.lastChild.style.display = "inline-block"; tableBar.lastChild.style.margin = "2px 0"; tableBar.lastChild.style.overflow = "auto"; tableBar.lastChild.style.width = "100%"; for (var i = 0; i < MainDiv.childNodes.length; i++) { MainDiv.childNodes[i].style.display = "none"; } _CLBtnGroup.Select(tableBar.firstChild.firstChild, true); sInput.oninput = function () { for (var i = 0; i < MainDiv.childNodes.length; i++) { var obj = MainDiv.childNodes[i].Object; if (obj != null) { obj.Search(sInput.value); } } } if (!IsMobile()) { tableBar.style.position = "relative"; sInput.style.verticalAlign = "top"; sInput.style.marginTop = "3px"; sInput.style.position = "absolute"; sInput.style.right = "3px"; tableBar.appendChild(sInput); } if (load) { load.Stop(); } } var MemberRangeDialog = function (Range, End, load) { if (IsMobile() && !load) { load = new Loading(); CLDelay(function () { MemberRangeDialog(Range, End, load); }, 10); return; } var dlgDiv = document.createElement("div"); if (IsMobile()) { dlgDiv.style.width = "100%"; dlgDiv.style.height = "100%"; } else { dlgDiv.style.width = "654px"; dlgDiv.style.maxWidth = "100%"; dlgDiv.style.height = "575px"; } var dlg = new CLDialog(dlgDiv, !IsMobile()); var Parts = []; var Roles = []; var Members = []; var Dynamic = []; var listRange = []; var listRangeIds = []; dlg.CreateAll("成员范围", function () { Range.Parts = Parts; Range.Roles = Roles; Range.Members = Members; Range.Dynamic = Dynamic; End(Range); }); var sInput = document.createElement("input"); sInput.className = "CLSearch"; sInput.style.height = "30px"; if (IsMobile()) { sInput.style.width = "100%"; sInput.style.margin = "7px 0"; sInput.style.cssFloat = "left"; dlg.Header.style.position = "relative"; dlg.Header.appendChild(sInput); } var Body = dlg.Body; Body.className = "FrmDesignerDialog"; var SelContainer = document.createElement("div"); SelContainer.className = "SelContainer"; Body.appendChild(SelContainer); var tableBar = document.createElement("div"); tableBar.className = "tableBar"; tableBar.style.margin = "0"; Body.appendChild(tableBar); var MainDiv = document.createElement("div"); MainDiv.style.border = "solid 1px #e0e0e0"; MainDiv.style.borderTop = "none"; MainDiv.style.overflow = "hidden"; Body.appendChild(MainDiv); var orgDiv = MainDiv.cloneNode(); orgDiv.style.border = "none"; orgDiv.style.overflow = "auto"; orgDiv.style.height = "100%"; MainDiv.appendChild(orgDiv); var roleDiv = orgDiv.cloneNode(); MainDiv.appendChild(roleDiv); var userDiv = orgDiv.cloneNode(); MainDiv.appendChild(userDiv); var dynamicDiv = orgDiv.cloneNode(); MainDiv.appendChild(dynamicDiv); if (IsMobile()) { MainDiv.style.height = "calc(100% - 160px)"; } else { MainDiv.style.height = "310px"; } var departTree = CLApp.getDepartTree()[0]; var userlist = CLApp.getUserList(); var roleTree = CLApp.getRoleTree()[0]; function showRange() { SelContainer.innerHTML = ""; var selectedList = new CLTop.CLList(listRange, SelContainer, null, function (Item) { Item.style.display = "inline-block"; Item.style.width = "initial"; Item.style.padding = "0 5px"; var icon = document.createElement("span"); icon.className = "FontIcon"; icon.innerHTML = Item.ItemData.Icon; Item.insertBefore(icon, Item.firstChild); var close = document.createElement("span"); close.className = "FontIcon"; close.innerHTML = ""; close.style.marginLeft = "5px"; close.style.lineHeight = "34px"; close.style.color = "#333"; Item.appendChild(close); close.onclick = function () { var className = Item.ItemData.className; if (className == "Parts") { orgDiv.Object.UnSelect(Item.ItemData.dataId); } if (className == "Roles") { roleDiv.Object.UnSelect(Item.ItemData.dataId); } if (className == "Members") { userDiv.Object.UnSelect(Item.ItemData.dataId); } if (className == "Dynamic") { dynamicDiv.Object.UnSelect(Item.ItemData.dataId); } } }); } function setRange() { if (orgDiv.Object) { orgDiv.Object.Selects(Parts); } if (roleDiv.Object) { roleDiv.Object.Selects(Roles); } if (userDiv.Object) { userDiv.Object.List.Selects(Members); } if (dynamicDiv.Object) { dynamicDiv.Object.Selects(Dynamic); } } (function () { var List = []; for (var i = 0; i < userlist.length; i++) { List.push({ ID: userlist[i].userid, Name: userlist[i].name, TreeID: userlist[i].department }); } userlist = List; }()); var View = null; function OnBtnCreated(divBtn) { divBtn.style.width = "100px"; if (divBtn.Btn.Name == "组织架构") { var obj = orgDiv.Object = new CLTree(departTree); obj.MultiSel = true; obj.Editable = false; obj.Render(orgDiv); divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = orgDiv; View.style.display = "block"; } obj.OnSelected = function (ItemData) { if (Parts.indexOf(ItemData.ID) < 0) { Parts.push(ItemData.ID); } if (listRangeIds.indexOf("Parts" + ItemData.ID) < 0) { listRangeIds.push("Parts" + ItemData.ID); listRange.push({ ID: "Parts" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: CLApp.getDepartmentById(ItemData.ID).name, className: "Parts" }); } showRange(); } obj.OnLostSelected = function (ItemData) { var index = Parts.indexOf(ItemData.ID); if (index >= 0) { Parts.splice(index, 1); } index = listRangeIds.indexOf("Parts" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } showRange(); } obj.Selects(Range.Parts); } if (divBtn.Btn.Name == "角色") { var obj = roleDiv.Object = new CLTree(roleTree); obj.MultiSel = true; obj.Editable = false; obj.Render(roleDiv); roleDiv.lastChild.classList.add("RoleTree"); divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = roleDiv; View.style.display = "block"; } obj.OnSelected = function (ItemData) { if (Roles.indexOf(ItemData.ID) < 0) { Roles.push(ItemData.ID); } if (listRangeIds.indexOf("Roles" + ItemData.ID) < 0) { listRangeIds.push("Roles" + ItemData.ID); listRange.push({ ID: "Roles" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: CLApp.getRoleById(ItemData.ID).Name, className: "Roles" }); } showRange(); } obj.OnLostSelected = function (ItemData) { var index = Roles.indexOf(ItemData.ID); if (index >= 0) { Roles.splice(index, 1); } index = listRangeIds.indexOf("Roles" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } showRange(); } obj.Selects(Range.Roles); } if (divBtn.Btn.Name == "成员") { var obj = userDiv.Object = new CLTreeList(userDiv, departTree, userlist, true); obj.List.OnSelected = function (ItemData) { if (Members.indexOf(ItemData.ID) < 0) { Members.push(ItemData.ID); } if (listRangeIds.indexOf("Members" + ItemData.ID) < 0) { listRangeIds.push("Members" + ItemData.ID); listRange.push({ ID: "Members" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: CLApp.getMemberNameById(ItemData.ID), className: "Members" }); } showRange(); } obj.List.OnLostSelected = function (ItemData) { var index = Members.indexOf(ItemData.ID); if (index >= 0) { Members.splice(index, 1); } index = listRangeIds.indexOf("Members" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } showRange(); } obj.List.Selects(Range.Members); divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = userDiv; View.style.display = "block"; } } if (divBtn.Btn.Name == "动态参数") { var dynamicList = dynamicDiv.Object = new CLTop.CLList(g_Dynamic, dynamicDiv, true); divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = dynamicDiv; View.style.display = "block"; } dynamicList.OnSelected = function (ItemData) { if (Dynamic.indexOf(ItemData.ID) < 0) { Dynamic.push(ItemData.ID); } if (listRangeIds.indexOf("Dynamic" + ItemData.ID) < 0) { listRangeIds.push("Dynamic" + ItemData.ID); listRange.push({ ID: "Dynamic" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: getDynamicNameById(ItemData.ID), className: "Dynamic" }); } showRange(); } dynamicList.OnLostSelected = function (ItemData) { var index = Dynamic.indexOf(ItemData.ID); if (index >= 0) { Dynamic.splice(index, 1); } index = listRangeIds.indexOf("Dynamic" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } showRange(); } dynamicList.Selects(Range.Dynamic); } } var Btns = []; Btns.push({ Name: "组织架构", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); Btns.push({ Name: "角色", Type: "角色", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); Btns.push({ Name: "成员", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); Btns.push({ Name: "动态参数", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); var _CLBtnGroup = new CLBtnGroup(tableBar, Btns); _CLBtnGroup.OnSelected = function (divBtn) { divBtn.Call(); } tableBar.lastChild.className = "CLTab"; tableBar.lastChild.style.display = "inline-block"; tableBar.lastChild.style.margin = "2px 0"; tableBar.lastChild.style.width = "100%"; for (var i = 0; i < MainDiv.childNodes.length; i++) { MainDiv.childNodes[i].style.display = "none"; } _CLBtnGroup.Select(tableBar.firstChild.firstChild, true); sInput.oninput = function () { for (var i = 0; i < MainDiv.childNodes.length; i++) { var obj = MainDiv.childNodes[i].Object; if (obj != null) { obj.Search(sInput.value); } } } if (!IsMobile()) { tableBar.style.position = "relative"; sInput.style.verticalAlign = "top"; sInput.style.marginTop = "3px"; sInput.style.position = "absolute"; sInput.style.right = "3px"; tableBar.appendChild(sInput); } if (load) { load.Stop(); } } //Range: {Parts: [],Dynamic: []} var PropDepartDialog = function (Range, Val, isMult, realDynamic, End, load) { if (IsMobile() && !load) { load = new Loading(); CLDelay(function () { PropDepartDialog(Range, Val, isMult, realDynamic, End, load); }, 10); return; } if (Val == null) { Val = {}; } var dlgDiv = document.createElement("div"); if (IsMobile()) { dlgDiv.style.width = "100%"; dlgDiv.style.height = "100%"; } else { dlgDiv.style.width = "654px"; dlgDiv.style.maxWidth = "100%"; dlgDiv.style.height = "575px"; } var Parts = []; var Dynamic = []; var listRange = []; var listRangeIds = []; var dlg = new CLDialog(dlgDiv, !IsMobile()); dlg.CreateAll("部门选择框", function () { End({ Parts: Parts, Dynamic: Dynamic }); }); var sInput = document.createElement("input"); sInput.className = "CLSearch"; sInput.style.height = "30px"; if (IsMobile()) { sInput.style.width = "100%"; sInput.style.margin = "7px 0"; sInput.style.cssFloat = "left"; dlg.Header.style.position = "relative"; dlg.Header.appendChild(sInput); } else { dlg.EnableMove(); } var Body = dlg.Body; Body.className = "FrmDesignerDialog"; var SelContainer = document.createElement("div"); SelContainer.className = "SelContainer"; Body.appendChild(SelContainer); var tableBar = document.createElement("div"); tableBar.className = "tableBar"; tableBar.style.margin = "0"; Body.appendChild(tableBar); var MainDiv = document.createElement("div"); MainDiv.style.border = "solid 1px #e0e0e0"; MainDiv.style.borderTop = "none"; MainDiv.style.overflow = "hidden"; Body.appendChild(MainDiv); var orgDiv = MainDiv.cloneNode(); orgDiv.style.border = "none"; orgDiv.style.overflow = "auto"; orgDiv.style.height = "100%"; MainDiv.appendChild(orgDiv); var dynamicDiv = orgDiv.cloneNode(); MainDiv.appendChild(dynamicDiv); if (IsMobile()) { MainDiv.style.height = "calc(100% - 160px)"; } else { MainDiv.style.height = "310px"; } var PartIds; var RoleIds; var dynamicList; var hasRange = false; if (Range.Parts != null && Range.Parts.length != 0) { hasRange = true; PartIds = CLApp.extendDepartRoot(Range.Parts); } if (Range.Dynamic != null && Range.Dynamic.length != 0) { hasRange = true; } dynamicList = getDynamic(Range.Dynamic); function SetVal() { orgDiv.IsSetVal = true; dynamicDiv.IsSetVal = true; if (isMult) { if (orgDiv.Object) { orgDiv.Object.Selects(null); orgDiv.Object.Selects(Parts); } if (realDynamic) { if (dynamicDiv.Object) { dynamicDiv.Object.Selects(null); dynamicDiv.Object.Selects(Parts); } } else { if (dynamicDiv.Object) { dynamicDiv.Object.Selects(null); dynamicDiv.Object.Selects(Dynamic); } } } else { if (orgDiv.Object) { orgDiv.Object.Select(Parts[0]); } if (realDynamic) { if (dynamicDiv.Object) { dynamicDiv.Object.Select(Parts[0]); } } else { if (dynamicDiv.Object) { dynamicDiv.Object.Select(Dynamic[0]); } } } showVal(); orgDiv.IsSetVal = false; dynamicDiv.IsSetVal = false; } function getDynamic(Ids) { if (!hasRange && !realDynamic) { return g_departDynamic; } var list = []; for (var i = 0; i < g_departDynamic.length; i++) { if (Ids == null || Ids.indexOf(g_departDynamic[i].ID) >= 0 || !hasRange) { list.push(g_departDynamic[i]); } } return realDynamic ? RealDynamic(list) : list; } function showVal() { SelContainer.innerHTML = ""; var selectedList = new CLTop.CLList(listRange, SelContainer, null, function (Item) { Item.style.display = "inline-block"; Item.style.width = "initial"; Item.style.padding = "0 5px"; var icon = document.createElement("span"); icon.className = "FontIcon"; icon.innerHTML = Item.ItemData.Icon; Item.insertBefore(icon, Item.firstChild); var close = document.createElement("span"); close.className = "FontIcon"; close.innerHTML = ""; close.style.marginLeft = "5px"; close.style.lineHeight = "34px"; close.style.color = "#333"; Item.appendChild(close); close.onclick = function () { var className = Item.ItemData.className; if (className == "Parts") { orgDiv.Object.UnSelect(Item.ItemData.dataId); } if (className == "Dynamic") { dynamicDiv.Object.UnSelect(Item.ItemData.dataId); } } }); } var View = null; function OnBtnCreated(divBtn) { divBtn.style.width = "100px"; if (divBtn.Btn.Name == "组织架构") { var departTree; if (hasRange) { departTree = CLApp.getDepartTree(PartIds)[0]; } else { departTree = CLApp.getDepartTree()[0]; } var obj = orgDiv.Object = new CLTree(departTree); obj.MultiSel = isMult; obj.Editable = false; if (hasRange) { obj.OnItemCreated = function (Item, ItemData) { if (Range.Parts.indexOf(ItemData.ID) < 0) { Item.disabled = true; Item.firstChild.lastChild.style.display = "none"; } } } obj.Render(orgDiv); divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = orgDiv; View.style.display = "block"; } obj.OnSelected = function (ItemData) { if (dynamicDiv.IsSetVal) { return; } if (Parts.indexOf(ItemData.ID) < 0) { Parts.push(ItemData.ID); } if (!isMult) { Dynamic = []; } if (!isMult) { listRangeIds = []; listRange = []; } if (listRangeIds.indexOf("Parts" + ItemData.ID) < 0) { listRangeIds.push("Parts" + ItemData.ID); listRange.push({ ID: "Parts" + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: CLApp.getDepartmentById(ItemData.ID).name, className: "Parts" }); } SetVal(); } obj.OnLostSelected = function (ItemData) { if (dynamicDiv.IsSetVal) { return; } var index = Parts.indexOf(ItemData.ID); if (index >= 0) { Parts.splice(index, 1); } index = listRangeIds.indexOf("Parts" + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } SetVal(); } obj.Selects(Val.Parts); } if (divBtn.Btn.Name == "动态参数") { var obj = dynamicDiv.Object = new CLTop.CLList(dynamicList, dynamicDiv, isMult); obj.OnSelected = function (ItemData) { if (dynamicDiv.IsSetVal) { return; } if (!isMult) { Parts = realDynamic ? [ItemData.ID] : []; Dynamic = realDynamic ? [] : [ItemData.ID]; listRange = [ { ID: (realDynamic ? "Parts" : "Dynamic") + ItemData.ID, Name: realDynamic ? CLApp.getDepartmentNameById(ItemData.ID) : getDepartDynamicNameById(ItemData.ID), className: (realDynamic ? "Parts" : "Dynamic"), Icon: "", dataId: ItemData.ID } ]; listRangeIds = [(realDynamic ? "Parts" : "Dynamic") + ItemData.ID]; } else { if (realDynamic) { if (Parts.indexOf(ItemData.ID) < 0) { Parts.push(ItemData.ID); } if (!isMult) { Dynamic = []; } } else { if (Dynamic.indexOf(ItemData.ID) < 0) { Dynamic.push(ItemData.ID); } if (!isMult) { Parts = []; } } if (listRangeIds.indexOf((realDynamic ? "Parts" : "Dynamic") + ItemData.ID) < 0) { listRangeIds.push((realDynamic ? "Parts" : "Dynamic") + ItemData.ID); listRange.push({ ID: (realDynamic ? "Parts" : "Dynamic") + ItemData.ID, dataId: ItemData.ID, Icon: "", Name: realDynamic ? CLApp.getDepartmentNameById(ItemData.ID) : getDepartDynamicNameById(ItemData.ID), className: (realDynamic ? "Parts" : "Dynamic") }); } } SetVal(); } obj.OnLostSelected = function (ItemData) { if (dynamicDiv.IsSetVal) { return; } if (realDynamic) { if (Parts.indexOf(ItemData.ID) >= 0) { Parts.splice(Parts.indexOf(ItemData.ID), 1); } } else { if (Dynamic.indexOf(ItemData.ID) >= 0) { Dynamic.splice(Dynamic.indexOf(ItemData.ID), 1); } } var index = listRangeIds.indexOf((realDynamic ? "Parts" : "Dynamic") + ItemData.ID) if (index >= 0) { listRangeIds.splice(index, 1); listRange.splice(index, 1); } SetVal(); } divBtn.Call = function () { if (View != null) { View.style.display = "none"; } View = dynamicDiv; View.style.display = "block"; } if (isMult && !realDynamic) { obj.Selects(Val.Dynamic); } else if (!realDynamic) { obj.Select(Val.Dynamic); } } } var Btns = []; if (!hasRange || (Range.Parts != null && Range.Parts.length != 0)) { Btns.push({ Name: "组织架构", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); } if (!hasRange || (Range.Dynamic != null && Range.Dynamic.length != 0)) { Btns.push({ Name: "动态参数", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); } var _CLBtnGroup = new CLBtnGroup(tableBar, Btns); _CLBtnGroup.OnSelected = function (divBtn) { divBtn.Call(); } tableBar.lastChild.className = "CLTab"; tableBar.lastChild.style.display = "inline-block"; tableBar.lastChild.style.margin = "2px 0"; tableBar.lastChild.style.width = "100%"; for (var i = 0; i < MainDiv.childNodes.length; i++) { MainDiv.childNodes[i].style.display = "none"; } _CLBtnGroup.Select(tableBar.firstChild.firstChild, true); sInput.oninput = function () { for (var i = 0; i < MainDiv.childNodes.length; i++) { var obj = MainDiv.childNodes[i].Object; if (obj != null) { obj.Search(sInput.value); } } } if (!IsMobile()) { tableBar.style.position = "relative"; sInput.style.verticalAlign = "top"; sInput.style.marginTop = "3px"; sInput.style.position = "absolute"; sInput.style.right = "3px"; tableBar.appendChild(sInput); } if (load) { load.Stop(); } } var RolesSelector = function (Roles, event, End) { var Menu = { "style": { "max-height": "250px", }, "Items": [] }; var _CLMenu = new CLMenu(Menu); var Div = _CLMenu.Div; var treeData = CLApp.getRoleTree()[0]; var roleTree = new CLTree(treeData); roleTree.MultiSel = true; roleTree.Editable = false; roleTree.Render(Div); var Vals = []; roleTree.OnSelected = function (ItemData) { if (Vals.indexOf(ItemData.ID) < 0) { Vals.push(ItemData.ID); } } roleTree.OnLostSelected = function (ItemData) { if (Vals.indexOf(ItemData.ID) >= 0) { Vals.splice(Vals.indexOf(ItemData.ID), 1); } } roleTree.Selects(Roles); var close = _CLMenu.Close; _CLMenu.Close = function () { End(Vals); close.apply(_CLMenu, arguments); } Div.style.height = ""; _CLMenu.Reset(event); } var notNull = function (Label) { var span = document.createElement("span"); span.style.cssText = "color:#d84636;padding:0 5px"; span.innerHTML = "*"; Label.appendChild(span); } var ScanImg = (function () { return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAVCAYAAABG1c6oAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBMTgN5+ASXIHrcBcGYBiewhi8hgkEQcgIE2EhOogRYo7YIs4IF5mOBCJhSDSSgKQg6YgUUSLFyHKkAqlCapFdSCPyLXIUOY1cQPqQ28ggMor8irxHMZSBslED1AJ1QLmoHxqKxqBz0XQ0D12AlqJr0Rq0Hj2AtqKn0UvodXQAfYqOY4DRMQ5mjNlhXIyHRWCJWBomxxZj5Vg1Vo81Yx1YN3YVG8CeYe8IJAKLgBPsCF6EEMJsgpCQR1hMWEOoJewjtBK6CFcJg4Qxwicik6hPtCV6EvnEeGI6sZBYRqwm7iEeIZ4lXicOE1+TSCQOyZLkTgohJZAySQtJa0jbSC2kU6Q+0hBpnEwm65Btyd7kCLKArCCXkbeQD5BPkvvJw+S3FDrFiOJMCaIkUqSUEko1ZT/lBKWfMkKZoKpRzame1AiqiDqfWkltoHZQL1OHqRM0dZolzZsWQ8ukLaPV0JppZ2n3aC/pdLoJ3YMeRZfQl9Jr6Afp5+mD9HcMDYYNg8dIYigZaxl7GacYtxkvmUymBdOXmchUMNcyG5lnmA+Yb1VYKvYqfBWRyhKVOpVWlX6V56pUVXNVP9V5qgtUq1UPq15WfaZGVbNQ46kJ1Bar1akdVbupNq7OUndSj1DPUV+jvl/9gvpjDbKGhUaghkijVGO3xhmNIRbGMmXxWELWclYD6yxrmE1iW7L57Ex2Bfsbdi97TFNDc6pmrGaRZp3mcc0BDsax4PA52ZxKziHODc57LQMtPy2x1mqtZq1+rTfaetq+2mLtcu0W7eva73VwnUCdLJ31Om0693UJuja6UbqFutt1z+o+02PreekJ9cr1Dund0Uf1bfSj9Rfq79bv0R83MDQINpAZbDE4Y/DMkGPoa5hpuNHwhOGoEctoupHEaKPRSaMnuCbuh2fjNXgXPmasbxxirDTeZdxrPGFiaTLbpMSkxeS+Kc2Ua5pmutG003TMzMgs3KzYrMnsjjnVnGueYb7ZvNv8jYWlRZzFSos2i8eW2pZ8ywWWTZb3rJhWPlZ5VvVW16xJ1lzrLOtt1ldsUBtXmwybOpvLtqitm63Edptt3xTiFI8p0in1U27aMez87ArsmuwG7Tn2YfYl9m32zx3MHBId1jt0O3xydHXMdmxwvOuk4TTDqcSpw+lXZxtnoXOd8zUXpkuQyxKXdpcXU22niqdun3rLleUa7rrStdP1o5u7m9yt2W3U3cw9xX2r+00umxvJXcM970H08PdY4nHM452nm6fC85DnL152Xlle+70eT7OcJp7WMG3I28Rb4L3Le2A6Pj1l+s7pAz7GPgKfep+Hvqa+It89viN+1n6Zfgf8nvs7+sv9j/i/4XnyFvFOBWABwQHlAb2BGoGzA2sDHwSZBKUHNQWNBbsGLww+FUIMCQ1ZH3KTb8AX8hv5YzPcZyya0RXKCJ0VWhv6MMwmTB7WEY6GzwjfEH5vpvlM6cy2CIjgR2yIuB9pGZkX+X0UKSoyqi7qUbRTdHF09yzWrORZ+2e9jvGPqYy5O9tqtnJ2Z6xqbFJsY+ybuIC4qriBeIf4RfGXEnQTJAntieTE2MQ9ieNzAudsmjOc5JpUlnRjruXcorkX5unOy553PFk1WZB8OIWYEpeyP+WDIEJQLxhP5aduTR0T8oSbhU9FvqKNolGxt7hKPJLmnVaV9jjdO31D+miGT0Z1xjMJT1IreZEZkrkj801WRNberM/ZcdktOZSclJyjUg1plrQr1zC3KLdPZisrkw3keeZtyhuTh8r35CP5c/PbFWyFTNGjtFKuUA4WTC+oK3hbGFt4uEi9SFrUM99m/ur5IwuCFny9kLBQuLCz2Lh4WfHgIr9FuxYji1MXdy4xXVK6ZHhp8NJ9y2jLspb9UOJYUlXyannc8o5Sg9KlpUMrglc0lamUycturvRauWMVYZVkVe9ql9VbVn8qF5VfrHCsqK74sEa45uJXTl/VfPV5bdra3kq3yu3rSOuk626s91m/r0q9akHV0IbwDa0b8Y3lG19tSt50oXpq9Y7NtM3KzQM1YTXtW8y2rNvyoTaj9nqdf13LVv2tq7e+2Sba1r/dd3vzDoMdFTve75TsvLUreFdrvUV99W7S7oLdjxpiG7q/5n7duEd3T8Wej3ulewf2Re/ranRvbNyvv7+yCW1SNo0eSDpw5ZuAb9qb7Zp3tXBaKg7CQeXBJ9+mfHvjUOihzsPcw83fmX+39QjrSHkr0jq/dawto22gPaG97+iMo50dXh1Hvrf/fu8x42N1xzWPV56gnSg98fnkgpPjp2Snnp1OPz3Umdx590z8mWtdUV29Z0PPnj8XdO5Mt1/3yfPe549d8Lxw9CL3Ytslt0utPa49R35w/eFIr1tv62X3y+1XPK509E3rO9Hv03/6asDVc9f41y5dn3m978bsG7duJt0cuCW69fh29u0XdwruTNxdeo94r/y+2v3qB/oP6n+0/rFlwG3g+GDAYM/DWQ/vDgmHnv6U/9OH4dJHzEfVI0YjjY+dHx8bDRq98mTOk+GnsqcTz8p+Vv9563Or59/94vtLz1j82PAL+YvPv655qfNy76uprzrHI8cfvM55PfGm/K3O233vuO+638e9H5ko/ED+UPPR+mPHp9BP9z7nfP78L/eE8/sl0p8zAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAANRSURBVHjanJS9i11VFMV/a+9zP96MEU1MNAFNVBAsFAUjKmppIfb5DwQLsbARsZ3CziLa2JtCG61sbAQVA45gkxgx0UJIQiaaGWfmvXvvOdvi3vcyVgY3bO7hcs46e6+z1tbLP37N+WtXn65ynCXKC5ixjFIKa03zceX++l4plCG/G8OwgYkDmwjYrNrmTYxv09Z88ZS6fjMQZjoffb+LqAERcX9f0oVUGVgQwZXo8iWVchOUgR73Rjme7/bn37Rrs1fSr1s33kkR+Hr7nkrZyPMCGiuQwFxI41rJzoWnc+QBJCKCOiXa9fqNrT9vfRTd8HaqojyCGXnRf6+IFdgqYkoEEWNOayEGGbtD/q72RJeHUwYaRi6iDiCWgBFQAh3AgwkwythBW0PllIgWAokurfZreSQIQJ4QkDH2shF5rEyexm+TIPm/L4VIRNSS2OkWjQQzr/B2BqmCCHIwtQeEUNPc5qLkZUfVRE1rUdvlIYIXH3z4t2dPnMTbNbI5lDIBTWDLtpc8BoCRKFQqf4SBu19JStWZyvxMJ+f60FPcsVhy9l8hAkPKl611SSJp0OlIduqHG1fbJFnjHhETmZCAaoLvgTz965ZXFlDGwohFLvmnFGX4kL356dn0uoX/F7kUrGm+SFbZq3nQSZVyGHCkJWYBWphcM1bVTxXPVxVGCJC5X5d0MZl8J3v+xZp2O7qeyPnOy5qc0jQN+7kckiJb6frPKOVWiXgukt/pa4wqcMdnDdn0eOm77TIMX6bc9w/IjJjPj8NoWsUBqY4yp88ZSVRmRCmoqqCp2SdgyPdZzgR+PMmsGxUwfUf9Ihkg3I2+67hntkZVV2zN57g0ugTwAKQ+JBALG4V00HMgTeafxoyZ8+iRY9w9W6MT4E6UGNseDywfUgnhhJDRHZgCS1sQEbgZJYJ+GEbRR6zmB6VAiWFip7Li/nPJA1ZVLyml1Wa4PcoigmRGMmcUiVYphBGvRQmycVHHvvr8sflifzOGvI7Z70Tcuq09nVDyDZV4/6HDR9hezN+6urP9QeN+LUad9sB69MMRT77X3jV7xu5t6ktNO3tykD4FDmM6henolIciWCsEV/b+4ma/39XBfuT8N2Nmct7Nrk/qtn3iaJpd+GcAzaW1vJtw1AkAAAAASUVORK5CYII="; })(); function LinkageBox(Box) { var Data = Box.dataCtrl.Data; if (Data.Linkage == null || (Data.DefType != "数据联动" && Data.SourceType != "数据联动" && Data.DefType != "数据源联动" && Data.SourceType != "数据源联动")) { return null; } var ID = Data.Linkage.CurFieldID; var retBox = FrmDesigner.getElementById(ID, Box); return retBox; } function GetWheres(Box, FormID) { if (Box == null) { return null; } var Data = Box.dataCtrl.Data; var Linkage = Data.Linkage; if (Linkage == null) { return null; } if (FormID == null) { FormID = Linkage.FormID; } if (FormID != Linkage.FormID) { return null; } var linkageBox = LinkageBox(Box); if (linkageBox == null) { return null; } var Wheres = [ ] if (Data.ParentID == null) { var Value = linkageBox.Value; Wheres.push({ UnionFieldID: Linkage.UnionFieldID1, Value: Value }); } else { var Value = linkageBox.Value; Wheres.push({ UnionFieldID: Linkage.UnionFieldID1, Value: Value }); } var preWheres = GetWheres(LinkageBox(Box), FormID); if (preWheres != null) { Wheres = Wheres.concat(preWheres); } return Wheres; } function GetIconByUrl(Url) { if (!Url) { return null; } var Ext = Url.substr(Url.lastIndexOf(".") + 1); return CLPreView.GetIcon(Ext); } function FindRelevantTable(Controls) { var TableIDs = []; for (var i = 0; i < Controls.length ; i++) { if (FrmCtrls[Controls[i].Name].FindRelevantTable != null) { var IDs = FrmCtrls[Controls[i].Name].FindRelevantTable(Controls[i].Data); for (var j = 0; j < IDs.length; j++) { if (TableIDs.indexOf(IDs[j]) < 0) { TableIDs.push(IDs[j]); } } } } return TableIDs; } function CalcRulesIDs(Rules) { var IDs = []; for (var i = 0; i < Rules.length; i++) { if (Rules[i].Val != null && Rules[i].Val.IDs != null) { for (var j = 0; j < Rules[i].Val.IDs.length; j++) { if (IDs.indexOf(Rules[i].Val.IDs[j]) < 0) { IDs.push(Rules[i].Val.IDs[j]); } } } if (Rules[i].Val != null && Rules[i].Val.SerialField != null) { if (IDs.indexOf(Rules[i].Val.SerialField) < 0) { IDs.push(Rules[i].Val.SerialField); } } if (Rules[i].Val != null && Rules[i].Val.ID != null) { if (IDs.indexOf(Rules[i].Val.ID) < 0) { IDs.push(Rules[i].Val.ID); } } } return IDs; } function Mapped(ControlBox) { var Designer = FrmDesigner.GetInstance(ControlBox); var dataForm = Designer.dataForm; var MappingInfo = dataForm.MappingInfo; if (!MappingInfo) { return null; } var formId; if (!ControlBox.dataCtrl.Data.ParentID) { formId = MappingInfo.FormID; mappedId = MappingInfo[ControlBox.dataCtrl.Data.ID]; } else { var Info = MappingInfo[ControlBox.dataCtrl.Data.ParentID]; formId = Info == null ? null : Info.FormID; mappedId = Info == null ? null : Info[ControlBox.dataCtrl.Data.ID]; } if (!mappedId) { return null; } var MappedInfo = CLClone(CLApp.getFieldInfo(mappedId)); MappedInfo.FormID = formId; if (MappedInfo.className == "流水号") { var UnMapped = Designer.UnMapped; if (!UnMapped) { Designer.UnMapped = UnMapped = {}; Designer.MappedInfo = {}; for (var key in MappingInfo) { if (key == "FormID") { continue; } if (typeof MappingInfo[key] == "string") { UnMapped[MappingInfo[key]] = key; Designer.MappedInfo[key] = MappingInfo[key]; } else { var subInfo = MappingInfo[key]; for (var subkey in subInfo) { if (subkey == "FormID") { continue; } UnMapped[subInfo[subkey]] = subkey; Designer.MappedInfo[subkey] = subInfo[subkey]; } } } } var IDs = CalcRulesIDs(MappedInfo.Rules); MappedInfo.RulesIDs = IDs; var UnMappedIDs = []; for (var i = 0; i < IDs.length; i++) { if (UnMapped[IDs[i]]) { UnMappedIDs.push(UnMapped[IDs[i]]); } } MappedInfo.UnMappedRulesIDs = UnMappedIDs; } return MappedInfo; } function CalcRules(ControlBox) { var Designer = FrmDesigner.GetInstance(ControlBox); var dataCtrl = ControlBox.dataCtrl; var Data = dataCtrl.Data; var Info = Mapped(ControlBox); var enableUpdate = Data.enableUpdate; var IDs = []; if (!!Info) { IDs = Info.UnMappedRulesIDs; enableUpdate = Info.enableUpdate; } else { if (dataCtrl.Name != "流水号") { return; } IDs = CalcRulesIDs(Data.Rules); } for (var i = 0; i < IDs.length; i++) { onEvent(IDs[i]); } var timer = null; function remoteCalcVal() { if (timer) { clearTimeout(timer); timer = null; } timer = setTimeout(function () { clearTimeout(timer); timer = null; func(); }); function func() { var PageData = Designer.GetBeforeChange(); if (!enableUpdate && ControlBox.Initialized) { return; } var formData = {}; if (PageData != null) { formData.ID = dataCtrl.Data.ParentID == null ? PageData.ID : ControlBox.Parent.ID == null ? CLMakeId() : ControlBox.Parent.ID; } else { formData.ID = CLMakeId(); } formData.FormID = !!Info ? Info.FormID : Designer.getData().ID; for (var i = 0; i < IDs.length; i++) { var Ele = FrmDesigner.getElementById(IDs[i], ControlBox); formData["DataField_" + (!!Info ? Designer.MappedInfo[IDs[i]] : IDs[i])] = Ele.Value; } var url = "/" + CLCorpId() + "/api/Frm.chx?Function=HttpCalcSerialNumber&Data=" + JSON.stringify(formData); HttpPost(url, function (Json) { ControlBox.Value = Json.data; }, {}, false); } } function onEvent(ID) { var Ele = FrmDesigner.getElementById(ID, ControlBox); if (Ele != null) { var fChanged = function (Box) { if (!ControlBox.isConnected) { return; } if (Box == null || Box.dataCtrl.Data.ID == ID || Box.Deleting) { remoteCalcVal(); } } Ele.Changed.push(fChanged); } else { var msg = "不好了,被引用的控件找不到了,被引用控件:" + FrmDesigner.getCtrlNameById(ControlBox, ID) + ",当前控件:【" + Data.Name + "】"; CLShowMsg(msg); } } remoteCalcVal(); } window.FrmCoderEditor = function (dataCtrl, Val, divContext, End, sHeader) { var self = this; self.divContext = divContext; self.dataCtrl = dataCtrl; var dlgDiv = document.createElement("div"); dlgDiv.style.width = "850px"; dlgDiv.style.height = "585px"; var dlg = new CLDialog(dlgDiv); dlg.CreateAll("公式编辑器", function (Val) { End(self.CodeEditor.getValue()); }); var Header = dlg.Header; var Body = dlg.Body; dlg.EnableMove(Header); Body.className = "FrmCoderEditor"; Header.ondblclick = function () { dlg.MaximizeOrReset(); self.CodeEditor.editor.setSize('auto', '100%'); } var Box = document.createElement("div"); Box.style.height = "calc(100% - 260px)"; Box.style.padding = "0 10px"; Box.style.border = "solid 1px #e0e0e0"; Body.appendChild(Box); if (dataCtrl.Name != "子表单" && dataCtrl.Name != "分割线" && dataCtrl.Name != "选项卡" && dataCtrl.Name != "表格控件") { var Box_Header = document.createElement("div"); if (typeof (sHeader) != "undefined") { Box_Header.innerHTML = sHeader; } else { Box_Header.innerHTML = dataCtrl.Data.Name + " = "; } Box_Header.style.lineHeight = "36px"; Box_Header.style.height = "36px"; Box.style.position = "relative"; Box.appendChild(Box_Header); } var editorBox = document.createElement("div"); editorBox.style.height = "calc(100% - 36px)"; Box.appendChild(editorBox); var codeEditor = self.CodeEditor = new CLCodeEditor(editorBox, "javascript"); var globalScope = self.CodeEditor.getGlobalScope(); FrmCoderEditor.Scope(dataCtrl, globalScope); codeEditor.testMark = function (Mark) { var ID = Mark.FieldData.ID; var FormID = Mark.FieldData.FormID; if (ID == "提交按钮" || ID == "摄像头") { return true; } if (Mark.FieldData.className == "角色") { for (var i = 0; i < g_RoleList.length; i++) { if (g_RoleList[i].ID == Mark.FieldData.ID) { return true; } } } else if (FormID != null) { var Form = CLApp.getFormById(FormID); var Fields = Form.Fields; for (var i = 0; i < Fields.length ; i++) { if (Fields[i].ID == ID) { Mark.FieldData.Name = Form.Name + "●" + Fields[i].Name; Mark.FieldData.FormName = Form.Name; Mark.FieldData.FieldName = Fields[i].Name; return true; } } } else { var Fields = FrmDesigner.getData(divContext).Controls; for (var i = 0; i < Fields.length ; i++) { if (Fields[i].Data.ID == ID) { Mark.FieldData.Name = Fields[i].Data.Name; return true; } if (Fields[i].Name == "子表单") { for (var j = 0; j < Fields[i].Data.Field.length; j++) { if (Fields[i].Data.Field[j].Data.ID == ID) { Mark.FieldData.Name = Fields[i].Data.Name + "●" + Fields[i].Data.Field[j].Data.Name; return true; } } } } } } codeEditor.replacedWith = function (className, FieldData) { if (FieldData.className == "摄像头") { return "FrmCtrls.ControlCamera()"; } else if (FieldData.className == "角色") { return "(\"" + FieldData.ID + "\")"; } else { return "__Ctrl__(\"" + FieldData.ID + "\")"; } } codeEditor.MarkerProps = function (mark) { return self.MarkerProps(mark); } codeEditor.setValue(Val); dlg.onsizeChanged = function () { codeEditor.editor.setSize('auto', '100%'); } var Row = document.createElement("div"); Row.style.marginTop = "10px"; var TableInfo = document.createElement("div"); TableInfo.style.display = "inline-block"; TableInfo.style.verticalAlign = "top"; TableInfo.style.width = "270px"; var label = document.createElement("div"); label.innerHTML = "变量"; label.style.color = "#91A1B7"; label.style.height = "18px"; label.style.lineHeight = "18px"; label.style.marginBottom = "5px"; TableInfo.appendChild(label); Row.appendChild(TableInfo); Body.appendChild(Row); (function () { var InfoHeader = document.createElement("div"); InfoHeader.style.lineHeight = "36px"; InfoHeader.style.height = "36px"; InfoHeader.style.border = "1px solid #e0e0e0"; TableInfo.appendChild(InfoHeader); function OnBtnCreated(divBtn) { divBtn.style.width = "50%"; divBtn.style.fontSize = "10px"; } var Btns = []; Btns.push({ Name: "当前表单字段", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); Btns.push({ Name: "角色信息", IsSel: false, Width: "100%", OnBtnCreated: OnBtnCreated }); var InfoBody = null; InfoBody = document.createElement("div"); InfoBody.style.height = "190px"; InfoBody.style.border = "1px solid #e0e0e0"; InfoBody.style.borderTop = "none"; TableInfo.appendChild(InfoBody); var _CLBtnGroup = new CLBtnGroup(InfoHeader, Btns); _CLBtnGroup.OnSelected = function (divBtn) { if (divBtn.Btn.Name == "当前表单字段") { self.CurrentTableInfo(InfoBody); } if (divBtn.Btn.Name == "角色信息") { self.RolesInfo(InfoBody); } } InfoHeader.lastChild.className = "CLTab"; InfoHeader.lastChild.style.display = "inline-block"; InfoHeader.lastChild.style.margin = "2px 0"; InfoHeader.lastChild.style.width = "100%"; _CLBtnGroup.Select(InfoHeader.firstChild.firstChild, true); var FunctionHelper = document.createElement("div"); FunctionHelper.style.height = "250px"; FunctionHelper.style.display = "inline-block"; FunctionHelper.style.verticalAlign = "top"; FunctionHelper.style.marginLeft = "10px"; FunctionHelper.style.width = "calc(100% - 280px)"; label = label.cloneNode(); label.innerHTML = "函数"; label.style.width = "530px"; FunctionHelper.appendChild(label); Row.appendChild(FunctionHelper); var FunBox = document.createElement("div"); FunBox.style.border = "1px solid #e0e0e0"; FunBox.style.width = "150px"; FunBox.style.height = "227px"; FunBox.style.display = "inline-block"; FunBox.style.position = "relative"; FunctionHelper.appendChild(FunBox); var Search = document.createElement("div"); Search.style.position = "relative"; Search.style.borderBottom = "1px solid #e0e0e0"; var input = document.createElement("input"); input.className = "ControlSearch"; input.setAttribute("placeholder", "搜索函数"); input.style.outline = "none"; input.style.border = "none"; input.style.width = "100%"; input.style.height = "36px"; input.style.padding = "0 30px 0 10px"; Search.appendChild(input); var icon = document.createElement("span"); icon.style.position = "absolute"; icon.style.right = "10px"; icon.style.lineHeight = "36px"; icon.style.fontWeight = "900"; icon.style.color = "#757575"; icon.style.fontFamily = "CLFont"; icon.innerHTML = ""; Search.appendChild(icon); FunBox.appendChild(Search); var listFun = document.createElement("div"); listFun.style.height = "188px"; listFun.style.overflow = "auto"; FunBox.appendChild(listFun); var Helper = null; var dataTree = { ID: "所有", Name: "所有", SubNode: [] }; for (var i = 0; i < FrmCoderEditor.AllFunc.length ; i++) { var Ele = { ID: i, Name: FrmCoderEditor.AllFunc[i].Type, SubNode: FrmCoderEditor.AllFunc[i].Functions }; dataTree.SubNode.push(Ele); } var tree = new CLTree(dataTree); tree.Editable = false; tree.OnItemCreated = function (Item, ItemData) { if (ItemData.ID == "所有") { Item.firstChild.style.display = "none"; } else { Item.firstChild.style.paddingLeft = parseInt(Item.firstChild.style.paddingLeft) - 10 + "px"; } if (ItemData.SubNode == null) { Item.onmouseenter = function () { Helper.innerHTML = ""; var FunName = document.createElement("div"); FunName.style.borderBottom = "1px solid #e0e0e0"; FunName.style.lineHeight = "36px"; FunName.style.padding = "0 10px"; FunName.style.height = "36px"; FunName.innerHTML = ItemData.Name; Helper.appendChild(FunName); var Info = document.createElement("div"); Info.style.lineHeight = "20px"; Info.style.padding = "2px 10px"; Info.style.color = "#5E6D82"; Info.innerHTML = FrmCoderEditor.GetNoteByName(ItemData.Name); Helper.appendChild(Info); var A = document.createElement("div"); A.style.margin = "15px 0 0 10px"; A.style.cursor = "pointer"; A.style.display = "inline-block"; A.style.color = "#248AF9"; A.style.textDecoration = "underline"; A.innerHTML = "了解详情"; A.onclick = function () { } Helper.appendChild(A); } Item.firstChild.onclick = function (e) { self.CodeEditor.pushText(ItemData.Name); e.stopPropagation(); } } else { //Item.firstChild.onmousedown = function (e) { // if (Item.IsOpen()) { // Item.Close(); // } else { // Item.Open(); // } // e.stopPropagation(); //} } } tree.Render(listFun); Helper = document.createElement("div"); Helper.style.width = "calc(100% - 160px)"; Helper.style.height = "227px"; Helper.style.display = "inline-block"; Helper.style.cssFloat = "right"; Helper.style.color = "#5E6D82"; Helper.style.overflow = "hidden"; Helper.style.border = "1px solid #e0e0e0"; var ul = document.createElement("ul"); var li = document.createElement("li"); li.style.lineHeight = "30px"; li.style.marginLeft = "25px"; li.style.listStyleType = "disc"; li.innerHTML = "请从左侧面板选择字段名和函数,或输入函数"; ul.appendChild(li); Helper.appendChild(ul); li = li.cloneNode(); li.innerHTML = "公式编辑举例:SUM(基本工资,加班工资)"; ul.appendChild(li); Helper.appendChild(ul); var defLink = document.createElement("div"); defLink.style.paddingTop = "5px"; defLink.style.lineHeight = "30px"; defLink.style.padding = "0 25px"; var A = document.createElement("div"); A.style.textDecoration = "underline"; A.style.cursor = "pointer"; A.style.color = "#248AF9"; A.innerHTML = "观看公式入门视频>"; A.onclick = function () { } defLink.appendChild(A); A = A.cloneNode(); A.innerHTML = "观看公式进阶视频>"; A.onclick = function () { } defLink.appendChild(A); A = A.cloneNode(); A.innerHTML = "查看所有公式的帮助文档>"; A.onclick = function () { } defLink.appendChild(A); Helper.appendChild(defLink); FunctionHelper.appendChild(Helper); }()) } var fn = FrmCoderEditor.prototype; fn.CodeEditor = null; fn.dataCtrl = null; fn.divContext = null; fn.CurrentTableInfo = function (Div) { var self = this; var Fields = FrmDesigner.getData(self.divContext).Controls; var Data = self.dataCtrl.Data; if (Data == null) { Data = {}; } var jList = []; var editor = self.CodeEditor.editor; var BaseControl = [ "单行文本", "多行文本", "数字", "时间日期", "单选按钮组", "复选框组", "下拉框", "下拉复选框", "子表单", "附件上传", "关联数据", "手写签名", "流水号", "成员单选", "成员多选", "部门单选", "部门多选", ] var className = self.dataCtrl.Name; var Prop = FrmCtrls.CtrlsProps; var helpSelf = document.createElement("div"); for (var i = 0; i < Fields.length; i++) { if (Fields[i].Data.ID != Data.ID) { if (BaseControl.indexOf(Fields[i].Name) >= 0) { jList.push({ ID: Fields[i].Data.ID, Name: Fields[i].Data.Name, className: Fields[i].Name }); var className = Fields[i].Name; if (className == "数字") { helpSelf.Value = 0; } else if (className == "复选框组" || className == "下拉复选框" || className == "子表单" || className == "附件上传" || className == "成员多选" || className == "部门多选" ) { helpSelf.Value = []; } else if (className == "单行文本" || className == "多行文本" || className == "时间日期" || className == "单选按钮组" || className == "下拉框" || className == "流水号" || className == "成员单选" || className == "部门多选" ) { helpSelf.Value = ""; } else { helpSelf.Value = {}; } helpSelf.OnInitializeds = []; if (Fields[i].Name == "下拉框" || Fields[i].Name == "下拉复选框") { helpSelf.Items = []; helpSelf.Select = new CLSelect(); } if (Fields[i].Name == "关联数据") { helpSelf.dataItem = {}; } if (Fields[i].Name == "手写签名") { helpSelf.ToUrl = function () { } } if (Fields[i].Name == "选项卡") { helpSelf.Show = function () { } helpSelf.Hide = function () { } helpSelf.Select = function () { } } helpSelf.Disabled = false; helpSelf.DivNote = helpSelf; } } if (Fields[i].Name == "子表单") { for (var j = 0; j < Fields[i].Data.Field.length; j++) { if (BaseControl.indexOf(Fields[i].Data.Field[j].Name) >= 0 && Fields[i].Data.Field[j].Data.ID != Data.ID) { jList.push({ ID: Fields[i].Data.Field[j].Data.ID, Name: (Fields[i].Data.ID != Data.ID ? Fields[i].Data.Name : "Self") + "●" + Fields[i].Data.Field[j].Data.Name, className: Fields[i].Data.Field[j].Name, ParentID: Fields[i].Data.ID }); } } } } if (className == "单行文本" && Data.ScanAble == true) { jList.push({ ID: "摄像头", Name: "摄像头", className: "摄像头", }); } jList.push({ ID: "提交按钮", Name: "提交时间", className: "提交按钮", }); Div.innerHTML = ""; var List = new CLList(jList, Div, null, function (Item, ItemData) { Item.style.fontSize = "12px"; Item.style.paddingLeft = "15px"; Item.title = ItemData.Name; Item.firstChild.style.maxWidth = "calc(100% - 45px)"; Item.firstChild.style.display = "inline-block"; Item.style.position = "relative"; Item.firstChild.classList.add("ellipsis"); Item.style.height = "26px"; var span = document.createElement("span"); span.style.position = "absolute"; span.style.right = "0"; span.style.padding = "0 8px"; if (ItemData.ParentID != null && ItemData.ParentID != Data.ParentID) { span.innerHTML = "数组"; span.style.color = " #8C5FFB"; } else { span.innerHTML = Prop[ItemData.className].Name; span.style.color = Prop[ItemData.className].Color; } Item.appendChild(span); Item.onclick = function () { var Mark = { className: "FormDataField", FieldData: ItemData, Color: Prop[ItemData.className].Color }; self.CodeEditor.pushMark(Mark); } }) } fn.RolesInfo = function (Div) { var self = this; Div.innerHTML = ""; var editor = self.CodeEditor.editor; var dataRole = CLApp.getRoleTree()[0]; var Tree = new CLTree(dataRole); Tree.OnItemCreated = function (Item, ItemData) { var itemData = { ID: ItemData.ID, Name: ItemData.Name, ParentID: ItemData.ParentID, className: "角色" } Item.firstChild.firstChild.onclick = function (e) { e.stopPropagation(); } Item.firstChild.onclick = function () { var Mark = { className: "RoleData", FieldData: ItemData, Color: "#68217a" }; self.CodeEditor.pushMark(Mark); } } Tree.Editable = false; Tree.Render(Div); Div.lastChild.style.overflow = "auto"; Div.lastChild.style.height = "100%"; } fn.MarkerProps = function (mark) { var self = this; if (JsParser.HasReturn(mark)) { return JsParser.GetReturn(mark) } function SubBox(dataCtrl) { var Box = document.createElement("div"); Box.Visible = false; Box.Disabled = false; Box.DivNote = document.createElement("div"); var Val = []; var line = {}; dataCtrl.Data.Field.forEach(function (ele) { if (/^[0-9]*$/.test(ele.Data.ID)) { line["DataField_" + ele.Data.ID] = FrmCtrls.GetValueProps(ele.Name, false, false); } }); var Val = [line]; Box.Value = Val; Box.AddLine = function () { }; JsParser.SetReturn(Box.AddLine, document.createElement("div")); Box.RemoveLine = function () { }; Box.HideLine = function () { }; Box.ShowLine = function () { }; return Box; } var className = mark.className; if (className == "RoleData") { return ""; } if (className == "FormDataField") { var FieldData = mark.FieldData; var ID = FieldData.ID; className = FieldData.className; if (className == "摄像头") { return ""; } var R = Object.create(null); R.Self = document.createElement("div"); R.toString = function () { }; R.valueOf = function () { }; R.IsNull = true; if (className == "下拉框" || className == "下拉复选框") { R.Self.Items = []; R.Self.Select = Object.create(CLSelect.prototype); } if (className == "关联数据") { R.Self.dataItem = {}; } if (className == "手写签名") { R.Self.ToUrl = function () { }; JsParser.SetReturn(R.Self.ToUrl, ""); } if (className == "选项卡") { R.Self.Show = function () { } R.Self.Hide = function () { } R.Self.Select = function () { } } R.Self.Visible = false; R.Self.Disabled = false; R.Self.DivNote = document.createElement("div"); var divContext = self.divContext; if (className == "子表单") { FrmDesigner.getData(divContext).Controls.forEach(function (dataCtrl) { if (dataCtrl.Data.ID == FieldData.ID) { R.Self = SubBox(dataCtrl); } }); } else if (FieldData.ParentID && FieldData.ParentID != self.dataCtrl.ParentID) { R = []; FrmDesigner.getData(divContext).Controls.forEach(function (dataCtrl) { if (dataCtrl.Data.ID == FieldData.ParentID) { dataCtrl.Data.Field.forEach(function (dataCtrl) { if (dataCtrl.Data.ID == FieldData.ID) { R.push(FrmCtrls.GetValueProps(dataCtrl.Name, false, false)); } }); } }); R.Self = Object.create(NodeList.prototype); var ele = document.createElement("div"); JsParser.SetElement(R.Self, ele); ele.Value = R[0]; R.Self.Value = FrmCtrls.GetValueProps(className, true, false); } else if (FieldData.ParentID) { R.Self.OffsetY = function () { }; JsParser.SetReturn(R.Self.OffsetY, 0); R.Self.Parent = document.createElement("div"); R.Self.Parent.dataLine; var table = R.Self.Parent.Parent = document.createElement("div"); FrmDesigner.getData(divContext).Controls.forEach(function (dataCtrl) { if (dataCtrl.Data.ID == FieldData.ParentID) { R.Self.Parent.Parent = SubBox(dataCtrl); } }); } else { R.Self.Value = FrmCtrls.GetValueProps(className, false, false); } JsParser.SetReturn(R.toString, ""); JsParser.SetReturn(R.valueOf, R.Self.Value); return R; } } FrmCoderEditor.AllFunc = (function 所有函数() { return [ (function 数学函数() { return { Type: "数学函数", Functions: [ { ID: "ABS", Name: "ABS" + (function () { window.ABS = function (Num) { return Math.abs(Num * 1); } return ""; })(), Note: "ABS函数可以获取一个数的绝对值
\ 用法:ABS(数字)
\ 示例:ABS(-8)可以返回8,也就是-8的绝对值", }, { ID: "AVERAGE", Name: "AVERAGE" + (function () { window.AVERAGE = function () { if (arguments.length == 0) { return 0; } var average = 0; var List = Array.isArray(arguments[0]) ? arguments[0] : arguments; for (var i = 0; i < List.length; i++) { List += List[i] * 1; } return average / List.length; } return ""; })(), Note: "AVERAGE函数可以获取一组数值的算术平均值
\ 用法:AVERAGE(数字1,数字2,...)
\ 示例:AVERAGE(语文成绩,数学成绩, 英语成绩)返回三门课程的平均分" }, { ID: "CEILING", Name: "CEILING" + (function () { window.CEILING = function (Num, Factors) { Num *= 1; Factors *= 1; var result = Num + Math.abs(Factors); result -= result % Math.abs(Factors); return result; } return ""; })(), Note: "CEILING函数可以将数字增大到最接近原值的指定因数的倍数
\ 用法:CEILING(数字,因数)
\ 示例:CEILING(7,6)返回12,因为12比7大的同时,也是6的倍数中最接近7的数字" }, { ID: "COUNTIF", Name: "COUNTIF" + (function () { window.COUNTIF = function (array, Condition) { var iRasult = 0; if (Condition == null) { return array.length; } for (var i = 0; i < array.length ; i++) { iRasult = (eval("(function(){return " + array[i] + Condition + "})()") ? iRasult + 1 : iRasult); } return iRasult; } return ""; })(), Note: "COUNTIF函数可以获取数组中满足条件的参数个数
\ 用法:COUNTIF(数组,\"条件\")
\ 示例:COUNTIF(子表单.性别, \"女\"),可得到子表单中性别填的是\"女\"的数据条数;COUNTIF([1,2,3,4],\">2\"),可得到1,2,3,4中大于2的数字数量,结果为2。" }, { ID: "FIXED", Name: "FIXED" + (function () { window.FIXED = function (Num, fractionDigits) { return (Num * 1).toFixed(fractionDigits) } return ""; })(), Note: "FIXED函数可将数字舍入到指定的小数位数并输出为文本
\ 用法:FIXED(数字,小数位数)
\ 示例:FIXED(3.1415,2)返回\"3.14\"" }, { ID: "FLOOR", Name: "FLOOR" + (function () { window.FLOOR = function (Num, Factors) { Num *= 1; Factors *= 1; var result = Num - (Num % Math.abs(Factors)); return result; } return ""; })(), Note: "FLOOR函数可将数字减小到最接近原值的指定因数的倍数
\ 用法:FLOOR(数字,因数)
\ 示例:FLOOR(7,6)返回6,因为6比7小的同时,也是6的倍数中最接近7的数字" }, { ID: "INT", Name: "INT" + (function () { window.INT = function (Num) { Num *= 1; return Num.toFixed(0); } return ""; })(), Note: "INT函数可以获取一个数的整数部分
\ 用法:INT(数字)
\ 示例:INT(3.1415)返回3,也就是3.1415的整数部分" }, { ID: "LARGE", Name: "LARGE" + (function () { window.LARGE = function (array, k) { array.sort(function (val1, val2) { return val1 - val2; }); if (array.length >= k) { return array[array.length - k]; } else { return null; } } return ""; })(), Note: "LARGE函数可以获取数据集中第k个最大值
\ 用法:LARGE(数组,k)
\ 示例:LARGE(学生成绩.数学成绩,1)返回子表单\"学生成绩\"中排名第1的\"数学成绩\"" }, { ID: "LOG", Name: "LOG" + (function () { window.LOG = function (Num, Base) { return Math.log(Num) / Math.log(Base); } return ""; })(), Note: "LOG函数可以根据指定底数返回数字的对数
\ 用法:LOG(数字,底数)
\ 示例:LOG(100,10)返回2,也就是以10为底数100的对数" }, { ID: "MAX", Name: "MAX" + (function () { window.MAX = function () { var result = null; var List = Array.isArray(arguments[0]) ? arguments[0] : arguments; for (var i = 0; i < List.length; i++) { result = result == null ? List[i] : (result < List[i] ? List[i] : result); } return result; } return ""; })(), Note: "MAX函数可以获取一组数值的最大值
\ 用法:MAX([数字1,数字2,...])
\ 示例:MAX([语文成绩,数学成绩,英语成绩])返回三门课程中的最高分" }, { ID: "MIN", Name: "MIN" + (function () { window.MIN = function () { var result = null; var List = Array.isArray(arguments[0]) ? arguments[0] : arguments; for (var i = 0; i < List.length; i++) { result = result == null ? List[i] : (result > List[i] ? List[i] : result); } return result; } return ""; })(), Note: "MIN函数可以获取一组数值的最大值
\ 用法:MIN([数字1,数字2,...])
\ 示例:MIN([语文成绩,数学成绩,英语成绩])返回三门课程中的最高分" }, { ID: "MOD", Name: "MOD" + (function () { window.MOD = function (Dividend, Divisor) { return Dividend % Divisor; } return ""; })(), Note: "MOD函数可以获取两数相除的余数
\ 用法:MOD(被除数,除数)
\ 示例:MOD(4,3)返回1,也就是4/3的余数" }, { ID: "POWER", Name: "POWER" + (function () { window.POWER = function (Num, Power) { return Math.pow(Num, Power); } return ""; })(), Note: "POWER函数可以获取数字乘幂的结果
\ 用法:POWER(数字,指数)
\ 示例:POWER(3,2)返回9,也就是3的2次方" }, { ID: "PRODUCT", Name: "PRODUCT" + (function () { window.PRODUCT = function () { var result = 1; for (var i = 0; i < arguments.length; i++) { result *= arguments[i]; } return result; } return ""; })(), Note: "PRODUCT函数可以获取一组数值的乘积
\ 用法:PRODUCT(数字1,数字2,...)
\ 示例:PRODUCT(单价, 数量)获取总价,也就是单价和数量的乘积" }, { ID: "ROUND", Name: "ROUND" + (function () { window.ROUND = function (Num, length) { return (Num * 1).toFixed(length) * 1; } return ""; })(), Note: "ROUND函数可以将数字四舍五入到指定的位数
\ 用法:ROUND(数字,数字位数)
\ 示例:ROUND(3.1485,2)返回3.15" }, { ID: "SMALL", Name: "SMALL" + (function () { window.SMALL = function (array, k) { array.sotr(function (val1, val2) { return val2 - val1; }); if (array.length > k) { return array[k - 1]; } else { return null; } } return ""; })(), Note: "SMALL函数可以返回数据集中第k个最小值
\ 用法:SMALL(数组,k)
\ 示例:SMALL(学生成绩.数学成绩, 1)返回子表单\"学生成绩\"中排名倒数第一的\"数学成绩\"" }, { ID: "SQRT", Name: "SQRT" + (function () { window.SQRT = function (Num) { return Math.sqrt(Num); } return ""; })(), Note: "SQRT函数可以获取一个数字的正平方根
\ 用法:SQRT(数字)
\ 示例:SQRT(9)返回3,也就是9的正平方根" }, { ID: "SUM", Name: "SUM" + (function () { window.SUM = function () { var result = 0; var List = Array.isArray(arguments[0]) ? arguments[0] : arguments; for (var i = 0; i < List.length ; i++) { result += List[i] * 1; } return result; } return ""; })(), Note: "SUM函数可以获取所有参数的和
\ 用法:SUM([数字1,数字2,...])
\ 示例:SUM([语文成绩,数学成绩, 英语成绩])返回三门课程的总分" }, { ID: "SUMPRODUCT", Name: "SUMPRODUCT" + (function () { window.SUMPRODUCT = function () { var result = 0; var Temp = []; for (var i = 0; i < arguments.length ; i++) { for (var j = 0; j < arguments[i].length; j++) { if (Temp[j] == null) { Temp[j] = 1; } Temp[j] *= arguments[i][j]; } } for (var i = 0; i < Temp.length ; i++) { result += Temp[i]; } return result; } return ""; })(), Note: "SUMPRODUCT函数可以将数组间对应的元素相乘,并返回乘积之和,适用于加权求和
\ 用法:SUMPRODUCT(数组,数组...)
\ 示例:SUMPRODUCT([1,2,3],[0.1,0.2,0.3])返回1.4,也就是 1×0.1 + 2×0.2 + 3×0.3的值" }, { ID: "RAND", Name: "RAND" + (function () { window.RAND = function () { return Math.random(); } return ""; })(), Note: "RAND函数可返回大于等于0且小于1的均匀分布随机实数
\ 用法:RAND()
\ 示例:RAND()返回0.424656" } ] } })(), (function 文本函数() { return { Type: "文本函数", Functions: [ { ID: "CONCATENATE", Name: "CONCATENATE" + (function () { window.CONCATENATE = function () { var str = ""; for (var i = 0; i < arguments.length ; i++) { str += arguments[i]; } return str; } return ""; })(), Note: "CONCATENATE函数可以将多个文本合并成一个文本
\ 用法:CONCATENATE(文本1,文本2,...)
\ 示例:CONCATENATE(\"三年二班\",\"周杰伦\")会返回\"三年二班周杰伦\"" }, { ID: "CHAR", Name: "CHAR" + (function () { window.CHAR = function (Code) { Code = Code.toString(); return String.fromCharCode(Code); } return ""; })(), Note: "CHAR函数可以将计算机字符集的数字代码转换为对应字符
\ 用法:CHAR(数字)
\ 示例:CHAR(10)会返回换行字符" }, { ID: "EXACT", Name: "EXACT" + (function () { window.EXACT = function (str1, str2) { return str1 + "" == str2 + ""; } return ""; })(), Note: "EXACT函数可以比较两个文本是否完全相同,完全相同则返回true,否则返回false
\ 用法:EXACT(文本1, 文本2)
\ 示例:EXACT(手机号,中奖手机号),如果两者相同,返回true,如果不相同,返回false" }, { ID: "GETUSERNAME", Name: "GETUSERNAME" + (function () { window.GETUSERNAME = function () { return CLApp.getMemberNameById(CLApp.getCurrentUserId()); } return ""; })(), Note: "GETUSERNAME函数可以获取当前用户的昵称
\ 用法:GETUSERNAME()
\ 示例:略" }, { ID: "ISEMPTY", Name: "ISEMPTY" + (function () { window.ISEMPTY = function (obj) { if (Object.prototype.toString.call(obj) == "[object Array]" || typeof (obj) == "string") { return obj.length != 0; } return obj != null; } return ""; })(), Note: "ISEMPTY函数可以用来判断值是否为空文本、空对象或者空数组
\ 用法:ISEMPTY(文本)
\ 示例:略" }, { ID: "LEFT", Name: "LEFT" + (function () { window.LEFT = function (str, length) { str = str.toString(); return str.substr(0, length > str.length ? str.length : length); } return ""; })(), Note: "LEFT函数可以从一个文本的第一个字符开始返回指定个数的字符
\ 用法:LEFT(文本,文本长度)
\ 示例:LEFT(\"三年二班周杰伦\",2)返回\"三年\",也就是\"三年二班周杰伦\"的从左往右的前2个字符" }, { ID: "LEN", Name: "LEN" + (function () { window.LEN = function (str) { str = str.toString(); return str.length; } return ""; })(), Note: "LEN函数可以获取文本中的字符个数
\ 用法:LEN(文本)
\ 示例:LEN(\"朝辞白帝彩云间\")返回7,因为这句诗中有7个字符" }, { ID: "LOWER", Name: "LOWER" + (function () { window.LOWER = function (str) { str = str.toString(); return str.toLocaleLowerCase(); } return ""; })(), Note: "LOWER函数可以将一个文本中的所有大写字母转换为小写字母
\ 用法:LOWER(文本)
\ 示例:LOWER(\"JAYZ\")返回\"jayz\"" }, { ID: "MID", Name: "MID" + (function () { window.MID = function (str, Pos, Length) { str = str.toString(); return str.substr(Pos, Length); } return ""; })(), Note: "MID返回文本中从指定位置开始的指定数目的字符
\ 用法:MID(文本,开始位置_数字,指定数目)
\ 示例:MID(\"百度云应用定制工具\",4,6)返回\"应用定制工具\"" }, { ID: "REPLACE", Name: "REPLACE" + (function () { window.REPLACE = function (str, Pos, Length, newStr) { str = str.toString(); return str.substr(0, Pos) + newStr + str.substr(Pos + Length); } return ""; })(), Note: "REPLACE函数可以根据指定的字符数,将部分文本替换为不同的文本
\ 用法:REPLACE(文本,开始位置,替换长度,新文本)
\ 示例:REPLACE(\"百度云应用定制工具\",4,6,\"企业数据管理平台\")返回\"百度云企业数据管理平台\"" }, { ID: "REPT", Name: "REPT" + (function () { window.REPT = function (str, Num) { str = str.toString(); for (var i = 0; i < Num - 1 ; i++) { str += str; } return str; } return ""; })(), Note: "REPT函数可以将文本重复一定次数
\ 用法:REPT(文本,重复次数)
\ 示例:REPT(\"周杰伦\",3)返回\"周杰伦周杰伦周杰伦\"" }, { ID: "RIGHT", Name: "RIGHT" + (function () { window.RIGHT = function (str, Num) { str = str.toString(); return str.substr(str.length - Num, Num); } return ""; })(), Note: "RIGHT函数可以获取由给定文本右端指定数量的字符构成的文本值
\ 用法:RIGHT(文本,文本长度)
\ 示例:RIGHT(\"三年二班周杰伦\",3)返回\"周杰伦\",也就是\"三年二班周杰伦\"从右往左的前3个字符" }, { ID: "SEARCH", Name: "SEARCH" + (function () { window.SEARCH = function (str1, str2) { str1 = str1.toString(); str2 = str2.toString(); return str2.indexOf(str1); } return ""; })(), Note: "SEARCH函数可以获取文本1在文本2中的开始位置
\ 用法:SEARCH(文本1,文本2)
\ 示例:SEARCH(\"2016\",\"百度云2016\")返回4" }, { ID: "SPLIT", Name: "SPLIT" + (function () { window.SPLIT = function (str1, sSplit) { str1 = str1.toString(); return str1.split(sSplit); } return ""; })(), Note: "SPLIT函数可以将文本按指定分割符分割成数组
\ 用法:SPLIT(文本,分隔符_文本)
\ 示例:SPLIT(\"百度云-应用定制工具\",\"-\")返回\"百度云,应用定制工具\"" }, { ID: "TEXT", Name: "TEXT" + (function () { window.TEXT = function (Num, sFormat) { return (Num * 1).toString(sFormat); } return ""; })(), Note: "TEXT函数可以将数字转化成文本
\ 用法:TEXT(数字)
\ 示例:TEXT(3.1415)返回\"3.1415\"" }, { ID: "TRIM", Name: "TRIM" + (function () { window.TRIM = function (str) { str = str.toString(); return str.replace(/(^\s*)|(\s*$)/g, ""); } return ""; })(), Note: "TRIM函数可以删除文本首尾的空格
\ 用法:TRIM(文本)
\ 示例:TRIM(\" 百度云 \")返回\"百度云\"" }, { ID: "UPPER", Name: "UPPER" + (function () { window.UPPER = function (str) { str = str.toString(); return str.toLocaleUpperCase(); } return ""; })(), Note: "UPPER函数可以将一个文本中的所有小写字母转换为大写字母
\ 用法:UPPER(文本)
\ 示例:UPPER(\"jayz\")返回\"JAYZ\"" }, { ID: "VALUE", Name: "VALUE" + (function () { window.VALUE = function (str) { str = str.toString(); return str * 1; } return ""; })(), Note: "VALUE函数可以将文本转化为数字\ 用法:VALUE(文本)\ 示例:VALUE(\"3.1415\")返回3.1415" } ] } })(), (function 日期函数() { return { Type: "日期函数", Functions: [ { ID: "DATE", Name: "DATE" + (function () { window.DATE = function (Val) { if (Val == null) { return new Date(); } else { return Date.Parse(Val); } } return ""; })(), Note: "DATE函数可以将时间戳转换为日期对象
\ 用法:DATE(时间戳)
\ 示例:略" }, { ID: "DATEDELTA", Name: "DATEDELTA" + (function () { window.DATEDELTA = function (Val, iDay) { if (typeof Val == "string") { Val = Date.Parse(Val); } Val.setDate(Val.getDate() + iDay); return Val; } return ""; })(), Note: "DATEDELTA函数可以将指定日期加/减指定天数
\ 用法:DATEDELTA(指定日期,需要加减的天数)
\ 示例:略" }, { ID: "DAY", Name: "DAY" + (function () { window.DAY = function (Val, iDay) { if (typeof Val == "string") { Val = Date.Parse(Val); } return Val.getDate(); } return ""; })(), Note: "DAY函数可以获取某日期是当月的第几日
\ 用法:DAY(时间戳)
\ 示例:略" }, { ID: "DAYS", Name: "DAYS" + (function () { window.DAYS = function (dtStart, dtEnd) { if (typeof dtStart == "string") { dtStart = Date.Parse(dtStart); } if (typeof dtEnd == "string") { dtEnd = Date.Parse(dtEnd); } return (dtStart - dtEnd) / 3600000 / 24; } return ""; })(), Note: "DAYS函数可以返回两个日期之间相差的天数。
\ 用法:DAYS(结束日期,开始日期)
\ 示例:略" }, { ID: "HOUR", Name: "HOUR" + (function () { window.HOUR = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } return Val.getHours(); } return ""; })(), Note: "HOUR函数可以返回某日期的小时数
\ 用法:HOUR(时间戳)
\ 示例:略" }, { ID: "ISOWEEKNUM", Name: "ISOWEEKNUM" + (function () { window.ISOWEEKNUM = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } var totalDays = 0; years = Val.getYear() if (years < 1000) years += 1900 var days = new Array(12); days[0] = 31; days[2] = 31; days[3] = 30; days[4] = 31; days[5] = 30; days[6] = 31; days[7] = 31; days[8] = 30; days[9] = 31; days[10] = 30; days[11] = 31; //判断是否为闰年,针对2月的天数进行计算 if ((Val.getYear() % 4 == 0 && Val.getYear() % 100 != 0) || (Val.getYear() % 400)) { days[1] = 29 } else { days[1] = 28 } if (Val.getMonth() == 0) { totalDays = totalDays + Val.getDate(); } else { var curMonth = Val.getMonth(); for (var count = 1; count <= curMonth; count++) { totalDays = totalDays + days[count - 1]; } totalDays = totalDays + Val.getDate(); } //得到第几周 var Temp = Date.Parse(Val.getFullYear() + "-01-01"); var iDay = Temp.getDay(); var week = 0; if (iDay < 4) { totalDays -= (4 - iDay); } else { totalDays -= (11 - iDay); } if (totalDays < 0) { return ISOWEEKNUM(Date.Parse(Val.getFullYear() - 1 + "-12-31")); } week = Math.round((totalDays - totalDays % 7) / 7); if (totalDays % 7 != 0) { week++; } return week + 1; } return ""; })(), Note: "ISOWEEKNUM函数可以返回指定日期在全年中的ISO周数
\ 用法:ISOWEEKNUM(指定日期)
\ 示例:略" }, { ID: "MINUTE", Name: "MINUTE" + (function () { window.MINUTE = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } return Val.getMinutes(); } return ""; })(), Note: "MINUTE函数可以返回某日期的分钟数
\ 用法:MINUTE(时间戳)
\ 示例:略" }, { ID: "MONTH", Name: "MONTH" + (function () { window.MONTH = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } return Val.getMonth() + 1; } return ""; })(), Note: "MONTH返回某日期的月份
\ 用法:MONTH(时间戳)
\ 示例:略" }, { ID: "NOW", Name: "NOW" + (function () { window.NOW = function () { return new Date(); } return ""; })(), Note: "NOW函数可以获取当前时间
\ 用法:NOW()
\ 示例:略" }, { ID: "SECOND", Name: "SECOND" + (function () { window.SECOND = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } return Val.getSeconds(); } return ""; })(), Note: "SECOND函数可以返回某日期的秒数
\ 用法:SECOND(时间戳)
\ 示例:略" }, { ID: "TIME", Name: "TIME" + (function () { window.TIME = function (h, m, s) { var fResult = 0; fResult += h / 24; fResult += m / (60 * 24); fResult += s / (60 * 60 * 24); return fResult; } return ""; })(), Note: "TIME函数可以返回特定时间的十进制数字
\ 用法:TIME(时_数字,分_数字,秒_数字)
\ 示例:略" }, { ID: "TIMESTAMP", Name: "TIMESTAMP" + (function () { window.TIMESTAMP = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } return Val.valueOf(); } return ""; })(), Note: "TIMESTAMP函数可以将日期对象转换成时间戳。
\ 用法:TIMESTAMP(日期)
\ 示例:略" }, { ID: "TODAY", Name: "TODAY" + (function () { window.TODAY = function () { return Date.Parse(new Date().toString("yyyy-MM-dd")); } return ""; })(), Note: "TODAY函数可以返回今天
\ 用法:TODAY()
\ 示例:略" }, { ID: "WEEKNUM", Name: "WEEKNUM" + (function () { window.WEEKNUM = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } var totalDays = 0; var years = Val.getFullYear() if (years < 1000) years += 1900 var days = new Array(12); days[0] = 31; days[2] = 31; days[3] = 30; days[4] = 31; days[5] = 30; days[6] = 31; days[7] = 31; days[8] = 30; days[9] = 31; days[10] = 30; days[11] = 31; //判断是否为闰年,针对2月的天数进行计算 if ((Val.getFullYear() % 4 == 0 && Val.getFullYear() % 100 != 0) || (Val.getFullYear() % 400 == 0)) { days[1] = 29 } else { days[1] = 28 } var curMonth = Val.getMonth(); for (var count = 0; count < curMonth; count++) { totalDays = totalDays + days[count]; } totalDays = totalDays + Val.getDate(); //得到第几周 var Temp = Date.Parse(Val.getFullYear() + "-01-01"); var iDay = Temp.getDay(); var week = 0; if (iDay != 0) { totalDays -= (7 - iDay); week++; } if (totalDays < 0) { return week; } if (totalDays % 7 != 0) { week++; } week += parseInt(totalDays / 7); return week; } return ""; })(), Note: "WEEKNUM函数可以返回指定日期在当年是第几周
\ 用法:WEEKNUM(指定日期)
\ 示例:略" }, { ID: "YEAR", Name: "YEAR" + (function () { window.YEAR = function (Val) { if (typeof Val == "string") { Val = Date.Parse(Val); } return Val.getFullYear(); } return ""; })(), Note: "YEAR函数可以返回某日期的年份
\ 用法:YEAR(时间戳)
\ 示例:略" } ] } })(), (function 逻辑函数() { return { Type: "逻辑函数", Functions: [ { ID: "AND", Name: "AND" + (function () { window.AND = function () { for (var i = 0; i < arguments.length ; i++) { if (!arguments[i]) { return false; } } return true; } return ""; })(), Note: "如果所有参数都为真,AND函数返回布尔值true,否则返回布尔值 false
\ 用法:AND(逻辑表达式1,逻辑表达式2,...)
\ 示例:AND(语文成绩>90,数学成绩>90,英语成绩>90),如果三门课成绩都> 90,返回true,否则返回false" }, { ID: "FALSE", Name: "FALSE" + (function () { window.FALSE = function () { return false; } return ""; })(), Note: "FALSE函数返回布尔值false
\ 用法:FALSE()
\ 示例:略" }, { ID: "IF", Name: "IF" + (function () { window.IF = function (Condition, Yes, No) { if (Condition) { return Yes; } else { return No; } } return ""; })(), Note: "IF函数判断一个条件能否满足;如果满足返回一个值,如果不满足则返回另外一个值
\ 用法:IF(逻辑表达式,为true时返回的值,为false时返回的值)
\ 示例:IF(语文成绩>60,\"及格\",\"不及格\"),当语文成绩>60时返回及格,否则返回不及格。" }, { ID: "NOT", Name: "NOT" + (function () { window.NOT = function (Condition) { return !Condition; } return ""; })(), Note: "NOT函数返回与指定表达式相反的布尔值。
\ 用法:NOT(逻辑表达式)
\ 示例:NOT(语文成绩>60),如果语文成绩大于60返回false,否则返回true" }, { ID: "OR", Name: "OR" + (function () { window.OR = function () { for (var i = 0; i < arguments.length ; i++) { if (arguments[i]) { return true; } } return false; } return ""; })(), Note: "如果任意参数为真,OR 函数返回布尔值true;如果所有参数为假,返回布尔值false。
\ 用法:OR(逻辑表达式1,逻辑表达式2,...)
\ 示例:OR(语文成绩>90,数学成绩>90,英语成绩>90),任何一门课成绩> 90,返回true,否则返回false" }, { ID: "TRUE", Name: "TRUE" + (function () { window.TRUE = function () { return true; } return ""; })(), Note: "TRUE函数返回布尔值true
\ 用法:TRUE()
\ 示例:略" }, { ID: "XOR", Name: "XOR" + (function () { window.XOR = function () { return arguments[0] != arguments[1]; } return ""; })(), Note: "XOR函数可以返回所有参数的异或值
\ 用法:XOR(逻辑表达式1, 逻辑表达式2)
\ 示例:XOR(语文成绩>90,数学成绩>90),如果两门成绩都>90,返回false;如果两门成绩都<90,返回false;如果其中一门>90,另外一门<90,返回true" } ] } })(), (function 高级函数() { return { Type: "高级函数", Functions: [ { ID: "UUID", Name: "UUID" + (function () { window.UUID = function () { var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split(''); var uuid = [], i; var len, radix; radix = radix || chars.length; if (len) { // Compact form for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]; } else { // rfc4122, version 4 form var r; // rfc4122 requires these characters uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'; uuid[14] = '4'; // Fill in random data. At i==19 set the high bits of clock sequence as // per rfc4122, sec. 4.1.5 for (i = 0; i < 36; i++) { if (!uuid[i]) { r = 0 | Math.random() * 16; uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]; } } } return uuid.join(''); } return ""; })(), Note: "UUID函数随机码生成器。可适用于随机流水号的使用场景等
\ 用法:UUID()
\ 示例:略" }, { ID: "FORMPARAM", Name: "FORMPARAM" + (function () { window.FORMPARAM = function (Name) { var sVal = CLQueryString[Name]; return sVal == null ? "" : sVal; } return ""; })(), Note: "FORMPARAMS获取url参数
\ 用法:FORMPARAMS(参数名)
\ 示例:略" }, { ID: "HTTPGET", Name: "HTTPGET" + (function () { window.HTTPGET = function (Url) { return HttpGet(Url, null, false, false); } return ""; })(), Note: "FORMPARAMS调用HTTP接口
\ 用法:HTTPGET(Url)
\ 示例:略" }, { ID: "FINDIN", Name: "FINDIN" + (function (Val, Vals) { window.FINDIN = function (Val, Vals) { return Vals.valueOf().indexOf(Val.valueOf()) >= 0; } return ""; })(), Note: "如果找到FINDIN函数返回布尔值true,否则返回布尔值 false
\ 用法:FINDIN(元素,数组)
\ 示例:AND(成员单选90,成员多选),如果成员单选的值被成员多选包含则返回true,否则返回false" } ] } })() ] })(); var setGlobalScope = CLCodeEditor.prototype.setGlobalScope; CLCodeEditor.prototype.setGlobalScope = function (globalScope) { setGlobalScope.call(this, globalScope); if ((globalScope.constructor + "").substr(9, 6) == "Window") { FrmCoderEditor.AllFunc.forEach(function (ele) { ele.Functions.forEach(function (ele) { if (!globalScope.hasOwnProperty(ele.Name)) { globalScope[ele.Name] = window[ele.Name]; } }); }); } } FrmCoderEditor.GetNoteByName = function (Name) { for (var i = 0; i < FrmCoderEditor.AllFunc.length ; i++) { for (var j = 0; j < FrmCoderEditor.AllFunc[i].Functions.length; j++) { if (FrmCoderEditor.AllFunc[i].Functions[j] != null && FrmCoderEditor.AllFunc[i].Functions[j].Name == Name) { return FrmCoderEditor.AllFunc[i].Functions[j].Note; } } } } FrmCoderEditor.Scope = function (dataCtrl, Scope) { Scope.Self = document.createElement("div"); Scope.EventTarger = document.createElement("div"); Scope.FrmDesignerInst = Object.create(FrmDesigner.prototype); Scope.Designer = Object.create(FrmDesigner.prototype); Scope.FrmDesignerEx = FrmDesignerEx; Scope.EventTarger.Name = ""; var className = dataCtrl.Name; if (className == "子表单") { var Val = []; var line = {}; dataCtrl.Data.Field.forEach(function (ele) { if (/^[0-9]*$/.test(ele.Data.ID)) { line["DataField_" + ele.Data.ID] = FrmCtrls.GetValueProps(ele.Name, false, false); } }); JsParser.SetElement(Val,line); Scope.Self.Value = Val; } else { Scope.Self.Value = FrmCtrls.GetValueProps(className, false, false); } return Scope; } FrmCoderEditor.MarksLength = function (Marks) { var iRet = 0; for (var i = 0; i < Marks.length; i++) { if (Marks[i].FieldData.FormID == null && Marks[i].FieldData.className != "角色") { iRet++; } } return iRet; } FrmCoderEditor.RunCode = function (sCode, Data, Box) { var out = ""; var Self = this;//当前控件 FrmCtrls.At(this, Box, function () { function GetRole(data) { return data.ID; } try { function __Ctrl__(ID) { if (ID == "提交按钮") { return FrmCtrls.ControlFormField({ ID: "提交按钮", Name: "提交按钮" }); } else { return FrmCtrls.ControlFormField(CLApp.getFieldInfo(ID)); } } var ControlCamera = FrmCtrls.ControlCamera; var ControlFormField = FrmCtrls.ControlFormField; var FrmDesignerInst = FrmDesigner.GetInstance(Self); var Designer = FrmDesignerInst; Self.Data = Self.dataCtrl.Data; var EventTarger = Box == null ? {} : Box; var Event = null; if (Box != null) { Event = Box.Event; } var OriginValue = FrmDesigner.GetOriginValue(Self, Self.dataCtrl.Data.ID); if (EventTarger != null && EventTarger.dataCtrl != null) { EventTarger.Name = EventTarger.dataCtrl.Data.Name; } var CurrentStep = Designer.CurrentStep == null ? {} : Designer.CurrentStep; var ret = eval(sCode); out = ret == null ? "" : ret; } catch (e) { if (e.name == "SyntaxError") { if (e.message == "Unexpected end of JSON input") { CLShowMsg("Unexpected end of JSON input:\n【" + Self.dataCtrl.Data.Name + "】"); } else { CLShowMsg("语法错误:\n【" + Self.dataCtrl.Data.Name + "】"); } } else if (e.message != null) { CLShowMsg("" + e.message + "【" + Self.dataCtrl.Data.Name + "】"); } else { CLShowMsg("" + e + "【" + Self.dataCtrl.Data.Name + "】"); } if (typeof e != "string") { throw e; } } }); return out; } var g_Dynamic = [ { ID: "Dynamic_10000", Name: "当前用户", } ] var g_departDynamic = [ { ID: "departDynamic_10000", Name: "当前用户所处部门", } ] function getDynamicNameById(Id) { for (var i = 0; i < g_Dynamic.length; i++) { if (g_Dynamic[i].ID == Id) { return g_Dynamic[i].Name; } } return "??????"; } function getDynamicIdByName(Name) { for (var i = 0; i < g_Dynamic.length; i++) { if (g_Dynamic[i].Name == Name) { return g_Dynamic[i].ID; } } return null; } function getDepartDynamicNameById(Id) { for (var i = 0; i < g_departDynamic.length; i++) { if (g_departDynamic[i].ID == Id) { return g_departDynamic[i].Name; } } return "??????"; } var DynamicFunctor = {}; //回调接口 DynamicFunctor["当前用户"] = function () { var user = CLApp.getMemberById(CLApp.getCurrentUserId()); return { ID: user.userid, Name: user.name } } //回调接口 DynamicFunctor["当前用户所处部门"] = function () { var user = CLApp.getMemberById(CLApp.getCurrentUserId()); if (!user) { H5.ShowMsg("【"+CLApp.getCurrentUserId()+"】员工信息已丢失",false); } var depart = CLApp.getDepartmentById(user && user.department[0]); if (depart == null) { return { ID: "", Name: "??????" } } return { ID: depart.id, Name: depart.name } } var RealDynamic = function (List) { var realDynamic = []; for (var i = 0 ; i < List.length; i++) { realDynamic.push(DynamicFunctor[List[i].Name]()); } return realDynamic; } var RealDepartDynamic = function (List) { var realDepartDynamic = []; for (var i = 0 ; i < List.length; i++) { realDepartDynamic.push(DynamicFunctor[List[i].Name]()); } return realDepartDynamic; } function SourceLinkage(ControlBox, Call) { var ValueBox = LinkageBox(ControlBox); var Data = ControlBox.dataCtrl.Data; var _FrmDesigner = FrmDesigner.GetInstance(ControlBox); var CurBox = Data.ParentID == null ? ControlBox : FrmDesigner.getElementById(Data.ParentID, _FrmDesigner.designerDiv); var TempIDs = []; var Wheres = GetWheres(ControlBox); if (Wheres == null) { Wheres = []; } function func(sourceIds) { if (sourceIds.indexOf(Data.Linkage.FormID) >= 0) { changde(); } } func.Name = Data.Name function changde() { if (!ControlBox.isConnected) { _FrmDesigner.UnSourceDataChanged(func); return; } var Wheres = GetWheres(ControlBox); if (Wheres == null) { Wheres = []; } if (_FrmDesigner.Initializing) { return; } getFormDataByIdAndWheresFromSource.call({ Initialized: !!ControlBox.Initialized, datetime: new Date() }, _FrmDesigner, Data.Linkage.FormID, Wheres, function (data) { if (!this.Initialized && ControlBox.Initialized) { return; } if (ControlBox.datetimeLinkage > this.datetime) { return; } ControlBox.datetimeLinkage = this.datetime; Call(data); }, true); } if (ValueBox != null) { if (Data.ParentID != null && ValueBox.LinkageData != null && ValueBox.LinkageData[Data.ID] != null && ValueBox.LinkageData[Data.ID][0] != null) { Call(ValueBox.LinkageData[Data.ID]); } var fChanged = function (Box) { if (_FrmDesigner.HasSourceChanged(Data.Linkage.FormID)) { return; } if (!ControlBox.isConnected) { if (ValueBox != null && ValueBox.LinkageData != null && ValueBox.LinkageData[Data.ID]) { _FrmDesigner.UnSourceDataChanged(func); return; } } else { Wheres = GetWheres(ControlBox); if (Wheres == null) { Wheres = []; } } if (Box != null && Box.dataCtrl.Data.ID != Data.Linkage.CurFieldID) { return; } if (ValueBox.Value == null) { ControlBox.Value = null; return; } getFormDataByIdAndWheresFromSource.call({ Initialized: !!Box.Initialized, datetime: new Date() }, _FrmDesigner, Data.Linkage.FormID, Wheres, function (data) { if (!this.Initialized && ControlBox.Initialized) { return; } if (ValueBox.LinkageData == null) { ValueBox.LinkageData = {}; } if (data.length != 0) { ValueBox.LinkageData[Data.ID] = data; } else { delete ValueBox.LinkageData[Data.ID]; } if (ControlBox.isConnected) { if (ControlBox.datetimeLinkage > this.datetime) { return; } ControlBox.datetimeLinkage = this.datetime; Call(data); } }, false); } ValueBox.Changed.push(fChanged); } else { _FrmDesigner.UseSource(Data.Linkage.FormID, changde); } _FrmDesigner.OnSourceDataChanged(func, true); } function LinkageItem(ControlBox) { var Data = ControlBox.dataCtrl.Data; var _FrmDesigner = FrmDesigner.GetInstance(ControlBox); var CurBox = Data.ParentID == null ? ControlBox : FrmDesigner.getElementById(Data.ParentID, _FrmDesigner.designerDiv); var Sel = ControlBox.Select; var ValueBox = LinkageBox(ControlBox); var prefix = Data.SourceType == "数据联动" ? "DataField_" : ""; var TempIDs = []; var UnionField2 = CLApp.getFieldInfo(Data.Linkage.UnionFieldID2); var className = ControlBox.dataCtrl.Name; var className2 = UnionField2 == null ? "" : UnionField2.className; var Wheres = GetWheres(ControlBox); if (Wheres == null) { Wheres = []; } var firsrSet = false; function LinkageFun(Box, bSet, IsMark, End) { if (_FrmDesigner.HasSourceChanged(Data.Linkage.FormID)) { return; } if (Box != null && Box.dataCtrl.Data.ID != Data.Linkage.CurFieldID && !IsMark) { return; } if (!ControlBox.isConnected) { if (ValueBox != null) { } if (ValueBox != null && ValueBox.LinkageData != null && ValueBox.LinkageData[Data.ID]) { if (End) { End(); } return; } } else { Wheres = GetWheres(ControlBox); if (Wheres == null) { Wheres = []; } } var fun = Data.SourceType == "数据联动" ? getFormDataByIdAndWheres : getFormDataByIdAndWheresFromSource; fun.call({ datetime: new Date(), Initialized: ControlBox.Initialized, Initializing: _FrmDesigner.Initializing }, _FrmDesigner, Data.Linkage.FormID, Wheres, function (data) { if (this.datetime < Sel.Items.datetime) { if (End) { End(); } return; } Sel.Items.datetime = this.datetime; if (ValueBox != null) { if (ValueBox.LinkageData == null) { ValueBox.LinkageData = {}; } ValueBox.LinkageData[Data.ID] = data; } if (!ControlBox.isConnected) { return; } Sel.Items.splice(0); if (bSet != true && this.Initialized == ControlBox.Initialized && !this.Initializing) { Sel.selectedIndex = -1; } var index = -1; for (var i = 0; i < data.length ; i++) { var Val = data[i][prefix + Data.Linkage.UnionFieldID2]; if (Val == null) { continue; } if (className2 == "下拉复选框" || className2 == "复选框组") { var Val = JSON.parse(Val); for (var j = 0; Val != null && j < Val.length ; j++) { if (Sel.Items.indexOf(Val[j]) < 0) { Sel.AddItems([ Val[j].toString() ]); } } } else { if (Sel.Items.indexOf(Val) < 0) { Sel.AddItems([ Val.toString() ]); if (data[i].Selected) { index = Sel.Items.length - 1; } } } } if (className == "下拉框" && index != -1 && !Sel.GetValue() && !firsrSet) { Sel.selectedIndex = index; } firsrSet = true; if (ControlBox.OnItemChanged) { ControlBox.OnItemChanged(); } if (End) { End(); } }, IsMark); } if (ValueBox != null) { ValueBox.Changed.push(LinkageFun); if (Data.SourceType == "数据联动") { ValueBox.OnInitializeds.push(function () { LinkageFun(ValueBox, true); }); } else { _FrmDesigner.UseSource(Data.Linkage.FormID, function () { LinkageFun(null, firsrSet, true) }); } } if (ValueBox != null) { if (ControlBox.dataCtrl.Data.ParentID != null && ValueBox.LinkageData != null && ValueBox.LinkageData[Data.ID] != null && ValueBox.LinkageData[Data.ID][0] != null) { var LinkageData = ValueBox.LinkageData[Data.ID]; Sel.Items.splice(0); Sel.selectedIndex = -1; for (var i = 0; i < LinkageData.length ; i++) { var Val = LinkageData[i][prefix + Data.Linkage.UnionFieldID2]; if (className2 == "下拉复选框" || className2 == "复选框组") { Val = JSON.parse(Val); for (var j = 0; Val != null && j < Val.length ; j++) { if (Sel.Items.indexOf(Val[j]) < 0) { Sel.AddItems([ Val[j].toString() ]); } } } else { if (Sel.Items.indexOf(LinkageData[i][prefix + Data.Linkage.UnionFieldID2]) < 0) { Sel.AddItems([ LinkageData[i][prefix + Data.Linkage.UnionFieldID2].toString() ]); } } } } else { ControlBox.Select.getItems = function (Success) { LinkageFun(null, true, true, function () { Success(ControlBox.Select.Items); }); } } } else { if (Data.Linkage.CurFieldID != null) { var msg = "不好了,被引用的控件找不到了,当前控件:【" + Data.Name + "】"; CLShowMsg(msg); return; } else { if (Data.SourceType == "数据联动") { LinkageFun(null, true); } else { ControlBox.Select.getItems = function (Success) { LinkageFun(null, true, true, function () { Success(ControlBox.Select.Items); }); } } } } //数据源触发 _FrmDesigner.OnSourceDataChanged(function (sourceIds) { if (sourceIds.indexOf(Data.Linkage.FormID) >= 0) { LinkageFun(null, firsrSet, true); } }); } function Linkage(ControlBox, Call) { var Data = ControlBox.dataCtrl.Data; var Form = CLApp.getFormById(Data.Linkage.FormID); if (Form == null) { return; } var ValueBox = LinkageBox(ControlBox); if (ValueBox != null) { if (ControlBox.dataCtrl.Data.ParentID != null && ValueBox.LinkageData != null && ValueBox.LinkageData[Data.ID] != null) { ControlBox.Value = ValueBox.LinkageData[Data.ID][0]["DataField_" + Data.Linkage.UnionFieldID2]; } var fChanged = function (Box) { if (!ControlBox.isConnected) { return; } if (ValueBox.Value == null) { ControlBox.Value = null; return; } if (Box != null && Box.dataCtrl.Data.ID != Data.Linkage.CurFieldID) { return; } var Wheres = GetWheres(ControlBox); if (Wheres == null) { Wheres = []; } getFormDataByIdAndWheres.call({ Initialized: !!Box.Initialized }, FrmDesigner.GetInstance(ControlBox), Data.Linkage.FormID, Wheres, function (data) { if (!this.Initialized && ControlBox.Initialized) { return; } if (Box.LinkageData == null) { Box.LinkageData = {}; } if (data.length != 0) { Box.LinkageData[Data.ID] = data; } else { delete Box.LinkageData[Data.ID]; } Call(data); }); } ValueBox.Changed.push(fChanged); if (ValueBox.Value != null) { fChanged(ValueBox); } } else { if (Data.Linkage.CurFieldID == null) { var Wheres = GetWheres(ControlBox); if (Wheres == null) { Wheres = []; } getFormDataByIdAndWheres.call({ Initialized: false }, FrmDesigner.GetInstance(ControlBox), Data.Linkage.FormID, Wheres, function (data) { if (!this.Initialized && ControlBox.Initialized) { return; } Call(data); }); } else { var msg = "不好了,被引用的控件找不到了,当前控件:【" + Data.Name + "】"; CLShowMsg(msg); } } } window.FrmCtrls = {}; FrmCtrls.CtrlDefCode = function (ControlBox) { var Data = ControlBox.dataCtrl.Data; var Marks = Data.DefVal.Marks; if (Marks != null && FrmCoderEditor.MarksLength(Marks) != 0) { FieldDatas = []; var bHasNull = false; function doMark(Mark) { var ID = null; if (Mark.FieldData.className == "角色") { return; } if (Mark.FieldData.className == "摄像头") { if (!ControlBox.isConnected) { return; } ControlBox.CameraChange = function () { ControlBox.Value = FrmCoderEditor.RunCode.call(ControlBox, Data.DefVal.runCode, Data, { Name: "摄像头" }); } return; } if (FieldDatas.indexOf(Mark.FieldData.ID) >= 0) { return; } FieldDatas.push(Mark.FieldData.ID); ID = Mark.FieldData.ID; if (ID == "提交按钮") { var _FrmDesigner = FrmDesigner.GetInstance(ControlBox); if (_FrmDesigner == null) { return; } var BeforeSubmit = _FrmDesigner.BeforeSubmit; if (BeforeSubmit == null) { return; } var fSubmit = function (Box) { if (!ControlBox.isConnected) { return; } if (Box == null || Box.dataCtrl.Data.ID == ID || Box.Deleting) { ControlBox.Value = FrmCoderEditor.RunCode.call(ControlBox, Data.DefVal.runCode, Data, Box); } } BeforeSubmit.push(fSubmit); return; } var ParentID = Mark.FieldData.ParentID; var Ele; if (ParentID != null && ParentID != Data.ParentID) { Ele = FrmDesigner.getElementById(ParentID, ControlBox); } else { Ele = FrmDesigner.getElementById(ID, ControlBox); } if (Ele != null) { var fChanged = function (Box) { if (!ControlBox.isConnected) { return; } if (Box == null || Box.dataCtrl.Data.ID == ID || Box.Deleting) { ControlBox.Value = FrmCoderEditor.RunCode.call(ControlBox, Data.DefVal.runCode, Data, Box); } } if (Ele.Changed) { Ele.Changed.push(fChanged); } } else { var msg = "不好了,被引用的控件找不到了,被引用控件:" + FrmDesigner.getCtrlNameById(ControlBox, ID) + ",当前控件:【" + Data.Name + "】"; CLShowMsg(msg); return; } if (Ele.Value == null) { bHasNull = true; } } for (var i = 0; i < Marks.length; i++) { if (Marks[i].FieldData.FormID == null) { doMark(Marks[i]); } } if (ControlBox.dataCtrl.Name == "分割线") { FrmCoderEditor.RunCode.call(ControlBox, Data.DefVal.runCode, Data); } else { if (!bHasNull) { FrmDesigner.GetInstance(ControlBox).OnCtrlPrepared(function () { var Value = FrmCoderEditor.RunCode.call(ControlBox, Data.DefVal.runCode, Data); ControlBox.Value = Value; }); } } } else { if (ControlBox.dataCtrl.Name == "分割线") { FrmCoderEditor.RunCode.call(ControlBox, Data.DefVal.runCode, Data); } else { FrmDesigner.GetInstance(ControlBox).OnCtrlPrepared(function () { var Value = FrmCoderEditor.RunCode.call(ControlBox, Data.DefVal.runCode, Data); ControlBox.Value = Value; }); } } } FrmCtrls.PicBox = function (value) { for (var i = 0; i < value.length; i++) { value[i].Ext = value[i].Name.substr(value[i].Name.lastIndexOf(".") + 1); } var _CLPreView = new CLPreView(value, 0); } FrmCtrls.g_Dynamic = g_Dynamic; FrmCtrls.g_departDynamic = g_departDynamic; FrmCtrls.PropLabel = PropLabel; FrmCtrls.PropValue = PropValue; FrmCtrls.PropBtn = PropBtn; FrmCtrls.PropSplit = PropSplit; FrmCtrls.ScanImg = ScanImg; FrmCtrls["基础字段"] = []; FrmCtrls["增强字段"] = []; FrmCtrls["高级字段"] = []; FrmCtrls.Categorys = ["基础字段", "增强字段", "高级字段"]; //基础字段 (function (单行文本) { FrmCtrls["单行文本"] = { Icon: "" , Name: "单行文本" , Init: function (Data) { if (Data.Name == null) { Data.Name = "单行文本" } if (Data.DefVal == null) { Data.DefVal = ""; } if (Data.ScanAble == null) { Data.ScanAble = false; } if (Data.ChangeAble == null) { Data.ChangeAble = true; } if (Data.Required == null) { Data.Required = false; } if (Data.RepeatAble == null) { Data.RepeatAble = true; } if (Data.Visible == null) { Data.Visible = true; } if (Data.Editable == null) { Data.Editable = true; } } , Html: function (Data) { this.Init(Data); html = "
" + Data.Name + (Data.Required ? "*" : "") + "
"; if (Data.Note != null) { html += "
" + CLHTMLSafe(Data.Note) + "
"; } var val = ""; if (Data.DefType == "自定义") { val = CLHTMLEncode(Data.DefVal == null || typeof (Data.DefVal) != "string" ? "" : Data.DefVal); } html += ""; return html; } , SubHtml: function (Data) { this.Init(Data); var val = ""; if (Data.DefType == "自定义") { val = CLHTMLEncode(Data.DefVal == null || typeof (Data.DefVal) != "string" ? "" : Data.DefVal); } var html = ""; if (Data.Visible == false) { html += "