chore: 格式化代码 (#3972)
This commit is contained in:
parent
1745f480fd
commit
baf406e7e2
|
|
@ -287,11 +287,11 @@
|
||||||
const on = {
|
const on = {
|
||||||
[eventKey]: (...args: Nullable<Recordable<any>>[]) => {
|
[eventKey]: (...args: Nullable<Recordable<any>>[]) => {
|
||||||
const [e] = args;
|
const [e] = args;
|
||||||
|
|
||||||
const target = e ? e.target : null;
|
const target = e ? e.target : null;
|
||||||
let value = target ? (isCheck ? target.checked : target.value) : e;
|
let value = target ? (isCheck ? target.checked : target.value) : e;
|
||||||
if(isFunction(valueFormat)){
|
if (isFunction(valueFormat)) {
|
||||||
value = valueFormat({...unref(getValues),value});
|
value = valueFormat({ ...unref(getValues), value });
|
||||||
}
|
}
|
||||||
props.setFormModel(field, value, props.schema);
|
props.setFormModel(field, value, props.schema);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,10 @@ const DATE_TYPE = ['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'];
|
||||||
/**
|
/**
|
||||||
* 上传组件
|
* 上传组件
|
||||||
*/
|
*/
|
||||||
export const uploadItemType: ComponentType[] = [
|
export const uploadItemType: ComponentType[] = ['Upload', 'ImageUpload'];
|
||||||
'Upload',
|
|
||||||
'ImageUpload'
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
function genType() {
|
function genType() {
|
||||||
return [...DATE_TYPE, 'RangePicker',"TimeRangePicker"];
|
return [...DATE_TYPE, 'RangePicker', 'TimeRangePicker'];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function setComponentRuleType(
|
export function setComponentRuleType(
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ interface UseFormActionContext {
|
||||||
schemaRef: Ref<FormSchema[]>;
|
schemaRef: Ref<FormSchema[]>;
|
||||||
handleFormValues: Fn;
|
handleFormValues: Fn;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @description: Is it upload
|
* @description: Is it upload
|
||||||
*/
|
*/
|
||||||
export function itemIsUploadComponent(key: keyof ComponentProps) {
|
export function itemIsUploadComponent(key: keyof ComponentProps) {
|
||||||
return uploadItemType.includes(key);
|
return uploadItemType.includes(key);
|
||||||
}
|
}
|
||||||
function tryConstructArray(field: string, values: Recordable = {}): any[] | undefined {
|
function tryConstructArray(field: string, values: Recordable = {}): any[] | undefined {
|
||||||
const pattern = /^\[(.+)\]$/;
|
const pattern = /^\[(.+)\]$/;
|
||||||
if (pattern.test(field)) {
|
if (pattern.test(field)) {
|
||||||
|
|
@ -146,7 +146,7 @@ export function useFormEvents({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
validKeys.push(key);
|
validKeys.push(key);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
// Adapt common component
|
// Adapt common component
|
||||||
if (hasKey) {
|
if (hasKey) {
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@
|
||||||
import UploadPreviewModal from './components/UploadPreviewModal.vue';
|
import UploadPreviewModal from './components/UploadPreviewModal.vue';
|
||||||
import { BaseFileItem } from './types/typing';
|
import { BaseFileItem } from './types/typing';
|
||||||
import { buildUUID } from '@/utils/uuid';
|
import { buildUUID } from '@/utils/uuid';
|
||||||
|
|
||||||
defineOptions({ name: 'BasicUpload' });
|
defineOptions({ name: 'BasicUpload' });
|
||||||
|
|
||||||
const props = defineProps(uploadContainerProps);
|
const props = defineProps(uploadContainerProps);
|
||||||
|
|
@ -86,9 +87,9 @@
|
||||||
return omit(value, 'onChange');
|
return omit(value, 'onChange');
|
||||||
});
|
});
|
||||||
|
|
||||||
const isFirstRender = ref<boolean>(true)
|
const isFirstRender = ref<boolean>(true);
|
||||||
|
|
||||||
function getValue(valueKey="url") {
|
function getValue(valueKey = 'url') {
|
||||||
const list = (fileList.value || []).map((item: any) => {
|
const list = (fileList.value || []).map((item: any) => {
|
||||||
return item[valueKey];
|
return item[valueKey];
|
||||||
});
|
});
|
||||||
|
|
@ -113,7 +114,7 @@
|
||||||
} else if (typeof v == 'string') {
|
} else if (typeof v == 'string') {
|
||||||
values.push(v);
|
values.push(v);
|
||||||
}
|
}
|
||||||
fileList.value = values.map((item,i) => {
|
fileList.value = values.map((item) => {
|
||||||
if (item && isString(item)) {
|
if (item && isString(item)) {
|
||||||
return {
|
return {
|
||||||
uid: buildUUID(),
|
uid: buildUUID(),
|
||||||
|
|
@ -127,19 +128,19 @@
|
||||||
}) as any;
|
}) as any;
|
||||||
}
|
}
|
||||||
emit('update:value', values);
|
emit('update:value', values);
|
||||||
if(!isFirstRender.value){
|
if (!isFirstRender.value) {
|
||||||
emit('change', values);
|
emit('change', values);
|
||||||
isFirstRender.value = false
|
isFirstRender.value = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// 上传modal保存操作
|
// 上传modal保存操作
|
||||||
function handleChange(urls: string[],valueKey:string) {
|
function handleChange(urls: string[], valueKey: string) {
|
||||||
fileList.value = [...unref(fileList), ...(genFileListByUrls(urls) || [])];
|
fileList.value = [...unref(fileList), ...(genFileListByUrls(urls) || [])];
|
||||||
const values = getValue(valueKey);
|
const values = getValue(valueKey);
|
||||||
emit('update:value', values);
|
emit('update:value', values);
|
||||||
|
|
@ -147,7 +148,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 预览modal保存操作
|
// 预览modal保存操作
|
||||||
function handlePreviewChange(fileItems: string[],valueKey:string) {
|
function handlePreviewChange(fileItems: string[], valueKey: string) {
|
||||||
fileList.value = [...(fileItems || [])];
|
fileList.value = [...(fileItems || [])];
|
||||||
const values = getValue(valueKey);
|
const values = getValue(valueKey);
|
||||||
emit('update:value', values);
|
emit('update:value', values);
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
const fileList = ref<UploadProps['fileList']>([]);
|
const fileList = ref<UploadProps['fileList']>([]);
|
||||||
const isLtMsg = ref<boolean>(true);
|
const isLtMsg = ref<boolean>(true);
|
||||||
const isActMsg = ref<boolean>(true);
|
const isActMsg = ref<boolean>(true);
|
||||||
const isFirstRender = ref<boolean>(true)
|
const isFirstRender = ref<boolean>(true);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.value,
|
() => props.value,
|
||||||
|
|
@ -95,13 +95,13 @@
|
||||||
}) as UploadProps['fileList'];
|
}) as UploadProps['fileList'];
|
||||||
}
|
}
|
||||||
emit('update:value', value);
|
emit('update:value', value);
|
||||||
if(!isFirstRender.value){
|
if (!isFirstRender.value) {
|
||||||
emit('change', value);
|
emit('change', value);
|
||||||
isFirstRender.value = false
|
isFirstRender.value = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
import { BasicColumn } from '@/components/Table';
|
import { BasicColumn } from '@/components/Table';
|
||||||
import { useMessage } from '@/hooks/web/useMessage';
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
import { buildUUID } from '@/utils/uuid';
|
import { buildUUID } from '@/utils/uuid';
|
||||||
|
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
|
|
||||||
const props = defineProps(previewProps);
|
const props = defineProps(previewProps);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ type SortableOptions = Merge<
|
||||||
// ...可扩展
|
// ...可扩展
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
export type handleFnKey = "record" | "valueKey" | "uidKey"
|
export type handleFnKey = 'record' | 'valueKey' | 'uidKey';
|
||||||
export type previewColumnsFnType = {
|
export type previewColumnsFnType = {
|
||||||
handleRemove: (record: Record<handleFnKey, any>) => any;
|
handleRemove: (record: Record<handleFnKey, any>) => any;
|
||||||
handleAdd: (record: Record<handleFnKey, any>) => any;
|
handleAdd: (record: Record<handleFnKey, any>) => any;
|
||||||
|
|
|
||||||
|
|
@ -177,4 +177,4 @@
|
||||||
"resizeParentHeightTable": "resizeParentHeightTable",
|
"resizeParentHeightTable": "resizeParentHeightTable",
|
||||||
"vxeTable": "VxeTable"
|
"vxeTable": "VxeTable"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -176,4 +176,4 @@
|
||||||
"resizeParentHeightTable": "继承父元素高度",
|
"resizeParentHeightTable": "继承父元素高度",
|
||||||
"vxeTable": "VxeTable"
|
"vxeTable": "VxeTable"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,9 @@ export const useMultipleTabStore = defineStore({
|
||||||
// Existing pages, do not add tabs repeatedly
|
// Existing pages, do not add tabs repeatedly
|
||||||
const tabHasExits = this.tabList.some((tab, index) => {
|
const tabHasExits = this.tabList.some((tab, index) => {
|
||||||
updateIndex = index;
|
updateIndex = index;
|
||||||
return decodeURIComponent(tab.fullPath || tab.path) === decodeURIComponent(fullPath || path);
|
return (
|
||||||
|
decodeURIComponent(tab.fullPath || tab.path) === decodeURIComponent(fullPath || path)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// If the tab already exists, perform the update operation
|
// If the tab already exists, perform the update operation
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
import { useMessage } from '@/hooks/web/useMessage';
|
import { useMessage } from '@/hooks/web/useMessage';
|
||||||
import { PageWrapper } from '@/components/Page';
|
import { PageWrapper } from '@/components/Page';
|
||||||
import { isAccountExist } from '@/api/demo/system';
|
import { isAccountExist } from '@/api/demo/system';
|
||||||
import dayjs from "dayjs"
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
const schemas: FormSchema[] = [
|
const schemas: FormSchema[] = [
|
||||||
{
|
{
|
||||||
field: 'field1',
|
field: 'field1',
|
||||||
|
|
@ -236,7 +236,7 @@
|
||||||
field5: ['1'],
|
field5: ['1'],
|
||||||
field7: '1',
|
field7: '1',
|
||||||
field33: '2020-12-12',
|
field33: '2020-12-12',
|
||||||
field3: dayjs('2020-12-12',"YYYY-MM-DD"),
|
field3: dayjs('2020-12-12', 'YYYY-MM-DD'),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue