fix: 修复ts类型错误

This commit is contained in:
ganpeng
2022-06-01 13:54:32 +08:00
parent 363ed7ae9e
commit f20f4209a3
9 changed files with 14 additions and 10 deletions

View File

@@ -46,10 +46,10 @@ export function useFormEvents({
await validate();
loadingSub.value = false;
emit('submit', formModel);
return true;
return;
} catch (error) {
loadingSub.value = false;
return false;
return;
}
}

View File

@@ -41,6 +41,7 @@ export interface FormProps {
submitFunc?: () => Promise<void>;
submitOnReset?: boolean;
baseGridStyle?: CSSProperties;
collapsedRows?: number;
}
export interface FormActionType {

View File

@@ -75,7 +75,7 @@
const getDropdownList = computed(() => {
return (toRaw(props.dropDownActions) || [])
.filter((action) => {
return hasPermission(action.auth) && isIfShow(action);
return hasPermission(action.auth as string[]) && isIfShow(action);
})
.map((action) => {
const { popConfirm } = action;
@@ -108,7 +108,7 @@
const getActions = computed(() => {
return (toRaw(props.actions) || [])
.filter((action) => {
return hasPermission(action.auth) && isIfShow(action);
return hasPermission(action.auth as string[]) && isIfShow(action);
})
.map((action) => {
const { popConfirm } = action;

View File

@@ -34,4 +34,5 @@ export interface BasicTableProps {
actionColumn: any[];
canResize: boolean;
resizeHeightOffset: number;
loading: boolean;
}

View File

@@ -1,6 +1,6 @@
import { NButton } from 'naive-ui';
import { PermissionsEnum } from '@/enums/permissionsEnum';
export interface ActionItem extends NButton.props {
export interface ActionItem extends Partial<InstanceType<typeof NButton>> {
onClick?: Fn;
label?: string;
color?: 'success' | 'error' | 'warning';

View File

@@ -37,6 +37,8 @@ const setting = {
mixMenu: false,
//触发移动端侧边栏的宽度
mobileWidth: 800,
// 折叠菜单
collapsed: false,
},
//面包屑
crumbsSetting: {

View File

@@ -16,10 +16,10 @@
</template>
<script lang="ts" setup>
import { BasicForm, useForm } from '@/components/Form/index';
import { BasicForm, FormSchema, useForm } from '@/components/Form/index';
import { useMessage } from 'naive-ui';
const schemas = [
const schemas: FormSchema[] = [
{
field: 'name',
component: 'NInput',

View File

@@ -259,7 +259,7 @@
function lightOkModal() {
lightCloseModal();
lightSetSubLoading();
lightSetSubLoading(false);
}
function showLightModal() {

View File

@@ -65,7 +65,7 @@
import { h, reactive, ref } from 'vue';
import { useMessage } from 'naive-ui';
import { BasicTable, TableAction } from '@/components/Table';
import { BasicForm, useForm } from '@/components/Form/index';
import { BasicForm, FormSchema, useForm } from '@/components/Form/index';
import { getTableList } from '@/api/table/list';
import { columns } from './columns';
import { PlusOutlined } from '@vicons/antd';
@@ -90,7 +90,7 @@
},
};
const schemas = [
const schemas: FormSchema[] = [
{
field: 'name',
labelMessage: '这是一个提示',