feat-wip(components): 数据字典相关页面代码提交
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import { computed, effectScope, onScopeDispose, reactive, shallowRef, watch } from 'vue';
|
||||
import type { Ref } from 'vue';
|
||||
import { computed, effectScope, onScopeDispose, reactive, shallowRef, watch } from 'vue';
|
||||
import type { PaginationProps } from 'naive-ui';
|
||||
import { useBoolean, useTable } from '@sa/hooks';
|
||||
import type { PaginationData, TableColumnCheck, UseTableOptions } from '@sa/hooks';
|
||||
import { useBoolean, useTable } from '@sa/hooks';
|
||||
import type { FlatResponseData } from '@sa/axios';
|
||||
import { jsonClone } from '@sa/utils';
|
||||
import { useAppStore } from '@/store/modules/app';
|
||||
@ -235,11 +235,11 @@ export function defaultTransform<ApiData>(
|
||||
const { data, error } = response;
|
||||
|
||||
if (!error) {
|
||||
const { records, pageNumber, pageSize, total } = data;
|
||||
const { records, pageIndex, pageSize, total } = data;
|
||||
|
||||
return {
|
||||
data: records,
|
||||
pageNum: pageNumber,
|
||||
pageNum: pageIndex,
|
||||
pageSize,
|
||||
total
|
||||
};
|
||||
@ -300,9 +300,7 @@ function getColumns<Column extends NaiveUI.TableColumn<any>>(cols: Column[], che
|
||||
}
|
||||
});
|
||||
|
||||
const filteredColumns = checks.filter(item => item.checked).map(check => columnMap.get(check.key) as Column);
|
||||
|
||||
return filteredColumns;
|
||||
return checks.filter(item => item.checked).map(check => columnMap.get(check.key) as Column);
|
||||
}
|
||||
|
||||
export function isTableColumnHasKey<T>(column: NaiveUI.TableColumn<T>): column is NaiveUI.TableColumnWithKey<T> {
|
||||
|
||||
@ -321,7 +321,7 @@ const local: App.I18n.Schema = {
|
||||
options: {
|
||||
type: {
|
||||
enum: '枚举',
|
||||
tree: '数型'
|
||||
tree: '树型'
|
||||
}
|
||||
},
|
||||
item: {
|
||||
|
||||
@ -8,7 +8,7 @@ import { request } from '../request';
|
||||
*/
|
||||
export function fetchLogin(username: string, password: string) {
|
||||
return request<Api.Auth.LoginToken>({
|
||||
url: '/auth/login',
|
||||
url: '/authorize/login',
|
||||
method: 'post',
|
||||
data: {
|
||||
username,
|
||||
@ -19,7 +19,7 @@ export function fetchLogin(username: string, password: string) {
|
||||
|
||||
/** Get user info */
|
||||
export function fetchGetUserInfo() {
|
||||
return request<Api.Auth.UserInfo>({ url: '/auth/getUserInfo' });
|
||||
return request<Api.Auth.UserInfo>({ url: '/authorize/getUserInfo' });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -29,7 +29,7 @@ export function fetchGetUserInfo() {
|
||||
*/
|
||||
export function fetchRefreshToken(refreshToken: string) {
|
||||
return request<Api.Auth.LoginToken>({
|
||||
url: '/auth/refreshToken',
|
||||
url: '/authorize/refreshToken',
|
||||
method: 'post',
|
||||
data: {
|
||||
refreshToken
|
||||
|
||||
@ -2,7 +2,7 @@ import { request } from '../../../request';
|
||||
|
||||
export function fetchPageDictionary(pageRequest: Api.Sys.Core.DictionaryQueryPageRequest) {
|
||||
return request<Api.Common.PageResponse<Api.Sys.Core.Dictionary>>({
|
||||
url: '/dictionary/page',
|
||||
url: '/dictionary/paginate',
|
||||
method: 'post',
|
||||
data: pageRequest
|
||||
});
|
||||
@ -10,7 +10,7 @@ export function fetchPageDictionary(pageRequest: Api.Sys.Core.DictionaryQueryPag
|
||||
|
||||
export function fetchDictionaryAdd(dictionaryOp: Api.Sys.Core.DictionaryOp) {
|
||||
return request({
|
||||
url: '/dictionary/add',
|
||||
url: '/dictionary/insert',
|
||||
method: 'post',
|
||||
data: dictionaryOp
|
||||
});
|
||||
@ -18,7 +18,7 @@ export function fetchDictionaryAdd(dictionaryOp: Api.Sys.Core.DictionaryOp) {
|
||||
|
||||
export function fetchDictionaryEdit(dictionaryOp: Api.Sys.Core.DictionaryOp) {
|
||||
return request({
|
||||
url: '/dictionary/edit',
|
||||
url: '/dictionary/update',
|
||||
method: 'post',
|
||||
data: dictionaryOp
|
||||
});
|
||||
|
||||
4
src/typings/api/common.d.ts
vendored
4
src/typings/api/common.d.ts
vendored
@ -7,7 +7,7 @@ declare namespace Api {
|
||||
namespace Common {
|
||||
/** 分页请求 */
|
||||
interface PageRequest {
|
||||
pageNumber: number;
|
||||
pageIndex: number;
|
||||
pageSize: number;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ declare namespace Api {
|
||||
/** 分页响应 */
|
||||
interface PageResponse<T> {
|
||||
total: number;
|
||||
pageNumber: number;
|
||||
pageIndex: number;
|
||||
pageSize: number;
|
||||
records: T[];
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ import DictionaryOperateDrawer from '@/views/sys/core/dictionary/modules/diction
|
||||
const appStore = useAppStore();
|
||||
|
||||
const pageRequest: Api.Sys.Core.DictionaryQueryPageRequest = reactive({
|
||||
pageNumber: 1,
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
query: {
|
||||
name: null,
|
||||
@ -25,7 +25,7 @@ const { columns, columnChecks, data, loading, getData, getDataByPage, mobilePagi
|
||||
api: () => fetchPageDictionary(pageRequest),
|
||||
transform: response => defaultTransform(response),
|
||||
onPaginationParamsChange: params => {
|
||||
pageRequest.pageNumber = params.page || 1;
|
||||
pageRequest.pageIndex = params.page || 1;
|
||||
pageRequest.pageSize = params.pageSize || 10;
|
||||
},
|
||||
columns: () => [
|
||||
|
||||
Reference in New Issue
Block a user