tangzy
2022-03-23 5dbdb3b1a0f164c4d31d0bb8cb4713e2f13a65b3
活动底图
7 files modified
11 files added
731 ■■■■■ changed files
src/main/java/org/springblade/common/config/BladeConfiguration.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/architecture/mapper/ArchitectureMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hd/controller/HdController.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hd/mapper/HdMapper.java 4 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hd/mapper/HdMapper.xml 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hd/service/IHdService.java 4 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hd/service/impl/HdServiceImpl.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/controller/HdmapController.java 128 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/dto/HdmapDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/entity/Hdmap.java 64 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/mapper/HdmapMapper.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/mapper/HdmapMapper.xml 18 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/service/IHdmapService.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/service/impl/HdmapServiceImpl.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/hdmap/vo/HdmapVO.java 36 ●●●●● patch | view | raw | blame | history
src/main/java/sql/hdmap.menu.mysql 10 ●●●●● patch | view | raw | blame | history
ss/src/api/hdmap/hdmap.js 50 ●●●●● patch | view | raw | blame | history
ss/src/views/hdmap/hdmap.vue 236 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -75,6 +75,7 @@
        secureRegistry.excludePathPatterns("/blade-vr/vr/**");
        secureRegistry.excludePathPatterns("/blade-sp/sp/**");
        secureRegistry.excludePathPatterns("/blade-resource/oss/endpoint/**");
        secureRegistry.excludePathPatterns("/hdmap/hdmap/**");
        return secureRegistry;
    }
src/main/java/org/springblade/modules/architecture/mapper/ArchitectureMapper.xml
@@ -85,7 +85,7 @@
        SELECT jd, wd, mechanismName AS mechanismname, tpUrl AS tpurl, codeUrl AS codeurl, introduce, panoramaurl
        FROM sys_architecture
        WHERE is_deleted = 0
--         UNION
        --         UNION
--         SELECT jd, wd, mechanismName AS mechanismname, tpUrl AS tpurl, codeUrl AS codeurl, introduce, panoramaurl
--         FROM sys_mechanism
--         WHERE is_deleted = 0
src/main/java/org/springblade/modules/hd/controller/HdController.java
@@ -122,6 +122,15 @@
        return R.status(hdService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 查询所有活动的名称
     * @return
     */
    @PostMapping("/selectInList")
    public R selectInList() {
        return R.data(hdService.selectInList());
    }
}
src/main/java/org/springblade/modules/hd/mapper/HdMapper.java
@@ -20,10 +20,11 @@
import org.springblade.modules.hd.vo.HdVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 *  Mapper 接口
 * Mapper 接口
 *
 * @author BladeX
 * @since 2021-12-30
@@ -39,4 +40,5 @@
     */
    List<HdVO> selectHdPage(IPage page, HdVO hd);
    List selectInList();
}
src/main/java/org/springblade/modules/hd/mapper/HdMapper.xml
@@ -18,4 +18,8 @@
        select * from sys_hd where is_deleted = 0
    </select>
    <select id="selectInList" resultType="java.util.HashMap">
        select id,hdname from sys_hd
    </select>
</mapper>
src/main/java/org/springblade/modules/hd/service/IHdService.java
@@ -21,6 +21,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 *  服务类
 *
@@ -37,5 +39,5 @@
     * @return
     */
    IPage<HdVO> selectHdPage(IPage<HdVO> page, HdVO hd);
    List selectInList();
}
src/main/java/org/springblade/modules/hd/service/impl/HdServiceImpl.java
@@ -24,6 +24,8 @@
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 *  服务实现类
 *
@@ -38,4 +40,9 @@
        return page.setRecords(baseMapper.selectHdPage(page, hd));
    }
    @Override
    public List selectInList() {
        return baseMapper.selectInList();
    }
}
src/main/java/org/springblade/modules/hdmap/controller/HdmapController.java
New file
@@ -0,0 +1,128 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hdmap.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.hdmap.entity.Hdmap;
import org.springblade.modules.hdmap.vo.HdmapVO;
import org.springblade.modules.hdmap.service.IHdmapService;
import org.springblade.core.boot.ctrl.BladeController;
/**
 * 控制器
 * 活动底图
 *
 * @author BladeX
 * @since 2022-03-23
 */
