Skip to content

Commit 4d2d5f5

Browse files
author
puhui999
committed
feat: infra 新增批量删除
1 parent 8d0a751 commit 4d2d5f5

File tree

22 files changed

+277
-48
lines changed

22 files changed

+277
-48
lines changed

src/api/infra/codegen.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,11 @@ export function deleteCodegen(tableId) {
9696
method: 'delete'
9797
})
9898
}
99+
100+
// 批量删除数据库的表和字段定义
101+
export function deleteCodegenList(tableIds) {
102+
return request({
103+
url: `/infra/codegen/delete-list?tableIds=${tableIds.join(',')}`,
104+
method: 'delete'
105+
})
106+
}

src/api/infra/config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ export function delConfig(configId) {
5151
})
5252
}
5353

54+
// 批量删除参数配置
55+
export function delConfigList(ids) {
56+
return request({
57+
url: `/infra/config/delete-list?ids=${ids.join(',')}`,
58+
method: 'delete'
59+
})
60+
}
61+
5462
// 导出参数
5563
export function exportConfig(query) {
5664
return request({

src/api/infra/dataSourceConfig.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ export function deleteDataSourceConfig(id) {
2626
})
2727
}
2828

29+
// 批量删除数据源配置
30+
export function deleteDataSourceConfigList(ids) {
31+
return request({
32+
url: `/infra/data-source-config/delete-list?ids=${ids.join(',')}`,
33+
method: 'delete'
34+
})
35+
}
36+
2937
// 获得数据源配置
3038
export function getDataSourceConfig(id) {
3139
return request({

src/api/infra/demo02.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ export function deleteDemo02Category(id) {
2626
})
2727
}
2828

29+
// 批量删除示例分类
30+
export function deleteDemo02CategoryList(ids) {
31+
return request({
32+
url: `/infra/demo02-category/delete-list?ids=${ids.join(',')}`,
33+
method: 'delete'
34+
})
35+
}
36+
2937
// 获得示例分类
3038
export function getDemo02Category(id) {
3139
return request({

src/api/infra/file.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ export function deleteFile(id) {
88
})
99
}
1010

11+
// 批量删除文件
12+
export function deleteFileList(ids) {
13+
return request({
14+
url: `/infra/file/delete-list?ids=${ids.join(',')}`,
15+
method: 'delete'
16+
})
17+
}
18+
1119
// 获得文件分页
1220
export function getFilePage(query) {
1321
return request({

src/api/infra/fileConfig.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ export function deleteFileConfig(id) {
3434
})
3535
}
3636

37+
// 批量删除文件配置
38+
export function deleteFileConfigList(ids) {
39+
return request({
40+
url: `/infra/file-config/delete-list?ids=${ids.join(',')}`,
41+
method: 'delete'
42+
})
43+
}
44+
3745
// 获得文件配置
3846
export function getFileConfig(id) {
3947
return request({

src/api/infra/job.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ export function delJob(jobId) {
4343
})
4444
}
4545

46+
// 批量删除定时任务调度
47+
export function delJobList(ids) {
48+
return request({
49+
url: `/infra/job/delete-list?ids=${ids.join(',')}`,
50+
method: 'delete'
51+
})
52+
}
53+
4654
// 导出定时任务调度
4755
export function exportJob(query) {
4856
return request({

src/views/infra/codegen/index.vue

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,25 @@
2828
<el-button type="info" plain icon="el-icon-upload" size="mini" @click="openImportTable"
2929
v-hasPermi="['infra:codegen:create']">导入</el-button>
3030
</el-col>
31+
<el-col :span="1.5">
32+
<el-button
33+
type="danger"
34+
plain
35+
icon="el-icon-delete"
36+
size="mini"
37+
:disabled="isEmpty(checkedIds)"
38+
@click="handleDeleteBatch"
39+
v-hasPermi="['infra:codegen:delete']"
40+
>
41+
批量删除
42+
</el-button>
43+
</el-col>
3144
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
3245
</el-row>
3346

3447
<!-- 列表 -->
35-
<el-table v-loading="loading" :data="tableList">
48+
<el-table v-loading="loading" :data="tableList" @selection-change="handleRowCheckboxChange">
49+
<el-table-column type="selection" width="55"/>
3650
<el-table-column label="数据源" align="center" :formatter="dataSourceConfigNameFormat"/>
3751
<el-table-column label="表名称" align="center" prop="tableName" width="200"/>
3852
<el-table-column label="表描述" align="center" prop="tableComment" :show-overflow-tooltip="true" width="120"/>
@@ -85,7 +99,7 @@
8599

86100
<script>
87101
import { getCodegenTablePage, previewCodegen, downloadCodegen, deleteCodegen,
88-
syncCodegenFromDB } from "@/api/infra/codegen";
102+
syncCodegenFromDB, deleteCodegenList } from "@/api/infra/codegen";
89103
90104
import importTable from "./importTable";
91105
// 代码高亮插件
@@ -136,6 +150,8 @@ export default {
136150
},
137151
// 数据源列表
138152
dataSourceConfigs: [],
153+
// 选中项
154+
checkedIds: [],
139155
};
140156
},
141157
created() {
@@ -312,6 +328,19 @@ export default {
312328
}
313329
return '未知【' + row.leaderUserId + '';
314330
},
331+
/** 选中行变化 */
332+
handleRowCheckboxChange(selection) {
333+
this.checkedIds = selection.map(item => item.id);
334+
},
335+
/** 批量删除 */
336+
handleDeleteBatch() {
337+
this.$modal.confirm('是否确认删除选中的数据项?').then(function() {
338+
return deleteCodegenList(this.checkedIds);
339+
}).then(() => {
340+
this.getList();
341+
this.$modal.msgSuccess("删除成功");
342+
}).catch(() => {});
343+
}
315344
}
316345
};
317346
</script>

src/views/infra/config/index.vue

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,24 @@
3636
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
3737
v-hasPermi="['infra:config:export']">导出</el-button>
3838
</el-col>
39+
<el-col :span="1.5">
40+
<el-button
41+
type="danger"
42+
plain
43+
icon="el-icon-delete"
44+
size="mini"
45+
:disabled="isEmpty(checkedIds)"
46+
@click="handleDeleteBatch"
47+
v-hasPermi="['infra:config:delete']"
48+
>
49+
批量删除
50+
</el-button>
51+
</el-col>
3952
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
4053
</el-row>
4154

42-
<el-table v-loading="loading" :data="configList">
55+
<el-table v-loading="loading" :data="configList" @selection-change="handleRowCheckboxChange">
56+
<el-table-column type="selection" width="55"/>
4357
<el-table-column label="参数主键" align="center" prop="id" />
4458
<el-table-column label="参数分类" align="center" prop="category" />
4559
<el-table-column label="参数名称" align="center" prop="name" :show-overflow-tooltip="true" />
@@ -107,7 +121,7 @@
107121
</template>
108122

109123
<script>
110-
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig } from "@/api/infra/config";
124+
import { listConfig, getConfig, delConfig, addConfig, updateConfig, exportConfig, delConfigList } from "@/api/infra/config";
111125
112126
export default {
113127
name: "InfraConfig",
@@ -154,7 +168,8 @@ export default {
154168
value: [
155169
{ required: true, message: "参数键值不能为空", trigger: "blur" }
156170
]
157-
}
171+
},
172+
checkedIds: []
158173
};
159174
},
160175
created() {
@@ -258,6 +273,18 @@ export default {
258273
this.exportLoading = false;
259274
});
260275
},
276+
handleRowCheckboxChange(selection) {
277+
this.checkedIds = selection.map(item => item.id);
278+
},
279+
handleDeleteBatch() {
280+
const ids = this.checkedIds;
281+
this.$modal.confirm('是否确认删除选中的' + this.checkedIds.length + '项数据?').then(function() {
282+
return delConfigList(ids);
283+
}).then(() => {
284+
this.getList();
285+
this.$modal.msgSuccess("删除成功");
286+
}).catch(() => {});
287+
}
261288
}
262289
};
263290
</script>

src/views/infra/dataSourceConfig/index.vue

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,24 @@
66
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
77
v-hasPermi="['infra:data-source-config:create']">新增</el-button>
88
</el-col>
9+
<el-col :span="1.5">
10+
<el-button
11+
type="danger"
12+
plain
13+
icon="el-icon-delete"
14+
size="mini"
15+
:disabled="isEmpty(checkedIds)"
16+
@click="handleDeleteBatch"
17+
v-hasPermi="['infra:data-source-config:delete']"
18+
>
19+
批量删除
20+
</el-button>
21+
</el-col>
922
</el-row>
1023

1124
<!-- 列表 -->
12-
<el-table v-loading="loading" :data="list">
25+
<el-table v-loading="loading" :data="list" @selection-change="handleRowCheckboxChange">
26+
<el-table-column type="selection" width="55"/>
1327
<el-table-column label="主键编号" align="center" prop="id" />
1428
<el-table-column label="数据源名称" align="center" prop="name" />
1529
<el-table-column label="数据源连接" align="center" prop="url" />
@@ -54,7 +68,7 @@
5468
</template>
5569

5670
<script>
57-
import { createDataSourceConfig, updateDataSourceConfig, deleteDataSourceConfig, getDataSourceConfig, getDataSourceConfigList } from "@/api/infra/dataSourceConfig";
71+
import { createDataSourceConfig, updateDataSourceConfig, deleteDataSourceConfig, getDataSourceConfig, getDataSourceConfigList, deleteDataSourceConfigList } from "@/api/infra/dataSourceConfig";
5872
5973
export default {
6074
name: "InfraDataSourceConfig",
@@ -80,7 +94,8 @@ export default {
8094
url: [{ required: true, message: "数据源连接不能为空", trigger: "blur" }],
8195
username: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
8296
password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
83-
}
97+
},
98+
checkedIds: []
8499
};
85100
},
86101
created() {
@@ -160,6 +175,18 @@ export default {
160175
this.getList();
161176
this.$modal.msgSuccess("删除成功");
162177
}).catch(() => {});
178+
},
179+
handleRowCheckboxChange(val) {
180+
this.checkedIds = val.map(item => item.id);
181+
},
182+
handleDeleteBatch() {
183+
const ids = this.checkedIds;
184+
this.$modal.confirm('是否确认删除选中的数据源配置?').then(function() {
185+
return deleteDataSourceConfigList(ids);
186+
}).then(() => {
187+
this.getList();
188+
this.$modal.msgSuccess("删除成功");
189+
}).catch(() => {});
163190
}
164191
}
165192
};

0 commit comments

Comments
 (0)