isHideCol隐藏列调试修改 去掉子字段和字段分组 根据字典cssClass的值设置整行颜色
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
:option="tableOption"
|
||||
v-bind="crudBind"
|
||||
:summary-method=summaryMethod1
|
||||
:row-style="rowStyleMethod"
|
||||
@search-change="searchChange"
|
||||
@search-reset="resetChange"
|
||||
@refresh-change="refreshChange"
|
||||
@@ -154,6 +155,8 @@ const dimensionFields=ref<any>({})
|
||||
const exportLoading = ref(false)
|
||||
const fieldList = ref<any[]>([]) // 添加fieldList引用
|
||||
const hideFeilds= ref<any>({})
|
||||
const hideCols=ref<any>([])
|
||||
const dictFieldList=ref<any>([])
|
||||
const permissions =
|
||||
wsCache.get(CACHE_KEY.USER).lideeYunjipermissions?.[route.meta.menuDataId as string] || false
|
||||
const selectIds = computed(() => {
|
||||
@@ -222,6 +225,15 @@ const summaryMethod1=({columns,data})=>{
|
||||
})
|
||||
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() {
|
||||
const now = new Date();
|
||||
// 补零函数:小于10则前面加0
|
||||
@@ -279,6 +291,7 @@ const initTable = async () => {
|
||||
const fixedFields = apiFieldList.filter(f => f.isFixedColumn === 'Y')
|
||||
const dynamicFields = apiFieldList.filter(f => f.isFixedColumn !== 'Y')
|
||||
|
||||
|
||||
// 处理固定列
|
||||
fixedFields.forEach((item) => {
|
||||
const config: any = {
|
||||
@@ -381,6 +394,7 @@ const initTable = async () => {
|
||||
config.dicData=dictData
|
||||
config.searchType= 'select'
|
||||
config.dataType= 'string'
|
||||
dictFieldList.value.push(config)
|
||||
}
|
||||
const moreIn="MORE_IN".includes(item.queryMode)
|
||||
config.searchType=moreIn?'select':config.searchType
|
||||
@@ -398,7 +412,7 @@ const initTable = async () => {
|
||||
dimensionFields.value[config.prop]=config
|
||||
hideFeilds.value[config.prop]=item.isHideDimension
|
||||
}
|
||||
if(item.isHideCol == 'Y') {
|
||||
if(item.isHideCol == 'Y') {hideCols.value.push(config.prop)
|
||||
config.hide = true
|
||||
hideColumns.value.push(config.prop)
|
||||
}
|
||||
@@ -532,7 +546,6 @@ const getTableData = async (isLoading = true) => {
|
||||
{ "yuefen": "五月", "benyue": 333, "leiji": 444 },
|
||||
{ "yuefen": "六月", "benyue": 555, "leiji": 555 },
|
||||
{ "yuefen": "六月", "benyue": 666, "leiji": 666 },
|
||||
|
||||
],
|
||||
total: 6
|
||||
}
|
||||
@@ -672,11 +685,10 @@ const getTableData = async (isLoading = true) => {
|
||||
|
||||
tableData.value = processedData
|
||||
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)
|
||||
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):'')
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -170,8 +170,8 @@ const infoColumn = {
|
||||
|
||||
isHideDimension: { title: '维度隐藏列', width: 180, editRender: { name: 'LowSelectMultiple', verifyEdit: true, filterable: true, multiple:true,dicData: [] } },
|
||||
isShowSort: { 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' } },
|
||||
//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' } },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user