no message
This commit is contained in:
@@ -69,6 +69,7 @@ interface ColumnConfig {
|
|||||||
filterable: boolean
|
filterable: boolean
|
||||||
sortable: string | boolean
|
sortable: string | boolean
|
||||||
showColumn: boolean
|
showColumn: boolean
|
||||||
|
sortNum?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -93,10 +94,6 @@ const initColumnConfig = () => {
|
|||||||
if (!props.columns) return
|
if (!props.columns) return
|
||||||
|
|
||||||
columnConfigList.value = Object.keys(props.columns)
|
columnConfigList.value = Object.keys(props.columns)
|
||||||
.filter(key => {
|
|
||||||
const column = props.columns[key]
|
|
||||||
return column.showColumn !== false && column.prop
|
|
||||||
})
|
|
||||||
.map(key => {
|
.map(key => {
|
||||||
const column = props.columns[key]
|
const column = props.columns[key]
|
||||||
return {
|
return {
|
||||||
@@ -106,10 +103,18 @@ const initColumnConfig = () => {
|
|||||||
fixed: column.fixed || false,
|
fixed: column.fixed || false,
|
||||||
filterable: column.filterable || false,
|
filterable: column.filterable || false,
|
||||||
sortable: column.sortable || false,
|
sortable: column.sortable || false,
|
||||||
showColumn: column.showColumn !== false
|
showColumn: column.showColumn !== false,
|
||||||
|
sortNum: column.sortNum
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
|
// 优先按 sortNum 排序(从小到大)
|
||||||
|
if (a.sortNum !== undefined && b.sortNum !== undefined) {
|
||||||
|
return a.sortNum - b.sortNum
|
||||||
|
}
|
||||||
|
if (a.sortNum !== undefined) return -1
|
||||||
|
if (b.sortNum !== undefined) return 1
|
||||||
|
// 如果都没有 sortNum,则按 label 排序
|
||||||
const labelA = a.label || ''
|
const labelA = a.label || ''
|
||||||
const labelB = b.label || ''
|
const labelB = b.label || ''
|
||||||
return labelA.localeCompare(labelB, 'zh-CN')
|
return labelA.localeCompare(labelB, 'zh-CN')
|
||||||
|
|||||||
@@ -1417,7 +1417,6 @@ const replaceColumnButton = () => {
|
|||||||
|
|
||||||
// 添加新的事件监听器
|
// 添加新的事件监听器
|
||||||
newButtonClone.addEventListener('click', (e) => {
|
newButtonClone.addEventListener('click', (e) => {
|
||||||
debugger
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
showColumnConfigDrawer.value = true
|
showColumnConfigDrawer.value = true
|
||||||
@@ -1555,12 +1554,10 @@ const loadColumnConfigToFieldList = async () => {
|
|||||||
try {
|
try {
|
||||||
const pageId = (route.params.id as string) || props.tableId
|
const pageId = (route.params.id as string) || props.tableId
|
||||||
const savedConfig = await getColumnConfig(pageId)
|
const savedConfig = await getColumnConfig(pageId)
|
||||||
debugger
|
|
||||||
|
|
||||||
if (savedConfig) {
|
if (savedConfig) {
|
||||||
// 修改 fieldList 中的 webEntity.isShowColumn
|
// 修改 fieldList 中的 webEntity.isShowColumn
|
||||||
fieldListRef.value.forEach((field: any) => {
|
fieldListRef.value.forEach((field: any) => {
|
||||||
debugger
|
|
||||||
if (field.webEntity && field.fieldCode && savedConfig[field.fieldCode] !== undefined) {
|
if (field.webEntity && field.fieldCode && savedConfig[field.fieldCode] !== undefined) {
|
||||||
const colConfig = savedConfig[field.fieldCode]
|
const colConfig = savedConfig[field.fieldCode]
|
||||||
// 优先使用 isShowColumn,如果没有则使用 hide 转换
|
// 优先使用 isShowColumn,如果没有则使用 hide 转换
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ const initColumn = (data, componentData, columnParams) => {
|
|||||||
const summaryBottom = {}
|
const summaryBottom = {}
|
||||||
const tableDic = {}
|
const tableDic = {}
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
const { dictEntity, webEntity, queryEntity, exportEntity, summaryEntity, fieldCode, fieldName, fieldType, fieldLen, fieldPointLen, fieldDefaultVal } = item
|
const { dictEntity, webEntity, queryEntity, exportEntity, summaryEntity, fieldCode, fieldName, fieldType, fieldLen, fieldPointLen, fieldDefaultVal, sortNum } = item
|
||||||
const { cellWidthType, cellWidth, controlsConfig, verifyConfig, isShowForm, isShowList, isDbSelect, isShowColumn, isShowSort, isRequired } = webEntity
|
const { cellWidthType, cellWidth, controlsConfig, verifyConfig, isShowForm, isShowList, isDbSelect, isShowColumn, isShowSort, isRequired } = webEntity
|
||||||
let controlType = webEntity.controlType || 'input'
|
let controlType = webEntity.controlType || 'input'
|
||||||
const { queryIsWeb, queryMode, queryConfig, queryDefaultVal } = queryEntity
|
const { queryIsWeb, queryMode, queryConfig, queryDefaultVal } = queryEntity
|
||||||
@@ -140,7 +140,8 @@ const initColumn = (data, componentData, columnParams) => {
|
|||||||
dataType: ['Integer', 'BigInt', 'BigDecimal'].includes(fieldType) || controlType == 'number' ? 'number' : 'string',
|
dataType: ['Integer', 'BigInt', 'BigDecimal'].includes(fieldType) || controlType == 'number' ? 'number' : 'string',
|
||||||
overHidden: isCardTable ? false : true,
|
overHidden: isCardTable ? false : true,
|
||||||
className: `low-field__${fieldCode} control-${controlType}`,
|
className: `low-field__${fieldCode} control-${controlType}`,
|
||||||
labelClassName: `low-header__${fieldCode}`
|
labelClassName: `low-header__${fieldCode}`,
|
||||||
|
sortNum: sortNum
|
||||||
}
|
}
|
||||||
|
|
||||||
//租户字段的列表、表单权限控制
|
//租户字段的列表、表单权限控制
|
||||||
|
|||||||
Reference in New Issue
Block a user