significative 5 months ago
commit 07fbbd9995
  1. 60
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/bigScreen/service/CompSystemBigScreenServiceImpl.java
  2. 289
      jeecgboot-vue3-master/src/components/Table/src/components/TableAction.vue
  3. 2
      jeecgboot-vue3-master/src/views/annualCompPoint/committee/AnnualCompPointList.vue
  4. 3
      jeecgboot-vue3-master/src/views/annualCompPoint/superAdmin/AnnualCompPointListPass.vue

@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.util.ComputeUtils;
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.demo.abilityEvaluation.entity.DepartAbilityEvaluation;
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluation;
import org.jeecg.modules.demo.abilityEvaluation.entity.PersonalAbilityEvaluationCollect;
import org.jeecg.modules.demo.abilityEvaluation.service.IDepartAbilityEvaluationService;
import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationCollectService;
import org.jeecg.modules.demo.abilityEvaluation.service.IPersonalAbilityEvaluationService;
import org.jeecg.modules.demo.annual.entity.Annual;
import org.jeecg.modules.demo.annual.service.IAnnualService;
import org.jeecg.modules.demo.annualCompPoint.entity.AnnualCompPoint;
@ -85,6 +87,9 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
@Autowired
private IDepartAbilityEvaluationService iDepartAbilityEvaluationService;
@Autowired
private IPersonalAbilityEvaluationService iPersonalAbilityEvaluationService;
@Autowired
private IPersonalAbilityEvaluationCollectService iPersonalAbilityEvaluationCollectService;
@ -114,7 +119,6 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
List<CompVo> annualCompList = this.getAnnualCompList(comp);
//年度比赛列表
resultMap.put("annualCompList", annualCompList);
// List<AnnualComp> annualCompList = iAnnualCompService.list(new LambdaQueryWrapper<AnnualComp>().eq(AnnualComp::getCompid, compId));
//年度比赛ids
@ -137,13 +141,15 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
resultMap.put("awardList", awardPersionList);
//TODO
List<PersonalCompTotalScore> personalCompScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper<PersonalCompTotalScore>()
// .eq(PersonalCompTotalScore::getDepet, departId)
List<PersonalCompScore> personalCompScoreList = iPersonalCompScoreService.list(new LambdaQueryWrapper<PersonalCompScore>().in(PersonalCompScore::getAnnualCompId, annualCompIds));
//参加该比赛的所有学生学号
Set<String> workNos = Optional.ofNullable(personalCompScoreList).orElse(new ArrayList<>()).stream().map(personalCompScore -> personalCompScore.getWorkOn()).collect(Collectors.toSet());
List<PersonalCompTotalScore> personalCompTotalScoreList = iPersonalCompTotalScoreService.list(new LambdaQueryWrapper<PersonalCompTotalScore>()
.in(PersonalCompTotalScore::getWorkOn, workNos)
.orderByDesc(PersonalCompTotalScore::getScore)
.last("limit 50"));
//学生积分排名
resultMap.put("studentScore", personalCompScoreList);
resultMap.put("studentScore", personalCompTotalScoreList);
Map<String, Object> compCounts = new LinkedHashMap<>();
@ -170,29 +176,29 @@ public class CompSystemBigScreenServiceImpl implements CompSystemBigScreenServic
resultMap.put("compCounts", compCounts);
//TODO
// List<DepartAbilityEvaluation> departAbilityEvaluations = iDepartAbilityEvaluationService.list(new LambdaQueryWrapper<DepartAbilityEvaluation>()
// .eq(DepartAbilityEvaluation::getDepetId, departId));
// List<DepartAbilityEvaluation> vos = new LinkedList<>();
// Map<String, List<DepartAbilityEvaluation>> capacityIdListMap = Optional.ofNullable(departAbilityEvaluations).orElse(new LinkedList<>()).stream()
// .collect(Collectors.groupingBy(DepartAbilityEvaluation::getCapacityId));
// //遍历分组后的结果
// Optional.ofNullable(capacityIdListMap).orElse(new LinkedHashMap<>()).forEach((key, value) -> {
// List<DepartAbilityEvaluation> departAbilityEvaluationList = value;
// double sum = departAbilityEvaluationList.stream().mapToDouble(obj -> obj.getValue()).sum();
// DecimalFormat decimalFormat = new DecimalFormat();
// decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
// decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
// double val = ComputeUtils.div2(sum, departAbilityEvaluationList.size());
// DepartAbilityEvaluation vo = new DepartAbilityEvaluation();
List<PersonalAbilityEvaluation> personalAbilityEvaluationList = iPersonalAbilityEvaluationService.list(new LambdaQueryWrapper<PersonalAbilityEvaluation>()
.in(PersonalAbilityEvaluation::getAnnualCompId, annualCompIds)
.in(PersonalAbilityEvaluation::getWorkOn, workNos)
);
List<DepartAbilityEvaluation> vos = new LinkedList<>();
Map<String, List<PersonalAbilityEvaluation>> capacityIdListMap = Optional.ofNullable(personalAbilityEvaluationList).orElse(new LinkedList<>()).stream()
.collect(Collectors.groupingBy(PersonalAbilityEvaluation::getCapacityId));
//遍历分组后的结果
Optional.ofNullable(capacityIdListMap).orElse(new LinkedHashMap<>()).forEach((key, obj) -> {
double sum = obj.stream().mapToDouble(bo -> bo.getValue()).sum();
DecimalFormat decimalFormat = new DecimalFormat();
decimalFormat.setMaximumFractionDigits(2); // 保留两位小数
decimalFormat.setRoundingMode(RoundingMode.HALF_UP); // 设置具体的进位机制
double val = ComputeUtils.div2(sum, obj.size());
DepartAbilityEvaluation vo = new DepartAbilityEvaluation();
// vo.setDepetId(departId);
// vo.setValue(val);
// vo.setCapacityId(key);
// vo.setCapacityName(departAbilityEvaluationList.get(0).getCapacityName());
// vos.add(vo);
// });
// //能力评估
// resultMap.put("departAbilityEvaluation", vos);
vo.setValue(val);
vo.setCapacityId(key);
vo.setCapacityName(obj.get(0).getCapacityName());
vos.add(vo);
});
//单项比赛能力评估
resultMap.put("comAbilityEvaluation", vos);
List<Integer> years = DateUtils.getLastxYear(5);

