正式移除 VXE 表格
parent
fd447dc7a3
commit
ebbf47f509
@ -1,3 +0,0 @@
|
||||
import XModal from './src/XModal.vue'
|
||||
|
||||
export { XModal }
|
||||
@ -1,44 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
const slots = useSlots()
|
||||
|
||||
const props = defineProps({
|
||||
id: propTypes.string.def('model_1'),
|
||||
modelValue: propTypes.bool.def(false),
|
||||
fullscreen: propTypes.bool.def(false),
|
||||
loading: propTypes.bool.def(false),
|
||||
title: propTypes.string.def('弹窗'),
|
||||
width: propTypes.string.def('40%'),
|
||||
height: propTypes.string,
|
||||
minWidth: propTypes.string.def('460'),
|
||||
minHeight: propTypes.string.def('320'),
|
||||
showFooter: propTypes.bool.def(true),
|
||||
maskClosable: propTypes.bool.def(false),
|
||||
escClosable: propTypes.bool.def(false)
|
||||
})
|
||||
|
||||
const getBindValue = computed(() => {
|
||||
const attrs = useAttrs()
|
||||
const obj = { ...attrs, ...props }
|
||||
return obj
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<vxe-modal v-bind="getBindValue" destroy-on-close show-zoom resize transfer>
|
||||
<template v-if="slots.header" #header>
|
||||
<slot name="header"></slot>
|
||||
</template>
|
||||
<ElScrollbar>
|
||||
<template v-if="slots.default" #default>
|
||||
<slot name="default"></slot>
|
||||
</template>
|
||||
</ElScrollbar>
|
||||
<template v-if="slots.corner" #corner>
|
||||
<slot name="corner"></slot>
|
||||
</template>
|
||||
<template v-if="slots.footer" #footer>
|
||||
<slot name="footer"></slot>
|
||||
</template>
|
||||
</vxe-modal>
|
||||
</template>
|
||||
@ -1,3 +0,0 @@
|
||||
import XTable from './src/XTable.vue'
|
||||
|
||||
export { XTable }
|
||||
@ -1,81 +0,0 @@
|
||||
// 修改样式变量
|
||||
//@import 'vxe-table/styles/variable.scss';
|
||||
|
||||
/*font*/
|
||||
$vxe-font-color: #e5e7eb;
|
||||
// $vxe-font-size: 14px !default;
|
||||
// $vxe-font-size-medium: 16px !default;
|
||||
// $vxe-font-size-small: 14px !default;
|
||||
// $vxe-font-size-mini: 12px !default;
|
||||
|
||||
/*color*/
|
||||
$vxe-primary-color: #409eff !default;
|
||||
$vxe-success-color: #67c23a !default;
|
||||
$vxe-info-color: #909399 !default;
|
||||
$vxe-warning-color: #e6a23c !default;
|
||||
$vxe-danger-color: #f56c6c !default;
|
||||
$vxe-disabled-color: #bfbfbf !default;
|
||||
$vxe-primary-disabled-color: #c0c4cc !default;
|
||||
|
||||
/*loading*/
|
||||
$vxe-loading-color: $vxe-primary-color !default;
|
||||
$vxe-loading-background-color: #1d1e1f !default;
|
||||
$vxe-loading-z-index: 999 !default;
|
||||
|
||||
/*icon*/
|
||||
$vxe-icon-font-family: Verdana, Arial, Tahoma !default;
|
||||
$vxe-icon-background-color: #e5e7eb !default;
|
||||
|
||||
/*toolbar*/
|
||||
$vxe-toolbar-background-color: #1d1e1f !default;
|
||||
$vxe-toolbar-button-border: #dcdfe6 !default;
|
||||
$vxe-toolbar-custom-active-background-color: #d9dadb !default;
|
||||
$vxe-toolbar-panel-background-color: #e5e7eb !default;
|
||||
|
||||
$vxe-table-font-color: #e5e7eb;
|
||||
$vxe-table-header-background-color: #1d1e1f;
|
||||
$vxe-table-body-background-color: #141414;
|
||||
$vxe-table-row-striped-background-color: #1d1d1d;
|
||||
$vxe-table-row-hover-background-color: #1d1e1f;
|
||||
$vxe-table-row-hover-striped-background-color: #1e1e1e;
|
||||
$vxe-table-footer-background-color: #1d1e1f;
|
||||
$vxe-table-row-current-background-color: #302d2d;
|
||||
$vxe-table-column-current-background-color: #302d2d;
|
||||
$vxe-table-column-hover-background-color: #302d2d;
|
||||
$vxe-table-row-hover-current-background-color: #302d2d;
|
||||
$vxe-table-row-checkbox-checked-background-color: #3e3c37 !default;
|
||||
$vxe-table-row-hover-checkbox-checked-background-color: #615a4a !default;
|
||||
$vxe-table-menu-background-color: #1d1e1f;
|
||||
$vxe-table-border-width: 1px !default;
|
||||
$vxe-table-border-color: #4c4d4f !default;
|
||||
$vxe-table-fixed-left-scrolling-box-shadow: 8px 0px 10px -5px rgba(0, 0, 0, 0.12) !default;
|
||||
$vxe-table-fixed-right-scrolling-box-shadow: -8px 0px 10px -5px rgba(0, 0, 0, 0.12) !default;
|
||||
|
||||
$vxe-form-background-color: #141414;
|
||||
|
||||
/*pager*/
|
||||
$vxe-pager-background-color: #1d1e1f !default;
|
||||
$vxe-pager-perfect-background-color: #262727 !default;
|
||||
$vxe-pager-perfect-button-background-color: #a7a3a3 !default;
|
||||
|
||||
$vxe-input-background-color: #141414;
|
||||
$vxe-input-border-color: #4c4d4f !default;
|
||||
|
||||
$vxe-select-option-hover-background-color: #262626 !default;
|
||||
$vxe-select-panel-background-color: #141414 !default;
|
||||
$vxe-select-empty-color: #262626 !default;
|
||||
$vxe-optgroup-title-color: #909399 !default;
|
||||
|
||||
/*button*/
|
||||
$vxe-button-default-background-color: #262626;
|
||||
$vxe-button-dropdown-panel-background-color: #141414;
|
||||
|
||||
/*modal*/
|
||||
$vxe-modal-header-background-color: #141414;
|
||||
$vxe-modal-body-background-color: #141414;
|
||||
$vxe-modal-border-color: #3b3b3b;
|
||||
|
||||
/*pulldown*/
|
||||
$vxe-pulldown-panel-background-color: #262626 !default;
|
||||
|
||||
@import 'vxe-table/styles/index.scss';
|
||||
@ -1,6 +0,0 @@
|
||||
// @import 'vxe-table/styles/variable.scss';
|
||||
// @import 'vxe-table/styles/modules.scss';
|
||||
// @import './theme/light.scss';
|
||||
i {
|
||||
border-color: initial;
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
// 修改样式变量
|
||||
// /*font*/
|
||||
// $vxe-font-size: 12px !default;
|
||||
// $vxe-font-size-medium: 16px !default;
|
||||
// $vxe-font-size-small: 14px !default;
|
||||
// $vxe-font-size-mini: 12px !default;
|
||||
/*color*/
|
||||
$vxe-primary-color: #409eff !default;
|
||||
$vxe-success-color: #67c23a !default;
|
||||
$vxe-info-color: #909399 !default;
|
||||
$vxe-warning-color: #e6a23c !default;
|
||||
$vxe-danger-color: #f56c6c !default;
|
||||
$vxe-disabled-color: #bfbfbf !default;
|
||||
$vxe-primary-disabled-color: #c0c4cc !default;
|
||||
|
||||
@import 'vxe-table/styles/index.scss';
|
||||
@ -1,26 +0,0 @@
|
||||
import { CrudSchema } from '@/hooks/web/useCrudSchemas'
|
||||
import type { VxeGridProps, VxeGridPropTypes, VxeTablePropTypes } from 'vxe-table'
|
||||
|
||||
export type XTableProps<D = any> = VxeGridProps<D> & {
|
||||
allSchemas?: CrudSchema
|
||||
height?: number // 高度 默认730
|
||||
topActionSlots?: boolean // 是否开启表格内顶部操作栏插槽
|
||||
treeConfig?: VxeTablePropTypes.TreeConfig // 树形表单配置
|
||||
isList?: boolean // 是否不带分页的list
|
||||
getListApi?: Function // 获取列表接口
|
||||
getAllListApi?: Function // 获取全部数据接口 用于 vxe 导出
|
||||
deleteApi?: Function // 删除接口
|
||||
deleteListApi?: Function // 批量删除接口
|
||||
exportListApi?: Function // 导出接口
|
||||
exportName?: string // 导出文件夹名称
|
||||
params?: any // 其他查询参数
|
||||
pagination?: boolean | VxeGridPropTypes.PagerConfig // 分页配置参数
|
||||
toolBar?: boolean | VxeGridPropTypes.ToolbarConfig // 右侧工具栏配置参数
|
||||
}
|
||||
export type XColumns = VxeGridPropTypes.Columns
|
||||
|
||||
export type VxeTableColumn = {
|
||||
field: string
|
||||
title?: string
|
||||
children?: VxeTableColumn[]
|
||||
} & Recordable
|
||||
@ -1,354 +0,0 @@
|
||||
import {
|
||||
FormItemRenderOptions,
|
||||
VxeColumnPropTypes,
|
||||
VxeFormItemProps,
|
||||
VxeGridPropTypes,
|
||||
VxeTableDefines
|
||||
} from 'vxe-table'
|
||||
import { eachTree } from 'xe-utils'
|
||||
|
||||
import { getBoolDictOptions, getDictOptions, getIntDictOptions } from '@/utils/dict'
|
||||
import { FormSchema } from '@/types/form'
|
||||
import { VxeTableColumn } from '@/types/table'
|
||||
import { ComponentOptions } from '@/types/components'
|
||||
import { DescriptionsSchema } from '@/types/descriptions'
|
||||
|
||||
export type VxeCrudSchema = {
|
||||
primaryKey?: string // 主键ID
|
||||
primaryTitle?: string // 主键标题 默认为序号
|
||||
primaryType?: VxeColumnPropTypes.Type | 'id' // 还支持 "id" | "seq" | "radio" | "checkbox" | "expand" | "html" | null
|
||||
firstColumn?: VxeColumnPropTypes.Type // 第一列显示类型
|
||||
action?: boolean // 是否开启表格内右侧操作栏插槽
|
||||
actionTitle?: string // 操作栏标题 默认为操作
|
||||
actionWidth?: string // 操作栏插槽宽度,一般2个字带图标 text 类型按钮 50-70
|
||||
columns: VxeCrudColumns[]
|
||||
searchSpan?: number
|
||||
}
|
||||
type VxeCrudColumns = Omit<VxeTableColumn, 'children'> & {
|
||||
field: string // 字段名
|
||||
title?: string // 标题名
|
||||
formatter?: VxeColumnPropTypes.Formatter // vxe formatter格式化
|
||||
isSearch?: boolean // 是否在查询显示
|
||||
search?: CrudSearchParams // 查询的详细配置
|
||||
isTable?: boolean // 是否在列表显示
|
||||
table?: CrudTableParams // 列表的详细配置
|
||||
isForm?: boolean // 是否在表单显示
|
||||
form?: CrudFormParams // 表单的详细配置
|
||||
isDetail?: boolean // 是否在详情显示
|
||||
detail?: CrudDescriptionsParams // 详情的详细配置
|
||||
print?: CrudPrintParams // vxe 打印的字段
|
||||
children?: VxeCrudColumns[] // 子级
|
||||
dictType?: string // 字典类型
|
||||
dictClass?: 'string' | 'number' | 'boolean' // 字典数据类型 string | number | boolean
|
||||
}
|
||||
|
||||
type CrudSearchParams = {
|
||||
// 是否显示在查询项
|
||||
show?: boolean
|
||||
} & Omit<VxeFormItemProps, 'field'>
|
||||
|
||||
type CrudTableParams = {
|
||||
// 是否显示表头
|
||||
show?: boolean
|
||||
} & Omit<VxeTableDefines.ColumnOptions, 'field'>
|
||||
|
||||
type CrudFormParams = {
|
||||
// 是否显示表单项
|
||||
show?: boolean
|
||||
} & Omit<FormSchema, 'field'>
|
||||
|
||||
type CrudDescriptionsParams = {
|
||||
// 是否显示表单项
|
||||
show?: boolean
|
||||
} & Omit<DescriptionsSchema, 'field'>
|
||||
|
||||
type CrudPrintParams = {
|
||||
// 是否显示打印项
|
||||
show?: boolean
|
||||
} & Omit<VxeTableDefines.ColumnInfo[], 'field'>
|
||||
|
||||
export type VxeAllSchemas = {
|
||||
searchSchema: VxeFormItemProps[]
|
||||
tableSchema: VxeGridPropTypes.Columns
|
||||
formSchema: FormSchema[]
|
||||
detailSchema: DescriptionsSchema[]
|
||||
printSchema: VxeTableDefines.ColumnInfo[]
|
||||
}
|
||||
|
||||
// 过滤所有结构
|
||||
export const useVxeCrudSchemas = (
|
||||
crudSchema: VxeCrudSchema
|
||||
): {
|
||||
allSchemas: VxeAllSchemas
|
||||
} => {
|
||||
// 所有结构数据
|
||||
const allSchemas = reactive<VxeAllSchemas>({
|
||||
searchSchema: [],
|
||||
tableSchema: [],
|
||||
formSchema: [],
|
||||
detailSchema: [],
|
||||
printSchema: []
|
||||
})
|
||||
|
||||
const searchSchema = filterSearchSchema(crudSchema)
|
||||
allSchemas.searchSchema = searchSchema || []
|
||||
|
||||
const tableSchema = filterTableSchema(crudSchema)
|
||||
allSchemas.tableSchema = tableSchema || []
|
||||
|
||||
const formSchema = filterFormSchema(crudSchema)
|
||||
allSchemas.formSchema = formSchema
|
||||
|
||||
const detailSchema = filterDescriptionsSchema(crudSchema)
|
||||
allSchemas.detailSchema = detailSchema
|
||||
|
||||
const printSchema = filterPrintSchema(crudSchema)
|
||||
allSchemas.printSchema = printSchema
|
||||
|
||||
return {
|
||||
allSchemas
|
||||
}
|
||||
}
|
||||
|
||||
// 过滤 Search 结构
|
||||
const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => {
|
||||
const { t } = useI18n()
|
||||
const span = crudSchema.searchSpan ? crudSchema.searchSpan : 6
|
||||
const spanLength = 24 / span
|
||||
const searchSchema: VxeFormItemProps[] = []
|
||||
eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
|
||||
// 判断是否显示
|
||||
if (schemaItem?.isSearch || schemaItem.search?.show) {
|
||||
let itemRenderName = schemaItem?.search?.itemRender?.name || '$input'
|
||||
const options: any[] = []
|
||||
let itemRender: FormItemRenderOptions = {}
|
||||
|
||||
if (schemaItem.dictType) {
|
||||
const allOptions = { label: '全部', value: '' }
|
||||
options.push(allOptions)
|
||||
getDictOptions(schemaItem.dictType).forEach((dict) => {
|
||||
options.push(dict)
|
||||
})
|
||||
itemRender.options = options
|
||||
if (!schemaItem?.search?.itemRender?.name) itemRenderName = '$select'
|
||||
itemRender = {
|
||||
name: itemRenderName,
|
||||
options: options,
|
||||
props: { placeholder: t('common.selectText') }
|
||||
}
|
||||
} else {
|
||||
if (schemaItem.search?.itemRender) {
|
||||
itemRender = schemaItem.search.itemRender
|
||||
} else {
|
||||
itemRender = {
|
||||
name: itemRenderName,
|
||||
props:
|
||||
itemRenderName == '$input'
|
||||
? { placeholder: t('common.inputText') }
|
||||
: { placeholder: t('common.selectText') }
|
||||
}
|
||||
}
|
||||
}
|
||||
const searchSchemaItem = {
|
||||
// 默认为 input
|
||||
folding: searchSchema.length > spanLength - 1,
|
||||
itemRender: schemaItem.itemRender ? schemaItem.itemRender : itemRender,
|
||||
field: schemaItem.field,
|
||||
title: schemaItem.search?.title || schemaItem.title,
|
||||
slots: schemaItem.search?.slots,
|
||||
span: span
|
||||
}
|
||||
searchSchema.push(searchSchemaItem)
|
||||
}
|
||||
})
|
||||
if (searchSchema.length > 0) {
|
||||
// 添加搜索按钮
|
||||
const buttons: VxeFormItemProps = {
|
||||
span: 24,
|
||||
align: 'right',
|
||||
collapseNode: searchSchema.length > spanLength,
|
||||
itemRender: {
|
||||
name: '$buttons',
|
||||
children: [
|
||||
{ props: { type: 'submit', content: t('common.query'), status: 'primary' } },
|
||||
{ props: { type: 'reset', content: t('common.reset') } }
|
||||
]
|
||||
}
|
||||
}
|
||||
searchSchema.push(buttons)
|
||||
}
|
||||
return searchSchema
|
||||
}
|
||||
|
||||
// 过滤 table 结构
|
||||
const filterTableSchema = (crudSchema: VxeCrudSchema): VxeGridPropTypes.Columns => {
|
||||
const { t } = useI18n()
|
||||
const tableSchema: VxeGridPropTypes.Columns = []
|
||||
// 第一列
|
||||
if (crudSchema.firstColumn) {
|
||||
const tableSchemaItem = {
|
||||
type: crudSchema.firstColumn,
|
||||
width: '50px'
|
||||
}
|
||||
tableSchema.push(tableSchemaItem)
|
||||
}
|
||||
// 主键ID
|
||||
if (crudSchema.primaryKey && crudSchema.primaryType) {
|
||||
const primaryTitle = crudSchema.primaryTitle ? crudSchema.primaryTitle : t('common.index')
|
||||
const primaryWidth = primaryTitle.length * 30 + 'px'
|
||||
|
||||
let tableSchemaItem: { [x: string]: any } = {
|
||||
title: primaryTitle,
|
||||
field: crudSchema.primaryKey,
|
||||
width: primaryWidth
|
||||
}
|
||||
if (crudSchema.primaryType != 'id') {
|
||||
tableSchemaItem = {
|
||||
...tableSchemaItem,
|
||||
type: crudSchema.primaryType
|
||||
}
|
||||
}
|
||||
tableSchema.push(tableSchemaItem)
|
||||
}
|
||||
|
||||
eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
|
||||
// 判断是否显示
|
||||
if (schemaItem?.isTable !== false && schemaItem?.table?.show !== false) {
|
||||
const tableSchemaItem = {
|
||||
...schemaItem.table,
|
||||
field: schemaItem.field,
|
||||
title: schemaItem.table?.title || schemaItem.title,
|
||||
minWidth: '80px'
|
||||
}
|
||||
tableSchemaItem.showOverflow = 'tooltip'
|
||||
if (schemaItem?.formatter) {
|
||||
tableSchemaItem.formatter = schemaItem.formatter
|
||||
tableSchemaItem.width = tableSchemaItem.width ? tableSchemaItem.width : 160
|
||||
}
|
||||
if (schemaItem?.dictType) {
|
||||
tableSchemaItem.cellRender = {
|
||||
name: 'XDict',
|
||||
content: schemaItem.dictType
|
||||
}
|
||||
tableSchemaItem.width = tableSchemaItem.width ? tableSchemaItem.width : 160
|
||||
}
|
||||
|
||||
tableSchema.push(tableSchemaItem)
|
||||
}
|
||||
})
|
||||
// 操作栏插槽
|
||||
if (crudSchema.action && crudSchema.action == true) {
|
||||
const tableSchemaItem = {
|
||||
title: crudSchema.actionTitle ? crudSchema.actionTitle : t('table.action'),
|
||||
field: 'actionbtns',
|
||||
fixed: 'right' as unknown as VxeColumnPropTypes.Fixed,
|
||||
width: crudSchema.actionWidth ? crudSchema.actionWidth : '200px',
|
||||
slots: {
|
||||
default: 'actionbtns_default'
|
||||
}
|
||||
}
|
||||
tableSchema.push(tableSchemaItem)
|
||||
}
|
||||
return tableSchema
|
||||
}
|
||||
|
||||
// 过滤 form 结构
|
||||
const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => {
|
||||
const formSchema: FormSchema[] = []
|
||||
|
||||
eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
|
||||
// 判断是否显示
|
||||
if (schemaItem?.isForm !== false && schemaItem?.form?.show !== false) {
|
||||
// 默认为 input
|
||||
let component = schemaItem?.form?.component || 'Input'
|
||||
let defaultValue: any = ''
|
||||
if (schemaItem.form?.value) {
|
||||
defaultValue = schemaItem.form?.value
|
||||
} else {
|
||||
if (component === 'InputNumber') {
|
||||
defaultValue = 0
|
||||
}
|
||||
}
|
||||
let comonentProps = {}
|
||||
if (schemaItem.dictType) {
|
||||
const options: ComponentOptions[] = []
|
||||
if (schemaItem.dictClass && schemaItem.dictClass === 'number') {
|
||||
getIntDictOptions(schemaItem.dictType).forEach((dict) => {
|
||||
options.push(dict)
|
||||
})
|
||||
} else if (schemaItem.dictClass && schemaItem.dictClass === 'boolean') {
|
||||
getBoolDictOptions(schemaItem.dictType).forEach((dict) => {
|
||||
options.push(dict)
|
||||
})
|
||||
} else {
|
||||
getDictOptions(schemaItem.dictType).forEach((dict) => {
|
||||
options.push(dict)
|
||||
})
|
||||
}
|
||||
comonentProps = {
|
||||
options: options
|
||||
}
|
||||
if (!(schemaItem.form && schemaItem.form.component)) component = 'Select'
|
||||
}
|
||||
const formSchemaItem = {
|
||||
component: component,
|
||||
componentProps: comonentProps,
|
||||
value: defaultValue,
|
||||
...schemaItem.form,
|
||||
field: schemaItem.field,
|
||||
label: schemaItem.form?.label || schemaItem.title
|
||||
}
|
||||
|
||||
formSchema.push(formSchemaItem)
|
||||
}
|
||||
})
|
||||
|
||||
return formSchema
|
||||
}
|
||||
|
||||
// 过滤 descriptions 结构
|
||||
const filterDescriptionsSchema = (crudSchema: VxeCrudSchema): DescriptionsSchema[] => {
|
||||
const descriptionsSchema: DescriptionsSchema[] = []
|
||||
|
||||
eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
|
||||
// 判断是否显示
|
||||
if (schemaItem?.isDetail !== false && schemaItem.detail?.show !== false) {
|
||||
const descriptionsSchemaItem = {
|
||||
...schemaItem.detail,
|
||||
field: schemaItem.field,
|
||||
label: schemaItem.detail?.label || schemaItem.title
|
||||
}
|
||||
if (schemaItem.dictType) {
|
||||
descriptionsSchemaItem.dictType = schemaItem.dictType
|
||||
}
|
||||
if (schemaItem.detail?.dateFormat || schemaItem.formatter == 'formatDate') {
|
||||
// 优先使用 detail 下的配置,如果没有默认为 YYYY-MM-DD HH:mm:ss
|
||||
descriptionsSchemaItem.dateFormat = schemaItem?.detail?.dateFormat
|
||||
? schemaItem?.detail?.dateFormat
|
||||
: 'YYYY-MM-DD HH:mm:ss'
|
||||
}
|
||||
|
||||
descriptionsSchema.push(descriptionsSchemaItem)
|
||||
}
|
||||
})
|
||||
|
||||
return descriptionsSchema
|
||||
}
|
||||
|
||||
// 过滤 打印 结构
|
||||
const filterPrintSchema = (crudSchema: VxeCrudSchema): any[] => {
|
||||
const printSchema: any[] = []
|
||||
|
||||
eachTree(crudSchema.columns, (schemaItem: VxeCrudColumns) => {
|
||||
// 判断是否显示
|
||||
if (schemaItem?.print?.show !== false) {
|
||||
const printSchemaItem = {
|
||||
field: schemaItem.field
|
||||
}
|
||||
|
||||
printSchema.push(printSchemaItem)
|
||||
}
|
||||
})
|
||||
|
||||
return printSchema
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
import { ElDatePicker } from 'element-plus'
|
||||
import { VXETable } from 'vxe-table'
|
||||
|
||||
// 日期区间选择渲染
|
||||
VXETable.renderer.add('XDataPicker', {
|
||||
// 默认显示模板
|
||||
renderItemContent(renderOpts, params) {
|
||||
const { data, field } = params
|
||||
const { content } = renderOpts
|
||||
return (
|
||||
<ElDatePicker
|
||||
v-model={data[field]}
|
||||
style="width: 100%"
|
||||
type={content ? (content as any) : 'datetime'}
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
clearable
|
||||
></ElDatePicker>
|
||||
)
|
||||
}
|
||||
})
|
||||
@ -1,23 +0,0 @@
|
||||
import { ElDatePicker } from 'element-plus'
|
||||
import { VXETable } from 'vxe-table'
|
||||
|
||||
// 日期区间选择渲染
|
||||
VXETable.renderer.add('XDataTimePicker', {
|
||||
// 默认显示模板
|
||||
renderItemContent(renderOpts, params) {
|
||||
const { t } = useI18n()
|
||||
const { data, field } = params
|
||||
const { content } = renderOpts
|
||||
return (
|
||||
<ElDatePicker
|
||||
v-model={data[field]}
|
||||
style="width: 100%"
|
||||
type={content ? (content as any) : 'datetimerange'}
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
range-separator="-"
|
||||
start-placeholder={t('common.startTimeText')}
|
||||
end-placeholder={t('common.endTimeText')}
|
||||
></ElDatePicker>
|
||||
)
|
||||
}
|
||||
})
|
||||
@ -1,12 +0,0 @@
|
||||
import { DictTag } from '@/components/DictTag'
|
||||
import { VXETable } from 'vxe-table'
|
||||
|
||||
// 字典渲染
|
||||
VXETable.renderer.add('XDict', {
|
||||
// 默认显示模板
|
||||
renderDefault(renderOpts, params) {
|
||||
const { row, column } = params
|
||||
const { content } = renderOpts
|
||||
return <DictTag type={content as unknown as string} value={row[column.field]}></DictTag>
|
||||
}
|
||||
})
|
||||
@ -1,10 +0,0 @@
|
||||
import { VXETable } from 'vxe-table'
|
||||
|
||||
// 图片渲染
|
||||
VXETable.renderer.add('XHtml', {
|
||||
// 默认显示模板
|
||||
renderDefault(_renderOpts, params) {
|
||||
const { row, column } = params
|
||||
return <span v-html={row[column.field]}></span>
|
||||
}
|
||||
})
|
||||
@ -1,20 +0,0 @@
|
||||
import { VXETable } from 'vxe-table'
|
||||
import { ElImage } from 'element-plus'
|
||||
|
||||
// 图片渲染
|
||||
VXETable.renderer.add('XImg', {
|
||||
// 默认显示模板
|
||||
renderDefault(_renderOpts, params) {
|
||||
const { row, column } = params
|
||||
return (
|
||||
<ElImage
|
||||
style="width: 80px; height: 50px"
|
||||
src={row[column.field]}
|
||||
key={row[column.field]}
|
||||
preview-src-list={[row[column.field]]}
|
||||
fit="contain"
|
||||
lazy
|
||||
></ElImage>
|
||||
)
|
||||
}
|
||||
})
|
||||
@ -1,7 +0,0 @@
|
||||
import './dataPicker'
|
||||
import './dataTimeRangePicker'
|
||||
import './dict'
|
||||
import './html'
|
||||
import './link'
|
||||
import './img'
|
||||
import './preview'
|
||||
@ -1,15 +0,0 @@
|
||||
import { VXETable } from 'vxe-table'
|
||||
|
||||
// 超链接渲染
|
||||
VXETable.renderer.add('XLink', {
|
||||
// 默认显示模板
|
||||
renderDefault(renderOpts, params) {
|
||||
const { row, column } = params
|
||||
const { events = {} } = renderOpts
|
||||
return (
|
||||
<a class="link" onClick={() => events.click(params)}>
|
||||
{row[column.field]}
|
||||
</a>
|
||||
)
|
||||
}
|
||||
})
|
||||
@ -1,35 +0,0 @@
|
||||
import { VXETable } from 'vxe-table'
|
||||
import { ElImage, ElLink } from 'element-plus'
|
||||
|
||||
// 图片渲染
|
||||
VXETable.renderer.add('XPreview', {
|
||||
// 默认显示模板
|
||||
renderDefault(_renderOpts, params) {
|
||||
const { row, column } = params
|
||||
if (row.type.indexOf('image/') === 0) {
|
||||
return (
|
||||
<ElImage
|
||||
style="width: 80px; height: 50px"
|
||||
src={row[column.field]}
|
||||
key={row[column.field]}
|
||||
preview-src-list={[row[column.field]]}
|
||||
fit="contain"
|
||||
lazy
|
||||
></ElImage>
|
||||
)
|
||||
} else if (row.type.indexOf('video/') === 0) {
|
||||
return (
|
||||
<video>
|
||||
<source src={row[column.field]}></source>
|
||||
</video>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
// @ts-ignore
|
||||
<ElLink href={row[column.field]} target="_blank">
|
||||
{row[column.field]}
|
||||
</ElLink>
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
Loading…
Reference in New Issue