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