Commit 81675eed by end

修改

parent 177a9418
No preview for this file type
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
"react-dnd": "^2.6.0", "react-dnd": "^2.6.0",
"react-dnd-html5-backend": "^2.6.0", "react-dnd-html5-backend": "^2.6.0",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",
"react-image-crop": "^11.0.10",
"react-intl-universal": "^2.2.5", "react-intl-universal": "^2.2.5",
"react-redux": "^7.2.0", "react-redux": "^7.2.0",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
......
...@@ -96,6 +96,7 @@ class InfoComment extends React.Component { ...@@ -96,6 +96,7 @@ class InfoComment extends React.Component {
visible: false, visible: false,
value: 3, value: 3,
a: 1, a: 1,
selectedRowKeys: [], // 新增:存储选中行的 key
}; };
this.columns = [ this.columns = [
{ {
...@@ -202,6 +203,10 @@ class InfoComment extends React.Component { ...@@ -202,6 +203,10 @@ class InfoComment extends React.Component {
this.handleDown = this.handleDown.bind(this); this.handleDown = this.handleDown.bind(this);
this.downloadCommentFun = this.downloadCommentFun.bind(this); this.downloadCommentFun = this.downloadCommentFun.bind(this);
this.seta = this.seta.bind(this); this.seta = this.seta.bind(this);
this.handleRowSelectChange = this.handleRowSelectChange.bind(this); // 新增:绑定行选择变化处理函数
this.batchDown = this.batchDown.bind(this); // 新增:绑定批量下架处理函数
this.batchUp = this.batchUp.bind(this); // 新增:绑定批量上架处理函数
this.batchDelete = this.batchDelete.bind(this); // 新增:绑定批量删除处理函数
} }
componentDidMount() { componentDidMount() {
...@@ -326,25 +331,87 @@ class InfoComment extends React.Component { ...@@ -326,25 +331,87 @@ class InfoComment extends React.Component {
pageSize: size, pageSize: size,
}); });
} }
// 新增:行选择变化处理函数
handleRowSelectChange(selectedRowKeys) {
this.setState({ selectedRowKeys });
}
// 新增:批量下架处理函数
batchDown() {
const { selectedRowKeys } = this.state;
const { commentlist } = this.props;
const selectedRecords = commentlist.list.filter(record =>
selectedRowKeys.includes(record.id)
);
selectedRecords.forEach(record => {
if (!record.state) {
this.handleDown(record.id, record);
}
});
}
// 新增:批量上架处理函数
batchUp() {
const { selectedRowKeys } = this.state;
const { commentlist } = this.props;
const selectedRecords = commentlist.list.filter(record =>
selectedRowKeys.includes(record.id)
);
selectedRecords.forEach(record => {
if (record.state) {
this.handleUp(record.id, record);
}
});
}
// 新增:批量删除处理函数
batchDelete() {
const { selectedRowKeys } = this.state;
const { commentlist } = this.props;
const selectedRecords = commentlist.list.filter(record =>
selectedRowKeys.includes(record.id)
);
selectedRecords.forEach(record => {
this.tpCommentDel(record.id, record);
});
}
render() { render() {
const { value } = this.state; const { value, selectedRowKeys } = this.state;
const { commentlist } = this.props; const { commentlist } = this.props;
const rowSelection = {
selectedRowKeys,
onChange: this.handleRowSelectChange,
};
return ( return (
<div className={styles.comment}> <div className={styles.comment}>
<div className={styles.mar40}> <div className={styles.mar40}>
{/* <span> {/* 新增:批量操作按钮 */}
<h2>{this.props.name}</h2> <div style={{ marginBottom: 16 }}>
<Row style={{ top: "-10px" }}> <Button
<Col span={4} key={4} style={{ float: "right" }}> type="primary"
<Popconfirm style={{marginRight:'10px'}}
title="确定下载评论信息?" onClick={this.batchDown}
onConfirm={this.downloadCommentFun} disabled={selectedRowKeys.length === 0}
> >
<Button type="primary">下载评论信息</Button> 批量下架
</Popconfirm> </Button>
</Col> <Button
</Row> type="primary"
</span> */} style={{marginRight:'10px'}}
onClick={this.batchUp}
disabled={selectedRowKeys.length === 0}
>
批量上架
</Button>
<Button
type="danger"
onClick={this.batchDelete}
disabled={selectedRowKeys.length === 0}
>
批量删除
</Button>
</div>
<Table <Table
columns={this.columns} columns={this.columns}
dataSource={commentlist.list} dataSource={commentlist.list}
...@@ -354,6 +421,7 @@ class InfoComment extends React.Component { ...@@ -354,6 +421,7 @@ class InfoComment extends React.Component {
onExpand={this.handleExpand} onExpand={this.handleExpand}
pagination={false} pagination={false}
rowKey="id" rowKey="id"
rowSelection={rowSelection} // 新增:添加行选择属性
/> />
<Pagination <Pagination
className={styles.comment_pagination} className={styles.comment_pagination}
......
...@@ -166,7 +166,13 @@ class App extends React.Component { ...@@ -166,7 +166,13 @@ class App extends React.Component {
}, },
}; };
} }
const organizations = [
"安控管理党支部",
"设备工程党支部",
"机电运行党支部",
"机关、业务、IT党支部",
"系统运行党支部"
];
// debugger // debugger
return ( return (
<div style={{ textAlign: "left" }}> <div style={{ textAlign: "left" }}>
...@@ -364,20 +370,28 @@ class App extends React.Component { ...@@ -364,20 +370,28 @@ class App extends React.Component {
<Col span={16}> <Col span={16}>
{getFieldDecorator("organizer", { {getFieldDecorator("organizer", {
initialValue: initialValue:
trainfirstinfo !== "" ? trainfirstinfo.organizer : "", //bug-11153-liyuan 修改新增活动会出现缓存名称和时间 trainfirstinfo !== "" ? trainfirstinfo.organizer?.split(',') : [],
rules: [ rules: [
{ {
required: false, required: false,
validator: (rule, value, callback) => { validator: (rule, value, callback) => {
validator(rule, value, callback, "请输入组织方", 50); const valueStr = Array.isArray(value) ? value.join(',') : value;
validator(rule, valueStr, callback, "请选择组织方", 50);
}, },
}, },
], ],
})(<Input placeholder="请输入组织方" disabled={usable} />)} })(
<Select
mode="multiple"
placeholder="请选择组织方"
disabled={usable}
>
{organizations.map(org => (
<Option key={org} value={org}>{org}</Option>
))}
</Select>
)}
</Col> </Col>
{/*<Col span={6}>
<Button size="small" disabled={usable} >复制已有活动</Button>
</Col>*/}
</Row> </Row>
</FormItem> </FormItem>
<FormItem {...formItemLayout} label="活动奖励"> <FormItem {...formItemLayout} label="活动奖励">
......
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