提交 62849209 作者: 方治民
...@@ -17,8 +17,8 @@ function setColumnWidth(data, worksheet, min = 3) { ...@@ -17,8 +17,8 @@ function setColumnWidth(data, worksheet, min = 3) {
data.forEach((item) => { data.forEach((item) => {
Object.keys(item).forEach((key) => { Object.keys(item).forEach((key) => {
const cur = item[key] const cur = item[key]
const length = cur.length const length = cur?.length ?? min
obj[key] = Math.max(min, length) obj[key] = Math.max(length, obj[key] ?? min)
}) })
}) })
Object.keys(obj).forEach((key) => { Object.keys(obj).forEach((key) => {
......
...@@ -128,8 +128,10 @@ ...@@ -128,8 +128,10 @@
* @description: 触发选择文件管理器 * @description: 触发选择文件管理器
*/ */
function handleInputClick(e: Event) { function handleInputClick(e: Event) {
const files = e && (e.target as HTMLInputElement).files const target = e && (e.target as HTMLInputElement)
const files = target?.files
const rawFile = files && files[0] // only setting files[0] const rawFile = files && files[0] // only setting files[0]
target.value = ''
if (!rawFile) return if (!rawFile) return
if (props.isReturnFile) { if (props.isReturnFile) {
emit('success', rawFile) emit('success', rawFile)
......
...@@ -240,6 +240,7 @@ ...@@ -240,6 +240,7 @@
const tableAction: TableActionType = { const tableAction: TableActionType = {
reload, reload,
getSelectRows, getSelectRows,
setSelectedRows,
clearSelectedRowKeys, clearSelectedRowKeys,
getSelectRowKeys, getSelectRowKeys,
deleteSelectRowByKey, deleteSelectRowByKey,
...@@ -264,7 +265,6 @@ ...@@ -264,7 +265,6 @@
updateTableData, updateTableData,
setShowPagination, setShowPagination,
getShowPagination, getShowPagination,
setSelectedRows,
setCacheColumnsByField, setCacheColumnsByField,
expandAll, expandAll,
expandRows, expandRows,
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
props: { props: {
colorList: { colorList: {
type: Array as PropType<string[]>, type: Array as PropType<string[]>,
defualt: [], default: () => [],
}, },
event: { event: {
type: Number as PropType<HandlerEnum>, type: Number as PropType<HandlerEnum>,
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
props: { props: {
menuTypeList: { menuTypeList: {
type: Array as PropType<typeof menuTypeList>, type: Array as PropType<typeof menuTypeList>,
defualt: () => [], default: () => [],
}, },
handler: { handler: {
type: Function as PropType<Fn>, type: Function as PropType<Fn>,
......
...@@ -6,11 +6,11 @@ import dayjs from 'dayjs' ...@@ -6,11 +6,11 @@ import dayjs from 'dayjs'
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss' const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'
const DATE_FORMAT = 'YYYY-MM-DD' const DATE_FORMAT = 'YYYY-MM-DD'
export function formatToDateTime(date: dayjs.Dayjs | Date | undefined = undefined, format = DATE_TIME_FORMAT): string { export function formatToDateTime(date?: dayjs.ConfigType, format = DATE_TIME_FORMAT): string {
return dayjs(date).format(format) return dayjs(date).format(format)
} }
export function formatToDate(date: dayjs.Dayjs | Date | undefined = undefined, format = DATE_FORMAT): string { export function formatToDate(date?: dayjs.ConfigType, format = DATE_FORMAT): string {
return dayjs(date).format(format) return dayjs(date).format(format)
} }
......
...@@ -3,6 +3,7 @@ import type { App, Plugin } from 'vue' ...@@ -3,6 +3,7 @@ import type { App, Plugin } from 'vue'
import { unref } from 'vue' import { unref } from 'vue'
import { isObject } from '/@/utils/is' import { isObject } from '/@/utils/is'
import { cloneDeep } from 'lodash-es'
export const noop = () => {} export const noop = () => {}
...@@ -35,10 +36,11 @@ export function setObjToUrlParams(baseUrl: string, obj: any): string { ...@@ -35,10 +36,11 @@ export function setObjToUrlParams(baseUrl: string, obj: any): string {
// 深度合并 // 深度合并
export function deepMerge<T = any>(src: any = {}, target: any = {}): T { export function deepMerge<T = any>(src: any = {}, target: any = {}): T {
let key: string let key: string
const res: any = cloneDeep(src)
for (key in target) { for (key in target) {
src[key] = isObject(src[key]) ? deepMerge(src[key], target[key]) : (src[key] = target[key]) res[key] = isObject(res[key]) ? deepMerge(res[key], target[key]) : (res[key] = target[key])
} }
return src return res
} }
export function openWindow( export function openWindow(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论