import React__default, { Component } from 'react';
import { Progress, Tooltip, notification } from 'antd';
import IconFont from '../IconFont/index.js';
import ImageView from '../ImageView/index.js';
import { submidstr, formatTimeStamp, cache, uuid } from '@zenview/micro-utils';
import { _ as _extends } from '../_rollupPluginBabelHelpers-736b301a.js';
import AuthComponent from '../AuthComponent/index.js';
import moment from 'moment';
import '@zenview/micro-basic-library';

/**
 * @desc 基础卡片
 * @param {string} className 类名
 * @param {boolean} hoverScale img是否hover放大
 * @param {string} name 姓名
 * @param {string} score 相似度
 * @param {string} plateNo 车牌号码
 * @param {string} imgUrl 图片url
 * @param {string} deviceName 设备名称
 * @param {string} captureTime 抓拍时间
 * @param {string} relativeIcon 关联图标
 * @param {*} renderItem 自定义渲染函数
 * @param {*} CheckboxItem checkout
 * @param {function} onClick 点击回调函数
 */
class CaptureCard extends Component {
  render() {
    let {
      className = '',
      active = false,
      score,
      plateNo,
      deviceName,
      address,
      hoverScale = true,
      captureTime,
      imgUrl = '',
      relativeIcon = 'icon-L_AID_Body',
      checkboxItem = undefined,
      onClick,
      children,
      name,
      taskName = '',
      placeName = '-',
      showPlaceName = false,
      prevChildren,
      alarmButton
    } = this.props;
    if (score) {
      if (score >= 100) {
        score = 99;
      } else {
        score = score.toString().substring(0, 2);
      }
    }
    return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
      className: `alarm-capture-card-item ${className} ${active ? 'active' : ''}`,
      onClick: onClick
    }, /*#__PURE__*/React__default.createElement("div", {
      className: `item-img-box ${hoverScale && imgUrl ? 'img-hover-scale' : ''}`
    }, /*#__PURE__*/React__default.createElement(ImageView, {
      src: imgUrl
    }), relativeIcon && /*#__PURE__*/React__default.createElement(IconFont, {
      className: "relative-icon",
      type: relativeIcon
    }), checkboxItem), /*#__PURE__*/React__default.createElement("div", {
      className: "item-info"
    }, prevChildren, (score || score === 0) && /*#__PURE__*/React__default.createElement("div", {
      className: "item"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Photo_Like"
    }), /*#__PURE__*/React__default.createElement("span", {
      className: "process alarm-score-progress"
    }, "\u76F8\u4F3C\u5EA6", /*#__PURE__*/React__default.createElement(Progress, {
      percent: score,
      size: "small",
      status: "active",
      showInfo: false,
      strokeWidth: 2
    }), /*#__PURE__*/React__default.createElement("span", {
      style: {
        fontSize: '16px'
      },
      className: "highlight"
    }, score, "%"))), name && /*#__PURE__*/React__default.createElement("div", {
      className: "item plate-number"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_Avatar"
    }), name), plateNo && /*#__PURE__*/React__default.createElement("div", {
      className: "item plate-number"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Bar_Brand"
    }), plateNo), taskName && /*#__PURE__*/React__default.createElement("div", {
      className: "item device-name"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Bar_Layer"
    }), taskName), (deviceName || address) && /*#__PURE__*/React__default.createElement("div", {
      className: "item device-name",
      title: deviceName || address
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Bar_Add"
    }), deviceName && submidstr(deviceName) || address && submidstr(address)), captureTime && /*#__PURE__*/React__default.createElement("div", {
      className: "item capture-time"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_ClockEnd"
    }), formatTimeStamp(captureTime)), showPlaceName && placeName && /*#__PURE__*/React__default.createElement("div", {
      className: "item device-name",
      title: placeName
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-M_Bar_Place1"
    }), placeName && submidstr(placeName)), children)), alarmButton && typeof alarmButton === 'function' && alarmButton());
  }
}

/**
 * @desc 单一图片卡片
 * @param {boolean} active 是否选中
 * @param {boolean} hoverScale 图片hover是否需要放大
 * @param {string} imgUrl 图片地址
 * @param {string} relativeIcon 关联图标
 * @param {node} checkboxItem checkbox
 */
const ImageCard = props => {
  let {
    active = false,
    hoverScale = false,
    imgUrl = '',
    relativeIcon = '',
    checkboxItem = undefined,
    imageNum,
    hasImageNum
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: `lm-card-image-box ${active ? 'active' : ''} ${hoverScale && imgUrl ? 'img-hover-scale' : ''}`
  }, hasImageNum && /*#__PURE__*/React__default.createElement("span", {
    className: "image-box-number"
  }, imageNum), /*#__PURE__*/React__default.createElement(ImageView, {
    src: imgUrl
  }), relativeIcon && /*#__PURE__*/React__default.createElement(IconFont, {
    className: "relative-icon",
    type: relativeIcon
  }), checkboxItem);
};

/**
 * @desc 单列卡片
 * @param {boolean} active 是否选中
 * @param {function} click 回调
 * @param {node} children 卡片信息
 * @param {array} sourceData 卡片数据
 */
const BaseCard = props => {
  const {
    active,
    click,
    children,
    sourceData,
    className
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: `lm-base-card ${active ? "active" : ""} ${className}`,
    onClick: e => click && click(sourceData, e)
  }, /*#__PURE__*/React__default.createElement(ImageCard, props), children);
};

/**
 * @desc 单列卡片
 * @param {array} data 卡片数据 [{info,icon}]
 * @param {string} icon 图标
 * @param {string} info 信息
 * @param {node} children 子组件
 * @param {node} outChildren 加在卡片子级的子组件
 */
const SingleColumnCard = props => {
  const {
    data = [],
    children,
    outChildren
  } = props;
  return /*#__PURE__*/React__default.createElement(BaseCard, props, /*#__PURE__*/React__default.createElement("div", {
    className: "lm-base-card-info"
  }, data.map((item, i) => /*#__PURE__*/React__default.createElement("div", {
    className: "info",
    key: `info${i}`
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: item.icon
  }), /*#__PURE__*/React__default.createElement("span", {
    className: "ellipsis",
    title: item.info
  }, item.info))), children), outChildren);
};

/**
 * 布控告警卡片底部有效、无效按钮
 * @param {*} sourceData 数据
 * @param {*} handleChangeYN handle方法
 */
const AlarmCardFooter = props => {
  let {
    actionName,
    sourceData,
    handleChangeYN,
    defence
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "alarm-card-handle-footer"
  }, /*#__PURE__*/React__default.createElement(AuthComponent, {
    actionName: actionName
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "handle handle-yes",
    onClick: e => {
      e.stopPropagation();
      handleChangeYN && handleChangeYN(sourceData, 1, e);
    }
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: defence && defence === 1 ? "icon-S_Photo_ThumbInvalid" : "icon-S_Photo_ThumbEffective",
    theme: "outlined"
  }), defence && defence === 1 ? "已违规" : "有效")), /*#__PURE__*/React__default.createElement(AuthComponent, {
    actionName: actionName
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "handle handle-no",
    onClick: e => {
      e.stopPropagation();
      handleChangeYN && handleChangeYN(sourceData, 0, e);
    }
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: defence && defence === 1 ? "icon-S_Photo_ThumbEffective" : "icon-S_Photo_ThumbInvalid",
    theme: "outlined"
  }), defence && defence === 1 ? "未违规" : "无效")));
};

/**
 * 告警卡片的有效、无效水印
 * @param {*} sourceData 数据
 * @param {*} handleChangeYN handle方法
 */
const AlarmCardEffective = props => {
  let {
    isEffective
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: `alam-effect-rotate ${isEffective === 1 ? 'alarm-rotate-yes' : 'alarm-rotate-no'}`
  });
};

/**
 * icon-value-不换行
 * @param {*} props
 */
const IconValueCard = props => {
  let {
    icon,
    value,
    className
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: `lm-card-icon-value ${className || ''}`
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: icon,
    theme: "outlined"
  }), /*#__PURE__*/React__default.createElement("span", {
    className: "value",
    title: value
  }, value || '暂无'));
};
//车辆布防违规卡片底部
const AlarmCardVecjile = props => {
  let {
    isEffective
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: `alam-vechile-rotate ${isEffective === 1 ? 'alarm-rotate-yes' : 'alarm-rotate-no'}`
  });
};

/**
 * @desc 外来人员、专网布控、事件布防卡片
 * @param {array} data 卡片数据 [{info,icon,click,relateds:[{title,icon,click}]}]
 * @param {string} icon 图标
 * @param {string} info 信息
 * @param {function} handleChangeYN 有效无效事件
 * @param {boolean} isActual 是否显示有效、无效按钮和水印
 */
class AlarmOneImgCard extends React__default.Component {
  render() {
    const {
      sourceData = {},
      isActual = false,
      handleChangeYN,
      score,
      actionName,
      ...res
    } = this.props;
    let {
      isEffective,
      isHandle
    } = sourceData; //       alarmType,
    return /*#__PURE__*/React__default.createElement(SingleColumnCard, _extends({
      className: "lm-one-img-card",
      sourceData: sourceData,
      imgUrl: sourceData.faceUrl
    }, res, {
      outChildren: isActual && isHandle === 1 && /*#__PURE__*/React__default.createElement(AlarmCardEffective, {
        isEffective: isEffective
      }),
      children: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isActual ? isHandle === 0 ? /*#__PURE__*/React__default.createElement(AlarmCardFooter, {
        actionName: actionName,
        sourceData: sourceData,
        handleChangeYN: handleChangeYN
      }) : /*#__PURE__*/React__default.createElement("div", {
        className: "card-footer",
        style: {
          height: '0px'
        }
      }) : '')
    }));
  }
}

/**
 * @desc 重点人员告警卡片
 * @param {boolean} active 是否选中
 * @param {function} click 回调
 * @param {array} data 卡片转换数据
 * @param {array} sourceData 卡片源数据
 * @param {node} children 卡片信息
 * @param {function} handleChangeYN 有效无效事件
 * @param {boolean} isActual 是否显示有效、无效按钮和水印
 */
