优化

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 * 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/>. * 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 dayjs from 'dayjs';
import { Type } from '../TimeRange/TimeRange'; 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) { export function fixedZero(val: number) {
return val < 10 ? `0${val}` : val; 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) { if (!value) {
return Promise.resolve(); return Promise.resolve();
} }
@ -203,7 +203,7 @@ export default (props: {
validateTrigger: ['onBlur'], validateTrigger: ['onBlur'],
}, },
{ {
validator: async (rule, value) => { validator: async (_rule, value) => {
if (!value) { if (!value) {
return Promise.resolve(); return Promise.resolve();
} }
@ -285,7 +285,7 @@ export default (props: {
}), }),
}, },
{ {
validator: async (rule, value) => { validator: async (_rule, value) => {
if (!value) { if (!value) {
return Promise.resolve(); return Promise.resolve();
} }

View File

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

View File

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

View File

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

View File

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