| | |
| | | */ |
| | | import React from 'react'; |
| | | |
| | | import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin, Breadcrumb } from 'antd'; |
| | | const { TextArea } = Input; |
| | | import { Row, Col, Input, DatePicker, Button, Modal, Upload, Table, Icon, message, Divider, TimePicker, Badge, Select, Popconfirm, Spin, Breadcrumb } from 'antd'; |
| | | const { TextArea, Search } = Input; |
| | | import HeadView from '../view/HeadView'; |
| | | import BusDetailView from '../view/BusDetailView'; |
| | | import TableView from '../view/TableView'; |
| | |
| | | savedate: {}, |
| | | formdata: {}, |
| | | fileList: [], |
| | | attList1: [], |
| | | previewVisible: false, |
| | | previewImage: '', |
| | | visible: false, |
| | |
| | | status: '', |
| | | loading: false, |
| | | code: '', |
| | | editorState: BraftEditor.createEditorState(null) |
| | | editorState: BraftEditor.createEditorState(null), |
| | | questionnaireModal: false, |
| | | pageSize: 10, |
| | | page: 1, |
| | | selectedRowKeys: [], |
| | | selectedQuestionnaireData: {} |
| | | }; |
| | | } |
| | | |
| | |
| | | dateSource: res.personList || [], |
| | | // fileList: res.attachments.length > 0 ? res.attachments.filter(item=>(item.typeId==1000)) : [], |
| | | fileList: res.attachments || [], |
| | | attList1: res.attList1 || [], |
| | | loading: false, |
| | | modalLoading: false, |
| | | selectedQuestionnaireData: res.questionnaire || {} |
| | | }); |
| | | }) |
| | | } |
| | | onShowSizeChange = (current, pageSize) => { |
| | | this.setState({ pageSize, page: 1 }) |
| | | this.loadData(1, pageSize); |
| | | } |
| | | pageChange = (page, pageSize) => { |
| | | this.loadData(page, pageSize); |
| | | } |
| | | |
| | | saveInputChange = ({ target: { value, name } }) => { |
| | |
| | | })) |
| | | } |
| | | |
| | | selectonClick = () => { |
| | | this.setState({ |
| | | questionnaireModal: true, |
| | | modalLoading: true |
| | | }) |
| | | Fetch.questionQuery({ |
| | | status: 3, |
| | | page: this.state.page, |
| | | size: this.state.pageSize, |
| | | }) |
| | | .then(res => { |
| | | console.log('res', res); |
| | | this.setState({ |
| | | modalLoading: false |
| | | }) |
| | | if (res.code == 0) { |
| | | for (var i = 0; i < res.data.content.length; i++) { |
| | | res.data.content[i]['index'] = i + 1; |
| | | res.data.content[i]['key'] = i; |
| | | } |
| | | this.setState({ |
| | | tableData: res.data.content, |
| | | totalElements: res.data.totalElements |
| | | }); |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | selectCancelModel = () => { |
| | | this.setState({ |
| | | questionnaireModal: false, |
| | | selectedRowKeys: [], |
| | | selectedQuestionnaireData: {}, |
| | | }) |
| | | } |
| | | |
| | | |
| | | questionnaireCancle = () => { |
| | | const { selectedQuestionnaireData } = this.state; |
| | | // this.props.history.push(`/questionnaire/detail/${selectedQuestionnaireData.id}`) |
| | | window.open('index.html#/activeManageEditquestionnaire/' + selectedQuestionnaireData.id); |
| | | } |
| | | |
| | | questionnaireDel = () => { |
| | | this.setState({ selectedQuestionnaireData: {} }) |
| | | } |
| | | |
| | | handleOk = (e) => { |
| | | console.log(e) |
| | | this.setState({ |
| | | questionnaireModal: false, |
| | | selectedRowKeys: [] |
| | | }) |
| | | } |
| | | |
| | | questionnaireSearch = (value) => { |
| | | console.log(value) |
| | | } |
| | | |
| | | submit = () => { |
| | | const { savedate } = this.state; |
| | | const { savedate, selectedQuestionnaireData, fileList } = this.state; |
| | | savedate.startTime = moment(savedate.startDate + " " + moment(savedate.startHour).format(format), 'YYYY-MM-DD HH:mm') |
| | | savedate.endTime = moment(savedate.endDate + " " + moment(savedate.endHour).format(format), 'YYYY-MM-DD HH:mm') |
| | | // console.log({...savedate,queId:selectedQuestionnaireData[0].id}); |
| | | console.log(savedate); |
| | | if (!savedate.activityPersonQuota) { |
| | | message.warning("活动人数不能为空"); |
| | | console.log(selectedQuestionnaireData); |
| | | if (!savedate.host) { |
| | | message.warning("主持人不能为空"); |
| | | return; |
| | | } |
| | | if (savedate.activityPhone) { |
| | |
| | | return message.warning("联系电话不能为空"); |
| | | } |
| | | } |
| | | Fetch.saveActive(savedate) |
| | | if (!savedate.activityTitle) { |
| | | message.warning("活动标题不能为空"); |
| | | return; |
| | | } |
| | | if (!savedate.activityAddress) { |
| | | message.warning("活动地址不能为空"); |
| | | return; |
| | | } |
| | | if (!savedate.activityPersonQuota) { |
| | | message.warning("活动人数不能为空"); |
| | | return; |
| | | } |
| | | if (!savedate.activityDesc) { |
| | | message.warning("活动描述不能为空"); |
| | | return; |
| | | } |
| | | if (!savedate.requirement) { |
| | | message.warning("报名要求不能为空"); |
| | | return; |
| | | } |
| | | |
| | | if (fileList.length = 0) { |
| | | message.warning("添加图片不能为空"); |
| | | return; |
| | | } |
| | | |
| | | if (!selectedQuestionnaireData) { |
| | | return message.warning("调查问卷不能为空"); |
| | | } |
| | | |
| | | Fetch.saveActive({ ...savedate, queId: selectedQuestionnaireData.id }) |
| | | .then(res => { |
| | | if (res.code === 0) { |
| | | message.success("提交成功!"); |
| | |
| | | })) |
| | | } |
| | | |
| | | onSelectChange = (selectedRowKeys, selectedRows) => { |
| | | const { tableData } = this.state; |
| | | console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | console.log('selectedRowKeys changed: ', selectedRows); |
| | | console.log(tableData[selectedRowKeys[0]]); |
| | | console.log(tableData); |
| | | this.setState({ |
| | | selectedQuestionnaireData: tableData[selectedRowKeys[0]], |
| | | selectedRowKeys |
| | | }) |
| | | }; |
| | | |
| | | handleCancel = () => this.setState({ previewVisible: false }) |
| | | render() { |
| | | const { savedate, previewVisible, previewImage, editorState, fileList, dateSource, code, hitList, activityType, disabled, loading } = this.state; |
| | | const { savedate, previewVisible, previewImage, editorState, selectedRowKeys, fileList, attList1, dateSource, code, hitList, activityType, disabled, loading, modalLoading } = this.state; |
| | | console.log('disabled', fileList) |
| | | const props = { |
| | | action: domain + 'api/v1/attachment/materials?entityId=' + savedate.id, |
| | | onChange: ({ file, fileList }) => { |
| | | this.setState({ fileList }); |
| | | }, |
| | | fileList: fileList.filter(item=>(item.typeId==1000)), |
| | | fileList: fileList, |
| | | onRemove: (file) => { |
| | | Fetch.deleteAttachment(file.uid) |
| | | .then(res => { |
| | |
| | | const bottmProps = { |
| | | action: domain + 'api/v1/attachment/materials?entityId=' + savedate.id, |
| | | onChange: ({ file, fileList }) => { |
| | | this.setState({ fileList }); |
| | | this.setState({ attList1: fileList }); |
| | | }, |
| | | fileList: fileList.filter(item=>(item.typeId==1020)), |
| | | fileList: attList1, |
| | | onRemove: (file) => { |
| | | Fetch.deleteAttachment(file.uid) |
| | | .then(res => { |
| | | message.success("移除成功!"); |
| | | }); |
| | | this.setState(({ fileList }) => { |
| | | const index = fileList.indexOf(file); |
| | | const newFileList = fileList.slice(); |
| | | this.setState(({ attList1 }) => { |
| | | const index = attList1.indexOf(file); |
| | | const newFileList = attList1.slice(); |
| | | newFileList.splice(index, 1); |
| | | return { |
| | | fileList: newFileList, |
| | |
| | | ) |
| | | ) |
| | | }]; |
| | | const questionnaireColumns = [{ |
| | | title: '主题', |
| | | dataIndex: 'title', |
| | | key: 'title', |
| | | ellipsis: true, |
| | | render: (cur, item) => { |
| | | return cur || '暂无' |
| | | } |
| | | }, { |
| | | title: '描述', |
| | | dataIndex: 'content', |
| | | key: 'content', |
| | | ellipsis: true, |
| | | render: (cur, item) => { |
| | | return cur || '暂无' |
| | | } |
| | | }, { |
| | | title: '发布时间', |
| | | dataIndex: 'publicTime', |
| | | key: 'publicTime', |
| | | render: (cur, item) => { |
| | | return cur ? moment(cur).format("YYYY-MM-DD HH:mm") : '暂无' |
| | | } |
| | | }]; |
| | | |
| | | const act2columns = [{ |
| | | title: '报名方', |
| | | dataIndex: 'proposerName', |
| | | key: 'proposerName' |
| | | }, { |
| | | title: '报名方性质', |
| | | dataIndex: 'signerType', |
| | | key: 'signerType', |
| | | render: text => (<span>{text == 1 ? '个人' : '企业'}</span>) |
| | | }, { |
| | | title: '报名人数', |
| | | dataIndex: 'signNum', |
| | | key: 'signNum', |
| | | }, { |
| | | }, |
| | | // { |
| | | // title: '报名方性质', |
| | | // dataIndex: 'signerType', |
| | | // key: 'signerType', |
| | | // render: text => (<span>{text == 1 ? '个人' : '企业'}</span>) |
| | | // }, { |
| | | // title: '报名人数', |
| | | // dataIndex: 'signNum', |
| | | // key: 'signNum', |
| | | // }, |
| | | { |
| | | title: '审核状态', |
| | | dataIndex: 'signStatus', |
| | | key: 'signStatus', |
| | |
| | | cancelText="不通过" |
| | | > |
| | | <a href="#">审核</a> |
| | | </Popconfirm> : <span disabled>审核</span> |
| | | </Popconfirm> : <span disabled></span> |
| | | ) |
| | | }]; |
| | | |
| | | console.log('savedate.activityStatus', savedate.activityStatus) |
| | | console.log('savedate.activityType', savedate.activityType) |
| | | return ( |
| | | <div className="app-page"> |
| | | <Spin spinning={loading}> |
| | |
| | | </Col> |
| | | </Row> |
| | | </div> |
| | | { |
| | | savedate.activityStatus == null || savedate.activityStatus == 0 ? |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='top' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>调查问卷</span></Col> |
| | | <Col span={18} push={0} > |
| | | { |
| | | this.state.selectedQuestionnaireData.title ? |
| | | <div> |
| | | <span style={{ margin: '0 20px' }}>{this.state.selectedQuestionnaireData.title}</span> |
| | | <Button type="link" onClick={this.questionnaireCancle}>查看</Button> |
| | | <Button type="link" onClick={this.questionnaireDel}>删除</Button> |
| | | </div> : |
| | | <Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.selectonClick}>请选择</Button> |
| | | } |
| | | </Col> |
| | | </Row> |
| | | </div> : |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='top' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>调查问卷</span></Col> |
| | | <Col span={18} push={0} > |
| | | { |
| | | this.state.selectedQuestionnaireData.title ? |
| | | <div> |
| | | <span style={{ margin: '0 20px' }}>{this.state.selectedQuestionnaireData.title}</span> |
| | | <Button type="link" disabled onClick={this.questionnaireCancle}>查看</Button> |
| | | <Button type="link" disabled onClick={this.questionnaireDel}>删除</Button> |
| | | </div> : |
| | | <Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.selectonClick}>请选择</Button> |
| | | } |
| | | </Col> |
| | | </Row> |
| | | </div> |
| | | } |
| | | |
| | | { |
| | | activityType == 'act_1' ? (dateSource.length > 0 ? |
| | | savedate.activityType == 'act_1' ? (dateSource.length > 0 ? |
| | | <div style={divStyle}> |
| | | <Divider orientation="left" style={{ margin: '20px', width: '97%' }}>报名人员信息</Divider> |
| | | <TableView columns={columns} data={dateSource} pageSize='6' size='small' /> |
| | | </div> : null) : null |
| | | } |
| | | { |
| | | activityType == 'act_2' || activityType == 'act_3' ? (dateSource.length > 0 ? |
| | | savedate.activityType == 'act_2' || savedate.activityType == 'act_3' ? (dateSource.length > 0 ? |
| | | <div style={divStyle}> |
| | | <Divider orientation="left" style={{ margin: '20px', width: '97%' }}>报名名单</Divider> |
| | | <TableView columns={act2columns} data={dateSource} pageSize='6' size='small' /> |
| | | </div> : null) : null |
| | | } |
| | | { |
| | | activityType == 'act_2' || activityType == 'act_3' ? (dateSource.length > 0 ? |
| | | savedate.activityType == 'act_2' || savedate.activityType == 'act_3' ? (dateSource.length > 0 ? |
| | | <div style={divStyle}> |
| | | <Divider orientation="left" style={{ margin: '20px', width: '97%' }}>培训结果</Divider> |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='top' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>添加图片</span></Col> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>结果材料</span></Col> |
| | | <Col span={18} push={0} > |
| | | <Upload disabled={disabled} listType="picture-card" onPreview={this.handlePreview} {...bottmProps}> |
| | | |
| | | |
| | | </Upload> |
| | | <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}> |
| | | <img alt="example" style={{ width: '100%' }} src={previewImage} /> |
| | | </Modal> |
| | | </Col> |
| | | </Row> |
| | | <Row type="flex" align='top' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>培训结果</span></Col> |
| | | <Col span={18} push={0} > |
| | | <span>{savedate.result}</span> |
| | | </Col> |
| | | </Row> |
| | | </div> |
| | | |
| | | </div> : null) : null |
| | | } |
| | | |
| | | { |
| | | activityType == 'act_1' && ( |
| | | savedate.activityType == 'act_1' && ( |
| | | savedate.activityStatus == null || savedate.activityStatus == 0 ? |
| | | <div style={{ display: 'flex', justifyContent: 'center' }}> |
| | | <Button style={{ marginRight: '15px', width: '150px' }} type="primary" onClick={this.submit}>提交</Button> |
| | |
| | | ) |
| | | } |
| | | { |
| | | activityType == 'act_2' || activityType == 'act_3' && ( |
| | | savedate.activityType == 'act_2' || savedate.activityType == 'act_3' ? ( |
| | | savedate.activityStatus == null || savedate.activityStatus == 0 ? |
| | | <div style={{ display: 'flex', justifyContent: 'center' }}> |
| | | <Button style={{ marginRight: '15px', width: '150px' }} type="primary" onClick={this.submit}>提交</Button> |
| | |
| | | <Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.cancle}>返回</Button> |
| | | </div> |
| | | ) |
| | | ) |
| | | ) : '123' |
| | | } |
| | | |
| | | </BusDetailView> |
| | |
| | | } |
| | | |
| | | </Modal> |
| | | <Modal |
| | | title="选择调查问卷" |
| | | visible={this.state.questionnaireModal} |
| | | onCancel={this.selectCancelModel} |
| | | onOk={this.handleOk} |
| | | width='1000px' |
| | | > |
| | | <Search |
| | | placeholder="请输入问卷调查标题" |
| | | enterButton="查询" |
| | | size="large" |
| | | style={{ margin: '12px' }} |
| | | onSearch={value => this.questionnaireSearch(value)} |
| | | /> |
| | | |
| | | <Table |
| | | size="middle" |
| | | dataSource={this.state.tableData} |
| | | rowSelection={{ |
| | | selectedRowKeys, |
| | | type: 'radio', |
| | | onChange: this.onSelectChange, |
| | | }} |
| | | loading={{ spinning: this.state.modalLoading }} |
| | | columns={questionnaireColumns} |
| | | pagination={{ |
| | | pageSize: this.state.pageSize, |
| | | onChange: this.pageChange, |
| | | total: this.state.totalElements, |
| | | showSizeChanger: true, |
| | | onShowSizeChange: this.onShowSizeChange, |
| | | showTotal: (total, range) => `共${total}条记录 `, |
| | | // itemRender: this.itemRender, |
| | | showQuickJumper: true, |
| | | defaultCurrent: 1, |
| | | current: this.state.page |
| | | }} |
| | | /> |
| | | {/* <TableView columns={columns} data={this.state.tableData} pageSize='10' size='default' loading={modalLoading} /> */} |
| | | </Modal> |
| | | </Spin> |
| | | </div> |
| | | ); |