| | |
| | | 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); |
| | | |
| | |
| | | /** |
| | | * 上传组件 |
| | | */ |
| | | 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( |
| | |
| | | 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)) { |
| | |
| | | } |
| | | } |
| | | validKeys.push(key); |
| | | return |
| | | return; |
| | | } |
| | | // Adapt common component |
| | | if (hasKey) { |
| | |
| | | import UploadPreviewModal from './components/UploadPreviewModal.vue'; |
| | | import { BaseFileItem } from './types/typing'; |
| | | import { buildUUID } from '@/utils/uuid'; |
| | | |
| | | defineOptions({ name: 'BasicUpload' }); |
| | | |
| | | const props = defineProps(uploadContainerProps); |
| | |
| | | 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]; |
| | | }); |
| | |
| | | } 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(), |
| | |
| | | }) 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); |
| | |
| | | } |
| | | |
| | | // 预览modal保存操作 |
| | | function handlePreviewChange(fileItems: string[],valueKey:string) { |
| | | function handlePreviewChange(fileItems: string[], valueKey: string) { |
| | | fileList.value = [...(fileItems || [])]; |
| | | const values = getValue(valueKey); |
| | | emit('update:value', values); |
| | |
| | | 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, |
| | |
| | | }) 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, |
| | | }, |
| | | ); |
| | |
| | | import { BasicColumn } from '@/components/Table'; |
| | | import { useMessage } from '@/hooks/web/useMessage'; |
| | | import { buildUUID } from '@/utils/uuid'; |
| | | |
| | | const { createMessage } = useMessage(); |
| | | |
| | | const props = defineProps(previewProps); |
| | |
| | | // ...可扩展 |
| | | } |
| | | >; |
| | | 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; |
| | |
| | | "resizeParentHeightTable": "resizeParentHeightTable", |
| | | "vxeTable": "VxeTable" |
| | | } |
| | | } |
| | | } |
| | |
| | | "resizeParentHeightTable": "继承父元素高度", |
| | | "vxeTable": "VxeTable" |
| | | } |
| | | } |
| | | } |
| | |
| | | // 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 |
| | |
| | | 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', |
| | |
| | | field5: ['1'], |
| | | field7: '1', |
| | | field33: '2020-12-12', |
| | | field3: dayjs('2020-12-12',"YYYY-MM-DD"), |
| | | field3: dayjs('2020-12-12', 'YYYY-MM-DD'), |
| | | }); |
| | | } |
| | | |