clddup
2024-07-19 baf406e7e271ac90faa3aec31ceb44715331d9d0
chore: 格式化代码 (#3972)

11个文件已修改
72 ■■■■ 已修改文件
src/components/Form/src/components/FormItem.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Form/src/helper.ts 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Form/src/hooks/useFormEvents.ts 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Upload/src/BasicUpload.vue 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Upload/src/components/ImageUpload.vue 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Upload/src/components/UploadPreviewModal.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Upload/src/props.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/locales/lang/en/routes/demo.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/locales/lang/zh-CN/routes/demo.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/multipleTab.ts 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/demo/form/RuleForm.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Form/src/components/FormItem.vue
@@ -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);
src/components/Form/src/helper.ts
@@ -34,14 +34,10 @@
/**
 * 上传组件
 */
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(
src/components/Form/src/hooks/useFormEvents.ts
@@ -25,12 +25,12 @@
  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 @@
          }
        }
        validKeys.push(key);
        return
        return;
      }
      // Adapt common component
      if (hasKey) {
src/components/Upload/src/BasicUpload.vue
@@ -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);
src/components/Upload/src/components/ImageUpload.vue
@@ -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,
    },
  );
src/components/Upload/src/components/UploadPreviewModal.vue
@@ -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);
src/components/Upload/src/props.ts
@@ -14,7 +14,7 @@
    // ...可扩展
  }
>;
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;
src/locales/lang/en/routes/demo.json
@@ -177,4 +177,4 @@
    "resizeParentHeightTable": "resizeParentHeightTable",
    "vxeTable": "VxeTable"
  }
}
}
src/locales/lang/zh-CN/routes/demo.json
@@ -176,4 +176,4 @@
    "resizeParentHeightTable": "继承父元素高度",
    "vxeTable": "VxeTable"
  }
}
}
src/store/modules/multipleTab.ts
@@ -134,7 +134,9 @@
      // 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
src/views/demo/form/RuleForm.vue
@@ -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'),
    });
  }