refactor(management): 重构企事业单位相关功能
- 移除 PoliceEnterprisesUnitPager 相关代码 - 为 EnterprisesUnit 添加创建人信息 - 优化 EnterprisesUnit 分页查询逻辑 - 更新相关控制器和服务实现 -调整枚举类型和注解
This commit is contained in:
parent
5d631ffbdb
commit
c684606410
|
@ -1,5 +1,6 @@
|
|||
package com.changhu.common.annotation;
|
||||
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
package com.changhu.common.annotation;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/6 上午11:13
|
||||
* @desc UserType...
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum UserType {
|
||||
MANAGEMENT_POLICE("公安后台用户"),
|
||||
MANAGEMENT_SECURITY("保安后台用户"),
|
||||
MANAGEMENT_SUPER("超级后台用户"),
|
||||
|
||||
MINI_PROGRAM_POLICE("小程序公安用户"),
|
||||
MINI_PROGRAM_PROJECT_MANAGE("小程序项目经理");
|
||||
|
||||
private final String remark;
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package com.changhu.common.db.enums;
|
||||
|
||||
import cn.hutool.core.lang.Dict;
|
||||
import com.baomidou.mybatisplus.annotation.IEnum;
|
||||
import com.changhu.common.annotation.IsExtData;
|
||||
import com.changhu.common.db.BaseEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
@ -17,28 +19,38 @@ import java.util.stream.Collectors;
|
|||
@AllArgsConstructor
|
||||
public enum EnterprisesUnitType implements BaseEnum<String>, IEnum<String> {
|
||||
|
||||
party_government("party_government", "党政机关"),
|
||||
medical("medical", "医疗机构"),
|
||||
residential("residential", "小区"),
|
||||
higher_learning("higher_learning", "高等院校"),
|
||||
primary_and_secondary("primary_and_secondary", "中小学幼儿园"),
|
||||
shopping_supermarkets("shopping_supermarkets", "商场超市"),
|
||||
financial("financial", "金融机构"),
|
||||
hydropower("hydropower", "水电油气"),
|
||||
key_projects("key_projects", "重点工程建设单位"),
|
||||
delivery_logistics("delivery_logistics", "寄递物流"),
|
||||
military("military", "军工、科研单位"),
|
||||
wen_bo("wen_bo", "文博单位"),
|
||||
important_news("important_news ", "重要新闻单位"),
|
||||
large_scale_material("large_scale_material ", "大型物资储备"),
|
||||
transportation("transportation", "交通运输企业"),
|
||||
industrial_park("industrial_park", "工业园区企业"),
|
||||
complex_public_security("complex_public_security", "治安复杂场所"),
|
||||
making_explosive_easily("making_explosive_easily ", "易制爆"),
|
||||
hazardous_materials("hazardous_materials ", "危化物品存放场所"),
|
||||
other("other", "其他单位");
|
||||
party_government("party_government", "党政机关", "party_government.png"),
|
||||
medical("medical", "医疗机构", "medical.png"),
|
||||
residential("residential", "小区", "residential.png"),
|
||||
higher_learning("higher_learning", "高等院校", "higher_learning.png"),
|
||||
primary_and_secondary("primary_and_secondary", "中小学幼儿园", "primary_and_secondary.png"),
|
||||
shopping_supermarkets("shopping_supermarkets", "商场超市", "shopping_supermarkets.png"),
|
||||
financial("financial", "金融机构", "financial.png"),
|
||||
hydropower("hydropower", "水电油气", "hydropower.png"),
|
||||
key_projects("key_projects", "重点工程建设单位", "key_projects.png"),
|
||||
delivery_logistics("delivery_logistics", "寄递物流", "delivery_logistics.png"),
|
||||
military("military", "军工、科研单位", "military.png"),
|
||||
wen_bo("wen_bo", "文博单位", "wen_bo.png"),
|
||||
important_news("important_news ", "重要新闻单位", "important_news.png"),
|
||||
large_scale_material("large_scale_material ", "大型物资储备", "large_scale_material.png"),
|
||||
transportation("transportation", "交通运输企业", "transportation.png"),
|
||||
industrial_park("industrial_park", "工业园区企业", "industrial_park.png"),
|
||||
complex_public_security("complex_public_security", "治安复杂场所", "complex_public_security.png"),
|
||||
making_explosive_easily("making_explosive_easily ", "易制爆", "making_explosive_easily.png"),
|
||||
hazardous_materials("hazardous_materials ", "危化物品存放场所", "hazardous_materials.png"),
|
||||
other("other", "其他单位", "other.png");
|
||||
|
||||
private final String value;
|
||||
private final String label;
|
||||
@IsExtData
|
||||
private final String icon;
|
||||
|
||||
@Override
|
||||
public Object serializer() {
|
||||
return Dict.of(
|
||||
"value", this.getValue(),
|
||||
"label", this.getLabel(),
|
||||
"extData", Dict.of("icon", "/resources/icon/gaode/marker/" + this.icon)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.changhu.common.db.enums;
|
||||
|
||||
import com.changhu.common.db.BaseEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/6 上午11:13
|
||||
* @desc UserType...
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum UserType implements BaseEnum<String> {
|
||||
MANAGEMENT_POLICE("management_police", "公安后台用户"),
|
||||
MANAGEMENT_SECURITY("management_security", "保安后台用户"),
|
||||
MANAGEMENT_SUPER("management_super", "超级后台用户"),
|
||||
|
||||
MINI_PROGRAM_POLICE("mini_program_police", "小程序公安用户"),
|
||||
MINI_PROGRAM_PROJECT_MANAGE("mini_program_project_manage", "小程序项目经理");
|
||||
|
||||
private final String value;
|
||||
private final String label;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.changhu.common.pojo.vo;
|
||||
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/11/12 下午3:27
|
||||
* @desc 通过视图去找出数据创建人
|
||||
*/
|
||||
@Data
|
||||
public class CreateOrUpdateUser {
|
||||
@Schema(description = "用户id")
|
||||
private Long snowFlakeId;
|
||||
@Schema(description = "用户名字")
|
||||
private String name;
|
||||
@Schema(description = "用户类型")
|
||||
private UserType type;
|
||||
}
|
|
@ -6,7 +6,7 @@ import cn.dev33.satoken.stp.StpUtil;
|
|||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.enums.handler;
|
|||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.enums.handler;
|
|||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.enums.handler;
|
|||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.TokenInfo;
|
||||
|
|
|
@ -8,7 +8,7 @@ import cn.hutool.core.lang.func.LambdaUtil;
|
|||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.db.enums.CheckStatus;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.db.enums.EnterprisesUnitType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.changhu.module.management.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
||||
|
@ -34,18 +36,21 @@ public class EnterprisesUnitController {
|
|||
|
||||
@Operation(summary = "分页查询")
|
||||
@PostMapping("/pager")
|
||||
public Page<EnterprisesUnitPagerVo> pager(@RequestBody @Valid PageParams<EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo> queryParams) {
|
||||
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
|
||||
public Page<EnterprisesUnitPagerVo> pager(@RequestBody PageParams<EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo> queryParams) {
|
||||
return enterprisesUnitService.pager(queryParams);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增或保存")
|
||||
@PostMapping("/saveOrUpdate")
|
||||
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
|
||||
public void saveOrUpdate(@RequestBody @Valid EnterprisesUnitSaveOrUpdateParams params) {
|
||||
enterprisesUnitService.saveOrUpdate(params);
|
||||
}
|
||||
|
||||
@Operation(summary = "根据id删除")
|
||||
@DeleteMapping("/deleteById")
|
||||
@CheckUserType(userTypes = {UserType.MANAGEMENT_POLICE, UserType.MANAGEMENT_SUPER})
|
||||
public void deleteById(@RequestParam @Schema(description = "企事业单位id") Long enterprisesUnitId) {
|
||||
boolean b = enterprisesUnitService.removeById(enterprisesUnitId);
|
||||
if (!b) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.module.management.pojo.params.IndexCheckPassParams;
|
||||
import com.changhu.module.management.pojo.params.IndexCheckStatusParams;
|
||||
import com.changhu.module.management.pojo.params.IndexDisableOrEnableParams;
|
||||
|
|
|
@ -3,12 +3,10 @@ package com.changhu.module.management.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.service.PoliceService;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
@ -50,9 +48,4 @@ public class PoliceController {
|
|||
policeService.userDeleteById(managementPoliceUnitUserId);
|
||||
}
|
||||
|
||||
@Operation(summary = "公安单位下的企事业单位分页")
|
||||
@PostMapping("/enterprisesUnitPager")
|
||||
public Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(@RequestBody PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
|
||||
return policeService.enterprisesUnitPager(queryParams);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.module.management.pojo.params.ManagementSecurityUnitUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementSecurityUnitUserPagerQueryParams;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.module.management.pojo.params.ServiceProjectSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ServiceProjectPagerQueryParams;
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.changhu.module.management.controller;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.module.management.pojo.params.ManagementSuperUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.SecurityUnitPagerQueryParams;
|
||||
|
|
|
@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
||||
import com.changhu.module.management.pojo.queryParams.EnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.EnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -26,15 +24,7 @@ public interface EnterprisesUnitMapper extends BaseMapper<EnterprisesUnit> {
|
|||
* @return 结果
|
||||
*/
|
||||
Page<EnterprisesUnitPagerVo> pager(@Param("page") Page<EnterprisesUnitPagerVo> page,
|
||||
@Param("unitId") Long unitId,
|
||||
@Param("params") EnterprisesUnitPagerQueryParams params);
|
||||
|
||||
/**
|
||||
* 公安单位下的企事业单位分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param params 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<PoliceEnterprisesUnitPagerVo> policeEnterprisesUnitPager(@Param("page") Page<PoliceEnterprisesUnitPagerVo> page,
|
||||
@Param("params") PoliceEnterprisesUnitPagerQueryParams params);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ public class EnterprisesUnitSaveOrUpdateParams {
|
|||
private Long snowFlakeId;
|
||||
|
||||
@Schema(description = "公安单位id")
|
||||
@NotNull(message = "公安单位不能为空")
|
||||
private Long policeUnitId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.changhu.module.management.pojo.queryParams;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +11,13 @@ import lombok.Data;
|
|||
@Data
|
||||
public class EnterprisesUnitPagerQueryParams {
|
||||
|
||||
@NotNull(message = "公安单位id不能为空")
|
||||
@Schema(description = "公安单位id")
|
||||
private Long policeUnitId;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
package com.changhu.module.management.pojo.queryParams;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 下午2:49
|
||||
* @desc PoliceEnterprisesUnitPagerQueryParams...
|
||||
*/
|
||||
@Data
|
||||
public class PoliceEnterprisesUnitPagerQueryParams {
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.changhu.module.management.pojo.vo;
|
||||
|
||||
import com.changhu.common.db.enums.EnterprisesUnitType;
|
||||
import com.changhu.common.pojo.vo.CreateOrUpdateUser;
|
||||
import com.changhu.module.management.pojo.model.ContactPersonInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
@ -47,7 +48,7 @@ public class EnterprisesUnitPagerVo {
|
|||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "坐标")
|
||||
@Schema(description = "位置")
|
||||
private Point point;
|
||||
|
||||
@Schema(description = "联系方式")
|
||||
|
@ -56,6 +57,8 @@ public class EnterprisesUnitPagerVo {
|
|||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建人")
|
||||
private CreateOrUpdateUser createUser;
|
||||
@Schema(description = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package com.changhu.module.management.pojo.vo;
|
||||
|
||||
import com.changhu.module.management.pojo.model.ContactPersonInfo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author 20252
|
||||
* @createTime 2024/9/5 下午2:46
|
||||
* @desc PoliceEnterprisesUnitPagerVo...
|
||||
*/
|
||||
@Data
|
||||
public class PoliceEnterprisesUnitPagerVo {
|
||||
@Schema(description = "id")
|
||||
private Long snowFlakeId;
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "省编码")
|
||||
private String province;
|
||||
@Schema(description = "省名称")
|
||||
private String provinceName;
|
||||
@Schema(description = "市编码")
|
||||
private String city;
|
||||
@Schema(description = "市名称")
|
||||
private String cityName;
|
||||
@Schema(description = "县编码")
|
||||
private String districts;
|
||||
@Schema(description = "县名称")
|
||||
private String districtsName;
|
||||
@Schema(description = "乡镇编码")
|
||||
private String street;
|
||||
@Schema(description = "乡镇名称")
|
||||
private String streetName;
|
||||
|
||||
@Schema(description = "详细地址")
|
||||
private String address;
|
||||
@Schema(description = "联系人")
|
||||
private ContactPersonInfo contactPersonInfo;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -3,9 +3,7 @@ package com.changhu.module.management.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
||||
/**
|
||||
|
@ -36,11 +34,4 @@ public interface PoliceService {
|
|||
*/
|
||||
void userDeleteById(Long managementPoliceUnitUserId);
|
||||
|
||||
/**
|
||||
* 公安单位下的企事业单位分页
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@ import cn.hutool.core.lang.Dict;
|
|||
import cn.hutool.core.lang.func.LambdaUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import com.changhu.module.management.mapper.EnterprisesUnitMapper;
|
||||
import com.changhu.module.management.pojo.entity.EnterprisesUnit;
|
||||
import com.changhu.module.management.pojo.params.EnterprisesUnitSaveOrUpdateParams;
|
||||
|
@ -29,12 +31,17 @@ public class EnterprisesUnitServiceImpl extends ServiceImpl<EnterprisesUnitMappe
|
|||
|
||||
@Override
|
||||
public Page<EnterprisesUnitPagerVo> pager(PageParams<EnterprisesUnitPagerQueryParams, EnterprisesUnitPagerVo> queryParams) {
|
||||
return baseMapper.pager(queryParams.getPage(), queryParams.getParams());
|
||||
return switch (UserUtil.getUserType()) {
|
||||
case MANAGEMENT_POLICE -> baseMapper.pager(queryParams.getPage(), UserUtil.getUnitId(), queryParams.getParams());
|
||||
case MANAGEMENT_SUPER -> baseMapper.pager(queryParams.getPage(), null, queryParams.getParams());
|
||||
default -> throw new MessageException();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrUpdate(EnterprisesUnitSaveOrUpdateParams params) {
|
||||
EnterprisesUnit enterprisesUnit = BeanUtil.copyProperties(params, EnterprisesUnit.class);
|
||||
//需要将行政区划编码转换为省市区
|
||||
Optional.ofNullable(params.getAdministrativeDivisionCodes())
|
||||
.ifPresent(codes -> {
|
||||
if (!codes.isEmpty()) {
|
||||
|
@ -50,6 +57,10 @@ public class EnterprisesUnitServiceImpl extends ServiceImpl<EnterprisesUnitMappe
|
|||
enterprisesUnit.setStreet(codes.get(3));
|
||||
}
|
||||
});
|
||||
//如果身份是公安的 是不会携带单位id的 从用户信息里取出来
|
||||
if (UserType.MANAGEMENT_POLICE.equals(UserUtil.getUserType())) {
|
||||
enterprisesUnit.setPoliceUnitId(UserUtil.getUnitId());
|
||||
}
|
||||
boolean b = this.saveOrUpdate(enterprisesUnit);
|
||||
if (!b) {
|
||||
throw new MessageException();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.changhu.module.management.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
|
|
|
@ -13,9 +13,7 @@ import com.changhu.module.management.mapper.ManagementPoliceUnitUserMapper;
|
|||
import com.changhu.module.management.pojo.entity.ManagementPoliceUnitUser;
|
||||
import com.changhu.module.management.pojo.params.ManagementPoliceUserSaveOrUpdateParams;
|
||||
import com.changhu.module.management.pojo.queryParams.ManagementPoliceUnitUserPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.queryParams.PoliceEnterprisesUnitPagerQueryParams;
|
||||
import com.changhu.module.management.pojo.vo.ManagementPoliceUnitUserPagerVo;
|
||||
import com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo;
|
||||
import com.changhu.module.management.service.PoliceService;
|
||||
import com.changhu.support.mybatisplus.pojo.entity.BaseEntity;
|
||||
import com.changhu.support.mybatisplus.pojo.params.PageParams;
|
||||
|
@ -93,8 +91,4 @@ public class PoliceServiceImpl implements PoliceService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PoliceEnterprisesUnitPagerVo> enterprisesUnitPager(PageParams<PoliceEnterprisesUnitPagerQueryParams, PoliceEnterprisesUnitPagerVo> queryParams) {
|
||||
return enterprisesUnitMapper.policeEnterprisesUnitPager(queryParams.getPage(), queryParams.getParams());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import cn.hutool.core.util.StrUtil;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.Db;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.db.enums.IsEnable;
|
||||
import com.changhu.common.db.enums.MiniProgramUserIdentity;
|
||||
import com.changhu.common.enums.ResultCode;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.changhu.module.miniProgram.controller;
|
|||
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.pojo.vo.SelectNodeVo;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexDataStatisticsVo;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
|
|
|
@ -2,14 +2,13 @@ package com.changhu.module.miniProgram.controller;
|
|||
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.JsonBody;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.module.miniProgram.pojo.params.SaveOrUpdateSecurityUserParams;
|
||||
import com.changhu.module.miniProgram.pojo.vo.IndexServiceProjectListVo;
|
||||
import com.changhu.module.miniProgram.service.ProjectManageIndexService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.changhu.support.interceptor;
|
|||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.changhu.common.annotation.CheckUserType;
|
||||
import com.changhu.common.annotation.UserType;
|
||||
import com.changhu.common.db.enums.UserType;
|
||||
import com.changhu.common.exception.MessageException;
|
||||
import com.changhu.common.utils.UserUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
|
|
@ -6,44 +6,33 @@
|
|||
column="contact_person_info"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
|
||||
property="contactPersonInfo"/>
|
||||
<result
|
||||
column="createUser"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
|
||||
property="createUser"/>
|
||||
</resultMap>
|
||||
<select id="pager" resultMap="EnterprisesUnitPagerVoResultMap">
|
||||
select eu.*,
|
||||
ad1.name as provinceName,
|
||||
ad2.name as cityName,
|
||||
ad3.name as districtsName,
|
||||
ad4.name as streetName
|
||||
ad1.name as provinceName,
|
||||
ad2.name as cityName,
|
||||
ad3.name as districtsName,
|
||||
ad4.name as streetName,
|
||||
json_object('snowFlakeId',spu.snow_flake_id,'name',spu.name,'type', spu.type) as 'createUser'
|
||||
from enterprises_unit eu
|
||||
left join administrative_division ad1 on eu.province = ad1.code and ad1.delete_flag = 0
|
||||
left join administrative_division ad2 on eu.city = ad2.code and ad2.delete_flag = 0
|
||||
left join administrative_division ad3 on eu.districts = ad3.code and ad3.delete_flag = 0
|
||||
left join administrative_division ad4 on eu.street = ad4.code and ad4.delete_flag = 0
|
||||
left join administrative_division ad1 on eu.province = ad1.code and ad1.delete_flag = 0
|
||||
left join administrative_division ad2 on eu.city = ad2.code and ad2.delete_flag = 0
|
||||
left join administrative_division ad3 on eu.districts = ad3.code and ad3.delete_flag = 0
|
||||
left join administrative_division ad4 on eu.street = ad4.code and ad4.delete_flag = 0
|
||||
left join super_police_users spu on eu.create_by = spu.snow_flake_id
|
||||
where eu.delete_flag = 0
|
||||
and eu.police_unit_id = #{params.policeUnitId}
|
||||
order by eu.create_time desc
|
||||
</select>
|
||||
|
||||
<resultMap id="PoliceEnterprisesUnitPagerVoResultMap"
|
||||
type="com.changhu.module.management.pojo.vo.PoliceEnterprisesUnitPagerVo">
|
||||
<result
|
||||
column="contact_person_info"
|
||||
typeHandler="com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler"
|
||||
property="contactPersonInfo"/>
|
||||
</resultMap>
|
||||
<select id="policeEnterprisesUnitPager"
|
||||
resultMap="PoliceEnterprisesUnitPagerVoResultMap">
|
||||
select eu.*,
|
||||
ad1.name as provinceName,
|
||||
ad2.name as cityName,
|
||||
ad3.name as districtsName,
|
||||
ad4.name as streetName
|
||||
from enterprises_unit eu
|
||||
left join administrative_division ad1 on eu.province = ad1.code and ad1.delete_flag = 0
|
||||
left join administrative_division ad2 on eu.city = ad2.code and ad2.delete_flag = 0
|
||||
left join administrative_division ad3 on eu.districts = ad3.code and ad3.delete_flag = 0
|
||||
left join administrative_division ad4 on eu.street = ad4.code and ad4.delete_flag = 0
|
||||
where eu.delete_flag = 0
|
||||
and eu.police_unit_id = ${@com.changhu.common.utils.UserUtil@getUnitId()}
|
||||
<choose>
|
||||
<when test="unitId != null">
|
||||
and eu.police_unit_id = #{unitId}
|
||||
</when>
|
||||
<otherwise>
|
||||
and eu.police_unit_id = #{params.policeUnitId}
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="params.name != null and params.name != ''">
|
||||
and eu.name like concat('%', #{params.name}, '%')
|
||||
</if>
|
||||
|
@ -55,4 +44,5 @@
|
|||
</if>
|
||||
order by eu.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -7,16 +7,13 @@
|
|||
<script setup lang="ts">
|
||||
import {onMounted, onUnmounted, shallowRef} from "vue";
|
||||
import {initMap} from "@/utils/aMapUtil";
|
||||
import {MapContainerProps, MapPlugins} from "@/types/components/map";
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
plugins?: string[],
|
||||
initCallback?: (map: AMap.Map) => void,
|
||||
mapOptions?: AMap.MapOptions
|
||||
}>(), {
|
||||
plugins: () => {
|
||||
const props = withDefaults(defineProps<MapContainerProps>(), {
|
||||
plugins: (): MapPlugins[] => {
|
||||
return []
|
||||
},
|
||||
mapOptions: () => {
|
||||
mapOptions: (): AMap.MapOptions => {
|
||||
return {
|
||||
// 是否为3D地图模式
|
||||
viewMode: "3D",
|
||||
|
|
|
@ -6,18 +6,12 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
|
||||
|
||||
import {IconFontProps} from "@/types/components/iconfont/IconFont";
|
||||
|
||||
withDefaults(defineProps<IconFontProps>(), {
|
||||
size: 25,
|
||||
type: "svg"
|
||||
});
|
||||
// import {onMounted} from "vue";
|
||||
// onMounted(() => {
|
||||
// console.log(props.fontClass, props.type);
|
||||
// });
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
:form-item-options="props.searchFormOptions"
|
||||
v-model:value="searchParams"
|
||||
v-bind="props.searchFormProps"
|
||||
:size="props.size"
|
||||
>
|
||||
<template v-slot:formOperation>
|
||||
<a-space class="margin-right flex-end">
|
||||
|
@ -67,6 +68,7 @@
|
|||
v-bind="props.paginationProps"
|
||||
@change="handleCurrentChange"
|
||||
@showSizeChange="handleSizeChange"
|
||||
:size="props.size"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -59,5 +59,6 @@ declare interface Grid {
|
|||
|
||||
interface BaseEnum<T> {
|
||||
value: T;
|
||||
label: string
|
||||
label: string,
|
||||
extData?: Record<string, any>
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* 高德支持的插件列表
|
||||
* @link https://lbs.amap.com/api/javascript-api-v2/guide/abc/plugins-list
|
||||
*/
|
||||
export type MapPlugins =
|
||||
'AMap.ElasticMarker'
|
||||
| 'AMap.ToolBar'
|
||||
| 'AMap.Scale'
|
||||
| 'AMap.HawkEye'
|
||||
| 'AMap.ControlBar'
|
||||
| 'AMap.MapType'
|
||||
| 'AMap.Geolocation'
|
||||
| 'AMap.AutoComplete'
|
||||
| 'AMap.PlaceSearch'
|
||||
| 'AMap.DistrictSearch'
|
||||
| 'AMap.LineSearch'
|
||||
| 'AMap.StationSearch'
|
||||
| 'AMap.Driving'
|
||||
| 'AMap.TruckDriving'
|
||||
| 'AMap.Transfer'
|
||||
| 'AMap.Walking'
|
||||
| 'AMap.Riding'
|
||||
| 'AMap.DragRoute'
|
||||
| 'AMap.Geocoder'
|
||||
| 'AMap.CitySearch'
|
||||
| 'AMap.IndoorMap'
|
||||
| 'AMap.MouseTool'
|
||||
| 'AMap.CircleEditor'
|
||||
| 'AMap.PolygonEditor'
|
||||
| 'AMap.PolylineEditor'
|
||||
| 'AMap.RectangleEditor'
|
||||
| 'AMap.EllipseEditor'
|
||||
| 'AMap.BezierCurveEditor'
|
||||
| 'AMap.MarkerCluster'
|
||||
| 'AMap.RangingTool'
|
||||
| 'AMap.CloudDataSearch'
|
||||
| 'AMap.Weather'
|
||||
| 'AMap.HeatMap'
|
||||
|
||||
export interface MapContainerProps {
|
||||
plugins?: MapPlugins[],
|
||||
initCallback?: (map: AMap.Map) => void,
|
||||
mapOptions?: AMap.MapOptions
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
export interface EnterprisesUnit {
|
||||
snowFlakeId?: string;
|
||||
/** policeUnitId **/
|
||||
policeUnitId?: string;
|
||||
/** name **/
|
||||
name?: string;
|
||||
/** type **/
|
||||
type?: BaseEnum<string>;
|
||||
/** province **/
|
||||
province?: string;
|
||||
/** city **/
|
||||
city?: string;
|
||||
/** districts **/
|
||||
districts?: string;
|
||||
/** street **/
|
||||
street?: string;
|
||||
/** address **/
|
||||
address?: string;
|
||||
/** point **/
|
||||
point?: [number, number];
|
||||
/** contactPersonInfo **/
|
||||
contactPersonInfo?: {
|
||||
name: string;
|
||||
telephone: string;
|
||||
};
|
||||
/** remark **/
|
||||
remark?: string;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
import AMapLoader from "@amap/amap-jsapi-loader";
|
||||
import {MapPlugins} from "@/types/components/map";
|
||||
|
||||
type Amap = typeof AMap;
|
||||
export const initMap = (plugins?: string[]): Promise<Amap> => new Promise((resolve, reject) => {
|
||||
export const initMap = (plugins?: MapPlugins[]): Promise<typeof AMap> => new Promise((resolve, reject) => {
|
||||
//@ts-ignore
|
||||
window._AMapSecurityConfig = {
|
||||
securityJsCode: __APP_ENV.VITE_APP_SECURITY_JS_CODE
|
||||
|
@ -10,8 +10,8 @@ export const initMap = (plugins?: string[]): Promise<Amap> => new Promise((resol
|
|||
key: __APP_ENV.VITE_APP_GAODE_KEY,
|
||||
version: __APP_ENV.VITE_APP_GAODE_VERSION,
|
||||
plugins
|
||||
}).then((AMap: Amap) => {
|
||||
resolve(AMap)
|
||||
}).then((aMap: typeof AMap) => {
|
||||
resolve(aMap)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<template>
|
||||
<div class="card">
|
||||
<div class="card-content">
|
||||
<h2 class="card-title">{{ name }}</h2>
|
||||
<p>单位类型: {{ type.label }}</p>
|
||||
<p>详细地址: {{ address }}</p>
|
||||
<p>联系人: {{ contactPersonInfo.name }}/{{ contactPersonInfo.telephone }}</p>
|
||||
<p class="card-text">备注: {{ remark }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {EnterprisesUnit} from "@/types/views/data/dataOverview.ts";
|
||||
|
||||
defineProps<EnterprisesUnit>()
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.card {
|
||||
width: 300px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
transition: 0.3s;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.card-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
margin-bottom: 10px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.card-text {
|
||||
font-size: 14px;
|
||||
color: #777;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.card-button {
|
||||
display: inline-block;
|
||||
padding: 8px 16px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background-color: #007BFF;
|
||||
border-radius: 5px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.card-button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
</style>
|
|
@ -1,9 +1,9 @@
|
|||
<template>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>地图页面标题</h1>
|
||||
<h1>警保联动数据总览</h1>
|
||||
</div>
|
||||
<MapContainer class="map-container" ref="mapRef" :map-options="mapOptions" :init-callback="initMap">
|
||||
<MapContainer class="map-container" ref="mapRef" :init-callback="initMap">
|
||||
<div class="left-panel panel">
|
||||
<h2>左侧统计面板</h2>
|
||||
<!-- 添加你的统计数据 -->
|
||||
|
@ -18,31 +18,52 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import MapContainer from "@/components/aMap/MapContainer.vue";
|
||||
import {ref} from "vue";
|
||||
import {createApp, h, ref} from "vue";
|
||||
import {ComponentExposed} from "vue-component-type-helpers";
|
||||
import api from "@/axios";
|
||||
import EnterprisesUnitInfoWindowContent from "@/views/data/components/EnterprisesUnitInfoWindowContent.vue";
|
||||
import {EnterprisesUnit} from "@/types/views/data/dataOverview.ts";
|
||||
|
||||
const mapRef = ref<ComponentExposed<typeof MapContainer>>(null)
|
||||
const mapOptions: AMap.MapOptions = {
|
||||
// 是否为3D地图模式
|
||||
viewMode: "3D",
|
||||
// 初始化地图级别
|
||||
zoom: 16,
|
||||
mapStyle: 'amap://styles/darkblue'
|
||||
}
|
||||
|
||||
let infoWindow: AMap.InfoWindow = null;
|
||||
|
||||
const initMap = async () => {
|
||||
const {data} = await api.get<any[]>('/enterprisesUnit/mapPoint')
|
||||
const {data} = await api.get<EnterprisesUnit[]>('/enterprisesUnit/mapPoint')
|
||||
mapRef.value?.mapInstance?.clearMap()
|
||||
const markers = data.map(item => {
|
||||
if (!item.point) {
|
||||
return null;
|
||||
}
|
||||
return new AMap.Marker({
|
||||
position: item.point
|
||||
const marker = new AMap.Marker({
|
||||
icon: new AMap.Icon({
|
||||
image: __APP_ENV.VITE_APP_MINIO_URL + item.type.extData.icon,
|
||||
size: new AMap.Size(66, 66),
|
||||
imageSize: new AMap.Size(66, 66),
|
||||
}),
|
||||
position: item.point,
|
||||
offset: new AMap.Pixel(-33, -66)
|
||||
})
|
||||
marker.on('click', () => {
|
||||
if (!infoWindow) {
|
||||
infoWindow = new AMap.InfoWindow({
|
||||
isCustom: true,
|
||||
offset: new AMap.Pixel(66, -66),
|
||||
closeWhenClickMap: true
|
||||
});
|
||||
}
|
||||
const element = document.createElement('div')
|
||||
//h 渲染组件 跟vue一样的用法
|
||||
const _InfoWindow = h(EnterprisesUnitInfoWindowContent, item)
|
||||
const app = createApp(_InfoWindow)
|
||||
app.mount(element)
|
||||
infoWindow.setContent(element)
|
||||
infoWindow.open(mapRef.value?.mapInstance, item.point)
|
||||
})
|
||||
return marker
|
||||
}).filter(Boolean)
|
||||
mapRef.value.mapInstance.add(markers)
|
||||
mapRef.value.mapInstance.setFitView()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -80,10 +101,12 @@ const initMap = async () => {
|
|||
}
|
||||
|
||||
.left-panel {
|
||||
width: 15%;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
.right-panel {
|
||||
width: 15%;
|
||||
right: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -10,12 +10,13 @@ import {ComponentExposed} from "vue-component-type-helpers";
|
|||
import MapContainer from "@/components/aMap/MapContainer.vue";
|
||||
import {FormProMaxItemOptions} from "@/types/components/form";
|
||||
import {dictSelectNodes} from "@/config/dict.ts";
|
||||
import {Button, message, Modal, Space} from "ant-design-vue";
|
||||
import {AutoComplete, Button, Input, message, Modal, Space} from "ant-design-vue";
|
||||
import api from "@/axios";
|
||||
import TableProMax from "@/components/table/TableProMax.vue";
|
||||
import {deleteDataModal} from "@/components/tsx/ModalPro.tsx";
|
||||
import {PageParams} from "@/types/hooks/useTableProMax.ts";
|
||||
import FormProMax from "@/components/form/FormProMax.vue";
|
||||
import {debounce} from "lodash-es";
|
||||
|
||||
type _TableProps = TableProMaxProps<EnterprisesUnitPagerVo, EnterprisesUnitPagerQueryParams>;
|
||||
type _FormType = EnterprisesUnitSaveOrUpdateParams & {
|
||||
|
@ -28,7 +29,6 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
|
|||
const _formParams = ref<_FormType>({...params})
|
||||
|
||||
let city = '';
|
||||
|
||||
const initMarker = (map: AMap.Map) => {
|
||||
//添加maker点 设置point
|
||||
const maker = new AMap.Marker({
|
||||
|
@ -42,12 +42,61 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
|
|||
map.add(maker)
|
||||
map.setFitView()
|
||||
}
|
||||
const autoAddress = ref<SelectNodeVo<string>[]>([])
|
||||
|
||||
const _formOptions = ref<FormProMaxItemOptions<_FormType>>({
|
||||
name: {
|
||||
type: 'input',
|
||||
type: 'custom',
|
||||
label: '单位名称',
|
||||
required: true,
|
||||
customRender: () => {
|
||||
return <AutoComplete
|
||||
v-model:value={_formParams.value.name}
|
||||
options={autoAddress.value}
|
||||
onSelect={(_, options: SelectNodeVo<string>) => {
|
||||
_formParams.value.point = options.extData?.location;
|
||||
_formParams.value.address = options.extData?.address;
|
||||
initMarker(_mapRef.value?.mapInstance)
|
||||
}}
|
||||
onSearch={debounce((val: string) => {
|
||||
//@ts-ignore
|
||||
const auto = new AMap.AutoComplete({
|
||||
city: city,
|
||||
input: "tipinput",
|
||||
citylimit: true
|
||||
});
|
||||
auto.search(val, (status, result) => {
|
||||
if (status === 'complete') {
|
||||
autoAddress.value = result.tips?.map(e => {
|
||||
return {
|
||||
value: e.name,
|
||||
label: e.name,
|
||||
extData: {
|
||||
district: e.district,
|
||||
address: e.address,
|
||||
location: e.location
|
||||
}
|
||||
} as SelectNodeVo<string>
|
||||
})
|
||||
} else {
|
||||
autoAddress.value = [];
|
||||
}
|
||||
})
|
||||
}, 300)}
|
||||
v-slots={{
|
||||
option: (item: SelectNodeVo<string>) => {
|
||||
return <div>
|
||||
<p>{item.label}</p>
|
||||
<p style={{color: '#9a9c9d'}}>{item.extData?.district} {item.extData?.address}</p>
|
||||
</div>
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Input
|
||||
placeholder="请输入单位名称"
|
||||
/>
|
||||
</AutoComplete>
|
||||
}
|
||||
},
|
||||
type: {
|
||||
type: 'select',
|
||||
|
@ -75,44 +124,23 @@ const saveOrUpdateEnterprisesUnit = (params: _FormType, callback: Function) => {
|
|||
label: '经纬度',
|
||||
customRender: () => <MapContainer
|
||||
ref={_mapRef}
|
||||
plugins={['AMap.AutoComplete']}
|
||||
style={{width: '100%', height: '300px', position: 'relative'}}
|
||||
initCallback={(map) => {
|
||||
const contextMenu = new AMap.ContextMenu();
|
||||
contextMenu.addItem('标记', () => {
|
||||
const {lng, lat} = contextMenu.getPosition()
|
||||
_formParams.value.point = [lng, lat]
|
||||
initMarker(map)
|
||||
}, 0)
|
||||
map.on('rightclick', ({lnglat}) => {
|
||||
contextMenu.open(map, lnglat)
|
||||
})
|
||||
if (_formParams.value.point) {
|
||||
initMarker(map)
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div style={{position: 'absolute', left: '10px', top: '10px', zIndex: 9999}}>
|
||||
<input id={'tipinput'}
|
||||
placeholder={'请输入详细地址'}
|
||||
autocomplete="off"
|
||||
onFocus={() => {
|
||||
if (!_mapRef.value?.mapInstance) {
|
||||
message.error('地图组件尚未初始化成功 请重新打开页面')
|
||||
return
|
||||
}
|
||||
//@ts-ignore
|
||||
_mapRef.value.mapInstance.plugin(['AMap.AutoComplete'], () => {
|
||||
//@ts-ignore
|
||||
const auto = new AMap.AutoComplete({
|
||||
city: city,
|
||||
input: "tipinput",
|
||||
citylimit: true
|
||||
});
|
||||
//注册监听,当选中某条记录时会触发
|
||||
auto.on("select", (e) => {
|
||||
//有些点位可能没有经纬度信息
|
||||
if (!e.poi.location) {
|
||||
message.error('所选点位没有经纬度信息 建议选则附近的手动移动!');
|
||||
return
|
||||
}
|
||||
_formParams.value.point = e.poi.location
|
||||
initMarker(_mapRef.value.mapInstance)
|
||||
});
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</MapContainer>
|
||||
},
|
||||
contactPersonInfoName: {
|
||||
|
@ -165,14 +193,17 @@ export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
|
|||
}, {
|
||||
dataIndex: 'contactPersonInfo',
|
||||
title: '联系人',
|
||||
ellipsis: true,
|
||||
customRender: ({text}) => text?.name + "/" + text.telephone
|
||||
}, {
|
||||
dataIndex: 'province',
|
||||
title: '行政区划',
|
||||
ellipsis: true,
|
||||
customRender: ({record}) => [record.provinceName, record.cityName, record.districtsName, record.streetName].filter(Boolean).join("/")
|
||||
}, {
|
||||
dataIndex: 'address',
|
||||
title: '详细地址'
|
||||
title: '详细地址',
|
||||
ellipsis: true
|
||||
}, {
|
||||
dataIndex: 'remark',
|
||||
title: '备注'
|
||||
|
@ -217,10 +248,25 @@ export const showEnterprisesUnit = (policeUnitPagerVo: PoliceUnitPagerVo) => {
|
|||
Modal.info({
|
||||
title: `【${policeUnitPagerVo.name}】 管辖企事业单位`,
|
||||
width: '80%',
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
content: () => <TableProMax
|
||||
ref={_tableRef}
|
||||
size="small"
|
||||
columns={_columns}
|
||||
requestApi={_reqApi}
|
||||
searchFormOptions={{
|
||||
name: {
|
||||
type: 'input',
|
||||
label: '单位名称'
|
||||
}, address: {
|
||||
type: 'input',
|
||||
label: '地址'
|
||||
}, remark: {
|
||||
type: 'input',
|
||||
label: '备注'
|
||||
}
|
||||
}}
|
||||
v-slots={{
|
||||
tableHeader: (_) => {
|
||||
return <Space>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
:columns="columns"
|
||||
:searchFormOptions="searchFormOptions"
|
||||
>
|
||||
|
||||
</TableProMax>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -78,6 +78,11 @@ export default defineConfig(({mode}) => {
|
|||
}
|
||||
}
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
api: 'modern-compiler'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue