isHideCol隐藏列调试修改 去掉子字段和字段分组 根据字典cssClass的值设置整行颜色

This commit is contained in:
mll
2026-03-17 15:43:52 +08:00
parent 280ff0837f
commit 386fb026b5
2 changed files with 21 additions and 9 deletions

View File

@@ -13,6 +13,7 @@
:option="tableOption" :option="tableOption"
v-bind="crudBind" v-bind="crudBind"
:summary-method=summaryMethod1 :summary-method=summaryMethod1
:row-style="rowStyleMethod"
@search-change="searchChange" @search-change="searchChange"
@search-reset="resetChange" @search-reset="resetChange"
@refresh-change="refreshChange" @refresh-change="refreshChange"
@@ -154,6 +155,8 @@ const dimensionFields=ref<any>({})
const exportLoading = ref(false) const exportLoading = ref(false)
const fieldList = ref<any[]>([]) // 添加fieldList引用 const fieldList = ref<any[]>([]) // 添加fieldList引用
const hideFeilds= ref<any>({}) const hideFeilds= ref<any>({})
const hideCols=ref<any>([])
const dictFieldList=ref<any>([])
const permissions = const permissions =
wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[route.meta.menuDataId as string] || false wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[route.meta.menuDataId as string] || false
const selectIds = computed(() => { const selectIds = computed(() => {
@@ -222,6 +225,15 @@ const summaryMethod1=({columns,data})=>{
}) })
return result; return result;
} }
const rowStyleMethod=({row,rowIndex})=>{
let styleObj={}
dictFieldList.value.forEach(item=>{
if(row[item.prop]){
styleObj['color']=item.dicData.find(d=>d.value===row[item.prop]).cssClass
}
})
return styleObj
}
function getCurrentDate() { function getCurrentDate() {
const now = new Date(); const now = new Date();
// 补零函数小于10则前面加0 // 补零函数小于10则前面加0
@@ -279,6 +291,7 @@ const initTable = async () => {
const fixedFields = apiFieldList.filter(f => f.isFixedColumn === 'Y') const fixedFields = apiFieldList.filter(f => f.isFixedColumn === 'Y')
const dynamicFields = apiFieldList.filter(f => f.isFixedColumn !== 'Y') const dynamicFields = apiFieldList.filter(f => f.isFixedColumn !== 'Y')
// 处理固定列 // 处理固定列
fixedFields.forEach((item) => { fixedFields.forEach((item) => {
const config: any = { const config: any = {
@@ -381,6 +394,7 @@ const initTable = async () => {
config.dicData=dictData config.dicData=dictData
config.searchType= 'select' config.searchType= 'select'
config.dataType= 'string' config.dataType= 'string'
dictFieldList.value.push(config)
} }
const moreIn="MORE_IN".includes(item.queryMode) const moreIn="MORE_IN".includes(item.queryMode)
config.searchType=moreIn?'select':config.searchType config.searchType=moreIn?'select':config.searchType
@@ -398,9 +412,9 @@ const initTable = async () => {
dimensionFields.value[config.prop]=config dimensionFields.value[config.prop]=config
hideFeilds.value[config.prop]=item.isHideDimension hideFeilds.value[config.prop]=item.isHideDimension
} }
if(item.isHideCol == 'Y') { if(item.isHideCol == 'Y') {hideCols.value.push(config.prop)
config.hide = true config.hide = true
hideColumns.value.push( config.prop ) hideColumns.value.push(config.prop)
} }
if (item.queryMode == 'RANGE') config.searchRange = true if (item.queryMode == 'RANGE') config.searchRange = true
if (item.queryMode == 'LIKE') config.multiple = config.collapseTags=true if (item.queryMode == 'LIKE') config.multiple = config.collapseTags=true
@@ -532,7 +546,6 @@ const getTableData = async (isLoading = true) => {
{ "yuefen": "五月", "benyue": 333, "leiji": 444 }, { "yuefen": "五月", "benyue": 333, "leiji": 444 },
{ "yuefen": "六月", "benyue": 555, "leiji": 555 }, { "yuefen": "六月", "benyue": 555, "leiji": 555 },
{ "yuefen": "六月", "benyue": 666, "leiji": 666 }, { "yuefen": "六月", "benyue": 666, "leiji": 666 },
], ],
total: 6 total: 6
} }
@@ -672,11 +685,10 @@ const getTableData = async (isLoading = true) => {
tableData.value = processedData tableData.value = processedData
Object.values(tableOption.value.column).forEach( item=>{ Object.values(tableOption.value.column).forEach( item=>{
item.hide=item.children?.every(child=>tableData.value[0]&&(tableData.value[0][child.prop]===undefined)) let oldHide=hideCols.value.indexOf(item.prop)!==-1
item.hide=item.children?.every(child=>tableData.value[0]&&(tableData.value[0][child.prop]===undefined))||oldHide
const prH=hideColumns.value.indexOf(item.prop) const prH=hideColumns.value.indexOf(item.prop)
item.hide?(prH===-1?hideColumns.value.push(item.prop):''):(prH!==-1?hideColumns.value.splice(prH,1):'') item.hide?(prH===-1?hideColumns.value.push(item.prop):''):(prH!==-1&&hideCols.value.indexOf(item.prop)===-1?hideColumns.value.splice(prH,1):'')
}) })

View File

@@ -170,8 +170,8 @@ const infoColumn = {
isHideDimension: { title: '维度隐藏列', width: 180, editRender: { name: 'LowSelectMultiple', verifyEdit: true, filterable: true, multiple:true,dicData: [] } }, isHideDimension: { title: '维度隐藏列', width: 180, editRender: { name: 'LowSelectMultiple', verifyEdit: true, filterable: true, multiple:true,dicData: [] } },
isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } }, isShowSort: { title: '是否排序', width: 75, align: "center", editRender: { name: 'LowCheckbox' } },
isDynamicGroup: { title: '动态分组', width: 75, align: "center", editRender: { name: 'LowCheckbox' } }, //isDynamicGroup: { 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' } }, //hasChildren: { title: '子字段', width: 90, align: "center", editRender: { name: 'LowButton', disabled: (row) => row.isSubField === true, buttonText: '添加子字段', buttonType: 'primary', buttonSize: 'small' } },
}, },
} }