| @ -1,4 +1,4 @@ | |||
| NODE_ENV=production | |||
| VUE_APP_API_BASE_URL=http://localhost:8000/jewelry-admin/ | |||
| VUE_APP_API_BASE_URL=http://localhost:8001/jewelry-admin/ | |||
| VUE_APP_CAS_BASE_URL=http://localhost:8888/cas | |||
| VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview | |||
| @ -0,0 +1,20 @@ | |||
| package org.jeecg.api.bean; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| @Data | |||
| public class PageBean { | |||
| /**显示条数*/ | |||
| @ApiModelProperty(value = "显示条数" ) | |||
| private Integer pageSize; | |||
| /**当前页*/ | |||
| @ApiModelProperty(value = "当前页" ) | |||
| private Integer pageNo; | |||
| public PageBean() { | |||
| this.pageNo = 1; | |||
| this.pageSize = 1000; | |||
| } | |||
| } | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.api.bean; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| @Data | |||
| public class WxQrCodeVo { | |||
| /**图片地址*/ | |||
| @ApiModelProperty(value = "图片地址") | |||
| private String url; | |||
| @ApiModelProperty(value = "加油站名称") | |||
| private String name; | |||
| } | |||
| @ -0,0 +1,217 @@ | |||
| package org.jeecg.api.controller; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecg.api.bean.PageBean; | |||
| import org.jeecg.api.service.AppletIndexService; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.annotation.Resource; | |||
| /** | |||
| * 集中所有登录接口 | |||
| */ | |||
| @Api(tags="珠宝项目-首页接口") | |||
| @RestController | |||
| @RequestMapping("/index_common") | |||
| @Slf4j | |||
| public class AppletIndexController { | |||
| @Resource | |||
| private AppletIndexService apiRiceService; | |||
| //获取首页轮播图 | |||
| @ApiOperation(value="获取首页轮播图", notes="获取首页轮播图") | |||
| @GetMapping(value = "/getRiceBanner") | |||
| public Result<?> getRiceBanner() { | |||
| return apiRiceService.getRiceBanner(); | |||
| } | |||
| //获取首页公告列表 | |||
| @ApiOperation(value="获取首页公告列表", notes="获取首页公告列表") | |||
| @GetMapping(value = "/getRiceNoticeList") | |||
| public Result<?> getRiceNoticeList() { | |||
| return apiRiceService.getRiceNoticeList(); | |||
| } | |||
| //获取会员信息 | |||
| @ApiOperation(value="获取会员信息", notes="获取会员信息") | |||
| @GetMapping(value = "/getVipInfoList") | |||
| public Result<?> getVipInfoList(){ | |||
| return apiRiceService.getVipInfoList(); | |||
| } | |||
| //获取首页跳转图标 | |||
| @ApiOperation(value="获取首页跳转图标", notes="获取首页跳转图标") | |||
| @GetMapping(value = "/getRiceIconList") | |||
| public Result<?> getRiceIconList() { | |||
| return apiRiceService.getRiceIconList(); | |||
| } | |||
| //获取首页广告列表 | |||
| @ApiOperation(value="获取首页广告列表", notes="获取首页广告列表") | |||
| @GetMapping(value = "/getRiceAdList") | |||
| public Result<?> getRiceAdList(PageBean pageBean) { | |||
| return apiRiceService.getRiceAdList(pageBean); | |||
| } | |||
| //获取分类分页商品列表接口 | |||
| @ApiOperation(value="获取分类分页商品列表接口", notes="获取分类分页商品列表接口") | |||
| @GetMapping(value = "/getClassShopPageList") | |||
| public Result<?> getClassShopPageList(PageBean pageBean, String classId) { | |||
| return apiRiceService.getClassShopPageList(pageBean,classId); | |||
| } | |||
| //获取首页商品详情 | |||
| @ApiOperation(value="获取首页商品详情", notes="获取首页商品详情") | |||
| @GetMapping(value = "/getRiceProductDetail") | |||
| public Result<?> getRiceProductDetail(String id) { | |||
| return apiRiceService.getRiceProductDetail(id); | |||
| } | |||
| //获取首页新闻列表 | |||
| @ApiOperation(value="获取首页新闻列表", notes="获取首页新闻列表") | |||
| @GetMapping(value = "/getRiceNewsList") | |||
| public Result<?> getRiceNewsList() { | |||
| return apiRiceService.getRiceNewsList(); | |||
| } | |||
| //加入购物车 传入token shopId num | |||
| @ApiOperation(value="加入购物车 传入token shopId num", notes="加入购物车 传入token shopId num") | |||
| @GetMapping(value = "/addCart") | |||
| public Result<?> addCart(@RequestHeader("X-Access-Token") String token, String shopId, Integer num){ | |||
| return apiRiceService.addCart(token,shopId,num); | |||
| } | |||
| //删除购物车信息 | |||
| @ApiOperation(value="删除购物车信息", notes="删除购物车信息") | |||
| @DeleteMapping(value = "/deleteCart") | |||
| public Result<?> deleteCart(@RequestHeader("X-Access-Token") String token,String ids){ | |||
| return apiRiceService.deleteCart(token,ids); | |||
| } | |||
| //修改购物车信息数量 | |||
| @ApiOperation(value="修改购物车信息数量", notes="修改购物车信息数量") | |||
| @PostMapping(value = "/updateCartNum") | |||
| public Result<?> updateCartNum(@RequestHeader("X-Access-Token") String token,String id,Integer num){ | |||
| return apiRiceService.updateCartNum(token,id,num); | |||
| } | |||
| //查询分类接口 | |||
| @ApiOperation(value="查询分类接口", notes="查询分类接口") | |||
| @GetMapping(value = "/getCategoryList") | |||
| private Result<?> getCategoryList(){ | |||
| return apiRiceService.getCategoryList(); | |||
| } | |||
| //创建订单 | |||
| @ApiOperation(value="创建订单", notes="创建订单") | |||
| @GetMapping(value = "/createOrder") | |||
| public Result<?> createOrder(@RequestHeader("X-Access-Token") String token, String shopId, Integer num,String addressId) { | |||
| return apiRiceService.createOrder(token,shopId,num,addressId); | |||
| } | |||
| //创建订单 | |||
| @ApiOperation(value="创建订单-再次支付", notes="创建订单-再次支付") | |||
| @GetMapping(value = "/createOrderTwo") | |||
| public Result<?> createOrderTwo(@RequestHeader("X-Access-Token") String token,String orderId) { | |||
| return apiRiceService.createOrderTwo(token,orderId); | |||
| } | |||
| //商城-加入购物车之后一次下多个订单 | |||
| @ApiOperation(value="商城-加入购物车之后一次下多个订单", notes="商城-加入购物车之后一次下多个订单") | |||
| @PostMapping("/createSumOrder") | |||
| public Result<?> createSumOrder(@RequestHeader("X-Access-Token") String token,String list,String addressId){ | |||
| return apiRiceService.createSumOrder(token,list,addressId); | |||
| } | |||
| //商城-加入购物车之后一次下多个订单 - 再次下单 | |||
| @ApiOperation(value="商城-加入购物车之后一次下多个订单 - 再次下单", notes="商城-加入购物车之后一次下多个订单 - 再次下单") | |||
| @PostMapping("/createSumOrderAgain") | |||
| public Result<?> createSumOrderAgain(@RequestHeader("X-Access-Token") String token,String orderId){ | |||
| return apiRiceService.createSumOrderAgain(token,orderId); | |||
| } | |||
| @PostMapping("/payNotify") | |||
| public Object payNotify(@RequestBody String requestBody){ | |||
| return apiRiceService.payNotify(requestBody); | |||
| } | |||
| //确认收货 | |||
| @ApiOperation(value="确认收货", notes="确认收货") | |||
| @GetMapping(value = "/confirmOrder") | |||
| public Result<?> confirmOrder(@RequestHeader("X-Access-Token") String token,String orderId) { | |||
| return apiRiceService.confirmOrder(token,orderId); | |||
| } | |||
| } | |||
| @ -0,0 +1,156 @@ | |||
| package org.jeecg.api.controller; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecg.api.bean.PageBean; | |||
| import org.jeecg.api.service.AppletIndexService; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.commonAddress.entity.CommonAddress; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.annotation.Resource; | |||
| import java.math.BigDecimal; | |||
| @Api(tags="珠宝项目-个人中心接口") | |||
| @RestController | |||
| @RequestMapping("/info_common") | |||
| @Slf4j | |||
| public class AppletInfoController { | |||
| @Resource | |||
| private AppletIndexService apiRiceService; | |||
| //获取优惠券信息 | |||
| @ApiOperation(value="获取优惠券信息", notes="获取优惠券信息") | |||
| @GetMapping(value = "/getRiceCouponList") | |||
| public Result<?> getRiceCouponList(@RequestHeader("X-Access-Token") String token,PageBean pageBean) { | |||
| return apiRiceService.getRiceCouponList(token,pageBean); | |||
| } | |||
| //获取流水记录带分页 | |||
| @ApiOperation(value="获取流水记录带分页", notes="获取流水记录带分页") | |||
| @GetMapping(value = "/getWaterPageList") | |||
| public Result<?> getWaterPageList(@RequestHeader("X-Access-Token") String token, PageBean pageBean){ | |||
| return apiRiceService.getWaterPageList(token,pageBean); | |||
| } | |||
| //获取订单列表带分页 | |||
| @ApiOperation(value="获取订单列表带分页", notes="获取订单列表带分页") | |||
| @GetMapping(value = "/getOrderPageList") | |||
| public Result<?> getOrderPageList(@RequestHeader("X-Access-Token") String token, PageBean pageBean,Integer state){ | |||
| return apiRiceService.getOrderPageList(token,pageBean,state); | |||
| } | |||
| //获取订单详情 | |||
| @ApiOperation(value="获取订单详情", notes="获取订单详情") | |||
| @GetMapping(value = "/getOrderDetail") | |||
| public Result<?> getOrderDetail(@RequestHeader("X-Access-Token") String token,String id){ | |||
| return apiRiceService.getOrderDetail(token,id); | |||
| } | |||
| //获取地址列表带分页 | |||
| @ApiOperation(value="获取地址列表带分页", notes="获取地址列表带分页") | |||
| @GetMapping(value = "/getAddressPageList") | |||
| public Result<?> getAddressPageList(@RequestHeader("X-Access-Token") String token,PageBean pageBean){ | |||
| return apiRiceService.getAddressPageList(token,pageBean); | |||
| } | |||
| //获取粉丝列表带分页 | |||
| @ApiOperation(value="获取粉丝列表带分页", notes="获取粉丝列表带分页") | |||
| @GetMapping(value = "/getFansPageList") | |||
| public Result<?> getFansPageList(@RequestHeader("X-Access-Token") String token,PageBean pageBean,String title){ | |||
| return apiRiceService.getFansPageList(token,pageBean,title); | |||
| } | |||
| //获取个人邀请码 | |||
| @ApiOperation(value="获取个人邀请码", notes="获取个人邀请码") | |||
| @GetMapping(value = "/getInviteCode") | |||
| public Result<?> getInviteCode(@RequestHeader("X-Access-Token") String token){ | |||
| return apiRiceService.getInviteCode(token); | |||
| } | |||
| //获取购物车信息列表带分页 | |||
| @ApiOperation(value="获取购物车信息列表带分页", notes="获取购物车信息列表带分页") | |||
| @GetMapping(value = "/getCartPageList") | |||
| public Result<?> getCartPageList(@RequestHeader("X-Access-Token") String token,PageBean pageBean){ | |||
| return apiRiceService.getCartPageList(token,pageBean); | |||
| } | |||
| //获取相关介绍 | |||
| @ApiOperation(value="获取相关介绍", notes="获取相关介绍") | |||
| @GetMapping(value = "/getInfoIntroduce") | |||
| public Result<?> getInfoIntroduce(String type){ | |||
| return apiRiceService.getInfoIntroduce(type); | |||
| } | |||
| //增加或修改地址信息 | |||
| @ApiOperation(value="增加或修改地址信息", notes="增加或修改地址信息") | |||
| @PostMapping(value = "/addOrUpdateAddress") | |||
| public Result<?> addOrUpdateAddress(@RequestHeader("X-Access-Token") String token, CommonAddress commonAddress){ | |||
| return apiRiceService.addOrUpdateAddress(token,commonAddress); | |||
| } | |||
| //删除地址 | |||
| @ApiOperation(value="删除地址", notes="删除地址") | |||
| @GetMapping(value = "/deleteAddress") | |||
| public Result<?> deleteAddress(@RequestHeader("X-Access-Token") String token,String id){ | |||
| return apiRiceService.deleteAddress(token,id); | |||
| } | |||
| //修改默认地址 | |||
| @ApiOperation(value="修改默认地址", notes="修改默认地址") | |||
| @GetMapping(value = "/updateDefaultAddress") | |||
| public Result<?> updateDefaultAddress(@RequestHeader("X-Access-Token") String token,String id){ | |||
| return apiRiceService.updateDefaultAddress(token,id); | |||
| } | |||
| //查询个人信息相关 | |||
| @ApiOperation(value="查询个人信息相关", notes="查询个人信息相关") | |||
| @GetMapping(value = "/getRiceInfo") | |||
| public Result<?> getRiceInfo(String token){ | |||
| return apiRiceService.getRiceInfo(token); | |||
| } | |||
| //充值 | |||
| @ApiOperation(value="充值", notes="充值") | |||
| @GetMapping(value = "/recharge") | |||
| public Result<?> recharge(@RequestHeader("X-Access-Token") String token, BigDecimal money){ | |||
| return apiRiceService.recharge(token,money); | |||
| } | |||
| //提现 | |||
| @ApiOperation(value="提现", notes="提现") | |||
| @GetMapping(value = "/withdraw") | |||
| public Result<?> withdraw(@RequestHeader("X-Access-Token") String token,BigDecimal money,String bankName,String bankNo){ | |||
| return apiRiceService.withdraw(token,money,bankName,bankNo); | |||
| } | |||
| } | |||
| @ -0,0 +1,131 @@ | |||
| package org.jeecg.api.service; | |||
| import org.jeecg.api.bean.PageBean; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.modules.commonAddress.entity.CommonAddress; | |||
| import org.springframework.web.bind.annotation.RequestHeader; | |||
| import java.math.BigDecimal; | |||
| public interface AppletIndexService { | |||
| //获取首页轮播图 | |||
| Result<?> getRiceBanner(); | |||
| //获取首页公告列表 | |||
| Result<?> getRiceNoticeList(); | |||
| //获取首页跳转图标 | |||
| Result<?> getRiceIconList(); | |||
| //获取会员信息 | |||
| Result<?> getVipInfoList(); | |||
| //获取首页广告列表 | |||
| Result<?> getRiceAdList(PageBean pageBean); | |||
| //获取首页商品详情 | |||
| Result<?> getRiceProductDetail(String id); | |||
| //获取首页新闻列表 | |||
| Result<?> getRiceNewsList(); | |||
| //创建订单 | |||
| Result<?> createOrder(String token,String shopId,Integer num,String addressId); | |||
| //再次支付 | |||
| Result<?> createOrderTwo(String token,String orderId); | |||
| //商城-立即购买多少商品 | |||
| Result<?> createSumOrder(String token,String list,String addressId); | |||
| //商城-加入购物车之后一次下多个订单 - 再次下单 | |||
| Result<?> createSumOrderAgain(String token,String orderId); | |||
| //商城-支付回调 | |||
| Object payNotify(String requestBody); | |||
| //加入购物车 | |||
| Result<?> addCart(String token,String shopId,Integer num); | |||
| //删除购物车信息 | |||
| Result<?> deleteCart(String token,String ids); | |||
| //修改购物车信息数量 | |||
| Result<?> updateCartNum(String token,String id,Integer num); | |||
| Result<?> getClassShopPageList(PageBean pageBean, String classId); | |||
| //获取优惠券信息列表 | |||
| Result<?> getRiceCouponList(String token, PageBean pageBean); | |||
| //获取流水记录带分页 | |||
| Result<?> getWaterPageList(String token,PageBean pageBean); | |||
| //获取订单列表带分页 | |||
| Result<?> getOrderPageList(String token, PageBean pageBean,Integer state); | |||
| //获取订单详情 | |||
| Result<?> getOrderDetail(String token, String id); | |||
| //获取粉丝列表带分页 | |||
| Result<?> getFansPageList(String token,PageBean pageBean,String title); | |||
| //获取购物车信息列表带分页 | |||
| Result<?> getCartPageList(String token,PageBean pageBean); | |||
| //获取地址列表带分页 | |||
| Result<?> getAddressPageList(String token,PageBean pageBean); | |||
| //获取个人邀请码 | |||
| Result<?> getInviteCode(String token); | |||
| //获取相关介绍 | |||
| Result<?> getInfoIntroduce(String type); | |||
| //查询分类的接口 | |||
| Result<?> getCategoryList(); | |||
| //增加或者修改地址 | |||
| Result<?> addOrUpdateAddress(String token, CommonAddress commonAddress); | |||
| //删除地址 | |||
| Result<?> deleteAddress(String token,String id); | |||
| //修改默认地址 | |||
| Result<?> updateDefaultAddress(String token,String id); | |||
| //查询个人信息相关 | |||
| Result<?> getRiceInfo(String token); | |||
| //充值 | |||
| Result<?> recharge(String token, BigDecimal money); | |||
| //提现 | |||
| Result<?> withdraw(String token,BigDecimal money,String bankName,String bankNo); | |||
| //确认收货 | |||
| Result<?> confirmOrder(String token,String orderId); | |||
| } | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.commonCoupon.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.commonCoupon.entity.CommonCoupon; | |||
| import org.jeecg.modules.commonCoupon.service.ICommonCouponService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 优惠券活动 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="优惠券活动") | |||
| @RestController | |||
| @RequestMapping("/commonCoupon/commonCoupon") | |||
| @Slf4j | |||
| public class CommonCouponController extends JeecgController<CommonCoupon, ICommonCouponService> { | |||
| @Autowired | |||
| private ICommonCouponService commonCouponService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param commonCoupon | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "优惠券活动-分页列表查询") | |||
| @ApiOperation(value="优惠券活动-分页列表查询", notes="优惠券活动-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<CommonCoupon>> queryPageList(CommonCoupon commonCoupon, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<CommonCoupon> queryWrapper = QueryGenerator.initQueryWrapper(commonCoupon, req.getParameterMap()); | |||
| Page<CommonCoupon> page = new Page<CommonCoupon>(pageNo, pageSize); | |||
| IPage<CommonCoupon> pageList = commonCouponService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param commonCoupon | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "优惠券活动-添加") | |||
| @ApiOperation(value="优惠券活动-添加", notes="优惠券活动-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody CommonCoupon commonCoupon) { | |||
| commonCouponService.save(commonCoupon); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param commonCoupon | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "优惠券活动-编辑") | |||
| @ApiOperation(value="优惠券活动-编辑", notes="优惠券活动-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody CommonCoupon commonCoupon) { | |||
| commonCouponService.updateById(commonCoupon); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "优惠券活动-通过id删除") | |||
| @ApiOperation(value="优惠券活动-通过id删除", notes="优惠券活动-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| commonCouponService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "优惠券活动-批量删除") | |||
| @ApiOperation(value="优惠券活动-批量删除", notes="优惠券活动-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.commonCouponService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "优惠券活动-通过id查询") | |||
| @ApiOperation(value="优惠券活动-通过id查询", notes="优惠券活动-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<CommonCoupon> queryById(@RequestParam(name="id",required=true) String id) { | |||
| CommonCoupon commonCoupon = commonCouponService.getById(id); | |||
| if(commonCoupon==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(commonCoupon); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param commonCoupon | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, CommonCoupon commonCoupon) { | |||
| return super.exportXls(request, commonCoupon, CommonCoupon.class, "优惠券活动"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, CommonCoupon.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,78 @@ | |||
| package org.jeecg.modules.commonCoupon.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 优惠券活动 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("common_coupon") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="common_coupon对象", description="优惠券活动") | |||
| public class CommonCoupon implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**金额*/ | |||
| @Excel(name = "金额", width = 15) | |||
| @ApiModelProperty(value = "金额") | |||
| private java.math.BigDecimal money; | |||
| /**满多少可用*/ | |||
| @Excel(name = "满多少可用", width = 15) | |||
| @ApiModelProperty(value = "满多少可用") | |||
| private java.math.BigDecimal useMoney; | |||
| /**结束时间*/ | |||
| @Excel(name = "结束时间", width = 15) | |||
| @ApiModelProperty(value = "结束时间") | |||
| private java.util.Date endTime; | |||
| /**优惠券备注*/ | |||
| @Excel(name = "优惠券备注", width = 15) | |||
| @ApiModelProperty(value = "优惠券备注") | |||
| private java.lang.String type; | |||
| /**使用时间*/ | |||
| @Excel(name = "使用时间", width = 15) | |||
| @ApiModelProperty(value = "使用时间") | |||
| private java.util.Date stateTime; | |||
| /**使用用户*/ | |||
| @Excel(name = "使用用户", width = 15) | |||
| @ApiModelProperty(value = "使用用户") | |||
| private java.lang.String userId; | |||
| /**使用状态*/ | |||
| @Excel(name = "使用状态", width = 15) | |||
| @ApiModelProperty(value = "使用状态") | |||
| private java.lang.Integer state; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.commonCoupon.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.commonCoupon.entity.CommonCoupon; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 优惠券活动 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface CommonCouponMapper extends BaseMapper<CommonCoupon> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="org.jeecg.modules.commonCoupon.mapper.CommonCouponMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.commonCoupon.service; | |||
| import org.jeecg.modules.commonCoupon.entity.CommonCoupon; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 优惠券活动 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface ICommonCouponService extends IService<CommonCoupon> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.commonCoupon.service.impl; | |||
| import org.jeecg.modules.commonCoupon.entity.CommonCoupon; | |||
| import org.jeecg.modules.commonCoupon.mapper.CommonCouponMapper; | |||
| import org.jeecg.modules.commonCoupon.service.ICommonCouponService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 优惠券活动 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class CommonCouponServiceImpl extends ServiceImpl<CommonCouponMapper, CommonCoupon> implements ICommonCouponService { | |||
| } | |||
| @ -0,0 +1,207 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('优惠券活动')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <common-coupon-modal ref="modalForm" @ok="modalFormOk"></common-coupon-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import CommonCouponModal from './modules/CommonCouponModal' | |||
| export default { | |||
| name: 'CommonCouponList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| CommonCouponModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '优惠券活动管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'金额', | |||
| align:"center", | |||
| dataIndex: 'money' | |||
| }, | |||
| { | |||
| title:'满多少可用', | |||
| align:"center", | |||
| dataIndex: 'useMoney' | |||
| }, | |||
| { | |||
| title:'结束时间', | |||
| align:"center", | |||
| dataIndex: 'endTime' | |||
| }, | |||
| { | |||
| title:'优惠券备注', | |||
| align:"center", | |||
| dataIndex: 'type' | |||
| }, | |||
| { | |||
| title:'使用时间', | |||
| align:"center", | |||
| dataIndex: 'stateTime' | |||
| }, | |||
| { | |||
| title:'使用用户', | |||
| align:"center", | |||
| dataIndex: 'userId' | |||
| }, | |||
| { | |||
| title:'使用状态', | |||
| align:"center", | |||
| dataIndex: 'state' | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/commonCoupon/commonCoupon/list", | |||
| delete: "/commonCoupon/commonCoupon/delete", | |||
| deleteBatch: "/commonCoupon/commonCoupon/deleteBatch", | |||
| exportXlsUrl: "/commonCoupon/commonCoupon/exportXls", | |||
| importExcelUrl: "commonCoupon/commonCoupon/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'BigDecimal',value:'money',text:'金额',dictCode:''}) | |||
| fieldList.push({type:'BigDecimal',value:'useMoney',text:'满多少可用',dictCode:''}) | |||
| fieldList.push({type:'datetime',value:'endTime',text:'结束时间'}) | |||
| fieldList.push({type:'string',value:'type',text:'优惠券备注',dictCode:''}) | |||
| fieldList.push({type:'datetime',value:'stateTime',text:'使用时间'}) | |||
| fieldList.push({type:'string',value:'userId',text:'使用用户',dictCode:''}) | |||
| fieldList.push({type:'int',value:'state',text:'使用状态',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,134 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money"> | |||
| <a-input-number v-model="model.money" placeholder="请输入金额" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="满多少可用" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="useMoney"> | |||
| <a-input-number v-model="model.useMoney" placeholder="请输入满多少可用" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="endTime"> | |||
| <j-date placeholder="请选择结束时间" v-model="model.endTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="优惠券备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> | |||
| <a-input v-model="model.type" placeholder="请输入优惠券备注" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="使用时间" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stateTime"> | |||
| <j-date placeholder="请选择使用时间" v-model="model.stateTime" :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="使用用户" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> | |||
| <a-input v-model="model.userId" placeholder="请输入使用用户" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="使用状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="state"> | |||
| <a-input-number v-model="model.state" placeholder="请输入使用状态" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'CommonCouponForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/commonCoupon/commonCoupon/add", | |||
| edit: "/commonCoupon/commonCoupon/edit", | |||
| queryById: "/commonCoupon/commonCoupon/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <common-coupon-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></common-coupon-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import CommonCouponForm from './CommonCouponForm' | |||
| export default { | |||
| name: 'CommonCouponModal', | |||
| components: { | |||
| CommonCouponForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <common-coupon-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></common-coupon-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import CommonCouponForm from './CommonCouponForm' | |||
| export default { | |||
| name: 'CommonCouponModal', | |||
| components: { | |||
| CommonCouponForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/commonCoupon/commonCoupon/list', | |||
| save='/commonCoupon/commonCoupon/add', | |||
| edit='/commonCoupon/commonCoupon/edit', | |||
| deleteOne = '/commonCoupon/commonCoupon/delete', | |||
| deleteBatch = '/commonCoupon/commonCoupon/deleteBatch', | |||
| importExcel = '/commonCoupon/commonCoupon/importExcel', | |||
| exportXls = '/commonCoupon/commonCoupon/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,83 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '金额', | |||
| align:"center", | |||
| dataIndex: 'money' | |||
| }, | |||
| { | |||
| title: '满多少可用', | |||
| align:"center", | |||
| dataIndex: 'useMoney' | |||
| }, | |||
| { | |||
| title: '结束时间', | |||
| align:"center", | |||
| dataIndex: 'endTime' | |||
| }, | |||
| { | |||
| title: '优惠券备注', | |||
| align:"center", | |||
| dataIndex: 'type' | |||
| }, | |||
| { | |||
| title: '使用时间', | |||
| align:"center", | |||
| dataIndex: 'stateTime' | |||
| }, | |||
| { | |||
| title: '使用用户', | |||
| align:"center", | |||
| dataIndex: 'userId' | |||
| }, | |||
| { | |||
| title: '使用状态', | |||
| align:"center", | |||
| dataIndex: 'state' | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '金额', | |||
| field: 'money', | |||
| component: 'InputNumber', | |||
| }, | |||
| { | |||
| label: '满多少可用', | |||
| field: 'useMoney', | |||
| component: 'InputNumber', | |||
| }, | |||
| { | |||
| label: '结束时间', | |||
| field: 'endTime', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '优惠券备注', | |||
| field: 'type', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '使用时间', | |||
| field: 'stateTime', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '使用用户', | |||
| field: 'userId', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '使用状态', | |||
| field: 'state', | |||
| component: 'InputNumber', | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <CommonCouponModal @register="registerModal" @success="handleSuccess"></CommonCouponModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="commonCoupon-commonCoupon" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import CommonCouponModal from './components/CommonCouponModal.vue' | |||
| import {columns, searchFormSchema} from './commonCoupon.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './commonCoupon.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '优惠券活动', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"优惠券活动", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../commonCoupon.data'; | |||
| import {saveOrUpdate} from '../commonCoupon.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.commonIcon.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.commonIcon.entity.CommonIcon; | |||
| import org.jeecg.modules.commonIcon.service.ICommonIconService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 广告位信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="广告位信息表") | |||
| @RestController | |||
| @RequestMapping("/commonIcon/commonIcon") | |||
| @Slf4j | |||
| public class CommonIconController extends JeecgController<CommonIcon, ICommonIconService> { | |||
| @Autowired | |||
| private ICommonIconService commonIconService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param commonIcon | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "广告位信息表-分页列表查询") | |||
| @ApiOperation(value="广告位信息表-分页列表查询", notes="广告位信息表-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<CommonIcon>> queryPageList(CommonIcon commonIcon, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<CommonIcon> queryWrapper = QueryGenerator.initQueryWrapper(commonIcon, req.getParameterMap()); | |||
| Page<CommonIcon> page = new Page<CommonIcon>(pageNo, pageSize); | |||
| IPage<CommonIcon> pageList = commonIconService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param commonIcon | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "广告位信息表-添加") | |||
| @ApiOperation(value="广告位信息表-添加", notes="广告位信息表-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody CommonIcon commonIcon) { | |||
| commonIconService.save(commonIcon); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param commonIcon | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "广告位信息表-编辑") | |||
| @ApiOperation(value="广告位信息表-编辑", notes="广告位信息表-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody CommonIcon commonIcon) { | |||
| commonIconService.updateById(commonIcon); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "广告位信息表-通过id删除") | |||
| @ApiOperation(value="广告位信息表-通过id删除", notes="广告位信息表-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| commonIconService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "广告位信息表-批量删除") | |||
| @ApiOperation(value="广告位信息表-批量删除", notes="广告位信息表-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.commonIconService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "广告位信息表-通过id查询") | |||
| @ApiOperation(value="广告位信息表-通过id查询", notes="广告位信息表-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<CommonIcon> queryById(@RequestParam(name="id",required=true) String id) { | |||
| CommonIcon commonIcon = commonIconService.getById(id); | |||
| if(commonIcon==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(commonIcon); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param commonIcon | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, CommonIcon commonIcon) { | |||
| return super.exportXls(request, commonIcon, CommonIcon.class, "广告位信息表"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, CommonIcon.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,74 @@ | |||
| package org.jeecg.modules.commonIcon.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 广告位信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("common_icon") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="common_icon对象", description="广告位信息表") | |||
| public class CommonIcon implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**标题*/ | |||
| @Excel(name = "标题", width = 15) | |||
| @ApiModelProperty(value = "标题") | |||
| private java.lang.String title; | |||
| /**价格*/ | |||
| @Excel(name = "价格", width = 15) | |||
| @ApiModelProperty(value = "价格") | |||
| private java.math.BigDecimal price; | |||
| /**主图*/ | |||
| @Excel(name = "主图", width = 15) | |||
| @ApiModelProperty(value = "主图") | |||
| private java.lang.String icon; | |||
| /**跳转地址*/ | |||
| @Excel(name = "跳转地址", width = 15) | |||
| @ApiModelProperty(value = "跳转地址") | |||
| private java.lang.String url; | |||
| /**排序*/ | |||
| @Excel(name = "排序", width = 15) | |||
| @ApiModelProperty(value = "排序") | |||
| private java.lang.Integer sort; | |||
| /**详情*/ | |||
| @Excel(name = "详情", width = 15) | |||
| @ApiModelProperty(value = "详情") | |||
| private java.lang.String details; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.commonIcon.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.commonIcon.entity.CommonIcon; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 广告位信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface CommonIconMapper extends BaseMapper<CommonIcon> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="org.jeecg.modules.commonIcon.mapper.CommonIconMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.commonIcon.service; | |||
| import org.jeecg.modules.commonIcon.entity.CommonIcon; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 广告位信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface ICommonIconService extends IService<CommonIcon> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.commonIcon.service.impl; | |||
| import org.jeecg.modules.commonIcon.entity.CommonIcon; | |||
| import org.jeecg.modules.commonIcon.mapper.CommonIconMapper; | |||
| import org.jeecg.modules.commonIcon.service.ICommonIconService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 广告位信息表 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class CommonIconServiceImpl extends ServiceImpl<CommonIconMapper, CommonIcon> implements ICommonIconService { | |||
| } | |||
| @ -0,0 +1,203 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('广告位信息表')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <common-icon-modal ref="modalForm" @ok="modalFormOk"></common-icon-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import CommonIconModal from './modules/CommonIconModal' | |||
| export default { | |||
| name: 'CommonIconList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| CommonIconModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '广告位信息表管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title:'价格', | |||
| align:"center", | |||
| dataIndex: 'price' | |||
| }, | |||
| { | |||
| title:'主图', | |||
| align:"center", | |||
| dataIndex: 'icon', | |||
| scopedSlots: {customRender: 'imgSlot'} | |||
| }, | |||
| { | |||
| title:'跳转地址', | |||
| align:"center", | |||
| dataIndex: 'url' | |||
| }, | |||
| { | |||
| title:'排序', | |||
| align:"center", | |||
| dataIndex: 'sort' | |||
| }, | |||
| { | |||
| title:'详情', | |||
| align:"center", | |||
| dataIndex: 'details', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/commonIcon/commonIcon/list", | |||
| delete: "/commonIcon/commonIcon/delete", | |||
| deleteBatch: "/commonIcon/commonIcon/deleteBatch", | |||
| exportXlsUrl: "/commonIcon/commonIcon/exportXls", | |||
| importExcelUrl: "commonIcon/commonIcon/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'标题',dictCode:''}) | |||
| fieldList.push({type:'BigDecimal',value:'price',text:'价格',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'icon',text:'主图',dictCode:''}) | |||
| fieldList.push({type:'string',value:'url',text:'跳转地址',dictCode:''}) | |||
| fieldList.push({type:'int',value:'sort',text:'排序',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'details',text:'详情',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,129 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
| <a-input v-model="model.title" placeholder="请输入标题" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="价格" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price"> | |||
| <a-input-number v-model="model.price" placeholder="请输入价格" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="主图" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="icon"> | |||
| <j-image-upload isMultiple v-model="model.icon" ></j-image-upload> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="跳转地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url"> | |||
| <a-input v-model="model.url" placeholder="请输入跳转地址" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="sort"> | |||
| <a-input-number v-model="model.sort" placeholder="请输入排序" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="详情" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="details"> | |||
| <j-editor v-model="model.details" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'CommonIconForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/commonIcon/commonIcon/add", | |||
| edit: "/commonIcon/commonIcon/edit", | |||
| queryById: "/commonIcon/commonIcon/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <common-icon-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></common-icon-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import CommonIconForm from './CommonIconForm' | |||
| export default { | |||
| name: 'CommonIconModal', | |||
| components: { | |||
| CommonIconForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <common-icon-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></common-icon-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import CommonIconForm from './CommonIconForm' | |||
| export default { | |||
| name: 'CommonIconModal', | |||
| components: { | |||
| CommonIconForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/commonIcon/commonIcon/list', | |||
| save='/commonIcon/commonIcon/add', | |||
| edit='/commonIcon/commonIcon/edit', | |||
| deleteOne = '/commonIcon/commonIcon/delete', | |||
| deleteBatch = '/commonIcon/commonIcon/deleteBatch', | |||
| importExcel = '/commonIcon/commonIcon/importExcel', | |||
| exportXls = '/commonIcon/commonIcon/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,77 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '标题', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '价格', | |||
| align:"center", | |||
| dataIndex: 'price' | |||
| }, | |||
| { | |||
| title: '主图', | |||
| align:"center", | |||
| dataIndex: 'icon', | |||
| customRender:render.renderAvatar, | |||
| }, | |||
| { | |||
| title: '跳转地址', | |||
| align:"center", | |||
| dataIndex: 'url' | |||
| }, | |||
| { | |||
| title: '排序', | |||
| align:"center", | |||
| dataIndex: 'sort' | |||
| }, | |||
| { | |||
| title: '详情', | |||
| align:"center", | |||
| dataIndex: 'details', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '标题', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '价格', | |||
| field: 'price', | |||
| component: 'InputNumber', | |||
| }, | |||
| { | |||
| label: '主图', | |||
| field: 'icon', | |||
| component: 'JImageUpload', | |||
| componentProps:{ | |||
| }, | |||
| }, | |||
| { | |||
| label: '跳转地址', | |||
| field: 'url', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '排序', | |||
| field: 'sort', | |||
| component: 'InputNumber', | |||
| }, | |||
| { | |||
| label: '详情', | |||
| field: 'details', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <CommonIconModal @register="registerModal" @success="handleSuccess"></CommonIconModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="commonIcon-commonIcon" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import CommonIconModal from './components/CommonIconModal.vue' | |||
| import {columns, searchFormSchema} from './commonIcon.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './commonIcon.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '广告位信息表', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"广告位信息表", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../commonIcon.data'; | |||
| import {saveOrUpdate} from '../commonIcon.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||
| @ -0,0 +1,171 @@ | |||
| package org.jeecg.modules.commonVip.controller; | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| import java.io.IOException; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.net.URLDecoder; | |||
| import javax.servlet.http.HttpServletRequest; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import org.jeecg.common.api.vo.Result; | |||
| import org.jeecg.common.system.query.QueryGenerator; | |||
| import org.jeecg.common.util.oConvertUtils; | |||
| import org.jeecg.modules.commonVip.entity.CommonVip; | |||
| import org.jeecg.modules.commonVip.service.ICommonVipService; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.jeecgframework.poi.excel.ExcelImportUtil; | |||
| import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |||
| import org.jeecgframework.poi.excel.entity.ExportParams; | |||
| import org.jeecgframework.poi.excel.entity.ImportParams; | |||
| import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |||
| import org.jeecg.common.system.base.controller.JeecgController; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| import org.springframework.web.multipart.MultipartHttpServletRequest; | |||
| import org.springframework.web.servlet.ModelAndView; | |||
| import com.alibaba.fastjson.JSON; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.jeecg.common.aspect.annotation.AutoLog; | |||
| /** | |||
| * @Description: 会员信息内容 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Api(tags="会员信息内容") | |||
| @RestController | |||
| @RequestMapping("/commonVip/commonVip") | |||
| @Slf4j | |||
| public class CommonVipController extends JeecgController<CommonVip, ICommonVipService> { | |||
| @Autowired | |||
| private ICommonVipService commonVipService; | |||
| /** | |||
| * 分页列表查询 | |||
| * | |||
| * @param commonVip | |||
| * @param pageNo | |||
| * @param pageSize | |||
| * @param req | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "会员信息内容-分页列表查询") | |||
| @ApiOperation(value="会员信息内容-分页列表查询", notes="会员信息内容-分页列表查询") | |||
| @GetMapping(value = "/list") | |||
| public Result<IPage<CommonVip>> queryPageList(CommonVip commonVip, | |||
| @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |||
| @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |||
| HttpServletRequest req) { | |||
| QueryWrapper<CommonVip> queryWrapper = QueryGenerator.initQueryWrapper(commonVip, req.getParameterMap()); | |||
| Page<CommonVip> page = new Page<CommonVip>(pageNo, pageSize); | |||
| IPage<CommonVip> pageList = commonVipService.page(page, queryWrapper); | |||
| return Result.OK(pageList); | |||
| } | |||
| /** | |||
| * 添加 | |||
| * | |||
| * @param commonVip | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "会员信息内容-添加") | |||
| @ApiOperation(value="会员信息内容-添加", notes="会员信息内容-添加") | |||
| @PostMapping(value = "/add") | |||
| public Result<String> add(@RequestBody CommonVip commonVip) { | |||
| commonVipService.save(commonVip); | |||
| return Result.OK("添加成功!"); | |||
| } | |||
| /** | |||
| * 编辑 | |||
| * | |||
| * @param commonVip | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "会员信息内容-编辑") | |||
| @ApiOperation(value="会员信息内容-编辑", notes="会员信息内容-编辑") | |||
| @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |||
| public Result<String> edit(@RequestBody CommonVip commonVip) { | |||
| commonVipService.updateById(commonVip); | |||
| return Result.OK("编辑成功!"); | |||
| } | |||
| /** | |||
| * 通过id删除 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "会员信息内容-通过id删除") | |||
| @ApiOperation(value="会员信息内容-通过id删除", notes="会员信息内容-通过id删除") | |||
| @DeleteMapping(value = "/delete") | |||
| public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |||
| commonVipService.removeById(id); | |||
| return Result.OK("删除成功!"); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * | |||
| * @param ids | |||
| * @return | |||
| */ | |||
| @AutoLog(value = "会员信息内容-批量删除") | |||
| @ApiOperation(value="会员信息内容-批量删除", notes="会员信息内容-批量删除") | |||
| @DeleteMapping(value = "/deleteBatch") | |||
| public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |||
| this.commonVipService.removeByIds(Arrays.asList(ids.split(","))); | |||
| return Result.OK("批量删除成功!"); | |||
| } | |||
| /** | |||
| * 通过id查询 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| //@AutoLog(value = "会员信息内容-通过id查询") | |||
| @ApiOperation(value="会员信息内容-通过id查询", notes="会员信息内容-通过id查询") | |||
| @GetMapping(value = "/queryById") | |||
| public Result<CommonVip> queryById(@RequestParam(name="id",required=true) String id) { | |||
| CommonVip commonVip = commonVipService.getById(id); | |||
| if(commonVip==null) { | |||
| return Result.error("未找到对应数据"); | |||
| } | |||
| return Result.OK(commonVip); | |||
| } | |||
| /** | |||
| * 导出excel | |||
| * | |||
| * @param request | |||
| * @param commonVip | |||
| */ | |||
| @RequestMapping(value = "/exportXls") | |||
| public ModelAndView exportXls(HttpServletRequest request, CommonVip commonVip) { | |||
| return super.exportXls(request, commonVip, CommonVip.class, "会员信息内容"); | |||
| } | |||
| /** | |||
| * 通过excel导入数据 | |||
| * | |||
| * @param request | |||
| * @param response | |||
| * @return | |||
| */ | |||
| @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |||
| public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |||
| return super.importExcel(request, response, CommonVip.class); | |||
| } | |||
| } | |||
| @ -0,0 +1,73 @@ | |||
| package org.jeecg.modules.commonVip.entity; | |||
| import java.io.Serializable; | |||
| import java.io.UnsupportedEncodingException; | |||
| import java.util.Date; | |||
| import java.math.BigDecimal; | |||
| import com.baomidou.mybatisplus.annotation.IdType; | |||
| import com.baomidou.mybatisplus.annotation.TableId; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| import lombok.Data; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import org.springframework.format.annotation.DateTimeFormat; | |||
| import org.jeecgframework.poi.excel.annotation.Excel; | |||
| import org.jeecg.common.aspect.annotation.Dict; | |||
| import io.swagger.annotations.ApiModel; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.EqualsAndHashCode; | |||
| import lombok.experimental.Accessors; | |||
| /** | |||
| * @Description: 会员信息内容 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Data | |||
| @TableName("common_vip") | |||
| @Accessors(chain = true) | |||
| @EqualsAndHashCode(callSuper = false) | |||
| @ApiModel(value="common_vip对象", description="会员信息内容") | |||
| public class CommonVip implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /**主键*/ | |||
| @TableId(type = IdType.ASSIGN_ID) | |||
| @ApiModelProperty(value = "主键") | |||
| private java.lang.String id; | |||
| /**创建人*/ | |||
| @ApiModelProperty(value = "创建人") | |||
| private java.lang.String createBy; | |||
| /**创建日期*/ | |||
| @ApiModelProperty(value = "创建日期") | |||
| private java.util.Date createTime; | |||
| /**更新人*/ | |||
| @ApiModelProperty(value = "更新人") | |||
| private java.lang.String updateBy; | |||
| /**更新日期*/ | |||
| @ApiModelProperty(value = "更新日期") | |||
| private java.util.Date updateTime; | |||
| /**所属部门*/ | |||
| @ApiModelProperty(value = "所属部门") | |||
| private java.lang.String sysOrgCode; | |||
| /**名称*/ | |||
| @Excel(name = "名称", width = 15) | |||
| @ApiModelProperty(value = "名称") | |||
| private java.lang.String title; | |||
| /**小标题*/ | |||
| @Excel(name = "小标题", width = 15) | |||
| @ApiModelProperty(value = "小标题") | |||
| private java.lang.String subTitle; | |||
| /**图标*/ | |||
| @Excel(name = "图标", width = 15) | |||
| @ApiModelProperty(value = "图标") | |||
| private java.lang.String headImage; | |||
| /**累积满多少可成为*/ | |||
| @Excel(name = "累积满多少可成为", width = 15) | |||
| @ApiModelProperty(value = "累积满多少可成为") | |||
| private java.math.BigDecimal money; | |||
| /**会员权益*/ | |||
| @Excel(name = "会员权益", width = 15) | |||
| @ApiModelProperty(value = "会员权益") | |||
| private java.lang.String details; | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package org.jeecg.modules.commonVip.mapper; | |||
| import java.util.List; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import org.jeecg.modules.commonVip.entity.CommonVip; | |||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
| /** | |||
| * @Description: 会员信息内容 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface CommonVipMapper extends BaseMapper<CommonVip> { | |||
| } | |||
| @ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| <mapper namespace="org.jeecg.modules.commonVip.mapper.CommonVipMapper"> | |||
| </mapper> | |||
| @ -0,0 +1,14 @@ | |||
| package org.jeecg.modules.commonVip.service; | |||
| import org.jeecg.modules.commonVip.entity.CommonVip; | |||
| import com.baomidou.mybatisplus.extension.service.IService; | |||
| /** | |||
| * @Description: 会员信息内容 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| public interface ICommonVipService extends IService<CommonVip> { | |||
| } | |||
| @ -0,0 +1,19 @@ | |||
| package org.jeecg.modules.commonVip.service.impl; | |||
| import org.jeecg.modules.commonVip.entity.CommonVip; | |||
| import org.jeecg.modules.commonVip.mapper.CommonVipMapper; | |||
| import org.jeecg.modules.commonVip.service.ICommonVipService; | |||
| import org.springframework.stereotype.Service; | |||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
| /** | |||
| * @Description: 会员信息内容 | |||
| * @Author: jeecg-boot | |||
| * @Date: 2024-12-30 | |||
| * @Version: V1.0 | |||
| */ | |||
| @Service | |||
| public class CommonVipServiceImpl extends ServiceImpl<CommonVipMapper, CommonVip> implements ICommonVipService { | |||
| } | |||
| @ -0,0 +1,197 @@ | |||
| <template> | |||
| <a-card :bordered="false"> | |||
| <!-- 查询区域 --> | |||
| <div class="table-page-search-wrapper"> | |||
| <a-form layout="inline" @keyup.enter.native="searchQuery"> | |||
| <a-row :gutter="24"> | |||
| </a-row> | |||
| </a-form> | |||
| </div> | |||
| <!-- 查询区域-END --> | |||
| <!-- 操作按钮区域 --> | |||
| <div class="table-operator"> | |||
| <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |||
| <a-button type="primary" icon="download" @click="handleExportXls('会员信息内容')">导出</a-button> | |||
| <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |||
| <a-button type="primary" icon="import">导入</a-button> | |||
| </a-upload> | |||
| <!-- 高级查询区域 --> | |||
| <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |||
| <a-dropdown v-if="selectedRowKeys.length > 0"> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |||
| </a-menu> | |||
| <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |||
| </a-dropdown> | |||
| </div> | |||
| <!-- table区域-begin --> | |||
| <div> | |||
| <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |||
| <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |||
| <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |||
| </div> | |||
| <a-table | |||
| ref="table" | |||
| size="middle" | |||
| :scroll="{x:true}" | |||
| bordered | |||
| rowKey="id" | |||
| :columns="columns" | |||
| :dataSource="dataSource" | |||
| :pagination="ipagination" | |||
| :loading="loading" | |||
| :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |||
| class="j-table-force-nowrap" | |||
| @change="handleTableChange"> | |||
| <template slot="htmlSlot" slot-scope="text"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template slot="imgSlot" slot-scope="text,record"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |||
| <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |||
| </template> | |||
| <template slot="fileSlot" slot-scope="text"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button | |||
| v-else | |||
| :ghost="true" | |||
| type="primary" | |||
| icon="download" | |||
| size="small" | |||
| @click="downloadFile(text)"> | |||
| 下载 | |||
| </a-button> | |||
| </template> | |||
| <span slot="action" slot-scope="text, record"> | |||
| <a @click="handleEdit(record)">编辑</a> | |||
| <a-divider type="vertical" /> | |||
| <a-dropdown> | |||
| <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |||
| <a-menu slot="overlay"> | |||
| <a-menu-item> | |||
| <a @click="handleDetail(record)">详情</a> | |||
| </a-menu-item> | |||
| <a-menu-item> | |||
| <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |||
| <a>删除</a> | |||
| </a-popconfirm> | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </a-dropdown> | |||
| </span> | |||
| </a-table> | |||
| </div> | |||
| <common-vip-modal ref="modalForm" @ok="modalFormOk"></common-vip-modal> | |||
| </a-card> | |||
| </template> | |||
| <script> | |||
| import '@/assets/less/TableExpand.less' | |||
| import { mixinDevice } from '@/utils/mixin' | |||
| import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |||
| import CommonVipModal from './modules/CommonVipModal' | |||
| export default { | |||
| name: 'CommonVipList', | |||
| mixins:[JeecgListMixin, mixinDevice], | |||
| components: { | |||
| CommonVipModal | |||
| }, | |||
| data () { | |||
| return { | |||
| description: '会员信息内容管理页面', | |||
| // 表头 | |||
| columns: [ | |||
| { | |||
| title: '#', | |||
| dataIndex: '', | |||
| key:'rowIndex', | |||
| width:60, | |||
| align:"center", | |||
| customRender:function (t,r,index) { | |||
| return parseInt(index)+1; | |||
| } | |||
| }, | |||
| { | |||
| title:'名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title:'小标题', | |||
| align:"center", | |||
| dataIndex: 'subTitle' | |||
| }, | |||
| { | |||
| title:'图标', | |||
| align:"center", | |||
| dataIndex: 'headImage', | |||
| scopedSlots: {customRender: 'imgSlot'} | |||
| }, | |||
| { | |||
| title:'累积满多少可成为', | |||
| align:"center", | |||
| dataIndex: 'money' | |||
| }, | |||
| { | |||
| title:'会员权益', | |||
| align:"center", | |||
| dataIndex: 'details', | |||
| scopedSlots: {customRender: 'htmlSlot'} | |||
| }, | |||
| { | |||
| title: '操作', | |||
| dataIndex: 'action', | |||
| align:"center", | |||
| fixed:"right", | |||
| width:147, | |||
| scopedSlots: { customRender: 'action' } | |||
| } | |||
| ], | |||
| url: { | |||
| list: "/commonVip/commonVip/list", | |||
| delete: "/commonVip/commonVip/delete", | |||
| deleteBatch: "/commonVip/commonVip/deleteBatch", | |||
| exportXlsUrl: "/commonVip/commonVip/exportXls", | |||
| importExcelUrl: "commonVip/commonVip/importExcel", | |||
| }, | |||
| dictOptions:{}, | |||
| superFieldList:[], | |||
| } | |||
| }, | |||
| created() { | |||
| this.getSuperFieldList(); | |||
| }, | |||
| computed: { | |||
| importExcelUrl: function(){ | |||
| return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |||
| }, | |||
| }, | |||
| methods: { | |||
| initDictConfig(){ | |||
| }, | |||
| getSuperFieldList(){ | |||
| let fieldList=[]; | |||
| fieldList.push({type:'string',value:'title',text:'名称',dictCode:''}) | |||
| fieldList.push({type:'string',value:'subTitle',text:'小标题',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'headImage',text:'图标',dictCode:''}) | |||
| fieldList.push({type:'BigDecimal',value:'money',text:'累积满多少可成为',dictCode:''}) | |||
| fieldList.push({type:'Text',value:'details',text:'会员权益',dictCode:''}) | |||
| this.superFieldList = fieldList | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| @import '~@assets/less/common.less'; | |||
| </style> | |||
| @ -0,0 +1,124 @@ | |||
| <template> | |||
| <a-spin :spinning="confirmLoading"> | |||
| <j-form-container :disabled="formDisabled"> | |||
| <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |||
| <a-row> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="title"> | |||
| <a-input v-model="model.title" placeholder="请输入名称" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="小标题" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="subTitle"> | |||
| <a-input v-model="model.subTitle" placeholder="请输入小标题" ></a-input> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="图标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="headImage"> | |||
| <j-image-upload isMultiple v-model="model.headImage" ></j-image-upload> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="累积满多少可成为" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="money"> | |||
| <a-input-number v-model="model.money" placeholder="请输入累积满多少可成为" style="width: 100%" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| <a-col :span="24"> | |||
| <a-form-model-item label="会员权益" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="details"> | |||
| <j-editor v-model="model.details" /> | |||
| </a-form-model-item> | |||
| </a-col> | |||
| </a-row> | |||
| </a-form-model> | |||
| </j-form-container> | |||
| </a-spin> | |||
| </template> | |||
| <script> | |||
| import { httpAction, getAction } from '@/api/manage' | |||
| import { validateDuplicateValue } from '@/utils/util' | |||
| export default { | |||
| name: 'CommonVipForm', | |||
| components: { | |||
| }, | |||
| props: { | |||
| //表单禁用 | |||
| disabled: { | |||
| type: Boolean, | |||
| default: false, | |||
| required: false | |||
| } | |||
| }, | |||
| data () { | |||
| return { | |||
| model:{ | |||
| }, | |||
| labelCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 5 }, | |||
| }, | |||
| wrapperCol: { | |||
| xs: { span: 24 }, | |||
| sm: { span: 16 }, | |||
| }, | |||
| confirmLoading: false, | |||
| validatorRules: { | |||
| }, | |||
| url: { | |||
| add: "/commonVip/commonVip/add", | |||
| edit: "/commonVip/commonVip/edit", | |||
| queryById: "/commonVip/commonVip/queryById" | |||
| } | |||
| } | |||
| }, | |||
| computed: { | |||
| formDisabled(){ | |||
| return this.disabled | |||
| }, | |||
| }, | |||
| created () { | |||
| //备份model原始值 | |||
| this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.edit(this.modelDefault); | |||
| }, | |||
| edit (record) { | |||
| this.model = Object.assign({}, record); | |||
| this.visible = true; | |||
| }, | |||
| submitForm () { | |||
| const that = this; | |||
| // 触发表单验证 | |||
| this.$refs.form.validate(valid => { | |||
| if (valid) { | |||
| that.confirmLoading = true; | |||
| let httpurl = ''; | |||
| let method = ''; | |||
| if(!this.model.id){ | |||
| httpurl+=this.url.add; | |||
| method = 'post'; | |||
| }else{ | |||
| httpurl+=this.url.edit; | |||
| method = 'put'; | |||
| } | |||
| httpAction(httpurl,this.model,method).then((res)=>{ | |||
| if(res.success){ | |||
| that.$message.success(res.message); | |||
| that.$emit('ok'); | |||
| }else{ | |||
| that.$message.warning(res.message); | |||
| } | |||
| }).finally(() => { | |||
| that.confirmLoading = false; | |||
| }) | |||
| } | |||
| }) | |||
| }, | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,84 @@ | |||
| <template> | |||
| <a-drawer | |||
| :title="title" | |||
| :width="width" | |||
| placement="right" | |||
| :closable="false" | |||
| @close="close" | |||
| destroyOnClose | |||
| :visible="visible"> | |||
| <common-vip-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></common-vip-form> | |||
| <div class="drawer-footer"> | |||
| <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |||
| <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |||
| </div> | |||
| </a-drawer> | |||
| </template> | |||
| <script> | |||
| import CommonVipForm from './CommonVipForm' | |||
| export default { | |||
| name: 'CommonVipModal', | |||
| components: { | |||
| CommonVipForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:"操作", | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }); | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| /** Button按钮间距 */ | |||
| .ant-btn { | |||
| margin-left: 30px; | |||
| margin-bottom: 30px; | |||
| float: right; | |||
| } | |||
| .drawer-footer{ | |||
| position: absolute; | |||
| bottom: -8px; | |||
| width: 100%; | |||
| border-top: 1px solid #e8e8e8; | |||
| padding: 10px 16px; | |||
| text-align: right; | |||
| left: 0; | |||
| background: #fff; | |||
| border-radius: 0 0 2px 2px; | |||
| } | |||
| </style> | |||
| @ -0,0 +1,60 @@ | |||
| <template> | |||
| <j-modal | |||
| :title="title" | |||
| :width="width" | |||
| :visible="visible" | |||
| switchFullscreen | |||
| @ok="handleOk" | |||
| :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |||
| @cancel="handleCancel" | |||
| cancelText="关闭"> | |||
| <common-vip-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></common-vip-form> | |||
| </j-modal> | |||
| </template> | |||
| <script> | |||
| import CommonVipForm from './CommonVipForm' | |||
| export default { | |||
| name: 'CommonVipModal', | |||
| components: { | |||
| CommonVipForm | |||
| }, | |||
| data () { | |||
| return { | |||
| title:'', | |||
| width:800, | |||
| visible: false, | |||
| disableSubmit: false | |||
| } | |||
| }, | |||
| methods: { | |||
| add () { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.add(); | |||
| }) | |||
| }, | |||
| edit (record) { | |||
| this.visible=true | |||
| this.$nextTick(()=>{ | |||
| this.$refs.realForm.edit(record); | |||
| }) | |||
| }, | |||
| close () { | |||
| this.$emit('close'); | |||
| this.visible = false; | |||
| }, | |||
| handleOk () { | |||
| this.$refs.realForm.submitForm(); | |||
| }, | |||
| submitCallback(){ | |||
| this.$emit('ok'); | |||
| this.visible = false; | |||
| }, | |||
| handleCancel () { | |||
| this.close() | |||
| } | |||
| } | |||
| } | |||
| </script> | |||
| @ -0,0 +1,61 @@ | |||
| import {defHttp} from '/@/utils/http/axios'; | |||
| import {Modal} from 'ant-design-vue'; | |||
| enum Api { | |||
| list = '/commonVip/commonVip/list', | |||
| save='/commonVip/commonVip/add', | |||
| edit='/commonVip/commonVip/edit', | |||
| deleteOne = '/commonVip/commonVip/delete', | |||
| deleteBatch = '/commonVip/commonVip/deleteBatch', | |||
| importExcel = '/commonVip/commonVip/importExcel', | |||
| exportXls = '/commonVip/commonVip/exportXls', | |||
| } | |||
| /** | |||
| * 导出api | |||
| * @param params | |||
| */ | |||
| export const getExportUrl = Api.exportXls; | |||
| /** | |||
| * 导入api | |||
| */ | |||
| export const getImportUrl = Api.importExcel; | |||
| /** | |||
| * 列表接口 | |||
| * @param params | |||
| */ | |||
| export const list = (params) => | |||
| defHttp.get({url: Api.list, params}); | |||
| /** | |||
| * 删除单个 | |||
| */ | |||
| export const deleteOne = (params,handleSuccess) => { | |||
| return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| /** | |||
| * 批量删除 | |||
| * @param params | |||
| */ | |||
| export const batchDelete = (params, handleSuccess) => { | |||
| Modal.confirm({ | |||
| title: '确认删除', | |||
| content: '是否删除选中数据', | |||
| okText: '确认', | |||
| cancelText: '取消', | |||
| onOk: () => { | |||
| return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { | |||
| handleSuccess(); | |||
| }); | |||
| } | |||
| }); | |||
| } | |||
| /** | |||
| * 保存或者更新 | |||
| * @param params | |||
| */ | |||
| export const saveOrUpdate = (params, isUpdate) => { | |||
| let url = isUpdate ? Api.edit : Api.save; | |||
| return defHttp.post({url: url, params}); | |||
| } | |||
| @ -0,0 +1,67 @@ | |||
| import {BasicColumn} from '/@/components/Table'; | |||
| import {FormSchema} from '/@/components/Table'; | |||
| import { rules} from '/@/utils/helper/validator'; | |||
| import { render } from '/@/utils/common/renderUtils'; | |||
| //列表数据 | |||
| export const columns: BasicColumn[] = [ | |||
| { | |||
| title: '名称', | |||
| align:"center", | |||
| dataIndex: 'title' | |||
| }, | |||
| { | |||
| title: '小标题', | |||
| align:"center", | |||
| dataIndex: 'subTitle' | |||
| }, | |||
| { | |||
| title: '图标', | |||
| align:"center", | |||
| dataIndex: 'headImage', | |||
| customRender:render.renderAvatar, | |||
| }, | |||
| { | |||
| title: '累积满多少可成为', | |||
| align:"center", | |||
| dataIndex: 'money' | |||
| }, | |||
| { | |||
| title: '会员权益', | |||
| align:"center", | |||
| dataIndex: 'details', | |||
| slots: { customRender: 'htmlSlot' }, | |||
| }, | |||
| ]; | |||
| //查询数据 | |||
| export const searchFormSchema: FormSchema[] = [ | |||
| ]; | |||
| //表单数据 | |||
| export const formSchema: FormSchema[] = [ | |||
| { | |||
| label: '名称', | |||
| field: 'title', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '小标题', | |||
| field: 'subTitle', | |||
| component: 'Input', | |||
| }, | |||
| { | |||
| label: '图标', | |||
| field: 'headImage', | |||
| component: 'JImageUpload', | |||
| componentProps:{ | |||
| }, | |||
| }, | |||
| { | |||
| label: '累积满多少可成为', | |||
| field: 'money', | |||
| component: 'InputNumber', | |||
| }, | |||
| { | |||
| label: '会员权益', | |||
| field: 'details', | |||
| component: 'JCodeEditor', //TODO String后缀暂未添加 | |||
| }, | |||
| ]; | |||
| @ -0,0 +1,162 @@ | |||
| <template> | |||
| <div> | |||
| <!--引用表格--> | |||
| <BasicTable @register="registerTable" :rowSelection="rowSelection"> | |||
| <!--插槽:table标题--> | |||
| <template #tableTitle> | |||
| <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button> | |||
| <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button> | |||
| <j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> | |||
| <a-dropdown v-if="checkedKeys.length > 0"> | |||
| <template #overlay> | |||
| <a-menu> | |||
| <a-menu-item key="1" @click="batchHandleDelete"> | |||
| <Icon icon="ant-design:delete-outlined"></Icon> | |||
| 删除 | |||
| </a-menu-item> | |||
| </a-menu> | |||
| </template> | |||
| <a-button>批量操作 | |||
| <Icon icon="mdi:chevron-down"></Icon> | |||
| </a-button> | |||
| </a-dropdown> | |||
| </template> | |||
| <!--操作栏--> | |||
| <template #action="{ record }"> | |||
| <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/> | |||
| </template> | |||
| <!--字段回显插槽--> | |||
| <template #htmlSlot="{text}"> | |||
| <div v-html="text"></div> | |||
| </template> | |||
| <template #fileSlot="{text}"> | |||
| <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |||
| <a-button v-else :ghost="true" type="primary" preIcon="ant-design:download-outlined" size="small" @click="downloadFile(text)">下载</a-button> | |||
| </template> | |||
| </BasicTable> | |||
| <!-- 表单区域 --> | |||
| <CommonVipModal @register="registerModal" @success="handleSuccess"></CommonVipModal> | |||
| </div> | |||
| </template> | |||
| <script lang="ts" name="commonVip-commonVip" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicTable, useTable, TableAction} from '/@/components/Table'; | |||
| import {useModal} from '/@/components/Modal'; | |||
| import { useListPage } from '/@/hooks/system/useListPage' | |||
| import CommonVipModal from './components/CommonVipModal.vue' | |||
| import {columns, searchFormSchema} from './commonVip.data'; | |||
| import {list, deleteOne, batchDelete, getImportUrl,getExportUrl} from './commonVip.api'; | |||
| const checkedKeys = ref<Array<string | number>>([]); | |||
| //注册model | |||
| const [registerModal, {openModal}] = useModal(); | |||
| //注册table数据 | |||
| const { prefixCls,tableContext,onExportXls,onImportXls } = useListPage({ | |||
| tableProps:{ | |||
| title: '会员信息内容', | |||
| api: list, | |||
| columns, | |||
| canResize:false, | |||
| formConfig: { | |||
| labelWidth: 120, | |||
| schemas: searchFormSchema, | |||
| autoSubmitOnEnter:true, | |||
| showAdvancedButton:true, | |||
| fieldMapToTime: [ | |||
| ], | |||
| }, | |||
| actionColumn: { | |||
| width: 120, | |||
| }, | |||
| }, | |||
| exportConfig: { | |||
| name:"会员信息内容", | |||
| url: getExportUrl, | |||
| }, | |||
| importConfig: { | |||
| url: getImportUrl | |||
| }, | |||
| }) | |||
| const [registerTable, {reload},{ rowSelection, selectedRowKeys }] = tableContext | |||
| /** | |||
| * 新增事件 | |||
| */ | |||
| function handleAdd() { | |||
| openModal(true, { | |||
| isUpdate: false, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 编辑事件 | |||
| */ | |||
| function handleEdit(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: true, | |||
| }); | |||
| } | |||
| /** | |||
| * 详情 | |||
| */ | |||
| function handleDetail(record: Recordable) { | |||
| openModal(true, { | |||
| record, | |||
| isUpdate: true, | |||
| showFooter: false, | |||
| }); | |||
| } | |||
| /** | |||
| * 删除事件 | |||
| */ | |||
| async function handleDelete(record) { | |||
| await deleteOne({id: record.id}, reload); | |||
| } | |||
| /** | |||
| * 批量删除事件 | |||
| */ | |||
| async function batchHandleDelete() { | |||
| await batchDelete({ids: checkedKeys.value}, reload); | |||
| } | |||
| /** | |||
| * 成功回调 | |||
| */ | |||
| function handleSuccess() { | |||
| reload(); | |||
| } | |||
| /** | |||
| * 操作栏 | |||
| */ | |||
| function getTableAction(record){ | |||
| return [ | |||
| { | |||
| label: '编辑', | |||
| onClick: handleEdit.bind(null, record), | |||
| } | |||
| ] | |||
| } | |||
| /** | |||
| * 下拉操作栏 | |||
| */ | |||
| function getDropDownAction(record){ | |||
| return [ | |||
| { | |||
| label: '详情', | |||
| onClick: handleDetail.bind(null, record), | |||
| }, { | |||
| label: '删除', | |||
| popConfirm: { | |||
| title: '是否确认删除', | |||
| confirm: handleDelete.bind(null, record), | |||
| } | |||
| } | |||
| ] | |||
| } | |||
| </script> | |||
| <style scoped> | |||
| </style> | |||
| @ -0,0 +1,58 @@ | |||
| <template> | |||
| <BasicModal v-bind="$attrs" @register="registerModal" :title="title" @ok="handleSubmit"> | |||
| <BasicForm @register="registerForm"/> | |||
| </BasicModal> | |||
| </template> | |||
| <script lang="ts" setup> | |||
| import {ref, computed, unref} from 'vue'; | |||
| import {BasicModal, useModalInner} from '/@/components/Modal'; | |||
| import {BasicForm, useForm} from '/@/components/Form/index'; | |||
| import {formSchema} from '../commonVip.data'; | |||
| import {saveOrUpdate} from '../commonVip.api'; | |||
| // Emits声明 | |||
| const emit = defineEmits(['register','success']); | |||
| const isUpdate = ref(true); | |||
| //表单配置 | |||
| const [registerForm, {setProps,resetFields, setFieldsValue, validate}] = useForm({ | |||
| labelWidth: 150, | |||
| schemas: formSchema, | |||
| showActionButtonGroup: false, | |||
| }); | |||
| //表单赋值 | |||
| const [registerModal, {setModalProps, closeModal}] = useModalInner(async (data) => { | |||
| //重置表单 | |||
| await resetFields(); | |||
| setModalProps({confirmLoading: false,showCancelBtn:!!data?.showFooter,showOkBtn:!!data?.showFooter}); | |||
| isUpdate.value = !!data?.isUpdate; | |||
| if (unref(isUpdate)) { | |||
| //表单赋值 | |||
| await setFieldsValue({ | |||
| ...data.record, | |||
| }); | |||
| } | |||
| // 隐藏底部时禁用整个表单 | |||
| setProps({ disabled: !data?.showFooter }) | |||
| }); | |||
| //设置标题 | |||
| const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑')); | |||
| //表单提交事件 | |||
| async function handleSubmit(v) { | |||
| try { | |||
| let values = await validate(); | |||
| setModalProps({confirmLoading: true}); | |||
| //提交表单 | |||
| await saveOrUpdate(values, isUpdate.value); | |||
| //关闭弹窗 | |||
| closeModal(); | |||
| //刷新列表 | |||
| emit('success'); | |||
| } finally { | |||
| setModalProps({confirmLoading: false}); | |||
| } | |||
| } | |||
| </script> | |||
| <style lang="less" scoped> | |||
| </style> | |||