"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _config = _interopRequireDefault(require("../../../../../_mapUtil/config"));
var _PublicService = _interopRequireDefault(require("../../../../../_mapUtil/PublicService"));
var _dayjs = _interopRequireDefault(require("dayjs"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var otherParams = {
  processDefinitionKey: 'customer_service_process'
};

// 表格排序
var handleTable = function handleTable(params, sorter, defaultSort) {
  var _params$finishLimitTi;
  var _params = params;
  _params.page = (params === null || params === void 0 ? void 0 : params.current) - 1;
  _params === null || _params === void 0 || delete _params.current;
  if (_params !== null && _params !== void 0 && (_params$finishLimitTi = _params.finishLimitTime) !== null && _params$finishLimitTi !== void 0 && _params$finishLimitTi.length) {
    var _params$finishLimitTi2, _params$finishLimitTi3;
    _params.finishLimitTimeMin = (0, _dayjs["default"])(_params === null || _params === void 0 || (_params$finishLimitTi2 = _params.finishLimitTime) === null || _params$finishLimitTi2 === void 0 ? void 0 : _params$finishLimitTi2[0]).format('YYYY-MM-DD 00:00:00');
    _params.finishLimitTimeMax = (0, _dayjs["default"])(_params === null || _params === void 0 || (_params$finishLimitTi3 = _params.finishLimitTime) === null || _params$finishLimitTi3 === void 0 ? void 0 : _params$finishLimitTi3[1]).format('YYYY-MM-DD 23:59:59');
  }
  delete _params.finishLimitTime;
  if (sorter && sorter.order) {
    var _sorter$order = sorter.order,
      order = _sorter$order === void 0 ? 'descend' : _sorter$order;
    _params.customSortMode = 2;
    _params.beenAsc = order === 'descend' ? false : true;
  } else if (defaultSort) {
    _params.customSortMode = 2;
    _params.beenAsc = defaultSort === 'descend' ? false : true;
  }
  return _params;
};

// 工单导出
var handleExport = function handleExport(params, sorter, defaultSort) {
  var _params = params;
  _params === null || _params === void 0 || delete _params.current;
  if (_params !== null && _params !== void 0 && _params.finishLimitTimeMax) {
    _params.finishLimitTimeMax = (0, _dayjs["default"])(_params === null || _params === void 0 ? void 0 : _params.finishLimitTimeMax).format('YYYY-MM-DD HH:mm:ss');
  }
  if (sorter && sorter.order) {
    var _sorter$order2 = sorter.order,
      order = _sorter$order2 === void 0 ? 'descend' : _sorter$order2;
    _params.customSortMode = 2;
    _params.beenAsc = order === 'descend' ? false : true;
  } else if (defaultSort) {
    _params.customSortMode = 2;
    _params.beenAsc = defaultSort === 'descend' ? false : true;
  }
  return _params;
};
var _default = exports["default"] = {
  // 工单中心参数---extraParams 用于区分内部和客服工单的key
  workOrderParams: function workOrderParams(_ref) {
    var _ref$pageType = _ref.pageType,
      pageType = _ref$pageType === void 0 ? 'ToDo' : _ref$pageType,
      _ref$pageParams = _ref.pageParams,
      pageParams = _ref$pageParams === void 0 ? {} : _ref$pageParams,
      _ref$extraParams = _ref.extraParams,
      extraParams = _ref$extraParams === void 0 ? {} : _ref$extraParams;
    var params = {
      MyReport: {
        // 上报案件
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/supervises/urge/record/allCasePage"),
        requestMethod: 'get',
        searchBefore: function searchBefore(params) {
          var _params = params;
          _params = handleTable(params);
          return _objectSpread(_objectSpread(_objectSpread({
            reportMan: _PublicService["default"].getQueryString('userId')
          }, _params), otherParams), pageParams);
        },
        exportParamBefore: function exportParamBefore(ret) {
          // 导出参数
          var _ret = ret;
          return _objectSpread(_objectSpread({
            reportMan: _PublicService["default"].getQueryString('userId')
          }, _ret), otherParams);
        }
      },
      Supervice: {
        // 督办案件
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/supervises/urge/record/allCasePage"),
        requestMethod: 'get',
        searchBefore: function searchBefore(params) {
          var _params = params;
          _params = handleTable(params);
          return _objectSpread(_objectSpread(_objectSpread({
            hzMySupervises: true
          }, _params), otherParams), pageParams);
        },
        exportParamBefore: function exportParamBefore(params) {
          // 导出参数
          var _params = params;
          _params = handleExport(params);
          return _objectSpread(_objectSpread(_objectSpread({
            hzMySupervises: true
          }, _params), otherParams), pageParams);
        },
        beforeExport: function beforeExport(ret) {
          // 导出参数
          var _ret = ret;
          _ret.exportType = 3;
          return _ret;
        }
      },
      TicketAll: {
        // 全部
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/supervises/urge/record/allCasePage"),
        requestMethod: 'get',
        searchBefore: function searchBefore(params) {
          var _params = params;
          _params = handleTable(params);
          return _objectSpread(_objectSpread(_objectSpread({}, _params), otherParams), pageParams);
        },
        exportParamBefore: function exportParamBefore(ret) {
          // 导出参数
          var _ret = ret;
          return _objectSpread(_objectSpread({}, _ret), otherParams);
        }
      },
      ToDo: {
        // 待办
        // searchApi: `${config.publicUrlSJGD}/api/workOrder/caseUnFinishPage`,
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/info/unFinishPage"),
        requestMethod: 'get',
        searchBefore: function searchBefore(params, sorter) {
          var _params = params;
          _params = handleTable(params, sorter, 'descend');
          return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _params), otherParams), pageParams), extraParams);
        },
        exportParamBefore: function exportParamBefore(params) {
          // 导出参数
          var _params = params;
          _params = handleExport(params, null, 'descend');
          return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _params), otherParams), pageParams), extraParams);
        },
        beforeExport: function beforeExport(ret) {
          // 导出参数
          var _ret = ret;
          _ret.exportType = 1;
          return _ret;
        }
      },
      Dispose: {
        // 待处置
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/dispose/task/page"),
        searchPage: true,
        requestMethod: 'get',
        searchBefore: function searchBefore(params) {
          var _params = params;
          _params.page = (params === null || params === void 0 ? void 0 : params.current) - 1;
          _params === null || _params === void 0 || delete _params.current;
          return _objectSpread(_objectSpread(_objectSpread({}, _params), otherParams), pageParams);
        },
        exportParamBefore: function exportParamBefore(ret) {
          // 导出参数
          var _ret = ret;
          if (_ret !== null && _ret !== void 0 && _ret.current) {
            _ret.page = ret === null || ret === void 0 ? void 0 : ret.current;
            _ret === null || _ret === void 0 || delete _ret.current;
          }
          return _objectSpread(_objectSpread(_objectSpread({}, _ret), otherParams), pageParams);
        }
      },
      Back: {
        // 退回件
        // searchApi: `${config.publicUrlZHXT}/case/info/finishPage`,
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/info/unFinishPage"),
        requestMethod: 'get',
        searchBefore: function searchBefore(params, sorter) {
          var _params = params;
          _params = handleTable(params, sorter, 'descend');
          return _objectSpread(_objectSpread(_objectSpread({
            hzBack: true
          }, _params), otherParams), pageParams);
        },
        exportParamBefore: function exportParamBefore(params) {
          // 导出参数
          var _params = params;
          _params = handleExport(params, null, 'descend');
          return _objectSpread(_objectSpread(_objectSpread({
            hzBack: true
          }, _params), otherParams), pageParams);
        }
      },
      TimeOutCheck: {
        // 延期审核
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/audit/record/page"),
        requestMethod: 'get',
        searchBefore: function searchBefore(params) {
          var _params = params;
          _params = handleTable(params);
          return _objectSpread(_objectSpread(_objectSpread({
            isPermission: true
          }, _params), otherParams), pageParams);
        },
        exportParamBefore: function exportParamBefore(params) {
          // 导出参数
          var _params = params;
          _params = handleExport(params);
          return _objectSpread(_objectSpread(_objectSpread({
            isPermission: true
          }, _params), otherParams), pageParams);
        }
      },
      HaveToDo: {
        // 已办
        searchApi: "".concat(_config["default"].publicUrlZHXT, "/case/info/finishPage"),
        requestMethod: 'get',
        searchBefore: function searchBefore(params, sorter) {
          var _params = params;
          _params = handleTable(params, sorter, 'descend');
          return _objectSpread(_objectSpread(_objectSpread({}, _params), otherParams), extraParams);
        },
        exportParamBefore: function exportParamBefore(params) {
          // 导出参数
          var _params = params;
          _params = handleExport(params, null, 'descend');
          return _objectSpread(_objectSpread(_objectSpread({}, _params), otherParams), extraParams);
        },
        beforeExport: function beforeExport(ret) {
          // 导出参数
          var _ret = ret;
          _ret.exportType = 2;
          return _ret;
        }
      }
    };
    return (params === null || params === void 0 ? void 0 : params[pageType]) || {};
  },
  highSearchParams: function highSearchParams(_ref2) {
    var _ref2$params = _ref2.params,
      params = _ref2$params === void 0 ? {} : _ref2$params,
      _ref2$filterParams = _ref2.filterParams,
      filterParams = _ref2$filterParams === void 0 ? {} : _ref2$filterParams;
    var _params = _objectSpread(_objectSpread({
      customSortMode: 2,
      beenAsc: false,
      size: params === null || params === void 0 ? void 0 : params.size,
      page: (params === null || params === void 0 ? void 0 : params.page) || 0
    }, filterParams), otherParams);
    return _params;
  },
  // 时限
  timeLimit: function timeLimit(type, status) {
    var items = [{
      index: '0',
      title: '剩余处理时间在规定时间的一半及以上'
    }, {
      index: '1',
      title: '未超时，但剩余处理时间不足一半'
    }, {
      index: '2',
      title: '超时'
    }];
    if (status) {
      return (items === null || items === void 0 ? void 0 : items[type]) || {};
    } else {
      return items;
    }
  }
};
//# sourceMappingURL=config.js.map
