"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _config = _interopRequireDefault(require("../../config"));
var _config2 = _interopRequireDefault(require("../../../../../_mapUtil/config"));
var _http = _interopRequireDefault(require("../../../../../_util/http"));
var _PublicService = _interopRequireDefault(require("../../../../../_mapUtil/PublicService"));
var _message = _interopRequireDefault(require("antd/lib/message"));
var _upload = _interopRequireDefault(require("antd/lib/upload"));
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
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 processParams = _config["default"].processParams;

// 重新导入操作
var customUpload = function customUpload(item, resetImport, record) {
  var key = 'updatable';
  var uploadURL = "".concat(_config2["default"].publicUrlSJGD, "/api/workOrder/importWorkOrderInfo");
  var uploadProps = {
    name: 'file',
    action: function action(file) {
      if (file) {
        var name = file.name;
        return uploadURL + "?fileName=".concat(name) || uploadURL;
      }
    },
    accept: 'word',
    data: {
      caseId: (record === null || record === void 0 ? void 0 : record.caseId) || (record === null || record === void 0 ? void 0 : record.id)
    },
    headers: {
      Authorization: "Bearer ".concat(_PublicService["default"].getToken()),
      tenantId: _PublicService["default"].getQueryString('tenantId') || _PublicService["default"].getSystemInfo('tenantId') || '',
      userId: _PublicService["default"].getQueryString('userId') || _PublicService["default"].getSystemInfo('userId') || ''
    },
    showUploadList: false,
    beforeUpload: function beforeUpload(info) {
      _message["default"].destroy();
      //   message.loading('正在进行数据校验……', 0);
    },
    onChange: function onChange(info) {
      if (info.file.status === 'uploading') {
        _message["default"].loading({
          content: '导入中...',
          key: key,
          duration: 0
        });
      } else if (info.file.status === 'done') {
        _message["default"].success({
          content: "".concat(info.file.name, " \u5BFC\u5165\u6210\u529F"),
          key: key
        });
      } else if (info.file.status === 'error') {
        _message["default"].error({
          content: "".concat(info.file.name, " \u5BFC\u5165\u5931\u8D25"),
          key: key
        });
      }
    },
    onSuccess: function onSuccess(info) {
      _message["default"].destroy();
      if (info.rc && info.rc !== 0 || info.code && !info.code || info.result) {
        _message["default"].error({
          content: info.err || info.msg || info.message,
          key: key
        });
      } else {
        _message["default"].success({
          content: '文件导入成功',
          key: key
        });
        _message["default"].destroy();
        resetImport && resetImport(info, record);
      }
    }
  };
  return /*#__PURE__*/_react["default"].createElement(_upload["default"], uploadProps, /*#__PURE__*/_react["default"].createElement("a", null, item));
};
var handleUserRole = function handleUserRole() {
  var userRole = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var list = [];
  // shift_boss_role   办结角色
  // dispatch_role  派发角色
  // supervisor_role  审核角色
  // function_dept_role  处置角色
  // report  上报
  // superAdmin  超级管理员
  // SBR 上报角色
  // DBR  督办角色
  // sonDispatchRole  子公司转派角色
  // sonCheckRole  子公司审核角色
  // sonDisposeRole  子公司部门处置角色
  var orderRole = ['dispatch_role', 'supervisor_role', 'superAdmin', 'report', 'function_dept_role', 'DBR', 'sonDispatchRole', 'sonCheckRole', 'sonDisposeRole'];
  var orderRoleNames = {
    dispatch_role: 'payPeople',
    // 派发角色
    supervisor_role: 'handlePeople',
    // 审核角色
    superAdmin: 'admin',
    // 管理员、超级管理员
    report: 'report',
    // 上报者
    function_dept_role: 'dealPeople',
    // 处置角色
    DBR: 'supervisePeople',
    // 督办角色
    sonDispatchRole: 'unitRedeployPeople',
    // 子公司转派角色
    sonCheckRole: 'unitHandlePeople',
    // 子公司审核角色
    sonDisposeRole: 'unitDealPeople' // 子公司部门处置角色
  };
  if (userRole !== null && userRole !== void 0 && userRole.length) {
    userRole.map(function (val) {
      if (orderRole.includes(val === null || val === void 0 ? void 0 : val.code)) {
        list.push(_objectSpread(_objectSpread({}, val), {}, {
          value: orderRoleNames === null || orderRoleNames === void 0 ? void 0 : orderRoleNames[val === null || val === void 0 ? void 0 : val.code]
        }));
      }
    });
  }
  return list;
};

// 判断处置按钮权限
var judgeDisposeBtn = function judgeDisposeBtn(record) {
  var _record$disposeDeptLi = record.disposeDeptList,
    disposeDeptList = _record$disposeDeptLi === void 0 ? [] : _record$disposeDeptLi;
  var userId = _PublicService["default"].getQueryString('userId');
  var disposeBtn = disposeDeptList !== null && disposeDeptList !== void 0 && disposeDeptList.some(function (val) {
    return (val === null || val === void 0 ? void 0 : val.disposeDeptDutyMan) === userId;
  }) ? ['处置'] : [];
  return disposeBtn;
};

// 根据流程key获取操作按钮
var getBtnByProcessKey = function getBtnByProcessKey() {
  var btnList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var record = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var pageType = arguments.length > 2 ? arguments[2] : undefined;
  var list = _toConsumableArray(btnList);
  var defaultBtn = (btnList === null || btnList === void 0 ? void 0 : btnList.filter(function (val) {
    return !['派发', '撤销', '转派', '处置', '退回', '一级审核', '二级审核', '撤回', '延期申请'].includes(val);
  })) || []; // 除了根据key限制的其他操作按钮
  if (pageType === 'HaveToDo') {
    // 已办工单
    list = (btnList === null || btnList === void 0 ? void 0 : btnList.filter(function (val) {
      return ['撤回'].includes(val);
    })) || {};
  } else if ((record === null || record === void 0 ? void 0 : record.processDefinitionKey) === 'customer_service_process') {
    // 主流程
    list = (btnList === null || btnList === void 0 ? void 0 : btnList.filter(function (val) {
      return ['派发', '撤销'].includes(val);
    })) || {};
  } else if ((record === null || record === void 0 ? void 0 : record.processDefinitionKey) === 'customer_service_process_czzlc') {
    // 子公司处置流程
    list = (btnList === null || btnList === void 0 ? void 0 : btnList.filter(function (val) {
      return ['转派', '处置', '退回', '一级审核', '延期申请'].includes(val);
    })) || {};
  } else if ((record === null || record === void 0 ? void 0 : record.processDefinitionKey) === 'customer_service_process_bmczzlc') {
    // 部门处置流程
    list = (btnList === null || btnList === void 0 ? void 0 : btnList.filter(function (val) {
      return ['处置', '退回', '二级审核'].includes(val);
    })) || {};
  }
  return [].concat(_toConsumableArray(defaultBtn), _toConsumableArray(list));
};

