import 'antd/es/tag/style';
import _Tag from 'antd/es/tag';
import 'antd/es/space/style';
import _Space from 'antd/es/space';
import { OkButton } from '@lm_fe/components_m';
import { mchcEvent } from '@lm_fe/env';
import { BF_Wrap2, MyBaseList } from '@lm_fe/pages';
import { SLocal_History } from '@lm_fe/service';
import { request } from '@lm_fe/utils';
import React__default, { useEffect, useState } from 'react';
function List(props) {
  var _a = BF_Wrap2({
      default_conf: {
        title: '胎监-列表',
        tableColumns: function tableColumns() {
          return import('./pages.prenatal-visit.fetal-monitor2.js');
        },
        name: '/api/fetalMonitorRecord',
        searchParams: {},
        searchConfig: [{
          title: '姓名',
          dataIndex: 'name'
        }, {
          title: '证件号码',
          dataIndex: 'idNO'
        }, {
          title: '就诊卡号',
          dataIndex: 'outpatientNO'
        }, {
          name: 'enterTime',
          label: '确认时间',
          inputType: 'rangeDate'
        }, {
          name: 'visitDate',
          label: '看诊日期',
          inputType: 'rangeDate'
        }, {
          name: 'state',
          label: '状态',
          inputType: 'MS',
          props: {
            options: [{
              value: false,
              label: '未确认'
            }, {
              value: true,
              label: '已确认'
            }]
          }
        }]
      }
    }),
    Wrap = _a.Wrap,
    config = _a.config;
  useEffect(function () {
    var rm = mchcEvent.on_rm('custom_msg', function (e) {
      e.data;
    });
    return rm;
  }, []);
  return /*#__PURE__*/React__default.createElement(Wrap, null, /*#__PURE__*/React__default.createElement(MyBaseList, {
    name: config === null || config === void 0 ? void 0 : config.name,
    searchParams: config === null || config === void 0 ? void 0 : config.searchParams,
    useListSourceCount: true,
    initialSearchValue: {},
    searchConfig: config === null || config === void 0 ? void 0 : config.searchConfig,
    handleDoubleClickRow: function handleDoubleClickRow(rowData, ctx) {
      rowData.enterTime;
      rowData.pregnancyId;
      var id = rowData.id;
      request.get('/api/enter/fetalMonitorRecord', {
        params: {
          id: id
        }
      }).then(function () {
        return ctx.handleSearch();
      });
    },
    RenderBtns: function RenderBtns(ctx) {
      return /*#__PURE__*/React__default.createElement(Count, {
        name: config === null || config === void 0 ? void 0 : config.name,
        getSearchParams: ctx.getSearchParams
      });
    },
    ActionAddonBefore: function ActionAddonBefore(ctx) {
      var _a = ctx.rowData;
      _a.enterTime;
      var pregnancyId = _a.pregnancyId,
        id = _a.id;
      return /*#__PURE__*/React__default.createElement(_Space, null, /*#__PURE__*/React__default.createElement(OkButton, {
        size: "small",
        onClick: function onClick() {
          return SLocal_History.historyPush("/prenatal-visit/pregnancy/doctor-end?id=".concat(pregnancyId));
        }
      }, "\u770B\u8BCA"), /*#__PURE__*/React__default.createElement(OkButton, {
        size: "small",
        onClick: function onClick() {
          return request.get('/api/redo/fetalMonitorRecord', {
            params: {
              id: id
            }
          }).then(function () {
            return ctx.handleSearch();
          });
        }
      }, "\u91CD\u505A"));
    },
    tableColumns: __DEV__ ? function () {
      return import('./pages.prenatal-visit.fetal-monitor2.js');
    } : config === null || config === void 0 ? void 0 : config.tableColumns
  }));
}
function Count(props) {
  var name = props.name,
    getSearchParams = props.getSearchParams;
  var _a = useState(0),
    num = _a[0],
    setNum = _a[1];
  useEffect(function () {
    return mchcEvent.on_rm('BaseList_hook', function (e) {
      if (e.type === 'search' && e.name === name) {
        request.get('/api/getTotalMonitorSum', {
          params: getSearchParams()
        }).then(function (r) {
          setNum(r.data);
        });
      }
    });
  }, [name, getSearchParams]);
  return /*#__PURE__*/React__default.createElement(_Tag, null, num);
}
export { List as default };
//# sourceMappingURL=pages.prenatal-visit.fetal-monitor.js.map
