forked from nsjcy/frontEnd/nsjcy

liuwh
2020-06-09 5a887acf1924950715086633d329db045223b5c4
SunshineIns/src/page/CareListEdit.jsx
@@ -87,7 +87,7 @@
                        taskType: res.taskType || 1
                    },
                    taskType: res.taskType || 1,
                    disabled: res.status ? true : false,
                    disabled: res.status == 0 || res.status == 99 ? true : false,
                    list: res.tasks || [],
                    socialTaskObject: res.socialTaskObject ? { id: res.socialTaskObject.objectId, objectName: res.socialTaskObject.objectName, taskReport: res.socialTaskObject.taskReport } : {},
                    loading: false,
@@ -225,18 +225,12 @@
        });
    }
    handleOk = e => {
        const { savedate } = this.state;
        console.log(savedate);
        this.setState({
            visible: false,
        });
        Fetch.socialUpdate(savedate.id, 2)
    handleOk = (record) => {
        Fetch.socialUpdate(record.id, 2)
            .then(res => {
                if (res.code === 0) {
                    message.success("结束任务成功!");
                    this.props.history.push("/careList")
                    this.getDetail()
                } else {
                    message.error('保存失败,请联系管理员', 2)
                }
@@ -425,7 +419,7 @@
                    },
                    editorState: BraftEditor.createEditorState(res.taskRequire),
                    editorStatetaskProcess: BraftEditor.createEditorState(res.taskProcess),
                    modaldisabled: res.status ? true : false,
                    modaldisabled: true,
                    loading: false,
                });
            })
@@ -433,45 +427,6 @@
    modalshowCancel = () => {
        this.setState({ modalshowVisible: false, fileList: [] })
    }
    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)
        //         }
        //     });
    }
@@ -516,6 +471,15 @@
                        <Popconfirm placement="topRight" title={'你确定要删除该条记录吗'} onConfirm={() => { this.onDel(text, record) }} okText="确定" cancelText="取消">
                            <label className="theme-color">删除</label>
                        </Popconfirm>
                        {
                            record.status == 1 &&
                            <React.Fragment>
                                <Divider type="vertical" />
                                <Popconfirm placement="topRight" title={'你确定要结束任务吗'} onConfirm={() => { this.handleOk(record) }} okText="确定" cancelText="取消">
                                    <a >结束任务</a>
                                </Popconfirm>
                            </React.Fragment>
                        }
                    </span>
                ),
            }
@@ -659,34 +623,19 @@
                        {
                            savedate.status == 2 || savedate.status == 99 ?
                            disabled ?
                                <div style={{ display: 'flex', justifyContent: 'center' }}>
                                    <Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.cancle}>返回</Button>
                                </div>
                                :
                                savedate.status == 1 ?
                                    <div style={{ display: 'flex', justifyContent: 'center' }}>
                                        <Button style={{ marginRight: '15px', width: '150px' }} type="primary" onClick={this.showModal}>结束任务</Button>
                                        <Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.cancle}>返回</Button>
                                    </div> :
                                    <div style={{ display: 'flex', justifyContent: 'center' }}>
                                        <Button loading={btlloading} style={{ marginRight: '15px', width: '150px' }} type="primary" onClick={this.submit}>提交</Button>
                                        <Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.cancle}>返回</Button>
                                    </div>
                                <div style={{ display: 'flex', justifyContent: 'center' }}>
                                    <Button loading={btlloading} style={{ marginRight: '15px', width: '150px' }} type="primary" onClick={this.submit}>提交</Button>
                                    <Button style={{ marginLeft: '15px', width: '150px' }} onClick={this.cancle}>返回</Button>
                                </div>
                        }
                    </BusDetailView>
                    <Modal
                        title="结束任务"
                        visible={this.state.visible}
                        onOk={this.handleOk}
                        onCancel={this.handleCancelModel}
                        width='300px'
                    >
                        <p>确认结束任务吗?</p>
                    </Modal>
                    <Modal
                        width='60%'
                        title="添加"
@@ -753,12 +702,12 @@
                            </Row>
                        </div>
                        {
                            savedate.status == 1 || savedate.status == 2 ?
                            modalData.socialTaskObject && modalData.socialTaskObject.taskReport ?
                                <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} >
                                            <TextArea disabled={disabled} rows={8} value={socialTaskObject.taskReport || ""} onChange={this.saveModalInputChange} name='taskReport' />
                                            <TextArea disabled={disabled} rows={8} value={modalData.socialTaskObject.taskReport || ""} onChange={this.saveModalInputChange} name='taskReport' />
                                        </Col>
                                        <Col span={12} pull={0}></Col>
                                    </Row>
@@ -766,7 +715,7 @@
                        }
                        {
                            savedate.status == 1 || savedate.status == 2 ?
                            modalData.socialTaskObject && modalData.socialTaskObject.taskReport ?
                                <div style={divStyle}>
                                    <div style={divStyle}>
                                        <Row type="flex" align='top' justify="space-around">