维度隐藏列

This commit is contained in:
mll
2026-02-09 20:16:36 +08:00
parent f9393dfca8
commit bcac3326a3
5 changed files with 62 additions and 6 deletions

View File

@@ -183,6 +183,43 @@ export const useRenderVxeColumn = (useType = 'table') => {
)
}
},
LowSelectMultiple: {
default: (renderOpts, { row, column }, isStop = false) => {
const { dicData } = renderOpts
const value = row[column.field]
const valStr=dicData.filter(item=>value.includes(item.value)).map(item=>item.label).join('')
return <span>{valStr}</span>
},
edit: (renderOpts, { row, rowIndex, column }) => {
const { multiple, filterable, allowCreate, typeKey ,dicData} = renderOpts
interface DictItem {
label: string;
value: string | number;
[key: string]: any; // 兼容其他可能的字段
}
return (
<el-select
popper-class="vxe-table--ignore-clear"
v-model={row[column.field]}
placeholder={'请选择 ' + column.title}
multiple={multiple}
filterable={filterable}
collapseTags={true}
collapseTagsTooltip={true}
allowCreate={allowCreate}
clearable={true}
>
{dicData.map((item: DictItem, index: number) => (
<el-option
key={index} // 建议用 item.value 作为 key更稳定
label={item.label}
value={item.value}
/>
))}
</el-select>
)
}
},
LowSummaryBottomSql: {
default: (renderOpts, { row, column }, isStop = false) => {
const { dicObj } = renderOpts

View File

@@ -89,6 +89,7 @@ const parentFieldMap = ref(new Map())
const fieldList = computed(() => {
let dicData: Array<{ label: string; value: string; type: string }> = []
infoData.value.basics.forEach((item) => {
if (item.fieldCode && item.isDb == 'Y')
dicData.push({
label: `${item.fieldCode}${item.fieldName ? '' + item.fieldName + '' : ''}`,
@@ -257,7 +258,9 @@ const initEditInfoData = () => {
if (fieldItem.hasChildren === 'Y') {
fieldItem.hasChildren = 'Y'
}
if (!!fieldItem.isHideDimension&&Object.prototype.toString.call(fieldItem.isHideDimension) == '[object String]') {
fieldItem.isHideDimension=fieldItem.isHideDimension.split(',')
}
fieldList.push(fieldItem)
})
@@ -282,7 +285,9 @@ onMounted(() => {
})
}
}
tableInfoOption.infoColumn.fieldColumn.isHideDimension.editRender.dicData = infoData.value.basics.map(({fieldCode,fieldName})=>{
return {label:fieldName,value:fieldCode}
})
// 设置父字段下拉选项
const updateParentFieldOptions = () => {
// 获取所有parentFieldCode为空的字段作为可选父字段

View File

@@ -159,7 +159,8 @@ const infoColumn = {
isExport: { title: '是否可导出', width: 90, align: "center", editRender: { name: 'LowCheckbox' } },
isAmount: { title: '是否合计', width: 75, align: "center", editRender: { name: 'LowCheckboxSum' } },
isDimension: { title: '是否维度', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
isHideDimension: { title: '维度隐藏列', width: 180, editRender: { name: 'LowSelectMultiple', verifyEdit: true, filterable: true, multiple:true,dicData: [] } },
isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
hasChildren: { title: '子字段', width: 90, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isSubField === true, buttonText: '添加子字段', buttonType: 'primary', buttonSize: 'small' } },
},
@@ -187,7 +188,7 @@ for (const key in infoColumn) {
//默认值
const infoDefaultData = {
basics: {
fieldCode: '', fieldName: '', parentFieldName: '', labelI18n: '', fieldType: 'String', queryIsDb: 'N', queryIsWeb: 'N', queryMode: 'LIKE', dictCode: '', isExport: 'Y', isShowSort: 'N', isAmount: '', isDimension: '', hasChildren: 'N', isSubField: false, parentFieldId: '', parentFieldCode: '',
fieldCode: '', fieldName: '', parentFieldName: '', labelI18n: '', fieldType: 'String', queryIsDb: 'N', queryIsWeb: 'N', queryMode: 'LIKE', dictCode: '', isExport: 'Y', isShowSort: 'N', isAmount: '', isDimension: '',isHideDimension:'', hasChildren: 'N', isSubField: false, parentFieldId: '', parentFieldCode: '',
},
}

View File

@@ -349,7 +349,7 @@ const tableFormVerify = (type) => {
const index = Number(i)
const item = filedData[index]
item.sortNum = index + 1
item.isHideDimension?item.isHideDimension=item.isHideDimension.join(','):''
let messageText = ''
let tabKey = 'mysql'
// 子字段不能再包含子字段