feat(mall): 添加衣服分类相关功能
- 新增衣服分类控制器 AdminClothesTypeController
- 添加分类、尺码、图案、位置、布料、工艺等相关的 CRUD 接口
- 实现分类列表、新增、更新、状态操作等功能
- 添加尺码、图案、位置、布料、工艺等的列表、新增、更新功能
- 实现工艺配置的穿梭框功能
- 添加相关的前端页面和模板文件
New file |
| | |
| | | package cc.mrbird.febs.mall.controller.clothes; |
| | | |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; |
| | | import cc.mrbird.febs.mall.dto.memberLevel.AdminMemberLabelAddDto; |
| | | import cc.mrbird.febs.mall.dto.memberLevel.AdminMemberLabelDto; |
| | | import cc.mrbird.febs.mall.dto.memberLevel.AdminMemberLabelUpdateDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.service.ClothesTypeService; |
| | | import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo; |
| | | import cc.mrbird.febs.mall.vo.memberLevel.AdminMemberLabelSetDto; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Map; |
| | | |
| | | @Slf4j |
| | | @Validated |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @RequestMapping(value = "/admin/clothesType") |
| | | public class AdminClothesTypeController extends BaseController { |
| | | |
| | | private final ClothesTypeService clothesTypeService; |
| | | /** |
| | | * 分类列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("typeList") |
| | | public FebsResponse typeList(ClothesType dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(clothesTypeService.adminTypeList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | /** |
| | | * 分类-新增 |
| | | */ |
| | | @PostMapping("typeAdd") |
| | | @ControllerEndpoint(operation = " 分类-新增", exceptionMessage = "操作失败") |
| | | public FebsResponse typeAdd(@RequestBody @Valid ClothesType dto) { |
| | | |
| | | return clothesTypeService.typeAdd(dto); |
| | | } |
| | | /** |
| | | * 分类-更新 |
| | | */ |
| | | @PostMapping("typeUpdate") |
| | | @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse typeUpdate(@RequestBody @Valid ClothesType dto) { |
| | | |
| | | return clothesTypeService.typeUpdate(dto); |
| | | } |
| | | /** |
| | | * 分类-状态操作 |
| | | */ |
| | | @GetMapping("changeState/{id}/{type}/{state}") |
| | | @ControllerEndpoint(operation = "分类-状态操作", exceptionMessage = "操作失败") |
| | | public FebsResponse changeState( |
| | | @NotNull(message = "{required}") @PathVariable Long id, |
| | | @NotNull(message = "{required}") @PathVariable Integer type, |
| | | @NotNull(message = "{required}") @PathVariable Integer state |
| | | ) { |
| | | |
| | | return clothesTypeService.changeState(id,type,state); |
| | | } |
| | | /** |
| | | * 尺码列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("sizeList") |
| | | public FebsResponse sizeList(ClothesSize dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(clothesTypeService.adminSizeList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | /** |
| | | * 尺码-新增 |
| | | */ |
| | | @PostMapping("sizeAdd") |
| | | @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") |
| | | public FebsResponse sizeAdd(@RequestBody @Valid ClothesSize dto) { |
| | | |
| | | return clothesTypeService.sizeAdd(dto); |
| | | } |
| | | /** |
| | | * 尺码-更新 |
| | | */ |
| | | @PostMapping("sizeUpdate") |
| | | @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse sizeUpdate(@RequestBody @Valid ClothesSize dto) { |
| | | |
| | | return clothesTypeService.sizeUpdate(dto); |
| | | } |
| | | /** |
| | | * 图案列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("patternList") |
| | | public FebsResponse patternList(ClothesPattern dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(clothesTypeService.adminPatternList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | /** |
| | | * 图案-新增 |
| | | */ |
| | | @PostMapping("patternAdd") |
| | | @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") |
| | | public FebsResponse patternAdd(@RequestBody @Valid ClothesPattern dto) { |
| | | |
| | | return clothesTypeService.patternAdd(dto); |
| | | } |
| | | /** |
| | | * 图案-更新 |
| | | */ |
| | | @PostMapping("patternUpdate") |
| | | @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse patternUpdate(@RequestBody @Valid ClothesPattern dto) { |
| | | |
| | | return clothesTypeService.patternUpdate(dto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 位置列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("locationList") |
| | | public FebsResponse locationList(ClothesLocation dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(clothesTypeService.adminLocationList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | /** |
| | | * 位置-新增 |
| | | */ |
| | | @PostMapping("locationAdd") |
| | | @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") |
| | | public FebsResponse locationAdd(@RequestBody @Valid ClothesLocation dto) { |
| | | |
| | | return clothesTypeService.locationAdd(dto); |
| | | } |
| | | /** |
| | | * 位置-更新 |
| | | */ |
| | | @PostMapping("locationUpdate") |
| | | @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse locationUpdate(@RequestBody @Valid ClothesLocation dto) { |
| | | |
| | | return clothesTypeService.locationUpdate(dto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 布料列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("clothList") |
| | | public FebsResponse clothList(ClothesCloth dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(clothesTypeService.adminClothList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | /** |
| | | * 布料-新增 |
| | | */ |
| | | @PostMapping("clothAdd") |
| | | @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") |
| | | public FebsResponse clothAdd(@RequestBody @Valid ClothesCloth dto) { |
| | | |
| | | return clothesTypeService.clothAdd(dto); |
| | | } |
| | | /** |
| | | * 布料-更新 |
| | | */ |
| | | @PostMapping("clothUpdate") |
| | | @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse clothUpdate(@RequestBody @Valid ClothesCloth dto) { |
| | | |
| | | return clothesTypeService.clothUpdate(dto); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 工艺列表 |
| | | * @return |
| | | */ |
| | | @GetMapping("artList") |
| | | public FebsResponse artList(ClothesArt dto, QueryRequest request) { |
| | | |
| | | Map<String, Object> data = getDataTable(clothesTypeService.adminArtList(dto, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | /** |
| | | * 工艺-新增 |
| | | */ |
| | | @PostMapping("artAdd") |
| | | @ControllerEndpoint(operation = "新增", exceptionMessage = "操作失败") |
| | | public FebsResponse artAdd(@RequestBody @Valid ClothesArt dto) { |
| | | |
| | | return clothesTypeService.artAdd(dto); |
| | | } |
| | | /** |
| | | * 工艺-更新 |
| | | */ |
| | | @PostMapping("artUpdate") |
| | | @ControllerEndpoint(operation = "分类-更新", exceptionMessage = "操作失败") |
| | | public FebsResponse artUpdate(@RequestBody @Valid ClothesArt dto) { |
| | | |
| | | return clothesTypeService.artUpdate(dto); |
| | | } |
| | | |
| | | @PostMapping("artSet") |
| | | @ControllerEndpoint(operation = "设置", exceptionMessage = "操作失败") |
| | | public FebsResponse artSet(@RequestBody @Valid AdminClothesTypeInfoDto dto) { |
| | | |
| | | return clothesTypeService.artSet(dto); |
| | | } |
| | | |
| | | @PostMapping("sizeSet") |
| | | @ControllerEndpoint(operation = "设置", exceptionMessage = "操作失败") |
| | | public FebsResponse sizeSet(@RequestBody @Valid AdminClothesTypeInfoDto dto) { |
| | | |
| | | return clothesTypeService.sizeSet(dto); |
| | | } |
| | | |
| | | @PostMapping("clothSet") |
| | | @ControllerEndpoint(operation = "设置", exceptionMessage = "操作失败") |
| | | public FebsResponse clothSet(@RequestBody @Valid AdminClothesTypeInfoDto dto) { |
| | | |
| | | return clothesTypeService.clothSet(dto); |
| | | } |
| | | |
| | | @PostMapping("patternSet") |
| | | @ControllerEndpoint(operation = "设置", exceptionMessage = "操作失败") |
| | | public FebsResponse patternSet(@RequestBody @Valid AdminClothesTypeInfoDto dto) { |
| | | |
| | | return clothesTypeService.patternSet(dto); |
| | | } |
| | | |
| | | @PostMapping("locationSet") |
| | | @ControllerEndpoint(operation = "设置", exceptionMessage = "操作失败") |
| | | public FebsResponse locationSet(@RequestBody @Valid AdminClothesTypeInfoDto dto) { |
| | | |
| | | return clothesTypeService.locationSet(dto); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.controller.clothes; |
| | | |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsConstant; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.ClothesTypeService; |
| | | import cc.mrbird.febs.mall.service.IAdminBannerService; |
| | | import cc.mrbird.febs.mall.vo.AdminLabelSetVo; |
| | | import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Controller("clothesTypeView") |
| | | @RequestMapping(FebsConstant.VIEW_PREFIX + "modules/clothesType") |
| | | @RequiredArgsConstructor |
| | | public class ViewClothesTypeController extends BaseController { |
| | | |
| | | private final ClothesTypeService clothesTypeService; |
| | | private final ClothesSizeMapper clothesSizeMapper; |
| | | private final ClothesPatternMapper clothesPatternMapper; |
| | | private final ClothesLocationMapper clothesLocationMapper; |
| | | private final ClothesClothMapper clothesClothMapper; |
| | | private final ClothesArtMapper clothesArtMapper; |
| | | private final ClothesTypeArtMapper clothesTypeArtMapper; |
| | | private final ClothesTypeSizeMapper clothesTypeSizeMapper; |
| | | private final ClothesTypeClothMapper clothesTypeClothMapper; |
| | | private final ClothesTypePatternMapper clothesTypePatternMapper; |
| | | private final ClothesTypeLocationMapper clothesTypeLocationMapper; |
| | | |
| | | /** |
| | | * 种类列表 |
| | | */ |
| | | @GetMapping("typeList") |
| | | @RequiresPermissions("typeList:view") |
| | | public String typeList() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/typeList"); |
| | | } |
| | | |
| | | /** |
| | | * 种类新增 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/typeAdd") |
| | | @RequiresPermissions("typeAdd:add") |
| | | public String typeAdd() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/typeAdd"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 种类编辑 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("typeInfo/{id}") |
| | | @RequiresPermissions("typeInfo:view") |
| | | public String typeInfo(@PathVariable long id, Model model) { |
| | | ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id); |
| | | model.addAttribute("clothesType", clothesType); |
| | | return FebsUtil.view("modules/clothesType/typeInfo"); |
| | | } |
| | | |
| | | /** |
| | | * 尺码列表 |
| | | */ |
| | | @GetMapping("sizeList") |
| | | @RequiresPermissions("sizeList:view") |
| | | public String sizeList() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/sizeList"); |
| | | } |
| | | |
| | | /** |
| | | * 尺码新增 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/sizeAdd") |
| | | @RequiresPermissions("sizeAdd:add") |
| | | public String sizeAdd() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/sizeAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 尺码编辑 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("sizeInfo/{id}") |
| | | @RequiresPermissions("sizeInfo:view") |
| | | public String sizeInfo(@PathVariable long id, Model model) { |
| | | ClothesSize clothesSize = clothesSizeMapper.selectById(id); |
| | | model.addAttribute("clothesSize", clothesSize); |
| | | return FebsUtil.view("modules/clothesType/sizeInfo"); |
| | | } |
| | | |
| | | /** |
| | | * 图案列表 |
| | | */ |
| | | @GetMapping("patternList") |
| | | @RequiresPermissions("patternList:view") |
| | | public String patternList() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/patternList"); |
| | | } |
| | | |
| | | /** |
| | | * 图案新增 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/patternAdd") |
| | | @RequiresPermissions("patternAdd:add") |
| | | public String patternAdd() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/patternAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 图案编辑 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("patternInfo/{id}") |
| | | @RequiresPermissions("patternInfo:view") |
| | | public String patternInfo(@PathVariable long id, Model model) { |
| | | ClothesPattern clothesPattern = clothesPatternMapper.selectById(id); |
| | | model.addAttribute("clothesPattern", clothesPattern); |
| | | return FebsUtil.view("modules/clothesType/patternInfo"); |
| | | } |
| | | |
| | | /** |
| | | * 位置列表 |
| | | */ |
| | | @GetMapping("locationList") |
| | | @RequiresPermissions("locationList:view") |
| | | public String locationList() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/locationList"); |
| | | } |
| | | |
| | | /** |
| | | * 位置新增 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/locationAdd") |
| | | @RequiresPermissions("locationAdd:add") |
| | | public String locationAdd() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/locationAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 位置编辑 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("locationInfo/{id}") |
| | | @RequiresPermissions("locationInfo:view") |
| | | public String locationInfo(@PathVariable long id, Model model) { |
| | | ClothesLocation clothesLocation = clothesLocationMapper.selectById(id); |
| | | model.addAttribute("clothesLocation", clothesLocation); |
| | | return FebsUtil.view("modules/clothesType/locationInfo"); |
| | | } |
| | | |
| | | /** |
| | | * 布料列表 |
| | | */ |
| | | @GetMapping("clothList") |
| | | @RequiresPermissions("clothList:view") |
| | | public String clothList() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/clothList"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 布料新增 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/clothAdd") |
| | | @RequiresPermissions("clothAdd:add") |
| | | public String clothAdd() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/clothAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 布料编辑 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("clothInfo/{id}") |
| | | @RequiresPermissions("clothInfo:view") |
| | | public String clothInfo(@PathVariable long id, Model model) { |
| | | ClothesCloth clothesCloth = clothesClothMapper.selectById(id); |
| | | model.addAttribute("clothesCloth", clothesCloth); |
| | | return FebsUtil.view("modules/clothesType/clothInfo"); |
| | | } |
| | | |
| | | /** |
| | | * 工艺列表 |
| | | */ |
| | | @GetMapping("artList") |
| | | @RequiresPermissions("artList:view") |
| | | public String artList() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/artList"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 工艺新增 |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/artAdd") |
| | | @RequiresPermissions("artAdd:add") |
| | | public String artAdd() { |
| | | |
| | | return FebsUtil.view("modules/clothesType/artAdd"); |
| | | } |
| | | |
| | | /** |
| | | * 工艺编辑 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("artInfo/{id}") |
| | | @RequiresPermissions("artInfo:view") |
| | | public String artInfo(@PathVariable long id, Model model) { |
| | | ClothesArt clothesArt = clothesArtMapper.selectById(id); |
| | | model.addAttribute("clothesArt", clothesArt); |
| | | return FebsUtil.view("modules/clothesType/artInfo"); |
| | | } |
| | | |
| | | /** |
| | | * 工艺配置 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("artSet/{id}") |
| | | @RequiresPermissions("artSet:view") |
| | | public String artSet(@PathVariable long id, Model model) { |
| | | List<AdminClothesTypeInfoVo> vos = new ArrayList<>(); |
| | | Set<Long> artIds = new HashSet<>(); |
| | | |
| | | ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id); |
| | | if(ObjectUtil.isNotEmpty(clothesType)){ |
| | | //右侧数据 |
| | | List<ClothesTypeArt> clothesTypeArts = clothesTypeArtMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesTypeArt.class) |
| | | .eq(ClothesTypeArt::getTypeId, id) |
| | | ); |
| | | if(CollUtil.isNotEmpty(clothesTypeArts)){ |
| | | //stream流操作happyMemberLabelRecords,获取memberId的set集合 |
| | | artIds = clothesTypeArts.stream().map(ClothesTypeArt::getArtId).collect(Collectors.toSet()); |
| | | } |
| | | |
| | | //左侧数据 |
| | | List<ClothesArt> clothesArts = clothesArtMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesArt.class) |
| | | .select(ClothesArt::getId, ClothesArt::getName) |
| | | ); |
| | | if(CollUtil.isNotEmpty(clothesArts)){ |
| | | //stream流操作mallMembers,生成一个新的List<MallMemberVo> |
| | | vos = clothesArts.stream().map(ClothesArt -> { |
| | | AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo(); |
| | | vo.setId(ClothesArt.getId()); |
| | | vo.setName(ClothesArt.getName()); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | model.addAttribute("artTypeAll", vos); |
| | | model.addAttribute("artTypeChoose", artIds); |
| | | model.addAttribute("typeId", id); |
| | | return FebsUtil.view("modules/clothesType/artSet"); |
| | | } |
| | | |
| | | /** |
| | | * 尺码配置 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("sizeSet/{id}") |
| | | @RequiresPermissions("sizeSet:view") |
| | | public String sizeSet(@PathVariable long id, Model model) { |
| | | List<AdminClothesTypeInfoVo> vos = new ArrayList<>(); |
| | | Set<Long> ids = new HashSet<>(); |
| | | |
| | | ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id); |
| | | if(ObjectUtil.isNotEmpty(clothesType)){ |
| | | //右侧数据 |
| | | List<ClothesTypeSize> lists = clothesTypeSizeMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesTypeSize.class) |
| | | .eq(ClothesTypeSize::getTypeId, id) |
| | | ); |
| | | |
| | | if (CollUtil.isNotEmpty(lists)){ |
| | | //stream流操作happyMemberLabelRecords,获取memberId的set集合 |
| | | ids = lists.stream().map(ClothesTypeSize::getSizeId).collect(Collectors.toSet()); |
| | | } |
| | | |
| | | //左侧数据 |
| | | List<ClothesSize> entities = clothesSizeMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesSize.class) |
| | | .select(ClothesSize::getId, ClothesSize::getName) |
| | | ); |
| | | if(CollUtil.isNotEmpty(entities)){ |
| | | //stream流操作mallMembers,生成一个新的List<MallMemberVo> |
| | | vos = entities.stream().map(ClothesSize -> { |
| | | AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo(); |
| | | vo.setId(ClothesSize.getId()); |
| | | vo.setName(ClothesSize.getName()); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | model.addAttribute("sizeTypeAll", vos); |
| | | model.addAttribute("sizeTypeChoose", ids); |
| | | model.addAttribute("typeId", id); |
| | | return FebsUtil.view("modules/clothesType/sizeSet"); |
| | | } |
| | | |
| | | /** |
| | | * 布料配置 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("clothSet/{id}") |
| | | @RequiresPermissions("clothSet:view") |
| | | public String clothSet(@PathVariable long id, Model model) { |
| | | List<AdminClothesTypeInfoVo> vos = new ArrayList<>(); |
| | | Set<Long> ids = new HashSet<>(); |
| | | |
| | | ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id); |
| | | if(ObjectUtil.isNotEmpty(clothesType)){ |
| | | //右侧数据 |
| | | List<ClothesTypeCloth> lists = clothesTypeClothMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesTypeCloth.class) |
| | | .eq(ClothesTypeCloth::getTypeId, id) |
| | | ); |
| | | |
| | | if (CollUtil.isNotEmpty(lists)){ |
| | | //stream流操作happyMemberLabelRecords,获取memberId的set集合 |
| | | ids = lists.stream().map(ClothesTypeCloth::getClothId).collect(Collectors.toSet()); |
| | | |
| | | } |
| | | |
| | | //左侧数据 |
| | | List<ClothesCloth> entities = clothesClothMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesCloth.class) |
| | | .select(ClothesCloth::getId, ClothesCloth::getName) |
| | | ); |
| | | if(CollUtil.isNotEmpty(entities)){ |
| | | //stream流操作mallMembers,生成一个新的List<MallMemberVo> |
| | | vos = entities.stream().map(ClothesCloth -> { |
| | | AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo(); |
| | | vo.setId(ClothesCloth.getId()); |
| | | vo.setName(ClothesCloth.getName()); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | model.addAttribute("clothTypeAll", vos); |
| | | model.addAttribute("clothTypeChoose", ids); |
| | | model.addAttribute("typeId", id); |
| | | return FebsUtil.view("modules/clothesType/clothSet"); |
| | | } |
| | | |
| | | /** |
| | | * 图案文字配置 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("patternSet/{id}") |
| | | @RequiresPermissions("patternSet:view") |
| | | public String patternSet(@PathVariable long id, Model model) { |
| | | List<AdminClothesTypeInfoVo> vos = new ArrayList<>(); |
| | | Set<Long> ids = new HashSet<>(); |
| | | |
| | | ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id); |
| | | if(ObjectUtil.isNotEmpty(clothesType)){ |
| | | //右侧数据 |
| | | List<ClothesTypePattern> lists = clothesTypePatternMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesTypePattern.class) |
| | | .eq(ClothesTypePattern::getTypeId, id) |
| | | ); |
| | | |
| | | if (CollUtil.isNotEmpty(lists)){ |
| | | //stream流操作happyMemberLabelRecords,获取memberId的set集合 |
| | | ids = lists.stream().map(ClothesTypePattern::getPatternId).collect(Collectors.toSet()); |
| | | } |
| | | |
| | | //左侧数据 |
| | | List<ClothesPattern> entities = clothesPatternMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesPattern.class) |
| | | .select(ClothesPattern::getId, ClothesPattern::getName) |
| | | ); |
| | | if(CollUtil.isNotEmpty(entities)){ |
| | | //stream流操作mallMembers,生成一个新的List<MallMemberVo> |
| | | vos = entities.stream().map(ClothesPattern -> { |
| | | AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo(); |
| | | vo.setId(ClothesPattern.getId()); |
| | | vo.setName(ClothesPattern.getName()); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | model.addAttribute("patternTypeAll", vos); |
| | | model.addAttribute("patternTypeChoose", ids); |
| | | model.addAttribute("typeId", id); |
| | | return FebsUtil.view("modules/clothesType/patternSet"); |
| | | } |
| | | |
| | | /** |
| | | * 图案位置配置 |
| | | * @param id |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @GetMapping("locationSet/{id}") |
| | | @RequiresPermissions("locationSet:view") |
| | | public String locationSet(@PathVariable long id, Model model) { |
| | | List<AdminClothesTypeInfoVo> vos = new ArrayList<>(); |
| | | Set<Long> ids = new HashSet<>(); |
| | | |
| | | ClothesType clothesType = clothesTypeService.getBaseMapper().selectById(id); |
| | | if(ObjectUtil.isNotEmpty(clothesType)){ |
| | | //右侧数据 |
| | | List<ClothesTypeLocation> lists = clothesTypeLocationMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesTypeLocation.class) |
| | | .eq(ClothesTypeLocation::getTypeId, id) |
| | | ); |
| | | |
| | | if(CollUtil.isNotEmpty(lists)){ |
| | | //stream流操作happyMemberLabelRecords,获取memberId的set集合 |
| | | ids = lists.stream().map(ClothesTypeLocation::getLocationId).collect(Collectors.toSet()); |
| | | } |
| | | |
| | | //左侧数据 |
| | | List<ClothesLocation> entities = clothesLocationMapper.selectList( |
| | | Wrappers.lambdaQuery(ClothesLocation.class) |
| | | .select(ClothesLocation::getId, ClothesLocation::getName) |
| | | ); |
| | | if(CollUtil.isNotEmpty(entities)){ |
| | | //stream流操作mallMembers,生成一个新的List<MallMemberVo> |
| | | vos = entities.stream().map(ClothesLocation -> { |
| | | AdminClothesTypeInfoVo vo = new AdminClothesTypeInfoVo(); |
| | | vo.setId(ClothesLocation.getId()); |
| | | vo.setName(ClothesLocation.getName()); |
| | | return vo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | model.addAttribute("locationTypeAll", vos); |
| | | model.addAttribute("locationTypeChoose", ids); |
| | | model.addAttribute("typeId", id); |
| | | return FebsUtil.view("modules/clothesType/locationSet"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.dto.clothes; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class AdminClothesTypeInfoDto { |
| | | |
| | | private Long typeId; |
| | | |
| | | private List<Long> chooseIds; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("clothes_art") |
| | | public class ClothesArt extends BaseEntity { |
| | | /** |
| | | * |
| | | `name` varchar(100) DEFAULT NULL COMMENT '名称', |
| | | `image` varchar(200) DEFAULT NULL COMMENT '小图标', |
| | | `content` text COMMENT '简介', |
| | | `price` decimal(20,2) DEFAULT NULL COMMENT '价格', |
| | | `order_num` int(11) DEFAULT NULL COMMENT '排序', |
| | | */ |
| | | |
| | | private String code; |
| | | private String name; |
| | | private String image; |
| | | private String content; |
| | | private BigDecimal price; |
| | | private Integer orderNum; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("clothes_cloth") |
| | | public class ClothesCloth extends BaseEntity { |
| | | /** |
| | | * |
| | | `name` varchar(100) DEFAULT NULL COMMENT '名称', |
| | | `image` varchar(200) DEFAULT NULL COMMENT '小图标', |
| | | `content` text COMMENT '简介', |
| | | `price` decimal(20,2) DEFAULT NULL COMMENT '价格', |
| | | `order_num` int(11) DEFAULT NULL COMMENT '排序', |
| | | */ |
| | | private String code; |
| | | private String name; |
| | | private String image; |
| | | private String content; |
| | | private BigDecimal price; |
| | | private Integer orderNum; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("clothes_location") |
| | | public class ClothesLocation extends BaseEntity { |
| | | /** |
| | | * |
| | | `name` varchar(100) DEFAULT NULL COMMENT '名称', |
| | | `image` varchar(200) DEFAULT NULL COMMENT '小图标', |
| | | `content` text COMMENT '简介', |
| | | `price` decimal(20,2) DEFAULT NULL COMMENT '价格', |
| | | `order_num` int(11) DEFAULT NULL COMMENT '排序', |
| | | */ |
| | | private String code; |
| | | private String name; |
| | | private String image; |
| | | private String content; |
| | | private BigDecimal price; |
| | | private Integer orderNum; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("clothes_pattern") |
| | | public class ClothesPattern extends BaseEntity { |
| | | /** |
| | | * |
| | | `name` varchar(100) DEFAULT NULL COMMENT '名称', |
| | | `image` varchar(200) DEFAULT NULL COMMENT '小图标', |
| | | `content` text COMMENT '简介', |
| | | `price` decimal(20,2) DEFAULT NULL COMMENT '价格', |
| | | `order_num` int(11) DEFAULT NULL COMMENT '排序', |
| | | `type` int(11) DEFAULT NULL COMMENT '类型 1-仅文字 2-仅图案 3-文字加图案', |
| | | */ |
| | | private String code; |
| | | private String name; |
| | | private String image; |
| | | private String content; |
| | | private BigDecimal price; |
| | | private Integer orderNum; |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("clothes_size") |
| | | public class ClothesSize extends BaseEntity { |
| | | /** |
| | | * |
| | | `name` varchar(100) DEFAULT NULL COMMENT '名称', |
| | | `image` varchar(200) DEFAULT NULL COMMENT '小图标', |
| | | `content` text COMMENT '简介', |
| | | `price` decimal(20,2) DEFAULT NULL COMMENT '价格', |
| | | `type` int(11) DEFAULT NULL COMMENT '尺码类型 1-衣服 2-裤子', |
| | | `order_num` int(11) DEFAULT NULL COMMENT '排序', |
| | | */ |
| | | private String code; |
| | | private String name; |
| | | private String image; |
| | | private String content; |
| | | private BigDecimal price; |
| | | private Integer type; |
| | | private Integer orderNum; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("clothes_type") |
| | | public class ClothesType extends BaseEntity { |
| | | /** |
| | | * |
| | | `name` varchar(100) DEFAULT NULL COMMENT '名称', |
| | | `image` varchar(200) DEFAULT NULL COMMENT '小图标', |
| | | `image_front` varchar(200) DEFAULT NULL COMMENT '正面', |
| | | `image_back` varchar(200) DEFAULT NULL COMMENT '反面', |
| | | `content` text COMMENT '描述', |
| | | `state` int(11) DEFAULT '0' COMMENT '是否上线 0-否 1-是', |
| | | `cloth_state` int(11) DEFAULT '0' COMMENT '是否允许选择布料 0-否 1-是', |
| | | `art_state` int(11) DEFAULT '0' COMMENT '是否允许选择工艺 0-否 1-是', |
| | | `pattern_state` int(11) DEFAULT '0' COMMENT '是否允许选择图案 0-否 1-是', |
| | | `location_state` int(11) DEFAULT '0' COMMENT '是否允许选择图案位置 0-否 1-是', |
| | | `size_state` int(11) DEFAULT '0' COMMENT '是否允许选择尺码 0-否 1-是', |
| | | `order_num` int(11) DEFAULT NULL COMMENT '排序', |
| | | */ |
| | | |
| | | private String name; |
| | | private String image; |
| | | private String imageFront; |
| | | private String imageBack; |
| | | private String content; |
| | | private Integer state; |
| | | private Integer clothState; |
| | | private Integer artState; |
| | | private Integer patternState; |
| | | private Integer locationState; |
| | | private Integer sizeState; |
| | | private Integer orderNum; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("clothes_type_art") |
| | | public class ClothesTypeArt extends BaseEntity { |
| | | /** |
| | | * |
| | | `type_id` bigint(20) DEFAULT NULL, |
| | | `art_id` bigint(20) DEFAULT NULL, |
| | | */ |
| | | private Long typeId; |
| | | private Long artId; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("clothes_type_cloth") |
| | | public class ClothesTypeCloth extends BaseEntity { |
| | | /** |
| | | * |
| | | `type_id` bigint(20) DEFAULT NULL, |
| | | `cloth_id` bigint(20) DEFAULT NULL, |
| | | */ |
| | | private Long typeId; |
| | | private Long clothId; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("clothes_type_location") |
| | | public class ClothesTypeLocation extends BaseEntity { |
| | | /** |
| | | * |
| | | `type_id` bigint(20) DEFAULT NULL, |
| | | `location_id` bigint(20) DEFAULT NULL, |
| | | */ |
| | | private Long typeId; |
| | | private Long locationId; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("clothes_type_pattern") |
| | | public class ClothesTypePattern extends BaseEntity { |
| | | /** |
| | | * |
| | | `type_id` bigint(20) DEFAULT NULL, |
| | | `pattern_id` bigint(20) DEFAULT NULL, |
| | | */ |
| | | private Long typeId; |
| | | private Long patternId; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.entity; |
| | | |
| | | import cc.mrbird.febs.common.entity.BaseEntity; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("clothes_type_size") |
| | | public class ClothesTypeSize extends BaseEntity { |
| | | /** |
| | | * |
| | | `type_id` bigint(20) DEFAULT NULL, |
| | | `size_id` bigint(20) DEFAULT NULL, |
| | | */ |
| | | private Long typeId; |
| | | private Long sizeId; |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesArt; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesArtMapper extends BaseMapper<ClothesArt> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesCloth; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesClothMapper extends BaseMapper<ClothesCloth> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesLocation; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesLocationMapper extends BaseMapper<ClothesLocation> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesPattern; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesPatternMapper extends BaseMapper<ClothesPattern> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesSize; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesSizeMapper extends BaseMapper<ClothesSize> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesTypeArt; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesTypeArtMapper extends BaseMapper<ClothesTypeArt> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesTypeCloth; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesTypeClothMapper extends BaseMapper<ClothesTypeCloth> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesTypeLocation; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesTypeLocationMapper extends BaseMapper<ClothesTypeLocation> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesType; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesTypeMapper extends BaseMapper<ClothesType> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesTypePattern; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesTypePatternMapper extends BaseMapper<ClothesTypePattern> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.mapper; |
| | | |
| | | import cc.mrbird.febs.mall.entity.ClothesTypeSize; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | public interface ClothesTypeSizeMapper extends BaseMapper<ClothesTypeSize> { |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.service; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | public interface ClothesTypeService extends IService<ClothesType> { |
| | | |
| | | IPage<ClothesType> adminTypeList(ClothesType dto, QueryRequest request); |
| | | |
| | | FebsResponse typeAdd(ClothesType dto); |
| | | |
| | | FebsResponse typeUpdate(ClothesType dto); |
| | | |
| | | FebsResponse changeState(Long id, Integer type, Integer state); |
| | | |
| | | IPage<ClothesSize> adminSizeList(ClothesSize dto, QueryRequest request); |
| | | |
| | | FebsResponse sizeAdd(ClothesSize dto); |
| | | |
| | | FebsResponse sizeUpdate(ClothesSize dto); |
| | | |
| | | IPage<ClothesPattern> adminPatternList(ClothesPattern dto, QueryRequest request); |
| | | |
| | | FebsResponse patternAdd(ClothesPattern dto); |
| | | |
| | | FebsResponse patternUpdate(ClothesPattern dto); |
| | | |
| | | IPage<ClothesLocation> adminLocationList(ClothesLocation dto, QueryRequest request); |
| | | |
| | | FebsResponse locationAdd(ClothesLocation dto); |
| | | |
| | | FebsResponse locationUpdate(ClothesLocation dto); |
| | | |
| | | IPage<ClothesCloth> adminClothList(ClothesCloth dto, QueryRequest request); |
| | | |
| | | FebsResponse clothAdd(ClothesCloth dto); |
| | | |
| | | FebsResponse clothUpdate(ClothesCloth dto); |
| | | |
| | | IPage<ClothesArt> adminArtList(ClothesArt dto, QueryRequest request); |
| | | |
| | | FebsResponse artAdd(ClothesArt dto); |
| | | |
| | | FebsResponse artUpdate(ClothesArt dto); |
| | | |
| | | FebsResponse artSet(AdminClothesTypeInfoDto dto); |
| | | |
| | | FebsResponse sizeSet(AdminClothesTypeInfoDto dto); |
| | | |
| | | FebsResponse clothSet(AdminClothesTypeInfoDto dto); |
| | | |
| | | FebsResponse patternSet(AdminClothesTypeInfoDto dto); |
| | | |
| | | FebsResponse locationSet(AdminClothesTypeInfoDto dto); |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.StateUpDownEnum; |
| | | import cc.mrbird.febs.mall.dto.clothes.AdminClothesTypeInfoDto; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.ClothesTypeService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | @Transactional |
| | | public class ClothesTypeServiceImpl extends ServiceImpl<ClothesTypeMapper, ClothesType> implements ClothesTypeService { |
| | | |
| | | private final ClothesTypeMapper clothesTypeMapper; |
| | | private final ClothesSizeMapper clothesSizeMapper ; |
| | | private final ClothesPatternMapper clothesPatternMapper; |
| | | private final ClothesLocationMapper clothesLocationMapper; |
| | | private final ClothesClothMapper clothesClothMapper; |
| | | private final ClothesArtMapper clothesArtMapper; |
| | | private final ClothesTypeArtMapper clothesTypeArtMapper; |
| | | private final ClothesTypeSizeMapper clothesTypeSizeMapper; |
| | | private final ClothesTypeClothMapper clothesTypeClothMapper; |
| | | private final ClothesTypePatternMapper clothesTypePatternMapper; |
| | | private final ClothesTypeLocationMapper clothesTypeLocationMapper; |
| | | |
| | | @Override |
| | | public IPage<ClothesType> adminTypeList(ClothesType dto, QueryRequest request) { |
| | | Page<ClothesType> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<ClothesType> clothesTypeLambdaQueryWrapper = Wrappers.lambdaQuery(ClothesType.class); |
| | | Page<ClothesType> clothesTypePage = clothesTypeMapper.selectPage(page, clothesTypeLambdaQueryWrapper); |
| | | return clothesTypePage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse typeAdd(ClothesType dto) { |
| | | ClothesType clothesType = new ClothesType(); |
| | | clothesType.setName(dto.getName()); |
| | | clothesType.setOrderNum(dto.getOrderNum()); |
| | | clothesType.setImage(dto.getImage()); |
| | | clothesType.setImageFront(dto.getImageFront()); |
| | | clothesType.setImageBack(dto.getImageBack()); |
| | | clothesType.setContent(dto.getContent()); |
| | | clothesTypeMapper.insert(clothesType); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse typeUpdate(ClothesType dto) { |
| | | Long id = dto.getId(); |
| | | ClothesType clothesType = clothesTypeMapper.selectById(id); |
| | | if (ObjectUtil.isNotNull(clothesType)) { |
| | | clothesTypeMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesType.class) |
| | | .eq(ClothesType::getId, id) |
| | | .set(ClothesType::getName, dto.getName()) |
| | | .set(ClothesType::getOrderNum, dto.getOrderNum()) |
| | | .set(ClothesType::getImage, dto.getImage()) |
| | | .set(ClothesType::getImageFront, dto.getImageFront()) |
| | | .set(ClothesType::getImageBack, dto.getImageBack()) |
| | | .set(ClothesType::getContent, dto.getContent()) |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse changeState(Long id, Integer type, Integer state) { |
| | | ClothesType clothesType = clothesTypeMapper.selectById(id); |
| | | if(ObjectUtil.isNotEmpty(clothesType)){ |
| | | switch (type) { |
| | | case 1: |
| | | clothesType.setState( state); |
| | | break; |
| | | case 2: |
| | | clothesType.setClothState(state); |
| | | break; |
| | | case 3: |
| | | clothesType.setArtState(state); |
| | | break; |
| | | case 4: |
| | | clothesType.setPatternState(state); |
| | | break; |
| | | case 5: |
| | | clothesType.setLocationState(state); |
| | | break; |
| | | case 6: |
| | | clothesType.setSizeState(state); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | clothesTypeMapper.updateById(clothesType); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ClothesSize> adminSizeList(ClothesSize dto, QueryRequest request) { |
| | | Page<ClothesSize> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<ClothesSize> clothesSizeLambdaQueryWrapper = Wrappers.lambdaQuery(ClothesSize.class); |
| | | Page<ClothesSize> clothesSizePage = clothesSizeMapper.selectPage(page, clothesSizeLambdaQueryWrapper); |
| | | return clothesSizePage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse sizeAdd(ClothesSize dto) { |
| | | ClothesSize clothesSize = new ClothesSize(); |
| | | clothesSize.setName(dto.getName()); |
| | | clothesSize.setOrderNum(dto.getOrderNum()); |
| | | clothesSize.setPrice(dto.getPrice()); |
| | | clothesSize.setType(dto.getType()); |
| | | clothesSize.setImage(dto.getImage()); |
| | | clothesSize.setContent(dto.getContent()); |
| | | clothesSizeMapper.insert(clothesSize); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse sizeUpdate(ClothesSize dto) { |
| | | Long id = dto.getId(); |
| | | ClothesSize clothesSize = clothesSizeMapper.selectById(id); |
| | | if (ObjectUtil.isNotNull(clothesSize)) { |
| | | clothesSizeMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesSize.class) |
| | | .eq(ClothesSize::getId, id) |
| | | .set(ClothesSize::getName, dto.getName()) |
| | | .set(ClothesSize::getCode, dto.getCode()) |
| | | .set(ClothesSize::getOrderNum, dto.getOrderNum()) |
| | | .set(ClothesSize::getPrice, dto.getPrice()) |
| | | .set(ClothesSize::getType, dto.getType()) |
| | | .set(ClothesSize::getImage, dto.getImage()) |
| | | .set(ClothesSize::getContent, dto.getContent()) |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ClothesPattern> adminPatternList(ClothesPattern dto, QueryRequest request) { |
| | | Page<ClothesPattern> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<ClothesPattern> clothesPatternLambdaQueryWrapper = Wrappers.lambdaQuery(ClothesPattern.class); |
| | | Page<ClothesPattern> clothesPatternPage = clothesPatternMapper.selectPage(page, clothesPatternLambdaQueryWrapper); |
| | | return clothesPatternPage; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse patternAdd(ClothesPattern dto) { |
| | | ClothesPattern clothesPattern = new ClothesPattern(); |
| | | clothesPattern.setName(dto.getName()); |
| | | clothesPattern.setCode(dto.getCode()); |
| | | clothesPattern.setType(dto.getType()); |
| | | clothesPattern.setPrice(dto.getPrice()); |
| | | clothesPattern.setOrderNum(dto.getOrderNum()); |
| | | clothesPattern.setImage(dto.getImage()); |
| | | clothesPattern.setContent(dto.getContent()); |
| | | clothesPatternMapper.insert(clothesPattern); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse patternUpdate(ClothesPattern dto) { |
| | | Long id = dto.getId(); |
| | | ClothesPattern clothesPattern = clothesPatternMapper.selectById(id); |
| | | if (ObjectUtil.isNotNull(clothesPattern)) { |
| | | clothesPatternMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesPattern.class) |
| | | .eq(ClothesPattern::getId, id) |
| | | .set(ClothesPattern::getName, dto.getName()) |
| | | .set(ClothesPattern::getCode, dto.getCode()) |
| | | .set(ClothesPattern::getImage, dto.getImage()) |
| | | .set(ClothesPattern::getContent, dto.getContent()) |
| | | .set(ClothesPattern::getOrderNum, dto.getOrderNum()) |
| | | .set(ClothesPattern::getPrice, dto.getPrice()) |
| | | .set(ClothesPattern::getType, dto.getType()) |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ClothesLocation> adminLocationList(ClothesLocation dto, QueryRequest request) { |
| | | Page<ClothesLocation> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<ClothesLocation> queryWrapper = Wrappers.lambdaQuery(ClothesLocation.class); |
| | | Page<ClothesLocation> pages = clothesLocationMapper.selectPage(page, queryWrapper); |
| | | return pages; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse locationAdd(ClothesLocation dto) { |
| | | ClothesLocation clothesLocation = new ClothesLocation(); |
| | | clothesLocation.setName(dto.getName()); |
| | | clothesLocation.setCode(dto.getCode()); |
| | | clothesLocation.setImage(dto.getImage()); |
| | | clothesLocation.setContent(dto.getContent()); |
| | | clothesLocation.setPrice(dto.getPrice()); |
| | | clothesLocation.setOrderNum(dto.getOrderNum()); |
| | | clothesLocationMapper.insert(clothesLocation); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse locationUpdate(ClothesLocation dto) { |
| | | Long id = dto.getId(); |
| | | ClothesLocation clothesLocation = clothesLocationMapper.selectById(id); |
| | | if (ObjectUtil.isNotNull(clothesLocation)) { |
| | | clothesLocationMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesLocation.class) |
| | | .eq(ClothesLocation::getId, id) |
| | | .set(ClothesLocation::getName, dto.getName()) |
| | | .set(ClothesLocation::getCode, dto.getCode()) |
| | | .set(ClothesLocation::getOrderNum, dto.getOrderNum()) |
| | | .set(ClothesLocation::getPrice, dto.getPrice()) |
| | | .set(ClothesLocation::getImage, dto.getImage()) |
| | | .set(ClothesLocation::getContent, dto.getContent()) |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ClothesCloth> adminClothList(ClothesCloth dto, QueryRequest request) { |
| | | Page<ClothesCloth> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<ClothesCloth> queryWrapper = Wrappers.lambdaQuery(ClothesCloth.class); |
| | | Page<ClothesCloth> pages = clothesClothMapper.selectPage(page, queryWrapper); |
| | | return pages; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse clothAdd(ClothesCloth dto) { |
| | | ClothesCloth clothesCloth = new ClothesCloth(); |
| | | clothesCloth.setName(dto.getName()); |
| | | clothesCloth.setCode(dto.getCode()); |
| | | clothesCloth.setImage(dto.getImage()); |
| | | clothesCloth.setContent(dto.getContent()); |
| | | clothesCloth.setPrice(dto.getPrice()); |
| | | clothesCloth.setOrderNum(dto.getOrderNum()); |
| | | clothesClothMapper.insert(clothesCloth); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse clothUpdate(ClothesCloth dto) { |
| | | Long id = dto.getId(); |
| | | ClothesCloth clothesCloth = clothesClothMapper.selectById(id); |
| | | if (ObjectUtil.isNotNull(clothesCloth)) { |
| | | clothesClothMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesCloth.class) |
| | | .eq(ClothesCloth::getId, id) |
| | | .set(ClothesCloth::getName, dto.getName()) |
| | | .set(ClothesCloth::getCode, dto.getCode()) |
| | | .set(ClothesCloth::getOrderNum, dto.getOrderNum()) |
| | | .set(ClothesCloth::getPrice, dto.getPrice()) |
| | | .set(ClothesCloth::getImage, dto.getImage()) |
| | | .set(ClothesCloth::getContent, dto.getContent()) |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<ClothesArt> adminArtList(ClothesArt dto, QueryRequest request) { |
| | | Page<ClothesArt> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | LambdaQueryWrapper<ClothesArt> queryWrapper = Wrappers.lambdaQuery(ClothesArt.class); |
| | | Page<ClothesArt> pages = clothesArtMapper.selectPage(page, queryWrapper); |
| | | return pages; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse artAdd(ClothesArt dto) { |
| | | ClothesArt clothesArt = new ClothesArt(); |
| | | clothesArt.setName(dto.getName()); |
| | | clothesArt.setCode(dto.getCode()); |
| | | clothesArt.setImage(dto.getImage()); |
| | | clothesArt.setContent(dto.getContent()); |
| | | clothesArt.setPrice(dto.getPrice()); |
| | | clothesArt.setOrderNum(dto.getOrderNum()); |
| | | clothesArtMapper.insert(clothesArt); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse artUpdate(ClothesArt dto) { |
| | | Long id = dto.getId(); |
| | | ClothesArt clothesArt = clothesArtMapper.selectById(id); |
| | | if (ObjectUtil.isNotNull(clothesArt)) { |
| | | clothesArtMapper.update(null, |
| | | Wrappers.lambdaUpdate(ClothesArt.class) |
| | | .eq(ClothesArt::getId, id) |
| | | .set(ClothesArt::getName, dto.getName()) |
| | | .set(ClothesArt::getCode, dto.getCode()) |
| | | .set(ClothesArt::getOrderNum, dto.getOrderNum()) |
| | | .set(ClothesArt::getPrice, dto.getPrice()) |
| | | .set(ClothesArt::getImage, dto.getImage()) |
| | | .set(ClothesArt::getContent, dto.getContent()) |
| | | ); |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse artSet(AdminClothesTypeInfoDto dto) { |
| | | Long typeId = dto.getTypeId(); |
| | | List<Long> chooseIds = dto.getChooseIds(); |
| | | ClothesType clothesType = clothesTypeMapper.selectById(typeId); |
| | | if (ObjectUtil.isNotEmpty(clothesType)) { |
| | | LambdaQueryWrapper<ClothesTypeArt> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ClothesTypeArt::getTypeId,typeId); |
| | | clothesTypeArtMapper.delete(queryWrapper); |
| | | if(CollUtil.isNotEmpty(chooseIds)){ |
| | | for (Long chooseId : chooseIds){ |
| | | ClothesTypeArt entity = new ClothesTypeArt(); |
| | | entity.setTypeId(typeId); |
| | | entity.setArtId(chooseId); |
| | | clothesTypeArtMapper.insert(entity); |
| | | } |
| | | } |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse sizeSet(AdminClothesTypeInfoDto dto) { |
| | | Long typeId = dto.getTypeId(); |
| | | List<Long> chooseIds = dto.getChooseIds(); |
| | | ClothesType clothesType = clothesTypeMapper.selectById(typeId); |
| | | if (ObjectUtil.isNotEmpty(clothesType)) { |
| | | LambdaQueryWrapper<ClothesTypeSize> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ClothesTypeSize::getTypeId,typeId); |
| | | clothesTypeSizeMapper.delete(queryWrapper); |
| | | if(CollUtil.isNotEmpty(chooseIds)){ |
| | | for (Long chooseId : chooseIds){ |
| | | ClothesTypeSize entity = new ClothesTypeSize(); |
| | | entity.setTypeId(typeId); |
| | | entity.setSizeId(chooseId); |
| | | clothesTypeSizeMapper.insert(entity); |
| | | } |
| | | } |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse clothSet(AdminClothesTypeInfoDto dto) { |
| | | Long typeId = dto.getTypeId(); |
| | | List<Long> chooseIds = dto.getChooseIds(); |
| | | ClothesType clothesType = clothesTypeMapper.selectById(typeId); |
| | | if (ObjectUtil.isNotEmpty(clothesType)) { |
| | | LambdaQueryWrapper<ClothesTypeCloth> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ClothesTypeCloth::getTypeId,typeId); |
| | | clothesTypeClothMapper.delete(queryWrapper); |
| | | if(CollUtil.isNotEmpty(chooseIds)){ |
| | | for (Long chooseId : chooseIds){ |
| | | ClothesTypeCloth entity = new ClothesTypeCloth(); |
| | | entity.setTypeId(typeId); |
| | | entity.setClothId(chooseId); |
| | | clothesTypeClothMapper.insert(entity); |
| | | } |
| | | } |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse patternSet(AdminClothesTypeInfoDto dto) { |
| | | Long typeId = dto.getTypeId(); |
| | | List<Long> chooseIds = dto.getChooseIds(); |
| | | ClothesType clothesType = clothesTypeMapper.selectById(typeId); |
| | | if (ObjectUtil.isNotEmpty(clothesType)) { |
| | | LambdaQueryWrapper<ClothesTypePattern> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ClothesTypePattern::getTypeId,typeId); |
| | | clothesTypePatternMapper.delete(queryWrapper); |
| | | if(CollUtil.isNotEmpty(chooseIds)){ |
| | | for (Long chooseId : chooseIds){ |
| | | ClothesTypePattern entity = new ClothesTypePattern(); |
| | | entity.setTypeId(typeId); |
| | | entity.setPatternId(chooseId); |
| | | clothesTypePatternMapper.insert(entity); |
| | | } |
| | | } |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse locationSet(AdminClothesTypeInfoDto dto) { |
| | | Long typeId = dto.getTypeId(); |
| | | List<Long> chooseIds = dto.getChooseIds(); |
| | | ClothesType clothesType = clothesTypeMapper.selectById(typeId); |
| | | if (ObjectUtil.isNotEmpty(clothesType)) { |
| | | LambdaQueryWrapper<ClothesTypeLocation> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ClothesTypeLocation::getTypeId,typeId); |
| | | clothesTypeLocationMapper.delete(queryWrapper); |
| | | if(CollUtil.isNotEmpty(chooseIds)){ |
| | | for (Long chooseId : chooseIds){ |
| | | ClothesTypeLocation entity = new ClothesTypeLocation(); |
| | | entity.setTypeId(typeId); |
| | | entity.setLocationId(chooseId); |
| | | clothesTypeLocationMapper.insert(entity); |
| | | } |
| | | } |
| | | } |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | } |
New file |
| | |
| | | package cc.mrbird.febs.mall.vo.clothes; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class AdminClothesTypeInfoVo { |
| | | |
| | | private Long id; |
| | | |
| | | private String name; |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesArtMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesClothMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesLocationMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesPatternMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesSizeMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesTypeArtMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesTypeClothMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesTypeLocationMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesTypeMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesTypePatternMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cc.mrbird.febs.mall.mapper.ClothesTypeSizeMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-art-add" lay-title="新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="art-add"> |
| | | <form class="layui-form" action="" lay-filter="art-add-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="artImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="artImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="art-toolbar-container" class="toolbar"></div> |
| | | <div id="art-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="art-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect','jquery'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#art-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#art-toolbar-container', '#art-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#artImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#artImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(art-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/artAdd', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-art').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-art-Info" lay-title="编辑"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="art-info"> |
| | | <form class="layui-form" action="" lay-filter="art-info-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="id" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="artImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="artImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="art-toolbar-container" class="toolbar"></div> |
| | | <div id="art-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="art-info-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | .layui-table-cell { |
| | | height:auto; |
| | | } |
| | | .layui-upload-list { |
| | | margin: 0 !important; |
| | | } |
| | | .multi-images { |
| | | margin: 0 5px !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'validate','formSelects', 'table', 'upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | form = layui.form, |
| | | $view = $('#art-info'), |
| | | clothesArt = [[${clothesArt}]], |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#art-toolbar-container', '#art-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#artImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#artImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | initArtInfo(); |
| | | |
| | | function initArtInfo() { |
| | | console.log("clothesArt:", clothesArt); |
| | | form.val("art-info-form", { |
| | | "id": clothesArt.id, |
| | | "name": clothesArt.name, |
| | | "code": clothesArt.code, |
| | | "price": clothesArt.price, |
| | | "orderNum": clothesArt.orderNum, |
| | | }); |
| | | |
| | | |
| | | $('#artImageUpload').append('<img src="' + clothesArt.image + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#image").val(clothesArt.image); |
| | | |
| | | editor.txt.html(clothesArt.content); |
| | | |
| | | } |
| | | |
| | | form.on('submit(art-info-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/artUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-art').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-art" lay-title="工艺管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="art-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="artTable" lay-data="{id: 'artTable'}"></table> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | ::-webkit-scrollbar { |
| | | height: 20px !important; |
| | | background-color: #f4f4f4; |
| | | } |
| | | </style> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="artToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="artAdd:add" lay-event="artAdd">新增</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="artOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="artInfo:view" lay-event="artInfoEvent">编辑</button> |
| | | </script> |
| | | |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-art'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'orderNum', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initartTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(artTable)', function (obj) { |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'seeartImage') { |
| | | var t = $view.find('#seeartImage'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "小图标", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'artInfoEvent') { |
| | | febs.modal.open('编辑','modules/clothesType/artInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-art-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(artTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | if(layEvent === 'artAdd'){ |
| | | febs.modal.open('新增', 'modules/clothesType/artAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-art-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | function initartTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'artTable', |
| | | url: ctx + 'admin/clothesType/artList', |
| | | toolbar:"#artToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#artOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'center'}, |
| | | {field: 'code', title: '编码', minWidth: 150,align:'center'}, |
| | | {field: 'orderNum', title: '序号', minWidth: 100,align:'center'}, |
| | | {field: 'price', title: '价格', minWidth: 150,align:'center'}, |
| | | {field: 'image',title: '小图标', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeartImage">' + |
| | | '<img id="seeartImage' + d.id + '" src="' + d.image + |
| | | '" alt="小图标" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | // name: $searchForm.find('input[name="name"]').val().trim(), |
| | | // state: $searchForm.find("select[name='state']").val(), |
| | | // categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="art-set" lay-title="工艺配置"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="art-type-set"> |
| | | <form class="layui-form" action="" lay-filter="art-type-set-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">工艺配置</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="typeId" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-form-item"> |
| | | <div id="artSetMove"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="art-type-set-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs','form', 'transfer'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | form = layui.form, |
| | | transfer = layui.transfer, |
| | | artTypeAll = [[${artTypeAll}]], |
| | | artTypeChoose = [[${artTypeChoose}]], |
| | | typeId = [[${typeId}]], |
| | | $view = $('#art-set'), |
| | | |
| | | $artSetMoveQuery = $view.find('#artSetMoveQuery') |
| | | ; |
| | | |
| | | // 查询按钮 |
| | | $artSetMoveQuery.on('click', function () { |
| | | console.log(transfer.getData('artSetMove-set')) |
| | | |
| | | let data1 = transfer.getData('artSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let artIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | |
| | | console.log(artIdList) |
| | | }); |
| | | |
| | | |
| | | form.render(); |
| | | |
| | | initArtTypeSet(); |
| | | |
| | | function initArtTypeSet() { |
| | | console.log("artTypeAll:", artTypeAll); // 调试信息 |
| | | console.log("artTypeChoose:", artTypeChoose); // 调试信息 |
| | | console.log("typeId:", typeId); // 调试信息 |
| | | form.val("art-type-set-form", { |
| | | "typeId": typeId, |
| | | }); |
| | | // 转换数据格式(假设接口返回的数据结构需要处理) |
| | | var dataLeft = artTypeAll.map(function(item){ |
| | | return { |
| | | value: item.id, // 值字段 |
| | | title: item.name // 显示文本 |
| | | } |
| | | }); |
| | | var dataRight = artTypeChoose.map(function(item){ |
| | | return { |
| | | value: item, // 值字段 |
| | | } |
| | | }); |
| | | |
| | | // 渲染穿梭框 |
| | | transfer.render({ |
| | | elem: '#artSetMove', |
| | | data: dataLeft, |
| | | id: 'artSetMove-set', // 唯一标识 |
| | | title: ['待选择列表', '已选择列表'], |
| | | width: 300, |
| | | height: 400, |
| | | showSearch: true, |
| | | value: artTypeChoose, |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(art-type-set-form-submit)', function (data) { |
| | | let data1 = transfer.getData('artSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let artIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | data.field.chooseIds = artIdList; |
| | | data.field.typeId = typeId; |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/artSet', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-type').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-cloth-add" lay-title="新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="cloth-add"> |
| | | <form class="layui-form" action="" lay-filter="cloth-add-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="clothImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="clothImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="cloth-toolbar-container" class="toolbar"></div> |
| | | <div id="cloth-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="cloth-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect','jquery'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#cloth-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#cloth-toolbar-container', '#cloth-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#clothImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#clothImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(cloth-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/clothAdd', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-cloth').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-cloth-Info" lay-title="编辑"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="cloth-info"> |
| | | <form class="layui-form" action="" lay-filter="cloth-info-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="id" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="clothImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="clothImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="cloth-toolbar-container" class="toolbar"></div> |
| | | <div id="cloth-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="cloth-info-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | .layui-table-cell { |
| | | height:auto; |
| | | } |
| | | .layui-upload-list { |
| | | margin: 0 !important; |
| | | } |
| | | .multi-images { |
| | | margin: 0 5px !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'validate','formSelects', 'table', 'upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | form = layui.form, |
| | | $view = $('#cloth-info'), |
| | | clothesCloth = [[${clothesCloth}]], |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#cloth-toolbar-container', '#cloth-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#clothImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#clothImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | initclothInfo(); |
| | | |
| | | function initclothInfo() { |
| | | console.log("clothesCloth:", clothesCloth); |
| | | form.val("cloth-info-form", { |
| | | "id": clothesCloth.id, |
| | | "name": clothesCloth.name, |
| | | "code": clothesCloth.code, |
| | | "price": clothesCloth.price, |
| | | "orderNum": clothesCloth.orderNum, |
| | | }); |
| | | |
| | | |
| | | $('#clothImageUpload').append('<img src="' + clothesCloth.image + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#image").val(clothesCloth.image); |
| | | |
| | | editor.txt.html(clothesCloth.content); |
| | | |
| | | } |
| | | |
| | | form.on('submit(cloth-info-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/clothUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-cloth').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-cloth" lay-title="布料管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="cloth-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="clothTable" lay-data="{id: 'clothTable'}"></table> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | ::-webkit-scrollbar { |
| | | height: 20px !important; |
| | | background-color: #f4f4f4; |
| | | } |
| | | </style> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="clothToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="clothAdd:add" lay-event="clothAdd">新增</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="clothOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="clothInfo:view" lay-event="clothInfoEvent">编辑</button> |
| | | </script> |
| | | |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-cloth'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'orderNum', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initclothTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(clothTable)', function (obj) { |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'seeclothImage') { |
| | | var t = $view.find('#seeclothImage'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "小图标", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'clothInfoEvent') { |
| | | febs.modal.open('编辑','modules/clothesType/clothInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-cloth-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(clothTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | if(layEvent === 'clothAdd'){ |
| | | febs.modal.open('新增', 'modules/clothesType/clothAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-cloth-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | function initclothTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'clothTable', |
| | | url: ctx + 'admin/clothesType/clothList', |
| | | toolbar:"#clothToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#clothOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'center'}, |
| | | {field: 'code', title: '编码', minWidth: 150,align:'center'}, |
| | | {field: 'orderNum', title: '序号', minWidth: 100,align:'center'}, |
| | | {field: 'price', title: '价格', minWidth: 150,align:'center'}, |
| | | {field: 'image',title: '小图标', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeclothImage">' + |
| | | '<img id="seeclothImage' + d.id + '" src="' + d.image + |
| | | '" alt="小图标" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | // name: $searchForm.find('input[name="name"]').val().trim(), |
| | | // state: $searchForm.find("select[name='state']").val(), |
| | | // categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="cloth-set" lay-title="布料配置"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="cloth-type-set"> |
| | | <form class="layui-form" action="" lay-filter="cloth-type-set-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">布料配置</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="typeId" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-form-item"> |
| | | <div id="clothSetMove"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="cloth-type-set-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs','form', 'transfer'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | form = layui.form, |
| | | transfer = layui.transfer, |
| | | clothTypeAll = [[${clothTypeAll}]], |
| | | clothTypeChoose = [[${clothTypeChoose}]], |
| | | typeId = [[${typeId}]], |
| | | $view = $('#cloth-set'), |
| | | |
| | | $clothSetMoveQuery = $view.find('#clothSetMoveQuery') |
| | | ; |
| | | |
| | | // 查询按钮 |
| | | $clothSetMoveQuery.on('click', function () { |
| | | console.log(transfer.getData('clothSetMove-set')) |
| | | |
| | | let data1 = transfer.getData('clothSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let clothIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | |
| | | console.log(clothIdList) |
| | | }); |
| | | |
| | | |
| | | form.render(); |
| | | |
| | | clothTypeSetInit(); |
| | | |
| | | function clothTypeSetInit() { |
| | | console.log("clothTypeAll:", clothTypeAll); // 调试信息 |
| | | console.log("clothTypeChoose:", clothTypeChoose); // 调试信息 |
| | | console.log("typeId:", typeId); // 调试信息 |
| | | form.val("cloth-type-set-form", { |
| | | "typeId": typeId, |
| | | }); |
| | | // 转换数据格式(假设接口返回的数据结构需要处理) |
| | | var dataLeft = clothTypeAll.map(function(item){ |
| | | return { |
| | | value: item.id, // 值字段 |
| | | title: item.name // 显示文本 |
| | | } |
| | | }); |
| | | var dataRight = clothTypeChoose.map(function(item){ |
| | | return { |
| | | value: item, // 值字段 |
| | | } |
| | | }); |
| | | |
| | | // 渲染穿梭框 |
| | | transfer.render({ |
| | | elem: '#clothSetMove', |
| | | data: dataLeft, |
| | | id: 'clothSetMove-set', // 唯一标识 |
| | | title: ['待选择列表', '已选择列表'], |
| | | width: 300, |
| | | height: 400, |
| | | showSearch: true, |
| | | value: clothTypeChoose, |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(cloth-type-set-form-submit)', function (data) { |
| | | let data1 = transfer.getData('clothSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let clothIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | data.field.chooseIds = clothIdList; |
| | | data.field.typeId = typeId; |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/clothSet', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-type').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-location-add" lay-title="新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="location-add"> |
| | | <form class="layui-form" action="" lay-filter="location-add-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="locationImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="locationImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="location-toolbar-container" class="toolbar"></div> |
| | | <div id="location-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="location-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect','jquery'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#location-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#location-toolbar-container', '#location-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#locationImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#locationImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(location-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/locationAdd', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-location').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-location-Info" lay-title="编辑"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="location-info"> |
| | | <form class="layui-form" action="" lay-filter="location-info-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="id" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="locationImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="locationImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="location-toolbar-container" class="toolbar"></div> |
| | | <div id="location-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="location-info-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | .layui-table-cell { |
| | | height:auto; |
| | | } |
| | | .layui-upload-list { |
| | | margin: 0 !important; |
| | | } |
| | | .multi-images { |
| | | margin: 0 5px !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'validate','formSelects', 'table', 'upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | form = layui.form, |
| | | $view = $('#location-info'), |
| | | clothesLocation = [[${clothesLocation}]], |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#location-toolbar-container', '#location-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#locationImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#locationImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | initLocationInfo(); |
| | | |
| | | function initLocationInfo() { |
| | | console.log("clothesLocation:", clothesLocation); |
| | | form.val("location-info-form", { |
| | | "id": clothesLocation.id, |
| | | "name": clothesLocation.name, |
| | | "code": clothesLocation.code, |
| | | "price": clothesLocation.price, |
| | | "orderNum": clothesLocation.orderNum, |
| | | }); |
| | | |
| | | |
| | | $('#locationImageUpload').append('<img src="' + clothesLocation.image + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#image").val(clothesLocation.image); |
| | | |
| | | editor.txt.html(clothesLocation.content); |
| | | |
| | | } |
| | | |
| | | form.on('submit(location-info-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/locationUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-location').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-location" lay-title="图案位置管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="location-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="locationTable" lay-data="{id: 'locationTable'}"></table> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | ::-webkit-scrollbar { |
| | | height: 20px !important; |
| | | background-color: #f4f4f4; |
| | | } |
| | | </style> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="locationToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="locationAdd:add" lay-event="locationAdd">新增</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="locationOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="locationInfo:view" lay-event="locationInfoEvent">编辑</button> |
| | | </script> |
| | | |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-location'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'orderNum', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initlocationTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(locationTable)', function (obj) { |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'seelocationImage') { |
| | | var t = $view.find('#seelocationImage'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "小图标", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'locationInfoEvent') { |
| | | febs.modal.open('编辑','modules/clothesType/locationInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-location-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(locationTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | if(layEvent === 'locationAdd'){ |
| | | febs.modal.open('新增', 'modules/clothesType/locationAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-location-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | function initlocationTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'locationTable', |
| | | url: ctx + 'admin/clothesType/locationList', |
| | | toolbar:"#locationToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#locationOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'center'}, |
| | | {field: 'code', title: '编码', minWidth: 150,align:'center'}, |
| | | {field: 'orderNum', title: '序号', minWidth: 100,align:'center'}, |
| | | {field: 'price', title: '价格', minWidth: 150,align:'center'}, |
| | | {field: 'image',title: '小图标', |
| | | templet: function (d) { |
| | | return '<a lay-event="seelocationImage">' + |
| | | '<img id="seelocationImage' + d.id + '" src="' + d.image + |
| | | '" alt="小图标" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | // name: $searchForm.find('input[name="name"]').val().trim(), |
| | | // state: $searchForm.find("select[name='state']").val(), |
| | | // categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="location-set" lay-title="图案位置配置"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="location-type-set"> |
| | | <form class="layui-form" action="" lay-filter="location-type-set-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">图案位置配置</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="typeId" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-form-item"> |
| | | <div id="locationSetMove"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="location-type-set-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs','form', 'transfer'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | form = layui.form, |
| | | transfer = layui.transfer, |
| | | locationTypeAll = [[${locationTypeAll}]], |
| | | locationTypeChoose = [[${locationTypeChoose}]], |
| | | typeId = [[${typeId}]], |
| | | $view = $('#location-set'), |
| | | |
| | | $locationSetMoveQuery = $view.find('#locationSetMoveQuery') |
| | | ; |
| | | |
| | | // 查询按钮 |
| | | $locationSetMoveQuery.on('click', function () { |
| | | console.log(transfer.getData('locationSetMove-set')) |
| | | |
| | | let data1 = transfer.getData('locationSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let locationIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | |
| | | console.log(locationIdList) |
| | | }); |
| | | |
| | | |
| | | form.render(); |
| | | |
| | | locationTypeSetInit(); |
| | | |
| | | function locationTypeSetInit() { |
| | | console.log("locationTypeAll:", locationTypeAll); // 调试信息 |
| | | console.log("locationTypeChoose:", locationTypeChoose); // 调试信息 |
| | | console.log("typeId:", typeId); // 调试信息 |
| | | form.val("location-type-set-form", { |
| | | "typeId": typeId, |
| | | }); |
| | | // 转换数据格式(假设接口返回的数据结构需要处理) |
| | | var dataLeft = locationTypeAll.map(function(item){ |
| | | return { |
| | | value: item.id, // 值字段 |
| | | title: item.name // 显示文本 |
| | | } |
| | | }); |
| | | var dataRight = locationTypeChoose.map(function(item){ |
| | | return { |
| | | value: item, // 值字段 |
| | | } |
| | | }); |
| | | |
| | | // 渲染穿梭框 |
| | | transfer.render({ |
| | | elem: '#locationSetMove', |
| | | data: dataLeft, |
| | | id: 'locationSetMove-set', // 唯一标识 |
| | | title: ['待选择列表', '已选择列表'], |
| | | width: 300, |
| | | height: 400, |
| | | showSearch: true, |
| | | value: locationTypeChoose, |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(location-type-set-form-submit)', function (data) { |
| | | let data1 = transfer.getData('locationSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let locationIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | data.field.chooseIds = locationIdList; |
| | | data.field.typeId = typeId; |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/locationSet', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-type').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-pattern-add" lay-title="新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="pattern-add"> |
| | | <form class="layui-form" action="" lay-filter="pattern-add-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">图案类型:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="type"> |
| | | <option value="1">文字</option> |
| | | <option value="2">图案</option> |
| | | <option value="3">文字和图案</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="patternImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="patternImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="pattern-toolbar-container" class="toolbar"></div> |
| | | <div id="pattern-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="pattern-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect','jquery'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#pattern-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#pattern-toolbar-container', '#pattern-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#patternImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#patternImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(pattern-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/patternAdd', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-pattern').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-pattern-Info" lay-title="编辑"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="pattern-info"> |
| | | <form class="layui-form" action="" lay-filter="pattern-info-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="id" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">图案类型:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="type"> |
| | | <option value="1">文字</option> |
| | | <option value="2">图案</option> |
| | | <option value="3">文字和图案</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="patternImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="patternImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="pattern-toolbar-container" class="toolbar"></div> |
| | | <div id="pattern-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="pattern-info-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | .layui-table-cell { |
| | | height:auto; |
| | | } |
| | | .layui-upload-list { |
| | | margin: 0 !important; |
| | | } |
| | | .multi-images { |
| | | margin: 0 5px !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'validate','formSelects', 'table', 'upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | form = layui.form, |
| | | $view = $('#pattern-info'), |
| | | clothesPattern = [[${clothesPattern}]], |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#pattern-toolbar-container', '#pattern-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#patternImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#patternImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | initPatternInfo(); |
| | | |
| | | function initPatternInfo() { |
| | | console.log("clothesPattern:", clothesPattern); |
| | | form.val("pattern-info-form", { |
| | | "id": clothesPattern.id, |
| | | "name": clothesPattern.name, |
| | | "code": clothesPattern.code, |
| | | "price": clothesPattern.price, |
| | | "type": clothesPattern.type, |
| | | "orderNum": clothesPattern.orderNum, |
| | | }); |
| | | |
| | | |
| | | $('#patternImageUpload').append('<img src="' + clothesPattern.image + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#image").val(clothesPattern.image); |
| | | |
| | | editor.txt.html(clothesPattern.content); |
| | | |
| | | } |
| | | |
| | | form.on('submit(pattern-info-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/patternUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-pattern').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-pattern" lay-title="图案管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="pattern-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="patternTable" lay-data="{id: 'patternTable'}"></table> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | ::-webkit-scrollbar { |
| | | height: 20px !important; |
| | | background-color: #f4f4f4; |
| | | } |
| | | </style> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="patternToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="patternAdd:add" lay-event="patternAdd">新增</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="patternOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="patternInfo:view" lay-event="patternInfoEvent">编辑</button> |
| | | </script> |
| | | <script type="text/html" id="patternTypeOption"> |
| | | {{# |
| | | var type = { |
| | | 1: {title: '文字', color: 'green'}, |
| | | 2: {title: '图案', color: 'blue'}, |
| | | 3: {title: '文字和图案', color: 'red'}, |
| | | }[d.type]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{type.color}}">{{ type.title }}</span> |
| | | </script> |
| | | |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-pattern'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'orderNum', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initPatternTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(patternTable)', function (obj) { |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'seePatternImage') { |
| | | var t = $view.find('#seePatternImage'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "小图标", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'patternInfoEvent') { |
| | | febs.modal.open('编辑','modules/clothesType/patternInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-pattern-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(patternTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | if(layEvent === 'patternAdd'){ |
| | | febs.modal.open('新增', 'modules/clothesType/patternAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-pattern-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | function initPatternTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'patternTable', |
| | | url: ctx + 'admin/clothesType/patternList', |
| | | toolbar:"#patternToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#patternOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'center'}, |
| | | {field: 'code', title: '编码', minWidth: 150,align:'center'}, |
| | | {field: 'orderNum', title: '序号', minWidth: 100,align:'center'}, |
| | | {field: 'price', title: '价格', minWidth: 150,align:'center'}, |
| | | {title: '图案类型', templet: '#patternTypeOption', minWidth: 150,align:'center'}, |
| | | {field: 'image',title: '小图标', |
| | | templet: function (d) { |
| | | return '<a lay-event="seePatternImage">' + |
| | | '<img id="seePatternImage' + d.id + '" src="' + d.image + |
| | | '" alt="小图标" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | // name: $searchForm.find('input[name="name"]').val().trim(), |
| | | // state: $searchForm.find("select[name='state']").val(), |
| | | // categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="pattern-set" lay-title="图案文字配置"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="pattern-type-set"> |
| | | <form class="layui-form" action="" lay-filter="pattern-type-set-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">图案文字配置</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="typeId" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-form-item"> |
| | | <div id="patternSetMove"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="pattern-type-set-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs','form', 'transfer'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | form = layui.form, |
| | | transfer = layui.transfer, |
| | | patternTypeAll = [[${patternTypeAll}]], |
| | | patternTypeChoose = [[${patternTypeChoose}]], |
| | | typeId = [[${typeId}]], |
| | | $view = $('#pattern-set'), |
| | | |
| | | $patternSetMoveQuery = $view.find('#patternSetMoveQuery') |
| | | ; |
| | | |
| | | // 查询按钮 |
| | | $patternSetMoveQuery.on('click', function () { |
| | | console.log(transfer.getData('patternSetMove-set')) |
| | | |
| | | let data1 = transfer.getData('patternSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let patternIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | |
| | | console.log(patternIdList) |
| | | }); |
| | | |
| | | |
| | | form.render(); |
| | | |
| | | patternTypeSetInit(); |
| | | |
| | | function patternTypeSetInit() { |
| | | console.log("patternTypeAll:", patternTypeAll); // 调试信息 |
| | | console.log("patternTypeChoose:", patternTypeChoose); // 调试信息 |
| | | console.log("typeId:", typeId); // 调试信息 |
| | | form.val("pattern-type-set-form", { |
| | | "typeId": typeId, |
| | | }); |
| | | // 转换数据格式(假设接口返回的数据结构需要处理) |
| | | var dataLeft = patternTypeAll.map(function(item){ |
| | | return { |
| | | value: item.id, // 值字段 |
| | | title: item.name // 显示文本 |
| | | } |
| | | }); |
| | | var dataRight = patternTypeChoose.map(function(item){ |
| | | return { |
| | | value: item, // 值字段 |
| | | } |
| | | }); |
| | | |
| | | // 渲染穿梭框 |
| | | transfer.render({ |
| | | elem: '#patternSetMove', |
| | | data: dataLeft, |
| | | id: 'patternSetMove-set', // 唯一标识 |
| | | title: ['待选择列表', '已选择列表'], |
| | | width: 300, |
| | | height: 400, |
| | | showSearch: true, |
| | | value: patternTypeChoose, |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(pattern-type-set-form-submit)', function (data) { |
| | | let data1 = transfer.getData('patternSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let patternIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | data.field.chooseIds = patternIdList; |
| | | data.field.typeId = typeId; |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/patternSet', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-type').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-size-add" lay-title="新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="size-add"> |
| | | <form class="layui-form" action="" lay-filter="size-add-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">尺码类型:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="type"> |
| | | <option value="1">衣服</option> |
| | | <option value="2">裤子</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="sizeImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="sizeImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="size-toolbar-container" class="toolbar"></div> |
| | | <div id="size-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="size-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect','jquery'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#size-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#size-toolbar-container', '#size-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#sizeImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#sizeImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(size-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/sizeAdd', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-size').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-size-Info" lay-title="编辑"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="size-info"> |
| | | <form class="layui-form" action="" lay-filter="size-info-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="id" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="code" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">尺码类型:</label> |
| | | <div class="layui-input-block"> |
| | | <select name="type"> |
| | | <option value="1">衣服</option> |
| | | <option value="2">裤子</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">价格:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="price" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="sizeImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="sizeImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="size-toolbar-container" class="toolbar"></div> |
| | | <div id="size-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="size-info-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | .layui-table-cell { |
| | | height:auto; |
| | | } |
| | | .layui-upload-list { |
| | | margin: 0 !important; |
| | | } |
| | | .multi-images { |
| | | margin: 0 5px !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'validate','formSelects', 'table', 'upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | form = layui.form, |
| | | $view = $('#size-info'), |
| | | clothesSize = [[${clothesSize}]], |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#size-toolbar-container', '#size-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#sizeImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#sizeImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | initSizeInfo(); |
| | | |
| | | function initSizeInfo() { |
| | | console.log("clothesSize:", clothesSize); |
| | | form.val("size-info-form", { |
| | | "id": clothesSize.id, |
| | | "name": clothesSize.name, |
| | | "type": clothesSize.type, |
| | | "code": clothesSize.code, |
| | | "price": clothesSize.price, |
| | | "orderNum": clothesSize.orderNum, |
| | | }); |
| | | |
| | | |
| | | $('#sizeImageUpload').append('<img src="' + clothesSize.image + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#image").val(clothesSize.image); |
| | | |
| | | editor.txt.html(clothesSize.content); |
| | | |
| | | } |
| | | |
| | | form.on('submit(size-info-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/sizeUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-size').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-size" lay-title="尺码管理"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="size-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="sizeTable" lay-data="{id: 'sizeTable'}"></table> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | ::-webkit-scrollbar { |
| | | height: 20px !important; |
| | | background-color: #f4f4f4; |
| | | } |
| | | </style> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="sizeToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="sizeAdd:add" lay-event="sizeAdd">新增</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="sizeOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="sizeInfo:view" lay-event="sizeInfoEvent">编辑</button> |
| | | </script> |
| | | |
| | | <script type="text/html" id="typeOption"> |
| | | {{# |
| | | var type = { |
| | | 1: {title: '衣服', color: 'green'}, |
| | | 2: {title: '裤子', color: 'blue'}, |
| | | }[d.type]; |
| | | }} |
| | | <span class="layui-badge febs-bg-{{type.color}}">{{ type.title }}</span> |
| | | </script> |
| | | |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-size'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'orderNum', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initSizeTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(sizeTable)', function (obj) { |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'seeSizeImage') { |
| | | var t = $view.find('#seeSizeImage'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "小图标", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'sizeInfoEvent') { |
| | | febs.modal.open('编辑','modules/clothesType/sizeInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-size-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(sizeTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | if(layEvent === 'sizeAdd'){ |
| | | febs.modal.open('新增', 'modules/clothesType/sizeAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-size-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | |
| | | function initSizeTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'sizeTable', |
| | | url: ctx + 'admin/clothesType/sizeList', |
| | | toolbar:"#sizeToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#sizeOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'center'}, |
| | | {field: 'code', title: '编码', minWidth: 150,align:'center'}, |
| | | {field: 'orderNum', title: '序号', minWidth: 100,align:'center'}, |
| | | {title: '尺码类型', templet: '#typeOption', minWidth: 150,align:'center'}, |
| | | {field: 'price', title: '价格', minWidth: 150,align:'center'}, |
| | | {field: 'image',title: '小图标', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeSizeImage">' + |
| | | '<img id="seeSizeImage' + d.id + '" src="' + d.image + |
| | | '" alt="小图标" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | // name: $searchForm.find('input[name="name"]').val().trim(), |
| | | // state: $searchForm.find("select[name='state']").val(), |
| | | // categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="size-set" lay-title="尺码配置"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="size-type-set"> |
| | | <form class="layui-form" action="" lay-filter="size-type-set-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">尺码配置</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="typeId" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-form-item"> |
| | | <div id="sizeSetMove"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="size-type-set-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs','form', 'transfer'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | form = layui.form, |
| | | transfer = layui.transfer, |
| | | sizeTypeAll = [[${sizeTypeAll}]], |
| | | sizeTypeChoose = [[${sizeTypeChoose}]], |
| | | typeId = [[${typeId}]], |
| | | $view = $('#size-set'), |
| | | |
| | | $sizeSetMoveQuery = $view.find('#sizeSetMoveQuery') |
| | | ; |
| | | |
| | | // 查询按钮 |
| | | $sizeSetMoveQuery.on('click', function () { |
| | | console.log(transfer.getData('sizeSetMove-set')) |
| | | |
| | | let data1 = transfer.getData('sizeSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let sizeIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | |
| | | console.log(sizeIdList) |
| | | }); |
| | | |
| | | |
| | | form.render(); |
| | | |
| | | sizeTypeSetInit(); |
| | | |
| | | function sizeTypeSetInit() { |
| | | console.log("sizeTypeAll:", sizeTypeAll); // 调试信息 |
| | | console.log("sizeTypeChoose:", sizeTypeChoose); // 调试信息 |
| | | console.log("typeId:", typeId); // 调试信息 |
| | | form.val("size-type-set-form", { |
| | | "typeId": typeId, |
| | | }); |
| | | // 转换数据格式(假设接口返回的数据结构需要处理) |
| | | var dataLeft = sizeTypeAll.map(function(item){ |
| | | return { |
| | | value: item.id, // 值字段 |
| | | title: item.name // 显示文本 |
| | | } |
| | | }); |
| | | var dataRight = sizeTypeChoose.map(function(item){ |
| | | return { |
| | | value: item, // 值字段 |
| | | } |
| | | }); |
| | | |
| | | // 渲染穿梭框 |
| | | transfer.render({ |
| | | elem: '#sizeSetMove', |
| | | data: dataLeft, |
| | | id: 'sizeSetMove-set', // 唯一标识 |
| | | title: ['待选择列表', '已选择列表'], |
| | | width: 300, |
| | | height: 400, |
| | | showSearch: true, |
| | | value: sizeTypeChoose, |
| | | }); |
| | | } |
| | | |
| | | form.on('submit(size-type-set-form-submit)', function (data) { |
| | | let data1 = transfer.getData('sizeSetMove-set'); |
| | | //获取data1中的value,返回一个数组 |
| | | let sizeIdList = data1.map(function(item){ |
| | | return item.value; |
| | | }); |
| | | data.field.chooseIds = sizeIdList; |
| | | data.field.typeId = typeId; |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/sizeSet', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-type').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-type-add" lay-title="新增"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="clothes-type-add"> |
| | | <form class="layui-form" action="" lay-filter="clothes-type-add-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="typeImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="typeImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">正面图:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="imageFrontUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="imageFrontUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">正面图链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="imageFront" lay-verify="required" name="imageFront" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">反面图:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="imageBackUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="imageBackUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">反面图链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="imageBack" lay-verify="required" name="imageBack" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="clothesType-toolbar-container" class="toolbar"></div> |
| | | <div id="clothesType-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="type-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | .layui-table-cell { |
| | | height:auto; |
| | | } |
| | | </style> |
| | | |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'formSelects', 'validate', 'treeSelect', 'eleTree','dropdown', 'laydate', 'layedit', 'upload', 'element', 'table', 'xmSelect','jquery'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | formSelects = layui.formSelects, |
| | | treeSelect = layui.treeSelect, |
| | | form = layui.form, |
| | | laydate = layui.laydate, |
| | | eleTree = layui.eleTree, |
| | | $view = $('#clothes-type-add'), |
| | | layedit = layui.layedit, |
| | | upload = layui.upload, |
| | | validate = layui.validate, |
| | | element = layui.element; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#clothesType-toolbar-container', '#clothesType-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#typeImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#typeImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#imageFrontUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#imageFrontUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#imageFront").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#imageBackUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#imageBackUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#imageBack").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | form.on('submit(type-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/typeAdd', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-type').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-type-Info" lay-title="编辑"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-fluid" id="type-info"> |
| | | <form class="layui-form" action="" lay-filter="type-info-form"> |
| | | <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief"> |
| | | <ul class="layui-tab-title"> |
| | | <li class="layui-this">基础信息</li> |
| | | </ul> |
| | | <div class="layui-tab-content"> |
| | | <input type="text" name="id" |
| | | placeholder="" autoComplete="off" class="layui-input febs-hide"> |
| | | <div class="layui-tab-item layui-show"> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">名称:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="name" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">排序:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="number" name="orderNum" lay-verify="required" |
| | | placeholder="" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">小图标:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="typeImageUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="typeImageUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">小图标链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="image" lay-verify="required" name="image" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">正面图:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="imageFrontUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="imageFrontUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">正面图链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="imageFront" lay-verify="required" name="imageFront" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-row layui-col-space10 layui-form-item"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label febs-form-item-require">反面图:</label> |
| | | <div class="layui-input-block"> |
| | | <div class="layui-upload"> |
| | | <button type="button" class="layui-btn layui-btn-normal layui-btn" id="imageBackUploadButton">上传</button> |
| | | <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;"> |
| | | <div class="layui-upload-list" id="imageBackUpload"></div> |
| | | </blockquote> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-row layui-col-space10 layui-form-item febs-hide"> |
| | | <div class="layui-col-lg6"> |
| | | <label class="layui-form-label">反面图链接:</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" id="imageBack" lay-verify="required" name="imageBack" autocomplete="off" class="layui-input" readonly> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label febs-form-item-require">详情介绍:</label> |
| | | <div class="layui-input-block"> |
| | | <div style="border: 1px solid #ccc;"> |
| | | <div id="clothesType-toolbar-container" class="toolbar"></div> |
| | | <div id="clothesType-text-container" class="text" style="height: 450px;"></div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item febs-hide"> |
| | | <button class="layui-btn" lay-submit="" lay-filter="type-info-form-submit" id="submit">保存</button> |
| | | </div> |
| | | </form> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <style> |
| | | .blue-border { |
| | | border-left-color: #2db7f5; |
| | | font-size: 18px; |
| | | } |
| | | .layui-table-cell { |
| | | height:auto; |
| | | } |
| | | .layui-upload-list { |
| | | margin: 0 !important; |
| | | } |
| | | .multi-images { |
| | | margin: 0 5px !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="javascript"> |
| | | layui.use(['febs', 'form', 'validate','formSelects', 'table', 'upload'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | layer = layui.layer, |
| | | table = layui.table, |
| | | form = layui.form, |
| | | $view = $('#type-info'), |
| | | clothesType = [[${clothesType}]], |
| | | upload = layui.upload, |
| | | validate = layui.validate; |
| | | |
| | | form.render(); |
| | | |
| | | const E = window.wangEditor; |
| | | const editor = new E('#clothesType-toolbar-container', '#clothesType-text-container'); // 传入两个元素 |
| | | editor.config.showLinkImg = false; |
| | | editor.config.uploadFileName = 'file'; |
| | | editor.config.customUploadImg = function (files, insertImgFn) { |
| | | // files 是 input 中选中的文件列表 |
| | | // insertImgFn 是获取图片 url 后,插入到编辑器的方法 |
| | | // 上传图片,返回结果,将图片插入到编辑器中 |
| | | for (let i = 0; i < files.length; i++){ |
| | | var form = new FormData(); |
| | | form.append("file", files[0]); |
| | | $.ajax({ |
| | | url:'/admin/goods/uploadFileBase64', |
| | | type: "post", |
| | | processData: false, |
| | | contentType: false, |
| | | data: form, |
| | | dataType: 'json', |
| | | success(res) { |
| | | // 上传代码返回结果之后,将图片插入到编辑器中 |
| | | insertImgFn(res.data.src, res.data.title, '') |
| | | } |
| | | }) |
| | | } |
| | | }; |
| | | editor.create(); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#typeImageUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#typeImageUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#image").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#imageFrontUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#imageFrontUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#imageFront").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | //图片上传 |
| | | upload.render({ |
| | | elem: '#imageBackUploadButton' |
| | | ,url: ctx + 'admin/goods/uploadFileBase64' //改成您自己的上传接口 |
| | | ,accept: 'file' //普通文件 |
| | | ,size: 10240 //限制文件大小,单位 KB |
| | | ,before: function(obj){ |
| | | //预读本地文件示例,不支持ie8 |
| | | obj.preview(function(index, file, result){ |
| | | $('#imageBackUpload').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img single-image" style="width: 130px">') |
| | | }); |
| | | } |
| | | ,done: function(res){ |
| | | $("#imageBack").val(res.data.src); |
| | | } |
| | | }); |
| | | |
| | | initClothesTypeInfo(); |
| | | |
| | | function initClothesTypeInfo() { |
| | | console.log("clothesType:", clothesType); |
| | | form.val("type-info-form", { |
| | | "id": clothesType.id, |
| | | "name": clothesType.name, |
| | | "orderNum": clothesType.orderNum, |
| | | }); |
| | | |
| | | |
| | | $('#typeImageUpload').append('<img src="' + clothesType.image + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#image").val(clothesType.image); |
| | | |
| | | |
| | | $('#imageFrontUpload').append('<img src="' + clothesType.imageFront + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#imageFront").val(clothesType.imageFront); |
| | | |
| | | |
| | | $('#imageBackUpload').append('<img src="' + clothesType.imageBack + '" alt="" class="layui-upload-img single-image" style="width: 130px">'); |
| | | $("#imageBack").val(clothesType.imageBack); |
| | | |
| | | editor.txt.html(clothesType.content); |
| | | |
| | | } |
| | | |
| | | form.on('submit(type-info-form-submit)', function (data) { |
| | | data.field.content = editor.txt.html(); |
| | | $.ajax({ |
| | | 'url':ctx + 'admin/clothesType/typeUpdate', |
| | | 'type':'post', |
| | | 'dataType':'json', |
| | | 'headers' : {'Content-Type' : 'application/json;charset=utf-8'}, //接口json格式 |
| | | 'traditional': true,//ajax传递数组必须添加属性 |
| | | 'data':JSON.stringify(data.field), |
| | | 'success':function (data) { |
| | | if(data.code==200){ |
| | | layer.closeAll(); |
| | | febs.alert.success(data.message); |
| | | $('#febs-type').find('#query').click(); |
| | | }else{ |
| | | febs.alert.warn(data.message); |
| | | } |
| | | }, |
| | | 'error':function () { |
| | | febs.alert.warn('服务器繁忙'); |
| | | } |
| | | }) |
| | | return false; |
| | | }); |
| | | |
| | | }); |
| | | </script> |
New file |
| | |
| | | <div class="layui-fluid layui-anim febs-anim" id="febs-type" lay-title="设计类型"> |
| | | <div class="layui-row febs-container"> |
| | | <div class="layui-col-md12"> |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body febs-table-full"> |
| | | <form class="layui-form layui-table-form" lay-filter="clothesType-table-form"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-md10"> |
| | | <div class="layui-form-item"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area"> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset"> |
| | | <i class="layui-icon"></i> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </form> |
| | | <table lay-filter="clothesTypeTable" lay-data="{id: 'clothesTypeTable'}"></table> |
| | | |
| | | <style type="text/css"> |
| | | .layui-table-cell{ |
| | | text-align:center; |
| | | height: auto; |
| | | white-space: nowrap; /*文本不会换行,在同一行显示*/ |
| | | overflow: hidden; /*超出隐藏*/ |
| | | text-overflow: ellipsis; /*省略号显示*/ |
| | | } |
| | | .layui-table img{ |
| | | max-width:100px |
| | | } |
| | | ::-webkit-scrollbar { |
| | | height: 20px !important; |
| | | background-color: #f4f4f4; |
| | | } |
| | | </style> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <!-- 表格操作栏 start --> |
| | | <script type="text/html" id="user-option"> |
| | | <span shiro:lacksPermission="list:view,add:add,votesActivityUpdate:update"> |
| | | <span class="layui-badge-dot febs-bg-orange"></span> 无权限 |
| | | </span> |
| | | <a lay-event="edit" shiro:hasPermission="votesActivityUpdate:update"><i |
| | | class="layui-icon febs-edit-area febs-blue"></i></a> |
| | | </script> |
| | | |
| | | <script type="text/html" id="clothesTypeToolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="typeAdd:add" lay-event="typeAdd">新增</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="artSet:view" lay-event="artSet">工艺配置</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="sizeSet:view" lay-event="sizeSet">尺码配置</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="clothSet:view" lay-event="clothSet">布料配置</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="patternSet:view" lay-event="patternSet">图案文字配置</button> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="locationSet:view" lay-event="locationSet">图案位置配置</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <script type="text/html" id="clothesTypeOption"> |
| | | <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" shiro:hasPermission="typeInfo:view" lay-event="typeInfoEvent">编辑</button> |
| | | </script> |
| | | |
| | | |
| | | <script type="text/html" id="stateSwitch"> |
| | | {{# if(d.state === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="stateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="stateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="clothStateSwitch"> |
| | | {{# if(d.clothState === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="clothStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="clothStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="artStateSwitch"> |
| | | {{# if(d.artState === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="artStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="artStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="patternStateSwitch"> |
| | | {{# if(d.patternState === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="patternStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="patternStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="locationStateSwitch"> |
| | | {{# if(d.locationState === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="locationStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="locationStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | <script type="text/html" id="sizeStateSwitch"> |
| | | {{# if(d.sizeState === 1) { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" checked lay-skin="switch" lay-filter="sizeStateSwitch"> |
| | | {{# } else { }} |
| | | <input type="checkbox" value={{d.id}} lay-text="开启|关闭" lay-skin="switch" lay-filter="sizeStateSwitch"> |
| | | {{# } }} |
| | | </script> |
| | | |
| | | <style> |
| | | .layui-form-onswitch { |
| | | background-color: #5FB878 !important; |
| | | } |
| | | </style> |
| | | <!-- 表格操作栏 end --> |
| | | <script data-th-inline="none" type="text/javascript"> |
| | | // 引入组件并初始化 |
| | | layui.use([ 'jquery', 'form', 'table', 'febs'], function () { |
| | | var $ = layui.jquery, |
| | | febs = layui.febs, |
| | | form = layui.form, |
| | | table = layui.table, |
| | | $view = $('#febs-type'), |
| | | $query = $view.find('#query'), |
| | | $reset = $view.find('#reset'), |
| | | $searchForm = $view.find('form'), |
| | | sortObject = {field: 'orderNum', type: null}, |
| | | tableIns; |
| | | |
| | | form.render(); |
| | | |
| | | // 表格初始化 |
| | | initClothesTypeTable(); |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('tool(clothesTypeTable)', function (obj) { |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | var data = obj.data, |
| | | layEvent = obj.event; |
| | | |
| | | if (layEvent === 'seeImage') { |
| | | var t = $view.find('#seeImage'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "小图标", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'seeImageFront') { |
| | | var t = $view.find('#seeImageFront'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "正面", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'seeImageBack') { |
| | | var t = $view.find('#seeImageBack'+data.id+''); |
| | | //页面层 |
| | | layer.open({ |
| | | type: 1, |
| | | title: "反面", |
| | | skin: 'layui-layer-rim', //加上边框 |
| | | area: ['100%', '100%'], //宽高 |
| | | shadeClose: true, //开启遮罩关闭 |
| | | end: function (index, layero) { |
| | | return false; |
| | | }, |
| | | content: '<div style="text-align:center"><img src="' + $(t).attr('src') + '" /></div>' |
| | | }); |
| | | } |
| | | if (layEvent === 'typeInfoEvent') { |
| | | febs.modal.open('编辑','modules/clothesType/typeInfo/' + data.id, { |
| | | btn: ['提交', '取消'], |
| | | area: ['100%', '100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-type-Info').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | form.on('switch(stateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | typeStateSwitch(1,data.value,1); |
| | | } else { |
| | | typeStateSwitch(1,data.value,0); |
| | | } |
| | | }) |
| | | |
| | | form.on('switch(clothStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | typeStateSwitch(2,data.value,1); |
| | | } else { |
| | | typeStateSwitch(2,data.value,0); |
| | | } |
| | | }) |
| | | |
| | | form.on('switch(artStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | typeStateSwitch(3,data.value,1); |
| | | } else { |
| | | typeStateSwitch(3,data.value,0); |
| | | } |
| | | }) |
| | | |
| | | form.on('switch(patternStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | typeStateSwitch(4,data.value,1); |
| | | } else { |
| | | typeStateSwitch(4,data.value,0); |
| | | } |
| | | }) |
| | | |
| | | form.on('switch(locationStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | typeStateSwitch(5,data.value,1); |
| | | } else { |
| | | typeStateSwitch(5,data.value,0); |
| | | } |
| | | }) |
| | | |
| | | form.on('switch(sizeStateSwitch)', function (data) { |
| | | if (data.elem.checked) { |
| | | typeStateSwitch(6,data.value,1); |
| | | } else { |
| | | typeStateSwitch(6,data.value,0); |
| | | } |
| | | }) |
| | | |
| | | function typeStateSwitch(type,id,state) { |
| | | febs.get(ctx + 'admin/clothesType/changeState/' + id+'/' + type+'/' + state, null, function (data) { |
| | | febs.alert.success(data.message); |
| | | $query.click(); |
| | | }); |
| | | } |
| | | |
| | | // 初始化表格操作栏各个按钮功能 |
| | | table.on('toolbar(clothesTypeTable)', function (obj) { |
| | | let data = obj.data, |
| | | layEvent = obj.event; |
| | | console.log("触发事件:", obj.event); // 调试信息 |
| | | if(layEvent === 'typeAdd'){ |
| | | febs.modal.open('新增', 'modules/clothesType/typeAdd/', { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#febs-type-add').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'artSet') { |
| | | var checkData = table.checkStatus('clothesTypeTable').data; |
| | | if (checkData.length > 1 || checkData.length === 0) { |
| | | febs.alert.warn('每次操作只能操作一行数据'); |
| | | return; |
| | | } |
| | | febs.modal.open('工艺配置', 'modules/clothesType/artSet/' + checkData[0].id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#art-set').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'sizeSet') { |
| | | var checkData = table.checkStatus('clothesTypeTable').data; |
| | | if (checkData.length > 1 || checkData.length === 0) { |
| | | febs.alert.warn('每次操作只能操作一行数据'); |
| | | return; |
| | | } |
| | | febs.modal.open('尺码配置', 'modules/clothesType/sizeSet/' + checkData[0].id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#size-set').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'clothSet') { |
| | | var checkData = table.checkStatus('clothesTypeTable').data; |
| | | if (checkData.length > 1 || checkData.length === 0) { |
| | | febs.alert.warn('每次操作只能操作一行数据'); |
| | | return; |
| | | } |
| | | febs.modal.open('布料配置', 'modules/clothesType/clothSet/' + checkData[0].id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#cloth-set').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'patternSet') { |
| | | var checkData = table.checkStatus('clothesTypeTable').data; |
| | | if (checkData.length > 1 || checkData.length === 0) { |
| | | febs.alert.warn('每次操作只能操作一行数据'); |
| | | return; |
| | | } |
| | | febs.modal.open('图案文字配置', 'modules/clothesType/patternSet/' + checkData[0].id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#pattern-set').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | if (layEvent === 'locationSet') { |
| | | var checkData = table.checkStatus('clothesTypeTable').data; |
| | | if (checkData.length > 1 || checkData.length === 0) { |
| | | febs.alert.warn('每次操作只能操作一行数据'); |
| | | return; |
| | | } |
| | | febs.modal.open('图案位置配置', 'modules/clothesType/locationSet/' + checkData[0].id, { |
| | | btn: ['提交', '取消'], |
| | | area:['100%','100%'], |
| | | yes: function (index, layero) { |
| | | $('#location-set').find('#submit').trigger('click'); |
| | | }, |
| | | btn2: function () { |
| | | layer.closeAll(); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | function initClothesTypeTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |
| | | id: 'clothesTypeTable', |
| | | url: ctx + 'admin/clothesType/typeList', |
| | | toolbar:"#clothesTypeToolbar", |
| | | defaultToolbar:[], |
| | | cols: [[ |
| | | {type: 'checkbox'}, |
| | | {type: 'numbers', title: '', width: 80}, |
| | | {title: '操作', toolbar: '#clothesTypeOption', minWidth: 200, align: 'center'}, |
| | | {field: 'name', title: '名称', minWidth: 150,align:'center'}, |
| | | {field: 'orderNum', title: '序号', minWidth: 100,align:'center'}, |
| | | {field: 'state', title: '允许上线', templet: '#stateSwitch', minWidth: 130,align:'center'}, |
| | | {field: 'clothState', title: '允许选择布料', templet: '#clothStateSwitch', minWidth: 130,align:'center'}, |
| | | {field: 'artState', title: '允许选择工艺', templet: '#artStateSwitch', minWidth: 130,align:'center'}, |
| | | {field: 'patternState', title: '允许选择图案', templet: '#patternStateSwitch', minWidth: 130,align:'center'}, |
| | | {field: 'locationState', title: '允许选择图案位置', templet: '#locationStateSwitch', minWidth: 180,align:'center'}, |
| | | {field: 'sizeState', title: '允许选择尺码', templet: '#sizeStateSwitch', minWidth: 130,align:'center'}, |
| | | {field: 'image',title: '小图标', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeImage">' + |
| | | '<img id="seeImage' + d.id + '" src="' + d.image + |
| | | '" alt="小图标" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | {field: 'imageFront',title: '正面', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeImageFront">' + |
| | | '<img id="seeImageFront' + d.id + '" src="' + d.imageFront + |
| | | '" alt="正面" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | {field: 'imageBack',title: '反面', |
| | | templet: function (d) { |
| | | return '<a lay-event="seeImageBack">' + |
| | | '<img id="seeImageBack' + d.id + '" src="' + d.imageBack + |
| | | '" alt="反面" style="width: 50px; height: 50px; object-fit: cover; border-radius: 5px; cursor: pointer;">' + |
| | | '</a>'; |
| | | }, |
| | | minWidth: 150,align: 'center'}, |
| | | ]] |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 查询按钮 |
| | | $query.on('click', function () { |
| | | var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type}); |
| | | tableIns.reload({where: params, page: {curr: 1}}); |
| | | }); |
| | | |
| | | // 刷新按钮 |
| | | $reset.on('click', function () { |
| | | $searchForm[0].reset(); |
| | | sortObject.type = 'null'; |
| | | tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject}); |
| | | }); |
| | | // 获取查询参数 |
| | | function getQueryParams() { |
| | | return { |
| | | // name: $searchForm.find('input[name="name"]').val().trim(), |
| | | // state: $searchForm.find("select[name='state']").val(), |
| | | // categoryId: $searchForm.find("select[name='categoryId']").val(), |
| | | }; |
| | | } |
| | | |
| | | }) |
| | | </script> |