|
|
@ -16,9 +16,11 @@
|
|
|
|
</a-button>
|
|
|
|
</a-button>
|
|
|
|
<!-- 列设置 -->
|
|
|
|
<!-- 列设置 -->
|
|
|
|
<HColSet
|
|
|
|
<HColSet
|
|
|
|
|
|
|
|
:id="vxeSetId"
|
|
|
|
:code="getBindValues.id"
|
|
|
|
:code="getBindValues.id"
|
|
|
|
:columns="columns"
|
|
|
|
:columns="getBindValues.columns"
|
|
|
|
type="vxe"
|
|
|
|
type="vxe"
|
|
|
|
|
|
|
|
@updateCol="updateCol"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -42,22 +44,27 @@
|
|
|
|
:loading="getBindValues.loading"
|
|
|
|
:loading="getBindValues.loading"
|
|
|
|
@cell-dblclick="dbclickVxeRow"
|
|
|
|
@cell-dblclick="dbclickVxeRow"
|
|
|
|
@sort-change="sortChangeEvent"
|
|
|
|
@sort-change="sortChangeEvent"
|
|
|
|
|
|
|
|
@resizable-change="resizableChangeEvent"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<vxe-column type="checkbox" width="40"></vxe-column>
|
|
|
|
<vxe-column type="checkbox" width="40"></vxe-column>
|
|
|
|
<!-- <vxe-column type="seq" width="40"></vxe-column> -->
|
|
|
|
<!-- <vxe-column type="seq" width="40"></vxe-column> -->
|
|
|
|
<vxe-column
|
|
|
|
<template
|
|
|
|
v-for="(item, index) in getBindValues.columns"
|
|
|
|
v-for="(item, index) in getBindValues.columns"
|
|
|
|
:key="`${item.dataIndex}-${index}`"
|
|
|
|
|
|
|
|
:title="item.customTitle"
|
|
|
|
|
|
|
|
:field="item.dataIndex"
|
|
|
|
|
|
|
|
:width="item.width"
|
|
|
|
|
|
|
|
:sortable="item.sorter"
|
|
|
|
|
|
|
|
:filters="item.filters"
|
|
|
|
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<template #default="{ row }">
|
|
|
|
<vxe-column
|
|
|
|
<slot name="bodyCell" :column="item" :record="row">{{ row[item.dataIndex] }}</slot>
|
|
|
|
v-if="item.visible !== false"
|
|
|
|
</template>
|
|
|
|
:key="`${item.dataIndex}-${index}`"
|
|
|
|
</vxe-column>
|
|
|
|
:title="item.customTitle"
|
|
|
|
|
|
|
|
:field="item.dataIndex"
|
|
|
|
|
|
|
|
:width="item.width"
|
|
|
|
|
|
|
|
:sortable="item.sorter"
|
|
|
|
|
|
|
|
:filters="item.filters"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
|
|
|
<slot name="bodyCell" :column="item" :record="row">{{ row[item.dataIndex] }}</slot>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</vxe-column>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<template #loading>
|
|
|
|
<template #loading>
|
|
|
|
<a-spin />
|
|
|
|
<a-spin />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -94,7 +101,7 @@
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
<script lang="ts">
|
|
|
|
import type { BasicTableProps, TableActionType, SizeType, ColumnChangeParam } from './types/table'
|
|
|
|
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 { Table, Pagination } from 'ant-design-vue'
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
import { BasicForm, useForm } from '/@/components/Form/index'
|
|
|
|
import { PageWrapperFixedHeightKey } from '/@/components/Page'
|
|
|
|
import { PageWrapperFixedHeightKey } from '/@/components/Page'
|
|
|
@ -122,6 +129,10 @@ import { omit } from 'lodash-es'
|
|
|
|
import { basicProps } from './props'
|
|
|
|
import { basicProps } from './props'
|
|
|
|
import { isFunction } from '/@/utils/is'
|
|
|
|
import { isFunction } from '/@/utils/is'
|
|
|
|
import { warn } from '/@/utils/log'
|
|
|
|
import { warn } from '/@/utils/log'
|
|
|
|
|
|
|
|
// vxe列设置接口
|
|
|
|
|
|
|
|
import { getColumnSetInfoByModule } from '/@/views/baseinfo/columnset/api'
|
|
|
|
|
|
|
|
// 引入表格权限信息(包含id和name)
|
|
|
|
|
|
|
|
import { permissionsInfo } from '/@/hooks/web/usePermission'
|
|
|
|
|
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'BasicTable',
|
|
|
|
name: 'BasicTable',
|
|
|
@ -311,7 +322,6 @@ export default defineComponent({
|
|
|
|
// if (slots.expandedRowRender) {
|
|
|
|
// if (slots.expandedRowRender) {
|
|
|
|
// propsData = omit(propsData, 'scroll');
|
|
|
|
// propsData = omit(propsData, 'scroll');
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
propsData = omit(propsData, ['class', 'onChange'])
|
|
|
|
propsData = omit(propsData, ['class', 'onChange'])
|
|
|
|
return propsData
|
|
|
|
return propsData
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -345,7 +355,22 @@ export default defineComponent({
|
|
|
|
setPagination(pageConfig)
|
|
|
|
setPagination(pageConfig)
|
|
|
|
reload()
|
|
|
|
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 = {
|
|
|
|
const tableAction: TableActionType = {
|
|
|
|
reload,
|
|
|
|
reload,
|
|
|
|
getSelectRows,
|
|
|
|
getSelectRows,
|
|
|
@ -405,6 +430,21 @@ export default defineComponent({
|
|
|
|
fetch()
|
|
|
|
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 = () => {
|
|
|
|
const initColSet = () => {
|
|
|
|
|
|
|
|
|
|
|
@ -419,6 +459,7 @@ export default defineComponent({
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
|
|
|
|
vxeSetId,
|
|
|
|
formRef,
|
|
|
|
formRef,
|
|
|
|
tableElRef,
|
|
|
|
tableElRef,
|
|
|
|
getBindValues,
|
|
|
|
getBindValues,
|
|
|
@ -427,6 +468,7 @@ export default defineComponent({
|
|
|
|
handleSearchInfoChange,
|
|
|
|
handleSearchInfoChange,
|
|
|
|
getEmptyDataIsShowTable,
|
|
|
|
getEmptyDataIsShowTable,
|
|
|
|
sortChangeEvent,
|
|
|
|
sortChangeEvent,
|
|
|
|
|
|
|
|
resizableChangeEvent,
|
|
|
|
// filterChangeEvent,
|
|
|
|
// filterChangeEvent,
|
|
|
|
handleTableChange,
|
|
|
|
handleTableChange,
|
|
|
|
getRowClassName,
|
|
|
|
getRowClassName,
|
|
|
@ -445,7 +487,8 @@ export default defineComponent({
|
|
|
|
getWrapperClass,
|
|
|
|
getWrapperClass,
|
|
|
|
columns: getViewColumns,
|
|
|
|
columns: getViewColumns,
|
|
|
|
resizeColumn,
|
|
|
|
resizeColumn,
|
|
|
|
reload
|
|
|
|
reload,
|
|
|
|
|
|
|
|
updateCol
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
})
|
|
|
|
})
|
|
|
|