const AlarmTwoImgCard = props => {
  let {
    active = false,
    click,
    isActual = false,
    handleChangeYN,
    sourceData,
    actionName,
    className,
    children
  } = props;
  let {
    imageUrl,
    faceUrl,
    score,
    cameraName,
    objectMainJson = {},
    captureTime,
    libName,
    isEffective,
    isHandle,
    deviceName,
    address
  } = sourceData;
  let {
    name
  } = objectMainJson;
  let personName = objectMainJson && name ? name : '';
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
    className: `lm-two-img-card-alarm ${active ? 'active' : ''} ${className}`,
    onClick: () => click && click(sourceData)
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "lm-two-img-card-header"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "header-box"
  }, /*#__PURE__*/React__default.createElement(ImageCard, {
    imgUrl: imageUrl
  }), /*#__PURE__*/React__default.createElement("div", {
    className: "img-text"
  }, "\u5E03\u63A7\u7167\u7247")), /*#__PURE__*/React__default.createElement("div", {
    className: "header-box"
  }, /*#__PURE__*/React__default.createElement(ImageCard, {
    imgUrl: faceUrl
  }), /*#__PURE__*/React__default.createElement("div", {
    className: "img-text"
  }, "\u6293\u62CD\u7167\u7247")), /*#__PURE__*/React__default.createElement("div", {
    className: "similarity"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: 'icon-S_Photo_Like',
    theme: "outlined"
  }), /*#__PURE__*/React__default.createElement("span", {
    className: "number"
  }, score && Math.floor(score), "%"))), /*#__PURE__*/React__default.createElement("div", {
    className: "lm-two-img-card-info"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "content"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "item name"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: 'icon-S_Edit_Avatar',
    theme: "outlined"
  }), /*#__PURE__*/React__default.createElement("span", {
    className: "info",
    title: personName
  }, personName ? personName.length > 15 ? personName.substring(0, 15) + '...' : personName : '')), /*#__PURE__*/React__default.createElement("div", {
    className: "item process alarm-score-progress"
  }, /*#__PURE__*/React__default.createElement(IconValueCard, {
    value: libName,
    icon: 'icon-S_Bar_Layer'
  }))), /*#__PURE__*/React__default.createElement("div", {
    className: "content"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "item"
  }, /*#__PURE__*/React__default.createElement(IconValueCard, {
    title: deviceName || cameraName || address,
    value: deviceName || cameraName || address,
    icon: 'icon-S_Bar_Add'
  })), /*#__PURE__*/React__default.createElement("div", {
    className: "item"
  }, /*#__PURE__*/React__default.createElement(IconValueCard, {
    value: moment(parseInt(captureTime, 10)).format('YYYY.MM.DD HH:mm:ss'),
    icon: 'icon-S_Edit_ClockEnd'
  }))), isActual && isHandle === 0 ? /*#__PURE__*/React__default.createElement(AlarmCardFooter, {
    actionName: actionName,
    sourceData: sourceData,
    handleChangeYN: handleChangeYN
  }) : /*#__PURE__*/React__default.createElement("div", {
    className: "card-footer",
    style: {
      height: '0px'
    }
  })), isHandle === 1 && /*#__PURE__*/React__default.createElement(AlarmCardEffective, {
    isEffective: isEffective
  })), children && children());
};

class ForeignCard$1 extends React__default.Component {
  constructor(...args) {
    super(...args);
    this.handleJumPage = (data, e) => {
      this.props.handlePageJump && this.props.handlePageJump(data, e);
    };
    this.getActionNAme = alarmType => {
      switch (alarmType) {
        case 5:
          return 'vehicleHandle';
        case 6:
          return 'vehicleTempHandle';
        case 'vehicleTags':
          return 'vehicleTagsHandle';
        // 车辆标签布控
        default:
          return '';
      }
    };
  }
  render() {
    const {
      data = {},
      isActual,
      handleChangeYN,
      libType,
      className,
      height,
      defence = 0,
      children
    } = this.props;
    let {
      isEffective,
      picPath,
      captureTime,
      isHandle,
      plateNo,
      plateNum,
      deviceName,
      address,
      taskName
    } = data;
    return /*#__PURE__*/React__default.createElement(CaptureCard, {
      className: `vehicle-card ${className}`,
      style: {
        height: `${height}px!important`
      },
      onClick: e => this.handleJumPage(data, e),
      plateNo: plateNo || plateNum,
      address: defence === 1 ? address ? address : "暂无" : address,
      hoverScale: false,
      imgUrl: picPath,
      relativeIcon: '',
      captureTime: captureTime,
      deviceName: deviceName,
      taskName: taskName,
      alarmButton: children
    }, isActual && +isHandle === 0 ? /*#__PURE__*/React__default.createElement(AlarmCardFooter, {
      actionName: this.getActionNAme(libType),
      sourceData: data,
      handleChangeYN: handleChangeYN,
      defence: defence
    }) : /*#__PURE__*/React__default.createElement("div", {
      className: "card-footer",
      style: {
        height: '0px'
      }
    }), +isHandle === 1 && defence !== 1 && /*#__PURE__*/React__default.createElement(AlarmCardEffective, {
      isEffective: isEffective
    }), +isHandle === 1 && defence === 1 && /*#__PURE__*/React__default.createElement(AlarmCardVecjile, {
      isEffective: isEffective
    }));
  }
}

/**
 * @desc 大库碰撞任务完成通知卡片
 * @param {array} data 卡片数据 [{info,icon,label}]
 */