@RestController
@AllArgsConstructor
@RequestMapping("hdmap/hdmap")
@Api(value = "", tags = "接口")
public class HdmapController extends BladeController {
    private final IHdmapService hdmapService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入hdmap")
    public R<Hdmap> detail(Hdmap hdmap) {
        Hdmap detail = hdmapService.getOne(Condition.getQueryWrapper(hdmap));
        return R.data(detail);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入hdmap")
    public R<IPage<Hdmap>> list(Hdmap hdmap, Query query) {
        IPage<Hdmap> pages = hdmapService.page(Condition.getPage(query), Condition.getQueryWrapper(hdmap));
        return R.data(pages);
    }
    /**
     * 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入hdmap")
    public R<IPage<HdmapVO>> page(HdmapVO hdmap, Query query) {
        IPage<HdmapVO> pages = hdmapService.selectHdmapPage(Condition.getPage(query), hdmap);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入hdmap")
    public R save(@Valid @RequestBody Hdmap hdmap) {
        return R.status(hdmapService.save(hdmap));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入hdmap")
    public R update(@Valid @RequestBody Hdmap hdmap) {
        return R.status(hdmapService.updateById(hdmap));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入hdmap")
    public R submit(@Valid @RequestBody Hdmap hdmap) {
        return R.status(hdmapService.saveOrUpdate(hdmap));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(hdmapService.removeByIds(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/hdmap/dto/HdmapDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hdmap.dto;
import org.springblade.modules.hdmap.entity.Hdmap;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 数据传输对象实体类
 *
 * @author BladeX
 * @since 2022-03-23
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class HdmapDTO extends Hdmap {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/hdmap/entity/Hdmap.java
New file
@@ -0,0 +1,64 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hdmap.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * 实体类
 *
 * @author BladeX
 * @since 2022-03-23
 */
@Data
@TableName("sys_hdmap")
@ApiModel(value = "Hdmap对象", description = "Hdmap对象")
public class Hdmap implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 活动id
     */
    @ApiModelProperty(value = "活动id")
    private String hdid;
    /**
     * 底图类型
     */
    @ApiModelProperty(value = "底图类型")
    @TableField("mapType")
    private String maptype;
    /**
     * 底图路径
     */
    @ApiModelProperty(value = "底图路径")
    @TableField("mapUrl")
    private String mapurl;
}
src/main/java/org/springblade/modules/hdmap/mapper/HdmapMapper.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hdmap.mapper;
import org.springblade.modules.hdmap.entity.Hdmap;
import org.springblade.modules.hdmap.vo.HdmapVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 *  Mapper 接口
 *
 * @author BladeX
 * @since 2022-03-23
 */
public interface HdmapMapper extends BaseMapper<Hdmap> {
    /**
     * 自定义分页
     *
     * @param page
     * @param hdmap
     * @return
     */
    List<HdmapVO> selectHdmapPage(IPage page, HdmapVO hdmap);
}
src/main/java/org/springblade/modules/hdmap/mapper/HdmapMapper.xml
New file
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.hdmap.mapper.HdmapMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="hdmapResultMap" type="org.springblade.modules.hdmap.entity.Hdmap">
        <id column="id" property="id"/>
        <result column="hdid" property="hdid"/>
        <result column="mapType" property="maptype"/>
        <result column="mapUrl" property="mapurl"/>
    </resultMap>
    <select id="selectHdmapPage" resultMap="hdmapResultMap">
        select * from sys_hdmap where is_deleted = 0
    </select>
</mapper>
src/main/java/org/springblade/modules/hdmap/service/IHdmapService.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hdmap.service;
import org.springblade.modules.hdmap.entity.Hdmap;
import org.springblade.modules.hdmap.vo.HdmapVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务类
 *
 * @author BladeX
 * @since 2022-03-23
 */
public interface IHdmapService extends IService<Hdmap> {
    /**
     * 自定义分页
     *
     * @param page
     * @param hdmap
     * @return
     */
    IPage<HdmapVO> selectHdmapPage(IPage<HdmapVO> page, HdmapVO hdmap);
}
src/main/java/org/springblade/modules/hdmap/service/impl/HdmapServiceImpl.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hdmap.service.impl;
import org.springblade.modules.hdmap.entity.Hdmap;
import org.springblade.modules.hdmap.vo.HdmapVO;
import org.springblade.modules.hdmap.mapper.HdmapMapper;
import org.springblade.modules.hdmap.service.IHdmapService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2022-03-23
 */
@Service
public class HdmapServiceImpl extends ServiceImpl<HdmapMapper, Hdmap> implements IHdmapService {
    @Override
    public IPage<HdmapVO> selectHdmapPage(IPage<HdmapVO> page, HdmapVO hdmap) {
        return page.setRecords(baseMapper.selectHdmapPage(page, hdmap));
    }
}
src/main/java/org/springblade/modules/hdmap/vo/HdmapVO.java
New file
@@ -0,0 +1,36 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.hdmap.vo;
import org.springblade.modules.hdmap.entity.Hdmap;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
/**
 * 视图实体类
 *
 * @author BladeX
 * @since 2022-03-23
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "HdmapVO对象", description = "HdmapVO对象")
public class HdmapVO extends Hdmap {
    private static final long serialVersionUID = 1L;
}
src/main/java/sql/hdmap.menu.mysql
New file
@@ -0,0 +1,10 @@
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1506463158749990919', 1123598815738675201, 'hdmap', '活动底图', 'menu', '/hdmap/hdmap', NULL, 1, 1, 0, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1506463158749990920', '1506463158749990919', 'hdmap_add', '新增', 'add', '/hdmap/hdmap/add', 'plus', 1, 2, 1, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1506463158749990921', '1506463158749990919', 'hdmap_edit', '修改', 'edit', '/hdmap/hdmap/edit', 'form', 2, 2, 2, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1506463158749990922', '1506463158749990919', 'hdmap_delete', '删除', 'delete', '/api/hdmap/hdmap/remove', 'delete', 3, 2, 3, 1, NULL, 0);
INSERT INTO `blade_menu`(`id`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
VALUES ('1506463158749990923', '1506463158749990919', 'hdmap_view', '查看', 'view', '/hdmap/hdmap/view', 'file-text', 4, 2, 2, 1, NULL, 0);
ss/src/api/hdmap/hdmap.js
New file
@@ -0,0 +1,50 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
  return request({
    url: '/api/hdmap/hdmap/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
export const getDetail = (id) => {
  return request({
    url: '/api/hdmap/hdmap/detail',
    method: 'get',
    params: {
      id
    }
  })
}
export const remove = (ids) => {
  return request({
    url: '/api/hdmap/hdmap/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}
export const add = (row) => {
  return request({
    url: '/api/hdmap/hdmap/submit',
    method: 'post',
    data: row
  })
}
export const update = (row) => {
  return request({
    url: '/api/hdmap/hdmap/submit',
    method: 'post',
    data: row
  })
}
ss/src/views/hdmap/hdmap.vue
New file
@@ -0,0 +1,236 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.hdmap_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/hdmap/hdmap";
  import {mapGetters} from "vuex";
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height:'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "",
              prop: "id",
              rules: [{
                required: true,
                message: "请输入",
                trigger: "blur"
              }]
            },
            {
              label: "活动id",
              prop: "hdid",
              rules: [{
                required: true,
                message: "请输入活动id",
                trigger: "blur"
              }]
            },
            {
              label: "底图类型",
              prop: "maptype",
              rules: [{
                required: true,
                message: "请输入底图类型",
                trigger: "blur"
              }]
            },
            {
              label: "底图路径",
              prop: "mapurl",
              rules: [{
                required: true,
                message: "请输入底图路径",
                trigger: "blur"
              }]
            },
          ]
        },
        data: []
      };
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.hdmap_add, false),
          viewBtn: this.vaildData(this.permission.hdmap_view, false),
          delBtn: this.vaildData(this.permission.hdmap_delete, false),
          editBtn: this.vaildData(this.permission.hdmap_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          window.console.log(error);
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          loading();
          console.log(error);
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
</script>
<style>
</style>