chore: format code style (#3808)
* first commit * style: format code style * style: format code style
This commit is contained in:
parent
ba5b8f8506
commit
ef5285385f
|
|
@ -4,11 +4,7 @@ import type { NamePath } from 'ant-design-vue/lib/form/interface';
|
|||
import { unref, toRaw, nextTick } from 'vue';
|
||||
import { isArray, isFunction, isObject, isString, isDef, isNil } from '@/utils/is';
|
||||
import { deepMerge } from '@/utils';
|
||||
import {
|
||||
dateItemType,
|
||||
defaultValueComponents,
|
||||
isIncludeSimpleComponents,
|
||||
} from '../helper';
|
||||
import { dateItemType, defaultValueComponents, isIncludeSimpleComponents } from '../helper';
|
||||
import { dateUtil } from '@/utils/dateUtil';
|
||||
import { cloneDeep, has, uniqBy, get } from 'lodash-es';
|
||||
import { error } from '@/utils/log';
|
||||
|
|
@ -76,7 +72,7 @@ export function useFormEvents({
|
|||
const validKeys: string[] = [];
|
||||
fields.forEach((key) => {
|
||||
const schema = unref(getSchema).find((item) => item.field === key);
|
||||
let value = get(values, key);
|
||||
const value = get(values, key);
|
||||
const hasKey = has(values, key);
|
||||
const { componentProps } = schema || {};
|
||||
let _props = componentProps as any;
|
||||
|
|
|
|||
|
|
@ -32,13 +32,9 @@
|
|||
<HeaderCell :column="column" />
|
||||
</slot>
|
||||
</template>
|
||||
<!-- 增加对antdv3.x兼容 -->
|
||||
<template #bodyCell="data">
|
||||
<slot name="bodyCell" v-bind="data || {}"></slot>
|
||||
</template>
|
||||
<!-- <template #[`header-${column.dataIndex}`] v-for="(column, index) in columns" :key="index">-->
|
||||
<!-- <HeaderCell :column="column" />-->
|
||||
<!-- </template>-->
|
||||
</Table>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -369,11 +369,9 @@
|
|||
if (!props.record.editValueRefs) props.record.editValueRefs = {};
|
||||
props.record.editValueRefs[props.column.dataIndex as any] = currentValueRef;
|
||||
}
|
||||
/* eslint-disable */
|
||||
props.record.onCancelEdit = () => {
|
||||
isArray(props.record?.cancelCbs) && props.record?.cancelCbs.forEach((fn) => fn());
|
||||
};
|
||||
/* eslint-disable */
|
||||
props.record.onSubmitEdit = async () => {
|
||||
if (isArray(props.record?.submitCbs)) {
|
||||
if (!props.record?.onValid?.()) return;
|
||||
|
|
@ -508,7 +506,7 @@
|
|||
}
|
||||
.@{prefix-cls} {
|
||||
position: relative;
|
||||
min-height: 24px; //设置高度让其始终可被hover
|
||||
min-height: 24px; // 设置高度让其始终可被hover
|
||||
|
||||
&__wrapper {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -193,8 +193,8 @@
|
|||
const list = (fileList.value || [])
|
||||
.filter((item) => item?.status === UploadResultStatus.DONE)
|
||||
.map((item: any) => {
|
||||
if(item?.response && props?.resultField){
|
||||
return item?.response
|
||||
if (item?.response && props?.resultField) {
|
||||
return item?.response;
|
||||
}
|
||||
return item?.url || item?.response?.url;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
import { downloadByUrl } from '@/utils/file/download';
|
||||
import { createPreviewColumns, createPreviewActionColumn } from './data';
|
||||
import { useI18n } from '@/hooks/web/useI18n';
|
||||
import { isArray } from '@/utils/is';
|
||||
import { isArray, isFunction } from '@/utils/is';
|
||||
import { BasicColumn } from '@/components/Table';
|
||||
import { isFunction } from '@/utils/is';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const props = defineProps(previewProps);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,14 @@ type SortableOptions = Merge<
|
|||
}
|
||||
>;
|
||||
type previewColumnsFnType = {
|
||||
handleRemove:(record:Record<string,any>,key:string)=>any,
|
||||
handleAdd:(record:Record<string,any>,key:string)=>any,
|
||||
}
|
||||
handleRemove: (record: Record<string, any>, key: string) => any;
|
||||
handleAdd: (record: Record<string, any>, key: string) => any;
|
||||
};
|
||||
export const previewType = {
|
||||
previewColumns: {
|
||||
type: [Array,Function] as PropType<BasicColumn[] | ((arg:previewColumnsFnType) => BasicColumn[])>,
|
||||
type: [Array, Function] as PropType<
|
||||
BasicColumn[] | ((arg: previewColumnsFnType) => BasicColumn[])
|
||||
>,
|
||||
required: false,
|
||||
},
|
||||
beforePreviewData: {
|
||||
|
|
|
|||
|
|
@ -1,28 +1,23 @@
|
|||
<template>
|
||||
|
||||
<Alert message="基础示例" />
|
||||
<BasicUpload
|
||||
:maxSize="20"
|
||||
:maxNumber="10"
|
||||
@change="handleChange"
|
||||
:api="uploadApi"
|
||||
class="my-5"
|
||||
:accept="['image/*']"
|
||||
/>
|
||||
|
||||
<Alert message="基础示例" />
|
||||
<BasicUpload
|
||||
:maxSize="20"
|
||||
:maxNumber="10"
|
||||
@change="handleChange"
|
||||
:api="uploadApi"
|
||||
class="my-5"
|
||||
:accept="['image/*']"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { BasicUpload } from '@/components/Upload';
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
const { createMessage } = useMessage();
|
||||
import { Alert } from 'ant-design-vue';
|
||||
import { BasicUpload } from '@/components/Upload';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
function handleChange(list: string[]) {
|
||||
createMessage.success(`已上传文件${JSON.stringify(list)}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -4,11 +4,13 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
const { createMessage } = useMessage();
|
||||
import { BasicForm, FormSchema, useForm } from '@/components/Form';
|
||||
import { Alert } from 'ant-design-vue';
|
||||
import { BasicForm, FormSchema, useForm } from '@/components/Form';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const schemasValiate: FormSchema[] = [
|
||||
{
|
||||
field: 'field1',
|
||||
|
|
@ -52,5 +54,3 @@
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
<template>
|
||||
<Alert message="嵌入表单,加入resultFiled自定义返回值" />
|
||||
<BasicForm @register="registerCustom" class="my-5" />
|
||||
<BasicForm @register="registerCustom" class="my-5" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
const { createMessage } = useMessage();
|
||||
import { BasicForm, FormSchema, useForm } from '@/components/Form';
|
||||
import { Alert } from 'ant-design-vue';
|
||||
import { BasicForm, FormSchema, useForm } from '@/components/Form';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const schemasCustom: FormSchema[] = [
|
||||
{
|
||||
field: 'field3',
|
||||
|
|
@ -69,5 +71,3 @@
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,14 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
const { createMessage } = useMessage();
|
||||
import { BasicForm, FormSchema, useForm } from '@/components/Form';
|
||||
import { Alert, Button } from 'ant-design-vue';
|
||||
import { createVNode } from 'vue';
|
||||
import { Alert, Button } from 'ant-design-vue';
|
||||
import { BasicForm, FormSchema, useForm } from '@/components/Form';
|
||||
import { useMessage } from '@/hooks/web/useMessage';
|
||||
import { uploadApi } from '@/api/sys/upload';
|
||||
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const schemasPreview: FormSchema[] = [
|
||||
{
|
||||
field: 'field5',
|
||||
|
|
@ -82,8 +84,8 @@
|
|||
component: 'Upload',
|
||||
label: '字段6',
|
||||
componentProps: {
|
||||
maxNumber:2,
|
||||
previewColumns: ({ handleRemove, handleAdd}) => {
|
||||
maxNumber: 2,
|
||||
previewColumns: ({ handleRemove, handleAdd }) => {
|
||||
return [
|
||||
{
|
||||
title: 'url6',
|
||||
|
|
@ -101,8 +103,8 @@
|
|||
createVNode(
|
||||
Button,
|
||||
{
|
||||
type:"primary",
|
||||
style:"margin:4px",
|
||||
type: 'primary',
|
||||
style: 'margin:4px',
|
||||
onclick: () => {
|
||||
handleAdd(
|
||||
{ url6: 'https://vebn.oss-cn-beijing.aliyuncs.com/vben/logo.png' },
|
||||
|
|
@ -115,7 +117,7 @@
|
|||
createVNode(
|
||||
Button,
|
||||
{
|
||||
danger:true,
|
||||
danger: true,
|
||||
onclick: () => {
|
||||
handleRemove({ url6: record.url6 }, 'url6');
|
||||
},
|
||||
|
|
@ -125,7 +127,6 @@
|
|||
]);
|
||||
},
|
||||
},
|
||||
|
||||
];
|
||||
},
|
||||
beforePreviewData: (arg) => {
|
||||
|
|
@ -158,7 +159,6 @@
|
|||
});
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
];
|
||||
const [registerPreview, { getFieldsValue: getFieldsValuePreview }] = useForm({
|
||||
|
|
@ -176,5 +176,3 @@
|
|||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<PageWrapper title="上传组件示例">
|
||||
<Upload1></Upload1>
|
||||
<Upload2></Upload2>
|
||||
<Upload3></Upload3>
|
||||
<Upload4></Upload4>
|
||||
<Upload1 />
|
||||
<Upload2 />
|
||||
<Upload3 />
|
||||
<Upload4 />
|
||||
</PageWrapper>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
},
|
||||
{
|
||||
field: '0',
|
||||
// component: 'Input',
|
||||
label: ' ',
|
||||
slot: 'add',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@
|
|||
},
|
||||
{
|
||||
field: 'field3',
|
||||
// component: 'Input',
|
||||
label: '自定义Slot',
|
||||
slot: 'f3',
|
||||
colProps: {
|
||||
|
|
@ -233,6 +232,7 @@
|
|||
createMessage.success('click search,values:' + JSON.stringify(values));
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
:deep(.local_form) .local_typeValue {
|
||||
width: calc(100% - 120px);
|
||||
|
|
|
|||
|
|
@ -119,14 +119,11 @@
|
|||
rules: [
|
||||
{
|
||||
required: true,
|
||||
// @ts-ignore
|
||||
validator: async (rule, value) => {
|
||||
validator: async (_, value) => {
|
||||
if (!value) {
|
||||
/* eslint-disable-next-line */
|
||||
return Promise.reject('值不能为空');
|
||||
}
|
||||
if (value === '1') {
|
||||
/* eslint-disable-next-line */
|
||||
return Promise.reject('值不能为1');
|
||||
}
|
||||
return Promise.resolve();
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@
|
|||
colProps: {
|
||||
span: 8,
|
||||
},
|
||||
// componentProps:{},
|
||||
// can func
|
||||
componentProps: ({ schema, formModel }) => {
|
||||
console.log('form:', schema);
|
||||
|
|
@ -460,7 +459,6 @@
|
|||
},
|
||||
{
|
||||
field: 'field31',
|
||||
// component: 'Input',
|
||||
label: '下拉本地搜索',
|
||||
helpMessage: ['ApiSelect组件', '远程数据源本地搜索', '只发起一次请求获取所有选项'],
|
||||
required: true,
|
||||
|
|
@ -475,7 +473,6 @@
|
|||
},
|
||||
{
|
||||
field: 'field32',
|
||||
// component: 'Input',
|
||||
label: '下拉远程搜索',
|
||||
helpMessage: ['ApiSelect组件', '将关键词发送到接口进行远程搜索'],
|
||||
required: true,
|
||||
|
|
@ -690,7 +687,6 @@
|
|||
},
|
||||
{
|
||||
field: 'selectA',
|
||||
// component: 'Select',
|
||||
label: '互斥SelectA',
|
||||
slot: 'selectA',
|
||||
defaultValue: [],
|
||||
|
|
@ -700,7 +696,6 @@
|
|||
},
|
||||
{
|
||||
field: 'selectB',
|
||||
// component: 'Select',
|
||||
label: '互斥SelectB',
|
||||
slot: 'selectB',
|
||||
defaultValue: [],
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@
|
|||
width: 250,
|
||||
title: 'Action',
|
||||
dataIndex: 'action',
|
||||
// slots: { customRender: 'action' },
|
||||
},
|
||||
showSelectionBar: true, // 显示多选状态栏
|
||||
});
|
||||
|
|
|
|||
|
|
@ -38,14 +38,12 @@
|
|||
title: 'ID',
|
||||
dataIndex: 'id',
|
||||
helpMessage: <div>这个是tsx渲染出来的helpMessage</div>,
|
||||
// slots: { customRender: 'id' },
|
||||
},
|
||||
{
|
||||
title: '头像',
|
||||
dataIndex: 'avatar',
|
||||
width: 100,
|
||||
helpMessage: h('div', '这是vue h函数渲染出来的helpMessage'),
|
||||
// slots: { customRender: 'avatar' },
|
||||
},
|
||||
{
|
||||
title: '分类',
|
||||
|
|
@ -53,7 +51,6 @@
|
|||
width: 80,
|
||||
align: 'center',
|
||||
defaultHidden: true,
|
||||
// slots: { customRender: 'category' },
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
|
|
@ -65,13 +62,11 @@
|
|||
dataIndex: 'imgArr',
|
||||
helpMessage: ['这是简单模式的图片列表', '只会显示一张在表格中', '但点击可预览多张图片'],
|
||||
width: 140,
|
||||
// slots: { customRender: 'img' },
|
||||
},
|
||||
{
|
||||
title: '照片列表2',
|
||||
dataIndex: 'imgs',
|
||||
width: 160,
|
||||
// slots: { customRender: 'imgs' },
|
||||
},
|
||||
{
|
||||
title: '地址',
|
||||
|
|
@ -80,7 +75,6 @@
|
|||
{
|
||||
title: '编号',
|
||||
dataIndex: 'no',
|
||||
// slots: { customRender: 'no' },
|
||||
},
|
||||
{
|
||||
title: '开始时间',
|
||||
|
|
|
|||
|
|
@ -238,7 +238,6 @@
|
|||
width: 160,
|
||||
title: 'Action',
|
||||
dataIndex: 'action',
|
||||
// slots: { customRender: 'action' },
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@
|
|||
title: 'Action',
|
||||
dataIndex: 'action',
|
||||
fixed: 'right',
|
||||
// slots: { customRender: 'action' },
|
||||
},
|
||||
});
|
||||
function handleDelete(record: Recordable) {
|
||||
|
|
|
|||
|
|
@ -142,13 +142,11 @@ export function getCustomHeaderColumns(): BasicColumn[] {
|
|||
// title: '姓名',
|
||||
dataIndex: 'name',
|
||||
width: 120,
|
||||
// slots: { title: 'customTitle' },
|
||||
},
|
||||
{
|
||||
// title: '地址',
|
||||
dataIndex: 'address',
|
||||
width: 120,
|
||||
// slots: { title: 'customAddress' },
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
|
|
@ -252,7 +250,6 @@ export function getFormConfig(): Partial<FormProps> {
|
|||
{
|
||||
field: `field11`,
|
||||
label: `Slot示例`,
|
||||
// component: 'Select',
|
||||
slot: 'custom',
|
||||
colProps: {
|
||||
xl: 12,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
}
|
||||
const actionList: TreeActionItem[] = [
|
||||
{
|
||||
// show:()=>boolean;
|
||||
// show:() => boolean;
|
||||
render: (node) => {
|
||||
return h(PlusOutlined, {
|
||||
class: 'ml-2',
|
||||
|
|
|
|||
Loading…
Reference in New Issue