// 工单操作按钮
var getWorkOrderBtn = function getWorkOrderBtn(_ref) {
  var _ref$statusTag = _ref.statusTag,
    statusTag = _ref$statusTag === void 0 ? 'OrderEnd' : _ref$statusTag,
    _ref$userRole = _ref.userRole,
    userRole = _ref$userRole === void 0 ? ['admin'] : _ref$userRole,
    _ref$record = _ref.record,
    record = _ref$record === void 0 ? {} : _ref$record,
    pageType = _ref.pageType;
  var _userRole = handleUserRole(userRole); // 整理角色权限为需要的形式
  var dismissBtn = []; // 撤销
  // canApplyBtn: 延期申请   disposeBtn: 处置

  var canApplyBtn = (record === null || record === void 0 ? void 0 : record.caseSource) !== '01' && (record === null || record === void 0 ? void 0 : record.status) === 4 && (record === null || record === void 0 ? void 0 : record.canApply) != null && (record === null || record === void 0 ? void 0 : record.canApply) == false ? ['延期申请'] : [];
  var firstCheck = [7].includes(record === null || record === void 0 ? void 0 : record.status) ? ['一级审核'] : [];
  var twoCheck = [6].includes(record === null || record === void 0 ? void 0 : record.status) ? ['二级审核'] : [];
  var unitDeal = [4, 15, 5].includes(record === null || record === void 0 ? void 0 : record.status) ? ['处置'] : [];
  var back = [4, 5].includes(record === null || record === void 0 ? void 0 : record.status) ? ['退回'] : [];
  var payout = [4].includes(record === null || record === void 0 ? void 0 : record.status) ? ['转派'] : [];
  var recall = [];
  if ((record === null || record === void 0 ? void 0 : record.status) === 4 && (record === null || record === void 0 ? void 0 : record.processDefinitionKey) == 'customer_service_process' && (record === null || record === void 0 ? void 0 : record.centerCanWithdraw) === true) {
    recall = ['撤回'];
  } else if ((record === null || record === void 0 ? void 0 : record.status) === 5 && (record === null || record === void 0 ? void 0 : record.processDefinitionKey) == 'customer_service_process_czzlc' && (record === null || record === void 0 ? void 0 : record.companyCanWithdraw) === true) {
    recall = ['撤回'];
  }
  var written = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15].includes(record === null || record === void 0 ? void 0 : record.status) ? ['批示'] : [];
  var pressToDo = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15].includes(record === null || record === void 0 ? void 0 : record.status) ? ['催办'] : [];
  if (_userRole.some(function (val) {
    return val.value === 'report';
  })) {
    // 撤回的工单不能撤销
    dismissBtn = ['撤销'];
  }

  // 再次办理
  var againDeal = pageType === 'ToDo' ? ['回访', '再次办理'] : [];
  var btnList = {
    Payout: {
      // 待派发
      admin: ['派发'],
      report: ['派发'].concat(_toConsumableArray(dismissBtn)),
      payPeople: ['派发']
    },
    Dispose: {
      // 待子公司处置
      admin: [].concat(written, pressToDo),
      payPeople: [].concat(written, pressToDo, _toConsumableArray(recall), firstCheck),
      supervisePeople: [].concat(written),
      unitRedeployPeople: [].concat(unitDeal, payout, back, _toConsumableArray(recall), twoCheck, canApplyBtn),
      // 子公司转派角色
      unitDealPeople: [].concat(unitDeal),
      // 子公司部门处置角色
      unitHandlePeople: [].concat(twoCheck),
      // 子公司审核角色
      dealPeople: [].concat(unitDeal, back, canApplyBtn)
    },
    // DisposeIn: {
    //   // 处置中
    //   payPeople: ['一级审核' /*'延期审核'*/],
    //   unitRedeployPeople: ['处置', '退回', /*'延期审核',*/ '二级审核', '审核退回'], // 子公司转派角色
    //   unitDealPeople: ['处置'], // 子公司部门处置角色
    //   unitHandlePeople: [/*'延期审核',*/ '二级审核', '审核退回'], // 子公司审核角色
    //   dealPeople: ['处置', '退回', ...canApplyBtn],
    // },
    AwaitOrderEnd: {
      // 待办结
      admin: [].concat(againDeal),
      payPeople: [].concat(againDeal)
    },
    OrderEnd: {
      // 已封存
    },
    BackOut: {
      // 已撤销
    }
  };
  var list = [],
    _btnList = (btnList === null || btnList === void 0 ? void 0 : btnList[statusTag]) || null;
  if (_userRole !== null && _userRole !== void 0 && _userRole.length && _btnList) {
    _userRole.map(function (val) {
      if (_btnList !== null && _btnList !== void 0 && _btnList[val === null || val === void 0 ? void 0 : val.value]) {
        list.push.apply(list, _toConsumableArray(_btnList === null || _btnList === void 0 ? void 0 : _btnList[val === null || val === void 0 ? void 0 : val.value]));
      }
    });
  }
  var _list = _toConsumableArray(new Set(list));
  _list = getBtnByProcessKey(_list, record, pageType);
  return _list;
};

// 获取办理状态对应的标识
var getOrderStatusTag = function getOrderStatusTag(status) {
  var tag = '';
  // 3: 待信息中心派发,
  // 4: 待子公司转派,
  // 5: 待子公司部门处置,
  // 6: 待子公司审核,
  // 7: 待信息中心审核,
  // 8: 待办结,
  // 9: 已封存,
  // 10: 结束(撤销),
  // 11: 子流程退回,
  // 12: 子流程审核通过,
  var statusList = {
    3: 'Payout',
    // 待派发
    // 4: 'Dispose', // 待子公司处置
    8: 'AwaitOrderEnd',
    // 待办结
    9: 'OrderEnd',
    // 已封存
    10: 'BackOut' // 已撤销
  };
  if ([4, 5, 6, 7, 11, 12, 15].includes(status)) {
    // 处置中
    tag = 'Dispose';
  } else {
    tag = (statusList === null || statusList === void 0 ? void 0 : statusList[status]) || '';
  }
  return tag;
};

// 获取工单流程状态标识---用于展示对应表单
var getOrderProcessTag = function getOrderProcessTag(_ref2) {
  var btnName = _ref2.btnName,
    _ref2$record = _ref2.record,
    record = _ref2$record === void 0 ? {} : _ref2$record;
  // 新的客服工单对应流程参数
  var defaultList = {
    派发: 'Payout',
    // 信息中心派发
    撤回: 'Recall',
    // 子公司撤回
    // 信息中心撤回: 'InfoRecall', // 1、信息中心撤回
    处置: 'Dispose',
    // 1、子公司部门处置  2、子公司审核不通过后子公司部门处置
    // 子公司处置: 'UnitDispose', // 1、子公司直接处置  2、信息中心审核不通过后子公司处置
    // 公司部门处置: 'Dispose', // 1、子公司部门处置  2、子公司审核不通过后子公司部门处置
    转派: 'Redeploy',
    // 子公司转派
    退回: 'Back',
    // 子公司部门退回
    // 子公司退回: 'unitBack',  // 子公司退回
    撤销: 'BackOut',
    批示: 'Written',
    催办: 'PressToDo',
    延期申请: 'TimeOutApply',
    延期审核: 'TimeOutCheck',
    二级审核: 'OrderCheck',
    // 子公司审核
    一级审核: 'InfoOrderCheck',
    // 信息中心审核
    审核退回: 'OrderCheckBack',
    回访: 'PayReturn',
    再次办理: 'OrderTwoManage'
    // 重新派发: 'RePayout', // 派发
    // 重新转派: 'ReRedeploy', // 转派
  };
  var name = btnName ? defaultList === null || defaultList === void 0 ? void 0 : defaultList[btnName] : '';
  if (name === 'Recall' && (record === null || record === void 0 ? void 0 : record.processDefinitionKey) == 'customer_service_process' && (record === null || record === void 0 ? void 0 : record.status) == 4 && (record === null || record === void 0 ? void 0 : record.centerCanWithdraw) == true) {
    // 信息中心撤回
    name = 'InfoRecall';
    // processDefinitionKey==customer_service_process_czzlc&&status==5&&companyCanWithdraw==true   子公司撤回判断
  } else if (name === 'Dispose' && (record === null || record === void 0 ? void 0 : record.processDefinitionKey) === 'customer_service_process_czzlc') {
    // 子公司处置
    name = 'UnitDispose';
    if ((record === null || record === void 0 ? void 0 : record.status) === 15) {
      // 子公司反馈
      name = 'UnitFeedback';
    }
    // customer_service_process_bmczzlc   部门处置判断
  } else if (name === 'Back' && (record === null || record === void 0 ? void 0 : record.processDefinitionKey) == 'customer_service_process_czzlc' && (record === null || record === void 0 ? void 0 : record.status) == 4) {
    //  子公司退回
    name = 'unitBack';
    // processDefinitionKey==customer_service_process_bmczzlc&&status==5   部门退回
  }
  return name;
};

// 操作按钮对应的提示信息
var getOperateMessage = {
  撤销: '请确认是否撤销此工单？',
  催办: '是否向责任人发一条催办提醒？'
  // 撤回: '请确认是否撤回此工单？',
};

// 获取额外的角色权限操作按钮
var getLimitBtn = function getLimitBtn(_ref3) {
  var userRole = _ref3.userRole,
    _ref3$currentRole = _ref3.currentRole,
    currentRole = _ref3$currentRole === void 0 ? [] : _ref3$currentRole;
  var flags = [];
  var _userRole = handleUserRole(userRole); // 整理角色权限为需要的形式
  var roleLimit = _PublicService["default"].getDataByKey(_userRole, 'value');
  (roleLimit === null || roleLimit === void 0 ? void 0 : roleLimit.length) && roleLimit.map(function (item) {
    if (currentRole.includes(item)) {
      flags.push(true);
    } else {
      flags.push(false);
    }
  });
  return flags;
};

// 获取操作按钮展示
var getOperateBtn = function getOperateBtn(_ref4) {
  var userRole = _ref4.userRole,
    record = _ref4.record,
    onConfirm = _ref4.onConfirm,
    onModalShow = _ref4.onModalShow,
    pageType = _ref4.pageType,
    resetImport = _ref4.resetImport;
  //   const buttonList = [
  //     '催办',
  //     '处置',
  //     '延期申请',
  //     '延期审核',
  //     '撤回',
  //     '批示',
  //     '派发',
  //     '撤销',
  //     '审核',
  //     '回访',
  //     '二次办理',
  //   ];
  var newList = [];
  if (pageType === 'TimeOutCheck' && !(record !== null && record !== void 0 && record.hasAudit) && (record === null || record === void 0 ? void 0 : record.status) === 4 && (record === null || record === void 0 ? void 0 : record.caseSource) != '01') {
    // 延期审核---12345工单不可以延期
    newList = [{
      name: '延期审核',
      onClick: function onClick() {
        return onModalShow(record, 'TimeOutCheck');
      }
    }];
  } else if (pageType === 'Supervice') {
    // 督办工单
    if ((record === null || record === void 0 ? void 0 : record.status) === 4) {
      newList = [{
        name: '批示',
        onClick: function onClick() {
          return onModalShow(record, 'Written');
        }
      }];
    }
  } else if (!['TimeOutCheck'].includes(pageType)) {
    var statusTag = getOrderStatusTag(record === null || record === void 0 ? void 0 : record.status) || '';
    var buttonList = getWorkOrderBtn({
      statusTag: statusTag,
      userRole: userRole,
      record: record,
      pageType: pageType
    }) || [];
    if (buttonList && buttonList.length) {
      buttonList.map(function (item) {
        if (['撤销', '催办'].includes(item)) {
          var msg = getOperateMessage === null || getOperateMessage === void 0 ? void 0 : getOperateMessage[item];
          // 二次确认框操作
          newList.push({
            name: item,
            onClick: function onClick() {
              return onConfirm(record, getOrderProcessTag({
                btnName: item,
                record: record
              }), msg);
            }
          });
        } else if (['再次办理'].includes(item) && (record === null || record === void 0 ? void 0 : record.caseSource) === '01') {
          // 再次办理---12345类型的工单有导入功能
          newList.push({
            name: customUpload(item, resetImport, record)
          });
        } else {
          newList.push({
            name: item,
            onClick: function onClick() {
              return onModalShow(record, getOrderProcessTag({
                btnName: item,
                record: record
              }));
            }
          });
        }
      });
    }
  }
  return [{
    name: '详情',
    onClick: function onClick() {
      return onModalShow(record, 'Details');
    }
  }].concat(_toConsumableArray(newList));
};
var _default = exports["default"] = {
  getOperateBtn: getOperateBtn,
  // 表格操作按钮
  getOperateMsg: getOperateMessage,
  getOrderProcessTagMsg: getOrderProcessTag({}),
  handleAddBtn: function handleAddBtn() {
    var userRole = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
    // 判断新增按钮权限---督办人、处理人没有新增按钮权限
    var orderRole = ['dispatch_role',
    // 'supervisor_role',
    'superAdmin', 'report', 'shift_boss_role', 'SBR' // 上报角色
    // 'DBR',   //督办角色
    // 'function_dept_role', // 处置角色
    ];
    var _userRole = userRole.filter(function (val) {
      return orderRole.includes(val === null || val === void 0 ? void 0 : val.code);
    }) || [];
    var flag = _userRole !== null && _userRole !== void 0 && _userRole.length ? true : false;
    return flag;
  },
  // 延期审核tabs展示权限
  judgeTabShow: function judgeTabShow(_ref5) {
    var userRole = _ref5.userRole,
      _ref5$orderRole = _ref5.orderRole,
      orderRole = _ref5$orderRole === void 0 ? ['superAdmin', 'dispatch_role', 'supervisor_role'] : _ref5$orderRole;
    // 判断延期审核tab显示权限--超级管理员、管理员、派发人、审核人显示
    // const orderRole = [
    //   'superAdmin', // 超级管理员
    //   'dispatch_role', // 派发角色
    //   'supervisor_role', // 审核角色
    //   // 'report',
    //   // 'shift_boss_role',  // 办结角色
    //   // 'SBR',  // 上报角色
    //   // 'DBR',   //督办角色
    //   // 'function_dept_role', // 处置角色
    // ];
    var _userRole = userRole.filter(function (val) {
      return orderRole.includes(val === null || val === void 0 ? void 0 : val.code);
    }) || [];
    var flag = _userRole !== null && _userRole !== void 0 && _userRole.length ? true : false;
    return flag;
  },
  // 获取流程的上一步和下一步操作
  getProcessArgument: function getProcessArgument(_ref6, callBack) {
    var modalType = _ref6.modalType,
      _ref6$modalVal = _ref6.modalVal,
      modalVal = _ref6$modalVal === void 0 ? {} : _ref6$modalVal;
    _http["default"].get("".concat(_config2["default"].publicUrlZHXT, "/case/info/nextStepList"), {
      body: {
        processInstanceId: modalVal === null || modalVal === void 0 ? void 0 : modalVal.processInstanceId,
        id: modalVal === null || modalVal === void 0 ? void 0 : modalVal.id,
        processDefinitionKey: 'zhxt_case_main_process'
      }
    }).then(function (res) {
      var list = {},
        nextList = [];
      if (String(res === null || res === void 0 ? void 0 : res.result) === '0' && res !== null && res !== void 0 && res.data) {
        var _res$data;
        nextList = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.nextList) || [];
        var currentParams = (processParams === null || processParams === void 0 ? void 0 : processParams[modalType]) || {};
        list = nextList.find(function (val) {
          return (val === null || val === void 0 ? void 0 : val.name) === (currentParams === null || currentParams === void 0 ? void 0 : currentParams.status);
        }) || {};
      }
      callBack && callBack(list, nextList);
    });
  }
};
//# sourceMappingURL=OperationBtns.js.map
