RuoYi
2025-04-27 2f8a257efd2b64dc40666b0d332edb7824a9768d
src/views/tool/gen/importTable.vue
@@ -51,76 +51,76 @@
</template>
<script setup>
import { listDbTable, importTable } from "@/api/tool/gen";
import { listDbTable, importTable } from "@/api/tool/gen"
const total = ref(0);
const visible = ref(false);
const tables = ref([]);
const dbTableList = ref([]);
const { proxy } = getCurrentInstance();
const total = ref(0)
const visible = ref(false)
const tables = ref([])
const dbTableList = ref([])
const { proxy } = getCurrentInstance()
const queryParams = reactive({
  pageNum: 1,
  pageSize: 10,
  tableName: undefined,
  tableComment: undefined
});
})
const emit = defineEmits(["ok"]);
const emit = defineEmits(["ok"])
/** 查询参数列表 */
function show() {
  getList();
  visible.value = true;
  getList()
  visible.value = true
}
/** 单击选择行 */
function clickRow(row) {
  proxy.$refs.table.toggleRowSelection(row);
  proxy.$refs.table.toggleRowSelection(row)
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
  tables.value = selection.map(item => item.tableName);
  tables.value = selection.map(item => item.tableName)
}
/** 查询表数据 */
function getList() {
  listDbTable(queryParams).then(res => {
    dbTableList.value = res.rows;
    total.value = res.total;
  });
    dbTableList.value = res.rows
    total.value = res.total
  })
}
/** 搜索按钮操作 */
function handleQuery() {
  queryParams.pageNum = 1;
  getList();
  queryParams.pageNum = 1
  getList()
}
/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
  proxy.resetForm("queryRef")
  handleQuery()
}
/** 导入按钮操作 */
function handleImportTable() {
  const tableNames = tables.value.join(",");
  const tableNames = tables.value.join(",")
  if (tableNames == "") {
    proxy.$modal.msgError("请选择要导入的表");
    return;
    proxy.$modal.msgError("请选择要导入的表")
    return
  }
  importTable({ tables: tableNames }).then(res => {
    proxy.$modal.msgSuccess(res.msg);
    proxy.$modal.msgSuccess(res.msg)
    if (res.code === 200) {
      visible.value = false;
      emit("ok");
      visible.value = false
      emit("ok")
    }
  });
  })
}
defineExpose({
  show,
});
})
</script>