您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
宜搭插件升级工具
当前为
// ==UserScript== // @name 宜搭+ // @namespace http://tampermonkey.net/ // @version 1.2.1 // @description 宜搭插件升级工具 // @author Nicoo // @match https://*.aliwork.com/alibaba/web/*/design/* // @icon https://www.google.com/s2/favicons?sz=64&domain=aliwork.com // @grant unsafeWindow // @grant GM_setClipboard // @grant GM_addStyle // @license MIT // ==/UserScript== (function() { 'use strict'; // Your code here... var _react_18_2_0_react = { exports: {} }; var react_production_min = {}; /** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var l$1 = Symbol.for("react.element"), n$1 = Symbol.for("react.portal"), p$1 = Symbol.for("react.fragment"), q$1 = Symbol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), x = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), z = Symbol.iterator; function A(a) { if (null === a || "object" !== typeof a) return null; a = z && a[z] || a["@@iterator"]; return "function" === typeof a ? a : null; } var B = { isMounted: function() { return false; }, enqueueForceUpdate: function() {}, enqueueReplaceState: function() {}, enqueueSetState: function() {} }, C = Object.assign, D = {}; function E(a, b, e) { this.props = a; this.context = b; this.refs = D; this.updater = e || B; } E.prototype.isReactComponent = {}; E.prototype.setState = function(a, b) { if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." ); this.updater.enqueueSetState(this, a, b, "setState"); }; E.prototype.forceUpdate = function(a) { this.updater.enqueueForceUpdate(this, a, "forceUpdate"); }; function F() {} F.prototype = E.prototype; function G(a, b, e) { this.props = a; this.context = b; this.refs = D; this.updater = e || B; } var H = G.prototype = new F(); H.constructor = G; C(H, E.prototype); H.isPureReactComponent = true; var I = Array.isArray, J = Object.prototype.hasOwnProperty, K = { current: null }, L = { key: true, ref: true, __self: true, __source: true }; function M(a, b, e) { var d, c = {}, k2 = null, h = null; if (null != b) for (d in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k2 = "" + b.key), b) J.call(b, d) && !L.hasOwnProperty(d) && (c[d] = b[d]); var g = arguments.length - 2; if (1 === g) c.children = e; else if (1 < g) { for (var f2 = Array(g), m2 = 0; m2 < g; m2++) f2[m2] = arguments[m2 + 2]; c.children = f2; } if (a && a.defaultProps) for (d in g = a.defaultProps, g) void 0 === c[d] && (c[d] = g[d]); return { $$typeof: l$1, type: a, key: k2, ref: h, props: c, _owner: K.current }; } function N(a, b) { return { $$typeof: l$1, type: a.type, key: b, ref: a.ref, props: a.props, _owner: a._owner }; } function O(a) { return "object" === typeof a && null !== a && a.$$typeof === l$1; } function escape(a) { var b = { "=": "=0", ":": "=2" }; return "$" + a.replace(/[=:]/g, function(a2) { return b[a2]; }); } var P = /\/+/g; function Q(a, b) { return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36); } function R(a, b, e, d, c) { var k2 = typeof a; if ("undefined" === k2 || "boolean" === k2) a = null; var h = false; if (null === a) h = true; else switch (k2) { case "string": case "number": h = true; break; case "object": switch (a.$$typeof) { case l$1: case n$1: h = true; } } if (h) return h = a, c = c(h), a = "" === d ? "." + Q(h, 0) : d, I(c) ? (e = "", null != a && (e = a.replace(P, "$&/") + "/"), R(c, b, e, "", function(a2) { return a2; })) : null != c && (O(c) && (c = N(c, e + (!c.key || h && h.key === c.key ? "" : ("" + c.key) .replace(P, "$&/") + "/") + a)), b.push(c)), 1; h = 0; d = "" === d ? "." : d + ":"; if (I(a)) for (var g = 0; g < a.length; g++) { k2 = a[g]; var f2 = d + Q(k2, g); h += R(k2, b, e, f2, c); } else if (f2 = A(a), "function" === typeof f2) for (a = f2.call(a), g = 0; !(k2 = a.next()).done;) k2 = k2.value, f2 = d + Q(k2, g++), h += R(k2, b, e, f2, c); else if ("object" === k2) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead."); return h; } function S(a, b, e) { if (null == a) { return a; } var d = [], c = 0; R(a, d, "", "", function(a2) { return b.call(e, a2, c++); }); return d; } function T(a) { if (-1 === a._status) { var b = a._result; b = b(); b.then(function(b2) { if (0 === a._status || -1 === a._status) a._status = 1, a._result = b2; }, function(b2) { if (0 === a._status || -1 === a._status) a._status = 2, a._result = b2; }); - 1 === a._status && (a._status = 0, a._result = b); } if (1 === a._status) return a._result.default; throw a._result; } var U = { current: null }, V = { transition: null }, W = { ReactCurrentDispatcher: U, ReactCurrentBatchConfig: V, ReactCurrentOwner: K }; react_production_min.Children = { map: S, forEach: function(a, b, e) { S(a, function() { b.apply(this, arguments); }, e); }, count: function(a) { var b = 0; S(a, function() { b++; }); return b; }, toArray: function(a) { return S(a, function(a2) { return a2; }) || []; }, only: function(a) { if (!O(a)) throw Error("React.Children.only expected to receive a single React element child."); return a; } }; react_production_min.Component = E; react_production_min.Fragment = p$1; react_production_min.Profiler = r; react_production_min.PureComponent = G; react_production_min.StrictMode = q$1; react_production_min.Suspense = w; react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = W; react_production_min.cloneElement = function(a, b, e) { if (null === a || void 0 === a) { throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + "."); } var d = C({}, a.props), c = a.key, k2 = a.ref, h = a._owner; if (null != b) { void 0 !== b.ref && (k2 = b.ref, h = K.current); void 0 !== b.key && (c = "" + b.key); if (a.type && a.type.defaultProps) var g = a.type.defaultProps; for (f2 in b) J.call(b, f2) && !L.hasOwnProperty(f2) && (d[f2] = void 0 === b[f2] && void 0 !== g ? g[f2] : b[ f2]); } var f2 = arguments.length - 2; if (1 === f2) { d.children = e; } else if (1 < f2) { g = Array(f2); for (var m2 = 0; m2 < f2; m2++) g[m2] = arguments[m2 + 2]; d.children = g; } return { $$typeof: l$1, type: a.type, key: c, ref: k2, props: d, _owner: h }; }; react_production_min.createContext = function(a) { a = { $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }; a.Provider = { $$typeof: t, _context: a }; return a.Consumer = a; }; react_production_min.createElement = M; react_production_min.createFactory = function(a) { var b = M.bind(null, a); b.type = a; return b; }; react_production_min.createRef = function() { return { current: null }; }; react_production_min.forwardRef = function(a) { return { $$typeof: v, render: a }; }; react_production_min.isValidElement = O; react_production_min.lazy = function(a) { return { $$typeof: y, _payload: { _status: -1, _result: a }, _init: T }; }; react_production_min.memo = function(a, b) { return { $$typeof: x, type: a, compare: void 0 === b ? null : b }; }; react_production_min.startTransition = function(a) { var b = V.transition; V.transition = {}; try { a(); } finally { V.transition = b; } }; react_production_min.unstable_act = function() { throw Error("act(...) is not supported in production builds of React."); }; react_production_min.useCallback = function(a, b) { return U.current.useCallback(a, b); }; react_production_min.useContext = function(a) { return U.current.useContext(a); }; react_production_min.useDebugValue = function() {}; react_production_min.useDeferredValue = function(a) { return U.current.useDeferredValue(a); }; react_production_min.useEffect = function(a, b) { return U.current.useEffect(a, b); }; react_production_min.useId = function() { return U.current.useId(); }; react_production_min.useImperativeHandle = function(a, b, e) { return U.current.useImperativeHandle(a, b, e); }; react_production_min.useInsertionEffect = function(a, b) { return U.current.useInsertionEffect(a, b); }; react_production_min.useLayoutEffect = function(a, b) { return U.current.useLayoutEffect(a, b); }; react_production_min.useMemo = function(a, b) { return U.current.useMemo(a, b); }; react_production_min.useReducer = function(a, b, e) { return U.current.useReducer(a, b, e); }; react_production_min.useRef = function(a) { return U.current.useRef(a); }; react_production_min.useState = function(a) { return U.current.useState(a); }; react_production_min.useSyncExternalStore = function(a, b, e) { return U.current.useSyncExternalStore(a, b, e); }; react_production_min.useTransition = function() { return U.current.useTransition(); }; react_production_min.version = "18.2.0"; (function(module) { { module.exports = react_production_min; } })(_react_18_2_0_react); var monkeyWindow = window; var unsafeWindow = /* @__PURE__ */ (() => { return monkeyWindow.unsafeWindow; })(); var GM_addStyle = /* @__PURE__ */ (() => monkeyWindow.GM_addStyle)(); var jsxRuntime = { exports: {} }; var reactJsxRuntime_production_min = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var f = _react_18_2_0_react.exports, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true }; function q(c, a, g) { var b, d = {}, e = null, h = null; void 0 !== g && (e = "" + g); void 0 !== a.key && (e = "" + a.key); void 0 !== a.ref && (h = a.ref); for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]); if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]); return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current }; } reactJsxRuntime_production_min.Fragment = l; reactJsxRuntime_production_min.jsx = q; reactJsxRuntime_production_min.jsxs = q; (function(module) { { module.exports = reactJsxRuntime_production_min; } })(jsxRuntime); const jsx = jsxRuntime.exports.jsx; function init() { GM_addStyle( `.next-tabs-tabpane{display: none;min-height: 50px;outline: none!important;outline-offset: none!important;-webkit-box-shadow: none;box-shadow: none;padding: 12px;overflow-y: auto; max-height: calc(100vh - 138px)!important}` ); GM_addStyle( `.box-grid-1{display: grid;grid-template-columns:repeat(1,minmax(0,1fr));gap: 4px;}.jsApiItemTitle{font-size: 14px;}.jsApiItemTitle_Box{display: flex;align-items: center;gap:8px;}.jsApiItemDescription{font-size: 12px;color: rgba(31,56,88,0.4);}.jsApiItemIcon{cursor: pointer;}.jsApiItem_Box{border-radius: 4px;padding:4px;}.jsApiItem_Box:hover{background-color:rgba(31,56,88,0.04)}.jsApiIcon_Box{height:14px;}` ); GM_addStyle(`.box-grid-2{display: grid;grid-template-columns:repeat(2,minmax(0,1fr));gap: 4px;}`); GM_addStyle( `.DataSourceApi-title{display:flex;align-items: center;gap:4px;}.DataSourceApi-content{width: 600px;max-height: 350px;overflow-y: auto;background: #ffffff;border: 1px solid #ccc;border-radius: 4px;padding:16px;}.DataSourceApi-content-apiName{font-size:14px;font-weight:600;line-height:2em}.DataSourceApi-content-InterfacePath{font-size:14px;margin-bottom:4px;display:flex;align-items: center;gap:4px;}.DataSourceApi-content-requestType{border-style: solid;border-width: 1px;border-radius: 4px;padding: 1px 4px;display: inline;background-color: rgba(31,56,88,0.1);border-color: rgba(31,56,88,0.06);}` ); GM_addStyle( `.helper-entry.mode-float {-webkit-transform: rotate(-90deg);-ms-transform: rotate(-90deg);transform: rotate(90deg);left: -22px;right: auto;}.helper-entry {position: fixed;right: auto;bottom: 60px;z-index: 1000;cursor: pointer;-webkit-transition: all .3s ease-in-out;transition: all .3s ease-in-out;}` ); GM_addStyle(`.border{border-style: solid;border-width: 1px;border-color: rgba(31,56,88,0.1);border-radius: 8px; padding:12px;}`); GM_addStyle(`.input-style{width:100%}`); const yidaToolIcon = (hexColor) => { return jsx("svg", { className: "icon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", pId: "5866", width: "20", height: "20", children: [ jsx("path", { d: "M960.7 513.4c0-249.5-199.6-449.2-449.2-449.2C262 64.2 62.3 263.8 62.3 513.4c0 249.5 199.6 449.2 449.2 449.2 104.8 0 199.6-34.9 279.5-99.8 10-10 10-20 5-29.9-10-10-20-10-29.9-5-69.9 54.9-159.7 89.8-254.5 89.8-224.6 0-404.3-179.7-404.3-404.3 0-224.6 179.7-404.3 404.3-404.3 224.6 0 404.3 179.7 404.3 404.3 0 74.9-20 149.7-59.9 214.6-5 10-5 25 5 29.9 10 5 25 5 29.9-5 44.8-74.8 69.8-154.7 69.8-239.5z m0 0", pId: "5867", fill: hexColor }), jsx("path", { d: "M802 346.6L680.4 225c-9.5-9.9-22.5-15.6-36.2-15.6-13.7-0.1-26.8 5.4-36.4 15.3L214 618.4c-15.6 16.2-15.5 42 0.3 58l137.4 137.4c15.8 15.8 41.2 14.7 56.9-0.9l393.7-393.8c9.8-9.5 15.3-22.7 15.3-36.4-0.1-13.6-5.7-26.7-15.6-36.1zM383.2 774.9L252.9 644.7c-2.3-2.3-2.3-6.9 0-9.2l108.5-108.6 69.9 69.9c6.9 6.9 16.1 7 23 0.1 6.8-6.8 6.8-16-0.1-23L384.3 504l68.5-68.5 69.9 69.9c6.9 6.9 16.1 7 23 0.1 6.8-6.8 6.8-16-0.1-23l-69.9-69.9 68.5-68.5 69.9 69.9c6.9 6.9 16.1 7 23 0.1 6.8-6.8 6.8-16-0.2-23L567 321.2l59.2-59.2c6.8-6.8 16-6.8 23 0.1l116.4 116.4c6.9 6.9 7 16.1 0.1 23L392.3 774.9c-2.3 2.3-6.9 2.3-9.1 0z m0 0", pId: "5868", fill: hexColor }) ] }); } const copyIcon = (hexColor) => { return jsx("svg", { t: '1693788640006', className: "icon jsApiItemIcon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", pId: "4043", width: "14", height: "14", children: [ jsx("path", { d: "M96.1 575.7a32.2 32.1 0 1 0 64.4 0 32.2 32.1 0 1 0-64.4 0Z", pId: "4044", fill: hexColor }), jsx("path", { d: "M742.1 450.7l-269.5-2.1c-14.3-0.1-26 13.8-26 31s11.7 31.3 26 31.4l269.5 2.1c14.3 0.1 26-13.8 26-31s-11.7-31.3-26-31.4zM742.1 577.7l-269.5-2.1c-14.3-0.1-26 13.8-26 31s11.7 31.3 26 31.4l269.5 2.1c14.3 0.2 26-13.8 26-31s-11.7-31.3-26-31.4z", pId: "4045", fill: hexColor }), jsx("path", { d: "M736.1 63.9H417c-70.4 0-128 57.6-128 128h-64.9c-70.4 0-128 57.6-128 128v128c-0.1 17.7 14.4 32 32.2 32 17.8 0 32.2-14.4 32.2-32.1V320c0-35.2 28.8-64 64-64H289v447.8c0 70.4 57.6 128 128 128h255.1c-0.1 35.2-28.8 63.8-64 63.8H224.5c-35.2 0-64-28.8-64-64V703.5c0-17.7-14.4-32.1-32.2-32.1-17.8 0-32.3 14.4-32.3 32.1v128.3c0 70.4 57.6 128 128 128h384.1c70.4 0 128-57.6 128-128h65c70.4 0 128-57.6 128-128V255.9l-193-192z m0.1 63.4l127.7 128.3H800c-35.2 0-64-28.8-64-64v-64.3h0.2z m64 641H416.1c-35.2 0-64-28.8-64-64v-513c0-35.2 28.8-64 64-64H671V191c0 70.4 57.6 128 128 128h65.2v385.3c0 35.2-28.8 64-64 64z", pId: "4046", fill: hexColor }) ] }); } const interfaceIcon = (hexColor) => { return jsx("svg", { t: '1694410902204', className: "icon jsApiItemIcon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", pId: "7705", width: "14", height: "14", children: [ jsx("path", { d: "M952.4 71.6c9.8 9.4 10.2 24.9 0.9 34.8l-84.8 84.8 27.4 27.4c73.8 73.8 73.8 193.4 0 267.2l-82.7 82.7c-28.1 28.1-73.6 28.1-101.7 0L453.8 310.9c-28.1-28.1-28.1-73.6 0-101.7l82.7-82.7c71.1-71.1 185.5-74 260.2-6.7l7.1 6.7 29.1 29.1 84.8-84.7c8.5-8.2 21.7-9.1 31.3-2.1l3.4 2.8zM862 252.5l-92.1-92.2-6-5.7c-55.8-49.6-140.6-47.1-193.4 5.7L487.8 243c-9.4 9.4-9.4 24.5 0 33.9l257.6 257.6c9.4 9.4 24.5 9.4 33.9 0l82.7-82.7c55-55 55-144.2 0-199.3zM615.7 543.7c9.8 9.4 10.2 24.9 0.9 34.8l-61.3 61.3 42.6 42.7c28.1 28.1 28.1 73.6 0 101.7l-97.4 97.4c-79.1 79.1-206.3 82.2-289.2 7.1l-7.4-7.1-12.7-12.7-84.8 84.8c-8.5 8.2-21.7 9.1-31.2 2.1l-3.5-2.9c-8.6-8.3-10.1-21.4-3.6-31.4l2.8-3.3 84.8-84.8-14.5-14.4c-81.9-81.9-81.9-214.6 0-296.5l97.4-97.4c28.1-28.1 73.6-28.1 101.7 0l49 49 61.4-61.3c8.5-8.2 21.8-9.1 31.3-2.1l3.5 2.9c8.6 8.3 10.1 21.5 3.6 31.4l-2.7 3.3-61.4 61.3 94.6 94.7 61.3-61.3c8.5-8.2 21.7-9 31.2-2l3.6 2.7z m-51.8 172.7L306.3 458.8c-9.4-9.4-24.5-9.4-33.9 0L175 556.2c-63.2 63.2-63.2 165.6 0 228.8l62.8 62.7 6.4 6.1c64 57.3 161.6 54.6 222.3-6.1l97.4-97.4c9.4-9.3 9.4-24.5 0-33.9z", pId: "4044", fill: hexColor }) ] }); } const JsApiBox = () => { const jsApiData = [{ title: "this.reloadDataSource()", description: '重新请求所有自动加载设置为 true 的远程 API,该方法也返回一个 Promise', code: `this.reloadDataSource().then(res => {\n this.utils.toast({\n type: 'success', \n title: '刷新成功!'\n });\n });` }, { title: "this.utils.dialog()", description: '弹出对话框', code: `this.utils.dialog({\n method: 'confirm', // 'alert', 'confirm', 'show'\n title: 'title',\n content: 'content', // 如需换行可传入 HTML/JSX 来实现\n onOk: () => {},\n onCancel: () => {},\n});` }, { title: "this.utils.getDateTimeRange(when, type)", description: '获取当前或指定日期的开始结束区间时间戳', code: `//when:支持时间戳、Date 日期类型,type:'year', 'month', 'week', 'day', 'date', 'hour', 'minute', 'second'\nconst [timeStart, timeEnd] = this.utils.getDateTimeRange(when:number, type:String); ` }, { title: "this.utils.getLocale()", description: '获取当前页面的语言环境', code: `const locale = this.utils.getLocale();\n // 输出:locale: zh_CN` }, { title: "this.utils.getLoginUserId()", description: '获取登录用户userId', code: `const userId = this.utils.getLoginUserId();\n // 输出:userId` }, { title: "this.utils.getLoginUserName()", description: '获取登录用户名称', code: `const userName = this.utils.getLoginUserName();\n // 输出:userName` }, { title: "this.utils.isMobile()", description: '判断当前访问环境是否是移动端', code: `this.utils.isMobile()` }, { title: "this.utils.isSubmissionPage()", description: '判断当前页面是否是数据提交页面', code: `this.utils.isSubmissionPage()` }, { title: "this.utils.isViewPage()", description: '判断当前页面是否是数据查看页面', code: `this.utils.isViewPage()` }, { title: "this.utils.loadScript()", description: '动态加载远程脚本', code: `this.utils.loadScript('');` }, { title: "this.utils.openPage()", description: '打开新页面,如果在钉钉环境下,会使用钉钉 API 打开新页面,体验会更友好一些', code: `this.utils.openPage('');` }, { title: "this.utils.previewImage()", description: '图片预览,通过这个 API 我们可以实现一个简洁的图片预览效果', code: `this.utils.previewImage({ current: '' });` }, { title: "this.utils.toast()", description: '信息提醒,会比 Dialog 对话框更加轻量,弹出后过一段时间会自动消失', code: `this.utils.toast({\n title: 'success', // 'success', 'warning', 'error', 'notice', 'help', 'loading'\n type: 'success',\n size: 'large',\n duration: 2000, // 毫秒, type 为 loding 时无效\n});` }]; return ( jsx('div', { className: 'box-grid-1', children: [ jsApiData.map((item) => { return jsx('div', { className: 'jsApiItem_Box', children: [ jsx('div', { children: [ jsx('div', { className: 'jsApiItemTitle_Box', children: [ jsx('div', { className: 'jsApiItemTitle', children: item .title }), jsx('div', { className: 'jsApiIcon_Box', onClick: () => { if (item .code ) { GM_setClipboard (item .code ); Next.Message .show({ type: "success", title: `复制成功!` }) } else { Next.Message .show({ type: "error", title: `复制失败,请联系开发者!` }) } }, children: copyIcon( '#3c99d8' ) }) ] }), jsx('div', { className: 'jsApiItemDescription', children: item .description }), ] }) ] }) }) ] }) ) } const ComponentsBox = () => { const componentsData = [{ title: "容器", schema: `{"componentsTree":[{"componentName":"Div"}]}` }, { title: "选项卡", schema: `{"componentsTree":[{"componentName":"TabsLayout","props":{"items":[{"primaryKey":"tab_lm4jmqz1","title":{"zh_CN":"标签项","en_US":"Tab Item","type":"i18n","use":"zh_CN"},"defaultActived":true},{"primaryKey":"tab_lm4jmqz2","title":{"zh_CN":"标签项","en_US":"Tab Item","type":"i18n","use":"zh_CN"}}]},"children":[{"componentName":"Tab","props":{"primaryKey":"tab_lm4jmqz1","title":{"zh_CN":"标签项","en_US":"Tab Item","type":"i18n","use":"zh_CN"}}},{"componentName":"Tab","props":{"primaryKey":"tab_lm4jmqz2","title":{"zh_CN":"标签项","en_US":"Tab Item","type":"i18n","use":"zh_CN"}}}]}]}` }, { title: "分组", schema: `{"componentsTree":[{"componentName":"PageSection","props":{"showHeader":true,"title":{"type":"i18n","en_US":"Group","zh_CN":"分组","use":"zh_CN"}}}]}` }, { title: "按钮", schema: `{"componentsTree":[{"componentName":"Button","props":{"content":{"use":"zh_CN","en_US":"Button","zh_CN":"按 钮","type":"i18n"}}}]}` }, { title: "文本", schema: `{"componentsTree":[{"componentName":"Text","props":{"content":{"type":"i18n","en_US":"Tips content","zh_CN":"文本","use":"zh_CN"}}}]}` }, { title: "HTML", schema: `{"componentsTree":[{"componentName":"Html","props":{"content":"<div>这里可以写html</div>"}}]}` }, { title: "JSX", schema: `{"componentsTree":[{"componentName":"Jsx"}]}` }, { title: "关联表单", schema: `{"componentsTree":[{"componentName":"AssociationFormField"}]}` }]; return ( jsx('div',{ className: 'box-grid-1', children:[ jsx('div', { className: 'box-grid-2', children: [ componentsData.map((item) => { return jsx(Next.Button, { onClick: () => { if (item.schema) { GM_setClipboard(item.schema); Next.Message.show({ type: "success", title: `复制成功!` }) } else { Next.Message.show({ type: "error", title: `复制失败,请联系开发者!` }) } }, children: [ item.title ], }) }) ] }), jsx("div", { className: 'box-grid-1 border', children: [ jsx('h6',{children:'生成表格'}), jsx(Next.Form,{ size:'small', children:[ jsx(Next.Form.Item,{children:jsx(Next.Input,{valueName:'appKey',label:'AppKey',colon:true,className:'input-style',defaultValue:unsafeWindow.pageConfig.appType || unsafeWindow.g_config.appKey,onChange:(value)=>{yidaToolsData.appKey = value}})}), jsx(Next.Form.Item,{children:jsx(Next.Input,{valueName:'fromUuid',label:'FromUuid',colon:true,className:'input-style',onChange:(value)=>{yidaToolsData.fromUuid = value}})}), jsx(Next.Form.Submit,{size:'small',type:'secondary',children:'创 建',className:'input-style',onClick: (values,errors)=>{ if(!yidaToolsData.appKey){ Next.Message.show({ type: "error", title: `缺少appKey` }) } else if(!yidaToolsData.fromUuid){ Next.Message.show({ type: "error", title: `缺少fromUuid` }) } else{ fetch(`/${yidaToolsData.appKey}/query/formdesign/getLatestFormWithNavNew.json?formUuid=${yidaToolsData.fromUuid}`) .then(res => res.json()) .then(({ content: { pages } }) => { const allComponent = pages[0].componentsTree[0].children[1].children[0].children; let tableSchemaObj={"componentsTree":[{"componentName":"TablePc","props":{"noPadding":true,"columns":[],"dataSourceType":"data","data":{"currentPage":1,"totalCount":2,"data":[]},"actionColumn":[{"title":{"type":"i18n","zh_CN":"详情","en_US":"Detail","use":"zh_CN"},"option":"callback"}],"showActionBar":true,"actionBar":[{"title":{"zh_CN":"操作1","en_US":"Action 1","type":"i18n","use":"zh_CN"},"option":"callback"},{"title":{"zh_CN":"操作2","en_US":"Action 2","type":"i18n","use":"zh_CN"},"option":"callback"}],"showSearch":true,"searchBarPlaceholder":{"type":"i18n","en_US":"Please Input","zh_CN":"请搜索","use":"zh_CN"}}}]} const formComponentList = ['TextField', 'TextareaField', 'NumberField', 'RateField', 'RadioField', 'CheckboxField', 'DateField', 'CascadeDateField', 'AttachmentField', 'EmployeeField', 'ImageField', 'SelectField', 'MultiSelectField', 'CascadeSelectField', 'PageSection', 'CountrySelectField', 'DepartmentSelectField', 'AddressField', 'LocationField', 'AssociationFormField', 'DigitalSignatureField', 'SerialNumberField', 'CompanyField',] function recursiveSearch(obj) { if (typeof obj === 'object') { if (obj.hasOwnProperty('componentName')) { if (formComponentList.includes(obj.componentName)){ try { tableSchemaObj.componentsTree[0].props.columns.push({ "dataKey":'formData.'+obj.props.fieldId, "title": { "zh_CN": obj.props.label.zh_CN, "en_US": "", "type": "i18n", "use": "zh_CN" }, "width": 100, "dataType": "text" }) } catch (e) { } } if (obj.componentName ==='TableField') return; } for (let key in obj) { if (obj.hasOwnProperty(key)) { recursiveSearch(obj[key]); } } } } recursiveSearch(allComponent); GM_setClipboard(JSON.stringify(tableSchemaObj)); Next.Message.show({ type: "success", title: `生成成功,请粘贴入页面!` }) console.log(tableSchemaObj); }) } }}) ] }), ] }) ] }) ) } const CommonCodeBox = () => { const CommonCodeData = [{ title: "this.utils.formatter(when, value, type)", description: '日期格式化', code: `// 格式化日期,输出值为:2022-01-29\n const formatDate = this.utils.formatter('date', new Date(), 'YYYY-MM-DD');` }, { title: "setTimeout()", description: '定时器(单次)', code: `setTimeout(()=>{\n\n},number)` }, { title: "setTimeout()", description: '定时器(循环)', code: `// 设置一个计数器\n let count = 0;\n const interval = setInterval(() => {\n ++count;\n if (count === 5) {\n //停止\n clearInterval(interval);\n }\n }, number);` }, { title: "validateRule(idCardNumber)", description: '身份证号校验', code: `function validateRule(idCardNumber) {\n if (idCardNumber && idCardNumber.length === 18) {\n const coeff = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];\n const laststr = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];\n let total = 0;\n for(let i = 0; i < 17; ++ i) {\n total+= parseInt(idCardNumber[i], 10) * coeff[i];\n }\n return idCardNumber[17] === laststr[total % 11];\n }\n return false;\n}` }, { title: "validateRule(bankCardNumber)", description: '卡号校验「Luhn 算法」', code: `function validateRule(bankCardNumber) {\n if (bankCardNumber && /^([0-9]{16}|[0-9]{19})$/.test(bankCardNumber)) {\n let total = 0;\n bankCardNumber.split('').reverse().forEach((item, idx) => {\n const num = parseInt(item, 10);\n total += idx % 2 ? 2 * num - (num > 4 ? 9 : 0) : num;\n });\n if (total === 0) {\n return false;\n }\n return total % 10 === 0;\n }\n return false;\n}` }, { title: "validateRule(phoneNumber)", description: '手机号校验', code: `function validateRule(phoneNumber) {\n var reg = /^1\d{10}$/;\n return reg.test(value);\n}` }, { title: "maskPhoneNumber()", description: '手机号加密', code: `export function maskPhoneNumber(phoneNumber) {\n return phoneNumber.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');\n}` }, { title: "fieldsValidate()", description: '表单必填校验「JS触发事件」', code: `/**\n* 表单必填校验js事件\n*/\nexport async function onClick() {\n //组件id集合,子表视作一个元素\n const fieldList = [];\n\n // 调用表单校验函数 \n this.fieldsValidate(fieldList).then(errorList => {\n setTimeout(() => {\n if (errorList.length > 0) {\n // 表单校验未通过,你可以做一些数据错误提示\n return;\n };\n // 表单校验通过,你的后续业务逻辑由此往下写\n this.utils.toast({\n title: '表单校验通过',\n type: 'success',\n });\n });\n }, 0);\n}\n\n// fieldList:Array,需要校验组件的唯一标识集合\nexport async function fieldsValidate(fieldList = []) {\n const result = [];\n for (let i = 0; i < fieldList.length; i++) {\n await this.$(fieldList[i]).validate((errors, values) => {\n if (!errors) { return };\n result.push({\n fieldId: fieldList[i], // 组件标识\n errors: this.utils.isMobile() ? errors.errors[fieldList[i]].errors : errors[fieldList[i]].errors // 校验错误信息\n });\n });\n };\n return result;\n}` },{ title: "vConsole", description: '打开需要调试页面的动作面板,在最上方直接输入下面代码。访问进行调试。 注意调试完成后删除该代码。', code: `const vConsole = 'https://g.alicdn.com/code/lib/vConsole/3.11.2/vconsole.min.js';const js = document.createElement('script');js.src = vConsole;document.body.append(js);js.onload = function() {\n window.vConsole = new window.VConsole();};` }]; return ( jsx('div', { className: 'box-grid-1', children: [ CommonCodeData.map((item) => { return jsx('div', { className: 'jsApiItem_Box', children: [ jsx('div', { children: [ jsx('div', { className: 'jsApiItemTitle_Box', children: [ jsx('div', { className: 'jsApiItemTitle', children: item .title }), jsx('div', { className: 'jsApiIcon_Box', onClick: () => { if (item .code ) { GM_setClipboard (item .code ); Next.Message .show({ type: "success", title: `复制成功!` }) } else { Next.Message .show({ type: "error", title: `复制失败,请联系开发者!` }) } }, children: copyIcon( '#3c99d8' ) }) ] }), jsx('div', { className: 'jsApiItemDescription', children: item .description }), ] }) ] }) }) ] }) ) } const DataSourceApiBox = () => { const DataSourceApiData = [ { title: '表单相关 API', key: "1", content: [{ apiName: '新建表单实例', InterfacePath: '/v1/form/saveFormData.json', requestType: 'POST', params: [{ parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "appType", description: "应用 ID", requiredFields: "是" }, { parameterName: "formDataJson", description: "表单数据", requiredFields: "是" }] }, { apiName: '更新表单中指定组件值', InterfacePath: '/v1/form/updateFormData.json', requestType: 'POST', params: [{ parameterName: "formInstId", description: "要更新的表单数据 ID", requiredFields: "是" }, { parameterName: "updateFormDataJson", description: "要更新的表单组件值,必填", requiredFields: "是" }, { parameterName: "useLatestVersion", description: "使用最新的表单版本进行更新", requiredFields: "否" }] }, { apiName: '删除表单实例', InterfacePath: '/v1/form/deleteFormData.json', requestType: 'POST', params: [{ parameterName: "formInstId", description: "要删除的表单数据 ID", requiredFields: "是" }] }, { apiName: '根据表单实例 ID 查询表单实例详情', InterfacePath: '/v1/form/getFormDataById.json', requestType: 'GET', params: [{ parameterName: "formInstId", description: "要查询的表单数据 ID", requiredFields: "是" }] }, { apiName: '根据条件搜索表单实例 ID 列表', InterfacePath: '/v1/form/searchFormDataIds.json', requestType: 'GET', params: [{ parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "searchFieldJson", description: "根据表单内组件值查询", requiredFields: "否" }, { parameterName: "currentPage", description: "当前页", requiredFields: "否" }, { parameterName: "pageSize", description: "每页记录数", requiredFields: "否" }, { parameterName: "originatorId", description: "根据数据提交人工号查询", requiredFields: "否" }, { parameterName: "createFrom", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "createTo", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "modifiedFrom", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }, { parameterName: "modifiedTo", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }, { parameterName: "dynamicOrder", description: "排序", requiredFields: "否" }] }, { apiName: '根据条件搜索表单实例详情列表', InterfacePath: '/v1/form/searchFormDatas.json', requestType: 'GET', params: [{ parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "searchFieldJson", description: "根据表单内组件值查询", requiredFields: "否" }, { parameterName: "currentPage", description: "当前页", requiredFields: "否" }, { parameterName: "pageSize", description: "每页记录数", requiredFields: "否" }, { parameterName: "originatorId", description: "根据数据提交人工号查询", requiredFields: "否" }, { parameterName: "createFrom", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "createTo", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "modifiedFrom", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }, { parameterName: "modifiedTo", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }, { parameterName: "dynamicOrder", description: "排序", requiredFields: "否" }] }, { apiName: '获取表单定义', InterfacePath: '/v1/form/getFormComponentDefinationList.json', requestType: 'GET', params: [{ parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "version", description: "表单版本", requiredFields: "否" }] }, { apiName: '获取子表单数据', InterfacePath: '/v1/form/listTableDataByFormInstIdAndTableId.json', requestType: 'GET', params: [{ parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "formInstanceId", description: "要查询的实例的实例 ID", requiredFields: "是" }, { parameterName: "tableFieldId", description: "需要查找的子表单组件的唯一标识", requiredFields: "是" }, { parameterName: "currentPage", description: "当前页", requiredFields: "否" }, { parameterName: "pageSize", description: "每页记录数", requiredFields: "否" }] } ] }, { title: '流程相关 API', key: "2", content: [{ apiName: '流程发起', InterfacePath: '/v1/process/startInstance.json', requestType: 'POST', params: [{ parameterName: "processCode", description: "流程 code", requiredFields: "是" }, { parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "formDataJson", description: "表单数据", requiredFields: "是" }, { parameterName: "deptId", description: "发起人所在部门号", requiredFields: "否" }] }, { apiName: '根据条件搜索流程实例 ID', InterfacePath: '/v1/process/getInstanceIds.json', requestType: 'GET', params: [{ parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "searchFieldJson", description: "根据表单内组件值查询", requiredFields: "否" }, { parameterName: "taskId", description: "", requiredFields: "否" }, { parameterName: "instanceStatxus", description: "实例状态", requiredFields: "否" }, { parameterName: "approvedResult", description: "流程审批结果", requiredFields: "否" }, { parameterName: "currentPage", description: "当前页", requiredFields: "否" }, { parameterName: "pageSize", description: "每页记录数", requiredFields: "否" }, { parameterName: "originatorId", description: "根据流程发起人工号查询", requiredFields: "否" }, { parameterName: "createFrom", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "createTo", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "modifiedFrom", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }, { parameterName: "modifiedTo", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }] }, { apiName: '根据搜索条件获取实例详情列表', InterfacePath: '/v1/process/getInstances.json', requestType: 'GET', params: [{ parameterName: "formUuid", description: "表单 ID", requiredFields: "是" }, { parameterName: "searchFieldJson", description: "根据表单内组件值查询", requiredFields: "否" }, { parameterName: "taskId", description: "任务 ID", requiredFields: "否" }, { parameterName: "instanceStatus", description: "实例状态", requiredFields: "否" }, { parameterName: "approvedResult", description: "流程审批结果", requiredFields: "否" }, { parameterName: "currentPage", description: "当前页", requiredFields: "否" }, { parameterName: "pageSize", description: "每页记录数", requiredFields: "否" }, { parameterName: "originatorId", description: "根据数据提交人工号查询", requiredFields: "否" }, { parameterName: "createFrom", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "createTo", description: "createFrom 和 createTo 两个时间构造一个时间段。查询在该时间段创建的数据列表", requiredFields: "否" }, { parameterName: "modifiedFrom", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }, { parameterName: "modifiedTo", description: "modifiedFrom 和 modifiedTo 构成一个时间段,查询在该时间段有修改的数据列表", requiredFields: "否" }] }, { apiName: '根据实例 ID 获取流程实例详情', InterfacePath: '/v1/process/getInstanceById.json', requestType: 'GET', params: [{ parameterName: "processInstanceId", description: "流程实例 ID", requiredFields: "是" }] }, { apiName: '删除流程实例', InterfacePath: '/v1/process/deleteInstance.json', requestType: 'POST', params: [{ parameterName: "processInstanceId", description: "流程实例 ID", requiredFields: "是" }] }, { apiName: '终止流程实例', InterfacePath: '/v1/process/terminateInstance.json', requestType: 'POST', params: [{ parameterName: "processInstanceId", description: "流程实例 ID", requiredFields: "是" }] }, { apiName: '执行单个任务接口', InterfacePath: '/v1/task/executeTask.json', requestType: 'POST', params: [{ parameterName: "taskId", description: "任务 ID", requiredFields: "是" }, { parameterName: "procInstId", description: "实例 ID", requiredFields: "是" }, { parameterName: "outResult", description: "审批结果", requiredFields: "是" }, { parameterName: "remark", description: "审批意见", requiredFields: "是" }, { parameterName: "formDataJson", description: "表单数据", requiredFields: "否" }, { parameterName: "noExecuteExpressions", description: "是否不执行校验&关联操作", requiredFields: "否" }] }, { apiName: '获取审批记录', InterfacePath: '/v1/process/getOperationRecords.json', requestType: 'GET', params: [{ parameterName: "processInstanceId", description: "流程实例 ID", requiredFields: "是" }] }, { apiName: '流程实例更新', InterfacePath: '/v1/process/updateInstance.json', requestType: 'POST', params: [{ parameterName: "processInstanceId", description: "实例 ID", requiredFields: "是" }, { parameterName: "updateFormDataJson", description: "更新的表单数据", requiredFields: "是" }] } ] }, { title: '任务中心相关 API', key: "3", content: [{ apiName: '已提交任务', InterfacePath: '/v1/process/getMySubmitInApp.json', requestType: 'GET', params: [{ parameterName: "pageSize", description: "每页记录数", requiredFields: "是" }, { parameterName: "currentPage", description: "当前页", requiredFields: "是" }, { parameterName: "keyword", description: "关键词", requiredFields: "否" }] }, { apiName: '待办任务', InterfacePath: '/v1/task/getTodoTasksInApp.json', requestType: 'GET', params: [{ parameterName: "pageSize", description: "每页记录数", requiredFields: "是" }, { parameterName: "currentPage", description: "当前页", requiredFields: "是" }, { parameterName: "keyword", description: "关键词", requiredFields: "否" }] }, { apiName: '已完成任务', InterfacePath: '/v1/task/getDoneTasksInApp.json', requestType: 'GET', params: [{ parameterName: "pageSize", description: "每页记录数", requiredFields: "是" }, { parameterName: "currentPage", description: "当前页", requiredFields: "是" }, { parameterName: "keyword", description: "关键词", requiredFields: "否" }] }, { apiName: '抄送我的任务(应用纬度)', InterfacePath: '/v1/task/getNotifyMeTasksInApp.json', requestType: 'GET', params: [{ parameterName: "pageSize", description: "每页记录数", requiredFields: "是" }, { parameterName: "currentPage", description: "当前页", requiredFields: "是" }, { parameterName: "keyword", description: "关键词", requiredFields: "否" }] }] }]; const setDatapool = (y,name, description, method, parVariable, urlVariable) => { console.log(y,name, description, method, parVariable, urlVariable) return { "id": "", name, description, formUuid:unsafeWindow.pageConfig.formUuid, "protocal": "REMOTE", "options": { "shouldFetch": true, method, "params": parVariable ? { "type": "variable", "variable": parVariable, "value": [] } : y&&{}||[], "isSync": false, "url": urlVariable ? { "type": "variable", "variable": urlVariable, "value": "" } : {}, "loadType": "" }, "isInit": false, "dpType": "REMOTE", "type": "legao", "requestHandler": { "type": "JSExpression", "value": "this.utils.legaoBuiltin.dataSourceHandler" }, "dataHandler": { "type": "js", "source": `function(data, err) { this.setState({${name}: data}); return data; }`, "compiled": `function(data, err) { this.setState({${name}: data}); return data; }`, } } } return ( jsx('div', { children: [ jsx('div', { className: 'DataSourceApi-content-InterfacePath', children: [ jsx('div', { children: '页面路径(变量)' }), jsx('div', { className: 'jsApiIcon_Box', onClick: () => { GM_setClipboard( '`/${window.pageConfig.appType || window.g_config.appKey}`' ); Next.Message.show({ type: "success", title: `复制成功!` }) }, children: copyIcon('#3c99d8') }) ] }), jsx(Next.Menu, { openMode: "single", defaultOpenKeys: "1", embeddable: true, children: [ DataSourceApiData.map((item) => { return jsx(Next.Menu.SubMenu, { label: item.title, children: [ item.content.map((content) => { return jsx(Next.Menu .PopupItem, { label: content .apiName, triggerType: 'click', children: jsx( 'div', { className: 'DataSourceApi-content box-grid-1', children: [ jsx('div', { className: 'DataSourceApi-title', children: [ jsx('div', { className: 'DataSourceApi-content-apiName', children: content .apiName }), jsx('div', { className: 'DataSourceApi-content-requestType', children: content .requestType }) ] }), jsx('div', { className: 'DataSourceApi-content-InterfacePath', children: [ jsx('div', { children: content .InterfacePath }), jsx('div', { className: 'jsApiIcon_Box', onClick: () => { if (content .InterfacePath ) { GM_setClipboard ('`/${window.pageConfig.appType || window.g_config.appKey}' + content .InterfacePath + '`' ); Next.Message .show({ type: "success", title: `复制成功!` }) } else { Next.Message .show({ type: "error", title: `复制失败,请联系开发者!` }) } }, children: jsx(Next.Balloon,{ trigger:copyIcon('#3c99d8'), children:"复制", closable:false, align:'t' }) }), jsx('div', { className: 'jsApiIcon_Box', onClick: () => { const {project,skeleton}=AliLowCodeEngine; let projectSchema = project.getSchema(); const pl=setDatapool(true,content.InterfacePath.match(/\b([A-Za-z]+)/g)[2],content.apiName,content.requestType,null,"`/${window.pageConfig.appType || window.g_config.appKey}"+content.InterfacePath+"`") const pl2=setDatapool(false,content.InterfacePath.match(/\b([A-Za-z]+)/g)[2],content.apiName,content.requestType,null,"`/${window.pageConfig.appType || window.g_config.appKey}"+content.InterfacePath+"`") projectSchema.componentsTree[0].dataSource.list.push(pl); projectSchema.componentsTree[0].dataSource.online.push(pl2); project.setSchema(projectSchema); const dp=skeleton.getPanel('datapool'); dp.parent.remove(dp); Next.Message.show({ type: "success", title: `数据源添加成功!` }) setTimeout(()=>dp.parent.add(dp),100); }, children: jsx(Next.Balloon,{ trigger:interfaceIcon('#3c99d8'), children:"一键创建数据源(无数据)", closable:false, align:'t' }) }), jsx('div', { className: 'jsApiIcon_Box', onClick: () => { const {project,skeleton}=AliLowCodeEngine; let projectSchema = project.getSchema(); const pl=setDatapool(true,content.InterfacePath.match(/\b([A-Za-z]+)/g)[2],content.apiName,content.requestType,`{${content.params.map((param)=>{return `\n "${param.parameterName}":"",//${param.description}`})}\n}`,"`/${window.pageConfig.appType || window.g_config.appKey}"+content.InterfacePath+"`") projectSchema.componentsTree[0].dataSource.list.push(pl); projectSchema.componentsTree[0].dataSource.online.push(pl); project.setSchema(projectSchema); const dp=skeleton.getPanel('datapool'); dp.parent.remove(dp); Next.Message.show({ type: "success", title: `数据源添加成功!` }) setTimeout(()=>dp.parent.add(dp),100); }, children: jsx(Next.Balloon,{ trigger:interfaceIcon('#3c99d8'), children:"一键创建数据源(有数据)", closable:false, align:'t' }) }) ] }), jsx(Next .Table, { dataSource: content .params, children: [ jsx(Next .Table .Column, { title: "参数名", dataIndex: "parameterName" } ), jsx(Next .Table .Column, { title: "描述", dataIndex: "description" } ), jsx(Next .Table .Column, { title: "必填", dataIndex: "requiredFields" } ), jsx(Next .Table .Column, { title: "操作", cell: (value, index, record ) => { return jsx( Next .Button, { children: '复制', type: 'primary', text: true, onClick: () => { GM_setClipboard (record .parameterName ); Next.Message .show({ type: "success", title: `复制成功!` }) } } ) } } ) ] } ) ] }) }) }) ] }) }) ] }) ] }) ) } const yidaTool = () => { return ( jsx(Next.Tab, { shape: "text", children: [ jsx(Next.Tab.Item, { title: '组件', key: 1, children: ComponentsBox() }), jsx(Next.Tab.Item, { title: 'JS-API', key: 2, children: JsApiBox() }), jsx(Next.Tab.Item, { title: '跨应用数据源API', key: 3, children: DataSourceApiBox() }), jsx(Next.Tab.Item, { title: '常用代码', key: 4, children: CommonCodeBox() }) ] }) ) } AliLowCodeEngine.skeleton.add({ area: "leftArea", type: "PanelDock", name: "yidaTool", content: yidaTool, props: { align: "left", icon: yidaToolIcon("currentColor"), description: "Yida+" }, panelProps: { floatable: true, hideTitleBar: false, title: "YidaTools", width: 400, enableDrag: true } }); //复制组件按钮 AliLowCodeEngine.designerCabin.addBuiltinComponentAction({ name: "Copy", content: { icon: yidaToolIcon("#ffffff"), title: "复制唯一标识", action(node) { const fieldId = ((node == null ? void 0 : node.propsData) == null ? void 0 : node .propsData.fieldId) || node.id; GM_setClipboard(fieldId); Next.Message.show({ type: "success", title: `唯一标识:${fieldId} 复制成功!` }) } }, important: true, condition: true }); document.getElementsByClassName('lc-left-area-bottom')[0].children[0].style.display = 'block'; console.log("Yida+加载完成!") } let yidaToolsData = { appKey: unsafeWindow.pageConfig.appType || unsafeWindow.g_config.appKey, fromUuid:'' } // 设置一个计数器 let count = 0; const interval = setInterval(() => { if (unsafeWindow.LeGao && unsafeWindow.AliLowCodeEngine && unsafeWindow.__VcDeepYidaUtils__) { count++; init() } if (count) { //停止 clearInterval(interval); } }, 1e2); })();