UNPKG

ng-lib-tsx

Version:

pc端基础类库

359 lines 29.6 kB
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } var _excluded = ["outLink", "validateMenuCode"]; function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } import { getHistory, NG } from 'ng-base-stand'; import showErrorInfoModal from './showErrorInfoModal'; var global = window; export var CommonUtil = { /** * 在列表页面注册回刷事件 * @param busType 业务类型 * @param callback 回刷事件 */ onRefreshList: function onRefreshList(busType, callback) { // 兼容历史单据回刷列表(包括win框架回刷) window['NG3Refresh'] = function (type) { if (!type) { // win框架没有type参数 type = busType; } type === busType && callback(); }; if (NG.isWebFrame()) { var _window$currentPageIn; var unSets = ((_window$currentPageIn = window['currentPageInstance']) === null || _window$currentPageIn === void 0 ? void 0 : _window$currentPageIn.unSubscribeFn) || new Set(); var un = NG.getObserver().subscribe(callback, "refresh".concat(busType)); unSets.add(un); return function () { un(); delete window['NG3Refresh']; unSets.has(un) && unSets.delete(un); }; } return function () { return void 0; }; }, /** * 在编辑页面回刷列表页面 * @param busType 业务类型 * @param data 回刷数据值 */ refreshList: function refreshList(busType, data) { try { var _global$external; if (NG.isWebFrame()) { NG.getObserver().notify(data, "refresh".concat(busType)).then(); } else if ((_global$external = global.external) === null || _global$external === void 0 ? void 0 : _global$external.RefreshWebListPage) { global.external.RefreshWebListPage(); } } catch (e) { console.log(e); } }, /** * 刷新首页portal * @param portalId * @param count */ refreshPortal: function refreshPortal(portalId) { var count = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; try { if (NG.isWebFrame()) { var _Center$queryById, _Center$queryById$cal, _Center$queryById$cal2, _Center$queryById$cal3; var _NG$GetWFrame = NG.GetWFrame(), _NG$GetWFrame$Center = _NG$GetWFrame.Center, Center = _NG$GetWFrame$Center === void 0 ? {} : _NG$GetWFrame$Center; var refreshPortalApi = Center.refreshPortal || ((_Center$queryById = Center.queryById) === null || _Center$queryById === void 0 ? void 0 : (_Center$queryById$cal = _Center$queryById.call(Center, 'mainHome')) === null || _Center$queryById$cal === void 0 ? void 0 : (_Center$queryById$cal2 = _Center$queryById$cal.contentEl) === null || _Center$queryById$cal2 === void 0 ? void 0 : (_Center$queryById$cal3 = _Center$queryById$cal2.contentWindow) === null || _Center$queryById$cal3 === void 0 ? void 0 : _Center$queryById$cal3.refreshPortal); refreshPortalApi === null || refreshPortalApi === void 0 ? void 0 : refreshPortalApi(portalId, count); } else { var _global$external2, _global$external2$Ref; (_global$external2 = global.external) === null || _global$external2 === void 0 ? void 0 : (_global$external2$Ref = _global$external2.RefreshPortal) === null || _global$external2$Ref === void 0 ? void 0 : _global$external2$Ref.call(_global$external2, portalId, count + ''); } } catch (e) { console.log(e); } }, /** * 主框架中打开url地址 * @param url url地址 * @param title 标题 */ openUrl: function openUrl(url, title) { var f = NG.GetWFrame(); if (title) { url = NG.handleUrl(url, { AppTitle: encodeURIComponent(title) }); } url = NG.getAbsoluteUrl(url); // 多版本使用时,相对路径可能会有问题 if (f && f.Center) { f.Center.openTab(title || '', url); } else if (global.external && global.external['ShowExternalWebForm']) { global.external['ShowExternalWebForm'](url); //主界面中打开 } else { global.open(url, '_blank'); //主界面中打开 } }, /** * 主框架中关闭tab页 */ closeTab: function closeTab() { var _arguments = arguments; return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { var check, payload, f, closeCheck, _global$external3, tab; return _regeneratorRuntime().wrap(function _callee$(_context) { while (1) switch (_context.prev = _context.next) { case 0: check = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : true; payload = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {}; f = NG.GetWFrame(); closeCheck = window['$CloseCheck']; if (!(check && typeof closeCheck === 'function')) { _context.next = 18; break; } if (!(f && f.Center)) { _context.next = 10; break; } _context.next = 8; return closeCheck('web', f.Center.getActiveTab()); case 8: _context.next = 17; break; case 10: if (!((_global$external3 = global.external) === null || _global$external3 === void 0 ? void 0 : _global$external3.CloseSelectedTabPage)) { _context.next = 15; break; } _context.next = 13; return closeCheck('win', ''); case 13: _context.next = 17; break; case 15: _context.next = 17; return closeCheck('web', NG.getPageInstance()); case 17: return _context.abrupt("return", false); case 18: if (f && f.Center) { tab = f.Center.getComponent(payload.tab) || f.Center.getActiveTab(); tab.canClose = true; // Ext tab页标记可以关闭 f.Center.remove(tab); } else if (global.external && global.external.CloseSelectedTabPage) { global.external.CloseSelectedTabPage(true); } else { // 关闭浏览器tab页 setTimeout(function () { window.opener = null; window.open('about:blank', '_self'); window.close(); }, 500); } return _context.abrupt("return", true); case 20: case "end": return _context.stop(); } }, _callee); }))(); }, open: function open(path) { var queryParmas = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var _ref = queryParmas || {}, _ref$outLink = _ref.outLink, outLink = _ref$outLink === void 0 ? false : _ref$outLink, _ref$validateMenuCode = _ref.validateMenuCode, validateMenuCode = _ref$validateMenuCode === void 0 ? true : _ref$validateMenuCode, query = _objectWithoutProperties(_ref, _excluded); var menuCode = NG.getQueryValue('menucode'); if (validateMenuCode !== false && menuCode && !query.hasOwnProperty('menucode') && !NG.getQueryValue('menucode', { search: path })) { // 当前页面存在多模式参数,自动传递到明细页面 query.menucode = menuCode; } if (/^https?:/.test(path)) { CommonUtil.openUrl(NG.handleUrl(path, query), query === null || query === void 0 ? void 0 : query.AppTitle); return true; } var currentPath = window.location.hash.substr(1); var newPath = NG.handleUrl(path.indexOf('/') === 0 ? path : "/".concat(path), query); if (newPath === currentPath) { return false; } // 打开外部项目的路由 if (newPath.indexOf('#/') > -1 || outLink) { CommonUtil.openUrl(newPath, query === null || query === void 0 ? void 0 : query.AppTitle); return true; } // 打开当前项目路由 if (NG.isNGFrame()) { var pathname = window.location.pathname || '/'; CommonUtil.openUrl("".concat(pathname, "#").concat(newPath), query === null || query === void 0 ? void 0 : query.AppTitle); } else { getHistory().push(newPath); } return true; }, close: function close() { return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { return _regeneratorRuntime().wrap(function _callee2$(_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: if (!NG.isNGFrame()) { _context2.next = 5; break; } _context2.next = 3; return CommonUtil.closeTab(); case 3: _context2.next = 6; break; case 5: getHistory().goBack(); case 6: case "end": return _context2.stop(); } }, _callee2); }))(); }, safeRefresh: function safeRefresh(query, title) { var _f$updateTab; var pathname = getHistory().location.pathname; var lastQuery = NG.getQueryValue(''); var newQuery = _objectSpread(_objectSpread({}, lastQuery), query); var f = NG.GetWFrame(); var updateResult = (_f$updateTab = f.updateTab) === null || _f$updateTab === void 0 ? void 0 : _f$updateTab.call(f, function (currentTab) { var tmp = _defineProperty({}, currentTab, { src: NG.handleUrl(currentTab, newQuery) }); title = title || newQuery.AppTitle || newQuery.appTitle; if (title) { tmp[currentTab].title = title; } return tmp; }); if (!updateResult) { var pathUrl = window.location.pathname || '/'; window.location.href = NG.handleUrl("".concat(pathUrl, "#").concat(pathname), newQuery); window.location.reload(); } }, getUser: function getUser() { return NG.getUser(); }, /** * 处理Lform报表控件,保证模态框不被遮挡 * @param hidden 默认隐藏 * @param activeTabKey 需要处理的tabkey */ hideAF: function hideAF() { var _NG$GetWFrame2, _NG$GetWFrame2$Center, _NG$GetWFrame2$Center2, _NG$GetWFrame2$Center3; var hidden = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; var activeTabKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var afList; var iframeSrc = activeTabKey || ((_NG$GetWFrame2 = NG.GetWFrame()) === null || _NG$GetWFrame2 === void 0 ? void 0 : (_NG$GetWFrame2$Center = _NG$GetWFrame2.Center) === null || _NG$GetWFrame2$Center === void 0 ? void 0 : (_NG$GetWFrame2$Center2 = _NG$GetWFrame2$Center.getActiveTab) === null || _NG$GetWFrame2$Center2 === void 0 ? void 0 : (_NG$GetWFrame2$Center3 = _NG$GetWFrame2$Center2.call(_NG$GetWFrame2$Center)) === null || _NG$GetWFrame2$Center3 === void 0 ? void 0 : _NG$GetWFrame2$Center3.id); var iframeEl = iframeSrc ? document.querySelector("iframe[src=\"".concat(iframeSrc, "\"]")) : null; if (iframeEl) { try { afList = iframeEl.contentWindow.document.querySelectorAll('object'); } catch (err) { (err === null || err === void 0 ? void 0 : err.name) !== 'SecurityError' && console.log(err); afList = []; } } else { afList = document.querySelectorAll('object'); } try { afList.forEach(function (af) { if (NG.isFunction(af.func)) { try { af.func('grayWindow', hidden ? '1\r\n backcolor=#FFFFFF;alpha=120' : ''); } catch (e) {} } }); } catch (err) { (err === null || err === void 0 ? void 0 : err.name) !== 'SecurityError' && console.log(err); console.log(err); } }, alertError: function alertError(errorInfoPromise) { return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() { var _errorInfo, _errorInfo2, _errorInfo3; var errorInfo; return _regeneratorRuntime().wrap(function _callee3$(_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: _context3.prev = 0; _context3.next = 3; return errorInfoPromise; case 3: errorInfo = _context3.sent; _context3.next = 19; break; case 6: _context3.prev = 6; _context3.t0 = _context3["catch"](0); _context3.prev = 8; _context3.t1 = NG; _context3.next = 12; return _context3.t0.response.text(); case 12: _context3.t2 = _context3.sent; errorInfo = _context3.t1.parseJson.call(_context3.t1, _context3.t2); _context3.next = 19; break; case 16: _context3.prev = 16; _context3.t3 = _context3["catch"](8); errorInfo = { Code: 500, Msg: '请求错误,请检查网络或服务器状态' }; case 19: if (!(typeof errorInfo === 'string')) { _context3.next = 21; break; } return _context3.abrupt("return", NG.alert(errorInfo)); case 21: if (!(((_errorInfo = errorInfo) === null || _errorInfo === void 0 ? void 0 : _errorInfo.Code) === 200 || ((_errorInfo2 = errorInfo) === null || _errorInfo2 === void 0 ? void 0 : _errorInfo2.Status) === 'success' || ((_errorInfo3 = errorInfo) === null || _errorInfo3 === void 0 ? void 0 : _errorInfo3.Success) === true)) { _context3.next = 23; break; } return _context3.abrupt("return", true); case 23: if (errorInfo.Msg) { _context3.next = 25; break; } return _context3.abrupt("return"); case 25: return _context3.abrupt("return", new Promise(function (resolve) { showErrorInfoModal({ errorInfo: errorInfo, resolve: resolve }); })); case 26: case "end": return _context3.stop(); } }, _callee3, null, [[0, 6], [8, 16]]); }))(); } }; NG.registerExternal(CommonUtil);