表头自定义修改默认表头

This commit is contained in:
高嵩
2023-02-13 14:18:37 +08:00
parent 25370a0857
commit 0df1e1f707
@@ -8,6 +8,7 @@ import com.jero.modules.head.enums.AffirmFlagEnum;
import com.jero.modules.head.mapper.HeadCustomEOMapper; import com.jero.modules.head.mapper.HeadCustomEOMapper;
import com.jero.modules.head.service.IHeadCustomEOService; import com.jero.modules.head.service.IHeadCustomEOService;
import com.jero.modules.head.vo.HeadCustomVO; import com.jero.modules.head.vo.HeadCustomVO;
import net.sf.saxon.functions.ConstantFunction;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
@@ -246,7 +247,71 @@ public class HeadCustomEOServiceImpl extends ServiceImpl<HeadCustomEOMapper, Hea
headCustomVOOneList.add(headCustomVO); headCustomVOOneList.add(headCustomVO);
} }
} }
return headCustomVOOneList;
List<HeadCustomVO> res = new ArrayList<>();
if ("法规清单".equals(moduleFlag) || "虚拟清单详情".equals(moduleFlag) || "维护清单".equals(moduleFlag)) {
res = checkDefaultHead(headCustomVOOneList, cut, moduleFlag);
} else {
res = headCustomVOOneList;
}
return res;
}
/**
* 检查默认表头,如果不存在则添加进列表
*/
private List<HeadCustomVO> checkDefaultHead(List<HeadCustomVO> headCustomVOOneList, String cut, String moduleFlag) {
List<HeadCustomVO> res = new ArrayList<>();
//编号,标题,操作
boolean hasBH = false;
boolean hasBT = false;
boolean hasCZ = false;
for (HeadCustomVO hcVO : headCustomVOOneList) {
if ("编号".equals(hcVO.getTitle()) || "Number".equals(hcVO.getTitle())) {
hasBH = true;
}
if ("标题".equals(hcVO.getTitle())) {
hasBT = true;
}
if ("操作".equals(hcVO.getTitle())) {
hasCZ = true;
}
}
if (!hasBH) {
HeadCustomVO bh = new HeadCustomVO();
bh.setDataIndex("serialNumber");
if (CutEnum.CN.getValue().equals(cut)) {
bh.setTitle("编号");
} else {
bh.setTitle("Number");
}
bh.setFixed("left");
res.add(bh);
}
if (!hasBT) {
HeadCustomVO bt = new HeadCustomVO();
bt.setDataIndex("title");
if (CutEnum.CN.getValue().equals(cut)) {
bt.setTitle("标题");
} else {
bt.setTitle("title");
}
bt.setFixed("left");
res.add(bt);
}
res.addAll(headCustomVOOneList);
if (!hasCZ) {
HeadCustomVO cz = new HeadCustomVO();
cz.setDataIndex("operation");
if (CutEnum.CN.getValue().equals(cut)) {
cz.setTitle("操作");
} else {
cz.setTitle("Operation");
}
cz.setFixed("right");
res.add(cz);
}
return res;
} }
@NotNull @NotNull