Skip to content

Commit

Permalink
types: modify table type name (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicCraver authored Jul 22, 2024
1 parent 6893c70 commit 7bda678
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/api/table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export function updateTableDataApi(data: Table.CreateOrUpdateTableRequestData) {
}

/** 查 */
export function getTableDataApi(params: Table.GetTableRequestData) {
return request<Table.GetTableResponseData>({
export function getTableDataApi(params: Table.TableRequestData) {
return request<Table.TableResponseData>({
url: "table",
method: "get",
params
Expand Down
8 changes: 4 additions & 4 deletions src/api/table/types/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export interface CreateOrUpdateTableRequestData {
password?: string
}

export interface GetTableRequestData {
export interface TableRequestData {
/** 当前页码 */
currentPage: number
/** 查询条数 */
Expand All @@ -15,7 +15,7 @@ export interface GetTableRequestData {
phone?: string
}

export interface GetTableData {
export interface TableData {
createTime: string
email: string
id: string
Expand All @@ -25,7 +25,7 @@ export interface GetTableData {
username: string
}

export type GetTableResponseData = ApiResponseData<{
list: GetTableData[]
export type TableResponseData = ApiResponseData<{
list: TableData[]
total: number
}>
8 changes: 4 additions & 4 deletions src/views/table/element-plus/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { reactive, ref, watch } from "vue"
import { createTableDataApi, deleteTableDataApi, updateTableDataApi, getTableDataApi } from "@/api/table"
import { type CreateOrUpdateTableRequestData, type GetTableData } from "@/api/table/types/table"
import { type CreateOrUpdateTableRequestData, type TableData } from "@/api/table/types/table"
import { type FormInstance, type FormRules, ElMessage, ElMessageBox } from "element-plus"
import { Search, Refresh, CirclePlus, Delete, Download, RefreshRight } from "@element-plus/icons-vue"
import { usePagination } from "@/hooks/usePagination"
Expand Down Expand Up @@ -51,7 +51,7 @@ const resetForm = () => {
//#endregion
//#region 删
const handleDelete = (row: GetTableData) => {
const handleDelete = (row: TableData) => {
ElMessageBox.confirm(`正在删除用户:${row.username},确认删除?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
Expand All @@ -66,14 +66,14 @@ const handleDelete = (row: GetTableData) => {
//#endregion
//#region 改
const handleUpdate = (row: GetTableData) => {
const handleUpdate = (row: TableData) => {
dialogVisible.value = true
formData.value = cloneDeep(row)
}
//#endregion
//#region 查
const tableData = ref<GetTableData[]>([])
const tableData = ref<TableData[]>([])
const searchFormRef = ref<FormInstance | null>(null)
const searchData = reactive({
username: "",
Expand Down
4 changes: 2 additions & 2 deletions src/views/table/vxe-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { nextTick, reactive, ref } from "vue"
import { type ElMessageBoxOptions, ElMessageBox, ElMessage } from "element-plus"
import { deleteTableDataApi, getTableDataApi } from "@/api/table"
import { type GetTableResponseData } from "@/api/table/types/table"
import { type TableResponseData } from "@/api/table/types/table"
import RoleColumnSolts from "./tsx/RoleColumnSolts"
import StatusColumnSolts from "./tsx/StatusColumnSolts"
import {
Expand Down Expand Up @@ -142,7 +142,7 @@ const xGridOpt: VxeGridProps = reactive({
let total = 0
let result: RowMeta[] = []
/** 加载数据 */
const callback = (res: GetTableResponseData) => {
const callback = (res: TableResponseData) => {
if (res?.data) {
// 总数
total = res.data.total
Expand Down

0 comments on commit 7bda678

Please sign in to comment.