import { d as __assign } from './index.js';
import { OkButton } from '@lm_fe/components_m';
import { mchcEvent } from '@lm_fe/env';
import { BF_Wrap2, MyBaseList } from '@lm_fe/pages';
import { SMchc_Courses } from '@lm_fe/service';
import React__default, { useEffect } from 'react';
function List(props) {
  var which_type = props.which_type;
  var type = which_type === '孕妇学校' ? 1 : 2;
  var is_midwifery = which_type === '助产士';
  var load_form = function load_form() {
    return is_midwifery ? import('./pages.pregnant-school.ordered2.js') : import('./pages.pregnant-school.ordered3.js');
  };
  var _a = BF_Wrap2({
      default_conf: {
        title: "".concat(which_type, "-\u9884\u7EA6\u5217\u8868"),
        tableColumns: load_form,
        name: '/api/course-reservations',
        searchParams: {
          'course.type.equals': type
        },
        searchConfig: [{
          name: 'course.name',
          label: '课程标题',
          inputType: 'input',
          filterType: ''
        }, {
          name: 'pregnancy.name',
          label: '姓名',
          inputType: 'input',
          filterType: ''
        }, {
          name: 'status',
          label: '签到状态',
          inputType: 'MS',
          filterType: 'in',
          inputProps: {
            options: [{
              label: '未签到',
              value: '0'
            }, {
              label: '已签到',
              value: '1'
            }, {
              label: '已取消',
              value: '2'
            }]
          },
          style: {
            width: 100
          }
        }, {
          label: '课程标题',
          name: 'course.name'
        }]
      }
    }),
    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, {
    showAdd: false,
    name: config === null || config === void 0 ? void 0 : config.name,
    searchParams: config === null || config === void 0 ? void 0 : config.searchParams,
    useListSourceCount: true,
    showRowEditBtn: false,
    initialSearchValue: {},
    beforeSubmit: function beforeSubmit(v) {
      return __assign(__assign({}, v), {
        type: type
      });
    },
    showPrint: true,
    showRowDelBtn: false,
    printDefaultConfig: {
      method: 'GET'
    },
    searchConfig: config === null || config === void 0 ? void 0 : config.searchConfig,
    ActionAddonBefore: function ActionAddonBefore(_a) {
      var rowData = _a.rowData,
        handleSearch = _a.handleSearch;
      var id = rowData.id,
        course = rowData.course;
      var is签到 = rowData.status === 1;
      var fn = is签到 ? SMchc_Courses.cancel_sign : SMchc_Courses.sign;
      return /*#__PURE__*/React__default.createElement(OkButton, {
        size: "small",
        danger: is签到,
        onClick: function onClick() {
          fn(course === null || course === void 0 ? void 0 : course.id, id).then(function () {
            return handleSearch();
          });
        }
      }, is签到 ? '取消' : '签到');
    },
    tableColumns: __DEV__ ? load_form : config === null || config === void 0 ? void 0 : config.tableColumns
  }));
}
export { List as L };
//# sourceMappingURL=index5.js.map
