"use strict";

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _api = require("../../api");
var _vmCard = _interopRequireDefault(require("../../../vm-card"));
var _antd = require("antd");
var _react = _interopRequireWildcard(require("react"));
var _vmFilter = require("../../../vm-filter");
var _vmTable = _interopRequireDefault(require("../../../vm-table"));
var _ahooks = require("ahooks");
var _index = require("../../index");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
var RestaurantList = function RestaurantList(_ref) {
  var id = _ref.id,
    info = _ref.info;
  var _useContext = (0, _react.useContext)(_index.CcUnitContext),
    openRestaurant = _useContext.openRestaurant;
  var _useSetState = (0, _ahooks.useSetState)({
      name: '',
      signStatus: ''
    }),
    _useSetState2 = _slicedToArray(_useSetState, 2),
    search = _useSetState2[0],
    setSearch = _useSetState2[1];
  var tableProps = _api.BasicService.restaurantList(Object.assign({
    name: search.name
  }, info.garbageType === 'fqyz' ? {
    fqyzSignStatus: search.signStatus,
    fqyzSignUnitId: id
  } : {
    ccSignStatus: search.signStatus,
    ccSignUnitId: id
  }));
  var signList = _api.BasicService.signEnum();
  var columns = [{
    title: '产生单位名称',
    dataIndex: 'name',
    width: 140,
    ellipsis: true,
    render: function render(text, record) {
      return text ? /*#__PURE__*/_react["default"].createElement("a", {
        onClick: function onClick() {
          return openRestaurant && openRestaurant({
            id: record.id,
            title: record.name
          });
        }
      }, text) : '-';
    }
  }, {
    title: '地址',
    dataIndex: 'address',
    width: 180,
    ellipsis: true
  }, {
    title: '单位类型',
    dataIndex: 'classesName',
    width: 140,
    ellipsis: true
  }, {
    title: '签约状态',
    dataIndex: 'isSignValue',
    width: 150,
    ellipsis: true
  }];
  return /*#__PURE__*/_react["default"].createElement(_antd.Row, {
    gutter: [10, 10],
    style: {
      padding: 10
    }
  }, /*#__PURE__*/_react["default"].createElement(_antd.Col, {
    span: 24
  }, /*#__PURE__*/_react["default"].createElement(_vmCard["default"], null, /*#__PURE__*/_react["default"].createElement(_antd.Space, null, /*#__PURE__*/_react["default"].createElement(_vmFilter.VmFilterItem, {
    items: [{
      label: '产生单位名称',
      type: 'input',
      value: search.name,
      style: {
        width: 200
      },
      onChange: function onChange(e) {
        setSearch({
          name: e.target.value
        });
      }
    }]
  }), /*#__PURE__*/_react["default"].createElement(_vmFilter.VmFilterItem, {
    items: [{
      label: info.garbageType === 'fqyz' ? '废弃油脂签约状态' : '餐厨垃圾签约状态',
      type: 'select',
      value: search.signStatus,
      style: {
        width: 120
      },
      options: signList,
      onChange: function onChange(value) {
        setSearch({
          signStatus: value
        });
      }
    }]
  })))), /*#__PURE__*/_react["default"].createElement(_antd.Col, {
    span: 24
  }, /*#__PURE__*/_react["default"].createElement(_vmCard["default"], null, /*#__PURE__*/_react["default"].createElement(_vmTable["default"], Object.assign({}, tableProps, {
    columns: columns,
    height: 400
  })))));
};
var _default = exports["default"] = RestaurantList;
//# sourceMappingURL=index.js.map
