|
|
|
@ -16,9 +16,11 @@
|
|
|
|
|
</a-button>
|
|
|
|
|
<!-- 列设置 -->
|
|
|
|
|
<HColSet
|
|
|
|
|
:id="vxeSetId"
|
|
|
|
|
:code="getBindValues.id"
|
|
|
|
|
:columns="columns"
|
|
|
|
|
:columns="getBindValues.columns"
|
|
|
|
|
type="vxe"
|
|
|
|
|
@updateCol="updateCol"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
@ -42,11 +44,15 @@
|
|
|
|
|
:loading="getBindValues.loading"
|
|
|
|
|
@cell-dblclick="dbclickVxeRow"
|
|
|
|
|
@sort-change="sortChangeEvent"
|
|
|
|
|
@resizable-change="resizableChangeEvent"
|
|
|
|
|
>
|
|
|
|
|
<vxe-column type="checkbox" width="40"></vxe-column>
|
|
|
|
|
<!-- <vxe-column type="seq" width="40"></vxe-column> -->
|
|
|
|
|
<vxe-column
|
|
|
|
|
<template
|
|
|
|
|
v-for="(item, index) in getBindValues.columns"
|
|
|
|
|
>
|
|
|
|
|
<vxe-column
|
|
|
|
|
v-if="item.visible !== false"
|
|
|
|
|
:key="`${item.dataIndex}-${index}`"
|
|
|
|
|
:title="item.customTitle"
|
|
|
|
|
:field="item.dataIndex"
|
|
|
|
@ -58,6 +64,7 @@
|
|
|
|
|
<slot name="bodyCell" :column="item" :record="row">{{ row[item.dataIndex] }}</slot>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
</template>
|
|
|
|
|
<template #loading>
|
|
|
|
|
<a-spin />
|
|
|
|
|
</template>
|
|
|
|
@ -94,7 +101,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
import type { BasicTableProps, TableActionType, SizeType, ColumnChangeParam } from './types/table'
|
|
|
|
|
import { defineComponent, ref, computed, unref, toRaw, inject, watchEffect } from 'vue'
|
|
|
|
|
import { defineComponent, ref, computed, unref, toRaw, inject, watchEffect, onMounted } from 'vue'
|
|
|
|
|
import { Table, Pagination } from 'ant-design-vue'
|
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
|
import { PageWrapperFixedHeightKey } from '/@/components/Page'
|
|
|
|
@ -122,6 +129,10 @@ import { omit } from 'lodash-es'
|
|
|
|
|
import { basicProps } from './props'
|
|
|
|
|
import { isFunction } from '/@/utils/is'
|
|
|
|
|
import { warn } from '/@/utils/log'
|
|
|
|
|
// vxe列设置接口
|
|
|
|
|
import { getColumnSetInfoByModule } from '/@/views/baseinfo/columnset/api'
|
|
|
|
|
// 引入表格权限信息(包含id和name)
|
|
|
|
|
import { permissionsInfo } from '/@/hooks/web/usePermission'
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
|
name: 'BasicTable',
|
|
|
|
@ -311,7 +322,6 @@ export default defineComponent({
|
|
|
|
|
// if (slots.expandedRowRender) {
|
|
|
|
|
// propsData = omit(propsData, 'scroll');
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
propsData = omit(propsData, ['class', 'onChange'])
|
|
|
|
|
return propsData
|
|
|
|
|
})
|
|
|
|
@ -345,7 +355,22 @@ export default defineComponent({
|
|
|
|
|
setPagination(pageConfig)
|
|
|
|
|
reload()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const vxeSetId = ref('0')
|
|
|
|
|
// vxe 列设置数据查询
|
|
|
|
|
const getVxeColSetData = () => {
|
|
|
|
|
if (props.id) {
|
|
|
|
|
getColumnSetInfoByModule({ permissionId: permissionsInfo().permissionId, columnNo: props.id }).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
const { data } = res
|
|
|
|
|
const columns = JSON.parse(data.content).columns
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
item['title'] = item.customTitle
|
|
|
|
|
})
|
|
|
|
|
setColumns(columns)
|
|
|
|
|
vxeSetId.value = data.id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const tableAction: TableActionType = {
|
|
|
|
|
reload,
|
|
|
|
|
getSelectRows,
|
|
|
|
@ -405,6 +430,21 @@ export default defineComponent({
|
|
|
|
|
fetch()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// vxe拖动列触发实时保存
|
|
|
|
|
const resizableChangeEvent = (item) => {
|
|
|
|
|
|
|
|
|
|
console.log(item)
|
|
|
|
|
}
|
|
|
|
|
// 更新vxe列设置
|
|
|
|
|
const updateCol = (data) => {
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
item['title'] = item.customTitle
|
|
|
|
|
})
|
|
|
|
|
setColumns(data)
|
|
|
|
|
}
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
getVxeColSetData()
|
|
|
|
|
})
|
|
|
|
|
// 初始化列设置
|
|
|
|
|
const initColSet = () => {
|
|
|
|
|
|
|
|
|
@ -419,6 +459,7 @@ export default defineComponent({
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
return {
|
|
|
|
|
vxeSetId,
|
|
|
|
|
formRef,
|
|
|
|
|
tableElRef,
|
|
|
|
|
getBindValues,
|
|
|
|
@ -427,6 +468,7 @@ export default defineComponent({
|
|
|
|
|
handleSearchInfoChange,
|
|
|
|
|
getEmptyDataIsShowTable,
|
|
|
|
|
sortChangeEvent,
|
|
|
|
|
resizableChangeEvent,
|
|
|
|
|
// filterChangeEvent,
|
|
|
|
|
handleTableChange,
|
|
|
|
|
getRowClassName,
|
|
|
|
@ -445,7 +487,8 @@ export default defineComponent({
|
|
|
|
|
getWrapperClass,
|
|
|
|
|
columns: getViewColumns,
|
|
|
|
|
resizeColumn,
|
|
|
|
|
reload
|
|
|
|
|
reload,
|
|
|
|
|
updateCol
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|