@ -1,5 +1,5 @@
<template>
<div :class="[prefixCls, getAlign]" @click="onCellClick">
<div :class="[prefixCls, getAlign]" @click="onCellClick" class="setting">
<template v-for="(action, index) in getActions" :key="`${index}-${action.label}`">
<template v-if="action.slot">
<slot name="customButton"></slot>
@ -19,183 +19,198 @@
<Divider type="vertical" class="action-divider" v-if="divider && index < getActions.length - 1" />
</template>
<Dropdown :trigger="['hover']" :dropMenuList="getDropdownList" popconfirm v-if="dropDownActions && getDropdownList.length > 0">
<Dropdown :trigger="['hover']" :dropMenuList="getDropdownList" popconfirm
v-if="dropDownActions && getDropdownList.length > 0">
<slot name="more"></slot>
<a-button type="link" size="small" v-if="!$slots.more"> 更多 <Icon icon="mdi-light:chevron-down"></Icon> </a-button>
</Dropdown>
</div>
</template>
<script lang="ts">
import { defineComponent, PropType, computed, toRaw, unref } from 'vue';
import { MoreOutlined } from '@ant-design/icons-vue';
import { Divider, Tooltip, TooltipProps } from 'ant-design-vue';
import Icon from '/@/components/Icon/index';
import { ActionItem, TableActionType } from '/@/components/Table';
import { PopConfirmButton } from '/@/components/Button';
import { Dropdown } from '/@/components/Dropdown';
import { useDesign } from '/@/hooks/web/useDesign';
import { useTableContext } from '../hooks/useTableContext';
import { usePermission } from '/@/hooks/web/usePermission';
import { isBoolean, isFunction, isString } from '/@/utils/is';
import { propTypes } from '/@/utils/propTypes';
import { ACTION_COLUMN_FLAG } from '../const';
export default defineComponent({
name: 'TableAction',
components: { Icon, PopConfirmButton, Divider, Dropdown, MoreOutlined, Tooltip },
props: {
actions: {
type: Array as PropType<ActionItem[]>,
default: null,
},
dropDownActions: {
type: Array as PropType<ActionItem[]>,
default: null,
},
divider: propTypes.bool.def(true),
outside: propTypes.bool,
stopButtonPropagation: propTypes.bool.def(false),
import { defineComponent, PropType, computed, toRaw, unref } from 'vue';
import { MoreOutlined } from '@ant-design/icons-vue';
import { Divider, Tooltip, TooltipProps } from 'ant-design-vue';
import Icon from '/@/components/Icon/index';
import { ActionItem, TableActionType } from '/@/components/Table';
import { PopConfirmButton } from '/@/components/Button';
import { Dropdown } from '/@/components/Dropdown';
import { useDesign } from '/@/hooks/web/useDesign';
import { useTableContext } from '../hooks/useTableContext';
import { usePermission } from '/@/hooks/web/usePermission';
import { isBoolean, isFunction, isString } from '/@/utils/is';
import { propTypes } from '/@/utils/propTypes';
import { ACTION_COLUMN_FLAG } from '../const';
export default defineComponent({
name: 'TableAction',
components: { Icon, PopConfirmButton, Divider, Dropdown, MoreOutlined, Tooltip },
props: {
actions: {
type: Array as PropType<ActionItem[]>,
default: null,
},
setup(props) {
const { prefixCls } = useDesign('basic-table-action');
let table: Partial<TableActionType> = {};
if (!props.outside) {
table = useTableContext();
}
dropDownActions: {
type: Array as PropType<ActionItem[]>,
default: null,
},
divider: propTypes.bool.def(true),
outside: propTypes.bool,
stopButtonPropagation: propTypes.bool.def(false),
},
setup(props) {
const { prefixCls } = useDesign('basic-table-action');
let table: Partial<TableActionType> = {};
if (!props.outside) {
table = useTableContext();
}
const { hasPermission } = usePermission();
function isIfShow(action: ActionItem): boolean {
const ifShow = action.ifShow;
const { hasPermission } = usePermission();
function isIfShow(action: ActionItem): boolean {
const ifShow = action.ifShow;
let isIfShow = true;
let isIfShow = true;
if (isBoolean(ifShow)) {
isIfShow = ifShow;
}
if (isFunction(ifShow)) {
isIfShow = ifShow(action);
}
return isIfShow;
if (isBoolean(ifShow)) {
isIfShow = ifShow;
}
if (isFunction(ifShow)) {
isIfShow = ifShow(action);
}
return isIfShow;
}
const getActions = computed(() => {
return (toRaw(props.actions) || [])
.filter((action) => {
return hasPermission(action.auth) && isIfShow(action);
})
.map((action) => {
const { popConfirm } = action;
return {
getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
type: 'link',
size: 'small',
...action,
...(popConfirm || {}),
onConfirm: popConfirm?.confirm,
onCancel: popConfirm?.cancel,
enable: !!popConfirm,
};
});
});
const getDropdownList = computed((): any[] => {
//dropdown,线
const list = (toRaw(props.dropDownActions) || []).filter((action) => {
const getActions = computed(() => {
return (toRaw(props.actions) || [])
.filter((action) => {
return hasPermission(action.auth) && isIfShow(action);
});
return list.map((action, index) => {
const { label, popConfirm } = action;
})
.map((action) => {
const { popConfirm } = action;
return {
getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
type: 'link',
size: 'small',
...action,
...popConfirm,
...(popConfirm || {}),
onConfirm: popConfirm?.confirm,
onCancel: popConfirm?.cancel,
text: label,
divider: index < list.length - 1 ? props.divider : false,
enable: !!popConfirm,
};
});
});
});
const getAlign = computed(() => {
const columns = (table as TableActionType)?.getColumns?.() || [];
const actionColumn = columns.find((item) => item.flag === ACTION_COLUMN_FLAG);
return actionColumn?.align ?? 'left';
const getDropdownList = computed((): any[] => {
//dropdown,线
const list = (toRaw(props.dropDownActions) || []).filter((action) => {
return hasPermission(action.auth) && isIfShow(action);
});
function getTooltip(data: string | TooltipProps): TooltipProps {
return list.map((action, index) => {
const { label, popConfirm } = action;
return {
getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
placement: 'bottom',
...(isString(data) ? { title: data } : data),
...action,
...popConfirm,
onConfirm: popConfirm?.confirm,
onCancel: popConfirm?.cancel,
text: label,
divider: index < list.length - 1 ? props.divider : false,
};
}
});
});
const getAlign = computed(() => {
const columns = (table as TableActionType)?.getColumns?.() || [];
const actionColumn = columns.find((item) => item.flag === ACTION_COLUMN_FLAG);
return actionColumn?.align ?? 'left';
});
function getTooltip(data: string | TooltipProps): TooltipProps {
return {
getPopupContainer: () => unref((table as any)?.wrapRef.value) ?? document.body,
placement: 'bottom',
...(isString(data) ? { title: data } : data),
};
}
function onCellClick(e: MouseEvent) {
if (!props.stopButtonPropagation) return;
const path = e.composedPath() as HTMLElement[];
const isInButton = path.find((ele) => {
return ele.tagName?.toUpperCase() === 'BUTTON';
});
isInButton && e.stopPropagation();
}
function onCellClick(e: MouseEvent) {
if (!props.stopButtonPropagation) return;
const path = e.composedPath() as HTMLElement[];
const isInButton = path.find((ele) => {
return ele.tagName?.toUpperCase() === 'BUTTON';
});
isInButton && e.stopPropagation();
}
return { prefixCls, getActions, getDropdownList, getAlign, onCellClick, getTooltip };
},
});
return { prefixCls, getActions, getDropdownList, getAlign, onCellClick, getTooltip };
},
});
</script>
<style lang="less">
@prefix-cls: ~'@{namespace}-basic-table-action';
@prefix-cls: ~'@{namespace}-basic-table-action';
.@{prefix-cls} {
display: flex;
align-items: center;
/* update-begin-author:taoyan date:2022-11-18 for: 表格默认行高比官方示例多出2px*/
height: 22px;
/* update-end-author:taoyan date:2022-11-18 for: 表格默认行高比官方示例多出2px*/
.action-divider {
display: table;
}
.@{prefix-cls} {
&.left {
justify-content: flex-start;
}
&.center {
justify-content: center;
}
&.right {
justify-content: flex-end;
}
button {
display: flex;
align-items: center;
/* update-begin-author:taoyan date:2022-11-18 for: 表格默认行高比官方示例多出2px*/
height: 22px;
/* update-end-author:taoyan date:2022-11-18 for: 表格默认行高比官方示例多出2px*/
.action-divider {
display: table;
span {
margin-left: 0 !important;
}
}
&.left {
justify-content: flex-start;
button.ant-btn-circle {
span {
margin: auto !important;
}
}
&.center {
justify-content: center;
}
.ant-divider,
.ant-divider-vertical {
margin: 0 2px;
}
.icon-more {
transform: rotate(90deg);
&.right {
justify-content: flex-end;
svg {
font-size: 1.1em;
font-weight: 700;
}
}
}
button {
display: flex;
align-items: center;
.setting {
span {
margin-left: 0 !important;
}
}
width: 100%;
button.ant-btn-circle {
span {
margin: auto !important;
}
}
height: 100%;
.ant-divider,
.ant-divider-vertical {
margin: 0 2px;
}
display: flex;
.icon-more {
transform: rotate(90deg);
flex-wrap: wrap;
svg {
font-size: 1.1em;
font-weight: 700;
}
}
}
align-items: center;
}
</style>

@ -105,7 +105,7 @@
canResize: false,
useSearchForm: false,
actionColumn: {
width: 550,
width: 220,
fixed: 'right',
},
beforeFetch: (params) => {

@ -336,4 +336,7 @@ function setFieldsValue(map) {
text-align: center
}
}
::v-deep(.ant-table-row) {
height: 120px !important;
}
</style>

Loading…
Cancel
Save