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>
......
...@@ -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="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!doctype html> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<%@ taglib prefix="fnc" uri="/WEB-INF/tlds/fnc.tld" %>
<c:set var="ctx" value="${pageContext.request.contextPath}${fns:getAdminPath()}" />
<c:set var="path" value="${pageContext.request.contextPath}${fns:getPath()}" />
<c:set var="jaaproot" value="${pageContext.request.contextPath}" />
<c:set var="ctxStatic" value="${pageContext.request.contextPath}/static" />
<!DOCTYPE html>
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>自助选号</title> <title>自助选号</title>
<!-- ... 保留原有的 Vue 引入 ... -->
<script src="https://unpkg.com/vue@3/dist/vue.global.prod.js"></script>
<!-- 添加 Naive UI 的引入 -->
<!-- 会使用最新版本,你最好指定一个版本 -->
<script src="https://unpkg.com/naive-ui"></script>
<!-- <script nomodule
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script> -->
<script type="module"
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.esm.js"></script>
<script nomodule
src="https://unpkg.com/ionicons@7.1.0/dist/ionicons/ionicons.js"></script>
<!-- Favicon-->
<link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
<!-- 自定义css -->
<link rel="stylesheet" href="${ctxStatic}/css/base.css">
<!-- Bootstrap CSS--> <!-- Bootstrap CSS-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css">
<!-- Font Awesome CSS-->
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/vendor/font-awesome/css/font-awesome.min.css"> href="${ctxStatic}/newdermon/vendor/bootstrap/css/bootstrap.min.css">
<!-- Fontastic Custom icon font-->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/fontastic.css">
<!-- Google fonts - Poppins -->
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/font-css.css">
<!-- theme stylesheet--> <!-- theme stylesheet-->
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>" href="${ctxStatic}/newdermon/css/style.default.css?v=<%=System.currentTimeMillis()%>"
...@@ -24,668 +42,647 @@ ...@@ -24,668 +42,647 @@
<!-- Custom stylesheet - for your changes--> <!-- Custom stylesheet - for your changes-->
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/newdermon/css/juery-ui-1.12.css">
<!-- Favicon--> <!-- Favicon-->
<link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico"> <link rel="shortcut icon" href="https://img.geexek.com/files/home/favicon.ico">
<link rel="stylesheet" <link rel="stylesheet"
href="${ctxStatic}/newdermon/css/custom.css?v=<%=System.currentTimeMillis()%>"> href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet"
href="${ctxStatic}/newdermon/css/main.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet" href="${ctxStatic}/cmpt/setting.css?v=<%=System.currentTimeMillis()%>">
<link rel="stylesheet"
href="${ctxStatic}/leaflet/css/leaflet.css?v=<%=System.currentTimeMillis()%>" />
<link rel="stylesheet" href="${ctxStatic}/leaflet/css/leaflet_label.css" />
<!-- Bootstrap CSS-->
<link rel="stylesheet" href="${ctxStatic}/css/base.css">
<script src="${ctxStatic}/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script> <script src="${ctxStatic}/newdermon/vendor/jquery/jquery.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctxStatic}/layer/layer.js"></script>
<link rel="stylesheet" href="${ctxStatic}/layer/skin/layer.css">
<link rel="stylesheet" href="/static/cmpt/score.css?<%=System.currentTimeMillis()%>">
<style> <style>
.layui-layer-title { #app {
color: white; padding: 0 20px 20px 20px;
} }
.layout {
.layui-layer-btn { min-height: 100vh;
color: white;
} }
.right { .carousel-img {
height: auto !important; width: 100%;
width: 80%; height: 240px;
margin: 0px 0px 0px 40px; object-fit: cover;
} }
.action { [v-cloak] {
display: flex; display: none;
flex-direction: row;
align-items: center;
justify-content: space-around;
} }
.dialog { .n-message .n-message__icon>* {
width: 40vw; position: absolute;
max-height: 80vh; left: 0;
height: auto; top: -5px !important;
z-index: 99; right: 0;
display: flex; bottom: 0;
flex-direction: column;
left: 50%;
transform: translate(-50%, 50%);
margin-left: 0;
padding: 20px;
border-radius: 10px;
} }
.dialog input { .n-dialog__icon>* {
width: 100% !important; position: absolute;
left: 0;
top: -2px !important;
right: 0;
bottom: 0;
} }
</style>
</head>
.action div { <body>
display: flex; <jsp:include page="../common/header.jsp"></jsp:include>
flex-direction: row; <div class="page-content d-flex align-items-stretch main-body">
align-items: center; <jsp:include page="../common/menu.jsp"></jsp:include>
justify-content: center; <div id="app" class="flex-1" v-cloak>
user-select: none; <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!');
} }
.submit { param.forEach((element) => {
display: inline-block; if (!element.key || !element.name) {
width: 120px; return;
height: 45px;
text-align: center;
line-height: 45px;
color: white;
background: #ce3939;
border-radius: 4px;
letter-spacing: 1px;
cursor: pointer;
font-size: 16px;
} }
// 使用对象存储键值对,方便快速查找
.cancel { keyObj[element.key] = element;
width: 120px; valueObj[element.value] = element;
height: 45px; nameObj[element.name] = element;
background: #949494; // 动态添加属性
border-radius: 4px; this[element.key] = element;
font-size: 16px; this[element.name] = element;
color: #FFFFFF; if (element.key !== element.value) {
line-height: 45px; this[element.value] = element;
text-align: center;
margin-right: 20px;
} }
});
.input { // 保存源数组
width: 100%; this.data = param;
height: 40px !important; this.keyObj = keyObj;
line-height: 40px !important; this.valueObj = valueObj;
border: 2px solid #F4F4F4; this.nameObj = nameObj;
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; Object.freeze(this);
font-weight: 500;
color: rgba(51, 51, 51, 1);
} }
.form-label { getColorByKey(key) {
font-size: 15px; const prop = this.keyOf(key);
color: rgb(92, 91, 91); if (!prop) {
width: auto; const error = new Error('No enum constant');
error.code = 'ENUM_NOT_FOUND';
throw error;
} }
return prop.color;
.form-item {
display: flex;
flex-direction: column;
/* height: 90px; */
padding: 5px 0;
} }
.section { getData() {
display: flex; return this.data;
background: rgba(255, 255, 255, 1);
border-radius: 4px;
flex-direction: column;
margin-bottom: 10px !important;
margin-top: 0px !important;
} }
.tip { getKeyByName(name) {
font-size: 16px; const prop = this.nameOf(name);
color: rgba(51, 51, 51, 1); if (!prop) {
position: absolute; const error = new Error('No enum constant');
right: 45px; error.code = 'ENUM_NOT_FOUND';
top: 10px; throw error;
} }
return prop.key;
.form-action {
display: flex;
justify-content: flex-end;
margin: 0 20px;
padding-top: 10px;
} }
label { getNameByKey(key) {
/* width: auto; */ const prop = this.keyOf(key);
/* width: 200px; */ if (!prop) {
display: flex; const error = new Error('No enum constant');
flex-direction: row; error.code = 'ENUM_NOT_FOUND';
align-items: center; throw error;
} }
return prop.name;
.label-box {
display: flex;
flex-direction: row;
align-items: center;
} }
.dialog label input { getNameByValue(value) {
width: 20px !important; const prop = this.valueOf(value);
height: 20px !important; if (!prop) {
margin: 0 10px !important; const error = new Error('No enum constant');
error.code = 'ENUM_NOT_FOUND';
throw error;
} }
return prop.name;
.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 { getValueByKey(key) {
width: 300px; const prop = this.keyOf(key);
cursor: pointer; if (!prop) {
background-repeat: no-repeat; const error = new Error('No enum constant');
background-position: center; error.code = 'ENUM_NOT_FOUND';
background-size: cover; throw error;
height: 300px;
} }
return prop.value;
.icon-cover {
width: 34px;
height: 34px;
background-image: url("/static/images/icon_cover.png");
background-size: 100%;
background-repeat: no-repeat;
} }
.section { getValueByName(name) {
width: 100% !important; const prop = this.nameOf(name);
display: flex; if (!prop) {
flex-direction: column; const error = new Error('No enum constant');
error.code = 'ENUM_NOT_FOUND';
throw error;
} }
return prop.value;
.rule-field tbody tr td:first-child {
padding-left: 5px !important;
height: auto !important;
} }
tbody tr td { keyOf(key) {
font-size: 15px !important; return this.keyObj[key];
padding: 5px;
} }
input[type=checkbox]::before { nameOf(name) {
border: none !important; return this.nameObj[name];
background: none !important;
} }
input[type=checkbox]:checked::before { valueOf(value) {
border: none !important; return this.valueObj[value];
background: none !important;
} }
input[type=checkbox] {
top: 0;
left: 0;
} }
</style>
</head>
<body> // to 方法,封装try catch
<jsp:include page="../common/header.jsp"></jsp:include> const to = async (
<div class="page-content d-flex align-items-stretch main-body"> promise,
<jsp:include page="../common/menu.jsp"></jsp:include> errorExt,
<div class="right" id="app"> ) => {
<div class="section flex flex-col gap-y-2"> try {
<div class="flex flex-row items-center justify-between"> const data = await promise
<div class="btn-group" role="group" aria-label="First group"> const result = [null, data]
<button :class="[index==typeIndex?'btn-primary':'btn-default']" return result
@click="changeType(index)" type="button" } catch (error) {
v-for="(typeOpt,index) in typeOptions" :key="index" class="btn btn-sm"> if (errorExt) {
{{typeOpt.name}} const parsedError = Object.assign({}, error, errorExt)
</button> return [parsedError, undefined]
</div> }
<div class="flex flex-row items-center gap-x-2 ml-auto"> return [error, undefined]
<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" const StatusEnum =
class="btn btn-sm"> new SuperEnum([
{{statusOpt.name}}({{statusOpt.count}}) { key: 'PICKED', name: '已选', color: 'warning', value: 1 },
</button> // 增值
</div> { key: 'UN_PICKED', name: '未选', color: 'success', value: 0 },
<div class="input-group ml-2 mr-2"> ])
<input type="text" class="form-control" // 自动与手动
:placeholder="isEnroll?'请输入搜索关键字':'请输入参赛号'" @keyup.enter="refresh" const AutoEnum =
v-model="keyword" aria-label="Input group example" new SuperEnum([
aria-describedby="btnGroupAddon"> { key: 'AUTO', name: '自动', color: 'warning', value: 1 },
</div> // 增值
<div class="flex flex-row items-center gap-x-2"> { key: 'MANUAL', name: '手动', color: 'success', value: 0 },
<button class="btn btn-sm ml-auto btn-danger" @click="refresh"> ])
搜索 // 列表类型
</button> const ListEnum =
</div> new SuperEnum([
</div> { key: 'PLAYERS', name: '选手名单', color: 'warning', value: 1 },
</div> // 增值
<div class="flex flex-row items-center w-full justify-start gap-x-2"> { key: 'MARK_NO', name: '参赛号列表', color: 'success', value: 2 },
<div> ])
<button class="btn btn-sm ml-auto btn-primary" </script>
@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>
</div>
<div style="margin-bottom: 50px">
<table style="width: 100%;" class="rule-field">
<colgroup>
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
<col style="width:20%;">
</colgroup>
<thead>
<tr>
<th style="text-align: center;padding-left:5px;">{{isEnroll?'姓名':'参赛号'}}
</th>
<th style="text-align: center">{{isEnroll?'参赛号':'分区'}}</th>
<th style="text-align: center">{{isEnroll?'手机号':'号段名'}}</th>
<th style="text-align: center">{{isEnroll?'分区':'状态'}}</th>
<th style="text-align: center">{{isEnroll?'更新时间':'是否自动分配'}}</th>
</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
class="page-link" href="#">Next</a></li>
<div class="ml-2 flex flex-row items-center gap-x-2">
<span>每页条数</span>
<select v-model="pageSize" @change="fetchData" style="width: 50px;">
<option :value="10">10</option>
<option :value="20">20</option>
<option :value="50">50</option>
<option :value="100">100</option>
<option :value="500">500</option>
</select>
<span>共{{pages}}页</span>
</div>
</ul>
</nav>
</div>
<div class="dialog" v-show="dialog">
<div>
<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> <script>
// 正式环境 const { createApp, defineComponent, reactive, ref, onMounted, h, computed } = Vue;
const eccUrl = "https://ecc.geexek.com" const { useMessage, useNotification, dateZhCN, NButton, NTag, zhCN, NSpace, NImageGroup, NImage, NText } = naive
const gtCmptId = getCId() // 添加全局 loading 指令
// ecc的请求地址 const uploadUrl = window.location.origin + '/api-common/v1/upload?folder=' + 'gk/invoice' + '&cmptId=' + getCId()
// const eccUrl = "http://localhost:8081" const BASE_ECC_URL = "https://ecc.geexek.com"
// 模拟的cmptId // 人员列表
// const gtCmptId = 27262 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 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" 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 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 MARK_NO_URL = BASE_ECC_URL + '/api-pick/v1/mark-list'
const app = new Vue({ const MARK_NO_EXPORT_URL = BASE_ECC_URL + '/api-pick/v1/export-markno-library-v1?cmptId=' + getCId()
el: '#app', const MARK_NO_IMPORT_URL = BASE_ECC_URL + '/api-pick/v1/import-mark-library'
data: { 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"
list: [], // 随机分配名单
dialog: false, const RANDOM_ASSIGN_URL = BASE_ECC_URL + '/api-pick/v1/pick-up-batch?cmptId=' + getCId()
type: 'enroll',// 类型有enroll 和 markNo
title: '自助选号', const MyApp = defineComponent({
selectedFile: null, // 上传的文件 name: 'MyApp',
typeIndex: 0, // 是否是人员列表 template: '#my-app',
typeOptions: [ setup() {
{ const message = useMessage()
name: "选手名单", const notification = useNotification()
value: 1, const loading = ref(false)
}, /***----------------选手名单相关 start -----------------*/
{ const tabIndex = ref(1)
name: "参赛号列表", const isPlayerList = computed(() => tabIndex.value === 1)
value: 0, const PLAYER = "player"
}, const MARK_NO = "markNo"
], // 状态统计
// 分页相关 const statusOptions = ref([
keyword: '',
page: 1,
pageSize: 10,
totalPage: 1,
pages: 0,
// 状态相关
statusIndex: 0,
statusOptions: [
{ {
name: "全部", name: '全部',
value: '', value: '',
count: 0 total: 0
}, },
{ {
name: "已选", name: '已选',
value: 1, value: 1,
count: 0 total: 0
}, },
{ {
name: "未选", name: '未选',
value: 0, value: 0,
count: 0 total: 0
},
],
pickUpEnum: {
0: '待选',
1: '已选'
},
autoEnum: {
0: '否',
1: '是'
}
}, },
computed: { ])
// 文件下载地址 const playersColumns = [
xlsxUrl() { {
return this.type === 'enroll' ? enrollTemplateUrl : markNoTemplateUrl title: '姓名',
key: 'name',
}, },
// 是否是选手名单 {
isEnroll() { title: '参赛号',
return this.typeIndex === 0 key: MARK_NO,
}
}, },
mounted() { {
this.fetchData(); title: '手机号',
this.getStats(); key: 'phone',
}, },
methods: { {
// 随机分配 title: '证件号',
markNoSelect() { key: 'identityNo',
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); title: '分区',
setTimeout(() => { key: 'zone',
this.dialog = false;
this.fetchData();
this.getStats()
}, 1500)
}, },
complete: () => { {
setTimeout(() => layer.closeAll(), 1500) title: '更新时间',
key: 'updateTime',
} }
}); ]
}); const markNoColumns = [
},
// 导出名单
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];
},
// 页面刷新 {
refresh() { title: '参赛号',
this.page = 1; key: MARK_NO,
this.fetchData()
},
// 状态切换
changeStatus(index) {
this.page = 1
this.statusIndex = index;
this.fetchData()
},
// 状态切换
changeType(index) {
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() { title: '分区',
this.page -= 1 key: 'zone',
this.fetchData()
}, },
// 编辑 {
importExcel(type) { title: '号段名',
this.type = type key: 'groupName',
this.title = type === 'enroll' ? '导入选号名单' : '导入参赛号入库'
this.dialog = true
}, },
// 保存 {
submit() { title: '状态',
if (!this.selectedFile) { key: 'isPickUp',
layer.msg('请先选择文件'); render: (row) => {
return; return h(NSpace, {
vertical: true,
}, [
h(NSpace, {}, [
h(NTag, {
size: "small",
type: StatusEnum[row.isPickUp].color
}, StatusEnum[row.isPickUp].name),
]),
])
} }
const bag = { ...this.bag }
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')
$.ajax({
url,
type: 'POST',
data: formData,
processData: false,
contentType: false,
beforeSend: () => {
layer.load()
}, },
success: (res) => { {
layer.msg(res.code === 200 ? '保存成功!' : res.msg); title: '是否自动分配',
setTimeout(() => { key: 'isAuto',
this.dialog = false; render: (row) => {
this.fetchData(); return h(NTag, {
this.getStats() size: "small",
}, 1500) 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()
}, },
complete: () => { onUpdatePageSize: (pageSize) => {
setTimeout(() => layer.closeAll(), 1500) 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 // 删除自助选号
const showModal = ref(false)
// 名单列表
const list = ref([])
// 状态更新
const updateStatus = (value) => {
pagination.page = 1
query.status = value
fetchData()
}
// 状态tab
const updateTab = (value) => {
tabIndex.value = value
console.log(isPlayerList.value)
fetchData()
}
// 上传完成
const uploadFinish = ({
file,
event
}) => {
const response = JSON.parse(event?.target?.response)
file.url = response.content
return file
}
// 重置form数据
const resetForm = () => {
Object.assign(formData, {
id: null,
remarks: null,
name: "",
markNo: "",
phone: "",
area: "",
province: "",
city: "",
location: "",
deliveryNo: "",
expressCompany: "",
status: StatusEnum.SUBMIT.value,
remark: ""
})
}
// 获取自助选号分页列表
const fetchData = async () => {
list.value = []
loading.value = true
let params = { let params = {
cmptId: gtCmptId, ...query,
keyword: this.keyword ?? undefined, current: pagination.page,
isPickUp: isPickUp === '' ? undefined : isPickUp, size: pagination.pageSize,
current: this.page, cmptId: getCId(),
size: this.pageSize keyword: keyword.value
} }
// 只对参赛号模糊搜索 // 发起请求
if (!this.isEnroll && this.keyword) { const url = isPlayerList.value ? PLAYERS_URL : MARK_NO_URL
params.markNo = this.keyword const [err, res] = await to(fetch(url, {
} method: "POST",
$.ajax({ headers: {
type: 'post', 'Content-Type': 'application/json'
contentType: 'application/json',
url,
data: JSON.stringify(params),
beforeSend: () => {
layer.load()
},
complete: () => {
layer.closeAll()
}, },
success: (res) => { body: JSON.stringify(params)
this.list = res.data.records }).then(res => res.json()))
if (res.data.records.length === this.pageSize) { loading.value = false
this.totalPage = this.page + 1 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
getStats() { const [err, res] = await to(fetch(RANDOM_ASSIGN_URL, {
const url = eccUrl + (this.isEnroll ? '/api-pick/v1/enroll-page' : '/api-pick/v1/mark-list') method: "GET",
let apis = [1, 0].map(v => headers: {
fetch(url, { 'Content-Type': 'application/json'
method: 'POST', }
}).then(res => res.json()))
loading.value = false
if (err) {
message.error(err)
return
}
if (res.code === 200) {
message.success('随机分配成功')
fetchData()
} else {
message.error(res.message)
}
}
// 获取统计 用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
}
if (res.code === 200) {
if (isPlayerList.value) {
statusOptions.value[1].total = res.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()
}) })
}).then(res => res.json()) return {
) // 自助选号相关
Promise.all(apis).then(([res1, res2]) => { updateStatus,
this.statusOptions[1].count = res1.data.total updateTab,
this.statusOptions[2].count = res2.data.total fileList,
list,
query,
pagination,
playersColumns,
markNoColumns,
isPlayerList,
showModal,
// 文件相关
keyword,
fetchData,
tabIndex,
randomAssign,
// 公共数据
loading,
StatusEnum,
ListEnum,
statusOptions,
// 名单导出
exportExcel,
download,
uploadFinish,
fileList,
onChange,
PLAYER,
MARK_NO,
}
}
}) })
}, const app = Vue.createApp({
setup() {
return {
locale: zhCN,
dateLocale: dateZhCN
} }
}); }
})
app.component('my-app', MyApp)
app.use(naive)
app.mount('#app')
</script> </script>
</body> </body>
......
...@@ -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