const LibCollisionNoticeCard = props => {
  const {
    height,
    data: {
      searchTime,
      taskName,
      similarity
    }
  } = props;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "lib-collision-notice-card",
    style: {
      height: height + 'px'
    }
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_View_librarycollision",
    className: "card-logo"
  }), /*#__PURE__*/React__default.createElement("div", {
    className: "card-content"
  }, /*#__PURE__*/React__default.createElement("p", {
    className: "txt"
  }, "\u5927\u5E93\u78B0\u649E\xA0\xA0\u5206\u6790\u5DF2\u5B8C\u6210"), /*#__PURE__*/React__default.createElement("p", {
    className: "txt"
  }, "\u8BF7\u8FDB\u5165", /*#__PURE__*/React__default.createElement("span", {
    className: "mark-txt"
  }, "\u5927\u5E93\u78B0\u649E-\u67E5\u8BE2\u8BB0\u5F55"), "\u4E2D\u67E5\u770B")), /*#__PURE__*/React__default.createElement("div", {
    className: "card-detail"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "detail-content"
  }, /*#__PURE__*/React__default.createElement("p", {
    class: "title"
  }, "\u67E5\u8BE2\u8BE6\u60C5\uFF1A"), /*#__PURE__*/React__default.createElement("p", {
    class: "txt"
  }, "\u67E5\u8BE2\u65F6\u95F4\uFF1A", /*#__PURE__*/React__default.createElement("span", {
    className: "info"
  }, formatTimeStamp(+searchTime))), /*#__PURE__*/React__default.createElement("p", {
    class: "txt"
  }, "\u6BD4\u5BF9\u5E93\u540D\u79F0\uFF1A", /*#__PURE__*/React__default.createElement("span", {
    className: "info",
    title: taskName
  }, taskName)), /*#__PURE__*/React__default.createElement("p", {
    class: "txt"
  }, "\u76F8\u4F3C\u5EA6: ", /*#__PURE__*/React__default.createElement("span", {
    className: "info"
  }, similarity, "%")))));
};

/**
 * @desc 隐匿车辆任务完成通知卡片
 * @param {array} data 卡片数据 [{info,icon,label}]
 */
const TaskOverNoticeCard = props => {
  const {
    height,
    data: {
      queryTime,
      crimeDate
    }
  } = props;
  console.log('TaskOverNoticeCard---------props', props);
  return /*#__PURE__*/React__default.createElement("div", {
    className: "notice-card",
    style: {
      height: height + 'px'
    }
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "card-logo"
  }), /*#__PURE__*/React__default.createElement("div", {
    className: "card-content"
  }, /*#__PURE__*/React__default.createElement("p", {
    className: "txt"
  }, "\u9690\u533F\u8F66\u8F86\xA0\xA0\u67E5\u8BE2\u5DF2\u5B8C\u6210"), /*#__PURE__*/React__default.createElement("p", {
    className: "txt"
  }, "\u8BF7\u8FDB\u5165", /*#__PURE__*/React__default.createElement("span", {
    className: "mark-txt"
  }, "\u9690\u533F\u8F66\u8F86-\u67E5\u8BE2\u8BB0\u5F55"), "\u4E2D\u67E5\u770B")), /*#__PURE__*/React__default.createElement("div", {
    className: "card-detail"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "detail-content"
  }, /*#__PURE__*/React__default.createElement("p", {
    class: "title"
  }, "\u67E5\u8BE2\u8BE6\u60C5\uFF1A"), /*#__PURE__*/React__default.createElement("p", {
    class: "txt"
  }, "\u67E5\u8BE2\u65F6\u95F4\uFF1A", formatTimeStamp(+queryTime)), /*#__PURE__*/React__default.createElement("p", {
    class: "txt"
  }, "\u6848\u53D1\u65F6\u95F4: ", crimeDate))));
};

const algorithmType = [{
  value: '101510',
  label: '非机动车乱停放',
  icon: 'icon-feijidongcheluantingfang'
}, {
  value: '101511',
  label: '沿街晾晒',
  icon: 'icon-yanjieliangshai'
}, {
  value: '101512',
  label: '沿街小贩',
  icon: 'icon-S_Control_Vendor'
}, {
  value: '101513',
  label: '撑伞经营',
  icon: 'icon-yanjiexiaofan'
}, {
  value: '101514',
  label: '占道经营	',
  icon: 'icon-zhandaojingying'
}, {
  value: '101515',
  label: '占道广告牌',
  icon: 'icon-zhandaoguanggaopai'
}, {
  value: '101516',
  label: '垃圾暴露',
  icon: 'icon-laji'
}, {
  value: '101517',
  label: '垃圾袋乱堆',
  icon: 'icon-lajidailuandui'
}, {
  value: '101518',
  label: '乱堆物料',
  icon: 'icon-luanduiwu'
}, {
  value: '101519',
  label: '垃圾桶满溢',
  icon: 'icon-lajitongmanyi'
}];
const runStatus = [{
  code: '10001',
  label: '待受理',
  bgColor: '#FFB319'
}, {
  code: '10002',
  label: '处理中',
  bgColor: '#29CCCC'
}, {
  code: '10003',
  label: '核查中',
  bgColor: '#198CFF'
}, {
  code: '10004',
  label: '已关闭',
  bgColor: '#A3ADC2'
}, {
  code: '10005',
  label: '已完成',
  bgColor: '#14CC8F'
}];
const feedbackStatus = [{
  code: '20001',
  label: '已驳回',
  img: '/micro-apps/micro-dep-librarys/images/alarm/reject.svg'
}, {
  code: '20002',
  label: '未通过',
  img: '/micro-apps/micro-dep-librarys/images/alarm/unpass.svg'
}];

