//定义驻勤点的信息窗体
export default function (data) {
  const { name, taskAddress, idCardNo, perNum, mobilePhone, taskName } = data;
  var content = [];
  content.push(
    "<div><div class='atten-content-text'><div class='text head'>" +
      taskName +
      "</div><div class='text'>负责人：" +
      name +
      "</div><div class='text'>手机号码：" +
      mobilePhone +
      "</div><div class='text'>证件号码：" +
      idCardNo +
      "</div><div class='text'>地址：" +
      taskAddress +
      "</div><div class='text'>保安员数量：" +
      perNum +
      "名</div></div>"
  );
  content.join("<br/>");
  var info = document.createElement("div");
  info.className = "content-window-card";
  //可以通过下面的方式修改自定义窗体的宽高
  info.style.width = "300px";
  // 定义内容
  var middle = document.createElement("div");
  middle.className = "info-middle";
  middle.innerHTML = content;
  info.appendChild(middle);
  //定义详情
  var detail = document.createElement("div");
  detail.className = "detail-div";
  info.appendChild(detail);
  //定义关闭按钮
  var detail = document.createElement("div");
  detail.className = "close-div";
  var a = document.createElement("a");
  a.innerHTML = "x";
  a.onclick = () => {
    this.clear('setSelectIndex')
    // this.state.map.clearInfoWindow();
  };
  detail.appendChild(a);
  info.appendChild(detail);
  //定义三个调度按钮
  var top = document.createElement("div");
  top.className = "info-button";
  var button1 = document.createElement("span");
  button1.className = "button";
  button1.innerHTML = "保安人员位置详情";
  button1.onclick = () => {
    this.props.dispatch({
      type: 'command/clearInfoWindow',
      payload: true
    })
    this.props.dispatch({
      type: "command/fetchAllAttendanceList",
      payload: [],
    });
    // this.state.map.clearInfoWindow();
    // this.setState({ selectedAttenData: data });
    this.props.dispatch({
      type: "command/setSelectedAttenData",
      payload: data,
    });
  };
  button1.style.borderRight = "unset";
  button1.style.background = "#50aaf7";
  button1.style.color = "#ffffff";
  top.appendChild(button1);
  info.appendChild(top);
  // 定义底部内容
  var bottom = document.createElement("div");
  bottom.className = "info-bottom";
  bottom.style.position = "relative";
  bottom.style.top = "-1px";
  bottom.style.margin = "0 auto";
  var sharp = document.createElement("img");
  sharp.src = "https://webapi.amap.com/images/sharp.png";
  bottom.appendChild(sharp);
  info.appendChild(bottom);
  return info;
}
