import React, { useState, useEffect, useContext } from 'react'; import { Form, Col, DatePicker, Button, message, Space, Input } from 'antd'; import apiObj from '@api/index'; import BlockContext from './problem-context'; import moment from "moment"; import "moment/locale/zh-cn" import { getCookie } from '@utils/index' const { RangePicker } = DatePicker; const { post, api, xPost } = apiObj; const { TextArea } = Input; function EditBlock(props) { useEffect(() => { }, []); const [form] = Form.useForm(); const [dates, setDates] = useState([]); const [limit, setLimit] = useState(false); const { problemDetail, type } = useContext(BlockContext); const initialValues = problemDetail; const onFinish = values => { if (type == 1) { dataCheck(values) } else { editProblem(values) } }; function change(e) { const { value } = e.target; if (value) { setLimit(true) } else { setLimit(false) } } function editProblem(values) { let params = { id: problemDetail.id, description: values.description, } post(api.updateColumnResult, params).then((res) => { if (res.data.code === 200) { props.userChange() message.success(res.data.message); form.resetFields(); } else { message.error(res.data.message); } }) } //数据对比 function dataCheck(values) { values.startDate = moment(values.time[0]).format('YYYY-MM-DD 00:00:00'); values.endDate = moment(values.time[1]).format('YYYY-MM-DD 23:23:59'); let params = { behospitalCode: values.behospitalCode, dateEnd: values.endDate, dateStart: values.startDate, isPlacefile:getCookie('isPlacefile') } post(api.dataCheck, params).then((res) => { if (res.data.code === 200) { props.userChange() message.success(res.data.message); form.resetFields(); } else { message.error(res.data.message); } }) } function disabledDate(current) { if (!dates || dates.length === 0) { return current && current >= moment().endOf('day'); } const tooLate = dates[0] && current.diff(dates[0], 'days') > 29; const tooEarly = dates[1] && dates[1].diff(current, 'days') > 29; if(!limit){ return current && current >= moment().endOf('day') || tooEarly || tooLate; }else{ return current && current >= moment().endOf('day'); } }; function cancel() { props.userChange() } return ( <>
{initialValues.behospitalCode} {initialValues.hosptialDatatmpCode} {initialValues.hosptialDatatmpName} {initialValues.modeName} {initialValues.tableCname} {initialValues.tableEname} {initialValues.columnCname} {initialValues.columnEname} {initialValues.tableVal} {initialValues.type == 1 ? "数据缺失" : initialValues.type == 2 ? "非标准值" : "正则校验失败"} {initialValues.isSolved == 1 ? "已解决" : "未解决"}