-
+ 删除
@@ -93,6 +93,8 @@
+
+
@@ -377,7 +379,37 @@
}
},
deleteCheckLine() {
- // todo
+ let choiceData = this.choiceResultObj[this.executeShowTable] || [];
+ if (choiceData.length > 0) {
+ let primaryKey = this.primaryKeyColumn.name;
+ if (!primaryKey) {
+ this.$message.error("删除失败,未找到数据表的主键列");
+ return;
+ }
+ // 通过主键ID和值删除行的数据
+ let deleteParam = [];
+ choiceData.forEach(item => {
+ let line = {};
+ line[primaryKey] = item[primaryKey];
+ deleteParam.push(line);
+ });
+ this.$confirm(`确定要删除选中的${choiceData.length}行数据吗?`, '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ let param = {
+ sourceId: this.pageParam.sourceId,
+ dbName: this.pageParam.dbName,
+ tableName: this.pageParam.tableName,
+ lineJson: JSON.stringify(deleteParam)
+ };
+ datasourceApi.deleteTableLineData(param).then(() => {
+ this.$message.success("删除成功!");
+ this.refreshData();
+ });
+ }).catch(()=>{});
+ }
},
handleCopyCheckLineCommand(type) {
let choiceData = this.choiceResultObj[this.executeShowTable] || [];