00b73e2a by xukangle

fix: 规则配置上移下移

1 parent a0632be9
......@@ -53,10 +53,10 @@ onMounted(async () => {
const tableData1 = ref([
{
databaseChName: router.currentRoute.value.query.databaseChName,
tableName: router.currentRoute.value.query.tableName,
tableChName: router.currentRoute.value.query.tableChName,
description: router.currentRoute.value.query.description,
databaseChName: router.currentRoute.value.query.databaseChName || '--',
tableName: router.currentRoute.value.query.tableName || '--',
tableChName: router.currentRoute.value.query.tableChName || '--',
description: router.currentRoute.value.query.description || '--',
},
])
// 表格数据
......@@ -87,7 +87,7 @@ const moveUp = () => {
return;
}
selectedRows.value.forEach((row: any) => {
const index = tableData.value.findIndex((item) => item.guid === row.guid);
const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
if (index > 0) {
[tableData.value[index - 1], tableData.value[index]] = [
tableData.value[index],
......@@ -105,7 +105,7 @@ const moveDown = () => {
}
// 倒序遍历选中行
[...selectedRows.value].reverse().forEach((row: any) => {
const index = tableData.value.findIndex((item) => item.guid === row.guid);
const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
if (index < tableData.value.length - 1) {
[tableData.value[index], tableData.value[index + 1]] = [
tableData.value[index + 1],
......@@ -114,6 +114,30 @@ const moveDown = () => {
}
});
};
// 删除行
const deleteRow = (index) => {
// confirm 弹窗
proxy.$confirm('是否删除该行数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
tableData.value.splice(index, 1)
}).catch(() => {
proxy.$message({
type: 'info',
message: '已取消删除'
});
});
}
// 批量删除功能
const batchDelete = () => {
selectedRows.value.forEach((row: any) => {
const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
if (index !== -1) tableData.value.splice(index, 1);
});
selectedRows.value = [];
};
// 编辑行
const editRow = (row) => {
......@@ -141,19 +165,6 @@ const saveRow = (row) => {
}
row.isEdit = false
}
// 删除行
const deleteRow = (index) => {
tableData.value.splice(index, 1)
}
// 批量删除功能
const batchDelete = () => {
selectedRows.value.forEach((row: any) => {
const index = tableData.value.findIndex((item) => item.id === row.id);
if (index !== -1) tableData.value.splice(index, 1);
});
selectedRows.value = [];
};
const data = [
{
value: '1',
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!