"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"] = _default;
var _react = _interopRequireWildcard(require("react"));
var _FormModal = _interopRequireDefault(require("../../../../FormModal"));
var _serviceConfig = _interopRequireDefault(require("../../../../../_mapUtil/serviceConfig"));
var _service = _interopRequireDefault(require("../../service"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
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 getOrgList = _serviceConfig["default"].getOrgList;
var getOrderAddress = _service["default"].getOrderAddress;
function _default(props) {
  var _props$optionsList = props.optionsList,
    optionsList = _props$optionsList === void 0 ? {} : _props$optionsList,
    filterOnCancel = props.filterOnCancel,
    getFilterParams = props.getFilterParams,
    filterParams = props.filterParams;
  var _optionsList$sourceDa = optionsList.sourceData,
    sourceData = _optionsList$sourceDa === void 0 ? [] : _optionsList$sourceDa,
    _optionsList$orderTyp = optionsList.orderTypeData,
    orderTypeData = _optionsList$orderTyp === void 0 ? [] : _optionsList$orderTyp,
    _optionsList$orderCat = optionsList.orderCategoryData,
    orderCategoryData = _optionsList$orderCat === void 0 ? [] : _optionsList$orderCat,
    _optionsList$orderNat = optionsList.orderNatureData,
    orderNatureData = _optionsList$orderNat === void 0 ? [] : _optionsList$orderNat,
    _optionsList$orderSta = optionsList.orderStatusData,
    orderStatusData = _optionsList$orderSta === void 0 ? [] : _optionsList$orderSta;
  var myForm = (0, _react.useRef)();
  var _useState = (0, _react.useState)(false),
    _useState2 = _slicedToArray(_useState, 2),
    loading = _useState2[0],
    setLoading = _useState2[1];
  var _useState3 = (0, _react.useState)([]),
    _useState4 = _slicedToArray(_useState3, 2),
    orgData = _useState4[0],
    setOrgData = _useState4[1]; // 办理部门
  var _useState5 = (0, _react.useState)([]),
    _useState6 = _slicedToArray(_useState5, 2),
    keyAreaData = _useState6[0],
    setKeyAreaData = _useState6[1]; // 事发区域

  (0, _react.useEffect)(function () {
    getOrgList(function (data) {
      setOrgData(data);
    }, {
      nodeTypeValue: 'Root',
      nodeTypeFile: 'nodeType',
      isLast: true
    }); // 部门数据
    getOrderAddress({
      levelEnd: 3
    }).then(function (res) {
      var list = [];
      if (String(res === null || res === void 0 ? void 0 : res.result) === '0' && res !== null && res !== void 0 && res.data) {
        list = [res === null || res === void 0 ? void 0 : res.data] || [];
        list && list.length && list.map(function (item) {
          _renderTree(item);
        });
      }
      setKeyAreaData(list);
    }); // 事发区域
  }, []);

  //递归
  var _renderTree = function renderTree(data) {
    data.label = data === null || data === void 0 ? void 0 : data.name;
    data.title = data === null || data === void 0 ? void 0 : data.name;
    data.value = data === null || data === void 0 ? void 0 : data.key;
    if (['root', 'type'].includes(data === null || data === void 0 ? void 0 : data.type)) {
      data.disabled = true;
    }
    if (data.children && data.children.length) {
      data.disabled = true;
      data.children.map(function (val) {
        _renderTree(val);
      });
    }
    return data;
  };

  // 查询
  var onSave = function onSave(value) {
    getFilterParams && getFilterParams(value);
  };
  var items = [{
    type: 'card',
    label: '基本信息',
    items: [{
      type: 'input',
      label: "\u5DE5\u5355\u7F16\u53F7",
      paramName: 'taskNo'
    }, {
      type: 'input',
      label: "\u5DE5\u5355\u540D\u79F0",
      paramName: 'taskName'
    }, {
      type: 'select',
      label: "\u5DE5\u5355\u6765\u6E90\u5C0F\u7C7B",
      paramName: 'caseSource',
      itemProps: {
        options: sourceData
      }
    }, {
      type: 'input',
      label: "\u5DE5\u5355\u63CF\u8FF0",
      paramName: 'caseDesc',
      weights: 2
    }, {
      type: 'select',
      label: "\u5DE5\u5355\u7C7B\u578B",
      paramName: 'classType',
      itemProps: {
        allowClear: true,
        options: orderTypeData
      }
    }, {
      type: 'treeSelect',
      label: "\u5DE5\u5355\u7C7B\u522B",
      paramName: 'eventAndComponentManageId',
      itemProps: {
        treeData: orderCategoryData,
        treeDefaultExpandAll: true
      }
    }, {
      type: 'select',
      label: "\u5DE5\u5355\u6027\u8D28",
      paramName: 'urgencyLevelId',
      itemProps: {
        options: orderNatureData
      }
    }, {
      type: 'treeSelect',
      label: '事发区域',
      paramName: 'hzDistrictDivisionId',
      itemProps: {
        treeData: keyAreaData,
        treeDefaultExpandAll: true
      }
    }, {
      type: 'rangePicker',
      label: '办理截止时间',
      paramName: 'finishLimitTime',
      itemProps: {
        showTime: {
          format: 'HH:mm'
        },
        format: 'YYYY-MM-DD HH:mm'
      }
    }, {
      type: 'select',
      label: "\u5E73\u53F0\u7763\u529E\u662F\u5426\u4ECB\u5165",
      paramName: 'interveneSupervises',
      itemProps: {
        options: [{
          label: '是',
          value: true
        }, {
          label: '否',
          value: false
        }]
      }
    }]
  }, {
    type: 'card',
    label: '诉求人信息',
    items: [{
      type: 'input',
      label: '诉求人姓名',
      paramName: 'movantName'
    }, {
      type: 'select',
      label: '性别',
      paramName: 'movantGender',
      itemProps: {
        allowClear: true,
        options: [{
          label: '男',
          value: '男'
        }, {
          label: '女',
          value: '女'
        }]
      }
    }, {
      type: 'input',
      label: '诉求人地址',
      paramName: 'movantAddress'
    }, {
      type: 'input',
      label: '虚拟号码',
      paramName: 'movantVirtualNum'
    }]
  }, {
    type: 'card',
    label: '办理信息',
    items: [{
      type: 'select',
      label: '办理部门',
      paramName: 'deptOrgId',
      itemProps: {
        allowClear: true,
        options: orgData
      }
    }, {
      type: 'select',
      label: '办理状态',
      paramName: 'status',
      itemProps: {
        allowClear: true,
        options: orderStatusData
      }
    }, {
      type: 'input',
      label: '办理结果',
      paramName: 'suggestion'
    }, {
      type: 'rangePicker',
      label: '流转开始时间',
      paramName: 'caseTime',
      itemProps: {
        showTime: {
          format: 'HH:mm'
        },
        format: 'YYYY-MM-DD HH:mm'
      }
    }, {
      type: 'rangePicker',
      label: '办结时间',
      paramName: 'endTime',
      itemProps: {
        showTime: {
          format: 'HH:mm'
        },
        format: 'YYYY-MM-DD HH:mm'
      }
    }]
  }];
  return /*#__PURE__*/_react["default"].createElement(_FormModal["default"], {
    width: 1200,
    column: 3,
    formData: filterParams,
    visible: true,
    ref: myForm,
    title: "\u9AD8\u7EA7\u67E5\u8BE2",
    items: items,
    saveTitle: "\u67E5\u8BE2",
    returnTitle: "\u91CD\u7F6E",
    onConfirm: onSave,
    footerShow: true,
    cancelBtn: false,
    onCancel: function onCancel() {
      filterOnCancel && filterOnCancel();
    },
    returnBtn: true,
    onReturnBack: function onReturnBack() {
      var _myForm$current;
      (myForm === null || myForm === void 0 || (_myForm$current = myForm.current) === null || _myForm$current === void 0 || (_myForm$current = _myForm$current.form) === null || _myForm$current === void 0 ? void 0 : _myForm$current.resetFields) && myForm.current.form.resetFields();
    },
    layout: "horizontal"
  });
}
//# sourceMappingURL=FilterModal.js.map
