UNPKG

w-vue-middle

Version:

统一公共服务组件

123 lines (118 loc) 3.51 kB
/* * @Author: Jason Liu * @Date: 2023-03-08 13:31:51 * @Desc: */ const $dataIntegration = require("../../api/dataIntegration"); import draggable from "vuedraggable"; export default { components: { draggable }, name: "dataTableSource", props: { value: { type: Object, default: { sourceType: 1, dbId: undefined, //链接数据库ID dbName: undefined, //链接数据库名称 dbType: undefined, //链接数据库类型 ip: undefined, port: undefined, tableId: undefined, tableName: undefined, tableCode: undefined, }, }, }, data() { return { loading: false, dataLoading: false, dataList: [], sourceList: [], //数据源列表 sourceInfo: [], //数据源选择信息 tableName: undefined, //查询的表名称 activeName: undefined, nodeData: this.value, } }, created() { this.getTableList(); }, methods: { /** * @Author: Jason Liu * @description: 数据源列表 */ getTableList() { if (this.nodeData.schemaId) { let $event = $dataIntegration.collectionDataInfo; let param = { clusterId: this.nodeData.clusterId, //集群ID collectType: 'table', // 采集类型:schema、table、column dsId: this.nodeData.dbId, schema: this.nodeData.schemaId, tableName: "tableName", useCache: true }; if (this.nodeData.sourceType == 0) { $event = $dataIntegration.getDbsSchema; param = { dbId: this.nodeData.dbId, schemaCode: this.nodeData.schema } } this.dataLoading = true; $event(param).then(req => { this.dataList = (req.data || []); this.$emit("table", this.dataList); }).finally(() => { this.dataLoading = false; }); } else { this.dataList = []; this.$emit("table", this.dataList); } }, /** * @Author: Jason Liu * @description: 点击表格事件 */ clickTable(row) { this.activeName = row.tableName; this.$emit("clickTable", row, this.nodeData); }, /** * @Author: Jason Liu * @description: 查询数据列表 */ searchTableList() {}, cloneEntry(row) { return { key: `${(new Date()).getTime()}`, ...row, }; }, /** * @Author: Jason Liu * @description: 开始克隆事件 */ cloneStart(e) { this.$emit("start", e); }, /** * @Author: Jason Liu * @description: 结束克隆事件 */ cloneEnd(e) { this.$emit("end", e); }, /** * @Author: Jason Liu * @description: 移动事件 */ cloneMove(e) { this.$emit("move", e); }, }, }