<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-row>
        <el-col :span="8">
          <el-form-item label="打卡地点" prop="kaAddress">
            <el-input
              v-model="queryParams.kaAddress"
              placeholder="请输入打卡地点名称"
              clearable
              style="width: 280px;"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="打卡次数" prop="kaNum">
            <el-select
              v-model="queryParams.kaNum"
              placeholder="打卡次数"
              clearable
              style="width: 280px;"

            >
              <el-option
                v-for="dict in cinume"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="打卡距离" prop="kaRadius">
            <el-input
              v-model="queryParams.kaRadius"
              placeholder="请输入打卡距离(半径,单位米)"
              clearable
              style="width: 280px;"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <!-- <el-col :span="8">
          <el-form-item label="打卡分类" prop="kaSort">
            <el-select
              v-model="queryParams.kaSort"
              placeholder="打卡分类"
              clearable
              style="width: 280px;"
            >
              <el-option
                v-for="dict in dict.type.sys_normal_disable"
                :key="dict.value"
                :label="dict.label"
                :value="dict.value"
              />
            </el-select>
          </el-form-item>
        </el-col> -->
        <el-col :span="8">
          <el-form-item label="上午上班" prop="kaTimeAmIn">
            <el-time-picker
                v-model="queryParams.kaTimeAmIn"
                value-format=" HH:mm:ss"
                format=" HH:mm:ss"
                @change = "jksed"
                 style="width: 280px;"
                placeholder="请选择上午上班">
              </el-time-picker>
            <!-- <el-date-picker clearable
              v-model="queryParams.kaTimeAmIn"
             type="datetime"
             value-format="yyyy-MM-dd HH:mm:ss"
             format="yyyy-MM-dd HH:mm:ss"
             style="width: 280px;"
              placeholder="请选择打卡时间 -上午上班">
            </el-date-picker> -->
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="上午下班" prop="kaTimeAmOut">
            <el-time-picker
                v-model="queryParams.kaTimeAmOut"
                value-format=" HH:mm:ss"
                format=" HH:mm:ss"
                 style="width: 280px;"
                placeholder="请选择上午下班">
              </el-time-picker>
            <!-- <el-date-picker clearable
              v-model="queryParams.kaTimeAmOut"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
              format="yyyy-MM-dd HH:mm:ss"
              style="width: 280px;"
              placeholder="请选择打卡时间 -上午下班">
            </el-date-picker> -->
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="下午上班" prop="kaTimePmIn">
            <el-time-picker
                v-model="queryParams.kaTimePmIn"
                value-format=" HH:mm:ss"
                format=" HH:mm:ss"
                 style="width: 280px;"
                placeholder="请选择下午上班">
              </el-time-picker>
            <!-- <el-date-picker clearable
              v-model="queryParams.kaTimePmIn"
             type="datetime"
             value-format="yyyy-MM-dd HH:mm:ss"
             format="yyyy-MM-dd HH:mm:ss"
             style="width: 280px;"
              placeholder="请选择打卡时间 -下午上班">
            </el-date-picker> -->
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="下午下班" prop="kaTimePmOut">
            <el-time-picker
                v-model="queryParams.kaTimePmOut"
                value-format=" HH:mm:ss"
                format=" HH:mm:ss"
                 style="width: 280px;"
                placeholder="请选择下午下班">
              </el-time-picker>
            <!-- <el-date-picker clearable
              v-model="queryParams.kaTimePmOut"
              type="datetime"
              value-format="yyyy-MM-dd HH:mm:ss"
              format="yyyy-MM-dd HH:mm:ss"
              style="width: 280px;"
              placeholder="请选择打卡时间 -下午下班">
            </el-date-picker> -->
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['kaoqin:config:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['kaoqin:config:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['kaoqin:config:remove']"
        >删除</el-button>
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['kaoqin:config:export']"
        >导出</el-button>
      </el-col> -->
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange" :max-height="tableMaxHeight">
      <el-table-column type="selection" width="55" align="center" />
     <!-- <el-table-column label="配置id" align="center" prop="kaoqinId" />
      <el-table-column label="部门id" align="center" prop="deptId" /> -->
      <el-table-column label="部门名称" align="center" prop="deptName" />
      <el-table-column label="打卡地点" align="center" prop="kaAddress" width="180"/>
      <!-- <el-table-column label="打卡地点经度" align="center" prop="kaLog" />
      <el-table-column label="打卡地点维度" align="center" prop="kaLat" /> -->
      <el-table-column label="打卡次数(一天)" align="center" prop="kaNum" width="180"/>
      <el-table-column label="打卡距离(半径米)" align="center" prop="kaRadius" width="180"/>
       <!-- 1:上午上班 2:上午下班 3:下午上班 4:下午下班 -->
      <!-- <el-table-column label="打卡分类" align="center" prop="kaSort" /> -->
      <el-table-column label="上午上班" align="center" prop="kaTimeAmIn" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.kaTimeAmIn }}</span>
        </template>
      </el-table-column>
      <el-table-column label="上午下班" align="center" prop="kaTimeAmOut" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.kaTimeAmOut }}</span>
        </template>
      </el-table-column>
      <el-table-column label="下午上班" align="center" prop="kaTimePmIn" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.kaTimePmIn}}</span>
        </template>
      </el-table-column>
      <el-table-column label="下午下班" align="center" prop="kaTimePmOut" width="180">
        <template slot-scope="scope">
          <span>{{ scope.row.kaTimePmOut }}</span>
        </template>
      </el-table-column>

      <!-- <el-table-column label="备注" align="center" prop="remark" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['kaoqin:config:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['kaoqin:config:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改考勤规则配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <!-- <el-form-item label="部门id" prop="deptId">
          <el-input v-model="form.deptId" placeholder="请输入部门id" />
        </el-form-item> -->
        <el-row>
          <el-col :span="24" >
            <el-form-item label="打卡地点" prop="kaAddress" class="oiue">
              <!-- @ready="handler" -->
              <baidu-map  :center="mapCenter" :zoom="zoom" @click ="getLocationPoint"  class="iuey" :scroll-wheel-zoom="true" :autoViewport="true">
                       <bm-view class="bm-view"></bm-view>
                         <bm-control :offset="{width: '10px', height: '10px'}">
                  <!-- <bm-auto-complete v-model="form.address" :sugStyle="{zIndex: 99}"> -->
                    <!-- <el-input placeholder="请输入地名关键字" v-model="form.address" @blur = "boiu" @focus= "faie"></el-input>  -->

                  <!-- <search-field placeholder="请输入地名关键字"></search-field>  -->
                  <!-- 这里指代一个自定义搜索框组件 -->
                  <!-- </bm-auto-complete> -->
                   <bm-marker v-if="nhe" :position="{lng:form.kaLog, lat: form.kaLat}"></bm-marker>
                   <el-autocomplete
                    v-model="form.kaAddress"
                    :fetch-suggestions="querySearch"
                    placeholder="请输入打卡地点"
                    @change="dessde"
                    style="width: 100%"
                    :trigger-on-focus="false"
                    @select="handleSelect"
                  />
                </bm-control>
                <!-- :pageCapacity = "20" nhesf-->
                <!-- <bm-local-search :keyword="form.address" :auto-viewport="true" class="pui" @searchcomplete = "oieueo" v-show="okuyt" @confirm= "confirmf" :location="location" ></bm-local-search>  :panel ="false"-->
                <bm-local-search  :keyword="form.kaAddress" :auto-viewport="true" :pageCapacity = "20" :location="location" :forceLocal="false"  @searchcomplete ="oieueo"  @markersset = "confirmf" :panel ="false" ></bm-local-search>
              </baidu-map>
            </el-form-item>

          </el-col>
          <el-col :span="24">
            <el-col :span="8">
            <el-form-item label="打卡次数" prop="kaNum">
              <el-select
                v-model="form.kaNum"
                placeholder="打卡次数"
                clearable
                @change="jues"
              >
                <el-option
                  v-for="dict in cinume"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="拍照打卡" prop="isPhoto">
                <el-select
                  v-model="form.isPhoto"
                  placeholder="拍照打卡"
                  clearable
                >
                  <el-option
                    v-for="dict in dict.type.sys_yes_no"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="打卡距离" prop="kaRadius">
                <el-input v-model="form.kaRadius" placeholder="请输入打卡距离(半径,单位米)" />
              </el-form-item>
            </el-col>
          </el-col>




          <!-- <el-col :span="8">
            <el-form-item label="打卡分类" prop="kaSort">
              <el-select
                v-model="form.kaSort"
                placeholder="打卡分类"
                clearable
              >
                <el-option
                  v-for="dict in dict.type.sys_normal_disable"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="8">
            <el-form-item label="上午上班" prop="kaTimeAmIn">
              <el-time-picker
                  v-model="form.kaTimeAmIn"
                  value-format="HH:mm:ss"
                  format="HH:mm:ss"
                  placeholder="请选择上午上班">
                </el-time-picker>
              <!-- <el-date-picker clearable
                v-model="form.kaTimeAmIn"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                format="yyyy-MM-dd HH:mm:ss"
                placeholder="请选择上午上班">
              </el-date-picker> -->
            </el-form-item>
          </el-col>
          <el-col :span="8" v-show="time">
            <el-form-item label="上午下班" :prop="time == true?'kaTimeAmOut' : ''" >
              <el-time-picker
                  v-model="form.kaTimeAmOut"
                  value-format="HH:mm:ss"
                  format="HH:mm:ss"
                  placeholder="请选择上午下班">
                </el-time-picker>
              <!-- <el-date-picker clearable
                v-model="form.kaTimeAmOut"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                format="yyyy-MM-dd HH:mm:ss"
                placeholder="请选择上午下班">
              </el-date-picker> -->
            </el-form-item>
          </el-col>
          <el-col :span="8" v-show="time">
            <el-form-item label="下午上班" :prop="time == true?'kaTimePmIn' : ''">
              <el-time-picker
                  v-model="form.kaTimePmIn"
                  value-format="HH:mm:ss"
                  format="HH:mm:ss"
                  placeholder="请选择下午上班">
                </el-time-picker>
              <!-- <el-date-picker clearable
                v-model="form.kaTimePmIn"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                format="yyyy-MM-dd HH:mm:ss"
                placeholder="请选择下午上班">
              </el-date-picker> -->
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="下午下班" prop="kaTimePmOut">
              <el-time-picker
                  v-model="form.kaTimePmOut"
                  value-format="HH:mm:ss"
                  format="HH:mm:ss"
                  placeholder="请选择下午下班">
                </el-time-picker>
              <!-- <el-date-picker clearable
                v-model="form.kaTimePmOut"
                type="datetime"
                value-format="yyyy-MM-dd HH:mm:ss"
                format="yyyy-MM-dd HH:mm:ss"
                placeholder="请选择下午下班">
              </el-date-picker> -->
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="njki">
            <el-form-item label="部门名称" prop="deptId">
              <treeselect v-model="form.deptId" @select="selectDepart" :options="deptOptions" :show-count="true" placeholder="请选择部门名称" />
              <!-- <el-input v-model="form.deptName" placeholder="请输入部门名称" /> -->
            </el-form-item>
          </el-col>
          <el-col :span=" 8">
            <el-form-item label="备注" prop="remark">
              <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
            </el-form-item>
          </el-col>
        </el-row>

        <!-- <el-form-item label="打卡地点经度" prop="kaLog">
          <el-input v-model="form.kaLog" placeholder="请输入打卡地点经度" />
        </el-form-item>
        <el-form-item label="打卡地点维度" prop="kaLat">
          <el-input v-model="form.kaLat" placeholder="请输入打卡地点维度" />
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>


  </div>
</template>

<script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig } from "@/api/kaoqin/config";
import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
import store from '@/store'
import { treeselect } from "@/api/system/dept";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
const defaultSettings = require("@/settings.js");
export default {
  name: "Config",
  dicts: ['sys_normal_disable','sys_yes_no'],
  components: { Treeselect },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      defaultSettings,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      mapCenter: {
        lng:116.587611,
        lat:30.636756
      },
      mapLocation: {
        address: undefined,
        coordinate: undefined
      },
      zoom:11,
      okuyt:true,
      nameadd:[],
      kdourg:[{'value':'抱歉，没有搜索到位置请重新输入'}],
      location:'',
       cb:undefined,
      // 考勤规则配置表格数据
      configList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      nhesf:0,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        deptId: null,
        kaAddress: null,
        kaLog: null,
        kaLat: null,
        kaNum: null,
        kaRadius: null,
        kaSort: null,
        kaTimeAmIn: null,
        kaTimeAmOut: null,
        kaTimePmIn: null,
        kaTimePmOut: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        isPhoto:[
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        kaAddress: [
          { required: true, message: "打卡地点名称不能为空", trigger: "blur" }
        ],
        deptId: [
          { required: true, message: "不能为空", trigger: "blur" }
        ],
        kaNum: [
          { required: true, message: "打卡次数(一天几次打卡)不能为空", trigger: "blur" }
        ],
        kaRadius: [
          { required: true, message: "打卡距离(半径)不能为空", trigger: "blur" }
        ],
        kaSort: [
          { required: true, message: "打卡分类 1:上午上班 2:上午下班 3:下午上班 4:下午下班不能为空", trigger: "blur" }
        ],
        kaTimeAmIn: [
          { required: true, message: "打卡时间 -上午上班不能为空", trigger: "blur" }
        ],
        kaTimeAmOut: [
          { required: true, message: "打卡时间 -上午下班不能为空", trigger: "blur" }
        ],
        kaTimePmIn: [
          { required: true, message: "打卡时间 -下午上班不能为空", trigger: "blur" }
        ],
        kaTimePmOut: [
          { required: true, message: "打卡时间 -下午下班不能为空", trigger: "blur" }
        ],
      },
      cinume:[{'value' : 2,'label':'一天两次'},{'value' : 4,'label':'一天四次'}],
      time:true,
      // 部门树选项
      deptOptions: undefined,
      opende:false,
      tableMaxHeight:'200',
      njki:false,
      nhe:false,
      center:{
        lng:'',
        lat:''
      },
      hfes:false,
      jde:[]
    };
  },
  created() {
    // this.queryParams.deptId = store.getters.deptid
    this.getList();
    this.getTreeselect()
    console.log(store)
    window.onresize = () => {
          this.changeTableMaxHeight()
        }
        this.changeTableMaxHeight()
  },
  methods: {

    /** 查询部门下拉树结构 */
    getTreeselect() {
      treeselect().then(response => {
        this.deptOptions = response.data;
      });
    },

    /** 查询考勤规则配置列表 */
    getList() {
      this.loading = true;
      listConfig(this.queryParams).then(response => {
        this.configList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        kaoqinId: null,
        deptId: null,
        kaAddress: null,
        kaLog: null,
        kaLat: null,
        kaNum: null,
        kaRadius: null,
        kaSort: null,
        kaTimeAmIn: null,
        kaTimeAmOut: null,
        kaTimePmIn: null,
        kaTimePmOut: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.kaoqinId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },

    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.nhe = false
      this.title = "添加考勤规则配置";
      this.njki = true
      this.nhesf = 20
      this.mapCenter.lng = 116.587611
      this.mapCenter.lat = 30.636756
      // this.handler()
      // this.form.deptId = store.getters.deptid
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      this.nhe = true
      const kaoqinId = row.kaoqinId || this.ids
      this.njki = false
      getConfig(kaoqinId).then(response => {
        this.form = response.data;
        // this.center.lng = this.form.lng
        // this.center.lat = this.form.lat
        this.nameadd = []
        this.hfes = true
        // this.mapCenter = this.form.kaAddress
        this.nhe = true
        // this.makerCenter(this.form.kaAddress)
        this.open = true;
        this.title = "修改考勤规则配置";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.kaoqinId != null) {
            updateConfig(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addConfig(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const kaoqinIds = row.kaoqinId || this.ids;
      this.$modal.confirm('是否确认删除考勤规则配置编号为"' + kaoqinIds + '"的数据项？').then(function() {
        return delConfig(kaoqinIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('kaoqin/config/export', {
        ...this.queryParams
      }, `config_${new Date().getTime()}.xlsx`)
    },
    // 、、地图
    getLocationPoint(e){
     console.log(e,76);
     this.center.lng = e.point.lng
     this.center.lat = e.point.lat
     this.form.kaLat = e.point.lat
     this.form.kaLog = e.point.lng
     // this.mapCenter.lng = this.form.lng
     // this.mapCenter.lat = this.form.lat
     this.nhe = true
     var point = new BMap.Point(e.point.lng, e.point.lat);
                       var gc = new BMap.Geocoder();
                       let _this = this;
                       gc.getLocation(point, function (rs) {
                           var addComp = rs.addressComponents;
                           console.log(rs.addressComponents,3);//地址信息
                           console.log(rs)
        })
    },
    searchcomplete(e){
      console.log(e);
    },
    querySearch(queryString,cb) {
      // console.log(e);
      // this.keyword = e
      // results, cb
      // var that = this
      // var myGeo = new this.BMap.Geocoder()
      // console.log(queryString, cb);

      // myGeo.getPoint(queryString, function(point) {
      //   console.log(point);
      //   // var point = '安庆市'

      //   if (point) {
      //     that.mapLocation.coordinate = point
      //     that.makerCenter(point)
      //   } else {
      //     that.mapLocation.coordinate = null
      //   }
      // }, this.locationCity)
      // console.log(this.locationCity);

      // var options = {
      //   onSearchComplete: function(results) {
      //     console.log(local.getStatus());

      //     if (local.getStatus() === 0) {
      //       // 判断状态是否正确
      //       var s = []
      //       console.log(results.getCurrentNumPois());

      //       for (var i = 0; i < results.getCurrentNumPois(); i++) {
      //         var x = results.getPoi(i)
      //         console.log(x);

      //         var item = { value: x.address + x.title, point: x.point }
      //         s.push(item)
      //         // console.log(s);

      //         cb(s)
      //       }
      //       // console.log(s);

      //     } else {
      //       cb()
      //     }
      //   }
      // // this.oieueo(results)
      console.log(queryString);
      if(this.hfes == true){
       this.center.lng = this.form.lng
       this.center.lat = this.form.lat
      }
      var item = []
      var x = ''
      //  this.nameadd = queryString.Ir
      // queryString.value = ''
       for(var i = 0 ; i <  this.nameadd.length; i++){
         console.log(queryString[i]);
        // var item = { value: this.nameadd[i].address + this.nameadd[i].title, point: this.nameadd[i].point }
        // if(queryString[i].address == undefined){
        //     queryString[i].address = ''
        // }
        //  x= this.nameadd[i].address + this.nameadd[i].title
        // item.push(x)
       this.nameadd[i].value = this.nameadd[i].address + this.nameadd[i].title
       console.log(this.nameadd[i].value);

      //  this.nameadd.push( item)
         }
        //  this.nameadd = item
         console.log(this.nameadd);
        //  this.cb = cb
        // if(this.njki == true){
           cb(this.nameadd)
           if(this.nameadd.length != 0){
             // console.log(local.getStatus());

           }else{
             cb(this.kdourg)
           }
        // }



      console.log(this.nameadd);

      // }
      // console.log(options );
    // var local = new this.BMap.LocalSearch('安庆市', options)

    // console.log(queryString );
      // local.search(queryString)
    },
    handleSelect(item) {
      var { point } = item
      this.mapLocation.coordinate = point
      this.form.kaLat = point.lat
      this.form.kaLog = point.lng
      console.log(this.form.kaLat,this.form.kaLog);
      // this.makerCenter(point)
    },
    // handler({ BMap, map }) {
    //   // console.log(2)
    //   // this.center.lng = this.form.lng
    //   // this.center.lat = this.form.lat
    //   this.map = map
    //   // console.log(this.map,map,999999);
    //   // console.log(this.map)

    //   // if (this.map) {
    //     // this.map.clearOverlays()
    //     // this.map.addOverlay(new this.BMap.Marker(point))
    //     this.mapCenter.lng = '30.636756'
    //     this.mapCenter.lat = '116.587611'
    //     // this.mapCenter = '安庆市'
    //     // this.mapZoom = 15
    //   // }
    // },
    oieueo(results,cb){
     //  console.log(results,cb);
    // console.log(results.Hr,3);
    console.log(this.form,87);
     // if(this.form.address == ''){
     //   this.nameadd = []
     // }else{
     //  this.nameadd = results.Ir
     // }
    // var allOverlay = this.map.getOverlays();
    // console.log(allOverlay,897)
    // this.map.removeOverlay(allOverlay[allOverlay.length-1]);

     if(this.njki == false){
       this.jde = []
       this.nhesf = 0
       this.nameadd = this.jde.push(results)
       this.center.lng = this.form.kaLog
       this.center.lat = this.form.kaLat
       this.mapCenter.lng = this.form.kaLog - 0
       this.mapCenter.lat = this.form.kaLat - 0
       console.log(this.mapCenter,897)
       this.querySearch(this.nameadd,this.cb)
       // this.mapCenter = this.form.kaAddress
       // return

       // this.querySearch(this.nameadd)
     }else{
       this.mapCenter.lng= 116.587611
       this.mapCenter.lat = 30.633773
       this.querySearch(this.nameadd,this.cb)
     }

      console.log(this.nameadd);

     //  var cb= cb

     // }


     //  results,cb

     //  this.nameadd.
     //  var local = new this.BMap.LocalSearch(this.map, options)
     //   local.search(queryString)

     },
     dessde(e){
       console.log(e,890)
       this.njki = true
       this.nhesf = 20
     },
     //选中数据
     confirmf(e){
       console.log(143);
       console.log(e.length,this.nameadd);

       if(this.njki == false){
         return
       }
       this.nameadd = e
       console.log(e.length,this.nameadd);
     },
     jues(e){
        console.log(e);
        if(e==4){
          this.time = true
        }else{
          this.time = false
          this.form.kaTimeAmOut = null
          this.form.kaTimePmIn = null
        }
     },
     jksed(){
       console.log(this.queryParams.kaTimeAmIn)
     },
     selectDepart(val){
       console.log(val)
       this.form.deptName =val.label
     },
     // 获取屏幕高度
     showFilterForm () {
           this.filterActive = !this.filterActive
           this.changeTableMaxHeight()
         },

         changeTableMaxHeight () {
           let height = document.body.offsetHeight // 网页可视区域高度
           // if (this.filterActive) {
           //   this.tableMaxHeight = height - 320
           // } else {
             this.tableMaxHeight = height - 250
           // }
           console.log(height)
         }
  }
};
</script>
<style rel="stylesheet/scss" lang="scss">
  .BMap_cpyCtrl {
     display: none;
   }
  .anchorBL {
     display: none;
}
.xioaq-from{
  text-align: right

}
.xioaq_formit{
  margin-bottom: 10px
}
.input-with-select{
  width: 50%;
  float: right;
  margin-bottom: 20px
}
.el-cascader{
  width: 100%;
}
.bm-view {
  width: 100%;
  height: 300px;
}
.oiue{
  height: 300px;
}
.pui{
  height: 100px;
  position: absolute;
  top: 40px;
  left: 0;
  z-index: 99;
  // overflow: hidden;
}
.anchorTL{
  width: 100%;
}
.app-container{
  // padding: 0 !important;
}
.BMap_mask{
  // background-color: #fff !important;
}
</style>
