Commit bdba67bb by chengming

增加报名导出按钮

parent c9aef493
......@@ -25,20 +25,32 @@ class Header extends PureComponent {
dataLoaded: false,
carouselKey: 0 // 新增:用于强制重新渲染Carousel
};
this.timer = null; // 新增:定时器引用
}
componentDidMount() {
// 修复:直接调用数据获取,不依赖初始状态检查
// 初始加载数据
this.fetchScrollData();
// 设置定时器,每隔5秒更新一次数据
this.timer = setInterval(() => {
this.fetchScrollData();
}, 60000);
}
componentWillUnmount() {
// 组件卸载时清除定时器
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
}
fetchScrollData = () => {
const { getPromptScrollData } = this.props;
this.setState({ isLoading: true });
getPromptScrollData({}, (res) => {
if (res && res.data) {
console.log('跑马灯数据加载成功:', res.data);
console.log('跑马灯数据更新成功:', res.data);
// 检查是否有数据
const hasData = Object.values(res.data).some(array => array.length > 0);
......@@ -50,7 +62,7 @@ class Header extends PureComponent {
carouselKey: this.state.carouselKey + 1 // 更新key强制重新渲染
});
} else {
console.log('跑马灯数据加载失败或为空');
console.log('跑马灯数据更新失败或为空');
this.setState({
isLoading: false,
hasData: false,
......
......@@ -53,7 +53,7 @@ import {
} from "antd";
import api from "./redux/api";
const { train } = api;
const { exportSignRecord, activitiesExport } = train;
const { exportSignRecord, exportEnrollRecord, activitiesExport } = train;
import request from "@/util/request";
import MessageRemind from "../../../common/MessageRemind";
......@@ -614,6 +614,10 @@ class NewTP extends Component {
this.hideenrollManag = this.hideenrollManag.bind(this);
// 可见范围回调
this.visibleRangeVoFun = this.visibleRangeVoFun.bind(this);
// 导出签到记录
this.downTxt = this.downTxt.bind(this);
// 导出报名记录
this.downEnrollTxt = this.downEnrollTxt.bind(this);
}
//
......@@ -783,25 +787,38 @@ class NewTP extends Component {
}
});
}
//导出报名记录
async downEnrollTxt(record) {
let data = {
trainningProjectId: record,
};
const res = await request({
url: exportEnrollRecord,
data,
});
if (res.code === "1000") {
message.loading("数据导出中..", 3).then(() => window.open(res.data));
} else {
message.error(res.subMsg);
}
}
// 导出签到记录
downTxt = record => {
async downTxt(record) {
let data = {
trainingProjectId: record,
};
return request({
const res = await request({
url: exportSignRecord,
data,
}).then(res => {
if (res.code === "1000") {
message.loading("数据导出中..", 3).then(() => window.open(res.data));
} else {
message.error(res.subMsg);
}
});
};
if (res.code === "1000") {
message.loading("数据导出中..", 3).then(() => window.open(res.data));
} else {
message.error(res.subMsg);
}
}
// 二维码导出
qdcode(record) {
console.log(record, "111111111");
const param = {
// 项目id
id: record.id,
......@@ -3154,13 +3171,30 @@ class NewTP extends Component {
""
)}
{record.enroll === 1 ? (
<div>
<div style={{ display: "flex" }}>
<a
style={{ marginLeft: "10px", color: "rgb(24, 144, 255)" }}
onClick={() => this.onEnrollManag(record)}
>
报名管理
</a>
<div>
<Popconfirm
title="确认导出?"
okText="确定"
cancelText="取消"
onConfirm={() => this.downEnrollTxt(record.id)}
>
<a
style={{
marginLeft: "10px",
color: "rgb(24, 144, 255)",
}}
>
导出报名记录
</a>
</Popconfirm>
</div>
</div>
) : (
""
......@@ -3289,7 +3323,7 @@ class NewTP extends Component {
<div className={styles.qclist}>{qclist}</div>
<Row>
<Col
span={5}
span={4}
style={{
backgroundColor: "white",
}}
......@@ -3304,7 +3338,7 @@ class NewTP extends Component {
</Tree>
</div>
</Col>
<Col span={19} style={{ paddingLeft: "16px" }}>
<Col span={20} style={{ paddingLeft: "8px" }}>
<div className={styles.filterDiv}>
活动状态:
<Select
......
......@@ -34,6 +34,8 @@ export default {
exportSign: `POST ${services.webManage}/sign/qrcode/get`,
// 导出签到记录
exportSignRecord: `GET ${services.webManage}/trainingProject/exportSignRecord`,
// 导出报名记录
exportEnrollRecord: `GET ${services.webManage}/enroll/list/export`,
// 导出活动清单
activitiesExport: `GET ${services.webManage}/tpPlanActivity/activitiesExport`,
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment