import _default, * as esriLoader from 'esri-loader';

const options = {
  url: '/arcgisApi/4.7/init.js',
};
function dxsSttpFormat(sttp) {
  //地下水监测站类型
  return sttp == 'NATIONAL'
    ? '国家级监测站'
    : sttp == 'PROVAUTO'
      ? '省级自动监测站'
      : sttp == 'PROVHAND'
        ? '省级手动监测站'
        : sttp == 'PRO'
          ? '省级监测站'
          : '';
}
function gateTypeFormat(sttp) {
  //水闸类型
  return sttp == '1'
    ? '分(泄)洪闸'
    : sttp == '2'
      ? '节制闸'
      : sttp == '3'
        ? '排(退)水闸'
        : sttp == '4'
          ? '引(进)水闸'
          : sttp == '5'
            ? '挡潮闸'
            : sttp == '6'
              ? '船闸'
              : sttp == '9'
                ? '其它'
                : '';
}
function typeFormat172(sttp) {
  //172类型
  return sttp == '0'
    ? '重大农业节水工程'
    : sttp == '1'
      ? '重大引调水工程'
      : sttp == '2'
        ? '重点水源工程'
        : sttp == '3'
          ? '江河湖泊治理骨干工程'
          : sttp == '4'
            ? '新建大型灌区工程'
            : sttp == '5'
              ? '非水利部下达投资计划'
              : sttp == '6'
                ? '全部由地方投资'
                : sttp == '7'
                  ? '其他项目15项'
                  : '';
}
function qsFormat(val) {
  return val == '1' ? '自流' : val == '2' ? '抽提' : '';
}
function dbssydFormat(val) {
  return val == '1'
    ? '水库'
    : val == '2'
      ? '湖泊'
      : val == '3'
        ? '河流'
        : val == '9'
          ? '其他'
          : '';
}
function swzFormat(sttp) {
  return sttp == 'MM'
    ? '气象站'
    : sttp == 'PP'
      ? '雨量站'
      : sttp == 'BB'
        ? '蒸发站'
        : sttp == 'ZQ'
          ? '河道水文站'
          : sttp == 'DD'
            ? '堰闸水文站'
            : sttp == 'ZZ'
              ? '河道水位站'
              : sttp == 'TT'
                ? '潮位站'
                : sttp == 'RR'
                  ? '水库水文站'
                  : sttp == 'DP'
                    ? '泵站'
                    : sttp == 'ZG'
                      ? '地下水站'
                      : sttp == 'SS'
                        ? '墒情站'
                        : sttp == 'ZB'
                          ? '分洪水位站'
                          : '';
}
export function pointMoveHandler(_self, graphic, response) {
  if (graphic.layer == null) {
    return;
  }
  esriLoader
    .loadModules(
      [
        'esri/Graphic',
        'esri/layers/GraphicsLayer',
        'esri/geometry/Point',
        'esri/geometry/Polygon',
        'esri/geometry/Polyline',
        'esri/symbols/SimpleLineSymbol',
      ],
      options,
    )
    .then(
      ([
        Graphic,
        GraphicsLayer,
        Point,
        Polygon,
        Polyline,
        SimpleLineSymbol,
      ]) => {
        if (graphic.layer.id == 'personGraphicLayer') {
          //人员
          _self.viewObject.popup.open({
            title: graphic.attributes.persName,
            content:
              '<div>' +
              '<table>' +
              '<tr>' +
              '<td>人员姓名</td>' +
              '<td>' +
              graphic.attributes.persName +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>手机号码</td>' +
              '<td>' +
              graphic.attributes.mobilenumb +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>最近上线时间</td>' +
              '<td>' +
              graphic.attributes.operateTime +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'shgcGraphicLayer') {
          //水毁工程
          _self.viewObject.popup.open({
            title: graphic.attributes.nm,
            content:
              '<div>' +
              '<table>' +
              '<tr>' +
              '<td>工程类别</td>' +
              '<td>' +
              graphic.attributes.wtdstType +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>所在位置</td>' +
              '<td>' +
              graphic.attributes.locNm +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'country150Layer') {
          //150县
          _self.viewObject.popup.open({
            title: graphic.attributes.adName,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>所在地</td>' +
              '<td>' +
              graphic.attributes.adFullName +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'xzcGraphicLayer') {
          //人饮行政村
          _self.viewObject.popup.open({
            title: graphic.attributes.adNm,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>督查时间</td>' +
              '<td>' +
              graphic.attributes.visitDate.substring(0, 10) +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'ncysgcGraphicLayer') {
          //农村饮水工程
          _self.viewObject.popup.open({
            title: graphic.attributes.cwsName,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>所在地</td>' +
              '<td>' +
              graphic.attributes.cwsLoc +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'graphicLayer172') {
          //172
          _self.viewObject.popup.open({
            title: graphic.attributes.nm,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>项目类型</td>' +
              '<td>' +
              typeFormat172(graphic.attributes.ptype) +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>管理单位</td>' +
              '<td>' +
              graphic.attributes.unitNm +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'szGraphicLayer') {
          //水闸
          _self.viewObject.popup.open({
            title: graphic.attributes.gateName,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>水闸类型</td>' +
              '<td>' +
              gateTypeFormat(graphic.attributes.gateType) +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>所属河流</td>' +
              '<td>' +
              graphic.attributes.locRvName +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>归口管理部门</td>' +
              '<td>' +
              graphic.attributes.gateAdmDep +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'szGraphicLayerAll') {
          //全部水闸
          _self.viewObject.popup.open({
            title: graphic.attributes.gateName,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>水闸类型</td>' +
              '<td>' +
              gateTypeFormat(graphic.attributes.gateType) +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>所属河流</td>' +
              '<td>' +
              graphic.attributes.locRvName +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>归口管理部门</td>' +
              '<td>' +
              graphic.attributes.gateAdmDep +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              // "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>"+
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'dxsGraphicLayer') {
          //地下水
          _self.viewObject.popup.open({
            title: graphic.attributes.stnm,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>测站类型</td>' +
              '<td>' +
              dxsSttpFormat(graphic.attributes.sttp) +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>测站位置</td>' +
              '<td>' +
              graphic.attributes.stlc +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>管理单位</td>' +
              '<td>' +
              graphic.attributes.mnun +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'graphicLayerQsk') {
          //取水口
          _self.viewObject.popup.open({
            title: graphic.attributes.wintName,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>取水方式</td>' +
              '<td>' +
              qsFormat(graphic.attributes.wintType) +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>取水口位置</td>' +
              '<td>' +
              graphic.attributes.wintPos +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>管理单位</td>' +
              '<td>' +
              graphic.attributes.admName +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'graphicLayerDbssyd') {
          //地表水水源地
          _self.viewObject.popup.open({
            title: graphic.attributes.swhsName,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>取水水源类型</td>' +
              '<td>' +
              dbssydFormat(graphic.attributes.wainWasoType) +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>所在位置</td>' +
              '<td>' +
              graphic.attributes.swhsLoc +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>管理单位</td>' +
              '<td>' +
              graphic.attributes.insName +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'graphicLayerSwz') {
          //水文站
          _self.viewObject.popup.open({
            title: graphic.attributes.stnm,
            content:
              '<div>' +
              "<table style='width:100%;'>" +
              '<tr>' +
              '<td>测站类型</td>' +
              '<td>' +
              swzFormat(graphic.attributes.sttp) +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>测站位置</td>' +
              '<td>' +
              graphic.attributes.stlc +
              '</td>' +
              '</tr>' +
              '<tr>' +
              '<td>隶属单位</td>' +
              '<td>' +
              graphic.attributes.atcunit +
              '</td>' +
              '</tr>' +
              '</table>' +
              '</div>' +
              "<div style='margin-top:10px;'>" +
              "<p style='margin:0px;color: #1311129c;'>提示：点击图标查看详细信息</p>" +
              '</div>',
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'allSkGraphicLayer') {
          //所有水库
          var feature = graphic.attributes;
          var str =
            '<div id="edituser">水库编码:&nbsp;&nbsp;' +
            feature.rsCode +
            '<br>' +
            '督查状态:&nbsp;&nbsp;' +
            feature.status +
            '<br>' +
            '所在位置:&nbsp;&nbsp;' +
            graphic.attributes.location +
            '<div style="display: flex;flex-direction: row;">' +
            '<div style="width:70px;cursor:pointer;color: #001fff;padding-right: 10px;"><span @click="showSkBaseInfo(' +
            "'" +
            feature.rsCode +
            "'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '基础信息' +
            '</span></div><br>' +
            '</div></div>';
          _self.viewObject.popup.open({
            title: graphic.attributes.rsName,
            content: _self.initHtml(str),
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'skGraphicLayer2018') {
          //2018水库
          var feature = graphic.attributes;
          var str =
            '<div id="edituser">水库编码:&nbsp;&nbsp;' +
            feature.rsCode +
            '<br>' +
            '督查状态:&nbsp;&nbsp;' +
            feature.status +
            '<br>' +
            '所在位置:&nbsp;&nbsp;' +
            graphic.attributes.location +
            '<div style="display: flex;flex-direction: row;">' +
            '<div style="width:70px;cursor:pointer;color: #001fff;padding-right: 10px;"><span @click="showSkBaseInfo(' +
            "'" +
            feature.rsCode +
            "'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '基础信息' +
            '</span></div><br>' +
            '<div style="width:85px;cursor:pointer;color: #001fff;"><span @click="addSkToPlan(' +
            "'" +
            feature.rsCode +
            "'," +
            "'" +
            feature.rsName +
            "'," +
            "'" +
            feature.longitude +
            "'," +
            "'" +
            feature.latitude +
            "'," +
            "'skGraphicLayer2018'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '加入督查计划' +
            '</span></div>' +
            '</div></div>';
          _self.viewObject.popup.open({
            title: graphic.attributes.rsName,
            content: _self.initHtml(str),
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'skGraphicLayer2019') {
          //2019水库
          var feature = graphic.attributes;
          var str =
            '<div id="edituser">水库编码:&nbsp;&nbsp;' +
            feature.rsCode +
            '<br>' +
            '督查状态:&nbsp;&nbsp;' +
            feature.status +
            '<br>' +
            '所在位置:&nbsp;&nbsp;' +
            graphic.attributes.location +
            '<div style="display: flex;flex-direction: row;">' +
            '<div style="width:70px;cursor:pointer;color: #001fff;padding-right: 10px;"><span @click="showSkBaseInfo(' +
            "'" +
            feature.rsCode +
            "'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '基础信息' +
            '</span></div><br>' +
            '<div style="width:70px;cursor:pointer;color: #001fff;padding-right: 10px;"><span @click="showSkDcInfo(' +
            "'" +
            feature.rsCode +
            "'," +
            "'" +
            feature.rsName +
            "'," +
            "'" +
            feature.rgstrId +
            "'," +
            "'" +
            feature.objId +
            "'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '督查信息' +
            '</span></div><br>' +
            '</div></div>';
          _self.viewObject.popup.open({
            title: graphic.attributes.rsName,
            content: _self.initHtml(str),
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'fcskGraphicLayer') {
          //复查水库
          var feature = graphic.attributes;
          var str =
            '<div id="edituser">水库编码:&nbsp;&nbsp;' +
            feature.rsCode +
            '<br>' +
            '督查状态:&nbsp;&nbsp;' +
            feature.status +
            '<br>' +
            '所在位置:&nbsp;&nbsp;' +
            graphic.attributes.location +
            '<div style="display: flex;flex-direction: row;">' +
            '<div style="width:70px;cursor:pointer;color: #001fff;padding-right: 10px;"><span @click="showSkBaseInfo(' +
            "'" +
            feature.rsCode +
            "'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '基础信息' +
            '</span></div><br>' +
            '<div style="width:70px;cursor:pointer;color: #001fff;padding-right: 10px;"><span @click="showSkDcInfo(' +
            "'" +
            feature.rsCode +
            "'," +
            "'" +
            feature.rsName +
            "'," +
            "'" +
            feature.rgstrId +
            "'," +
            "'" +
            feature.objId +
            "'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '督查信息' +
            '</span></div><br>' +
            '</div></div>';
          _self.viewObject.popup.open({
            title: graphic.attributes.rsName,
            content: _self.initHtml(str),
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'jhwskGraphicLayer') {
          //计划外水库
          var feature = graphic.attributes;
          var str =
            '<div id="edituser">水库编码:&nbsp;&nbsp;' +
            feature.rsCode +
            '<br>' +
            '督查状态:&nbsp;&nbsp;' +
            feature.status +
            '<br>' +
            '所在位置:&nbsp;&nbsp;' +
            graphic.attributes.location +
            '<div style="display: flex;flex-direction: row;">' +
            '<div style="width:70px;cursor:pointer;color: #001fff;padding-right: 10px;"><span @click="showSkBaseInfo(' +
            "'" +
            feature.rsCode +
            "'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '基础信息' +
            '</span></div><br>' +
            '<div style="width:85px;cursor:pointer;color: #001fff;"><span @click="addSkToPlan(' +
            "'" +
            feature.rsCode +
            "'," +
            "'" +
            feature.rsName +
            "'," +
            "'" +
            feature.longitude +
            "'," +
            "'" +
            feature.latitude +
            "'," +
            "'jhwskGraphicLayer'" +
            ')" style="border-bottom: 1px solid blue;">' +
            '加入督查计划' +
            '</span></div>' +
            '</div></div>';
          _self.viewObject.popup.open({
            title: graphic.attributes.rsName,
            content: _self.initHtml(str),
            location: response.results[0].mapPoint,
          });
        } else if (graphic.layer.id == 'bjGraphicLayer') {
          //标记
          var feature = graphic.attributes;
          var str =
            '<div>' +
            '<div>' +
            "<div style='display: flex;padding: 5px;'>" +
            "<p style='font-size: 14px;padding: 5px;'>名称:</p>" +
            "<input type='text' id='nameId' style='height: 33px;width: 216px;' value=" +
            feature.inteName +
            '>' +
            '</div>' +
            "<div style='display: flex;padding: 5px;'>" +
            "<p style='font-size: 14px;padding: 5px;'>备注:</p>" +
            "<textarea id='noteId' rows='6' cols='28' style='width: 216px;'value=" +
            feature.des +
            '>' +
            feature.des +
            '</textarea>' +
            '</div>' +
            '</div>' +
            "<div style='margin-top:10px;float: right;'>" +
            "<button type='button' style='margin-right: 20px;width: 50px;' @click='cancelHandler()'>取消</button>" +
            '<button type="button" style="width: 50px;" @click="editHandler(' +
            "'" +
            feature.id +
            "'," +
            "'" +
            feature.inteName +
            "'," +
            "'" +
            feature.des +
            "'" +
            ')">保存</button>' +
            '</div>' +
            '</div>';
          _self.viewObject.popup.open({
            title: '',
            content: _self.initHtml(str),
            location: response.results[0].mapPoint,
          });
        }
      },
    );
}
