分配队员页面的完成人数显示
This commit is contained in:
parent
a57a748cc2
commit
bca23b5d65
@ -520,6 +520,7 @@ import { computed, reactive, ref, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { UploadFilled, ArrowRight, Close, CircleCheck } from '@element-plus/icons-vue';
|
||||
import ProTable from '/@/components/ProTable/index.vue';
|
||||
import { formatDate } from '/@/utils/formatTime';
|
||||
import {
|
||||
usereventrecordListGet,
|
||||
usereventrecordCancelPost,
|
||||
@ -649,46 +650,29 @@ const getEventStatusText = (status) => {
|
||||
};
|
||||
|
||||
const disableCancel = computed(() => {
|
||||
if (!currentRow.value) return true;
|
||||
const payStatus = normalizeToNumber(currentRow.value.payStatus);
|
||||
// 只有支付状态为已支付(1),才能取消/退款
|
||||
return !(payStatus === 1);
|
||||
if (!currentRow.value) return true;
|
||||
const payStatus = normalizeToNumber(currentRow.value.payStatus);
|
||||
const paymentMethod = normalizeToNumber(currentRow.value.paymentMethod);
|
||||
// 如果是线下支付(1),仅当支付状态为未支付(0)或已支付(1)时允许取消
|
||||
// 否则只有支付状态为已支付(1),才能取消/退款
|
||||
if (paymentMethod === 1) {
|
||||
// 线下支付:仅未支付(0)或已支付(1)允许取消
|
||||
return !(payStatus === 0 || payStatus === 1);
|
||||
}
|
||||
return !(payStatus === 1);
|
||||
});
|
||||
|
||||
const isCancelDisabledByRow = (row) => {
|
||||
if (!row) return true;
|
||||
const payStatus = normalizeToNumber(row.payStatus);
|
||||
// 只有支付状态为已支付(1),才能取消/退款
|
||||
return !(payStatus === 1);
|
||||
};
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (date, fmt) => {
|
||||
if (!date) return '';
|
||||
const d = new Date(date);
|
||||
if (isNaN(d.getTime())) return '';
|
||||
|
||||
let result = fmt;
|
||||
const o = {
|
||||
'Y+': d.getFullYear(),
|
||||
'm+': d.getMonth() + 1,
|
||||
'd+': d.getDate(),
|
||||
'H+': d.getHours(),
|
||||
'M+': d.getMinutes(),
|
||||
'S+': d.getSeconds(),
|
||||
'q+': Math.floor((d.getMonth() + 3) / 3),
|
||||
's': d.getMilliseconds()
|
||||
};
|
||||
|
||||
for (let k in o) {
|
||||
if (new RegExp('(' + k + ')').test(result)) {
|
||||
result = result.replace(
|
||||
RegExp.$1,
|
||||
(RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))
|
||||
);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
if (!row) return true;
|
||||
const payStatus = normalizeToNumber(row.payStatus);
|
||||
const paymentMethod = normalizeToNumber(row.paymentMethod);
|
||||
// 如果是线下支付(1),仅当支付状态为未支付(0)或已支付(1)时允许取消
|
||||
// 否则只有支付状态为已支付(1),才能取消/退款
|
||||
if (paymentMethod === 1) {
|
||||
// 线下支付:仅未支付(0)或已支付(1)允许取消
|
||||
return !(payStatus === 0 || payStatus === 1);
|
||||
}
|
||||
return !(payStatus === 1);
|
||||
};
|
||||
|
||||
// 格式化组别的年龄段(出生日期范围)
|
||||
@ -696,10 +680,29 @@ const formatGroupDate = (item) => {
|
||||
const start = item?.birthDateStart;
|
||||
const end = item?.birthDateEnd;
|
||||
if (!start && !end) return '';
|
||||
|
||||
// 修复日期解析,处理两位数年份的情况
|
||||
const fixDate = (dateStr) => {
|
||||
if (!dateStr) return '';
|
||||
// 如果是类似 "85-01-01" 这种格式,尝试转换为完整年份
|
||||
if (typeof dateStr === 'string' && /^\d{2}-\d{2}-\d{2}$/.test(dateStr)) {
|
||||
const [year, month, day] = dateStr.split('-');
|
||||
const fullYear = parseInt(year, 10) < 50 ? 2000 + parseInt(year, 10) : 1900 + parseInt(year, 10);
|
||||
return `${fullYear}-${month}-${day}`;
|
||||
}
|
||||
return dateStr;
|
||||
};
|
||||
|
||||
const fmt = (v) => {
|
||||
if (!v) return '';
|
||||
try { return formatDate(new Date(v), 'YYYY-mm-dd'); } catch { return String(v); }
|
||||
try {
|
||||
const fixedDate = fixDate(v);
|
||||
return formatDate(new Date(fixedDate), 'YYYY-mm-dd');
|
||||
} catch {
|
||||
return String(v);
|
||||
}
|
||||
};
|
||||
|
||||
if (start && end) return `${fmt(start)} ~ ${fmt(end)}`;
|
||||
return fmt(start || end);
|
||||
};
|
||||
@ -749,8 +752,8 @@ const formatRefundRules = (rules) => {
|
||||
// 格式化项目标题
|
||||
const formatItemTitle = (item) => {
|
||||
const projectType = item.projectTypeName || '';
|
||||
// 使用从后端Project表读取的完成人数
|
||||
const completionCount = item.projectCompletionCount ?? 0;
|
||||
// 使用报名项目人数作为完成人数显示
|
||||
const completionCount = item.personCount ?? 0;
|
||||
const projectName = item.projectName || '';
|
||||
const groupName = item.groupName || '';
|
||||
const dateRange = formatGroupDate(item);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user