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}
......
...@@ -4,18 +4,10 @@ import { ...@@ -4,18 +4,10 @@ import {
Modal, Modal,
Form, Form,
Input, Input,
Radio,
Cascader,
DatePicker,
Upload,
Icon,
message, message,
} from "antd"; } from "antd";
import { connect } from "react-redux"; import { connect } from "react-redux";
// import {gupList, gupfetch} from 'ACTIONS/upload';
import { gupList, gupfetch } from "@/common/UpLoad/redux/actions"; import { gupList, gupfetch } from "@/common/UpLoad/redux/actions";
import Editor from "@/common/Editor/editor";
import UpLoad from "@/common/UpLoad";
import moment from "moment"; import moment from "moment";
import validator from "@/common/validatorForm/index"; import validator from "@/common/validatorForm/index";
const FormItem = Form.Item; const FormItem = Form.Item;
...@@ -26,8 +18,6 @@ class addEdit extends React.Component { ...@@ -26,8 +18,6 @@ class addEdit extends React.Component {
this.state = { this.state = {
uploadParams: {}, uploadParams: {},
uploadAction: "", uploadAction: "",
editor: "",
tags: [],
fileList: [], fileList: [],
responseList: [], responseList: [],
previewVisible: false, // 控制预览模态框的显示与隐藏 previewVisible: false, // 控制预览模态框的显示与隐藏
...@@ -43,10 +33,7 @@ class addEdit extends React.Component { ...@@ -43,10 +33,7 @@ class addEdit extends React.Component {
componentDidMount() { componentDidMount() {
const { seeEdit, type } = this.props; const { seeEdit, type } = this.props;
} }
//多媒体组件事件
getEditorHtml = editor => {
this.props.onEditor(editor);
};
//上传文件 //上传文件
beforeUpload(file, fileList) { beforeUpload(file, fileList) {
console.log("检测打印变量=file ", file); console.log("检测打印变量=file ", file);
...@@ -83,66 +70,43 @@ class addEdit extends React.Component { ...@@ -83,66 +70,43 @@ class addEdit extends React.Component {
}); });
} }
} }
//123
handleUploadChange({ file, fileList }) {
// console.log(123,file.name.split('.')[1])
// if (file.name.indexOf("pdf") == -1) {
// message.error("请上传pdf文件");
// return;
// }
handleUploadChange({ file, fileList }) {
let temp = this.state.fileList; let temp = this.state.fileList;
if (file.status == "removed") { if (file.status === "removed") {
temp = temp.filter(item => { temp = temp.filter(item => item.uid !== file.uid);
return item.uid != file.uid;
});
this.setState({ this.setState({
fileList: temp, fileList: temp,
responseList: temp.map(item => { responseList: temp.map(item => ({
return {
fileName: item.name, fileName: item.name,
fileUrl: item.fileUrl fileUrl: item.fileUrl
? item.fileUrl ? item.fileUrl
: this.state.hostAndDir + : `${this.state.hostAndDir}/${item.uid}.${item.name.substr(item.name.length - 3)}`,
"/" +
item.uid +
"." +
item.name.substr(item.name.length - 3),
size: item.size + "", size: item.size + "",
suffix: "." + item.name.split(".")[1], suffix: `.${item.name.split(".")[1]}`,
}; })),
}),
}); });
} else { } else {
temp.push(fileList.pop()); temp.push(fileList.pop());
this.setState({ this.setState({
fileList: temp.map(item => { fileList: temp.map(item => ({
return {
uid: item.uid, uid: item.uid,
name: item.name, name: item.name,
size: item.size, size: item.size,
fileUrl: item.fileUrl, fileUrl: item.fileUrl,
}; })),
}), responseList: temp.map(item => ({
});
this.setState({
responseList: temp.map(item => {
return {
fileName: item.name, fileName: item.name,
fileUrl: item.fileUrl fileUrl: item.fileUrl
? item.fileUrl ? item.fileUrl
: this.state.hostAndDir + : `${this.state.hostAndDir}/${item.uid}.${item.name.substr(item.name.length - 3)}`,
"/" +
item.uid +
"." +
item.name.substr(item.name.length - 3),
size: item.size + "", size: item.size + "",
suffix: "." + item.name.split(".")[1], suffix: `.${item.name.split(".")[1]}`,
}; })),
}),
}); });
} }
} }
normFile = e => { normFile = e => {
if (Array.isArray(e)) { if (Array.isArray(e)) {
return e; return e;
...@@ -151,12 +115,6 @@ class addEdit extends React.Component { ...@@ -151,12 +115,6 @@ class addEdit extends React.Component {
}; };
render() { render() {
var fileUrl = "";
var fileName = "";
if (this.state.responseList[0]) {
var fileUrl = this.state.responseList[0].fileUrl;
var fileName = this.state.responseList[0].fileName;
}
const { const {
visible, visible,
onCancel, onCancel,
...@@ -168,7 +126,7 @@ class addEdit extends React.Component { ...@@ -168,7 +126,7 @@ class addEdit extends React.Component {
seeEdit = {}, seeEdit = {},
type, type,
} = this.props; } = this.props;
const { uploadParams, uploadAction, tags } = this.state; const { previewVisible, previewImage } = this.state;
const { getFieldDecorator } = form; const { getFieldDecorator } = form;
const formItemLayout = { const formItemLayout = {
labelCol: { labelCol: {
...@@ -180,9 +138,10 @@ class addEdit extends React.Component { ...@@ -180,9 +138,10 @@ class addEdit extends React.Component {
sm: { span: 20 }, sm: { span: 20 },
}, },
}; };
const { id, state } = this.props.seeEdit; const { id, state } = seeEdit;
return ( return (
<>
<Modal <Modal
visible={visible} visible={visible}
title={title} title={title}
...@@ -192,7 +151,7 @@ class addEdit extends React.Component { ...@@ -192,7 +151,7 @@ class addEdit extends React.Component {
onCancel={onCancel} onCancel={onCancel}
footer={ footer={
<> <>
{state == 1 && ( {state === 1 && (
<Button key="1" type="primary" onClick={() => onApprove(id, 2)}> <Button key="1" type="primary" onClick={() => onApprove(id, 2)}>
接收 接收
</Button> </Button>
...@@ -209,7 +168,7 @@ class addEdit extends React.Component { ...@@ -209,7 +168,7 @@ class addEdit extends React.Component {
initialValue: seeEdit && seeEdit.name, initialValue: seeEdit && seeEdit.name,
})( })(
<Input <Input
disabled={type != "edit" ? true : false} disabled={type !== "edit"}
style={{ width: "300px" }} style={{ width: "300px" }}
/> />
)} )}
...@@ -222,33 +181,35 @@ class addEdit extends React.Component { ...@@ -222,33 +181,35 @@ class addEdit extends React.Component {
key={index} key={index}
src={item} src={item}
alt="" alt=""
style={{ width: "300px", cursor: 'pointer' }} style={{ width: "200px", height: "240px", cursor: 'pointer' }}
onClick={() => this.handlePreview(item)} // 点击图片触发预览 onClick={() => this.handlePreview(item)}
/> />
))} ))}
</FormItem> </FormItem>
{/* 预览模态框 */}
<Modal
visible={previewVisible}
footer={null}
onCancel={this.handleCancel}
>
<img alt="preview" style={{ width: '100%' }} src={previewImage} />
</Modal>
<FormItem {...formItemLayout} label="内容"> <FormItem {...formItemLayout} label="内容">
{getFieldDecorator("content", { {getFieldDecorator("content", {
initialValue: seeEdit && seeEdit.content, initialValue: seeEdit && seeEdit.content,
})( })(
<textarea <textarea
disabled={type != "edit" ? true : false} disabled={type !== "edit"}
style={{ width: "600px", minHeight: "200px" }} style={{ width: "600px", minHeight: "200px" }}
/> />
)} )}
</FormItem> </FormItem>
</Form> </Form>
</Modal> </Modal>
{/* 预览模态框移到外层 */}
<Modal
visible={previewVisible}
footer={null}
onCancel={this.handleCancel}
>
<img alt="preview" style={{ width: '100%' }} src={previewImage} />
</Modal>
</>
); );
} }
// 处理图片预览 // 处理图片预览
handlePreview = (url) => { handlePreview = (url) => {
this.setState({ this.setState({
...@@ -259,92 +220,6 @@ class addEdit extends React.Component { ...@@ -259,92 +220,6 @@ class addEdit extends React.Component {
// 关闭预览模态框 // 关闭预览模态框
handleCancel = () => this.setState({ previewVisible: false }); handleCancel = () => this.setState({ previewVisible: false });
render() {
var fileUrl = "";
var fileName = "";
if (this.state.responseList[0]) {
var fileUrl = this.state.responseList[0].fileUrl;
var fileName = this.state.responseList[0].fileName;
}
const {
visible,
onCancel,
onCreate,
onApprove,
title,
fileList,
form,
seeEdit = {},
type,
} = this.props;
const { uploadParams, uploadAction, tags } = this.state;
const { getFieldDecorator } = form;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 4 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 20 },
},
};
const { id, state } = this.props.seeEdit;
return (
<Modal
visible={visible}
title={title}
okText="确定"
width={1000}
destroyOnClose
onCancel={onCancel}
footer={
<>
{state == 1 && (
<Button key="1" type="primary" onClick={() => onApprove(id, 2)}>
接收
</Button>
)}
<Button key="3" type="primary" onClick={onCancel}>
返回
</Button>
</>
}
>
<Form>
<FormItem {...formItemLayout} label="留言标题">
{getFieldDecorator("name", {
initialValue: seeEdit && seeEdit.name,
})(
<Input
disabled={type != "edit" ? true : false}
style={{ width: "300px" }}
/>
)}
</FormItem>
<FormItem {...formItemLayout} label="留言图片">
{seeEdit.ossUrl &&
JSON.parse(seeEdit.ossUrl).length > 0 &&
JSON.parse(seeEdit.ossUrl).map((item, index) => (
<img key={index} src={item} alt="" style={{ width: "300px" }} />
))}
</FormItem>
<FormItem {...formItemLayout} label="内容">
{getFieldDecorator("content", {
initialValue: seeEdit && seeEdit.content,
})(
<textarea
disabled={type != "edit" ? true : false}
style={{ width: "600px", minHeight: "200px" }}
/>
)}
</FormItem>
</Form>
</Modal>
);
}
} }
function mapStateToProps(state, ownProps) { function mapStateToProps(state, ownProps) {
......
...@@ -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