{"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\\meta\\DataSourceManager.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\xq-web-bpm\\src\\views\\meta\\DataSourceManager.vue","mtime":1675071993006},{"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/web.dom.iterable\";\nimport \"core-js/modules/es6.regexp.replace\";\nimport \"core-js/modules/es6.function.name\";\nimport \"core-js/modules/es6.array.find-index\";\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//\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//\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//\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//\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 sys from \"@/api/portal.js\";\nimport req from \"@/request.js\";\nimport portal from \"@/api/portal.js\";\nexport default {\n  name: \"meta-dataSource\",\n  components: {},\n  data: function data() {\n    return {\n      isExpand: false,\n      dataSourceDisabled: false,\n      dataSourceTitle: \"\",\n      loadDataUrl: \"\",\n      settingDataUrl: \"\",\n      dialogVisible: false,\n      data: [],\n      pageResult: {\n        page: 1,\n        pageSize: 50,\n        total: 0\n      },\n      isSubmit: true,\n      enableds: [{\n        key: true,\n        value: \"是 \"\n      }, {\n        key: false,\n        value: \"否\"\n      }],\n      dbType: null,\n      dbTypeList: [{\n        value: \"mysql\",\n        driverName: \"com.mysql.cj.jdbc.Driver\",\n        url: \"jdbc:mysql://主机:3306/数据库名?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull\",\n        validationquery: \"select 1 from dual\"\n      }, {\n        value: \"oracle\",\n        driverName: \"oracle.jdbc.OracleDriver\",\n        url: \"jdbc:oracle:thin:@主机:1521:数据库实例\",\n        validationquery: \"select 1 from dual\"\n      }, {\n        value: \"mssql2012\",\n        driverName: \"com.microsoft.sqlserver.jdbc.SQLServerDriver\",\n        url: \"jdbc:sqlserver://主机:1433;databaseName=数据库名;\",\n        validationquery: \"select 1\"\n      }, {\n        value: \"mssql2008\",\n        driverName: \"com.microsoft.sqlserver.jdbc.SQLServerDriver\",\n        url: \"jdbc:sqlserver://主机:1433;databaseName=数据库名;\",\n        validationquery: \"select 1\"\n      }, {\n        value: \"pgsql\",\n        driverName: \"org.postgresql.Driver\",\n        url: \"jdbc:postgresql://主机:5432/数据库名\",\n        validationquery: \"select 1\"\n      }, {\n        value: \"dm8\",\n        driverName: \"dm.jdbc.driver.DmDriver\",\n        url: \"jdbc:dm://192.168.1.120:5236/EIP725_DM\",\n        validationquery: \"select 1 from dual\"\n      }, {\n        value: \"taos\",\n        driverName: \"com.taosdata.jdbc.TSDBDriver\",\n        url: \"jdbc:TAOS://主机:6030/数据库名?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8\",\n        validationquery: \"select server_status()\"\n      }],\n      sysDataSourceDefs: [],\n      dsId: \"\",\n      sourceProp: {\n        settingJson: [],\n        initOnStart: false,\n        enabled: null,\n        dbType: \"\",\n        classPath: \"\",\n        initMethod: \"\",\n        closeMethod: \"\",\n        name: \"\",\n        alias: \"\",\n        id: \"\"\n      },\n      newSourceProp: {},\n      sysDataSourceRow: {},\n      uploadDialogVisible: false,\n      fileList: [],\n      uploadUrl: window.context.portal + \"/sys/sysDataSource/v1/import\",\n      isEncrypt: 0\n    };\n  },\n  watch: {\n    dsId: function dsId(newVal, oldVal) {\n      if (!newVal) {\n        this.sourceProp.settingJson = [];\n      }\n    }\n  },\n  computed: {\n    dataSourceDeleteUrl: function dataSourceDeleteUrl() {\n      return window.context.portal + \"/sys/sysDataSource/v1/remove\";\n    }\n  },\n  methods: {\n    //鼠标选中行改变复选框\n    rowClick: function rowClick(row, column, event) {\n      this.$refs.dataSourceTable.$refs.htTable.toggleRowSelection(row);\n    },\n    encrypt: function encrypt(item) {\n      var _this = this;\n\n      if (this.isEncrypt === 1) {\n        if (!item.value) {\n          this.$message.warning(\"请输入密码!\");\n          this.isEncrypt = 0;\n          return;\n        }\n\n        this.$http.post(window.context.portal + \"/base/tools/v1/encryptDbPassword\", {\n          password: item.value\n        }).then(function (res) {\n          if (_this.dsId != '1') {\n            _this.$message.error(\"不支持密码加密\");\n\n            return;\n          }\n\n          if (!res.data.state) {\n            _this.$message.error(\"加密失败\");\n\n            return;\n          }\n\n          item.value = res.data.value.password;\n          var publicKey = {\n            \"name\": \"connectionProperties\",\n            \"comment\": \"公钥\",\n            \"type\": \"java.lang.String\",\n            \"baseAttr\": \"1\",\n            \"default\": \"\",\n            \"value\": \"config.decrypt=true;config.decrypt.key=\" + res.data.value.publicKey\n          };\n\n          _this.sourceProp.settingJson.splice(_this.sourceProp.settingJson.findIndex(function (item) {\n            return item.name === \"connectionProperties\";\n          }), 1);\n\n          _this.sourceProp.settingJson.splice(_this.sourceProp.settingJson.findIndex(function (item) {\n            return item.name === \"password\";\n          }) + 1, 0, publicKey);\n        });\n      } else {\n        item.value = \"\";\n        var index = this.sourceProp.settingJson.findIndex(function (item) {\n          return item.name === \"connectionProperties\";\n        });\n\n        if (index > 0) {\n          this.sourceProp.settingJson.splice(index, 1);\n        }\n      }\n    },\n    checkConnection: function checkConnection() {\n      var _this2 = this;\n\n      if (this.sourceProp.settingJson.length == 0) {\n        this.$message.error(\"连接失败\");\n        return;\n      }\n\n      var newSourceProp = {};\n      Object.assign(newSourceProp, this.sourceProp);\n      newSourceProp.settingJson = JSON.stringify(newSourceProp.settingJson);\n      sys.checkConnection(newSourceProp).then(function (data) {\n        if (data.state) {\n          _this2.$message.success(data.message);\n        }\n      }, function (error) {\n        _this2.$message.error(error || \"连接失败\");\n      });\n    },\n    currentSel: function currentSel(val, data) {\n      var list = data.value;\n\n      for (var i in this.dbTypeList) {\n        var d = this.dbTypeList[i];\n        if (d.value != val) continue;\n\n        for (var i = 0; i < this.sourceProp.settingJson.length; i++) {\n          var attr = this.sourceProp.settingJson[i];\n\n          if (attr.name.toLowerCase().indexOf(\"url\") != -1) {\n            attr.value = d.url;\n          } else if (attr.name.toLowerCase().indexOf(\"driver\") != -1) {\n            attr.value = d.driverName;\n          } else if (attr.name.toLowerCase().indexOf(\"validationquery\") != -1) {\n            attr.value = d.validationquery;\n          }\n        }\n      }\n    },\n    settingSel: function settingSel(dsId, data) {\n      var _this3 = this;\n\n      if (data && data.settingJson) {\n        this.sourceProp.settingJson = JSON.parse(data.settingJson.replace(/[\\\\]/g, '')); //改变了数据池id，那么需要输入的属性也变了\n\n        for (var i = 0; i < this.sysDataSourceDefs.length; i++) {\n          var def = this.sysDataSourceDefs[i];\n          if (def.id != dsId) continue;\n          var settingJson = JSON.parse(def.settingJson.replace(/[\\\\]/g, ''));\n          this.sourceProp.classPath = def.classPath;\n          this.sourceProp.initMethod = def.initMethod;\n          this.sourceProp.closeMethod = def.closeMethod; //处理配置的初始化值\n\n          this.sourceProp.settingJson = [];\n          settingJson.forEach(function (obj) {\n            obj.value = obj[\"default\"];\n\n            _this3.sourceProp.settingJson.push(obj);\n          });\n        } //选择了数据源类型 就替换数据源中的连接地址和驱动\n\n\n        for (var i in this.dbTypeList) {\n          var d = this.dbTypeList[i];\n          if (d.value != this.sourceProp.dbType) continue;\n\n          for (var i = 0; i < this.sourceProp.settingJson.length; i++) {\n            var attr = this.sourceProp.settingJson[i];\n\n            if (attr.name.toLowerCase().indexOf(\"url\") != -1) {\n              attr.value = d.url;\n            } else if (attr.name.toLowerCase().indexOf(\"driver\") != -1) {\n              attr.value = d.driverName;\n            } else if (attr.name.toLowerCase().indexOf(\"validationquery\") != -1) {\n              attr.value = d.validationquery;\n            }\n          }\n        } //数据源配置别名跟这里的别名一致\n\n\n        for (var i = 0; i < this.sourceProp.settingJson.length; i++) {\n          var attr = this.sourceProp.settingJson[i];\n\n          if (attr.name.toLowerCase().indexOf(\"alias\") != -1) {\n            attr.value = attr.alias;\n          }\n        }\n      }\n    },\n    handleSelectOptions: function handleSelectOptions(query) {\n      var _me = this;\n\n      return new Promise(function (resolve, reject) {\n        setTimeout(function () {\n          _me.dbType = _me.dbTypeList;\n          resolve();\n        }, 1000);\n      });\n    },\n    beforeSaveData: function beforeSaveData() {\n      this.newSourceProp = {}; //克隆一个新对象以免影响页面数据动态绑定上了\n\n      Object.assign(this.newSourceProp, this.sourceProp);\n      this.newSourceProp.settingJson = JSON.stringify(this.newSourceProp.settingJson);\n    },\n    savedataSourceUrl: function savedataSourceUrl() {\n      return window.context.portal + \"/sys/sysDataSource/v1/save\"; //window.context.portal +\n    },\n    afterSaveData: function afterSaveData() {\n      this.dialogVisible = false;\n      this.$refs.dataSourceTable.load();\n    },\n    afterLoadData: function afterLoadData(data) {\n      var _this4 = this;\n\n      // 编辑数据源\n      if (this.dialogVisible) {\n        this.sourceProp = data;\n        this.sourceProp.settingJson = JSON.parse(data.settingJson);\n        this.oldAlias = this.sourceProp.alias; //判断是否已经加密\n\n        this.judgeIsEncrypt(this.sourceProp.settingJson);\n\n        var _me = this;\n\n        this.sysDataSourceDefs.forEach(function (item) {\n          if (item.classPath == _me.sourceProp.classPath) {\n            _me.dsId = item.id;\n          }\n        });\n        setTimeout(function () {\n          return _this4.$validator.validateAll(\"editdataSourceForm\");\n        });\n      }\n    },\n    judgeIsEncrypt: function judgeIsEncrypt(settingJson) {\n      var index = settingJson.findIndex(function (item) {\n        return item.name === \"connectionProperties\";\n      });\n\n      if (index > 0) {\n        this.isEncrypt = 1;\n      } else {\n        this.isEncrypt = 0;\n      }\n    },\n    afterLoadSourcesettingData: function afterLoadSourcesettingData(data) {\n      this.sysDataSourceDefs = data;\n\n      if (this.sysDataSourceRow && this.sysDataSourceRow.id) {\n        this.loadDataUrl = \"/sys/sysDataSource/v1/getJson?id=\" + this.sysDataSourceRow.id;\n      }\n    },\n    dialogCancle: function dialogCancle(dialogVisible) {\n      var _this5 = this;\n\n      this.loadDataUrl = \"\";\n      this.settingDataUrl = \"\";\n      this[dialogVisible] = false;\n      setTimeout(function () {\n        return _this5.dataSourceDisabled = false;\n      }, 500);\n    },\n    handleClose: function handleClose() {\n      var _this6 = this;\n\n      this.loadDataUrl = \"\";\n      this.settingDataUrl = \"\";\n      this.dialogVisible = false;\n      setTimeout(function () {\n        return _this6.dataSourceDisabled = false;\n      }, 500);\n    },\n    showDialog: function showDialog(row) {\n      this.dialogVisible = true;\n      this.settingDataUrl = \"/sys/sysDataSourceDef/v1/getAll\";\n\n      if (row && row.id) {\n        this.sysDataSourceRow = row; //this.loadDataUrl = `/sys/sysDataSource/v1/getJson?id=` + row.id;\n      }\n    },\n    handleNodeClick: function handleNodeClick(node) {},\n    loadData: function loadData(param, cb) {\n      var _this7 = this;\n\n      sys.getDataSourcePageJson(param).then(function (response) {\n        _this7.data = response.rows;\n        _this7.pageResult = {\n          page: response.page,\n          pageSize: response.pageSize,\n          total: response.total\n        };\n      }).finally(function () {\n        return cb();\n      });\n    },\n    handleCommand: function handleCommand(params) {\n      switch (params.command) {\n        case \"edit\":\n          this.dataSourceTitle = \"编辑数据源\";\n          this.showDialog(params.row);\n          break;\n\n        case \"add\":\n          this.sysDataSourceRow = {};\n          this.sourceProp.dbType = \"\";\n          this.sourceProp.id = \"\";\n          this.sourceProp.alias = \"\";\n          this.sourceProp.name = \"\";\n          this.sourceProp.enabled = null;\n          this.dsId = \"\"; //this.dataSource.genType ='1'\n\n          this.dataSourceTitle = \"添加数据源\";\n          this.showDialog();\n          this.isEncrypt = 0;\n          break;\n\n        case \"get\":\n          this.dataSourceTitle = \"查看数据源\";\n          this.isSubmit = false;\n          this.dataSourceDisabled = true;\n          this.showDialog(params.row);\n          break;\n\n        default:\n          break;\n      }\n    },\n    handleExport: function handleExport() {\n      var selection = this.$refs.dataSourceTable.$refs.htTable.selection;\n\n      if (!selection || selection.length == 0) {\n        this.$message({\n          type: \"warning\",\n          message: \"请至少选择一条数据\"\n        });\n        return;\n      }\n\n      var ids = [];\n\n      for (var i = 0; i < selection.length; i++) {\n        ids.push(selection[i].id);\n      }\n\n      req.download(window.context.portal + \"/sys/sysDataSource/v1/export?ids=\" + ids.join(\",\"));\n    },\n    beforeClose: function beforeClose() {\n      this.fileList = [];\n      this.uploadDialogVisible = false;\n    },\n    handleImport: function handleImport(param) {\n      var _this8 = this;\n\n      var formData = new FormData();\n      formData.append(\"file\", param.file);\n      portal.importSysDataSource(formData).then(function (resp) {\n        if (resp.state) {\n          _this8.$message({\n            type: \"success\",\n            message: resp.message\n          });\n        } else {\n          _this8.$message({\n            type: \"warning\",\n            message: resp.message\n          });\n        }\n\n        _this8.beforeClose();\n\n        _this8.loadData();\n      });\n    },\n    uploadSubmit: function uploadSubmit() {\n      if (this.$refs.elUpload.uploadFiles.length == 0) {\n        this.$message({\n          type: \"warning\",\n          message: \"请上传文件\"\n        });\n      }\n\n      this.$refs.elUpload.submit();\n    }\n  }\n};",null]}