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