Commit 4a2cb33cd7d295b6d98bcb3ab0335793a70ef4fd
1 parent
98ca807d
product:优化商品属性值的代码
Showing
9 changed files
with
46 additions
and
99 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyValueController.java
| ... | ... | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.Produc |
| 6 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; |
| 8 | 8 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO; |
| 9 | +import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; | |
| 9 | 10 | import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; |
| 10 | 11 | import io.swagger.annotations.Api; |
| 11 | 12 | import io.swagger.annotations.ApiImplicitParam; |
| ... | ... | @@ -57,13 +58,13 @@ public class ProductPropertyValueController { |
| 57 | 58 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 58 | 59 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 59 | 60 | public CommonResult<ProductPropertyValueRespVO> getProperty(@RequestParam("id") Long id) { |
| 60 | - return success(productPropertyValueService.getPropertyValue(id)); | |
| 61 | + return success(ProductPropertyValueConvert.INSTANCE.convert(productPropertyValueService.getPropertyValue(id))); | |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | @GetMapping("/page") |
| 64 | 65 | @ApiOperation("获得属性值分页") |
| 65 | 66 | @PreAuthorize("@ss.hasPermission('product:property:query')") |
| 66 | 67 | public CommonResult<PageResult<ProductPropertyValueRespVO>> getPropertyValuePage(@Valid ProductPropertyValuePageReqVO pageVO) { |
| 67 | - return success(productPropertyValueService.getPropertyValueListPage(pageVO)); | |
| 68 | + return success(ProductPropertyValueConvert.INSTANCE.convertPage(productPropertyValueService.getPropertyValuePage(pageVO))); | |
| 68 | 69 | } |
| 69 | 70 | } | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java
| ... | ... | @@ -3,16 +3,12 @@ package cn.iocoder.yudao.module.product.controller.admin.property.vo.property; |
| 3 | 3 | import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | -import lombok.EqualsAndHashCode; | |
| 7 | -import lombok.ToString; | |
| 8 | 6 | |
| 9 | 7 | import java.util.List; |
| 10 | 8 | |
| 11 | 9 | @ApiModel("管理后台 - 商品属性项 + 属性值 Response VO") |
| 12 | 10 | @Data |
| 13 | -@EqualsAndHashCode(callSuper = true) | |
| 14 | -@ToString(callSuper = true) | |
| 15 | -public class ProductPropertyAndValueRespVO extends ProductPropertyBaseVO { | |
| 11 | +public class ProductPropertyAndValueRespVO { | |
| 16 | 12 | |
| 17 | 13 | @ApiModelProperty(value = "属性项的编号", required = true, example = "1024") |
| 18 | 14 | private Long id; | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueService.java
| ... | ... | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.product.service.property; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO; |
| 6 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; | |
| 7 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; |
| 9 | 8 | import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; |
| ... | ... | @@ -46,7 +45,7 @@ public interface ProductPropertyValueService { |
| 46 | 45 | * @param id 编号 |
| 47 | 46 | * @return 属性值 |
| 48 | 47 | */ |
| 49 | - ProductPropertyValueRespVO getPropertyValue(Long id); | |
| 48 | + ProductPropertyValueDO getPropertyValue(Long id); | |
| 50 | 49 | |
| 51 | 50 | /** |
| 52 | 51 | * 根据属性项编号数组,获得属性值列表 |
| ... | ... | @@ -65,14 +64,6 @@ public interface ProductPropertyValueService { |
| 65 | 64 | List<ProductPropertyValueDetailRespBO> getPropertyValueDetailList(Collection<Long> ids); |
| 66 | 65 | |
| 67 | 66 | /** |
| 68 | - * 根据属性项编号,获得属性值数组 | |
| 69 | - * | |
| 70 | - * @param propertyIds 属性项编号数组 | |
| 71 | - * @return 属性值 | |
| 72 | - */ | |
| 73 | - List<ProductPropertyValueRespVO> getPropertyValueListByPropertyId(List<Long> propertyIds); | |
| 74 | - | |
| 75 | - /** | |
| 76 | 67 | * 根据属性项编号,活的属性值数量 |
| 77 | 68 | * |
| 78 | 69 | * @param propertyId 属性项编号数 |
| ... | ... | @@ -86,7 +77,7 @@ public interface ProductPropertyValueService { |
| 86 | 77 | * @param pageReqVO 查询条件 |
| 87 | 78 | * @return 属性值的分页 |
| 88 | 79 | */ |
| 89 | - PageResult<ProductPropertyValueRespVO> getPropertyValueListPage(ProductPropertyValuePageReqVO pageReqVO); | |
| 80 | + PageResult<ProductPropertyValueDO> getPropertyValuePage(ProductPropertyValuePageReqVO pageReqVO); | |
| 90 | 81 | |
| 91 | 82 | /** |
| 92 | 83 | * 删除指定属性项编号下的属性值们 | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java
| ... | ... | @@ -4,14 +4,12 @@ import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO; |
| 7 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; | |
| 8 | 7 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO; |
| 9 | 8 | import cn.iocoder.yudao.module.product.convert.propertyvalue.ProductPropertyValueConvert; |
| 10 | 9 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| 11 | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; |
| 12 | 11 | import cn.iocoder.yudao.module.product.dal.mysql.property.ProductPropertyValueMapper; |
| 13 | 12 | import cn.iocoder.yudao.module.product.service.property.bo.ProductPropertyValueDetailRespBO; |
| 14 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
| 15 | 13 | import org.springframework.context.annotation.Lazy; |
| 16 | 14 | import org.springframework.stereotype.Service; |
| 17 | 15 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -24,6 +22,7 @@ import java.util.List; |
| 24 | 22 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 25 | 23 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 26 | 24 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS; |
| 25 | +import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_NOT_EXISTS; | |
| 27 | 26 | |
| 28 | 27 | /** |
| 29 | 28 | * 商品属性值 Service 实现类 |
| ... | ... | @@ -43,34 +42,47 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ |
| 43 | 42 | |
| 44 | 43 | @Override |
| 45 | 44 | public Long createPropertyValue(ProductPropertyValueCreateReqVO createReqVO) { |
| 45 | + // 校验名字唯一 | |
| 46 | 46 | if (productPropertyValueMapper.selectByName(createReqVO.getPropertyId(), createReqVO.getName()) != null) { |
| 47 | 47 | throw exception(PROPERTY_VALUE_EXISTS); |
| 48 | 48 | } |
| 49 | - ProductPropertyValueDO convert = ProductPropertyValueConvert.INSTANCE.convert(createReqVO); | |
| 50 | - productPropertyValueMapper.insert(convert); | |
| 51 | - return convert.getId(); | |
| 49 | + | |
| 50 | + // 新增 | |
| 51 | + ProductPropertyValueDO value = ProductPropertyValueConvert.INSTANCE.convert(createReqVO); | |
| 52 | + productPropertyValueMapper.insert(value); | |
| 53 | + return value.getId(); | |
| 52 | 54 | } |
| 53 | 55 | |
| 54 | 56 | @Override |
| 55 | 57 | public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) { |
| 56 | - ProductPropertyValueDO productPropertyValueDO = productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName()); | |
| 58 | + validatePropertyValueExists(updateReqVO.getId()); | |
| 59 | + // 校验名字唯一 | |
| 60 | + ProductPropertyValueDO productPropertyValueDO = productPropertyValueMapper.selectByName | |
| 61 | + (updateReqVO.getPropertyId(), updateReqVO.getName()); | |
| 57 | 62 | if (productPropertyValueDO != null && !productPropertyValueDO.getId().equals(updateReqVO.getId())) { |
| 58 | 63 | throw exception(PROPERTY_VALUE_EXISTS); |
| 59 | 64 | } |
| 60 | - ProductPropertyValueDO convert = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO); | |
| 61 | - productPropertyValueMapper.updateById(convert); | |
| 65 | + | |
| 66 | + // 更新 | |
| 67 | + ProductPropertyValueDO updateObj = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO); | |
| 68 | + productPropertyValueMapper.updateById(updateObj); | |
| 62 | 69 | } |
| 63 | 70 | |
| 64 | 71 | @Override |
| 65 | 72 | public void deletePropertyValue(Long id) { |
| 73 | + validatePropertyValueExists(id); | |
| 66 | 74 | productPropertyValueMapper.deleteById(id); |
| 67 | 75 | } |
| 68 | 76 | |
| 77 | + private void validatePropertyValueExists(Long id) { | |
| 78 | + if (productPropertyValueMapper.selectById(id) == null) { | |
| 79 | + throw exception(PROPERTY_VALUE_NOT_EXISTS); | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 69 | 83 | @Override |
| 70 | - public ProductPropertyValueRespVO getPropertyValue(Long id) { | |
| 71 | - ProductPropertyValueDO productPropertyValueDO = productPropertyValueMapper.selectOne(new LambdaQueryWrapper<ProductPropertyValueDO>() | |
| 72 | - .eq(ProductPropertyValueDO::getId, id)); | |
| 73 | - return ProductPropertyValueConvert.INSTANCE.convert(productPropertyValueDO); | |
| 84 | + public ProductPropertyValueDO getPropertyValue(Long id) { | |
| 85 | + return productPropertyValueMapper.selectById(id); | |
| 74 | 86 | } |
| 75 | 87 | |
| 76 | 88 | @Override |
| ... | ... | @@ -96,18 +108,13 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ |
| 96 | 108 | } |
| 97 | 109 | |
| 98 | 110 | @Override |
| 99 | - public List<ProductPropertyValueRespVO> getPropertyValueListByPropertyId(List<Long> propertyIds) { | |
| 100 | - return ProductPropertyValueConvert.INSTANCE.convertList(productPropertyValueMapper.selectList("property_id", propertyIds)); | |
| 101 | - } | |
| 102 | - | |
| 103 | - @Override | |
| 104 | 111 | public Integer getPropertyValueCountByPropertyId(Long propertyId) { |
| 105 | 112 | return productPropertyValueMapper.selectCountByPropertyId(propertyId); |
| 106 | 113 | } |
| 107 | 114 | |
| 108 | 115 | @Override |
| 109 | - public PageResult<ProductPropertyValueRespVO> getPropertyValueListPage(ProductPropertyValuePageReqVO pageReqVO) { | |
| 110 | - return ProductPropertyValueConvert.INSTANCE.convertPage(productPropertyValueMapper.selectPage(pageReqVO)); | |
| 116 | + public PageResult<ProductPropertyValueDO> getPropertyValuePage(ProductPropertyValuePageReqVO pageReqVO) { | |
| 117 | + return productPropertyValueMapper.selectPage(pageReqVO); | |
| 111 | 118 | } |
| 112 | 119 | |
| 113 | 120 | @Override | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/sku/ProductSkuServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.product.service.sku; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | |
| 5 | 4 | import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO; |
| 6 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; | |
| 7 | 5 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuBaseVO; |
| 8 | 6 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; |
| 9 | 7 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 10 | 8 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| 9 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | |
| 11 | 10 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 12 | 11 | import cn.iocoder.yudao.module.product.dal.mysql.sku.ProductSkuMapper; |
| 13 | 12 | import cn.iocoder.yudao.module.product.enums.ErrorCodeConstants; |
| ... | ... | @@ -25,6 +24,7 @@ import java.util.*; |
| 25 | 24 | import java.util.stream.Collectors; |
| 26 | 25 | |
| 27 | 26 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 27 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 28 | 28 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 29 | 29 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*; |
| 30 | 30 | |
| ... | ... | @@ -95,7 +95,7 @@ public class ProductSkuServiceImpl implements ProductSkuService { |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | // 2. 校验,一个 SKU 下,没有重复的属性。校验方式是,遍历每个 SKU ,看看是否有重复的属性 propertyId |
| 98 | - Map<Long, ProductPropertyValueRespVO> propertyValueMap = CollectionUtils.convertMap(productPropertyValueService.getPropertyValueListByPropertyId(new ArrayList<>(propertyIds)), ProductPropertyValueRespVO::getId); | |
| 98 | + Map<Long, ProductPropertyValueDO> propertyValueMap = convertMap(productPropertyValueService.getPropertyValueListByPropertyId(propertyIds), ProductPropertyValueDO::getId); | |
| 99 | 99 | skus.forEach(sku -> { |
| 100 | 100 | Set<Long> skuPropertyIds = convertSet(sku.getProperties(), propertyItem -> propertyValueMap.get(propertyItem.getValueId()).getPropertyId()); |
| 101 | 101 | if (skuPropertyIds.size() != sku.getProperties().size()) { | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
| ... | ... | @@ -5,7 +5,6 @@ import cn.hutool.core.collection.CollUtil; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 7 | 7 | import cn.iocoder.yudao.module.product.controller.admin.property.vo.ProductPropertyViewRespVO; |
| 8 | -import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; | |
| 9 | 8 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuBaseVO; |
| 10 | 9 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO; |
| 11 | 10 | import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO; |
| ... | ... | @@ -15,6 +14,7 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppSpuPageRespVO; |
| 15 | 14 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 16 | 15 | import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert; |
| 17 | 16 | import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; |
| 17 | +import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; | |
| 18 | 18 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 19 | 19 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| 20 | 20 | import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper; |
| ... | ... | @@ -34,6 +34,7 @@ import java.util.*; |
| 34 | 34 | import java.util.stream.Collectors; |
| 35 | 35 | |
| 36 | 36 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 37 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | |
| 37 | 38 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.SPU_NOT_EXISTS; |
| 38 | 39 | |
| 39 | 40 | /** |
| ... | ... | @@ -141,7 +142,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 141 | 142 | } |
| 142 | 143 | Map<Long, List<ProductSkuBaseVO.Property>> propertyMaps = properties.stream().collect(Collectors.groupingBy(ProductSkuBaseVO.Property::getPropertyId)); |
| 143 | 144 | |
| 144 | - List<ProductPropertyValueRespVO> propertyValueList = productPropertyValueService.getPropertyValueListByPropertyId(new ArrayList<>(propertyMaps.keySet())); | |
| 145 | + List<ProductPropertyValueDO> propertyValueList = productPropertyValueService.getPropertyValueListByPropertyId(propertyMaps.keySet()); | |
| 145 | 146 | List<ProductPropertyDO> propertyList = productPropertyService.getPropertyList(propertyMaps.keySet()); |
| 146 | 147 | // 装载组装过后的属性 |
| 147 | 148 | List<ProductPropertyViewRespVO> productPropertyViews = new ArrayList<>(); |
| ... | ... | @@ -151,7 +152,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { |
| 151 | 152 | productPropertyViewRespVO.setName(p.getName()); |
| 152 | 153 | List<ProductPropertyViewRespVO.Tuple2> propertyValues = new ArrayList<>(); |
| 153 | 154 | // 转换成map是为了能快速获取 |
| 154 | - Map<Long, ProductPropertyValueRespVO> propertyValueMaps = CollectionUtils.convertMap(propertyValueList, ProductPropertyValueRespVO::getId); | |
| 155 | + Map<Long, ProductPropertyValueDO> propertyValueMaps = convertMap(propertyValueList, ProductPropertyValueDO::getId); | |
| 155 | 156 | propertyMaps.get(p.getId()).forEach(pv -> { |
| 156 | 157 | ProductPropertyViewRespVO.Tuple2 tuple2 = new ProductPropertyViewRespVO.Tuple2(pv.getValueId(), propertyValueMaps.get(pv.getValueId()).getName()); |
| 157 | 158 | propertyValues.add(tuple2); | ... | ... |
yudao-ui-admin/src/api/mall/product/property.js
| ... | ... | @@ -63,17 +63,6 @@ export function getPropertyListAndValue(query) { |
| 63 | 63 | }) |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - | |
| 67 | -// 导出属性项 Excel | |
| 68 | -export function exportPropertyExcel(query) { | |
| 69 | - return request({ | |
| 70 | - url: '/product/property/export-excel', | |
| 71 | - method: 'get', | |
| 72 | - params: query, | |
| 73 | - responseType: 'blob' | |
| 74 | - }) | |
| 75 | -} | |
| 76 | - | |
| 77 | 66 | // ------------------------ 属性值 ------------------- |
| 78 | 67 | |
| 79 | 68 | // 获得属性值分页 |
| ... | ... | @@ -119,3 +108,6 @@ export function deletePropertyValue(id) { |
| 119 | 108 | method: 'delete' |
| 120 | 109 | }) |
| 121 | 110 | } |
| 111 | + | |
| 112 | +export class exportPropertyExcel { | |
| 113 | +} | ... | ... |
yudao-ui-admin/src/views/mall/product/property/index.vue
| ... | ... | @@ -6,12 +6,6 @@ |
| 6 | 6 | <el-form-item label="名称" prop="name"> |
| 7 | 7 | <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> |
| 8 | 8 | </el-form-item> |
| 9 | - <el-form-item label="状态" prop="status"> | |
| 10 | - <el-select v-model="queryParams.status" placeholder="请选择开启状态" clearable size="small"> | |
| 11 | - <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" | |
| 12 | - :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 13 | - </el-select> | |
| 14 | - </el-form-item> | |
| 15 | 9 | <el-form-item label="创建时间" prop="createTime"> |
| 16 | 10 | <el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange" |
| 17 | 11 | range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" /> |
| ... | ... | @@ -41,12 +35,12 @@ |
| 41 | 35 | </router-link> |
| 42 | 36 | </template> |
| 43 | 37 | </el-table-column> |
| 38 | + <el-table-column label="备注" align="center" prop="remark" /> | |
| 44 | 39 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| 45 | 40 | <template slot-scope="scope"> |
| 46 | 41 | <span>{{ parseTime(scope.row.createTime) }}</span> |
| 47 | 42 | </template> |
| 48 | 43 | </el-table-column> |
| 49 | - <el-table-column label="备注" align="center" prop="left" /> | |
| 50 | 44 | <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
| 51 | 45 | <template slot-scope="scope"> |
| 52 | 46 | <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" |
| ... | ... | @@ -63,9 +57,6 @@ |
| 63 | 57 | <!-- 对话框(添加 / 修改) --> |
| 64 | 58 | <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> |
| 65 | 59 | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| 66 | - <el-form-item label="编号" prop="id" v-if="form.id != null"> | |
| 67 | - <el-input v-model="form.id" disabled /> | |
| 68 | - </el-form-item> | |
| 69 | 60 | <el-form-item label="名称" prop="name"> |
| 70 | 61 | <el-input v-model="form.name" placeholder="请输入名称" /> |
| 71 | 62 | </el-form-item> |
| ... | ... | @@ -82,7 +73,7 @@ |
| 82 | 73 | </template> |
| 83 | 74 | |
| 84 | 75 | <script> |
| 85 | -import { createProperty, updateProperty, deleteProperty, getProperty, getPropertyPage, exportPropertyExcel } from "@/api/mall/product/property"; | |
| 76 | +import { createProperty, updateProperty, deleteProperty, getProperty, getPropertyPage } from "@/api/mall/product/property"; | |
| 86 | 77 | |
| 87 | 78 | export default { |
| 88 | 79 | name: "Property", |
| ... | ... | @@ -92,8 +83,6 @@ export default { |
| 92 | 83 | return { |
| 93 | 84 | // 遮罩层 |
| 94 | 85 | loading: true, |
| 95 | - // 导出遮罩层 | |
| 96 | - exportLoading: false, | |
| 97 | 86 | // 显示搜索条件 |
| 98 | 87 | showSearch: true, |
| 99 | 88 | // 总条数 |
| ... | ... | @@ -114,7 +103,6 @@ export default { |
| 114 | 103 | // 表单参数 |
| 115 | 104 | form: { |
| 116 | 105 | name:'', |
| 117 | - status:'', | |
| 118 | 106 | remark:"", |
| 119 | 107 | id: null, |
| 120 | 108 | }, | ... | ... |
yudao-ui-admin/src/views/mall/product/property/value.vue
| ... | ... | @@ -3,18 +3,12 @@ |
| 3 | 3 | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| 4 | 4 | <el-form-item label="属性项" prop="propertyId"> |
| 5 | 5 | <el-select v-model="queryParams.propertyId"> |
| 6 | - <el-option v-for="item in propertyOptions" :key="item.id" :label="item.id +'-'+ item.name" :value="item.id"/> | |
| 6 | + <el-option v-for="item in propertyOptions" :key="item.id" :label="item.name" :value="item.id"/> | |
| 7 | 7 | </el-select> |
| 8 | 8 | </el-form-item> |
| 9 | 9 | <el-form-item label="名称" prop="name"> |
| 10 | 10 | <el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery"/> |
| 11 | 11 | </el-form-item> |
| 12 | - <el-form-item label="状态" prop="status"> | |
| 13 | - <el-select v-model="queryParams.status" placeholder="状态" clearable size="small"> | |
| 14 | - <el-option v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" | |
| 15 | - :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 16 | - </el-select> | |
| 17 | - </el-form-item> | |
| 18 | 12 | <el-form-item> |
| 19 | 13 | <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button> |
| 20 | 14 | <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button> |
| ... | ... | @@ -27,21 +21,12 @@ |
| 27 | 21 | v-hasPermi="['system:dict:create']">新增 |
| 28 | 22 | </el-button> |
| 29 | 23 | </el-col> |
| 30 | - <!-- <el-col :span="1.5"> | |
| 31 | - <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading" | |
| 32 | - v-hasPermi="['system:dict:export']">导出</el-button> | |
| 33 | - </el-col> --> | |
| 34 | 24 | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| 35 | 25 | </el-row> |
| 36 | 26 | |
| 37 | 27 | <el-table v-loading="loading" :data="dataList"> |
| 38 | 28 | <el-table-column label="编号" align="center" prop="id"/> |
| 39 | 29 | <el-table-column label="名称" align="center" prop="name"/> |
| 40 | - <el-table-column label="状态" align="center" prop="status"> | |
| 41 | - <template slot-scope="scope"> | |
| 42 | - <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/> | |
| 43 | - </template> | |
| 44 | - </el-table-column> | |
| 45 | 30 | <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/> |
| 46 | 31 | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| 47 | 32 | <template slot-scope="scope"> |
| ... | ... | @@ -72,13 +57,6 @@ |
| 72 | 57 | <el-form-item label="名称" prop="name"> |
| 73 | 58 | <el-input v-model="form.name" placeholder="请输入名称"/> |
| 74 | 59 | </el-form-item> |
| 75 | - <el-form-item label="状态" prop="status"> | |
| 76 | - <el-radio-group v-model="form.status"> | |
| 77 | - <el-radio v-for="dict in this.getDictDatas(DICT_TYPE.COMMON_STATUS)" | |
| 78 | - :key="dict.value" :label="parseInt(dict.value)">{{ dict.label }} | |
| 79 | - </el-radio> | |
| 80 | - </el-radio-group> | |
| 81 | - </el-form-item> | |
| 82 | 60 | <el-form-item label="备注" prop="remark"> |
| 83 | 61 | <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> |
| 84 | 62 | </el-form-item> |
| ... | ... | @@ -108,8 +86,6 @@ export default { |
| 108 | 86 | return { |
| 109 | 87 | // 遮罩层 |
| 110 | 88 | loading: true, |
| 111 | - // 导出遮罩层 | |
| 112 | - exportLoading: false, | |
| 113 | 89 | // 显示搜索条件 |
| 114 | 90 | showSearch: true, |
| 115 | 91 | // 总条数 |
| ... | ... | @@ -130,7 +106,6 @@ export default { |
| 130 | 106 | pageSize: 10, |
| 131 | 107 | propertyId: undefined, |
| 132 | 108 | name: undefined, |
| 133 | - status: undefined | |
| 134 | 109 | }, |
| 135 | 110 | // 表单参数 |
| 136 | 111 | form: {}, |
| ... | ... | @@ -138,9 +113,6 @@ export default { |
| 138 | 113 | rules: { |
| 139 | 114 | name: [ |
| 140 | 115 | {required: true, message: "名称不能为空", trigger: "blur"} |
| 141 | - ], | |
| 142 | - status: [ | |
| 143 | - {required: true, message: "状态不能为空", trigger: "blur"} | |
| 144 | 116 | ] |
| 145 | 117 | }, |
| 146 | 118 | |
| ... | ... | @@ -186,7 +158,6 @@ export default { |
| 186 | 158 | id: undefined, |
| 187 | 159 | propertyId: undefined, |
| 188 | 160 | name: undefined, |
| 189 | - status: undefined, | |
| 190 | 161 | remark: undefined |
| 191 | 162 | }; |
| 192 | 163 | this.resetForm("form"); |
| ... | ... | @@ -212,7 +183,7 @@ export default { |
| 212 | 183 | /** 修改按钮操作 */ |
| 213 | 184 | handleUpdate(row) { |
| 214 | 185 | this.reset(); |
| 215 | - const id = row.id || this.ids | |
| 186 | + const id = row.id; | |
| 216 | 187 | getPropertyValue(id).then(response => { |
| 217 | 188 | this.form = response.data; |
| 218 | 189 | this.open = true; | ... | ... |