{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\form\\FormMenusAdd.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\form\\FormMenusAdd.vue","mtime":1675071992913},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\thread-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es7.object.get-own-property-descriptors\";\nimport \"core-js/modules/es6.object.keys\";\nimport \"core-js/modules/es6.regexp.split\";\nimport \"core-js/modules/web.dom.iterable\";\nimport _defineProperty from \"D:/jenkins/workspace/xq-web-bpm/node_modules/@babel/runtime/helpers/esm/defineProperty\";\nimport \"core-js/modules/es6.function.name\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport form from \"@/api/form.js\";\nimport portal from \"@/api/portal.js\";\nimport { mapState } from \"vuex\";\nimport Treeselect from \"@riophae/vue-treeselect\";\nimport \"@riophae/vue-treeselect/dist/vue-treeselect.css\";\nexport default {\n  name: \"form-menus-add\",\n  props: [\"formId\"],\n  type: \"\",\n  components: {\n    Treeselect: Treeselect\n  },\n  data: function data() {\n    return {\n      menu: {},\n      type: \"\",\n      frontAliasPre: \"href/template/\",\n      menuTreeData: [],\n      dialogVisible: false,\n      normalizer: function normalizer(node) {\n        return {\n          id: node.id,\n          label: node.name,\n          children: node.children,\n          isDefaultExpanded: false\n        };\n      },\n      from: \"\"\n    };\n  },\n  computed: _objectSpread({}, mapState({\n    currentUser: function currentUser(state) {\n      return state.login.currentUser;\n    }\n  })),\n  watch: {\n    type: {\n      handler: function handler(newVal, oldVal) {\n        if (newVal != oldVal) {\n          this.getMenuDataByType();\n        }\n      }\n    }\n  },\n  methods: {\n    onConfirm: function onConfirm(selection) {\n      var _this = this;\n\n      if (!this.menu.parentAlias) {\n        this.$message.error(\"请选择父节点！\");\n        return;\n      }\n\n      if (!this.menu.name) {\n        this.$message.error(\"请输入菜单名!\");\n        return;\n      }\n\n      var this_ = this;\n      this_.$validator.validateAll(\"TemplateMenuForm\").then(function (result) {\n        if (result) {\n          var menu = _objectSpread({}, this_.menu);\n\n          delete menu.parentMenuName;\n          portal.saveDataTemplateToMenu(menu).then(function (rep) {\n            if (rep.state) {\n              this_.dialogVisible = false;\n\n              _this.$message.success(rep.message);\n            }\n          });\n        } else {\n          var arr = this_.$validator.errors.items.filter(function (item) {\n            return item.scope == \"TemplateMenuForm\";\n          });\n          var errorLength = arr.length;\n          this_.$message({\n            showClose: true,\n            message: \"\\u6709\".concat(errorLength, \"\\u4E2A\\u5B57\\u6BB5\\u672A\\u901A\\u8FC7\\u6821\\u9A8C\\uFF0C\\u8BF7\\u6B63\\u786E\\u586B\\u5199\\u8868\\u5355\\u5185\\u5BB9\\u3002\"),\n            type: \"warning\"\n          });\n        }\n      });\n    },\n    handleClose: function handleClose() {\n      this.dialogVisible = false;\n    },\n    getMenuDataByType: function getMenuDataByType() {\n      var _this2 = this;\n\n      var menuAlias = this.type == \"front\" ? \"front_menu\" : \"manage_menu\";\n      portal.getCurrentMenuByAlias(menuAlias).then(function (rep) {\n        if (rep.state && rep.value.length > 0) {\n          var menus = rep.value;\n\n          _this2.removeEmptyChildren(menus);\n\n          if (_this2.type != \"front\") {\n            //添加为后端菜单时如果二级菜单不是URL菜单则表单预览生成的菜单不能添加到这个菜单下面\n            //如：设计中心->业务表单  设计中心下的业务表单菜单是下级菜单不是URL菜单则表单预览生成的菜单不能添加到这个菜单下面\n            for (var i = 0; i < menus.length; i++) {\n              if (menus[i].children) {\n                for (var j = menus[i].children.length - 1; j >= 0; j--) {\n                  if (menus[i].children[j].alias.indexOf(\"href/template\") == -1) {\n                    menus[i].children.splice(j, 1);\n                  }\n                }\n              }\n            }\n          }\n\n          _this2.menuTreeData = menus;\n        }\n      });\n    },\n    removeEmptyChildren: function removeEmptyChildren(menus) {\n      var _this3 = this;\n\n      menus.forEach(function (m) {\n        if (m.children) {\n          if (m.children.length < 1) {\n            delete m.children;\n          } else {\n            //不允许选择4级菜单\n            if (m.path.split(\".\").length == 6) {\n              delete m.children;\n            } else {\n              _this3.removeEmptyChildren(m.children);\n            }\n          }\n        }\n      });\n    },\n    handleNodeClick: function handleNodeClick(node) {\n      var menuAlias = \"\";\n      var key = Date.parse(new Date()) + \"_\" + Math.ceil(Math.random() * 99999);\n      menuAlias = this.frontAliasPre + key; //后台外部菜单URL地址\n\n      this.menu.href = window.context.front + \"/previewForm/\" + this.formId + \"/true\";\n      var this_ = this;\n      portal.isMenuExist(this_.menu.alias).then(function (rep) {\n        if (rep.state) {\n          this_.menu.menuId = node.id;\n\n          if (rep.value) {\n            this_.$message.error(\"菜单别名：\" + menuAlias + \"已存在！\");\n            this_.menu.alias = \"\";\n            this_.$forceUpdate();\n          } else {\n            this_.menu.alias = menuAlias;\n            this_.menu.parentAlias = node.alias;\n            this_.$forceUpdate();\n          }\n        } else {\n          this_.$message.error(\"菜单别名校验失败！\");\n        }\n      });\n    },\n    //显示对话框\n    showDialog: function showDialog(type, from) {\n      this.menu = {};\n      this.type = type;\n\n      if (from && type == \"front\") {\n        this.from = from;\n      } else if (from && type == \"manage\") {\n        this.from = \"addManageReport\";\n      }\n\n      this.dialogVisible = true;\n    }\n  }\n};",null]}