import 'antd/es/button/style';
import _Button from 'antd/es/button';
import 'antd/es/message/style';
import _message from 'antd/es/message';
import 'antd/es/tag/style';
import _Tag from 'antd/es/tag';
import _set from 'lodash/set';
import _get from 'lodash/get';
import { a as __spreadArray, b as __awaiter, c as __generator, d as __assign } from './index.js';
import { UploadOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons';
import { mchcEnv } from '@lm_fe/env';
import { BF_Wrap2, MyBaseList, mchcModal__ } from '@lm_fe/pages';
import { request } from '@lm_fe/utils';
import React__default from 'react';
import 'antd/es/tabs/style';
import 'antd/es/tabs';
import 'lodash/size';
import 'lodash/orderBy';
import 'lodash/map';
import '@lm_fe/components';
import 'antd/es/collapse/style';
import 'antd/es/collapse';
import 'antd/es/badge/style';
import 'antd/es/badge';
import 'lodash/assign';
import '@lm_fe/components_m';
import '@lm_fe/service';
function BreastCancerDataReport(prop) {
  var _a = BF_Wrap2({
      default_conf: {
        title: mchcEnv.is_primary ? '分娩记录-列表' : '产科住院-新生儿分娩记录',
        tableColumns: function tableColumns() {
          return import('./pages.deliver-management.labour-record2.js');
        },
        searchConfig: [{
          label: '分娩日期',
          name: 'labourDate',
          inputType: 'rangeDate'
        }, {
          label: '姓名',
          name: 'admissionCriteria.name',
          inputType: 'Input'
        }, {
          label: '证件号码',
          name: 'admissionCriteria.idNO',
          inputType: 'Input'
        }]
      }
    }),
    config = _a.config,
    Wrap = _a.Wrap;
  return /*#__PURE__*/React__default.createElement(Wrap, null, /*#__PURE__*/React__default.createElement(MyBaseList, {
    name: "/api/labour-records",
    useListSourceCount: true,
    searchConfig: config === null || config === void 0 ? void 0 : config.searchConfig,
    showAction: false,
    showAdd: false,
    baseTitle: "\u5206\u5A29\u8BB0\u5F55",
    genColumns: function genColumns(ctx) {
      var _a;
      return __spreadArray(__spreadArray([], (_a = config === null || config === void 0 ? void 0 : config.tableColumns) !== null && _a !== void 0 ? _a : [], true), [{
        title: '状态',
        dataIndex: 'state',
        width: 64,
        align: 'center',
        fixed: 'right',
        render: function render(text, record) {
          return text ? /*#__PURE__*/React__default.createElement(_Tag, {
            style: {
              marginRight: 0
            }
          }, "\u5DF2\u4E0A\u62A5") : /*#__PURE__*/React__default.createElement(_Tag, {
            style: {
              marginRight: 0
            }
          }, "\u672A\u4E0A\u62A5");
        }
      }, {
        label: '操作',
        fixed: 'right',
        width: 188,
        render: function render(value, rowData) {
          return /*#__PURE__*/React__default.createElement(_Button.Group, null, /*#__PURE__*/React__default.createElement(_Button, {
            size: "small",
            type: "link",
            icon: /*#__PURE__*/React__default.createElement(UploadOutlined, {
              className: "global-table-action-icon"
            }),
            disabled: rowData.state,
            onClick: function onClick() {
              request.get("/api/labour-records/".concat(rowData.id, "/upload"));
              _message.info('上传成功！');
            }
          }, "\u4E0A\u62A5"), /*#__PURE__*/React__default.createElement(_Button, {
            size: "small",
            type: "link",
            icon: /*#__PURE__*/React__default.createElement(EditOutlined, {
              className: "global-table-action-icon"
            }),
            onClick: function onClick() {
              console.log('ctx', rowData.id, ctx);
              mchcModal__.open('modal_form', {
                width: 1600,
                modal_data: {
                  bf_title: mchcEnv.is_primary ? '分娩记录-编辑' : undefined,
                  getInitialData: function getInitialData() {
                    return __awaiter(this, void 0, void 0, function () {
                      return __generator(this, function (_a) {
                        return [2, rowData];
                      });
                    });
                  },
                  formDescriptions: function formDescriptions() {
                    return import('./pages.deliver-management.labour-record3.js');
                  },
                  onSubmit: function onSubmit(values) {
                    return __awaiter(this, void 0, void 0, function () {
                      var admission, finalValues;
                      return __generator(this, function (_a) {
                        switch (_a.label) {
                          case 0:
                            console.log('values', values);
                            admission = _get(rowData, 'admission');
                            _set(admission, 'noenateRecords', _get(values, 'admission.noenateRecords'));
                            finalValues = __assign(__assign({}, values), {
                              admission: admission
                            });
                            if (!_get(finalValues, 'id')) return [3, 2];
                            return [4, request.put("/api/labour-records", finalValues)];
                          case 1:
                            _a.sent();
                            return [3, 4];
                          case 2:
                            return [4, request.post("/api/labour-records", finalValues)];
                          case 3:
                            _a.sent();
                            _a.label = 4;
                          case 4:
                            _message.success('修改成功');
                            ctx.handleSearch();
                            return [2, true];
                        }
                      });
                    });
                  }
                }
              });
            }
          }, "\u7F16\u8F91"), /*#__PURE__*/React__default.createElement(_Button, {
            type: "link",
            size: "small",
            icon: /*#__PURE__*/React__default.createElement(DeleteOutlined, {
              className: "global-table-action-icon"
            }),
            onClick: function onClick() {
              return ctx.handleDelete(rowData);
            }
          }, "\u5220\u9664"));
        }
      }], false);
    }
  }));
}
export { BreastCancerDataReport as default };
//# sourceMappingURL=pages.deliver-management.labour-record.js.map
