Commit 25984274 authored by daniel's avatar daniel

fix(location): 领物导航开发开发完成

parent a50d6e91
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationCategory;
import com.dlbridge.jadp.plugins.cmpt.dto.LocationCategoryQueryDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface LocationCategoryMapper {
int insert(LocationCategory category);
int update(LocationCategory category);
int delete(Integer id);
LocationCategory getById(Integer id);
List<LocationCategory> page(LocationCategoryQueryDTO queryDTO);
int count(LocationCategoryQueryDTO queryDTO);
}
\ No newline at end of file
<?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="com.dlbridge.jadp.plugins.cmpt.dao.mapper.LocationCategoryMapper">
<insert id="insert" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationCategory">
INSERT INTO location_category (cmpt_id, parent_id, name, icon, sort_order)
VALUES (#{cmptId}, #{parentId}, #{name}, #{icon}, #{sortOrder})
</insert>
<update id="update" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationCategory">
UPDATE location_category
<set>
<if test="cmptId != null">
cmpt_id = #{cmptId},
</if>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="name != null">
name = #{name},
</if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="sortOrder != null">
sort_order = #{sortOrder},
</if>
<if test="status != null">
status = #{status}
</if>
</set>
WHERE id = #{id}
</update>
<update id="delete" parameterType="java.lang.Integer">
UPDATE location_category SET del_flag = 1 WHERE id = #{id}
</update>
<select id="getById" parameterType="java.lang.Integer" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationCategory">
SELECT * FROM location_category WHERE id = #{id}
</select>
<select id="page" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.LocationCategoryQueryDTO" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationCategory">
SELECT * FROM location_category
<where>
<if test="cmptId != null">
AND cmpt_id = #{cmptId}
</if>
<if test="parentId != null">
AND parent_id = #{parentId}
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
<if test="status != null">
AND status = #{status}
</if>
AND del_flag = 0
</where>
order by sort_order
</select>
<select id="count" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.LocationCategoryQueryDTO" resultType="java.lang.Integer">
SELECT COUNT(*) FROM location_category
<where>
<if test="cmptId != null">
AND cmpt_id = #{cmptId}
</if>
<if test="parentId != null">
AND parent_id = #{parentId}
</if>
<if test="name != null and name != ''">
AND name LIKE CONCAT('%', #{name}, '%')
</if>
AND del_flag = 0
</where>
</select>
</mapper>
package com.dlbridge.jadp.plugins.cmpt.dao.mapper; package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint; import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPointBak;
import com.dlbridge.jadp.plugins.cmpt.dao.model.PointRecord;
import com.dlbridge.jadp.plugins.cmpt.dao.model.UserPoint;
import com.dlbridge.jadp.plugins.partner.bean.BagDelivery;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -14,15 +11,15 @@ import java.util.List; ...@@ -14,15 +11,15 @@ import java.util.List;
*/ */
public interface LocationMapper { public interface LocationMapper {
void addLocationCategory(LocationPoint locationPoint); void addLocationCategory(LocationPointBak locationPointBak);
void insertLocationPoint(LocationPoint locationPoint); void insertLocationPoint(LocationPointBak locationPointBak);
int delLocationPoint(@Param("id") Integer id); int delLocationPoint(@Param("id") Integer id);
int delLocationCategory(@Param("catId") Integer catId); int delLocationCategory(@Param("catId") Integer catId);
int updateLocationPoint(LocationPoint locationPoint); int updateLocationPoint(LocationPointBak locationPointBak);
List<LocationPoint> queryLocationList(@Param("cmptId") Integer cmptId, @Param("catId") Integer catId); List<LocationPointBak> queryLocationList(@Param("cmptId") Integer cmptId, @Param("catId") Integer catId);
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.LocationMapper"> <mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.LocationMapper">
<select id="addLocationCategory" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint"> <select id="addLocationCategory" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPointBak">
call AddLocationCategory(#{cmptId},#{catId},#{catName},#{icon},#{sortOrder}) call AddLocationCategory(#{cmptId},#{catId},#{catName},#{icon},#{sortOrder})
</select> </select>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
where id = #{id} where id = #{id}
</update> </update>
<select id="queryLocationList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint"> <select id="queryLocationList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPointBak">
SELECT SELECT
c.cmpt_id cmptId, c.cmpt_id cmptId,
c.id AS catId, c.id AS catId,
......
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint;
import com.dlbridge.jadp.plugins.cmpt.dto.LocationPointQueryDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface LocationPointMapper {
int insert(LocationPoint point);
int update(LocationPoint point);
int delete(Integer id);
LocationPoint getById(Integer id);
List<LocationPoint> page(LocationPointQueryDTO queryDTO);
int count(LocationPointQueryDTO queryDTO);
}
\ No newline at end of file
<?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="com.dlbridge.jadp.plugins.cmpt.dao.mapper.LocationPointMapper">
<insert id="insert" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint">
INSERT INTO location_point (name,icon, sort_order,description,latitude,altitude,longitude,category_id)
VALUES ( #{name}, #{icon}, #{sortOrder},#{description},#{latitude},#{altitude},#{longitude},#{categoryId})
</insert>
<update id="update" parameterType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint">
UPDATE location_point
<set>
<if test="name != null">
name = #{name},
</if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="sortOrder != null">
sort_order = #{sortOrder},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="latitude != null">
latitude = #{latitude},
</if>
<if test="altitude != null">
altitude = #{altitude},
</if>
<if test="longitude != null">
longitude = #{longitude}
</if>
</set>
WHERE id = #{id}
</update>
<delete id="delete" parameterType="java.lang.Integer">
DELETE FROM location_point WHERE id = #{id}
</delete>
<select id="getById" parameterType="java.lang.Integer" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint">
SELECT * FROM location_point WHERE id = #{id}
</select>
<select id="page" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.LocationPointQueryDTO" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint">
SELECT * FROM location_point
<where>
<if test="categoryId != null">
AND category_id = #{categoryId}
</if>
</where>
</select>
<select id="count" parameterType="com.dlbridge.jadp.plugins.cmpt.dto.LocationPointQueryDTO" resultType="java.lang.Integer">
SELECT COUNT(*) FROM location_point
<where>
<if test="categoryId != null">
AND category_id = #{categoryId}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.dao.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "定位分类", description = "定位分类")
public class LocationCategory implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "定位分类id", notes = "定位分类id")
private Integer id;
@ApiModelProperty(value = "赛事id", notes = "赛事id")
private Integer cmptId;
@ApiModelProperty(value = "父分类id", notes = "父分类id")
private Integer parentId;
@ApiModelProperty(value = "定位分类名称", notes = "定位分类名称")
private String name;
@ApiModelProperty(value = "定位分类图标", notes = "定位分类图标")
private String icon;
@ApiModelProperty(value = "排序", notes = "排序")
private Integer sortOrder;
@ApiModelProperty(value = "状态", notes = "状态")
private Integer status;
@ApiModelProperty(value = "是否删除", notes = "是否删除")
private Integer delFlag;
}
\ No newline at end of file
...@@ -3,43 +3,31 @@ package com.dlbridge.jadp.plugins.cmpt.dao.model; ...@@ -3,43 +3,31 @@ package com.dlbridge.jadp.plugins.cmpt.dao.model;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
@ApiModel(value = "领物导航实体类", description = "领物导航实体类") import java.io.Serializable;
@Data
public class LocationPoint {
@ApiModelProperty(value = "赛事ID", notes = "赛事ID")
private Integer cmptId;
@ApiModelProperty(value = "所属分类ID", notes = "所属分类ID")
private Integer catId;
@ApiModelProperty(value = "分类名", notes = "分类名")
private String catName;
@ApiModelProperty(value = "层级", notes = "层级")
private Integer level;
@ApiModelProperty(value = "图标URL", notes = "图标URL")
private String icon;
@ApiModelProperty(value = "点位ID", notes = "点位ID")
private Integer pointId;
@ApiModelProperty(value = "点位名", notes = "点位名")
private String pointName;
@Data
@ApiModel(value = "位置点", description = "位置点")
public class LocationPoint implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "位置点id", notes = "位置点id")
private Integer id;
@ApiModelProperty(value = "所属分类id", notes = "所属分类id")
private Integer categoryId;
@ApiModelProperty(value = "点位名称", notes = "点位名称")
private String name;
@ApiModelProperty(value = "经度", notes = "经度") @ApiModelProperty(value = "经度", notes = "经度")
private BigDecimal longitude; private java.math.BigDecimal longitude;
@ApiModelProperty(value = "纬度", notes = "纬度") @ApiModelProperty(value = "纬度", notes = "纬度")
private BigDecimal latitude; private java.math.BigDecimal latitude;
@ApiModelProperty(value = "点位描述", notes = "点位描述")
@ApiModelProperty(value = "描述", notes = "描述")
private String description; private String description;
@ApiModelProperty(value = "海拔", notes = "海拔")
private java.math.BigDecimal altitude;
@ApiModelProperty(value = "图标", notes = "图标")
private String icon;
@ApiModelProperty(value = "状态", notes = "状态")
private Integer status;
@ApiModelProperty(value = "排序", notes = "排序") @ApiModelProperty(value = "排序", notes = "排序")
private Integer sortOrder; private Integer sortOrder;
}
} \ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.dao.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@ApiModel(value = "领物导航实体类", description = "领物导航实体类")
@Data
public class LocationPointBak {
@ApiModelProperty(value = "赛事ID", notes = "赛事ID")
private Integer cmptId;
@ApiModelProperty(value = "所属分类ID", notes = "所属分类ID")
private Integer catId;
@ApiModelProperty(value = "分类名", notes = "分类名")
private String catName;
@ApiModelProperty(value = "层级", notes = "层级")
private Integer level;
@ApiModelProperty(value = "图标URL", notes = "图标URL")
private String icon;
@ApiModelProperty(value = "点位ID", notes = "点位ID")
private Integer pointId;
@ApiModelProperty(value = "点位名", notes = "点位名")
private String pointName;
@ApiModelProperty(value = "经度", notes = "经度")
private BigDecimal longitude;
@ApiModelProperty(value = "纬度", notes = "纬度")
private BigDecimal latitude;
@ApiModelProperty(value = "描述", notes = "描述")
private String description;
@ApiModelProperty(value = "排序", notes = "排序")
private Integer sortOrder;
}
package com.dlbridge.jadp.plugins.cmpt.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
@Data
@ApiModel(value = "定位分类查询参数", description = "定位分类查询参数")
public class LocationCategoryQueryDTO extends PageDTO {
@ApiModelProperty(value = "赛事id", notes = "赛事id")
private Integer cmptId;
@ApiModelProperty(value = "父分类id", notes = "父分类id")
private Integer parentId;
@ApiModelProperty(value = "定位分类名称", notes = "定位分类名称")
private String name;
@ApiModelProperty(value = "定位分类状态", notes = "定位分类状态")
private Integer status;
}
package com.dlbridge.jadp.plugins.cmpt.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = false)
@Data
@ApiModel(value = "位置点查询参数", description = "位置点查询参数")
public class LocationPointQueryDTO extends PageDTO {
@ApiModelProperty(value = "所属分类id", notes = "所属分类id")
private Integer categoryId;
}
\ No newline at end of file
...@@ -6,4 +6,6 @@ import lombok.Data; ...@@ -6,4 +6,6 @@ import lombok.Data;
public class PageDTO { public class PageDTO {
private Integer pageNum = 1; private Integer pageNum = 1;
private Integer pageSize = 10; private Integer pageSize = 10;
} }
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.LocationCategoryMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationCategory;
import com.dlbridge.jadp.plugins.cmpt.dto.LocationCategoryQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class LocationCategoryService {
@Resource
private LocationCategoryMapper locationCategoryMapper;
/**
* 创建定位分类
* @param category 定位分类
* @return 创建后的定位分类
*/
public LocationCategory create(LocationCategory category) {
locationCategoryMapper.insert(category);
return category;
}
/**
* 根据id查询定位分类
* @param id 定位分类id
* @return 定位分类
*/
public LocationCategory detail(Integer id) {
return locationCategoryMapper.getById(id);
}
/**
* 更新定位分类
* @param category 定位分类
* @return 更新后的定位分类
*/
public LocationCategory update(LocationCategory category) {
locationCategoryMapper.update(category);
return category;
}
/**
* 删除定位分类
* @param id 定位分类id
* @return 删除的结果
*/
public int delete(Integer id) {
return locationCategoryMapper.delete(id);
}
/**
* 分页查询定位分类
* @param queryDTO 查询参数
* @return 定位分类列表
*/
public Page<List<LocationCategory>> page(LocationCategoryQueryDTO queryDTO) {
int pageNum = queryDTO.getPageNum();
int pageSize = queryDTO.getPageSize();
// 计算正确的偏移量
int offset = (pageNum - 1) * pageSize;
queryDTO.setPageNum(offset);
List<LocationCategory> categoryList = locationCategoryMapper.page(queryDTO);
int total = locationCategoryMapper.count(queryDTO);
Page<List<LocationCategory>> page = new Page<>();
page.setTotal(total);
page.setFirst(pageNum == 1);
page.setLast(pageNum * pageSize >= total);
page.setCurrent(pageNum);
page.setSize(pageSize);
page.setContent(categoryList);
return page;
}
}
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.LocationPointMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint;
import com.dlbridge.jadp.plugins.cmpt.dto.LocationPointQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.utils.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class LocationPointService {
@Resource
private LocationPointMapper locationPointMapper;
/**
* 创建位置点
* @param point 位置点
* @return 创建后的位置点
*/
public LocationPoint create(LocationPoint point) {
locationPointMapper.insert(point);
return point;
}
/**
* 根据id查询位置点
* @param id 位置点id
* @return 位置点
*/
public LocationPoint detail(Integer id) {
return locationPointMapper.getById(id);
}
/**
* 更新位置点
* @param point 位置点
* @return 更新后的位置点
*/
public LocationPoint update(LocationPoint point) {
locationPointMapper.update(point);
return point;
}
/**
* 删除位置点
* @param id 位置点id
* @return 删除的结果
*/
public int delete(Integer id) {
return locationPointMapper.delete(id);
}
/**
* 分页查询位置点
* @param queryDTO 查询参数
* @return 位置点列表
*/
public Page<List<LocationPoint>> page(LocationPointQueryDTO queryDTO) {
int pageNum = queryDTO.getPageNum();
int pageSize = queryDTO.getPageSize();
// 计算正确的偏移量
int offset = (pageNum - 1) * pageSize;
queryDTO.setPageNum(offset);
List<LocationPoint> pointList = locationPointMapper.page(queryDTO);
int total = locationPointMapper.count(queryDTO);
Page<List<LocationPoint>> page = new Page<>();
page.setTotal(total);
page.setFirst(pageNum == 1);
page.setLast(pageNum * pageSize >= total);
page.setCurrent(pageNum);
page.setSize(pageSize);
page.setContent(pointList);
return page;
}
}
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.common.interceptor.PageView;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt;
import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationCategory;
import com.dlbridge.jadp.plugins.cmpt.dto.LocationCategoryQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.service.CmptService;
import com.dlbridge.jadp.plugins.cmpt.service.LocationCategoryService;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.ArrayList;
@RestController
@RequestMapping("/gk/location-category")
@Api(value = "区域分类服务", tags = "区域分类服务")
public class LocationCategoryController {
@Resource
private CmptService cmptService;
@Resource
private LocationCategoryService locationCategoryService;
@RequestMapping("index/{cmptId}")
@PageView
public ModelAndView index(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
Cmpt cmpt = cmptService.queryCmptBycmptId(cmptId);
mv.setViewName("cmpt/location");
mv.addObject("cmpt", cmpt);
return mv;
}
@PostMapping
@ApiOperation(value = "创建区域分类", notes = "创建新的区域分类")
public Result<LocationCategory> create(@RequestBody LocationCategory category) {
LocationCategory result = locationCategoryService.create(category);
return Result.success().setContent(result);
}
@GetMapping("/{id}")
@ApiOperation(value = "获取区域分类", notes = "根据ID获取区域分类")
public Result<LocationCategory> detail(@PathVariable Integer id) {
LocationCategory category = locationCategoryService.detail(id);
return Result.success().setContent(category);
}
@PutMapping
@ApiOperation(value = "更新区域分类", notes = "根据ID更新区域分类")
public Result<LocationCategory> update(@RequestBody LocationCategory category) {
LocationCategory result = locationCategoryService.update(category);
return Result.success().setContent(result);
}
@DeleteMapping("/{id}")
@ApiOperation(value = "删除区域分类", notes = "根据ID删除区域分类")
public Result<?> delete(@PathVariable Integer id) {
return Result.success().setContent(locationCategoryService.delete(id));
}
@PostMapping("/page")
@ApiOperation(value = "获取区域分类列表", notes = "根据条件获取区域分类列表")
public Result<?> page(@RequestBody LocationCategoryQueryDTO queryDTO) {
if (queryDTO.getPageNum() == null) {
return Result.success().setContent(new ArrayList<>());
}
return Result.success().setContent(locationCategoryService.page(queryDTO));
}
}
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.common.interceptor.PageView;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt;
import com.dlbridge.jadp.plugins.cmpt.dao.model.LocationPoint;
import com.dlbridge.jadp.plugins.cmpt.dto.LocationPointQueryDTO;
import com.dlbridge.jadp.plugins.cmpt.service.CmptService;
import com.dlbridge.jadp.plugins.cmpt.service.LocationPointService;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
@RestController
@RequestMapping("/gk/location-point")
@Api(value = "位置点服务", tags = "位置点服务")
public class LocationPointController {
@Resource
private LocationPointService locationPointService;
@Resource
private CmptService cmptService;
@RequestMapping("index/{cmptId}")
@PageView
public ModelAndView index(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
Cmpt cmpt = cmptService.queryCmptBycmptId(cmptId);
mv.setViewName("cmpt/locationPoint");
mv.addObject("cmpt", cmpt);
return mv;
}
@PostMapping
@ApiOperation(value = "创建位置点", notes = "创建新的位置点")
public Result<LocationPoint> create(@RequestBody LocationPoint point) {
LocationPoint result = locationPointService.create(point);
return Result.success().setContent(result);
}
@GetMapping("/{id}")
@ApiOperation(value = "获取位置点", notes = "根据ID获取位置点")
public Result<LocationPoint> detail(@PathVariable Integer id) {
LocationPoint point = locationPointService.detail(id);
return Result.success().setContent(point);
}
@PutMapping
@ApiOperation(value = "更新位置点", notes = "根据ID更新位置点")
public Result<LocationPoint> update(@RequestBody LocationPoint point) {
LocationPoint result = locationPointService.update(point);
return Result.success().setContent(result);
}
@DeleteMapping("/{id}")
@ApiOperation(value = "删除位置点", notes = "根据ID删除位置点")
public Result<?> delete(@PathVariable Integer id) {
return Result.success().setContent(locationPointService.delete(id));
}
@PostMapping("/page")
@ApiOperation(value = "获取位置点列表", notes = "根据条件获取位置点列表")
public Result<?> page(@RequestBody LocationPointQueryDTO queryDTO) {
return Result.success().setContent(locationPointService.page(queryDTO));
}
}
...@@ -74,6 +74,14 @@ ...@@ -74,6 +74,14 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
} }
.n-dialog__icon>* {
position: absolute;
left: 0;
top: -2px !important;
right: 0;
bottom: 0;
}
</style> </style>
</head> </head>
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
<n-alert title="图片要求" type="warning"> <n-alert title="图片要求" type="warning">
建议1081 x 4174 png格式 1MB以内 建议1081 x 4174 png格式 1MB以内
</n-alert> </n-alert>
<n-upload <n-upload
:max="1" :max="1"
@before-upload="beforeUpload" @before-upload="beforeUpload"
:action="uploadUrl" :action="uploadUrl"
......
...@@ -74,6 +74,14 @@ ...@@ -74,6 +74,14 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
} }
.n-dialog__icon>* {
position: absolute;
left: 0;
top: -2px !important;
right: 0;
bottom: 0;
}
</style> </style>
</head> </head>
...@@ -496,7 +504,6 @@ ...@@ -496,7 +504,6 @@
key: 'header', key: 'header',
width: 250, width: 250,
render: (row) => { render: (row) => {
// const images = row.resolveImageUrl?.split(',') ?? []
return h(NSpace, { return h(NSpace, {
vertical: true, vertical: true,
}, [ }, [
...@@ -504,12 +511,6 @@ ...@@ -504,12 +511,6 @@
h(NText, {}, "纳税人识别号:" + (row.taxPayerId ?? '--')), h(NText, {}, "纳税人识别号:" + (row.taxPayerId ?? '--')),
h(NText, {}, "开户行:" + (row.taxBank ?? '--')), h(NText, {}, "开户行:" + (row.taxBank ?? '--')),
h(NText, {}, "开户行账号:" + (row.taxBankAccount ?? '--')), h(NText, {}, "开户行账号:" + (row.taxBankAccount ?? '--')),
// h(NImageGroup, {}, [
// ...images.map((img) => h(NImage, {
// height: "100",
// src: img
// }))
// ]),
]) ])
} }
}, },
......
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
</div> </div>
</n-form-item> </n-form-item>
<n-form-item label="排除字符" > <n-form-item label="排除字符" >
<n-input v-model:value="markNoRuleValue.excludedChars" placeholder="请输入全局排查的字符集" /> <n-input v-model:value="markNoRuleValue.excludedChars" placeholder="请输入全局排查的字符集,多个字符用逗号隔开" />
</n-form-item> </n-form-item>
<n-form-item label="对应性别" path="gender"> <n-form-item label="对应性别" path="gender">
<n-select v-model:value="markNoRuleValue.gender" :options="GenderEnum.data.map(v=>({label:v.name,value:v.value}))" /> <n-select v-model:value="markNoRuleValue.gender" :options="GenderEnum.data.map(v=>({label:v.name,value:v.value}))" />
...@@ -431,19 +431,22 @@ ...@@ -431,19 +431,22 @@
id: undefined, id: undefined,
type: RuleTypeEnum.DIGIT.value, type: RuleTypeEnum.DIGIT.value,
position: 1, position: 1,
fixedValue: '' fixedValue: '',
// excludedChars: '',
}, },
{ {
id: undefined, id: undefined,
type: RuleTypeEnum.DIGIT.value, type: RuleTypeEnum.DIGIT.value,
position: 2, position: 2,
fixedValue: '' fixedValue: '',
// excludedChars: '',
}, },
{ {
id: undefined, id: undefined,
type: RuleTypeEnum.DIGIT.value, type: RuleTypeEnum.DIGIT.value,
position: 3, position: 3,
fixedValue: '' fixedValue: '',
// excludedChars: '',
}, },
],// 选号规则详情 ],// 选号规则详情
waves: [] // 枪次 waves: [] // 枪次
...@@ -596,6 +599,22 @@ ...@@ -596,6 +599,22 @@
}) })
} }
}, },
// {
// title: '排除字符',
// key: 'excludedChars',
// align: 'center',
// width: 200,
// render(row, index) {
// return h(NInput, {
// placeholder: '请输入排除字符,多个逗号隔开',
// value: row.excludedChars,
// disabled: row.type === RuleTypeEnum.FIXED.value,
// onUpdateValue(v) {
// markNoRuleValue.value.details[index].excludedChars = v
// }
// })
// }
// },
] ]
// 选号长度改变 // 选号长度改变
const changeTotalLength = (v) => { const changeTotalLength = (v) => {
......
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %> <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!doctype html> <%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<html> <%@ taglib prefix="fnc" uri="/WEB-INF/tlds/fnc.tld" %>
<c:set var="ctx" value="${pageContext.request.contextPath}${fns:getAdminPath()}" />
<head>
<title>自助选号</title> <c:set var="path" value="${pageContext.request.contextPath}${fns:getPath()}" />
<!-- Bootstrap CSS-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css"> <c:set var="jaaproot" value="${pageContext.request.contextPath}" />
<!-- Font Awesome CSS--> <c:set var="ctxStatic" value="${pageContext.request.contextPath}/static" />
<link rel="stylesheet" <!DOCTYPE html>
href="${ctxStatic}/newdermon/vendor/font-awesome/css/font-awesome.min.css"> <html>
<!-- Fontastic Custom icon font-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/fontastic.css"> <head>
<!-- Google fonts - Poppins --> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/font-css.css"> <title>自助选号</title>
<!-- theme stylesheet--> <!-- ... 保留原有的 Vue 引入 ... -->
<link rel="stylesheet" <script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>" <!-- 添加 Naive UI 的引入 -->
id="theme-stylesheet"> <!-- 会使用最新版本,你最好指定一个版本 -->
<!-- Custom stylesheet - for your changes--> <script src="https://unpkg.com/naive-ui"></script>
<link rel="stylesheet" <!-- <script nomodule
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/juery-ui-1.12.css"> <script type="module"
<!-- Favicon--> src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
<link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico"> <script nomodule
<link rel="stylesheet" src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> <!-- Favicon-->
<link rel="stylesheet" <link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>"> <!-- 自定义css -->
<link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>"> <link rel="stylesheet" href="${ctxStatic}/css/base.css">
<link rel="stylesheet" <!-- Bootstrap CSS-->
href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>" /> <link rel="stylesheet"
<link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css" /> href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css">
<!-- Bootstrap CSS--> <!-- theme stylesheet-->
<link rel="stylesheet" href="${ctxStatic}/css/base.css"> <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>"
<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script> id="theme-stylesheet">
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script> <!-- Custom stylesheet - for your changes-->
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script> <link rel="stylesheet"
<link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css"> href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="/static/cmpt/score.css?<%=System.currentTimeMillis()%>"> <!-- Favicon-->
<style> <link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
.layui-layer-title { <link rel="stylesheet"
color: white; href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>">
}
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script>
<style>
.layui-layer-btn { #app {
color: white; padding: 0 20px 20px 20px;
} }
.right {
height: auto !important;
width: 80%;
margin: 0px 0px 0px 40px;
}
.action {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-around;
}
.dialog {
width: 40vw;
max-height: 80vh;
height: auto;
z-index: 99;
display: flex;
flex-direction: column;
left: 50%;
transform: translate(-50%, 50%);
margin-left: 0;
padding: 20px;
border-radius: 10px;
}
.dialog input {
width: 100% !important;
}
.action div {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
user-select: none;
}
.submit {
display: inline-block;
width: 120px;
height: 45px;
text-align: center;
line-height: 45px;
color: white;
background: #ce3939;
border-radius: 4px;
letter-spacing: 1px;
cursor: pointer;
font-size: 16px;
}
.cancel {
width: 120px;
height: 45px;
background: #949494;
border-radius: 4px;
font-size: 16px;
color: #FFFFFF;
line-height: 45px;
text-align: center;
margin-right: 20px;
}
.input {
width: 100%;
height: 40px !important;
line-height: 40px !important;
border: 2px solid #F4F4F4;
border-radius: 4px;
margin-right: 30px;
margin-left: 0px;
padding-left: 12px;
background: rgba(247, 247, 247, 1);
border-radius: 4px;
border: 1px solid rgba(229, 229, 229, 1);
}
.title {
font-size: 24px;
font-weight: 500;
color: rgba(51, 51, 51, 1);
}
.form-label {
font-size: 15px;
color: rgb(92, 91, 91);
width: auto;
}
.form-item {
display: flex;
flex-direction: column;
/* height: 90px; */
padding: 5px 0;
}
.section {
display: flex;
background: rgba(255, 255, 255, 1);
border-radius: 4px;
flex-direction: column;
margin-bottom: 10px !important;
margin-top: 0px !important;
}
.tip {
font-size: 16px;
color: rgba(51, 51, 51, 1);
position: absolute;
right: 45px;
top: 10px;
}
.form-action {
display: flex;
justify-content: flex-end;
margin: 0 20px;
padding-top: 10px;
}
label {
/* width: auto; */
/* width: 200px; */
display: flex;
flex-direction: row;
align-items: center;
}
.label-box {
display: flex;
flex-direction: row;
align-items: center;
}
.dialog label input {
width: 20px !important;
height: 20px !important;
margin: 0 10px !important;
}
.cover {
width: 100%;
height: 100px;
background: rgba(247, 247, 247, 1);
border-radius: 4px;
border: 1px solid rgba(238, 238, 238, 1);
display: flex;
justify-content: center;
align-items: center;
}
.cover-img {
width: 300px;
cursor: pointer;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
height: 300px;
}
.icon-cover { .layout {
width: 34px; min-height: 100vh;
height: 34px; }
background-image: url("/static/images/icon_cover.png");
background-size: 100%;
background-repeat: no-repeat;
}
.section { .carousel-img {
width: 100% !important; width: 100%;
display: flex; height: 240px;
flex-direction: column; object-fit: cover;
} }
[v-cloak] {
display: none;
}
.n-message .n-message__icon>* {
position: absolute;
left: 0;
top: -5px !important;
right: 0;
bottom: 0;
}
.rule-field tbody tr td:first-child { .n-dialog__icon>* {
padding-left: 5px !important; position: absolute;
height: auto !important; left: 0;
} top: -2px !important;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
<jsp:include page="../common/header.jsp"></jsp:include>
<div class="page-content d-flex align-items-stretch main-body">
<jsp:include page="../common/menu.jsp"></jsp:include>
<div id="app" class="flex-1" v-cloak>
<n-config-provider :locale="locale" :date-locale="dateLocale">
<n-modal-provider>
<n-message-provider>
<n-notification-provider>
<my-app></my-app>
</n-notification-provider>
</n-message-provider>
</n-modal-provider>
</n-config-provider>
</div>
</div>
<script type="text/x-template" id="my-app">
<n-space vertical >
<!-- 顶部的搜索框 -->
<n-card :bordered="false">
<div class="w-full flex flex-row items-center gap-x-2">
<div style="min-width: 200px">
<n-tabs type="segment" @update:value="updateTab":value="tabIndex" animated pane-style="padding:0;">
<n-tab-pane v-for="item in ListEnum.data" :name="item.value" :tab="item.name"/>
</n-tabs>
</div>
<div style="min-width: 300px">
<n-tabs type="segment" @update:value="updateStatus" :value="query.status" animated pane-style="padding:0;">
<n-tab-pane
v-for="item in statusOptions"
:name="item.value"
:tab="item.name+'('+item.total+')'"/>
</n-tabs>
</div>
<div class="ml-auto">
<n-input v-model:value="keyword" placeholder="请输入关键字进行搜索" :clearable="true" @change="fetchData" />
</div>
</div>
<div class="w-full flex flex-row items-center mt-3">
<n-space>
<n-upload
:max="1"
@change="onChange($event,PLAYER)"
v-model:file-list="fileList"
accept=".xlsx,.xls"
>
<n-button type="primary" block>
导入名单
</n-button>
</n-upload>
<n-upload
:max="1"
@change="onChange($event,MARK_NO)"
v-model:file-list="fileList"
accept=".xlsx,.xls"
>
<n-button type="primary" @click="importNo">导入参赛号</n-button>
</n-upload>
<n-button type="primary" @click="exportExcel(PLAYER)">导出选手名单</n-button>
<n-button type="primary" @click="exportExcel(MARK_NO)">导出参赛号</n-button>
<n-button @click="download(PLAYER)">下载选号名单模板</n-button>
<n-button @click="download(MARK_NO)">参赛号入库模板</n-button>
<n-button type="error" @click="showModal = true">随机分配</n-button>
</n-space>
</div>
</n-card>
<!-- 搜索框 -->
<n-data-table :columns="isPlayerList?playersColumns:markNoColumns" :loading="loading" :data="list" :pagination="pagination"
:bordered="false"
:remote="true"/>
<n-modal
v-model:show="showModal"
preset="dialog"
title="确认"
content="是否确定开始随机分配?"
positive-text="确认"
negative-text="取消"
@positive-click="randomAssign"
/>
</n-space>
</script>
<script>
// 枚举class
class SuperEnum {
constructor(param) {
const keyObj = {};
const valueObj = {};
const nameObj = {};
if (!Array.isArray(param)) {
throw new TypeError('param is not an array!');
}
tbody tr td { param.forEach((element) => {
font-size: 15px !important; if (!element.key || !element.name) {
padding: 5px; return;
} }
// 使用对象存储键值对,方便快速查找
keyObj[element.key] = element;
valueObj[element.value] = element;
nameObj[element.name] = element;
// 动态添加属性
this[element.key] = element;
this[element.name] = element;
if (element.key !== element.value) {
this[element.value] = element;
}
});
input[type=checkbox]::before { // 保存源数组
border: none !important; this.data = param;
background: none !important; this.keyObj = keyObj;
} this.valueObj = valueObj;
this.nameObj = nameObj;
input[type=checkbox]:checked::before { // 防止被修改
border: none !important; Object.freeze(this);
background: none !important; }
}
input[type=checkbox] { getColorByKey(key) {
top: 0; const prop = this.keyOf(key);
left: 0; if (!prop) {
} const error = new Error('No enum constant');
</style> error.code = 'ENUM_NOT_FOUND';
</head> throw error;
}
return prop.color;
}
<body> getData() {
<jsp:include page="../common/header.jsp"></jsp:include> return this.data;
<div class="page-content d-flex align-items-stretch main-body"> }
<jsp:include page="../common/menu.jsp"></jsp:include>
<div class="right" id="app">
<div class="section flex flex-col gap-y-2">
<div class="flex flex-row items-center justify-between">
<div class="btn-group" role="group" aria-label="First group">
<button :class="[index==typeIndex?'btn-primary':'btn-default']"
@click="changeType(index)" type="button"
v-for="(typeOpt,index) in typeOptions" :key="index" class="btn btn-sm">
{{typeOpt.name}}
</button>
</div>
<div class="flex flex-row items-center gap-x-2 ml-auto">
<div class="btn-group" role="group" aria-label="First group">
<button :class="[index==statusIndex?'btn-danger':'btn-default']"
@click="changeStatus(index)" type="button"
v-for="(statusOpt,index) in statusOptions" :key="index"
class="btn btn-sm">
{{statusOpt.name}}({{statusOpt.count}})
</button>
</div>
<div class="input-group ml-2 mr-2">
<input type="text" class="form-control"
:placeholder="isEnroll?'请输入搜索关键字':'请输入参赛号'" @keyup.enter="refresh"
v-model="keyword" aria-label="Input group example"
aria-describedby="btnGroupAddon">
</div>
<div class="flex flex-row items-center gap-x-2">
<button class="btn btn-sm ml-auto btn-danger" @click="refresh">
搜索
</button>
</div>
</div>
</div>
<div class="flex flex-row items-center w-full justify-start gap-x-2">
<div>
<button class="btn btn-sm ml-auto btn-primary"
@click="importExcel('enroll')">
导入名单
</button>
</div>
<div>
<button class="btn btn-sm ml-auto btn-primary"
@click="importExcel('markNo')">
导入参赛号
</button>
</div>
<div>
<button class="btn btn-sm ml-auto btn-primary"
@click="exportExcel('enroll')">
导出选手名单
</button>
</div>
<div>
<button class="btn btn-sm ml-auto btn-primary"
@click="exportExcel('markNo')">
导出参赛号
</button>
</div>
<div>
<button class="btn btn-sm ml-auto btn-primary" @click="markNoSelect">
随机分配
</button>
</div>
</div> getKeyByName(name) {
</div> const prop = this.nameOf(name);
<div style="margin-bottom: 50px"> if (!prop) {
<table style="width: 100%;" class="rule-field"> const error = new Error('No enum constant');
<colgroup> error.code = 'ENUM_NOT_FOUND';
<col style="width:20%;"> throw error;
<col style="width:20%;"> }
<col style="width:20%;"> return prop.key;
<col style="width:20%;"> }
<col style="width:20%;">
</colgroup>
<thead> getNameByKey(key) {
<tr> const prop = this.keyOf(key);
<th style="text-align: center;padding-left:5px;">{{isEnroll?'姓名':'参赛号'}} if (!prop) {
</th> const error = new Error('No enum constant');
<th style="text-align: center">{{isEnroll?'参赛号':'分区'}}</th> error.code = 'ENUM_NOT_FOUND';
<th style="text-align: center">{{isEnroll?'手机号':'号段名'}}</th> throw error;
<th style="text-align: center">{{isEnroll?'分区':'状态'}}</th> }
<th style="text-align: center">{{isEnroll?'更新时间':'是否自动分配'}}</th> return prop.name;
</tr> }
</thead>
<tbody>
<tr v-for="item in list" :data-id="item.id">
<td style="text-align: center;">
{{isEnroll?item.name:item.markNo}}
</td>
<td class="name" style="text-align: center;">
{{isEnroll?(item.markNo?item.markNo:'---'):item.zone}}
</td>
<td class="name" style="text-align: center;">
{{isEnroll?item.phone:item.groupName}}
</td>
<td class="name" style="text-align: center;">
{{isEnroll?item.zone:pickUpEnum[item.isPickUp]}}
</td>
<td class="name" style="text-align: center;">
{{isEnroll?item.updateTime:autoEnum[item.isAuto]}}
</td>
</tr>
</tbody>
</table>
<nav class="mt-2" v-if="list.length>0" aria-label="Page navigation">
<ul class="pagination">
<li class="page-item" v-if="page!==1" @click="preview"><a class="page-link"
href="#">Previous</a></li>
<li @click="changePage(item+1)" v-for="item,index in totalPage"
:key="item+'page'" class="page-item" :class="{active:(index+1)==page}">
<a class="page-link" href="#">{{item}}</a>
</li>
<li class="page-item" v-if="list.length===pageSize" @click="next"><a getNameByValue(value) {
class="page-link" href="#">Next</a></li> const prop = this.valueOf(value);
if (!prop) {
const error = new Error('No enum constant');
error.code = 'ENUM_NOT_FOUND';
throw error;
}
return prop.name;
}
<div class="ml-2 flex flex-row items-center gap-x-2"> getValueByKey(key) {
<span>每页条数</span> const prop = this.keyOf(key);
<select v-model="pageSize" @change="fetchData" style="width: 50px;"> if (!prop) {
<option :value="10">10</option> const error = new Error('No enum constant');
<option :value="20">20</option> error.code = 'ENUM_NOT_FOUND';
<option :value="50">50</option> throw error;
<option :value="100">100</option> }
<option :value="500">500</option> return prop.value;
</select> }
<span>共{{pages}}页</span>
</div>
</ul>
</nav>
</div>
getValueByName(name) {
const prop = this.nameOf(name);
if (!prop) {
const error = new Error('No enum constant');
error.code = 'ENUM_NOT_FOUND';
throw error;
}
return prop.value;
}
<div class="dialog" v-show="dialog"> keyOf(key) {
<div> return this.keyObj[key];
<span class="text-2xl font-bold mb-3 text-main"> }
{{title}}
</span>
</div>
<div class="flex flex-col gap-y-3 flex-1 overflow-y-auto">
<input class="pt-2" @change="handleFileChange" type="file" ref="fileInput"
:placeholder="type==='enroll'?'请上传选号名单模板':'请上传参赛号入库模板'" />
<a :href="xlsxUrl">
{{type==='enroll'?'选号名单模板.xlsx':'参赛号入库模板.xlsx'}}
</a>
<span class="text-main">
文件上传(请上传.xlsx格式文件)
</span>
</div>
<div class="form-action">
<span @click="cancel" class="cancel cursor-pointer">取消</span>
<span @click="submit" class="submit">上传</span>
</div>
</div>
<div v-show="dialog"
style="position: fixed;height: 100%;width: 100%;background: black;z-index: 10;opacity: 0.5;top:0px;left:0px">
</div>
</div>
<script src="${ctxStatic}/vue/vue.js"></script>
<script>
// 正式环境
const eccUrl = "https://ecc.geexek.com"
const gtCmptId = getCId()
// ecc的请求地址
// const eccUrl = "http://localhost:8081"
// 模拟的cmptId
// const gtCmptId = 27262
// 选号模板 nameOf(name) {
const markNoTemplateUrl = "https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/gk/common/markNoSelect/%E5%8F%82%E8%B5%9B%E5%8F%B7%E5%85%A5%E5%BA%93%E6%A8%A1%E7%89%88v1.xlsx" return this.nameObj[name];
// 选手模板
const enrollTemplateUrl = "https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/gk/common/markNoSelect/%E9%80%89%E5%8F%B7%E5%90%8D%E5%8D%95%E8%A1%A8%E6%A8%A1%E7%89%88v1.xlsx"
const app = new Vue({
el: '#app',
data: {
list: [],
dialog: false,
type: 'enroll',// 类型有enroll 和 markNo
title: '自助选号',
selectedFile: null, // 上传的文件
typeIndex: 0, // 是否是人员列表
typeOptions: [
{
name: "选手名单",
value: 1,
},
{
name: "参赛号列表",
value: 0,
},
],
// 分页相关
keyword: '',
page: 1,
pageSize: 10,
totalPage: 1,
pages: 0,
// 状态相关
statusIndex: 0,
statusOptions: [
{
name: "全部",
value: '',
count: 0
},
{
name: "已选",
value: 1,
count: 0
},
{
name: "未选",
value: 0,
count: 0
},
],
pickUpEnum: {
0: '待选',
1: '已选'
},
autoEnum: {
0: '否',
1: '是'
} }
},
computed: { valueOf(value) {
// 文件下载地址 return this.valueObj[value];
xlsxUrl() {
return this.type === 'enroll' ? enrollTemplateUrl : markNoTemplateUrl
},
// 是否是选手名单
isEnroll() {
return this.typeIndex === 0
} }
}, }
mounted() {
this.fetchData();
this.getStats();
},
methods: {
// 随机分配
markNoSelect() {
layer.confirm("确认要随机分配吗?", () => {
$.ajax({
url: eccUrl + '/api-pick/v1/pick-up-batch?cmptId=' + gtCmptId,
type: 'get',
contentType: 'application/json',
beforeSend: () => {
layer.load()
},
success: (res) => {
layer.msg(res.code === 200 ? '分配成功!' : res.msg);
setTimeout(() => {
this.dialog = false;
this.fetchData();
this.getStats()
}, 1500)
},
complete: () => {
setTimeout(() => layer.closeAll(), 1500)
}
});
});
},
// 导出名单
exportExcel(type) {
const markNoUrl = '/api-pick/v1/export-markno-library-v1'
const enrollUrl = '/api-pick/v1/export-markno-enroll'
const url = eccUrl + (type === 'enroll' ? enrollUrl : markNoUrl)
window.location.href = url + '?cmptId=' + gtCmptId
},
// 处理文件选择
handleFileChange(event) {
this.selectedFile = event.target.files[0];
},
// 页面刷新 // to 方法,封装try catch
refresh() { const to = async (
this.page = 1; promise,
this.fetchData() errorExt,
}, ) => {
// 状态切换 try {
changeStatus(index) { const data = await promise
this.page = 1 const result = [null, data]
this.statusIndex = index; return result
this.fetchData() } catch (error) {
}, if (errorExt) {
// 状态切换 const parsedError = Object.assign({}, error, errorExt)
changeType(index) { return [parsedError, undefined]
this.page = 1
this.typeIndex = index;
this.statusIndex = 0
this.keyword = ''
this.getStats()
this.fetchData()
},
// 分页
changePage(page) {
this.page = page
this.fetchData()
},
// 下一页
next() {
this.page += 1
this.fetchData()
},
// 上一也
preview() {
this.page -= 1
this.fetchData()
},
// 编辑
importExcel(type) {
this.type = type
this.title = type === 'enroll' ? '导入选号名单' : '导入参赛号入库'
this.dialog = true
},
// 保存
submit() {
if (!this.selectedFile) {
layer.msg('请先选择文件');
return;
} }
const bag = { ...this.bag } return [error, undefined]
const formData = new FormData(); }
formData.append('file', this.selectedFile); }
formData.append('cmptId', gtCmptId); // 状态
const url = eccUrl + (this.type === 'enroll' ? '/api-pick/v1/import-mark-enroll' : '/api-pick/v1/import-mark-library') const StatusEnum =
$.ajax({ new SuperEnum([
url, { key: 'PICKED', name: '已选', color: 'warning', value: 1 },
type: 'POST', // 增值
data: formData, { key: 'UN_PICKED', name: '未选', color: 'success', value: 0 },
processData: false, ])
contentType: false, // 自动与手动
beforeSend: () => { const AutoEnum =
layer.load() new SuperEnum([
{ key: 'AUTO', name: '自动', color: 'warning', value: 1 },
// 增值
{ key: 'MANUAL', name: '手动', color: 'success', value: 0 },
])
// 列表类型
const ListEnum =
new SuperEnum([
{ key: 'PLAYERS', name: '选手名单', color: 'warning', value: 1 },
// 增值
{ key: 'MARK_NO', name: '参赛号列表', color: 'success', value: 2 },
])
</script>
<script>
const { createApp, defineComponent, reactive, ref, onMounted, h, computed } = Vue;
const { useMessage, useNotification, dateZhCN, NButton, NTag, zhCN, NSpace, NImageGroup, NImage, NText } = naive
// 添加全局 loading 指令
const uploadUrl = window.location.origin + '/api-common/v1/upload?folder=' + 'gk/invoice' + '&cmptId=' + getCId()
const BASE_ECC_URL = "https://ecc.geexek.com"
// 人员列表
const PLAYERS_URL = BASE_ECC_URL + '/api-pick/v1/enroll-page'
const PLAYERS_EXPORT_URL = BASE_ECC_URL + '/api-pick/v1/export-markno-enroll?cmptId=' + getCId()
const PLAYERS_IMPORT_URL = BASE_ECC_URL + '/api-pick/v1/import-mark-enroll'
const PLAYERS_DOWNLOAD_URL = "https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/gk/common/markNoSelect/%E9%80%89%E5%8F%B7%E5%90%8D%E5%8D%95%E8%A1%A8%E6%A8%A1%E7%89%88v1.xlsx"
// 号码簿列表
const MARK_NO_URL = BASE_ECC_URL + '/api-pick/v1/mark-list'
const MARK_NO_EXPORT_URL = BASE_ECC_URL + '/api-pick/v1/export-markno-library-v1?cmptId=' + getCId()
const MARK_NO_IMPORT_URL = BASE_ECC_URL + '/api-pick/v1/import-mark-library'
const MARK_NO_DOWNLOAD_URL = "https://geexekimgoss-sxk.oss-cn-hangzhou.aliyuncs.com/gk/common/markNoSelect/%E5%8F%82%E8%B5%9B%E5%8F%B7%E5%85%A5%E5%BA%93%E6%A8%A1%E7%89%88v1.xlsx"
// 随机分配名单
const RANDOM_ASSIGN_URL = BASE_ECC_URL + '/api-pick/v1/pick-up-batch?cmptId=' + getCId()
const MyApp = defineComponent({
name: 'MyApp',
template: '#my-app',
setup() {
const message = useMessage()
const notification = useNotification()
const loading = ref(false)
/***----------------选手名单相关 start -----------------*/
const tabIndex = ref(1)
const isPlayerList = computed(() => tabIndex.value === 1)
const PLAYER = "player"
const MARK_NO = "markNo"
// 状态统计
const statusOptions = ref([
{
name: '全部',
value: '',
total: 0
},
{
name: '已选',
value: 1,
total: 0
},
{
name: '未选',
value: 0,
total: 0
},
])
const playersColumns = [
{
title: '姓名',
key: 'name',
}, },
success: (res) => { {
layer.msg(res.code === 200 ? '保存成功!' : res.msg); title: '参赛号',
setTimeout(() => { key: MARK_NO,
this.dialog = false;
this.fetchData();
this.getStats()
}, 1500)
}, },
complete: () => { {
setTimeout(() => layer.closeAll(), 1500) title: '手机号',
key: 'phone',
},
{
title: '证件号',
key: 'identityNo',
},
{
title: '分区',
key: 'zone',
},
{
title: '更新时间',
key: 'updateTime',
}
]
const markNoColumns = [
{
title: '参赛号',
key: MARK_NO,
},
{
title: '分区',
key: 'zone',
},
{
title: '号段名',
key: 'groupName',
},
{
title: '状态',
key: 'isPickUp',
render: (row) => {
return h(NSpace, {
vertical: true,
}, [
h(NSpace, {}, [
h(NTag, {
size: "small",
type: StatusEnum[row.isPickUp].color
}, StatusEnum[row.isPickUp].name),
]),
])
}
},
{
title: '是否自动分配',
key: 'isAuto',
render: (row) => {
return h(NTag, {
size: "small",
type: AutoEnum[row.isAuto].color
}, AutoEnum[row.isAuto].name)
}
}
]
// 分页
const pagination = reactive({
pageSize: 20,
page: 1,
pageCount: 0,
showSizePicker: true,
itemCount: 0,
pageSizes: [20, 50, 200, 500],
prefix: (info) => "共" + info.itemCount + "条数据",
onChange: (page) => {
pagination.page = page
fetchData()
},
onUpdatePageSize: (pageSize) => {
pagination.pageSize = pageSize
pagination.page = 1
fetchData()
} }
}) })
}, // 查询的参数
// 返回 const query = reactive({
cancel() { keyword: undefined,
this.dialog = false; isPickUp: undefined,
}, markNo: undefined,
// 查询所有 })
fetchData() { const keyword = ref('')
if (!getCId()) return // 结果列表
const url = eccUrl + (this.isEnroll ? '/api-pick/v1/enroll-page' : '/api-pick/v1/mark-list') const fileList = ref([])
let isPickUp = this.statusOptions[this.statusIndex].value // 删除自助选号
let params = { const showModal = ref(false)
cmptId: gtCmptId, // 名单列表
keyword: this.keyword ?? undefined, const list = ref([])
isPickUp: isPickUp === '' ? undefined : isPickUp, // 状态更新
current: this.page, const updateStatus = (value) => {
size: this.pageSize pagination.page = 1
query.status = value
fetchData()
} }
// 只对参赛号模糊搜索 // 状态tab
if (!this.isEnroll && this.keyword) { const updateTab = (value) => {
params.markNo = this.keyword tabIndex.value = value
console.log(isPlayerList.value)
fetchData()
} }
$.ajax({ // 上传完成
type: 'post', const uploadFinish = ({
contentType: 'application/json', file,
url, event
data: JSON.stringify(params), }) => {
beforeSend: () => { const response = JSON.parse(event?.target?.response)
layer.load() file.url = response.content
}, return file
complete: () => { }
layer.closeAll() // 重置form数据
}, const resetForm = () => {
success: (res) => { Object.assign(formData, {
this.list = res.data.records id: null,
if (res.data.records.length === this.pageSize) { remarks: null,
this.totalPage = this.page + 1 name: "",
markNo: "",
phone: "",
area: "",
province: "",
city: "",
location: "",
deliveryNo: "",
expressCompany: "",
status: StatusEnum.SUBMIT.value,
remark: ""
})
}
// 获取自助选号分页列表
const fetchData = async () => {
list.value = []
loading.value = true
let params = {
...query,
current: pagination.page,
size: pagination.pageSize,
cmptId: getCId(),
keyword: keyword.value
}
// 发起请求
const url = isPlayerList.value ? PLAYERS_URL : MARK_NO_URL
const [err, res] = await to(fetch(url, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
}).then(res => res.json()))
loading.value = false
if (err) {
message.error(err)
return
}
if (res.code === 200) {
list.value = res.data.records
pagination.itemCount = res.data.total
if (isPlayerList.value) {
statusOptions.value[2].total = res.data.total
} else { } else {
this.totalPage = this.page statusOptions.value[1].total = res.data.total
} }
this.pages = res.data.pages getStats()
// 总数的统计数 } else {
if (this.statusOptions[this.statusIndex].value === '') { message.error(res.message)
this.statusOptions[0].count = res.data.total }
}
// 随机分配名单
const randomAssign = async () => {
loading.value = true
const [err, res] = await to(fetch(RANDOM_ASSIGN_URL, {
method: "GET",
headers: {
'Content-Type': 'application/json'
} }
}).then(res => res.json()))
loading.value = false
if (err) {
message.error(err)
return
} }
}) if (res.code === 200) {
}, message.success('随机分配成功')
// 获取统计 fetchData()
getStats() { } else {
const url = eccUrl + (this.isEnroll ? '/api-pick/v1/enroll-page' : '/api-pick/v1/mark-list') message.error(res.message)
let apis = [1, 0].map(v => }
fetch(url, { }
method: 'POST', // 获取统计 用fetch改造
const getStats = async () => {
loading.value = true
let params = {
page: 1,
size: 1,
cmptId: getCId(),
}
// 发起请求
const url = isPlayerList.value ? MARK_NO_URL : PLAYERS_URL
const [err, res] = await to(fetch(url, {
method: "POST",
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ body: JSON.stringify(params)
cmptId: gtCmptId, }).then(res => res.json()))
isPickUp: v, loading.value = false
current: this.page, if (err) {
size: this.pageSize message.error(err)
}) return
}).then(res => res.json()) }
) if (res.code === 200) {
Promise.all(apis).then(([res1, res2]) => { if (isPlayerList.value) {
this.statusOptions[1].count = res1.data.total statusOptions.value[1].total = res.data.total
this.statusOptions[2].count = res2.data.total } else {
statusOptions.value[2].total = res.data.total
}
statusOptions.value[0].total = statusOptions.value[2].total + statusOptions.value[1].total
} else {
message.error(res.message)
}
}
// 名单导出
const exportExcel = (type) => {
const url = type === PLAYER ? PLAYERS_EXPORT_URL : MARK_NO_EXPORT_URL
window.location.href = url
}
// 文件上传成功
const onChange = async (file, type) => {
loading.value = true
const formData = new FormData();
formData.append('file', file.file);
formData.append('cmptId', getCId());
const url = type === PLAYER ? PLAYERS_IMPORT_URL : MARK_NO_IMPORT_URL
const [err, res] = await to(fetch(url, {
method: "POST",
body: formData
}).then(res => res.json()))
loading.value = false
if (err) {
message.error(err)
return
}
fileList.value = []
if (res.code === 200) {
message.success('导入成功')
fetchData()
} else {
message.error(res.message)
}
}
// 导出
const download = (type) => {
const url = type === PLAYER ? PLAYERS_DOWNLOAD_URL : MARK_NO_DOWNLOAD_URL
window.location.href = url
}
/***---------------- 自助选号相关 end -----------------*/
onMounted(() => {
fetchData()
}) })
}, return {
} // 自助选号相关
}); updateStatus,
</script> updateTab,
</body> fileList,
list,
query,
pagination,
playersColumns,
markNoColumns,
isPlayerList,
showModal,
// 文件相关
keyword,
fetchData,
tabIndex,
randomAssign,
// 公共数据
loading,
StatusEnum,
ListEnum,
statusOptions,
// 名单导出
exportExcel,
download,
uploadFinish,
fileList,
onChange,
PLAYER,
MARK_NO,
</html>
\ No newline at end of file }
}
})
const app = Vue.createApp({
setup() {
return {
locale: zhCN,
dateLocale: dateZhCN
}
}
})
app.component('my-app', MyApp)
app.use(naive)
app.mount('#app')
</script>
</body>
</html>
\ No newline at end of file
...@@ -397,6 +397,13 @@ ...@@ -397,6 +397,13 @@
<span class="menu-txt">免责声明</span> <span class="menu-txt">免责声明</span>
</a> </a>
</li> </li>
<li class="location menu-sub-item">
<a
href="/gk/location-category/index/${cmpt.cmptId}?uId=${uId}&cId=${cId}&timestamp=${timestamp}&sign=${sign}">
<span class="left-arrow"></span>
<span class="menu-txt">领物导航</span>
</a>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
...@@ -459,7 +466,7 @@ ...@@ -459,7 +466,7 @@
var classes = ['cmptSetting', 'nameList', 'manual', 'contact', 'manage', var classes = ['cmptSetting', 'nameList', 'manual', 'contact', 'manage',
'route', 'road', 'equip', 'photo', 'news', 'cert', 'data', 'route', 'road', 'equip', 'photo', 'news', 'cert', 'data',
'banner', 'score', 'auto', 'scan', 'review', 'customer', 'rule', 'banner', 'score', 'auto', 'scan', 'review', 'customer', 'rule',
'outter-link', 'sure-letter', 'rankSetting', 'service', "module", "swiper", "bag", "invoice", "markNoSelect", "feedback", "markNoRule", "gunRule", "disClaimer"]; 'outter-link', 'sure-letter', 'rankSetting', 'service', "module", "swiper", "bag", "invoice", "markNoSelect", "feedback", "markNoRule", "gunRule", "disClaimer", "location"];
let url = document.location.href; let url = document.location.href;
var done = false; var done = false;
for (var i in classes) { for (var i in classes) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment