| | |
| | | |
| | | import React from 'react'; |
| | | |
| | | import { Row, Col, Input, DatePicker, Button, Modal, Upload, Icon, message, Breadcrumb, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd'; |
| | | import { Row, Col, Input, DatePicker, Button, Modal, Upload, Table, message, Breadcrumb, TimePicker, Badge, Select, Popconfirm, Spin } from 'antd'; |
| | | const { TextArea } = Input; |
| | | import HeadView from '../view/HeadView'; |
| | | import BusDetailView from '../view/BusDetailView'; |
| | |
| | | this.state = { |
| | | dateSource: [], |
| | | savedate: {}, |
| | | modalData: {}, |
| | | formdata: {}, |
| | | fileList: [], |
| | | previewVisible: false, |
| | |
| | | // rowNum: 4, |
| | | editorState: BraftEditor.createEditorState(null), |
| | | editorStatetaskProcess: BraftEditor.createEditorState(null), |
| | | list: [] |
| | | }; |
| | | } |
| | | |
| | |
| | | endHour: moment(endTime).format(format), |
| | | taskType: res.taskType || 1 |
| | | }, |
| | | editorState: BraftEditor.createEditorState(res.taskRequire), |
| | | editorStatetaskProcess: BraftEditor.createEditorState(res.taskProcess), |
| | | taskType: res.taskType || 1, |
| | | // status: res.activityStatus || '', |
| | | socialTaskObject: res.socialTaskObject ? { id: res.socialTaskObject.objectId, objectName: res.socialTaskObject.objectName, taskReport: res.socialTaskObject.taskReport } : {}, |
| | |
| | | message.warning("任务标题不能为空"); |
| | | return; |
| | | } |
| | | if (!savedate.taskAddress) { |
| | | message.warning("任务地点不能为空"); |
| | | return; |
| | | } |
| | | if (moment(savedate.startTime) < moment(new Date())) { |
| | | message.warning("开始时间必须大于当前时间"); |
| | | console.log(moment(savedate.startTime)) |
| | |
| | | } |
| | | if (moment(savedate.endTime) < moment(savedate.startTime)) { |
| | | message.warning("结束时间必须大于开始时间"); |
| | | return; |
| | | } |
| | | if (!savedate.taskRequire) { |
| | | message.warning("任务要求不能为空"); |
| | | return; |
| | | } |
| | | if (!savedate.taskProcess) { |
| | | message.warning("任务流程不能为空"); |
| | | return; |
| | | } |
| | | if (!socialTaskObject.id) { |
| | |
| | | autoPlay: true, // 指定音视频是否自动播放 |
| | | controls: true, // 指定音视频是否显示控制栏 |
| | | poster: domain + 'api/v1/attachment/image/' + res[0].id, // 指定视频播放器的封面 |
| | | modalshowVisible: false |
| | | } |
| | | }) |
| | | } |
| | |
| | | this.setState({ editorState }) |
| | | const htmlContent = editorState.toHTML() |
| | | console.log(htmlContent) |
| | | this.setState(({ savedate }) => ({ |
| | | savedate: { |
| | | ...savedate, |
| | | this.setState(({ modalData }) => ({ |
| | | modalData: { |
| | | ...modalData, |
| | | taskRequire: htmlContent |
| | | } |
| | | })) |
| | |
| | | handleEditorLChange = (editorStatetaskProcess) => { |
| | | this.setState({ editorStatetaskProcess }) |
| | | const htmlContent = editorStatetaskProcess.toHTML() |
| | | this.setState(({ savedate }) => ({ |
| | | savedate: { |
| | | ...savedate, |
| | | this.setState(({ modalData }) => ({ |
| | | modalData: { |
| | | ...modalData, |
| | | taskProcess: htmlContent |
| | | } |
| | | })) |
| | | } |
| | | |
| | | modalshow = () => { |
| | | this.setState({ modalshowVisible: true }) |
| | | const { id } = this.props.match.params; |
| | | this.setState({ loading: true }) |
| | | Fetch.socialfind(id) |
| | | .then(res => { |
| | | console.log(res) |
| | | this.setState({ |
| | | modalData: { |
| | | ...res, |
| | | }, |
| | | editorState: BraftEditor.createEditorState(res.taskRequire), |
| | | editorStatetaskProcess: BraftEditor.createEditorState(res.taskProcess), |
| | | taskType: res.taskType || 1, |
| | | socialTaskObject: res.socialTaskObject ? { id: res.socialTaskObject.objectId, objectName: res.socialTaskObject.objectName, taskReport: res.socialTaskObject.taskReport } : {}, |
| | | modaldisabled: res.status ? true : false, |
| | | fileList: res.attachments || [], |
| | | loading: false, |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | modalshowCancel = () => { |
| | | this.setState({ modalshowVisible: false }) |
| | | } |
| | | |
| | | handleOk = () => { |
| | | console.log('success') |
| | | this.setState({ confirmLoading: true }); |
| | | const { modalData } = this.state; |
| | | console.log(modalData) |
| | | |
| | | if (!modalData.taskAddress) { |
| | | return message.warning("任务地点不能为空"); |
| | | } |
| | | if (!modalData.taskTitle) { |
| | | return message.warning("任务标题不能为空"); |
| | | } |
| | | if (!modalData.taskRequire) { |
| | | message.warning("任务要求不能为空"); |
| | | return; |
| | | } |
| | | if (!modalData.taskProcess) { |
| | | message.warning("任务流程不能为空"); |
| | | return; |
| | | } |
| | | console.log(modalData) |
| | | //提交完成后关闭弹窗,刷新列表 |
| | | |
| | | // Fetch.addResult({ ...modalData }) |
| | | // .then(res => { |
| | | // console.log(res) |
| | | // if (res.code === 0) { |
| | | // this.setState({ |
| | | // confirmLoading: false, |
| | | // modal: false, |
| | | // closeKey: Date.now() |
| | | // }, this.getData); |
| | | // message.success("提交成功!") |
| | | // } else { |
| | | // message.error('保存失败,请联系管理员', 2) |
| | | // } |
| | | // }); |
| | | } |
| | | |
| | | |
| | | handleCancel = () => this.setState({ previewVisible: false }) |
| | | |
| | | |
| | | renderColumns = () => { |
| | | return [ |
| | | { |
| | | title: '编号', |
| | | dataIndex: 'key', |
| | | key: 'key', |
| | | }, |
| | | { |
| | | title: '任务流程', |
| | | dataIndex: 'taskAddress', |
| | | key: 'taskAddress', |
| | | }, |
| | | { |
| | | title: '任务要求', |
| | | dataIndex: 'taskProcess', |
| | | key: 'taskProcess', |
| | | }, { |
| | | title: '操作', |
| | | key: 'action', |
| | | render: (text, record) => ( |
| | | <span> |
| | | <label onClick={() => { this.onDetail(text, record) }} className="theme-color">详情</label> |
| | | <Divider type="vertical" /> |
| | | <Popconfirm placement="topRight" title={'你确定要删除该条记录吗'} onConfirm={() => { this.onDel(text, record) }} okText="确定" cancelText="取消"> |
| | | <label className="theme-color">删除</label> |
| | | </Popconfirm> |
| | | </span> |
| | | ), |
| | | } |
| | | ] |
| | | } |
| | | |
| | | onDel = (_text, _record) => { |
| | | console.log(_text, _record) |
| | | // Fetch.businessDel({ businessId: _text.businessId }).then(res => { |
| | | // if (res.code == 0) { |
| | | // message.warning('正在更新列表'); |
| | | // this.onTableChange(); |
| | | // } |
| | | // }, err => { |
| | | // message.error(err); |
| | | // }); |
| | | } |
| | | |
| | | onDetail = (_text, _record) => { |
| | | console.log(_text, _record) |
| | | } |
| | | |
| | | render() { |
| | | const { savedate, editorState, socialTaskObject, fileList, editorStatetaskProcess, hitList, taskType, disabled, loading } = this.state; |
| | | console.log('list', socialTaskObject) |
| | | const { savedate, editorState, socialTaskObject, fileList, editorStatetaskProcess, hitList, taskType, disabled, loading, modalData, modalshowVisible, list, modaldisabled } = this.state; |
| | | const props = { |
| | | action: domain + 'api/v1/attachment/materials?entityId=' + savedate.id, |
| | | onChange: ({ file, fileList }) => { |
| | |
| | | <Option value={4}>心理疏导</Option> |
| | | </Select> |
| | | </Col> |
| | | <Col span={12} pull={0}></Col> |
| | | </Row> |
| | | </div> |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务标题</span></Col> |
| | | <Col span={6} push={0} ><Input disabled={disabled} placeholder="请输入任务标题" style={{ width: '300px' }} name='taskTitle' onChange={this.saveInputChange} value={savedate.taskTitle || ""} /></Col> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务地点</span></Col> |
| | | <Col span={6} push={0} ><Input disabled={disabled} placeholder="请输入任务地点" style={{ width: '300px' }} name='taskAddress' onChange={this.saveInputChange} value={savedate.taskAddress || ""} /></Col> |
| | | </Row> |
| | | </div> |
| | | |
| | | |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | |
| | | </Row> |
| | | </div> |
| | | |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务要求</span></Col> |
| | | <Col span={18} push={0} style={{ border: 'solid 1px rgba(0, 0, 0, 0.25)', borderRadius: '5PX' }}> |
| | | |
| | | <BraftEditor |
| | | value={editorState} |
| | | disabled={disabled} |
| | | placeholder='请输入活动进程' |
| | | media={{ |
| | | allowPasteImage: true, // 是否允许直接粘贴剪贴板图片(例如QQ截图等)到编辑器 |
| | | image: true, // 开启图片插入功能 |
| | | video: false, // 开启视频插入功能 |
| | | audio: false, // 开启音频插入功能 |
| | | uploadFn: this.uploadFn |
| | | }} |
| | | excludeControls={['emoji']} |
| | | onChange={this.handleEditorChange} |
| | | onSave={this.submitContent} |
| | | onBlur={this.submitContent} |
| | | /> |
| | | {/* <TextArea disabled={disabled} rows={4} placeholder="请输入任务要求" style={{ width: '92%' }} value={savedate.taskRequire || ""} onChange={this.saveInputChange} name='taskRequire' /> */} |
| | | </Col> |
| | | </Row> |
| | | </div> |
| | | |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务流程</span></Col> |
| | | <Col span={18} push={0} style={{ border: 'solid 1px rgba(0, 0, 0, 0.25)', borderRadius: '5PX' }}> |
| | | |
| | | <BraftEditor |
| | | value={editorStatetaskProcess} |
| | | disabled={disabled} |
| | | placeholder='请输入活动进程' |
| | | media={{ |
| | | allowPasteImage: true, // 是否允许直接粘贴剪贴板图片(例如QQ截图等)到编辑器 |
| | | image: true, // 开启图片插入功能 |
| | | video: false, // 开启视频插入功能 |
| | | audio: false, // 开启音频插入功能 |
| | | uploadFn: this.uploadFn |
| | | }} |
| | | excludeControls={['emoji']} |
| | | onChange={this.handleEditorLChange} |
| | | onSave={this.submitLContent} |
| | | onBlur={this.submitLContent} |
| | | /> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>添加子任务</span></Col> |
| | | <Col span={6} push={0} > |
| | | <Button style={{ width: '300px' }} disabled={disabled} onClick={this.modalshow}>请添加</Button> |
| | | </Col> |
| | | {/* <Col span={18} push={0} ><TextArea disabled={disabled} rows={4} placeholder="请输入任务流程" style={{ width: '92%' }} value={savedate.taskProcess || ""} onChange={this.saveInputChange} name='taskProcess' /></Col> */} |
| | | <Col span={12} pull={0}></Col> |
| | | </Row> |
| | | </div> |
| | | |
| | | <Table dataSource={list} pagination={false} columns={this.renderColumns()} /> |
| | | |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | |
| | | > |
| | | <p>确认结束任务吗?</p> |
| | | </Modal> |
| | | <Modal |
| | | width='60%' |
| | | title="添加" |
| | | confirmLoading={confirmLoading} |
| | | visible={modalshowVisible} |
| | | onOk={this.modalhandleOk} |
| | | onCancel={this.modalshowCancel} |
| | | > |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务地点</span></Col> |
| | | <Col span={6} push={0} ><Input disabled={modaldisabled} placeholder="请输入任务地点" name='taskAddress' onChange={this.saveInputChange} value={modalData.taskAddress || ""} /></Col> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务标题</span></Col> |
| | | <Col span={6} push={0} ><Input disabled={modaldisabled} placeholder="请输入任务标题" name='taskTitle' onChange={this.saveInputChange} value={modalData.taskTitle || ""} /></Col> |
| | | </Row> |
| | | </div> |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务要求</span></Col> |
| | | <Col span={18} push={0} style={{ border: 'solid 1px rgba(0, 0, 0, 0.25)', borderRadius: '5PX' }}> |
| | | |
| | | <BraftEditor |
| | | value={editorState} |
| | | disabled={modaldisabled} |
| | | placeholder='请输入活动进程' |
| | | media={{ |
| | | allowPasteImage: true, // 是否允许直接粘贴剪贴板图片(例如QQ截图等)到编辑器 |
| | | image: true, // 开启图片插入功能 |
| | | video: false, // 开启视频插入功能 |
| | | audio: false, // 开启音频插入功能 |
| | | uploadFn: this.uploadFn |
| | | }} |
| | | excludeControls={['emoji']} |
| | | onChange={this.handleEditorChange} |
| | | onSave={this.submitContent} |
| | | onBlur={this.submitContent} |
| | | /> |
| | | </Col> |
| | | </Row> |
| | | </div> |
| | | |
| | | <div style={divStyle}> |
| | | <Row type="flex" align='middle' justify="space-around"> |
| | | <Col span={6} pull={0} style={{ textAlign: 'center' }}><span>任务流程</span></Col> |
| | | <Col span={18} push={0} style={{ border: 'solid 1px rgba(0, 0, 0, 0.25)', borderRadius: '5PX' }}> |
| | | |
| | | <BraftEditor |
| | | value={editorStatetaskProcess} |
| | | disabled={modaldisabled} |
| | | placeholder='请输入活动进程' |
| | | media={{ |
| | | allowPasteImage: true, // 是否允许直接粘贴剪贴板图片(例如QQ截图等)到编辑器 |
| | | image: true, // 开启图片插入功能 |
| | | video: false, // 开启视频插入功能 |
| | | audio: false, // 开启音频插入功能 |
| | | uploadFn: this.uploadFn |
| | | }} |
| | | excludeControls={['emoji']} |
| | | onChange={this.handleEditorLChange} |
| | | onSave={this.submitLContent} |
| | | onBlur={this.submitLContent} |
| | | /> |
| | | </Col> |
| | | </Row> |
| | | </div> |
| | | </Modal> |
| | | </Spin> |
| | | </div> |
| | | ); |