{"remainingRequest":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\xq-web-fvue\\src\\views\\main\\organizationPermission\\OrgTree.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\src\\views\\main\\organizationPermission\\OrgTree.vue","mtime":1667327530012},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\xq-web-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\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//\n//\n//\n//\n\r\nimport styles from \"@/assets/css/element-variables.scss\";\r\nimport ucApi from \"@/api/uc.js\";\r\n\r\nconst htOrgTree = () => import(\"./HtOrgTree.vue\");\r\nexport default {\r\n  name: \"org-tree\",\r\n  components: {\r\n    htOrgTree\r\n  },\r\n  props: {\r\n    width: {\r\n      type: String,\r\n      default: styles.aside_width\r\n    },\r\n    defId: {\r\n      type: String,\r\n      required: true\r\n    },\r\n    supportFilter: {\r\n      type: Boolean,\r\n      default: true\r\n    },\r\n    showDropdown: {\r\n      type: Boolean,\r\n      default: false\r\n    }\r\n  },\r\n  computed: {\r\n    navbarCollapseStyle: function() {\r\n      if (this.asideShow) {\r\n        return { left: parseInt(this.width) + 16 + \"px\" };\r\n      }\r\n      return { left: \"0px\" };\r\n    },\r\n    saveSysTypeUrl: function() {\r\n      return `${window.context.portal}/sys/sysType/v1/save?parentId=${\r\n        this.parentSysType.id\r\n      }&isRoot=${this.parentSysType.parentId == 0 ? 1 : 0}&isPriNode=0`;\r\n    }\r\n  },\r\n  data() {\r\n    return {\r\n      asideShow: true,\r\n      isExpand: true,\r\n      showCheckbox: false,\r\n      dialogVisible: false,\r\n      sysType: {\r\n        children: [],\r\n        icon: \"{}\",\r\n        isLeaf: \"N\",\r\n        struType: 1,\r\n        typeKey: \"\",\r\n        name: \"\"\r\n      },\r\n      parentSysType: {\r\n        name: \"\"\r\n      }\r\n    };\r\n  },\r\n  methods: {\r\n    handleNodeClick(node) {\r\n      this.$emit(\"node-click\", node);\r\n    },\r\n    check(data, checkedObj) {\r\n      this.$emit(\"check\", data, checkedObj);\r\n    },\r\n    syncTree() {\r\n      this.$refs.orgTree.loadData();\r\n    },\r\n    handleExpand() {\r\n      this.isExpand = !this.isExpand;\r\n      let elTree = this.$refs.htSysTypeTree.$refs.htTree.$refs.elTree;\r\n      for (var i = 0; i < elTree.store._getAllNodes().length; i++) {\r\n        elTree.store._getAllNodes()[i].expanded = this.isExpand;\r\n      }\r\n    },\r\n    handleCommand(command) {\r\n      let node = command.node;\r\n      let data = command.data;\r\n      let action = command.action;\r\n      switch (action) {\r\n        case \"add\":\r\n          // this.showDialog(data, action);\r\n          this.$emit(\"addOrg\", data);\r\n          break;\r\n        case \"edit\":\r\n          // this.showDialog(data, action);\r\n          this.$emit(\"editOrg\", data);\r\n          break;\r\n        case \"delete\":\r\n          this.delSysType(data);\r\n          break;\r\n        case \"syncTree\":\r\n          this.syncTree();\r\n          break;\r\n        default:\r\n          break;\r\n      }\r\n    },\r\n    showDialog(data, action) {\r\n      this.dialogVisible = true;\r\n      if (data && action == \"add\") {\r\n        this.sysType.id = \"\";\r\n        this.sysType.name = \"\";\r\n        this.sysType.typeKey = \"\";\r\n        this.parentSysType = data;\r\n        this.sysType.parentId = data.id;\r\n        this.sysType.typeGroupKey =\r\n          data.parentId == 0 ? data.typeKey : data.typeGroupKey;\r\n      }\r\n      if (data && action == \"edit\") {\r\n        this.sysType = { ...this.sysType, ...data };\r\n      }\r\n    },\r\n    delSysType(data) {\r\n      this.$confirm(`是否确定删除 [${data.name}] ?`, \"提示\", {\r\n        confirmButtonText: \"确定\",\r\n        cancelButtonText: \"取消\",\r\n        type: \"warning\"\r\n      }).then(() => {\r\n        ucApi\r\n          .deleteOrg(data.code)\r\n          .then(\r\n            data => {\r\n              if (data.state) {\r\n                this.$message({\r\n                  type: \"success\",\r\n                  message: data.message || \"删除成功\"\r\n                });\r\n                this.$refs.orgTree.loadData();\r\n              } else {\r\n                this.$message.error(data.message || \"删除成功\");\r\n              }\r\n            },\r\n            error => {\r\n              this.$message.error(error || \"删除失败\");\r\n            }\r\n          )\r\n          .catch(() => {\r\n            this.dialogVisible = false;\r\n          });\r\n      });\r\n    },\r\n    handleClose() {\r\n      this.dialogVisible = false;\r\n    },\r\n    afterSaveData() {\r\n      this.$refs.htSysTypeTree.loadData();\r\n      if (this.sysType.id) {\r\n        this.dialogVisible = false;\r\n        return;\r\n      }\r\n      this.sysType.name = \"\";\r\n      this.sysType.typeKey = \"\";\r\n      this.$confirm(\"是否继续?\", \"提示\", {\r\n        confirmButtonText: \"确定\",\r\n        cancelButtonText: \"取消\",\r\n        type: \"success\"\r\n      })\r\n        .then(() => {})\r\n        .catch(() => {\r\n          this.dialogVisible = false;\r\n        });\r\n    },\r\n    load(){\r\n      this.$refs.orgTree.loadData();\r\n    }\r\n  }\r\n};\r\n",null]}