00b73e2a by xukangle

fix: 规则配置上移下移

1 parent a0632be9
...@@ -53,10 +53,10 @@ onMounted(async () => { ...@@ -53,10 +53,10 @@ onMounted(async () => {
53 53
54 const tableData1 = ref([ 54 const tableData1 = ref([
55 { 55 {
56 databaseChName: router.currentRoute.value.query.databaseChName, 56 databaseChName: router.currentRoute.value.query.databaseChName || '--',
57 tableName: router.currentRoute.value.query.tableName, 57 tableName: router.currentRoute.value.query.tableName || '--',
58 tableChName: router.currentRoute.value.query.tableChName, 58 tableChName: router.currentRoute.value.query.tableChName || '--',
59 description: router.currentRoute.value.query.description, 59 description: router.currentRoute.value.query.description || '--',
60 }, 60 },
61 ]) 61 ])
62 // 表格数据 62 // 表格数据
...@@ -87,7 +87,7 @@ const moveUp = () => { ...@@ -87,7 +87,7 @@ const moveUp = () => {
87 return; 87 return;
88 } 88 }
89 selectedRows.value.forEach((row: any) => { 89 selectedRows.value.forEach((row: any) => {
90 const index = tableData.value.findIndex((item) => item.guid === row.guid); 90 const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
91 if (index > 0) { 91 if (index > 0) {
92 [tableData.value[index - 1], tableData.value[index]] = [ 92 [tableData.value[index - 1], tableData.value[index]] = [
93 tableData.value[index], 93 tableData.value[index],
...@@ -105,7 +105,7 @@ const moveDown = () => { ...@@ -105,7 +105,7 @@ const moveDown = () => {
105 } 105 }
106 // 倒序遍历选中行 106 // 倒序遍历选中行
107 [...selectedRows.value].reverse().forEach((row: any) => { 107 [...selectedRows.value].reverse().forEach((row: any) => {
108 const index = tableData.value.findIndex((item) => item.guid === row.guid); 108 const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
109 if (index < tableData.value.length - 1) { 109 if (index < tableData.value.length - 1) {
110 [tableData.value[index], tableData.value[index + 1]] = [ 110 [tableData.value[index], tableData.value[index + 1]] = [
111 tableData.value[index + 1], 111 tableData.value[index + 1],
...@@ -114,6 +114,30 @@ const moveDown = () => { ...@@ -114,6 +114,30 @@ const moveDown = () => {
114 } 114 }
115 }); 115 });
116 }; 116 };
117 // 删除行
118 const deleteRow = (index) => {
119 // confirm 弹窗
120 proxy.$confirm('是否删除该行数据?', '提示', {
121 confirmButtonText: '确定',
122 cancelButtonText: '取消',
123 type: 'warning',
124 }).then(() => {
125 tableData.value.splice(index, 1)
126 }).catch(() => {
127 proxy.$message({
128 type: 'info',
129 message: '已取消删除'
130 });
131 });
132 }
133 // 批量删除功能
134 const batchDelete = () => {
135 selectedRows.value.forEach((row: any) => {
136 const index = tableData.value.findIndex((item) => item.tableData === row.tableData);
137 if (index !== -1) tableData.value.splice(index, 1);
138 });
139 selectedRows.value = [];
140 };
117 141
118 // 编辑行 142 // 编辑行
119 const editRow = (row) => { 143 const editRow = (row) => {
...@@ -141,19 +165,6 @@ const saveRow = (row) => { ...@@ -141,19 +165,6 @@ const saveRow = (row) => {
141 } 165 }
142 row.isEdit = false 166 row.isEdit = false
143 } 167 }
144
145 // 删除行
146 const deleteRow = (index) => {
147 tableData.value.splice(index, 1)
148 }
149 // 批量删除功能
150 const batchDelete = () => {
151 selectedRows.value.forEach((row: any) => {
152 const index = tableData.value.findIndex((item) => item.id === row.id);
153 if (index !== -1) tableData.value.splice(index, 1);
154 });
155 selectedRows.value = [];
156 };
157 const data = [ 168 const data = [
158 { 169 {
159 value: '1', 170 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!