UNPKG

efview-plus

Version:

A high quality Service UI components Library with Vue.js

1,690 lines 2.3 MB
import ViewUI, { Modal, Page } from "view-ui-plus"; import axios from "axios"; import $ from "jquery"; import Cookies from "js-cookie"; import md5 from "js-md5"; import * as XLSX from "xlsx"; import * as XLSXS from "xlsx-style-vite"; import { saveAs } from "file-saver"; import { watch, effectScope, reactive, computed, resolveComponent, openBlock, createElementBlock, normalizeStyle, createVNode, withCtx, withDirectives, createTextVNode, toDisplayString, vShow, createCommentVNode, Fragment, createBlock, renderList, createElementVNode, withKeys, withModifiers, renderSlot, createSlots, normalizeClass, defineComponent, onMounted, onBeforeUnmount, ref, nextTick, h, toRaw, unref, resolveDynamicComponent, shallowRef } from "vue"; import elementResizeDetectorMaker from "element-resize-detector"; import pako, { gzip } from "pako"; import Viewer from "viewerjs"; import { embed } from "pdfobject"; import "echarts-liquidfill"; import { VueDraggable } from "vue-draggable-plus"; import { View, Map as Map$1, Feature } from "ol"; import html2Canvas from "html2canvas"; import { Editor as Editor$1, Toolbar as Toolbar$1 } from "@wangeditor/editor-for-vue"; function oneOf(value, validList) { for (let i = 0; i < validList.length; i++) { if (value === validList[i]) { return true; } } return false; } function typeOf(obj) { const toString2 = Object.prototype.toString; const map = { "[object Boolean]": "boolean", "[object Number]": "number", "[object String]": "string", "[object Function]": "function", "[object Array]": "array", "[object Date]": "date", "[object RegExp]": "regExp", "[object Undefined]": "undefined", "[object Null]": "null", "[object Object]": "object" }; return map[toString2.call(obj)]; } function deepCopy(data) { const t = typeOf(data); let o; if (t === "array") { o = []; } else if (t === "object") { o = {}; } else { return data; } if (t === "array") { for (let i = 0; i < data.length; i++) { o.push(deepCopy(data[i])); } } else if (t === "object") { for (let i in data) { o[i] = deepCopy(data[i]); } } return o; } let common = {}; function Table_getSelection() { let selectionIndexes = []; let selectionRowKeys = []; for (let i in this.objData) { const objData = this.objData[i]; if (objData._isChecked) selectionIndexes.push(parseInt(i)); if (objData.children && objData.children.length) { selectionRowKeys = selectionRowKeys.concat(this.getSelectionChildrenRowKeys(objData, selectionRowKeys)); } } selectionRowKeys = [...new Set(selectionRowKeys)]; let selection = []; this.data.forEach((item, index) => { if (selectionIndexes.indexOf(index) > -1) { item._customIndex = index; selection = selection.concat(item); } if (item.children && item.children.length && selectionRowKeys.length) { selection = selection.concat(this.getSelectionChildren(item, selection, selectionRowKeys)); } }); selection = [...new Set(selection)]; return JSON.parse(JSON.stringify(selection)); } function Table_handleResize() { let tableWidth = this.$el.parentNode.offsetWidth; let columnsWidth = {}; let sumMinWidth = 0; let hasWidthColumns = []; let noWidthColumns = []; let noMaxWidthColumns = []; this.cloneColumns.forEach((col) => { if (col.width) { hasWidthColumns.push(col); } else { noWidthColumns.push(col); if (col.minWidth) { sumMinWidth += col.minWidth; } if (col.maxWidth) ; else { noMaxWidthColumns.push(col); } } col._width = null; }); let unUsableWidth = hasWidthColumns.map((cell) => cell.width).reduce((a, b) => a + b, 0); let usableWidth = tableWidth - unUsableWidth - sumMinWidth - (this.showVerticalScrollBar ? this.scrollBarWidth : 0) - 1; let usableLength = noWidthColumns.length; let columnWidth = 0; if (usableWidth > 0 && usableLength > 0) { columnWidth = parseInt(usableWidth / usableLength); } for (let i = 0; i < this.cloneColumns.length; i++) { const column2 = this.cloneColumns[i]; let width = columnWidth + (column2.minWidth ? column2.minWidth : 0); if (column2.width) { width = column2.width; } else { if (column2._width) { width = column2._width; } else { if (column2.minWidth > width) { width = column2.minWidth; } else if (column2.maxWidth < width) { width = column2.maxWidth; } if (usableWidth > 0) { usableWidth -= width - (column2.minWidth ? column2.minWidth : 0); usableLength--; if (usableLength > 0) { columnWidth = parseInt(usableWidth / usableLength); } else { columnWidth = 0; } } else { columnWidth = 0; } } } column2._width = width; columnsWidth[column2._index] = { width }; } if (usableWidth > 0) { usableLength = noMaxWidthColumns.length; columnWidth = parseInt(usableWidth / usableLength); for (let i = 0; i < noMaxWidthColumns.length; i++) { const column2 = noMaxWidthColumns[i]; let width = column2._width + columnWidth; if (usableLength > 1) { usableLength--; usableWidth -= columnWidth; columnWidth = parseInt(usableWidth / usableLength); } else { columnWidth = 0; } column2._width = width; columnsWidth[column2._index] = { width }; } } this.tableWidth = this.cloneColumns.map((cell) => cell._width).reduce((a, b) => a + b, 0) + (this.showVerticalScrollBar ? this.scrollBarWidth : 0) + 1; this.columnsWidth = columnsWidth; this.fixedHeader(); } function Table_highlightCurrentRow(_index, rowKey) { const objData = rowKey ? this.getDataByRowKey(rowKey) : this.objData[_index]; if (!objData) return; if (!this.highlightRow || objData._isHighlight) return; this.handleCurrentRow("highlight", _index, rowKey); } function getRandomStr(len = 32) { const $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; const maxPos = $chars.length; let str = ""; for (let i = 0; i < len; i++) { str += $chars.charAt(Math.floor(Math.random() * maxPos)); } return str; } function Table_makeColumnsId(columns) { const cloneColumns = deepCopy(columns); return cloneColumns.map((item) => { if ("children" in item) item.children = this.makeColumnsId(item.children); item.__id = getRandomStr(6); return item; }); } function TableHead_scrollBarCellClass() { let hasRightFixed = false; for (let i in this.headRows) { for (let j in this.headRows[i]) { if (this.headRows[i][j].fixed === "right") { hasRightFixed = true; break; } if (hasRightFixed) break; } } return [ { [`${this.prefixCls}-hidden`]: hasRightFixed, "efuture-table-scroll-th": true } ]; } function handleCheckClick(event, new_window = false) { if (this.to) { if (this.target === "_blank") { return false; } else { event.preventDefault(); if (this.to === "click") { this.$emit("click", event); } else { this.handleClick(new_window); } } } } function Upload_handleClick() { if (this.itemDisabled) return; if (this.$parent && this.$parent.onClick) { this.$parent.onClick(); } else { if (this.$refs.input) { this.$refs.input.click(); } } } function DatePicker_reset() { if (this.$refs.pickerPanel && this.$refs.pickerPanel.reset) { this.$refs.pickerPanel.reset(); } } function DatePicker_handleKeydown(e) { const pickerPrefixCls = "ivu-picker"; const keyCode = e.keyCode; if (keyCode === 9) { if (this.visible) { e.stopPropagation(); e.preventDefault(); if (this.isConfirm) { const selector = `.${pickerPrefixCls}-confirm > *`; const tabbable = this.$refs.drop.$el.querySelectorAll(selector); this.internalFocus = true; const element = [...tabbable][e.shiftKey ? "pop" : "shift"](); element.focus(); } else { this.handleClose(); } } else { this.focused = false; } } const arrows = [37, 38, 39, 40]; if (!this.visible && arrows.includes(keyCode)) { this.visible = true; return; } if (keyCode === 27) { if (this.visible) { e.stopPropagation(); this.handleClose(); } } if (keyCode === 13) { const timePickers = this.timeSpinnerList.map((item) => item.timeSpinner); if (timePickers.length > 0) { const columnsPerPicker = timePickers[0].showSeconds ? 3 : 2; const pickerIndex = Math.floor(this.focusedTime.column / columnsPerPicker); const value = this.focusedTime.time[pickerIndex]; timePickers[pickerIndex].chooseValue(value); return; } if (this.type.match(/range/)) { this.$refs.pickerPanel.handleRangePick(this.focusedDate, "date"); } else { const panels = this.panelTableList.map((item) => item.panelTable); const compareDate = (d) => { const sliceIndex = ["year", "month", "date"].indexOf(this.type) + 1; return [d.getFullYear(), d.getMonth(), d.getDate()].slice(0, sliceIndex).join("-"); }; const dateIsValid = panels.find(({ cells }) => { return cells.find(({ date, disabled }) => compareDate(date) === compareDate(this.focusedDate) && !disabled); }); if (dateIsValid) { if (this.modelValue === null) { this.onPick(null, false, "date"); } else { this.onPick(this.focusedDate, false, "date"); } } } } if (!arrows.includes(keyCode)) return; if (this.focusedTime.active) e.preventDefault(); this.navigateDatePanel(keyValueMapper[keyCode], e.shiftKey); } function DatePicker_handleBlur(e) { if (this.internalFocus) { this.internalFocus = false; return; } if (this.visible) { e.preventDefault(); return; } this.isFocused = false; this.onSelectionModeChange(this.type); this.internalValue = this.internalValue.slice(); this.reset(); if (this.$refs.pickerPanel) { this.$refs.pickerPanel.onToggleVisibility(false); } } const isClient = typeof window !== "undefined"; function getScroll(target, top) { const prop = top ? "pageYOffset" : "pageXOffset"; const method = top ? "scrollTop" : "scrollLeft"; let ret = target[prop]; if (isClient && typeof ret !== "number") { ret = window.document.documentElement[method]; } return ret; } function getOffset(element) { if (!isClient) return; const rect = element.getBoundingClientRect(); const scrollTop = getScroll(window, true); const scrollLeft = getScroll(window); const docEl = window.document.body; const clientTop = docEl.clientTop || 0; const clientLeft = docEl.clientLeft || 0; return { top: rect.top + scrollTop - clientTop, left: rect.left + scrollLeft - clientLeft }; } function Anchor_handleScroll(e) { this.upperFirstTitle = !!this.titlesOffsetArr[0] && e.target.scrollTop < this.titlesOffsetArr[0].offset; if (this.animating) return; const scrollTop = this.scrollContainer.scrollTop; this.getCurrentScrollAtTitleId(scrollTop); } function Affix_handleScroll() { if (!isClient) return; const affix = this.affix; const scrollTop = getScroll(window, true); const elOffset = getOffset(this.$el); const windowHeight = window.innerHeight; const elHeight = this.$el.getElementsByTagName("div")[0].offsetHeight; if (elOffset.top - this.offsetTop < scrollTop && this.offsetType == "top" && !affix) { this.affix = true; this.slotStyle = { width: this.$refs.point.clientWidth + "px", height: this.$refs.point.clientHeight + "px" }; this.slot = true; this.styles = { top: `${this.offsetTop}px` }; if (elOffset.left) { this.styles.left = `${elOffset.left}px`; } if (this.$el.offsetWidth) { this.styles.width = `${this.$el.offsetWidth}px`; } this.$emit("on-change", true); } else if (elOffset.top - this.offsetTop > scrollTop && this.offsetType == "top" && affix) { this.slot = false; this.slotStyle = {}; this.affix = false; this.styles = null; this.$emit("on-change", false); } if (elOffset.top + this.offsetBottom + elHeight > scrollTop + windowHeight && this.offsetType == "bottom" && !affix) { this.affix = true; this.styles = { bottom: `${this.offsetBottom}px`, left: `${elOffset.left}px`, width: `${this.$el.offsetWidth}px` }; this.$emit("on-change", true); } else if (elOffset.top + this.offsetBottom + elHeight < scrollTop + windowHeight && this.offsetType == "bottom" && affix) { this.affix = false; this.styles = null; this.$emit("on-change", false); } } common.initTable = function(obj) { obj.methods.getSelection = Table_getSelection; obj.methods.handleResize = Table_handleResize; obj.methods.highlightCurrentRow = Table_highlightCurrentRow; obj.methods.makeColumnsId = Table_makeColumnsId; obj.components.tableHead.methods.scrollBarCellClass = TableHead_scrollBarCellClass; }; common.initBreadcrumbItem = function(obj) { obj.mixins[0].methods.handleCheckClick = handleCheckClick; }; common.initButton = function(obj) { obj.mixins[0].methods.handleCheckClick = handleCheckClick; }; common.initCard = function(obj) { obj.mixins[0].methods.handleCheckClick = handleCheckClick; }; common.initCell = function(obj) { obj.mixins[0].methods.handleCheckClick = handleCheckClick; }; common.initMenuItem = function(obj) { obj.mixins[1].methods.handleCheckClick = handleCheckClick; }; common.initUpload = function(obj) { obj.methods.handleClick = Upload_handleClick; }; common.initDatePicker = function(obj) { obj.mixins[0].methods.reset = DatePicker_reset; obj.mixins[0].methods.handleBlur = DatePicker_handleBlur; obj.mixins[0].methods.handleKeydown = DatePicker_handleKeydown; }; common.initAffix = function(obj) { obj.methods.handleScroll = Affix_handleScroll; }; common.initAnchor = function(obj) { obj.methods.handleScroll = Anchor_handleScroll; }; common.initEview = function(ViewUI2) { common.initTable(ViewUI2.Table); common.initBreadcrumbItem(ViewUI2.BreadcrumbItem); common.initButton(ViewUI2.Button); common.initCard(ViewUI2.Card); common.initCell(ViewUI2.Cell); common.initMenuItem(ViewUI2.MenuItem); common.initUpload(ViewUI2.Upload); common.initDatePicker(ViewUI2.DatePicker); common.initAffix(ViewUI2.Affix); common.initAnchor(ViewUI2.Anchor); }; const name = "efview-plus"; const version = "2.0.6"; const title = "efviewPlus"; const description = "A high quality Service UI components Library with Vue.js"; const homepage = ""; const keywords = [ "efview", "iview", "vue", "viewui", "viewuiplus", "vue.js", "component", "components", "ui", "framework" ]; const main = "dist/efviewplus.min.js"; const typings = "types/index.d.ts"; const files = [ "dist", "src", "types" ]; const scripts = { dev: "vue-cli-service serve", build: "npm run build:prod && npm run build:style && npm run build:lang", "build:style": "gulp --gulpfile build/build-style.js", "build:prod": "vite build", "build:lang": "vite build --config build/vite.lang.config.js", lint: "vue-cli-service lint --fix" }; const repository = { type: "git", url: "" }; const author = "Tianhao"; const license = "MIT"; const bugs = { url: "" }; const dependencies = { "@vueup/vue-quill": "^1.0.0-alpha.40", "@wangeditor/editor": "^5.1.23", "@wangeditor/editor-for-vue": "^5.1.12", "async-validator": "^3.3.0", "autoprefixer-loader": "^3.2.0", axios: "^0.18.0", deepmerge: "^2.2.1", echarts: "^4.3.0", "echarts-liquidfill": "^2.0.0", "element-resize-detector": "^1.2.0", "file-saver": "^2.0.5", "good-storage": "^1.1.1", html2canvas: "^1.4.1", jquery: "^3.3.1", "js-cookie": "^2.2.0", "js-md5": "^0.7.3", ol: "^6.7.0", pako: "^1.0.3", pdfobject: "^2.3.0", "popper.js": "^1.14.6", "view-ui-plus": "^1.3.17", viewerjs: "^1.11.6", "vue-draggable-plus": "^0.5.0", vuex: "^4.0.2", xlsx: "^0.18.5", "xlsx-style-vite": "^0.0.2" }; const devDependencies = { "@vitejs/plugin-vue": "^1.9.3", "@vue/cli-plugin-babel": "~4.5.0", "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-service": "~4.5.0", "@vue/compiler-sfc": "^3.0.0", "autoprefixer-loader": "^3.2.0", "babel-cli": "^6.26.0", "babel-core": "^6.26.0", "babel-eslint": "^10.1.0", "babel-helper-vue-jsx-merge-props": "^2.0.3", "babel-loader": "^7.1.5", "babel-plugin-dynamic-import-node": "^1.2.0", "babel-plugin-import": "^1.13.3", "babel-plugin-syntax-jsx": "^6.18.0", "babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-es5-property-mutators": "^6.24.1", "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-vue-jsx": "^3.7.0", "babel-preset-env": "^1.6.1", "babel-preset-stage-3": "^6.24.1", "babel-runtime": "^6.26.0", chai: "^4.2.0", "compression-webpack-plugin": "^1.1.12", "copy-webpack-plugin": "^6.4.1", "cross-env": "^5.2.0", "css-loader": "^0.28.10", eslint: "^6.7.2", "eslint-plugin-vue": "^7.0.0-0", "extract-text-webpack-plugin": "^2.1.2", "file-loader": "^1.1.11", "friendly-errors-webpack-plugin": "^1.6.1", gulp: "^4.0.2", "gulp-autoprefixer": "^8.0.0", "gulp-clean-css": "^4.3.0", "gulp-less": "^4.0.1", "gulp-rename": "^2.0.0", "html-loader": "^0.5.5", "html-webpack-plugin": "^3.0.6", karma: "^2.0.5", "karma-chrome-launcher": "^2.2.0", "karma-coverage": "^1.1.1", "karma-mocha": "^1.3.0", "karma-sinon-chai": "^1.3.3", "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "^0.0.32", "karma-webpack": "^2.0.13", less: "^2.7.3", "less-loader": "^6.2.0", "lint-staged": "^10.5.4", lolex: "^2.7.5", mocha: "^5.0.4", "rollup-plugin-visualizer": "^5.12.0", "script-loader": "^0.7.2", sinon: "^4.4.2", "sinon-chai": "^3.3.0", "style-loader": "^0.20.2", tslint: "^5.14.0", typescript: "^3.3.4000", "uglifyjs-webpack-plugin": "^1.3.0", "url-loader": "^1.1.2", vite: "^2.6.4", "vite-plugin-compression2": "^1.3.0", "vite-plugin-importer": "^0.2.5", vue: "^3.2.47", "vue-hot-reload-api": "^2.3.4", "vue-html-loader": "^1.2.4", "vue-loader": "^17.0.0", "vue-router": "^4.0.14", "vue-style-loader": "^4.1.3", "vue-template-compiler": "^2.6.14" }; var pkg = { name, version, title, description, homepage, keywords, main, typings, files, scripts, repository, author, license, bugs, dependencies, devDependencies }; let caseMethod = {}; let OmdUrl = {}; OmdUrl.eid = "0"; OmdUrl.uid = "0"; OmdUrl.uname = "future"; OmdUrl.format = "json"; OmdUrl.appKey = "mall"; OmdUrl.portalkey = "congou"; OmdUrl.checktoken = "Y"; OmdUrl.ver = "1.0"; OmdUrl.signMethod = "MD5"; OmdUrl.secret = ""; OmdUrl.omp = "/mall-work-webin/rest"; OmdUrl.mall = "/mall-work-webin/rest"; OmdUrl.mss = "/mall-work-webin/rest"; OmdUrl.portal = "/mall-portal-rest/portalesb/ocmrest"; OmdUrl.mdm = "/ocm-mdm-webin/rest"; OmdUrl.omc = "/omc-tags-webin/rest"; OmdUrl.member = "/omc-membership-webin/rest"; OmdUrl.accnt = "/omc-accnt-webin/rest"; OmdUrl.work = "/omc-work-webin/rest"; OmdUrl.investment = "/mall-investment-webin/rest"; OmdUrl.uploadfile = "/mss-sysconf-boot/upload"; OmdUrl.delfile = "/mss-sysconf-boot/delete?filekey="; OmdUrl.downfile = "/mss-sysconf-boot/download?filekey="; OmdUrl.getfile = "/mss-sysconf-boot/filedata?"; OmdUrl.amp = "/ampOpenapiService/"; OmdUrl.uidespath = OmdUrl.amp; OmdUrl.helpUrl = "docs.sjhgo.com"; OmdUrl.mallmdm = "/mall-mdm-webin/rest"; OmdUrl.mallmaster = "/mall-master-webin/rest"; OmdUrl.portal = OmdUrl.mallmdm; OmdUrl.uiConfigExpire = 24; OmdUrl.fairyConfigExpire = 24; OmdUrl.dictExpire = 24; OmdUrl.operbilllog = "/mss-sysconf-query/rest"; OmdUrl.getCurHelpUrl = function(that) { var curHelpUrl = ""; if (that.OmdUrl.startHelp === "Y") { if (that.OmdUrl.helpType) { var modulecodeHelp = that.$Method.getUrlParam("helpindex"); var modulecodeHelpUrl = that.$Method.getLocalStorage("modulecodeHelp_" + that.OmdUrl.helpType + "_" + modulecodeHelp); if (modulecodeHelpUrl) { return modulecodeHelpUrl; } if (modulecodeHelp) { var helpUrl = that.OmdUrl.helpUrl; if (!helpUrl) { if (that.getHelpdocumenturl) { helpUrl = that.getHelpdocumenturl(); } } if (helpUrl) { let helpId = that.getHelpId(that.OmdUrl.helpType, modulecodeHelp); if (helpId) { curHelpUrl = "http://" + helpUrl + "/web/#/p/" + helpId; } else { curHelpUrl = "http://" + helpUrl + "/web/#/" + that.OmdUrl.helpType + "?page_id=" + modulecodeHelp; } } that.$Method.setLocalStorage("modulecodeHelp_" + that.OmdUrl.helpType + "_" + modulecodeHelp, curHelpUrl, that.OmdUrl.uiConfigExpire); } } } return curHelpUrl; }; caseMethod.OmdUrl = OmdUrl; caseMethod.alert = function(_strerr, _title, _flag) { if (!_flag) { _flag = "1"; } if (_strerr && typeof _strerr === "string") { _strerr = _strerr.replace(new RegExp("</xmp>", "gi"), "</txmp>"); _strerr = _strerr.replace(new RegExp("<xmp", "gi"), "<txmp"); _strerr = '<xmp style="margin: 0;white-space:break-spaces;">' + _strerr + "</xmp>"; } _flag = _flag + ""; if (_flag === "2") { Modal.error({ title: "\u7CFB\u7EDF\u8B66\u544A", content: '<div style="word-wrap:break-word">' + _strerr + "</div>" }); } else if (_flag === "3") { if (!_title) { _title = "\u6210\u529F"; } Modal.success({ title: _title, content: '<div style="word-wrap:break-word">' + _strerr + "</div>" }); } else { if (!_title) { _title = "\u63D0\u9192"; } Modal.warning({ title: _title, content: '<div style="word-wrap:break-word">' + _strerr + "</div>" }); } }; function getCommonUrlParam(_self, _param, _type) { let token = caseMethod.getToken(); let end_id = caseMethod.getEnt_id(); let para = _param; if (!para) { para = {}; } let portalkey = _self.OmdUrl.portalkey; if (!caseMethod.getUrlParam("portalkey")) { portalkey = caseMethod.getUrlParam("portalkey"); } if (caseMethod.getUrlParam("srvkey") === "cloud") { portalkey = "cloud"; } if (_type === "1") { let url = ""; if (token && token.trim() !== "") { url = url + "&ent_id=" + end_id + "&token=" + token + "&timestamp=" + new Date().getTime() + "&format=" + _self.OmdUrl.format + "&app_key=" + _self.OmdUrl.appKey + "&portalkey=" + portalkey + "&ver=" + _self.OmdUrl.ver; if (_self.OmdUrl.signMethod.trim().length !== 0 && _self.OmdUrl.secret.trim().length != 0) { url = url + "&sign_method=" + _self.OmdUrl.signMethod + "&sign="; let secret = _self.OmdUrl.appKey + "=" + _self.OmdUrl.secret + "&body=" + JSON.stringify(para).toString() + "&token=" + token; if (_self.OmdUrl.getMd5 !== void 0) { secret = _self.OmdUrl.getMd5(para, token); } url = url + md5(secret); } } else { let _session = { "ent_id": end_id, "user_id": _self.OmdUrl.uid, "user_code": _self.OmdUrl.uid, "user_name": _self.OmdUrl.uname }; url = url + "&session=" + JSON.stringify(_session); } return url; } else { let temp = {}; if (token && token.trim() !== "") { temp.ent_id = end_id; temp.token = token; temp.timestamp = new Date().getTime(); temp.format = _self.OmdUrl.format; temp.app_key = _self.OmdUrl.appKey; temp.ver = _self.OmdUrl.ver; temp.portalkey = portalkey; temp.sign_method = _self.OmdUrl.signMethod; let secret = _self.OmdUrl.appKey + "=" + _self.OmdUrl.secret + "&body=" + JSON.stringify(para).toString() + "&token=" + token; if (_self.OmdUrl.getMd5 !== void 0) { secret = _self.OmdUrl.getMd5(para, token); } temp.sign = md5(secret); } else { let _session = { "ent_id": end_id, "user_id": _self.OmdUrl.uid, "user_code": _self.OmdUrl.uid, "user_name": _self.OmdUrl.uname }; temp.session = JSON.stringify(_session); } return temp; } } function basePost(url, method, postdata, _self, _type) { let temp = {}; if (method) { temp.method = method; } let comtemp = getCommonUrlParam(_self, postdata, "2"); for (let v in comtemp) { temp[v] = comtemp[v]; } if (!postdata) { postdata = {}; } let menuCode = caseMethod.getUrlParam("menuCode"); if (menuCode) { temp.menuCode = menuCode; } if (_type === "get") { return new Promise((resolve, reject) => { axios.get(url, postdata, { params: temp }).then((response) => { resolve(response.data); }, (err) => { reject(err); }).catch((error) => { reject(error); }); }); } else { return new Promise((resolve, reject) => { axios.post(url, postdata, { params: temp }).then((response) => { resolve(response.data); }, (err) => { reject(err); }).catch((error) => { reject(error); }); }); } } function successRequest(data, _successFunc, _failFunc, _errorFunc, _self) { let obj = null; try { if (typeof data === "string") { obj = JSON.parse(data); } else { obj = data; } if (parseInt(obj.returncode) === 0) { try { if (_successFunc) { _successFunc(obj.data); } } catch (e) { if (_self.$Spin) { _self.$Spin.hide(); } _self.$nextTick(() => { setTimeout(() => { _self.alert(e, null, 2); }, 1e3); }); } return; } else if (parseInt(obj.returncode) > 0) { if (_failFunc) { try { _failFunc(obj.data); } catch (e) { if (_self.$Spin) { _self.$Spin.hide(); } _self.$nextTick(() => { setTimeout(() => { _self.alert(e, null, 2); }, 1e3); }); } return; } else { throw obj.data; } } else { if (_errorFunc) { try { _errorFunc(obj.data); } catch (e) { if (_self.$Spin) { _self.$Spin.hide(); } _self.$nextTick(() => { setTimeout(() => { _self.alert(e, null, 2); }, 1e3); }); } return; } else { throw obj.data; } } } catch (e) { if (_self.$Spin) { _self.$Spin.hide(); } _self.$nextTick(() => { setTimeout(() => { if (typeof data === "string") { _self.alert(e + "<br/>" + data, null, 2); } else { _self.alert(e, null, 2); } }, 1e3); }); } } caseMethod.asyncPost = function(url, method, postdata, _successFunc, _failFunc, _errorFunc, _type) { let _self = this; if (!url.startsWith("/")) { url = "/" + url; } basePost(url, method, postdata, _self, _type).then(function(data) { return successRequest(data, _successFunc, _failFunc, null, _self); }, function(err) { if (_failFunc) { _failFunc(err); } else { if (_self.$Spin) { _self.$Spin.hide(); } _self.$nextTick(() => { setTimeout(() => { _self.alert(err.message + "<br/>" + err.response.data, null, "2"); }, 1e3); }); } }).catch((err) => { if (_errorFunc) { _errorFunc(err); } else { if (_self.$Spin) { _self.$Spin.hide(); } let error = JSON.stringify(err); _self.$nextTick(() => { setTimeout(() => { _self.alert(error, null, "2"); }, 1e3); }); return false; } }); }; function getresturl(_baseUrl, _method, _param, _self) { let url = ""; if (_method) { url = "method=" + _method; } else { url = "method="; } let tempUrl = getCommonUrlParam(_self, _param, "1"); url = url + tempUrl; if (_baseUrl && _baseUrl.indexOf("?") != -1) { url = _baseUrl + "&" + url; } else { url = _baseUrl + "?" + url; } let menuCode = caseMethod.getUrlParam("menuCode"); if (menuCode) { url = url + "&menuCode=" + menuCode; } return encodeURI(url); } caseMethod.getResturl = getresturl; caseMethod.synchroPost = function(_baseUrl, _method, _param, _successFunc, _failFunc, _errorFunc, _type) { let _self = this; let tempType = "POST"; if (_type) { tempType = _type; } let url = getresturl(_baseUrl, _method, _param, _self); if (!url.startsWith("/")) { url = "/" + url; } $.ajaxSetup({ cache: false }); let post = { type: tempType, contentType: "text/plain; charset=UTF-8", async: false, dataType: "JSON", processData: false, success: function(data) { return successRequest(data, _successFunc, _failFunc, _errorFunc, _self); }, error: function(XMLHttpRequest2, textStatus, errorThrown) { if (_self.$Spin) { _self.$Spin.hide(); } try { let error = JSON.stringify(errorThrown); _self.alert(error, null, "2"); } catch (e) { setTimeout(() => { _self.alert(errorThrown, null, "2"); }, 1e3); } return false; } }; if (!_param) { _param = {}; } if (tempType === "POST") { post.data = JSON.stringify(_param); } else { delete post.data; } $.ajax(url, post); }; caseMethod.getOmdUrlConfig = function(_self) { $.ajax({ url: "/amp-glod/config.json", type: "GET", dataType: "json", success: function(data) { let pageData = data; let obj = {}; if (pageData) { for (let pro in pageData) { if (pageData[pro] instanceof Array) { pageData[pro].forEach((el) => { obj[el.name] = el.value; }); } else { obj[pro] = pageData[pro]; } } } _self.config.globalProperties.OmdUrl = Object.assign({}, _self.config.globalProperties.OmdUrl, obj); } }); }; caseMethod.getPortalConfig = function(_self) { $.ajax({ url: "/ampOpenapiService?method=usercenter.portal.getConfig", type: "POST", data: {}, dataType: "json", success: function(res) { if (res.returncode == 0) { if (res.data) { if (res.data.OmdUrl) { let OmdUrl2 = JSON.parse(res.data.OmdUrl); _self.config.globalProperties.OmdUrl = Object.assign({}, _self.config.globalProperties.OmdUrl, OmdUrl2); } _self.config.globalProperties.portalConfig = res.data; } } } }); }; function getCongouCookie(value) { if (!value) return ""; try { let v = JSON.parse(value); v = v.state; if (v) { return v.split(":")[1]; } else { return value; } } catch (e) { return value; } } caseMethod.getUserCode = function(v) { let that = null; if (!v) { that = this; } else { that = v; } let token = caseMethod.getToken(v); let portalkey = ""; let usercode = ""; portalkey = that.portalkey; usercode = that.OmdUrl.uid; if (token) { if (portalkey == "congou") { usercode = getCongouCookie(Cookies.get("user_code")); } else { if (Cookies.get("user_code")) { usercode = Cookies.get("user_code"); } } } return usercode; }; caseMethod.getUserName = function(v) { let that = null; if (!v) { that = this; } else { that = v; } let token = caseMethod.getToken(v); let portalkey = ""; let username = ""; portalkey = that.portalkey; username = "[" + that.OmdUrl.uid + "]" + that.OmdUrl.uname; if (token) { if (portalkey == "congou") { username = "[" + getCongouCookie(Cookies.get("user_code")) + "]" + getCongouCookie(Cookies.get("user_name")); } else { if (Cookies.get("user_code")) { username = "[" + Cookies.get("user_code") + "]" + Cookies.get("user_name"); } } } return username; }; caseMethod.getPortalMkt = function() { let obj = {}; obj.shopId = Cookies.get("shopId"); obj.shopCode = Cookies.get("shopCode"); obj.shopName = Cookies.get("shopName"); return obj; }, caseMethod.getSession = function() { let obj = {}; let user_name = caseMethod.getUserName(); let user_code = caseMethod.getUserCode(); let user_id = Cookies.get("user_id"); let ent_id = caseMethod.getEnt_id(); let token = caseMethod.getToken(); if (user_name) { obj["user_name"] = user_name; } else { obj["user_name"] = ""; } if (user_code) { obj["user_code"] = user_code; } else { obj["user_code"] = ""; } if (user_id) { obj["user_id"] = user_id; } else { obj["user_id"] = ""; } if (ent_id) { obj["ent_id"] = ent_id; } else { obj["ent_id"] = ""; } if (token) { obj["token"] = token; } else { obj["token"] = ""; } return JSON.stringify(obj); }; caseMethod.getUrlParam = function(name2) { let reg = new RegExp("(^|&)" + name2 + "=([^&]*)(&|$)"); let list = window.location.href.split("?"); let r = ""; if (list.length > 1) { r = list[1].match(reg); } if (!r) { if (list.length > 2) { r = list[2].match(reg); } } if (r) return decodeURI(r[2]); return ""; }; caseMethod.initGlobal = function(_self, _obj, isInitUser) { let OmdUrl2 = {}; if (!_self.config.globalProperties.OmdUrl) { _self.config.globalProperties.OmdUrl = {}; } if (_obj) { OmdUrl2 = Object.assign({}, _self.config.globalProperties.OmdUrl, _obj); } let portalkey = caseMethod.getUrlParam("portalkey"); if (portalkey) { OmdUrl2.portalkey = portalkey; } OmdUrl2.eid = caseMethod.getEnt_id(_self.config.globalProperties); OmdUrl2.modulecode = caseMethod.getUrlParam("modulecode"); if (!OmdUrl2.modulecode) { OmdUrl2.modulecode = caseMethod.getUrlParam("billmoduleid"); } OmdUrl2.helpindex = caseMethod.getUrlParam("helpindex"); OmdUrl2.billmoduleid = _self.config.globalProperties.modulecode; OmdUrl2.openbillno = caseMethod.getUrlParam("billno"); OmdUrl2.opentaskid = caseMethod.getUrlParam("taskid"); OmdUrl2.nocheck = caseMethod.getUrlParam("nocheck") ? caseMethod.getUrlParam("nocheck") : "N"; _self.config.globalProperties.OmdUrl = Object.assign({}, _self.config.globalProperties.OmdUrl, OmdUrl2); caseMethod.getPortalConfig(_self); }; caseMethod.getUserModuleMethod = function(curlmodulecode) { let reModuleMethod = null; let token = caseMethod.getToken(); if (!token) { return reModuleMethod; } let modulecode = ""; if (curlmodulecode) { modulecode = curlmodulecode; } else { modulecode = caseMethod.getUrlParam("modulecode"); if (!modulecode) { return reModuleMethod; } } let portalUrl = "/mall-portal-rest/portalesb/ocmrest"; if (this.OmdUrl && this.OmdUrl.portal) { portalUrl = this.OmdUrl.portal; } let srvkey = caseMethod.getUrlParam("srvkey"); if (srvkey === "cloud") { portalUrl = this.OmdUrl.mdm; } let param = {}; param.token = token; param.modulecode = modulecode; this.synchroPost(portalUrl, "runtime.modulesrivce.getUserModuleMethod", param, function(data) { reModuleMethod = data; }, null); return reModuleMethod; }; caseMethod.checkModuleByToken = function() { let powerflag = false; let token = caseMethod.getToken(); if (!token) { return powerflag; } let modulecode = caseMethod.getUrlParam("modulecode"); if (!modulecode) { return powerflag; } if (!location.pathname) { return powerflag; } if (this.portalkey != "congou") { return powerflag; } let portalUrl = "/mall-portal-rest/portalesb/ocmrest"; if (this.OmdUrl.portal) { portalUrl = this.OmdUrl.portal; } let pathname = location.pathname; let searchParam = { "token": token, "modulecode": modulecode, "execmodule": pathname }; let srvkey = caseMethod.getUrlParam("srvkey"); if (srvkey === "cloud") { portalUrl = this.OmdUrl.mdm; } let method = "runtime.modulesrivce.checkmodulebytoken"; this.synchroPost(portalUrl, method, searchParam, function(data) { if (data.flag === "-1") { powerflag = true; } }, null); return powerflag; }; caseMethod.getDict = function(str, _fields) { let fields = "code,name"; if (_fields) { fields = _fields; } let _dicData = {}; let searchParam = { fields, dict_group_code: str }; this.synchroPost(this.OmdUrl.omp, "omp.work.dict.getbydictgroupcode", searchParam, function(data) { _dicData = data; }, null); return _dicData; }; caseMethod.setQueryConfig = function(obj) { Object.assign(this.query.Config, obj); }; caseMethod.getQueryConfig = function(selectkey) { let config = null; if (this.query.Config[selectkey]) { config = JSON.parse(JSON.stringify(this.query.Config[selectkey])); } else { config = {}; } if (config.width === void 0) { if (config.isTree) { config.width = 0.3; } else { config.width = 0.4; } } if (config.height === void 0) { config.height = 0.6; } if (config.responseId === void 0) { config.responseId = config.responseCode; } if (config.manualLoad === void 0) { config.manualLoad = true; } if (config.multiSelect === void 0) { config.multiSelect = false; } if (config.showCondition === void 0) { config.showCondition = true; } if (config.isConfig) { return config; } else { if (this.query.customQueryConfig) { return this.query.customQueryConfig(config); } else { return config; } } }; caseMethod.getBillmoduleid = function(billtype) { let billmoduleid = ""; let searchParam = { "billtype": billtype, "order_field": "modeid" }; let method = "mss.base.billmain.search"; this.synchroPost(this.OmdUrl.mall, method, searchParam, function(data) { if (data && data.billmain && data.billmain.length > 0) { billmoduleid = data.billmain[0].modeid; } }, null); return billmoduleid; }; caseMethod.getBilltype = function(billmoduleid) { let billtype = ""; let searchParam = { "modeid": billmoduleid }; let method = "mss.base.billmain.search"; this.synchroPost(this.OmdUrl.mall, method, searchParam, function(data) { if (data && data.billmain && data.billmain.length > 0) { billtype = data.billmain[0].billtype; } }, null); return billtype; }; caseMethod.getHelpdocumenturl = function() { let url = ""; let searchParam = { "queryid": "select_fgetmanapara", "mpmkt": "00", "mpcode": "HELPDOCUMENTURL" }; let method = "mss.work.report.query"; this.synchroPost(this.OmdUrl.mall, method, searchParam, function(data) { if (data && data.report && data.report.length > 0) { url = data.report[0].mpvalue; } }, null); return url; }; caseMethod.getHelpId = function(helpType, helpIndex) { let helpId = ""; let para = {}; para.helpType = helpType; para.helpIndex = helpIndex; this.synchroPost(this.OmdUrl.amp, "usercenter.helpconfig.getHelpId", para, function(data) { if (data && data.helpId) { helpId = data.helpId; } }, function(data) { helpId = ""; }, function(data) { helpId = ""; }); return helpId; }; caseMethod.getConditionValue = function(name2, value, calculator, config) { let condition = {}; if (calculator === "==") { if (config.type === "DateBox") { condition[name2] = {}; let temp = {}; temp[">="] = value; if (config.vtype === "month") { temp["<"] = this.$Method.getNextMonthFirstDay(value); } else { temp["<"] = this.$Method.getTomorrow(value); } condition[name2] = temp; } else { if (name2 === "inputer" || name2 === "auditor" || name2 === "canceler") { let temp1 = {}; temp1[name2] = { "==": value }; let temp2 = {}; temp2[name2 + "_name"] = { "LIKE": "[%]" + value }; condition["$or"] = []; condition["$or"].push(temp1); condition["$or"].push(temp2); } else { condition[name2] = {}; if (value.value !== void 0) { condition[name2][calculator] = value.value; } else { condition[name2][calculator] = value; } } } } if (calculator === "LIKE") { condition[name2] = {}; condition[name2][calculator] = "%" + value + "%"; } if (calculator !== "LIKE" && calculator !== "==") { condition[name2] = {}; condition[name2][calculator] = value; } return condition; }; caseMethod.getHelpUrl = function() { let url = ""; if (this.helpindex) { let helpUrl = ""; if (this.OmdUrl.helpUrl) { helpUrl = this.OmdUrl.helpUrl; } else { helpUrl = this.getHelpdocumenturl(); } if (helpUrl) { url = "http://" + helpUrl + "/web/#/" + this.OmdUrl.helpType + "?page_id=" + this.helpindex; } } return url; }; caseMethod.getEnt_id = function(_self) { let ent_id = ""; let portalkey = ""; if (_self) { ent_id = _self.OmdUrl.eid; portalkey = _self.OmdUrl.portalkey; } else { ent_id = this.OmdUrl.eid; portalkey = this.OmdUrl.portalkey; } if (Cookies.get("ent_id") !== void 0 && Cookies.get("ent_id") !== "") { ent_id = Cookies.get("ent_id"); } else { let temp = caseMethod.getUrlParam("ent_id"); if (temp !== void 0 && temp !== "") { ent_id = temp; } } if (portalkey === "cloud") { let lock_entid = caseMethod.getUrlParam("lock_entid"); if (lock_entid !== void 0 && lock_entid !== "") { ent_id = lock_entid; } } return ent_id; }; caseMethod.getToken = function(_self) { let token = ""; if (!_self) { if (this.token) { token = this.token; } } else { if (_self.token) { token = _self.token; } } if (Cookies.get("token")) { token = Cookies.get("token"); } else { let temp = caseMethod.getUrlParam("token"); if (temp) { token = temp; } } return token; }; caseMethod.getModulecode = function() { let modulecode = ""; modulecode = caseMethod.getUrlParam("modulecode"); if (!modulecode) { modulecode = caseMethod.getUrlParam("billmoduleid"); } return modulecode; }; caseMethod.downloadFile = function(url, that) { if (!url) { return; } let xhr2 = new XMLHttpRequest(); xhr2.open("GET", url, true); xhr2.responseType = "blob"; xhr2.onload = function() { if (this.status === 200) { let blob = this.response; let reader = new FileReader(); let headerStr = decodeURI(this.getResponseHeader("content-disposition")); let filename = headerStr.replace("attachment;filename*=UTF-8''", ""); filename = filename.replace("attachment;filename=", ""); reader.readAsDataURL(blob); filename = decodeURIComponent(filename); filename = filename.replace(/\ +/g, ""); filename = filename.replace(/[\r\n]/g, ""); reader.onload = function() { let a = document.createElement("a"); a.download = filename; a.href = URL.createObjectURL(blob); $("body").append(a); that.$Spin.hide(); a.click(); $(a).remove(); }; } else { that.$Spin.hide(); that.alert("\u5BFC\u51FA\u5931\u8D25"); } }; xhr2.send(new Blob()); }; caseMethod.exportExcelback = function(that) { if (that.child) { setTimeout(that.exportExcelback(that), 100); } else { that.$Spin.hide(); } }; caseMethod.doExportExcel = function(_baseUrl, _method, _param, exportType, that) { let url = _baseUrl; if (!_param) { _param = {}; } url = getresturl(url, _method, _param, that); let _paramStr = JSON.stringify(_param); _paramStr = _paramStr.replaceAll("#", "%23"); _paramStr = _paramStr.replaceAll("&", "%26"); _paramStr = _paramStr.replaceAll("+", "%2B"); url = encodeURI(url + "&param=" + _paramStr); let userid = Cookies.get("user_id"); let user_code = Cookies.get("user_code"); if (userid) { url = url + encodeURI("&user_id=" + userid); } if (user_code) { url = url + encodeURI("&user_code=" + user_code); } that.$Spin.show({ render: (h2) => { return h2("div", "\u5BFC\u51FA\u4E2D...,\u8BF7\u52FF\u5173\u95ED!"); } }); if (!exportType) { exportType = "2"; } if (exportType === "2") { caseMethod.downloadFile(url, that); } else { const child = window.open(url, "_blank"); var loop = setInterval(function() { if (child.closed) { that.$Spin.hide(); clearInterval(loop); } }, 100); } }; caseMethod.doExportReport = function(_baseUrl, _method, _param, that) { let url = _baseUrl; if (!_param) { _param = {}; } url = getresturl(url, _method, _param, that); let _paramStr = JSON.stringify(_param); _paramStr = _paramStr.replaceAll("#", "%23"); _paramStr = _paramStr.replaceAll("&", "%26"); _paramStr = _paramStr.replaceAll("+", "%2B"); url = encodeURI(url + "&param=" + _paramStr); that.$Spin.show({ render: (h2) => { return h2("div", "\u5BFC\u51FA\u4E2D...,\u8BF7\u52FF\u5173\u95ED!"); } }); caseMethod.downloadFile(url, that); }; caseMethod.getFilesInfo = function(billno, billmoduleid, notdelfile, scenetype, callBackMethod) { let usercode = caseMethod.getUserCode(); let username = caseMethod.getUserName(); let token = caseMethod.getToken(); let url = OmdUrl.getfile + "billno=" + billno + "&billmoduleid=" + billmoduleid + "&scenetype=" + scenetype; let userInfo = "&usercode=" + usercode + "&username=" + username + "&token=" + token; if (notdelfile !== "Y") { userInfo = userInfo + "&notdelfile=N"; } else { userInfo = userInfo + "&notdelfile=Y"; } userInfo = encodeURI(userInfo); caseMethod.synchroPost(url, "", {}, (result) => { let data = []; if (result && result.length > 0) { result.forEach((el) => { let obj = Object.assign({}, {}, el); obj.filename = el.filename; obj.filekey = el.filekey; obj.downUrl = OmdUrl.downfile + obj.filekey + userInfo; obj.delUrl = OmdUrl.delfile + obj.filekey + userInfo; obj.title = obj.filename; obj.url = obj.downUrl; obj.modflag = el.modflag; data.push(obj); }); } callBackMethod(data); }, null, null, "get"); }; caseMethod.getFilesInfoByIdkey = function(idkey, callBackMethod) { let usercode = caseMethod.getUserCode(); let username = caseMethod.getUserName(); let token = caseMethod.getToken(); let url = OmdUrl.getfile + "idkey=" + idkey; let userInfo = "&usercode=" + usercode + "&username=" + username + "&token=" + token; userInfo = encodeURI(userInfo); caseMethod.synchroPost(url, "", {}, (result) => { let data = []; if (result && result.length > 0) { result.forEach((el) => { let obj = Object.assign({}, {}, el); obj.filename = el.filename; obj.filekey = el.filekey; obj.downUrl = OmdUrl.downfile + obj.filekey + userInfo; obj.delUrl = OmdUrl.delfile + obj.filekey + userInfo; obj.title = obj.filename; obj.url = obj.downUrl; obj.modflag = el.modflag; data.push(obj); }); } callBackMethod(data); }, null, null, "get"); }; caseMethod.getFileInfo = function(filekey, callBackMethod) { let usercode = caseMethod.getUserCode(); let username = caseMethod.getUserName(); let token = caseMethod.getToken(); let url = OmdUrl.getfile + "filekey=" + filekey; let userInfo = "&usercode=" + usercode + "&username=" + username + "&token=" + token; userInfo = encodeURI(userInfo); caseMethod.synchroPost(url, "", {}, (result) => { let data = []; if (result && result.length > 0) { result.forEach((el) => { let obj = Object.assign({}, {}, el); obj.filename = el.filename; obj.filekey = el.filekey; obj.downUrl = OmdUrl.downfile + obj.filekey + userInfo; obj.delUrl = OmdUrl.delfile + obj.filekey + userInfo; obj.title = obj.filename; obj.url = obj.downUrl; obj.modflag = el.modflag; data.push(obj); }); } callBackMethod(data); }, null, null, "get"); }; caseMethod.setUrlSuffix = function(url, self2) { let srvkey = caseMethod.getUrlParam("srvkey"); let token = caseMethod.getUrlParam("token"); let user_code = caseMethod.getUrlParam("usercode"); let portalkey = caseMethod.getUrlParam("portalkey"); if (url) { if (url.indexOf("?") != -1) { return url + "&token=" + token + "&srvkey=" + srvkey + "&app_key=" + self2.OmdUrl.appKey + "&secret=" + self2.OmdUrl.secret + "&portalkey=" + portalkey + "&usercode=" + user_code; } else { return url + "?token=" + token + "&srvkey=" + srvkey + "&app_key=" + self2.OmdUrl.appKey + "&secret=" + self2.OmdUrl.secret + "&portalkey=" + portalkey + "&usercode=" + user_code; } } return url; }; var _extends = Object.assign || function(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var isServer = typeof window === "undefined"; var store$1 = { version: "1.1.1", storage: !isServer ? window.localStorage : null, session: { storage: !isServer ? window.sessionStorage : null } }; var api = { set: function set(key, val2) { if (this.disabled) { return; } if (val2 === void 0) { return this.remove(key); } this.storage.setItem(key, serialize(val2)); return val2; }, get: function get(key, def) { if (this.disabled) { return def; } var val2 = deserialize(this.storage.getItem(ke