const formatDurationTime = timetemp => {
  const hU = 1 * 60 * 60 * 1000;
  const mU = 1 * 60 * 1000;
  const sU = 1 * 1000;
  const h = Math.floor(timetemp / hU);
  const m = Math.floor((timetemp - h * hU) / mU);
  const s = Math.floor((timetemp - h * hU - m * mU) / sU);
  const hStr = `${h ? (h > 9 ? h : '0' + h) + '时' : ''}`;
  const mStr = `${m ? (m > 9 ? m : '0' + m) + '分' : hStr ? '00分' : ''}`;
  const sStr = `${s ? (s > 9 ? s : '0' + s) + '秒' : mStr ? '00秒' : ''}`;
  return hStr + mStr + sStr;
};
const EventCard = ({
  queryDetailHandle,
  detail,
  activeType
}) => {
  const alarmType = algorithmType.find(item => Number(item.value) === Number(detail.alarmType));
  const runStatueObj = runStatus.find(d => Number(d.code) === Number(detail.runStatus));
  const formatDuration = formatDurationTime(detail.duration);
  const rebackImage = feedbackStatus.find(v => v.code === detail.feedbackStatus);
  return /*#__PURE__*/React__default.createElement("div", {
    className: `list-card-popup ${detail.sceneType === 1 ? 'no-tag' : ''}`,
    onClick: () => {}
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "list-card-image"
  }, /*#__PURE__*/React__default.createElement(ImageView, {
    src: detail.alarmImageUrl
  }), /*#__PURE__*/React__default.createElement("span", {
    className: "list-task-status",
    style: {
      backgroundColor: runStatueObj.bgColor
    }
  }, runStatueObj.label)), /*#__PURE__*/React__default.createElement("div", {
    className: "list-card-detail"
  }, detail.sceneType !== 1 ? /*#__PURE__*/React__default.createElement("div", {
    className: "list-card-detail-tag"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: alarmType && alarmType.icon,
    style: {
      fontSize: '20px'
    }
  }), /*#__PURE__*/React__default.createElement("span", null, alarmType && alarmType.label)) : null, rebackImage && rebackImage.img && /*#__PURE__*/React__default.createElement(ImageView, {
    className: "list-task-status-img",
    src: rebackImage.img
  }), /*#__PURE__*/React__default.createElement("div", {
    className: "list-card-detail-name"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "device-name"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Bar_Add"
  }), /*#__PURE__*/React__default.createElement("span", null, detail.deviceName)), /*#__PURE__*/React__default.createElement("div", {
    className: "task-name"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Bar_Layer"
  }), /*#__PURE__*/React__default.createElement("span", null, detail.taskName))), /*#__PURE__*/React__default.createElement("div", {
    className: "list-card-detail-name"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "device-name"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Edit_ClockStart"
  }), /*#__PURE__*/React__default.createElement("span", null, typeof detail.alarmTime === 'string' ? detail.alarmTime : '')), /*#__PURE__*/React__default.createElement("div", {
    className: "task-name"
  }, /*#__PURE__*/React__default.createElement(IconFont, {
    type: "icon-S_Edit_ClockStart"
  }), /*#__PURE__*/React__default.createElement("span", null, formatDuration)))));
};

class ForeignCard extends React__default.Component {
  render() {
    const {
      data = {}
    } = this.props;
    return /*#__PURE__*/React__default.createElement(EventCard, {
      detail: data
    });
  }
}

class MultipointUnusualCard extends React__default.Component {
  constructor(props) {
    super(props);
    this.handlePageJump = data => {
      this.props.handlePageJump && this.props.handlePageJump(data);
    };
  }
  render() {
    const {
      data = {},
      height,
      className
    } = this.props;
    let {
      lastCaptureUrl,
      lastCaptureTime,
      appearPlaceCount,
      lastCaptureDeviceName,
      address,
      personBriefInfos = [],
      context
    } = data;
    let placeTag = '';
    try {
      placeTag = JSON.parse(context).personAbnormalActivity.placeTag;
    } catch (e) {
      placeTag = '';
    }
    const {
      personName = ''
    } = personBriefInfos && personBriefInfos.length > 0 ? personBriefInfos[0] : {};
    return /*#__PURE__*/React__default.createElement(CaptureCard, {
      className: `multipoint-unusual-card ${className}`,
      style: {
        height: `${height}px!important`
      },
      onClick: () => this.handlePageJump(data),
      address: address,
      hoverScale: false,
      imgUrl: lastCaptureUrl,
      captureTime: lastCaptureTime,
      deviceName: lastCaptureDeviceName,
      relativeIcon: false,
      prevChildren: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
        className: "prev-children-item"
      }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(IconFont, {
        type: "icon-S_Edit_Avatar"
      }), /*#__PURE__*/React__default.createElement("span", {
        style: {
          color: 'var(--primary)'
        }
      }, personName)), !className && /*#__PURE__*/React__default.createElement(Tooltip, {
        title: `异常出现在${+placeTag === 119101 ? '小区' : '医院'}数量`
      }, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(IconFont, {
        type: +placeTag === 119101 ? 'icon-S_Place_Community' : 'icon-L_Place_Hospital'
      }), /*#__PURE__*/React__default.createElement("span", {
        style: {
          color: 'var(--primary)'
        }
      }, appearPlaceCount)))), className && /*#__PURE__*/React__default.createElement("span", {
        className: 'item '
      }, /*#__PURE__*/React__default.createElement(IconFont, {
        type: "icon-S_Place_Community"
      }), /*#__PURE__*/React__default.createElement("span", {
        style: {
          color: 'var(--primary)'
        }
      }, appearPlaceCount)), /*#__PURE__*/React__default.createElement("div", {
        className: "multipoint-unusual-card-rencent-tip"
      }, "\u6700\u8FD1\u51FA\u73B0"))
    });
  }
}

class ObjectMapPersonnelCard extends React__default.Component {
  constructor(...args) {
    super(...args);
    this.handlePageJump = data => {
      this.props.handlePageJump && this.props.handlePageJump(data);
    };
  }
  render() {
    let {
      placeName,
      lastCaptureDeviceName,
      alarmDeviceName,
      alarmTime,
      name,
      lastCaptureUrl,
      lastCaptureTime,
      aid
    } = this.props.data;
    let {
      className = ''
    } = this.props;
    return /*#__PURE__*/React__default.createElement("div", {
      className: `${className} abnormal-person-card`,
      onClick: () => this.handlePageJump(this.props.data)
    }, /*#__PURE__*/React__default.createElement("div", {
      className: "map-personnerl-header"
    }, /*#__PURE__*/React__default.createElement("div", {
      className: "img-box"
    }, /*#__PURE__*/React__default.createElement(ImageView, {
      className: "image",
      src: lastCaptureUrl
    })), /*#__PURE__*/React__default.createElement("div", {
      className: "header-info"
    }, /*#__PURE__*/React__default.createElement("div", {
      className: "info-content"
    }, /*#__PURE__*/React__default.createElement("p", {
      className: "content-text name",
      title: name || aid
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_Avatar",
      theme: "outlined"
    }), /*#__PURE__*/React__default.createElement("span", {
      className: "value"
    }, name || aid))), /*#__PURE__*/React__default.createElement("div", {
      className: "info-content"
    }, /*#__PURE__*/React__default.createElement("div", {
      className: "title"
    }, "\u62A5\u8B66\u4FE1\u606F"), /*#__PURE__*/React__default.createElement("p", {
      className: "content-text"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Bar_Add",
      theme: "outlined"
    }), /*#__PURE__*/React__default.createElement("span", {
      className: "value",
      title: alarmDeviceName || "暂无"
    }, alarmDeviceName || "暂无")), /*#__PURE__*/React__default.createElement("p", {
      className: "content-text"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_ClockEnd",
      theme: "outlined"
    }), /*#__PURE__*/React__default.createElement("span", {
      className: "value"
    }, alarmTime ? formatTimeStamp(+alarmTime) : "暂无"))), /*#__PURE__*/React__default.createElement("div", {
      className: "info-content"
    }, /*#__PURE__*/React__default.createElement("div", {
      className: "title"
    }, "\u533A\u57DF\u5185\u6700\u540E\u51FA\u73B0"), /*#__PURE__*/React__default.createElement("p", {
      className: "content-text"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Bar_Add",
      theme: "outlined"
    }), /*#__PURE__*/React__default.createElement("span", {
      className: "value",
      title: lastCaptureDeviceName || "暂无"
    }, lastCaptureDeviceName || "暂无")), /*#__PURE__*/React__default.createElement("p", {
      className: "content-text"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_ClockEnd",
      theme: "outlined"
    }), /*#__PURE__*/React__default.createElement("span", {
      className: "value"
    }, lastCaptureTime ? formatTimeStamp(+lastCaptureTime) : "暂无"))), placeName && /*#__PURE__*/React__default.createElement("div", {
      className: "info-content"
    }, /*#__PURE__*/React__default.createElement("p", {
      className: "content-text"
    }, "\u5728", placeName, "\u533A\u57DF\u5F02\u5E38\u6D3B\u52A8")))));
  }
}

const BasePic = ({
  src,
  style
}) => /*#__PURE__*/React__default.createElement("span", {
  className: "base-pic",
  style: style
}, /*#__PURE__*/React__default.createElement(ImageView, {
  src: src
}));
/**
 * images 图片数组
 * maxLen 最多排列几张图 6/5/9
 */
const PicArray = ({
  images,
  maxLen = 6
}) => {
  if (images.length >= maxLen) ;
  return /*#__PURE__*/React__default.createElement("div", {
    className: "base_row"
  }, images.slice(0, maxLen + 1).map((src, index) => {
    return /*#__PURE__*/React__default.createElement(BasePic, {
      src: src,
      style: {
        transform: `translateX(-${index * 8}px)`
      }
    });
  }));
};

class SubscriptionCard extends Component {
  constructor(...args) {
    super(...args);
    this.handlePageJump = data => {
      this.props.handlePageJump && this.props.handlePageJump(data);
    };
  }
  render() {
    const {
      data,
      moduleName = 'outflowof',
      className = ''
    } = this.props;
    const {
      active = false,
      lastCaptureUrl,
      checkboxItem = undefined,
      children,
      date,
      total = 0,
      aids,
      taskName,
      aggregateNumber = 0,
      prevChildren,
      alarmTime,
      captureTime,
      placeName,
      lastCaptureUrls = []
    } = data; //       deviceName,

    let imgs = ['outflowof', 'inflowof'].includes(moduleName) ? aids.map(v => v.picUrl) : [lastCaptureUrl];
    if (moduleName === 'abnormalGroupsList') {
      imgs = lastCaptureUrls; // 异常群体
    }
    return /*#__PURE__*/React__default.createElement("div", {
      className: `subscription-card-item ${className} ${active ? 'active' : ''}`,
      onClick: () => this.handlePageJump(data)
    }, ['outflowof', 'inflowof'].includes(moduleName) && /*#__PURE__*/React__default.createElement("div", {
      className: "title"
    }, /*#__PURE__*/React__default.createElement("span", {
      className: "time"
    }, date), /*#__PURE__*/React__default.createElement("span", {
      className: "text"
    }, "\u7591\u4F3C\u4EBA\u5458", moduleName === 'outflowof' ? '流出' : '流入', "\u6570\u91CF\uFF1A", /*#__PURE__*/React__default.createElement("span", {
      className: "num"
    }, total))), /*#__PURE__*/React__default.createElement(PicArray, {
      images: imgs
    }), checkboxItem, moduleName === 'abnormalGroupsList' && /*#__PURE__*/React__default.createElement("div", {
      className: "item-info"
    }, prevChildren, /*#__PURE__*/React__default.createElement("div", {
      className: "item plate-number"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_Avatar"
    }), aggregateNumber), /*#__PURE__*/React__default.createElement("div", {
      className: "item device-name",
      title: taskName
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Bar_Add"
    }), taskName && getSubStr(taskName)), placeName && /*#__PURE__*/React__default.createElement("div", {
      className: "item device-name",
      title: placeName
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Bar_Add"
    }), placeName && getSubStr(placeName)), (alarmTime || captureTime) && /*#__PURE__*/React__default.createElement("div", {
      className: "item capture-time"
    }, /*#__PURE__*/React__default.createElement(IconFont, {
      type: "icon-S_Edit_ClockEnd"
    }), formatTimeStamp(alarmTime || captureTime)), children));
  }
}
function getSubStr(str, number = 4) {
  if (str.length > number * 2) {
    let arr1 = str.substr(0, number);
    let arr2 = str.substr(str.length - number, number);
    return `${arr1}...${arr2}`;
  } else {
    return str;
  }
}

// 车辆导入 人员导入 socket处理
class VehicleEntrySocket extends React__default.Component {
  constructor(props) {
    super(props);
    // componentDidMount() {
    //   SocketEmitter.subscribe('importVillage', this.importVillage);
    // }
    // componentWillUnmount() {
    //   SocketEmitter.unsubscribe('importVillage', this.importVillage);
    // }
    this.importVillage = (res = {}) => {
      const {
        message = {}
      } = res;
      let {
        totalCount = 0,
        wrongInfoCount = 0,
        noPicCount = 0,
        successCount = 0,
        otherCount = 0,
        failCount = 0,
        picWithoutFeatureCount = 0,
        type = 'PEOPLE',
        info = '',
        communityUnitErrors = []
      } = message;
      if (type === 'HOUSE') {
        try {
          let mess = JSON.parse(message.message);
          successCount = mess.successCount;
          failCount = mess.failCount;
          totalCount = mess.totalCount;
          info = mess.info;
        } catch (error) {}
      }
      let successNum = 0;
      let failNum = 0;
      let name = '';
      switch (type) {
        case 'PEOPLE':
          successNum = successCount + '人';
          failNum = failCount + '人';
          name = '人员';
          break;
        case 'HOUSE':
          successNum = successCount + '间';
          failNum = failCount + '间';
          name = '房屋';
          break;
        case 'VEHICLE':
          successNum = totalCount - wrongInfoCount + '车';
          failNum = wrongInfoCount + '车';
          name = '车辆';
          break;
        case 'community_unit':
          successNum = successCount + '单位';
          failNum = Array.isArray(communityUnitErrors) ? `${communityUnitErrors.length}单位` : '0单位';
          name = '单位管理';
          break;
      }
      const content = res.message && /*#__PURE__*/React__default.createElement("div", {
        className: "community-upload-modal"
      }, /*#__PURE__*/React__default.createElement("div", {
        className: "title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "value"
      }, "\u5BFC\u5165\u6210\u529F\uFF1A"), /*#__PURE__*/React__default.createElement("div", {
        className: "info"
      }, successNum)), /*#__PURE__*/React__default.createElement("div", {
        className: "title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "value"
      }, "\u5BFC\u5165\u5931\u8D25\uFF1A"), /*#__PURE__*/React__default.createElement("div", {
        className: "info"
      }, failNum)), type === 'PEOPLE' && /*#__PURE__*/React__default.createElement("div", {
        className: "title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "value"
      }, "\u5931\u8D25\u539F\u56E0\uFF1A"), /*#__PURE__*/React__default.createElement("div", {
        className: "value-box"
      }, /*#__PURE__*/React__default.createElement("p", {
        className: "box-title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "box-span"
      }, "\u7167\u7247\u65E0\u7279\u5F81\u503C "), " ", picWithoutFeatureCount || 0, "\u4EBA"), /*#__PURE__*/React__default.createElement("p", {
        className: "box-title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "box-span"
      }, "\u6682\u65E0\u7167\u7247 "), " ", noPicCount || 0, "\u4EBA"), /*#__PURE__*/React__default.createElement("p", {
        className: "box-title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "box-span"
      }, "\u4FE1\u606F\u586B\u5199\u9519\u8BEF "), " ", wrongInfoCount || 0, "\u4EBA"), /*#__PURE__*/React__default.createElement("p", {
        className: "box-title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "box-span"
      }, "\u5176\u4ED6 "), " ", otherCount || 0, "\u4EBA"))), type === 'community_unit' && /*#__PURE__*/React__default.createElement("div", {
        className: "title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "value"
      }, "\u5931\u8D25\u539F\u56E0\uFF1A"), /*#__PURE__*/React__default.createElement("div", {
        className: "value-box"
      }, communityUnitErrors.length && communityUnitErrors.map((item, i) => {
        return /*#__PURE__*/React__default.createElement("p", {
          className: "box-title",
          key: i
        }, /*#__PURE__*/React__default.createElement("span", {
          className: "box-span"
        }, `第${item.position}行因${item.msg}`));
      }))), type === 'HOUSE' && /*#__PURE__*/React__default.createElement("div", {
        className: "title"
      }, /*#__PURE__*/React__default.createElement("span", {
        className: "value"
      }, "\u5931\u8D25\u539F\u56E0\uFF1A"), /*#__PURE__*/React__default.createElement("div", {
        className: "value-box"
      }, info)), /*#__PURE__*/React__default.createElement("div", {
        style: {
          textAlign: 'right'
        }
      }, /*#__PURE__*/React__default.createElement("span", {
        style: {
          cursor: 'pointer'
        },
        className: "ok",
        onClick: () => this.goLibPage(res)
      }, "\u8FDB\u5165\u5C0F\u533A", name, "\u4FE1\u606F\u754C\u9762")));
      return content;
    };
    this.getTopModuleKey = moduleName => {
      const cacheKey = cache.getUserCache('menu_cache_key', 'session') || {};
      if (cacheKey[moduleName]) {
        return cacheKey[moduleName];
      } else {
        //   const key = BaseStore.tab.createTabKey();
        const key = uuid();
        cacheKey[moduleName] = key;
        cache.setUserCache('menu_cache_key', cacheKey, 'session');
        return key;
      }
    };
    // 跳转页面
    this.goLibPage = res => {
      // let { history } = this.props;
      const {
        message = {}
      } = res;
      const {
        type,
        villageId
      } = message;
      // const { BaseStore } = window;
      let villageTitle = '';
      let pageType = 'communityPersonManagement';
      switch (type) {
        case 'PEOPLE':
          pageType = 'villageManagement/communityPersonManagement';
          villageTitle = '人员';
          break;
        case 'HOUSE':
          pageType = 'villageManagement/communityHourseManagement';
          villageTitle = '房屋';
          break;
        case 'VEHICLE':
          pageType = 'villageManagement/communityVehicleManagement';
          villageTitle = '车辆';
          break;
        case 'community_unit':
          pageType = 'villageManagement/communityUnitManagement';
          villageTitle = '单位';
          break;
      }
      console.log('pageType, villageId, type, this.props.history', pageType, villageId, type, this.props.history);
      notification.destroy();
      // let tabs = BaseStore.tab.findTabsByModuleName(pageType);
      // let item = tabs.find((v) => +queryFormat(v.location.search).id === +villageId);
      // if (item) {
      //   BaseStore.tab.closeTabForStoreId(item.id);
      // }
      // const tabKey = BaseStore.tab.createTabKey();

      const newLocation = {
        //   pathname: `/communityManagement/${this.getTopModuleKey('communityManagement')}/${pageType}/${tabKey}`,
        pathname: `/${pageType}`,
        search: `?dbId=${villageId}&&key=${uuid()}`,
        state: {
          pageState: {
            tabTitle: `${villageTitle}信息`
          }
        }
      };
      this.props.history && this.props.history.push(newLocation);

      // browserHistory.push(`/${pageType}?id=${villageId}`);
      // history.push(newLocation);
    };
    this.state = {
      data: {}
    };
    console.log('是否有history', this.props);
  }
  render() {
    const {
      data
    } = this.props;
    return this.importVillage(data);
  }
}

const AlarmCard = {
  AlarmCapture: CaptureCard,
  BaseCard,
  ImageCard,
  OneImgCard: AlarmOneImgCard,
  SingleColumnCard,
  TwoImgCard: AlarmTwoImgCard,
  VehicleCard: ForeignCard$1,
  LibCollisionNoticeCard,
  TaskOverNoticeCard,
  EventHandCard: ForeignCard,
  MultipointUnusualCard,
  AbnormalPersonCard: ObjectMapPersonnelCard,
  SubscriptionCard,
  ImportVillageCard: VehicleEntrySocket
};

export { AlarmCard as default };
//# sourceMappingURL=index.js.map
