优化

pull/82/head^2
awenes 2024-04-04 19:23:45 +08:00
parent 91a0a8e7e2
commit 4c935c0f28
6 changed files with 18 additions and 17 deletions

View File

@ -15,11 +15,11 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import type { RangePickerProps } from 'antd/es/date-picker/generatePicker';
import dayjs from 'dayjs';
import { Type } from '../TimeRange/TimeRange';
import { RangePickerProps } from 'antd/es/date-picker';
export type RangePickerValue = RangePickerProps<dayjs.Dayjs>['value'];
export type RangePickerValue = RangePickerProps['value'];
export function fixedZero(val: number) {
return val < 10 ? `0${val}` : val;

View File

@ -135,7 +135,7 @@ export default (props: {
}),
},
{
validator: async (rule, value) => {
validator: async (_rule, value) => {
if (!value) {
return Promise.resolve();
}
@ -203,7 +203,7 @@ export default (props: {
validateTrigger: ['onBlur'],
},
{
validator: async (rule, value) => {
validator: async (_rule, value) => {
if (!value) {
return Promise.resolve();
}
@ -285,7 +285,7 @@ export default (props: {
}),
},
{
validator: async (rule, value) => {
validator: async (_rule, value) => {
if (!value) {
return Promise.resolve();
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { SMS_PROVIDER } from '@/constant';
import { Language } from '@/pages/setting/Storage/constant';
import { Language } from '../../constant';
import {
disableSmsProvider,
getSmsProviderConfig,
@ -45,7 +45,7 @@ import QiNiu from './QiNiu';
import Tencent from './Tencent';
import { Container } from '@/components/Container';
import { useIntl } from '@umijs/max';
import { SmsTemplateList } from '@/pages/setting/Message/data';
import { SmsTemplateList } from '../../data.d';
const layout = {
labelCol: {
@ -345,13 +345,13 @@ export default (props: { visible: boolean }) => {
},
}}
onFinish={async (values) => {
const fieldsValue: any = editorFormRef.current?.getFieldsValue();
const fieldsValue = editorFormRef.current?.getFieldsValue();
const templates: { type: string; code: string }[] = [];
editableKeys?.forEach((i) => {
if (fieldsValue[i].code !== undefined) {
editableKeys?.forEach((i, index) => {
if (fieldsValue?.[index].code !== undefined) {
const config: { type: string; code: string } = {
type: `${i}`,
code: fieldsValue[i].code,
code: fieldsValue[index].code,
};
templates.push(config);
}

View File

@ -59,7 +59,7 @@ export async function getFilterOrganizationTree(
* Get organization Details
*/
export async function getOrganization(
id: string | number,
id: Key,
): Promise<API.ApiResult<AccountAPI.GetOrganization>> {
return request<API.ApiResult<AccountAPI.GetOrganization>>(`/api/v1/organization/get/${id}`);
}
@ -128,8 +128,8 @@ export async function moveOrganization(
*/
export async function getUserList(
params: Record<string, any>,
sort: Record<string, SortOrder>,
filter: Record<string, (string | number)[] | null>,
sort?: Record<string, SortOrder>,
filter?: Record<string, (string | number)[] | null>,
): Promise<RequestData<AccountAPI.ListUser>> {
return request<API.ApiResult<AccountAPI.ListUser>>('/api/v1/user/list', {
params: { ...params, ...sortParamConverter(sort), ...filterParamConverter(filter) },
@ -419,7 +419,7 @@ export async function removeUserGroup(id: string): Promise<API.ApiResult<boolean
*/
export async function removeUserGroupMember(
id: string,
userIds: (number | string)[],
userIds: (number | string | Key)[],
): Promise<API.ApiResult<boolean>> {
return request<API.ApiResult<boolean>>(`/api/v1/user_group/remove_member/${id}`, {
method: 'DELETE',

View File

@ -91,7 +91,7 @@ export const jsonToUrlParams = (params: Record<string, any>) => {
*
* @param value
*/
export const sortParamConverter = (value: Record<string, SortOrder> | undefined) => {
export const sortParamConverter = (value?: Record<string, SortOrder> | undefined) => {
const param: Record<string, any> = {};
if (value)
Object.entries(value).forEach(([key, sort], index) => {
@ -106,7 +106,7 @@ export const sortParamConverter = (value: Record<string, SortOrder> | undefined)
*
* @param value
*/
export const filterParamConverter = (value: Record<string, (string | number)[] | null>) => {
export const filterParamConverter = (value?: Record<string, (string | number)[] | null>) => {
const param: Record<string, any> = {};
if (value)
Object.entries(value).forEach(([key], index) => {

View File

@ -5,6 +5,7 @@
"forceConsistentCasingInFileNames": false,
"noImplicitReturns": true,
"suppressImplicitAnyIndexErrors": true,
"ignoreDeprecations":"5.0",
"noUnusedLocals": true,
"allowJs": true,
"target": "esnext",