diff --git a/src/main/webapp/static/images/404.png b/src/main/webapp/static/images/404.png new file mode 100644 index 00000000..9492d7dd Binary files /dev/null and b/src/main/webapp/static/images/404.png differ diff --git a/src/main/webapp/static/images/500.png b/src/main/webapp/static/images/500.png new file mode 100644 index 00000000..d403a74b Binary files /dev/null and b/src/main/webapp/static/images/500.png differ diff --git a/src/main/webapp/static/mdiy/index.js b/src/main/webapp/static/mdiy/index.js new file mode 100644 index 00000000..a43aae52 --- /dev/null +++ b/src/main/webapp/static/mdiy/index.js @@ -0,0 +1,260 @@ +/** + * 自定义模块前端工具 + */ +(function () { + + + let URLS = { + "config": { + "get": "/mdiy/config/get.do", + formURL: { + update: { + "url": "/mdiy/configData/update.do", + "params": {} + }, + save: { + "url": "/mdiy/configData/update.do", + "params": {} + }, + get: { + "url": "/mdiy/configData/get.do", + "params": {} + } + }, + + }, + "form": { + "get": "/mdiy/form/get.do", + formURL: { + update: { + "url": "/mdiy/formData/update.do", + "params": {} + }, + save: { + "url": "/mdiy/formData/save.do", + "params": {} + }, + get: { + "url": "/mdiy/formData/getData.do", + "params": {} + } + }, + }, + "model": { + "get": "/mdiy/model/get.do", + formURL: { + update: { + "url": "/mdiy/model/data/update.do", + "params": {} + }, + save: { + "url": "/mdiy/model/data/save.do", + "params": {} + }, + get: { + "url": "/mdiy/model/data.do", + "params": {} + } + }, + } + }; + + /** + * 获取自定义配置 + * @param configName:配置名称 + * @paramk key:配置的key值(可选),key == null 可以获取所有的配置 + * @param isSystem true 后台调用会拼接后台地址 false前台调用 + */ + function config(configName, key,isSystem) { + + var data = {configName: configName}; + + if(key != null) { + data.key = key; + } + + if(isSystem) { + return ms.http.get(ms.manager + "/mdiy/configData/getMap.do",data); + } else { + return ms.http.get(ms.base + "/mdiy/config/get.do",data); + } + + } + + + + var dict = { + /** + * 获取所有字典类型的数组集合 + * @param dictType 字典类型 支持多个类型用英文逗号隔开 + * @param isChild 子业务类型 可选 + */ + list: function(dictType, isChild) { + var _dict = { + dictType: dictType, + isChild: isChild, + } + return ms.http.get(ms.base + '/mdiy/dict/list.do', _dict); + }, + /** + * 根据字典 value 获取对应的 label + * @param dictList 字典列表 + * @param value 值 + * @returns {string|string|[{message: string, required: boolean}]|*} + */ + getLabel: function(dictList, value) { + var data = dictList.find(function (v) { + return v.dictValue == value; + }); + + if (data) { + return data.dictLabel; + } + return ""; + }, + /** + * 根据字典 label 获取对应的 value + * @param dictList 字典列表 + * @param label 值 + * @returns {string|string|[{message: string, required: boolean}]|*} + */ + getValue: function(dictList, label) { + var data = dictList.find(function (v) { + return v.dictLabel == label; + }); + + if (data) { + return data.dictValue; + } + return ""; + } + + } + + + var model = { + + /** + * 模型地址资源配置 + */ + + /** + * 配置模型 + * @param renderDomId 绑定的domid,表单会显示在dom里面 + * @param model 模型对象 示例:业务调用{modelName:模型名称},自动业务使用{id:模型编号} + * @param params 请求参数 示例:{参数名称:值} + * @param isSystem true 后台调用会拼接后台地址 false前台调用 + * @returns {Promise} + */ + config: function(renderDomId, model, params, isSystem) { + + URLS.config.formURL.get.params = params; + var urlStrs = JSON.stringify(URLS.config.formURL); + return this.render(renderDomId, model, JSON.parse(urlStrs), URLS["config"].get, isSystem); + }, + + /** + * 业务表单模型 + * @param renderDomId 绑定的domid,表单会显示在dom里面 + * @param model 模型对象 示例:业务调用{modelName:模型名称},自动业务使用{id:模型编号} + * @param params 请求参数 示例:{参数名称:值} + * @param isSystem true 后台调用会拼接后台地址 false前台调用 + * @returns {Promise} + */ + form: function(renderDomId, model, params, isSystem) { + URLS.form.formURL.get.params = params; + var urlStrs = JSON.stringify(URLS.form.formURL); + return this.render(renderDomId, model, JSON.parse(urlStrs), URLS["form"].get, isSystem); + }, + + /** + * 扩展业务模型 + * @param renderDomId 绑定的domid,表单会显示在dom里面 + * @param model 模型对象 示例:业务调用方式{modelName:模型名称}如配置的使用,自动业务使用{id:模型编号},如内容模型 + * @param params 请求参数 示例:{参数名称:值} + * @param isSystem true 后台调用会拼接后台地址 false前台调用 + * @returns {Promise} + */ + extend: function(renderDomId, model, params, isSystem) { + + URLS.model.formURL.get.params = params; + var urlStrs = JSON.stringify(URLS.model.formURL); + return this.render(renderDomId, model,JSON.parse(urlStrs) , URLS["model"].get, isSystem); + }, + + /** + * 渲染自定义模型对象 + * @param renderDomId 绑定的domid,表单会显示在dom里面 + * @param model 模型对象 示例:业务调用{modelName:模型名称},自动业务使用{id:模型编号} + * @param url 模型获取地址 + * @param isSystem true 后台调用会拼接后台地址 false前台调用 + * @returns {Promise} 返回model对象 + */ + render: function(renderDomId, model, formUrls, url, isSystem) { + // if(model.modelName!=undefined || model.modelId!=undefined){ + // return null; + // } + //查模型 + + if (isSystem) { + url = ms.manager + url; + formUrls.update.url = ms.manager + formUrls.update.url; + formUrls.save.url = ms.manager + formUrls.save.url; + formUrls.get.url = ms.manager + formUrls.get.url; + } + var modelId = 0; + var modelName = ""; + + return new Promise(function(resolve,reject) { + + ms.http.get(url, model).then(function (res) { + if (res.result && res.data) { + //因为命名规范问做容错处理 + if("undefined" != typeof formVue) { + form = formVue; + } + form.mdiyModel = res.data; + modelId = res.data.id; + modelName = res.data.modelName; + var data = JSON.parse(form.mdiyModel.modelJson); + form.$nextTick(function () { + + var modelDom = document.getElementById(renderDomId); + modelDom.innerHTML=""; + var modelDom = document.getElementById(renderDomId); + var scriptDom = document.createElement('script'); + scriptDom.innerHTML = data.script; + var divDom = document.createElement('div'); + divDom.id = 'custom-model'; + divDom.innerHTML = data.html; + modelDom.appendChild(scriptDom); + modelDom.appendChild(divDom); //初始化自定义模型并传入关联参数 + // promise抛出resolve进行外部调用自定义模型 + resolve(new custom_model({ + data: { + modelName: modelName, + modelId: modelId, + formURL: formUrls + } + })) + }); + + } + }); + }) + } + } + + var mdiy = { + dict: dict, + model: model, + config: config + } + + + if (typeof ms != "object") { + window.ms = {}; + } + window.ms.mdiy = mdiy; + window.ms.debug = false +}()); diff --git a/src/main/webapp/static/plugins/platform/ms-store.umd.min.js b/src/main/webapp/static/plugins/platform/ms-store.umd.min.js new file mode 100644 index 00000000..c5453611 --- /dev/null +++ b/src/main/webapp/static/plugins/platform/ms-store.umd.min.js @@ -0,0 +1,953 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["ms-store"] = factory(); + else + root["ms-store"] = factory(); +})((typeof self !== 'undefined' ? self : this), function() { + return /******/ (function(modules) { // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; + /******/ + /******/ // The require function + /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if(installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ } + /******/ // Create a new module (and put it into the cache) + /******/ var module = installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ }; + /******/ + /******/ // Execute the module function + /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + /******/ + /******/ // Flag the module as loaded + /******/ module.l = true; + /******/ + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } + /******/ + /******/ + /******/ // expose the modules object (__webpack_modules__) + /******/ __webpack_require__.m = modules; + /******/ + /******/ // expose the module cache + /******/ __webpack_require__.c = installedModules; + /******/ + /******/ // define getter function for harmony exports + /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if(!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); + /******/ } + /******/ }; + /******/ + /******/ // define __esModule on exports + /******/ __webpack_require__.r = function(exports) { + /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { + /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); + /******/ } + /******/ Object.defineProperty(exports, '__esModule', { value: true }); + /******/ }; + /******/ + /******/ // create a fake namespace object + /******/ // mode & 1: value is a module id, require it + /******/ // mode & 2: merge all properties of value into the ns + /******/ // mode & 4: return value when already ns object + /******/ // mode & 8|1: behave like require + /******/ __webpack_require__.t = function(value, mode) { + /******/ if(mode & 1) value = __webpack_require__(value); + /******/ if(mode & 8) return value; + /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; + /******/ var ns = Object.create(null); + /******/ __webpack_require__.r(ns); + /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); + /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); + /******/ return ns; + /******/ }; + /******/ + /******/ // getDefaultExport function for compatibility with non-harmony modules + /******/ __webpack_require__.n = function(module) { + /******/ var getter = module && module.__esModule ? + /******/ function getDefault() { return module['default']; } : + /******/ function getModuleExports() { return module; }; + /******/ __webpack_require__.d(getter, 'a', getter); + /******/ return getter; + /******/ }; + /******/ + /******/ // Object.prototype.hasOwnProperty.call + /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; + /******/ + /******/ // __webpack_public_path__ + /******/ __webpack_require__.p = ""; + /******/ + /******/ + /******/ // Load entry module and return exports + /******/ return __webpack_require__(__webpack_require__.s = "./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js"); + /******/ }) + /************************************************************************/ + /******/ ({ + + /***/ "./node_modules/@soda/get-current-script/index.js": + /*!********************************************************!*\ + !*** ./node_modules/@soda/get-current-script/index.js ***! + \********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports, __webpack_require__) { + + eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller\n// MIT license\n// source: https://github.com/amiller-gh/currentScript-polyfill\n\n// added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505\n\n(function (root, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else {}\n}(typeof self !== 'undefined' ? self : this, function () {\n function getCurrentScript () {\n var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')\n // for chrome\n if (!descriptor && 'currentScript' in document && document.currentScript) {\n return document.currentScript\n }\n\n // for other browsers with native support for currentScript\n if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {\n return document.currentScript\n }\n \n // IE 8-10 support script readyState\n // IE 11+ & Firefox support stack trace\n try {\n throw new Error();\n }\n catch (err) {\n // Find the second match for the \"at\" string to get file src url from stack.\n var ieStackRegExp = /.*at [^(]*\\((.*):(.+):(.+)\\)$/ig,\n ffStackRegExp = /@([^@]*):(\\d+):(\\d+)\\s*$/ig,\n stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),\n scriptLocation = (stackDetails && stackDetails[1]) || false,\n line = (stackDetails && stackDetails[2]) || false,\n currentLocation = document.location.href.replace(document.location.hash, ''),\n pageSource,\n inlineScriptSourceRegExp,\n inlineScriptSource,\n scripts = document.getElementsByTagName('script'); // Live NodeList collection\n \n if (scriptLocation === currentLocation) {\n pageSource = document.documentElement.outerHTML;\n inlineScriptSourceRegExp = new RegExp('(?:[^\\\\n]+?\\\\n){0,' + (line - 2) + '}[^<]*