Compare commits
12 Commits
6aa1d581e7
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ce1ffad5a | ||
|
|
1fe6e030d4 | ||
|
|
96a1f9f9bc | ||
| 2099a01bc1 | |||
| d5c1c1485c | |||
| 2aa0ae83c2 | |||
| 774fe86941 | |||
|
|
d02ef34751 | ||
|
|
2e7a50bf64 | ||
|
|
3ae6403bd3 | ||
|
|
855dbbe099 | ||
| f41a17c885 |
@@ -70,7 +70,7 @@ spring:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: prod
|
||||
active: @profiles.active@
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.gear.mat.controller;
|
||||
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.mat.domain.bo.MatProductAdditionBo;
|
||||
import com.gear.mat.domain.vo.MatProductAdditionVo;
|
||||
import com.gear.mat.service.IMatProductAdditionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Controller
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/mat/productAddition")
|
||||
public class MatProductAdditionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMatProductAdditionService productAdditionService;
|
||||
|
||||
/**
|
||||
* 查询产品属性附加表列表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 产品属性附加表列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MatProductAdditionBo productAdditionBo) {
|
||||
List<MatProductAdditionVo> list = productAdditionService.listProductAddition(productAdditionBo);
|
||||
return TableDataInfo.build(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品属性附加表
|
||||
*/
|
||||
@Log(title = "产品属性附加表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Boolean> add(@RequestBody MatProductAdditionBo productAdditionBo) {
|
||||
boolean result = productAdditionService.addProductAddition(productAdditionBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品属性附加表
|
||||
*/
|
||||
@Log(title = "产品属性附加表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody MatProductAdditionBo productAdditionBo) {
|
||||
boolean result = productAdditionService.updateProductAddition(productAdditionBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品属性附加表
|
||||
*
|
||||
* @param addId 主键ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
@Log(title = "产品属性附加表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{addId}")
|
||||
public R<Boolean> del(@PathVariable Long addId) {
|
||||
boolean result = productAdditionService.delProductAddition(addId);
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.gear.mat.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.mat.domain.bo.MatProductLaborBo;
|
||||
import com.gear.mat.domain.vo.MatProductLaborVo;
|
||||
import com.gear.mat.service.IMatProductLaborService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/mat/productLabor")
|
||||
public class MatProductLaborController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMatProductLaborService productLaborService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MatProductLaborBo productLaborBo) {
|
||||
List<MatProductLaborVo> list = productLaborService.listProductLabor(productLaborBo);
|
||||
return TableDataInfo.build(list);
|
||||
}
|
||||
|
||||
@Log(title = "产品手动工价", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Boolean> add(@RequestBody MatProductLaborBo productLaborBo) {
|
||||
boolean result = productLaborService.addProductLabor(productLaborBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Log(title = "产品手动工价", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody MatProductLaborBo productLaborBo) {
|
||||
boolean result = productLaborService.updateProductLabor(productLaborBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Log(title = "产品手动工价", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{laborId}")
|
||||
public R<Boolean> del(@PathVariable Long laborId) {
|
||||
boolean result = productLaborService.delProductLabor(laborId);
|
||||
return R.ok(result);
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,10 @@ public class MatMaterial extends BaseEntity {
|
||||
* 配料名称
|
||||
*/
|
||||
private String materialName;
|
||||
/**
|
||||
* 物料类型:1=辅料,2=原料
|
||||
*/
|
||||
private Integer materialType;
|
||||
/**
|
||||
* 配料规格
|
||||
*/
|
||||
|
||||
@@ -54,4 +54,14 @@ public class MatProduct extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 产品图片,多个图片以逗号分隔
|
||||
*/
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品说明书,多个PDF以逗号分隔
|
||||
*/
|
||||
private String productPdfs;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.gear.mat.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 产品属性附加表
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Data
|
||||
@TableName("gear_product_addition")
|
||||
public class MatProductAddition extends BaseEntity {
|
||||
/** 主键ID */
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long addId;
|
||||
|
||||
/** 属性名 */
|
||||
private String attrName;
|
||||
|
||||
/** 属性值 */
|
||||
private String attrValue;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 删除标识 0-未删除 1-已删除 */
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.gear.mat.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@TableName("gear_product_labor")
|
||||
public class MatProductLabor extends BaseEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long laborId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String laborName;
|
||||
|
||||
private BigDecimal laborPrice;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -32,6 +32,11 @@ public class MatMaterialBo extends BaseEntity {
|
||||
*/
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 物料类型:1=辅料,2=原料
|
||||
*/
|
||||
private Integer materialType;
|
||||
|
||||
/**
|
||||
* 配料规格
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 产品属性附加表业务对象
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Data
|
||||
public class MatProductAdditionBo {
|
||||
/** 主键ID */
|
||||
private Long addId;
|
||||
|
||||
/** 属性名 */
|
||||
private String attrName;
|
||||
|
||||
/** 属性值 */
|
||||
private String attrValue;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
@@ -52,5 +52,14 @@ public class MatProductBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 产品图片,多个图片以逗号分隔
|
||||
*/
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品说明书,多个PDF以逗号分隔
|
||||
*/
|
||||
private String productPdfs;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class MatProductLaborBo {
|
||||
|
||||
private Long laborId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String laborName;
|
||||
|
||||
private BigDecimal laborPrice;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -34,6 +34,12 @@ public class MatMaterialVo {
|
||||
@ExcelProperty(value = "配料名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 物料类型:1=辅料,2=原料
|
||||
*/
|
||||
@ExcelProperty(value = "物料类型")
|
||||
private Integer materialType;
|
||||
|
||||
/**
|
||||
* 配料规格
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.gear.mat.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 产品属性附加表视图对象
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Data
|
||||
public class MatProductAdditionVo {
|
||||
/** 主键ID */
|
||||
private Long addId;
|
||||
|
||||
/** 属性名 */
|
||||
private String attrName;
|
||||
|
||||
/** 属性值 */
|
||||
private String attrValue;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
|
||||
/** 创建人 */
|
||||
private String createBy;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
|
||||
/** 更新人 */
|
||||
private String updateBy;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gear.mat.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class MatProductLaborVo {
|
||||
|
||||
private Long laborId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String laborName;
|
||||
|
||||
private BigDecimal laborPrice;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -58,5 +58,17 @@ public class MatProductVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 产品图片,多个图片以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "产品图片")
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品说明书,多个PDF以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "产品说明书")
|
||||
private String productPdfs;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -57,6 +57,18 @@ public class MatProductWithMaterialsVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 产品图片,多个图片以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "产品图片")
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品PDF文件,多个PDF以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "产品PDF文件")
|
||||
private String productPdfs;
|
||||
|
||||
/**
|
||||
* 关联的配料信息列表
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gear.mat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gear.mat.domain.MatProductAddition;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Mapper接口
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Mapper
|
||||
public interface MatProductAdditionMapper extends BaseMapper<MatProductAddition> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.gear.mat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gear.mat.domain.MatProductLabor;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MatProductLaborMapper extends BaseMapper<MatProductLabor> {
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gear.mat.domain.MatProductAddition;
|
||||
import com.gear.mat.domain.bo.MatProductAdditionBo;
|
||||
import com.gear.mat.domain.vo.MatProductAdditionVo;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Service接口
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
public interface IMatProductAdditionService extends IService<MatProductAddition> {
|
||||
/**
|
||||
* 查询产品属性附加表列表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 产品属性附加表列表
|
||||
*/
|
||||
List<MatProductAdditionVo> listProductAddition(MatProductAdditionBo productAdditionBo);
|
||||
|
||||
/**
|
||||
* 新增产品属性附加表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
boolean addProductAddition(MatProductAdditionBo productAdditionBo);
|
||||
|
||||
/**
|
||||
* 修改产品属性附加表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
boolean updateProductAddition(MatProductAdditionBo productAdditionBo);
|
||||
|
||||
/**
|
||||
* 删除产品属性附加表
|
||||
*
|
||||
* @param addId 主键ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
boolean delProductAddition(Long addId);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gear.mat.domain.MatProductLabor;
|
||||
import com.gear.mat.domain.bo.MatProductLaborBo;
|
||||
import com.gear.mat.domain.vo.MatProductLaborVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMatProductLaborService extends IService<MatProductLabor> {
|
||||
|
||||
List<MatProductLaborVo> listProductLabor(MatProductLaborBo productLaborBo);
|
||||
|
||||
boolean addProductLabor(MatProductLaborBo productLaborBo);
|
||||
|
||||
boolean updateProductLabor(MatProductLaborBo productLaborBo);
|
||||
|
||||
boolean delProductLabor(Long laborId);
|
||||
}
|
||||
@@ -75,6 +75,7 @@ public class MatMaterialServiceImpl implements IMatMaterialService {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<MatMaterial> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), MatMaterial::getMaterialName, bo.getMaterialName());
|
||||
lqw.eq(bo.getMaterialType() != null, MatMaterial::getMaterialType, bo.getMaterialType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSpec()), MatMaterial::getSpec, bo.getSpec());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getModel()), MatMaterial::getModel, bo.getModel());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFactory()), MatMaterial::getFactory, bo.getFactory());
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.gear.mat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gear.mat.domain.MatProductAddition;
|
||||
import com.gear.mat.domain.bo.MatProductAdditionBo;
|
||||
import com.gear.mat.domain.vo.MatProductAdditionVo;
|
||||
import com.gear.mat.mapper.MatProductAdditionMapper;
|
||||
import com.gear.mat.service.IMatProductAdditionService;
|
||||
import com.gear.common.utils.BeanCopyUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Service实现类
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Service
|
||||
public class MatProductAdditionServiceImpl extends ServiceImpl<MatProductAdditionMapper, MatProductAddition> implements IMatProductAdditionService {
|
||||
|
||||
@Override
|
||||
public List<MatProductAdditionVo> listProductAddition(MatProductAdditionBo productAdditionBo) {
|
||||
LambdaQueryWrapper<MatProductAddition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (productAdditionBo.getProductId() != null) {
|
||||
queryWrapper.eq(MatProductAddition::getProductId, productAdditionBo.getProductId());
|
||||
}
|
||||
if (productAdditionBo.getAttrName() != null) {
|
||||
queryWrapper.eq(MatProductAddition::getAttrName, productAdditionBo.getAttrName());
|
||||
}
|
||||
queryWrapper.eq(MatProductAddition::getDelFlag, 0);
|
||||
|
||||
List<MatProductAddition> list = baseMapper.selectList(queryWrapper);
|
||||
return BeanCopyUtils.copyList(list, MatProductAdditionVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProductAddition(MatProductAdditionBo productAdditionBo) {
|
||||
MatProductAddition productAddition = BeanCopyUtils.copy(productAdditionBo, MatProductAddition.class);
|
||||
return save(productAddition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateProductAddition(MatProductAdditionBo productAdditionBo) {
|
||||
MatProductAddition productAddition = BeanCopyUtils.copy(productAdditionBo, MatProductAddition.class);
|
||||
return updateById(productAddition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delProductAddition(Long addId) {
|
||||
return removeById(addId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gear.mat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gear.common.utils.BeanCopyUtils;
|
||||
import com.gear.mat.domain.MatProductLabor;
|
||||
import com.gear.mat.domain.bo.MatProductLaborBo;
|
||||
import com.gear.mat.domain.vo.MatProductLaborVo;
|
||||
import com.gear.mat.mapper.MatProductLaborMapper;
|
||||
import com.gear.mat.service.IMatProductLaborService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class MatProductLaborServiceImpl extends ServiceImpl<MatProductLaborMapper, MatProductLabor> implements IMatProductLaborService {
|
||||
|
||||
@Override
|
||||
public List<MatProductLaborVo> listProductLabor(MatProductLaborBo productLaborBo) {
|
||||
LambdaQueryWrapper<MatProductLabor> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (productLaborBo.getProductId() != null) {
|
||||
queryWrapper.eq(MatProductLabor::getProductId, productLaborBo.getProductId());
|
||||
}
|
||||
queryWrapper.eq(MatProductLabor::getDelFlag, 0);
|
||||
List<MatProductLabor> list = baseMapper.selectList(queryWrapper);
|
||||
return BeanCopyUtils.copyList(list, MatProductLaborVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProductLabor(MatProductLaborBo productLaborBo) {
|
||||
MatProductLabor labor = BeanCopyUtils.copy(productLaborBo, MatProductLabor.class);
|
||||
return save(labor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateProductLabor(MatProductLaborBo productLaborBo) {
|
||||
MatProductLabor labor = BeanCopyUtils.copy(productLaborBo, MatProductLabor.class);
|
||||
return updateById(labor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delProductLabor(Long laborId) {
|
||||
return removeById(laborId);
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,8 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
productWithMaterialsVo.setModel(productVo.getModel());
|
||||
productWithMaterialsVo.setUnitPrice(productVo.getUnitPrice());
|
||||
productWithMaterialsVo.setRemark(productVo.getRemark());
|
||||
productWithMaterialsVo.setProductImages(productVo.getProductImages());
|
||||
productWithMaterialsVo.setProductPdfs(productVo.getProductPdfs());
|
||||
|
||||
// 查询并设置关联的配料信息
|
||||
List<MatProductMaterialRelationVo> relations = productMaterialRelationService.queryList(
|
||||
@@ -168,7 +170,9 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(MatProductBo bo) {
|
||||
System.out.println("插入产品,productPdfs: " + bo.getProductPdfs());
|
||||
MatProduct add = BeanUtil.toBean(bo, MatProduct.class);
|
||||
System.out.println("转换后,productPdfs: " + add.getProductPdfs());
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
@@ -182,7 +186,9 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(MatProductBo bo) {
|
||||
System.out.println("修改产品,productPdfs: " + bo.getProductPdfs());
|
||||
MatProduct update = BeanUtil.toBean(bo, MatProduct.class);
|
||||
System.out.println("转换后,productPdfs: " + update.getProductPdfs());
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="com.gear.mat.domain.MatMaterial" id="MatMaterialResult">
|
||||
<result property="materialId" column="material_id"/>
|
||||
<result property="materialName" column="material_name"/>
|
||||
<result property="materialType" column="material_type"/>
|
||||
<result property="spec" column="spec"/>
|
||||
<result property="model" column="model"/>
|
||||
<result property="factory" column="factory"/>
|
||||
|
||||
@@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<!-- <result property="productImages" column="product_images"/>-->
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工资录入明细业务对象 gear_wage_entry_detail
|
||||
@@ -71,4 +72,6 @@ public class GearWageEntryDetailBo extends BaseEntity {
|
||||
private String makeupReason;
|
||||
|
||||
private String remark;
|
||||
// 新增累计金额
|
||||
private Map<String, BigDecimal> cumulativeAmounts;
|
||||
}
|
||||
|
||||
@@ -77,4 +77,6 @@ public class GearWageEntryDetailVo {
|
||||
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
@ExcelProperty(value = "累计金额")
|
||||
private BigDecimal cumulativeAmount;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.helper.LoginHelper;
|
||||
import com.gear.common.utils.DateUtils;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.oa.domain.GearWageEntryDetail;
|
||||
import com.gear.oa.domain.GearWageRateConfig;
|
||||
@@ -23,7 +24,10 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 工资录入明细Service业务层处理
|
||||
@@ -44,15 +48,96 @@ public class GearWageEntryDetailServiceImpl implements IGearWageEntryDetailServi
|
||||
|
||||
@Override
|
||||
public TableDataInfo<GearWageEntryDetailVo> queryPageList(GearWageEntryDetailBo bo, PageQuery pageQuery) {
|
||||
syncTodayWorkers(bo.getEntryDate());
|
||||
LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
|
||||
Page<GearWageEntryDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<GearWageEntryDetailVo> queryList(GearWageEntryDetailBo bo) {
|
||||
// LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
|
||||
// return baseMapper.selectVoList(lqw);
|
||||
//
|
||||
// }
|
||||
@Override
|
||||
public List<GearWageEntryDetailVo> queryList(GearWageEntryDetailBo bo) {
|
||||
LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
syncTodayWorkers(bo.getEntryDate());
|
||||
// 将 selectList 改为 selectVoList
|
||||
List<GearWageEntryDetailVo> list = baseMapper.selectVoList(buildQueryWrapper(bo));
|
||||
// 处理累计金额
|
||||
if (bo.getCumulativeAmounts() != null) {
|
||||
for (GearWageEntryDetailVo vo : list) {
|
||||
vo.setCumulativeAmount(bo.getCumulativeAmounts().get(vo.getEmpName()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void syncTodayWorkers(Date entryDate) {
|
||||
if (entryDate == null) {
|
||||
return;
|
||||
}
|
||||
if (!DateUtils.isSameDay(entryDate, DateUtils.getNowDate())) {
|
||||
return;
|
||||
}
|
||||
|
||||
java.sql.Date date = new java.sql.Date(entryDate.getTime());
|
||||
|
||||
List<GearWageEntryDetail> existList = baseMapper.selectList(Wrappers.<GearWageEntryDetail>lambdaQuery()
|
||||
.select(GearWageEntryDetail::getEmpId, GearWageEntryDetail::getBillingType, GearWageEntryDetail::getRateId, GearWageEntryDetail::getOrderNo)
|
||||
.eq(GearWageEntryDetail::getEntryDate, date)
|
||||
.eq(GearWageEntryDetail::getOrderNo, ""));
|
||||
|
||||
Set<String> existKeys = new HashSet<>();
|
||||
for (GearWageEntryDetail d : existList) {
|
||||
existKeys.add(buildDailyKey(d.getEmpId(), d.getBillingType(), d.getRateId(), d.getOrderNo()));
|
||||
}
|
||||
|
||||
List<GearWorker> workers = gearWorkerMapper.selectList(Wrappers.<GearWorker>lambdaQuery()
|
||||
.eq(GearWorker::getStatus, "0")
|
||||
.orderByAsc(GearWorker::getWorkerNo));
|
||||
|
||||
for (GearWorker worker : workers) {
|
||||
String billingType = StringUtils.isBlank(worker.getDefaultBillingType()) ? "1" : worker.getDefaultBillingType();
|
||||
GearWageRateConfig rateConfig = gearWageRateConfigMapper.selectOne(Wrappers.<GearWageRateConfig>lambdaQuery()
|
||||
.eq(GearWageRateConfig::getBillingType, billingType)
|
||||
.eq(StringUtils.isNotBlank(worker.getDefaultWorkTypeName()), GearWageRateConfig::getRateName, worker.getDefaultWorkTypeName())
|
||||
.eq(GearWageRateConfig::getStatus, "0")
|
||||
.last("limit 1"));
|
||||
Long rateId = rateConfig == null ? 0L : rateConfig.getRateId();
|
||||
String orderNo = "";
|
||||
|
||||
String key = buildDailyKey(worker.getWorkerId(), billingType, rateId, orderNo);
|
||||
if (existKeys.contains(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
GearWageEntryDetail detail = new GearWageEntryDetail();
|
||||
detail.setEntryDate(date);
|
||||
detail.setEmpId(worker.getWorkerId());
|
||||
detail.setEmpName(worker.getWorkerName());
|
||||
detail.setBillingType(billingType);
|
||||
detail.setWorkTypeName(StringUtils.isNotBlank(worker.getDefaultWorkTypeName()) ? worker.getDefaultWorkTypeName() : (rateConfig == null ? null : rateConfig.getRateName()));
|
||||
detail.setRateId(rateId);
|
||||
detail.setWorkload(BigDecimal.ZERO);
|
||||
detail.setUnitPrice(rateConfig == null || rateConfig.getUnitPrice() == null ? BigDecimal.ZERO : rateConfig.getUnitPrice());
|
||||
detail.setBaseAmount(BigDecimal.ZERO);
|
||||
detail.setExtraAmount(BigDecimal.ZERO);
|
||||
detail.setTotalAmount(BigDecimal.ZERO);
|
||||
detail.setIsMakeup("0");
|
||||
detail.setOrderNo(orderNo);
|
||||
detail.setRemark("当日名单热更新");
|
||||
try {
|
||||
baseMapper.insert(detail);
|
||||
existKeys.add(key);
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String buildDailyKey(Long empId, String billingType, Long rateId, String orderNo) {
|
||||
return String.valueOf(empId) + "|" + String.valueOf(billingType) + "|" + String.valueOf(rateId) + "|" + String.valueOf(orderNo);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<GearWageEntryDetail> buildQueryWrapper(GearWageEntryDetailBo bo) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Cacheable(cacheNames = CacheNames.SYS_OSS, key = "#ossId")
|
||||
@Cacheable(cacheNames = CacheNames.SYS_OSS, key = "'v2:' + #ossId")
|
||||
@Override
|
||||
public SysOssVo getById(Long ossId) {
|
||||
return baseMapper.selectVoById(ossId);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<resultMap type="com.gear.system.domain.SysOss" id="SysOssResult">
|
||||
<result property="ossId" column="oss_id"/>
|
||||
<result property="fileName" column="file_name"/>
|
||||
<result property="originalName" column="original_name"/>
|
||||
<result property="fileSuffix" column="file_suffix"/>
|
||||
<result property="url" column="url"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
|
||||
0
gear-ui3/.npm-cache/_update-notifier-last-checked
Normal file
0
gear-ui3/.npm-cache/_update-notifier-last-checked
Normal file
@@ -40,7 +40,8 @@
|
||||
"vue-cropper": "1.1.1",
|
||||
"vue-router": "4.5.1",
|
||||
"vue3-treeselect": "^0.1.10",
|
||||
"vuedraggable": "4.1.0"
|
||||
"vuedraggable": "4.1.0",
|
||||
"xlsx": "^0.18.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "5.2.4",
|
||||
|
||||
36
gear-ui3/src/api/mat/productAddition.js
Normal file
36
gear-ui3/src/api/mat/productAddition.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询产品属性附加列表
|
||||
export function listProductAddition(query) {
|
||||
return request({
|
||||
url: '/api/mat/productAddition/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 新增产品属性附加
|
||||
export function addProductAddition(data) {
|
||||
return request({
|
||||
url: '/api/mat/productAddition',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改产品属性附加
|
||||
export function updateProductAddition(data) {
|
||||
return request({
|
||||
url: '/api/mat/productAddition',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除产品属性附加
|
||||
export function delProductAddition(addId) {
|
||||
return request({
|
||||
url: '/api/mat/productAddition/' + addId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
33
gear-ui3/src/api/mat/productLabor.js
Normal file
33
gear-ui3/src/api/mat/productLabor.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function listProductLabor(query) {
|
||||
return request({
|
||||
url: '/api/mat/productLabor/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addProductLabor(data) {
|
||||
return request({
|
||||
url: '/api/mat/productLabor',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateProductLabor(data) {
|
||||
return request({
|
||||
url: '/api/mat/productLabor',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function delProductLabor(laborId) {
|
||||
return request({
|
||||
url: '/api/mat/productLabor/' + laborId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -11,10 +11,32 @@
|
||||
</div>
|
||||
|
||||
<!-- 选择弹窗:表格+分页+底部按钮 -->
|
||||
<el-dialog title="选择配料" v-model="open" width="800px" destroy-on-close>
|
||||
<el-dialog title="选择配料" v-model="open" width="900px" destroy-on-close>
|
||||
<!-- 检索功能 -->
|
||||
<el-form :model="searchForm" :inline="true" class="mb-4">
|
||||
<el-form-item label="配料名称">
|
||||
<el-input v-model="searchForm.materialName" placeholder="请输入配料名称" clearable @keyup.enter="fetchMaterialList" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型">
|
||||
<el-select v-model="searchForm.materialType" placeholder="请选择物料类型" clearable @change="fetchMaterialList">
|
||||
<el-option label="主材" value="2" />
|
||||
<el-option label="辅料" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="fetchMaterialList">搜索</el-button>
|
||||
<el-button @click="resetSearch">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table :data="list" style="width: 100%" border stripe @row-click="handleRowSelect" highlight-current-row
|
||||
row-key="materialId" :current-row-key="materialId">
|
||||
<el-table-column prop="materialName" label="配料名称" min-width="120" align="center" />
|
||||
<el-table-column label="物料类型" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ scope.row.materialType === 1 ? '辅料' : scope.row.materialType === 2 ? '主材' : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="spec" label="配料规格" min-width="100" align="center" />
|
||||
<el-table-column prop="model" label="配料型号" min-width="100" align="center" />
|
||||
<el-table-column prop="factory" label="生产厂家" min-width="120" align="center" />
|
||||
@@ -64,6 +86,12 @@ const emit = defineEmits(['change']);
|
||||
const list = ref([]); // 物料列表
|
||||
const open = ref(false); // 弹窗显隐
|
||||
|
||||
// 搜索表单数据
|
||||
const searchForm = ref({
|
||||
materialName: '',
|
||||
materialType: ''
|
||||
});
|
||||
|
||||
// 分页响应式数据(核心新增)
|
||||
const pageNum = ref(1); // 当前页码
|
||||
const pageSize = ref(10); // 每页条数
|
||||
@@ -77,7 +105,15 @@ onMounted(async () => {
|
||||
// 加载物料列表(适配分页参数)
|
||||
async function fetchMaterialList() {
|
||||
try {
|
||||
const res = await listMaterial({ pageNum: pageNum.value, pageSize: pageSize.value });
|
||||
// 构建查询参数,包含分页和搜索条件
|
||||
const params = {
|
||||
pageNum: pageNum.value,
|
||||
pageSize: pageSize.value,
|
||||
materialName: searchForm.value.materialName,
|
||||
materialType: searchForm.value.materialType
|
||||
};
|
||||
|
||||
const res = await listMaterial(params);
|
||||
|
||||
list.value = res.rows;
|
||||
total.value = res.total; // 赋值总条数供分页使用
|
||||
@@ -95,6 +131,16 @@ async function fetchMaterialList() {
|
||||
}
|
||||
}
|
||||
|
||||
// 重置搜索
|
||||
function resetSearch() {
|
||||
searchForm.value = {
|
||||
materialName: '',
|
||||
materialType: ''
|
||||
};
|
||||
pageNum.value = 1;
|
||||
fetchMaterialList();
|
||||
}
|
||||
|
||||
// 表格行选择物料
|
||||
function handleRowSelect(row) {
|
||||
if (row.materialId === materialId.value) return;
|
||||
|
||||
@@ -70,20 +70,7 @@ export const constantRoutes = [
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/user',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
redirect: 'noredirect',
|
||||
children: [
|
||||
{
|
||||
path: 'profile/:activeTab?',
|
||||
component: () => import('@/views/system/user/profile/index'),
|
||||
name: 'Profile',
|
||||
meta: { title: '个人中心', icon: 'user' }
|
||||
}
|
||||
]
|
||||
}
|
||||
{ path: '/user', component: Layout, hidden: true, redirect: 'noredirect', children: [ { path: 'profile/:activeTab?', component: () => import('@/views/system/user/profile/index'), name: 'Profile', meta: { title: '个人中心', icon: 'user' } } ] }, { path: '/mat/product', component: Layout, hidden: true, children: [ { path: 'detail/:id(\\d+)', component: () => import('@/views/mat/product/detail'), name: 'ProductDetail', meta: { title: '产品详情', activeMenu: '/mat/product' } } ] }
|
||||
]
|
||||
|
||||
// 动态路由,基于用户权限动态去加载
|
||||
@@ -151,7 +138,7 @@ export const dynamicRoutes = [
|
||||
permissions: ['tool:gen:edit'],
|
||||
children: [
|
||||
{
|
||||
path: 'index/:tableId(\\d+)',
|
||||
path: 'index/:tableId(\d+)',
|
||||
component: () => import('@/views/tool/gen/editTable'),
|
||||
name: 'GenEdit',
|
||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
||||
|
||||
@@ -17,7 +17,7 @@ const service = axios.create({
|
||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||
// 超时
|
||||
timeout: 10000
|
||||
timeout: 30000
|
||||
})
|
||||
|
||||
// request拦截器
|
||||
|
||||
464
gear-ui3/src/views/mat/auxiliary/index.vue
Normal file
464
gear-ui3/src/views/mat/auxiliary/index.vue
Normal file
@@ -0,0 +1,464 @@
|
||||
<!-- 辅料管理 -->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="辅料名称" prop="materialName">
|
||||
<el-input v-model="queryParams.materialName" placeholder="请输入辅料名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料规格" prop="spec">
|
||||
<el-input v-model="queryParams.spec" placeholder="请输入辅料规格" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料型号" prop="model">
|
||||
<el-input v-model="queryParams.model" placeholder="请输入辅料型号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="计量单位 个/公斤/米等" prop="unit">
|
||||
<el-input v-model="queryParams.unit" placeholder="请输入计量单位 个/公斤/米等" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="现存库存" prop="currentStock">
|
||||
<el-input v-model="queryParams.currentStock" placeholder="请输入现存库存" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item> -->
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange" @row-click="handleRowClick">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="辅料ID 主键" align="center" prop="materialId" v-if="true" /> -->
|
||||
<el-table-column label="辅料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="物料类型" align="center" prop="materialType">
|
||||
<template #default="scope">
|
||||
{{ scope.row.materialType === 1 ? '辅料' : '原料' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="辅料规格" align="center" prop="spec" />
|
||||
<el-table-column label="辅料型号" align="center" prop="model" />
|
||||
<el-table-column label="厂家" align="center" prop="factory" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="现存库存" align="center" prop="currentStock">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.currentStock) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="在途数量" align="center" prop="inTransitNum">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.inTransitNum) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Plus" @click="handleIn(scope.row)">入库</el-button>
|
||||
<el-button link type="primary" icon="Minus" @click="handleOut(scope.row)">出库</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改辅料基础信息对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="辅料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入辅料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型" prop="materialType">
|
||||
<el-select v-model="form.materialType" placeholder="请选择物料类型" disabled>
|
||||
<el-option label="辅料" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入辅料规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入辅料型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="form.factory" placeholder="请输入厂家" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="现存库存" prop="currentStock">
|
||||
<el-input v-model="form.currentStock" placeholder="请输入现存库存" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="入库" v-model="inOpen" width="500px" append-to-body>
|
||||
<el-form ref="materialInRef" :model="inForm" label-width="80px">
|
||||
<el-form-item label="辅料" prop="materialId">
|
||||
<raw-selector ref="rawSelector" v-model="inForm.materialId" placeholder="请选择辅料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库数量" prop="inNum">
|
||||
<el-input v-model="inForm.inNum" placeholder="请输入入库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库单价" prop="inPrice">
|
||||
<el-input v-model="inForm.inPrice" placeholder="请输入入库单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库时间" prop="inTime">
|
||||
<el-date-picker clearable v-model="inForm.inTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际入库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="inForm.operator" placeholder="请输入入库操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="inForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitFormIn">确 定</el-button>
|
||||
<el-button @click="cancelIn">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="出库" v-model="outOpen" width="500px" append-to-body>
|
||||
<el-form ref="materialOutRef" :model="outForm" label-width="80px">
|
||||
<el-form-item label="出库单号" prop="outNo">
|
||||
<el-input v-model="outForm.outNo" placeholder="请输入出库单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辅料" prop="materialId">
|
||||
<raw-selector ref="rawSelector" v-model="outForm.materialId" placeholder="请选择辅料" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库数量" prop="outNum">
|
||||
<el-input v-model="outForm.outNum" placeholder="请输入出库数量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库原因" prop="outReason">
|
||||
<el-input v-model="outForm.outReason" placeholder="请输入出库原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="操作人" prop="operator">
|
||||
<el-input v-model="outForm.operator" placeholder="请输入操作人" />
|
||||
</el-form-item>
|
||||
<el-form-item label="出库时间" prop="outTime">
|
||||
<el-date-picker clearable v-model="outForm.outTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||
placeholder="请选择实际出库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="outForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitFormOut">确 定</el-button>
|
||||
<el-button @click="cancelOut">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
|
||||
<Price :materialId="currentMaterialId" ref="priceRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="AuxiliaryMaterial">
|
||||
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/mat/material";
|
||||
import { addPurchaseInDetail } from "@/api/mat/purchaseInDetail";
|
||||
import { addMaterialOut } from "@/api/mat/materialOut";
|
||||
import Price from "@/views/mat/components/price.vue";
|
||||
import RawSelector from "@/components/RawSelector/index.vue";
|
||||
import { formatDecimal } from '@/utils/gear'
|
||||
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const materialList = ref([]);
|
||||
const open = ref(false);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const inForm = ref({});
|
||||
const outForm = ref({});
|
||||
const inOpen = ref(false);
|
||||
const outOpen = ref(false);
|
||||
|
||||
const currentMaterialId = ref(null);
|
||||
|
||||
function handleRowClick(row) {
|
||||
currentMaterialId.value = row.materialId;
|
||||
}
|
||||
|
||||
const priceHistoryList = ref([]);
|
||||
|
||||
const nickName = computed(() => userStore.nickName)
|
||||
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
materialName: undefined,
|
||||
spec: undefined,
|
||||
model: undefined,
|
||||
factory: undefined,
|
||||
unit: undefined,
|
||||
currentStock: undefined,
|
||||
materialType: 1, // 固定为辅料
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询辅料基础信息列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listMaterial(queryParams.value).then(response => {
|
||||
materialList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
materialType: 1, // 固定为辅料
|
||||
spec: null,
|
||||
model: null,
|
||||
factory: null,
|
||||
unit: null,
|
||||
currentStock: null,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("materialRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
queryParams.value.materialType = 1; // 重置后仍为辅料
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.materialId);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加辅料基础信息";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _materialId = row.materialId || ids.value
|
||||
getMaterial(_materialId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改辅料基础信息";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["materialRef"].validate(valid => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.materialId != null) {
|
||||
updateMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _materialIds = row.materialId || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除辅料基础信息编号为"' + _materialIds + '"的数据项?').then(function () {
|
||||
loading.value = true;
|
||||
return delMaterial(_materialIds);
|
||||
}).then(() => {
|
||||
loading.value = true;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('mat/material/export', {
|
||||
...queryParams.value
|
||||
}, `auxiliary_material_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
function handleIn(row) {
|
||||
const inTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
inOpen.value = true;
|
||||
|
||||
inForm.value = {
|
||||
detailId: null,
|
||||
purchaseId: null,
|
||||
materialId: row.materialId,
|
||||
inNum: null,
|
||||
inPrice: null,
|
||||
inAmount: null,
|
||||
inTime: inTime,
|
||||
operator: nickName,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("materialInRef");
|
||||
}
|
||||
|
||||
function cancelIn() {
|
||||
inOpen.value = false;
|
||||
}
|
||||
|
||||
const priceRef = ref(null);
|
||||
|
||||
function submitFormIn() {
|
||||
loading.value = true;
|
||||
buttonLoading.value = true;
|
||||
addPurchaseInDetail(inForm.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
inOpen.value = false;
|
||||
getList();
|
||||
priceRef.value.getListChart();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function handleOut(row) {
|
||||
const outNo = proxy.parseTime(new Date(), '{y}{m}{d}{hh}{i}{s}')
|
||||
const outTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
outOpen.value = true;
|
||||
|
||||
outForm.value = {
|
||||
outId: null,
|
||||
outNo: outNo,
|
||||
materialId: row.materialId,
|
||||
outNum: null,
|
||||
outReason: null,
|
||||
operator: nickName,
|
||||
outTime: outTime,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
};
|
||||
proxy.resetForm("materialOutRef");
|
||||
}
|
||||
|
||||
function cancelOut() {
|
||||
outOpen.value = false;
|
||||
}
|
||||
|
||||
function submitFormOut() {
|
||||
loading.value = true;
|
||||
buttonLoading.value = true;
|
||||
addMaterialOut(outForm.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
outOpen.value = false;
|
||||
getList();
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
@@ -25,6 +25,11 @@
|
||||
<raw :data="scope.row" :materialId="scope.row.materialId" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料类型" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ scope.row.material?.materialType === 1 ? '辅料' : scope.row.material?.materialType === 2 ? '主材' : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="所需数量" align="center" prop="materialNum">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.materialNum) }}
|
||||
@@ -75,6 +80,7 @@
|
||||
|
||||
<script setup name="ProductMaterialRelation">
|
||||
import { listProductMaterialRelation, getProductMaterialRelation, delProductMaterialRelation, addProductMaterialRelation, updateProductMaterialRelation } from "@/api/mat/productMaterialRelation";
|
||||
import { getMaterial } from "@/api/mat/material";
|
||||
import RawSelector from '@/components/RawSelector/index.vue'
|
||||
import Raw from '@/components/Renderer/Raw.vue'
|
||||
import { formatDecimal } from '@/utils/gear'
|
||||
@@ -128,8 +134,21 @@ watch(() => props.productId, (newVal, oldVal) => {
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listProductMaterialRelation(queryParams.value).then(response => {
|
||||
productMaterialRelationList.value = response.rows;
|
||||
total.value = response.total;
|
||||
const relations = response.rows;
|
||||
// 为每个配方项获取物料详细信息,包括物料类型
|
||||
const promises = relations.map(item => {
|
||||
return getMaterial(item.materialId).then(materialResponse => {
|
||||
item.material = materialResponse.data;
|
||||
return item;
|
||||
});
|
||||
});
|
||||
return Promise.all(promises);
|
||||
}).then(relationsWithMaterial => {
|
||||
productMaterialRelationList.value = relationsWithMaterial;
|
||||
total.value = relationsWithMaterial.length;
|
||||
loading.value = false;
|
||||
}).catch(error => {
|
||||
console.error('获取数据失败:', error);
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
516
gear-ui3/src/views/mat/product/detail.vue
Normal file
516
gear-ui3/src/views/mat/product/detail.vue
Normal file
@@ -0,0 +1,516 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card class="mb20">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>{{ productDetail.productName }} - 产品详情</span>
|
||||
<el-button type="primary" plain size="small" @click="handleBack">返回列表</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<div class="product-info">
|
||||
<div class="info-item">
|
||||
<span class="label">产品名称:</span>
|
||||
<span class="value">{{ productDetail.productName }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">产品规格:</span>
|
||||
<span class="value">{{ productDetail.spec }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">产品型号:</span>
|
||||
<span class="value">{{ productDetail.model }}</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">产品单价:</span>
|
||||
<span class="value">{{ formatDecimal(productDetail.unitPrice) }} 元</span>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="label">备注:</span>
|
||||
<span class="value">{{ productDetail.remark || '无' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 产品附加属性 -->
|
||||
<div class="product-addition" v-if="productAdditionList.length > 0">
|
||||
<h4>产品附加属性</h4>
|
||||
<el-table :data="productAdditionList" style="width: 100%" border>
|
||||
<el-table-column prop="attrName" label="属性名" width="150" />
|
||||
<el-table-column prop="attrValue" label="属性值" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="product-images" v-if="productDetail.productImages && productDetail.productImages.trim()">
|
||||
<h4>产品图片</h4>
|
||||
<div class="image-list">
|
||||
<el-image
|
||||
v-for="(image, index) in productDetail.productImages.split(',').filter(img => img.trim())"
|
||||
:key="index"
|
||||
:src="image"
|
||||
:preview-src-list="productDetail.productImages.split(',').filter(img => img.trim())"
|
||||
style="width: 100px; height: 100px; margin-right: 10px;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="product-pdfs" v-if="pdfDisplayList.length > 0">
|
||||
<h4>产品说明书</h4>
|
||||
<div class="pdf-list">
|
||||
<div
|
||||
v-for="(pdf, index) in pdfDisplayList"
|
||||
:key="index"
|
||||
class="pdf-item"
|
||||
>
|
||||
<el-icon class="pdf-icon"><Document /></el-icon>
|
||||
<span class="pdf-name" :title="pdf.name">{{ pdf.name }}</span>
|
||||
<el-button type="primary" link size="small" @click="previewPdf(pdf)">预览</el-button>
|
||||
<el-button type="success" link size="small" @click="downloadPdf(pdf)">下载</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>材料明细</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 主材部分 -->
|
||||
<div class="material-section">
|
||||
<h3 class="section-title">主材</h3>
|
||||
<el-table :data="mainMaterials" style="width: 100%" border>
|
||||
<el-table-column prop="materialName" label="配料名称" width="150" />
|
||||
<el-table-column prop="spec" label="材料规格" width="150" />
|
||||
<el-table-column prop="quantity" label="数量" width="100" align="center" />
|
||||
<el-table-column prop="price" label="价格" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.price) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subtotal" label="小计" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.subtotal) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="section-summary" v-if="mainMaterials.length > 0">
|
||||
<span>主材小计:{{ formatDecimal(mainMaterials.reduce((sum, item) => sum + item.subtotal, 0)) }} 元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 辅材部分 -->
|
||||
<div class="material-section">
|
||||
<h3 class="section-title">辅材</h3>
|
||||
<el-table :data="auxiliaryMaterials" style="width: 100%" border>
|
||||
<el-table-column prop="materialName" label="配料名称" width="150" />
|
||||
<el-table-column prop="spec" label="材料规格" width="150" />
|
||||
<el-table-column prop="quantity" label="数量" width="100" align="center" />
|
||||
<el-table-column prop="price" label="价格" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.price) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subtotal" label="小计" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.subtotal) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="section-summary" v-if="auxiliaryMaterials.length > 0">
|
||||
<span>辅材小计:{{ formatDecimal(auxiliaryMaterials.reduce((sum, item) => sum + item.subtotal, 0)) }} 元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 工价部分 -->
|
||||
<div class="material-section">
|
||||
<h3 class="section-title">工价</h3>
|
||||
<el-table :data="laborMaterials" style="width: 100%" border>
|
||||
<el-table-column prop="materialName" label="项目名称" width="150" />
|
||||
<el-table-column prop="spec" label="规格" width="150" />
|
||||
<el-table-column prop="quantity" label="数量" width="100" align="center" />
|
||||
<el-table-column prop="price" label="价格" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.price) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="subtotal" label="小计" width="100" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.subtotal) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="section-summary" v-if="laborMaterials.length > 0">
|
||||
<span>工价小计:{{ formatDecimal(laborMaterials.reduce((sum, item) => sum + item.subtotal, 0)) }} 元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="material-section" v-if="productLaborList.length > 0">
|
||||
<h3 class="section-title">工价(手动)</h3>
|
||||
<el-table :data="productLaborList" style="width: 100%" border>
|
||||
<el-table-column prop="laborName" label="工价说明" />
|
||||
<el-table-column prop="laborPrice" label="金额" width="140" align="center">
|
||||
<template #default="scope">
|
||||
{{ formatDecimal(scope.row.laborPrice) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="section-summary">
|
||||
<span>工价(手动)小计:{{ formatDecimal(productLaborList.reduce((sum, item) => sum + (Number(item.laborPrice) || 0), 0)) }} 元</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 总计部分 -->
|
||||
<div class="total-section">
|
||||
<div class="total-item">
|
||||
<span class="total-label">合计:</span>
|
||||
<span class="total-value">{{ formatDecimal(totalAmount) }} 元</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="ProductDetail">
|
||||
import { ref, computed, onMounted } from 'vue';
|
||||
import { useRouter, useRoute } from 'vue-router';
|
||||
import { getProduct } from "@/api/mat/product";
|
||||
import { listProductMaterialRelation } from "@/api/mat/productMaterialRelation";
|
||||
import { getMaterial } from "@/api/mat/material";
|
||||
import { listProductAddition } from "@/api/mat/productAddition";
|
||||
import { listProductLabor } from "@/api/mat/productLabor";
|
||||
import { listByIds, listOss } from "@/api/system/oss";
|
||||
import { formatDecimal } from '@/utils/gear';
|
||||
import { Document } from '@element-plus/icons-vue';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const productDetail = ref({});
|
||||
const loading = ref(true);
|
||||
const materialLoading = ref(false);
|
||||
const additionLoading = ref(false);
|
||||
const pdfFiles = ref([]);
|
||||
const pdfUrlFiles = ref([]);
|
||||
|
||||
// 材料明细数据
|
||||
const productMaterialRelationList = ref([]);
|
||||
|
||||
// 产品附加属性数据
|
||||
const productAdditionList = ref([]);
|
||||
const productLaborList = ref([]);
|
||||
|
||||
// 计算主材、辅材和工本
|
||||
const mainMaterials = computed(() => {
|
||||
// 主材(材料类型为2)
|
||||
return productMaterialRelationList.value
|
||||
.filter(item => item.material && item.material.materialType === 2)
|
||||
.map(item => ({
|
||||
materialName: item.material.materialName,
|
||||
spec: item.material.spec,
|
||||
quantity: item.materialNum + (item.material.unit || ''),
|
||||
price: item.material.unitPrice || 0,
|
||||
subtotal: (item.materialNum * (item.material.unitPrice || 0)) || 0
|
||||
}));
|
||||
});
|
||||
|
||||
const auxiliaryMaterials = computed(() => {
|
||||
// 辅材(材料类型为1)
|
||||
return productMaterialRelationList.value
|
||||
.filter(item => item.material && item.material.materialType === 1)
|
||||
.map(item => ({
|
||||
materialName: item.material.materialName,
|
||||
spec: item.material.spec,
|
||||
quantity: item.materialNum + (item.material.unit || ''),
|
||||
price: item.material.unitPrice || 0,
|
||||
subtotal: (item.materialNum * (item.material.unitPrice || 0)) || 0
|
||||
}));
|
||||
});
|
||||
|
||||
const laborMaterials = computed(() => {
|
||||
// 工价(材料类型为3)
|
||||
return productMaterialRelationList.value
|
||||
.filter(item => item.material && item.material.materialType === 3)
|
||||
.map(item => ({
|
||||
materialName: item.material.materialName,
|
||||
spec: item.material.spec,
|
||||
quantity: item.materialNum + (item.material.unit || ''),
|
||||
price: item.material.unitPrice || 0,
|
||||
subtotal: (item.materialNum * (item.material.unitPrice || 0)) || 0
|
||||
}));
|
||||
});
|
||||
|
||||
// 计算总金额
|
||||
const totalAmount = computed(() => {
|
||||
const mainTotal = mainMaterials.value.reduce((sum, item) => sum + item.subtotal, 0);
|
||||
const auxiliaryTotal = auxiliaryMaterials.value.reduce((sum, item) => sum + item.subtotal, 0);
|
||||
const laborTotal = laborMaterials.value.reduce((sum, item) => sum + item.subtotal, 0);
|
||||
const manualLaborTotal = productLaborList.value.reduce((sum, item) => {
|
||||
const price = item && item.laborPrice !== undefined && item.laborPrice !== null ? Number(item.laborPrice) : 0;
|
||||
return sum + (Number.isFinite(price) ? price : 0);
|
||||
}, 0);
|
||||
return mainTotal + auxiliaryTotal + laborTotal + manualLaborTotal;
|
||||
});
|
||||
|
||||
const isOssIdList = (val) => {
|
||||
if (val === null || val === undefined) return false;
|
||||
const str = String(val).trim();
|
||||
return /^[0-9]+(,[0-9]+)*$/.test(str);
|
||||
};
|
||||
|
||||
const pdfDisplayList = computed(() => {
|
||||
const raw = String(productDetail.value.productPdfs || '').trim();
|
||||
if (!raw) return [];
|
||||
if (isOssIdList(raw)) return pdfFiles.value;
|
||||
return pdfUrlFiles.value;
|
||||
});
|
||||
|
||||
// 获取产品详情
|
||||
function getProductDetail() {
|
||||
const productId = route.params.id;
|
||||
if (productId) {
|
||||
loading.value = true;
|
||||
getProduct(productId).then(response => {
|
||||
productDetail.value = response.data;
|
||||
loading.value = false;
|
||||
resolvePdfFiles();
|
||||
// 获取材料明细
|
||||
getMaterialDetail(productId);
|
||||
// 获取产品附加属性
|
||||
getProductAddition(productId);
|
||||
getProductLabor(productId);
|
||||
}).catch(error => {
|
||||
console.error('获取产品详情失败:', error);
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 获取产品附加属性
|
||||
function getProductAddition(productId) {
|
||||
additionLoading.value = true;
|
||||
listProductAddition({ productId }).then(response => {
|
||||
productAdditionList.value = response.rows || [];
|
||||
additionLoading.value = false;
|
||||
}).catch(error => {
|
||||
console.error('获取产品附加属性失败:', error);
|
||||
additionLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 获取材料明细
|
||||
function getMaterialDetail(productId) {
|
||||
materialLoading.value = true;
|
||||
listProductMaterialRelation({ productId }).then(response => {
|
||||
const relations = response.rows;
|
||||
// 为每个配方项获取物料详细信息,包括物料类型
|
||||
const promises = relations.map(item => {
|
||||
return getMaterial(item.materialId).then(materialResponse => {
|
||||
item.material = materialResponse.data;
|
||||
return item;
|
||||
});
|
||||
});
|
||||
return Promise.all(promises);
|
||||
}).then(relationsWithMaterial => {
|
||||
productMaterialRelationList.value = relationsWithMaterial;
|
||||
materialLoading.value = false;
|
||||
}).catch(error => {
|
||||
console.error('获取材料明细失败:', error);
|
||||
materialLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
function getProductLabor(productId) {
|
||||
listProductLabor({ productId }).then(response => {
|
||||
productLaborList.value = response.rows || [];
|
||||
}).catch(() => {
|
||||
productLaborList.value = [];
|
||||
});
|
||||
}
|
||||
|
||||
function resolvePdfFiles() {
|
||||
const raw = String(productDetail.value.productPdfs || '').trim();
|
||||
if (!raw) {
|
||||
pdfFiles.value = [];
|
||||
pdfUrlFiles.value = [];
|
||||
return;
|
||||
}
|
||||
if (isOssIdList(raw)) {
|
||||
pdfUrlFiles.value = [];
|
||||
listByIds(raw).then(res => {
|
||||
const list = res.data || [];
|
||||
pdfFiles.value = list.map(oss => ({
|
||||
name: oss.originalName || oss.fileName || String(oss.ossId),
|
||||
url: oss.url,
|
||||
ossId: oss.ossId
|
||||
}));
|
||||
}).catch(() => {
|
||||
pdfFiles.value = [];
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
pdfFiles.value = [];
|
||||
const urls = raw.split(',').map(s => String(s).trim()).filter(Boolean);
|
||||
Promise.all(urls.map((url) =>
|
||||
listOss({ url, pageNum: 1, pageSize: 1 })
|
||||
.then(r => (r && r.rows && r.rows[0]) ? r.rows[0] : null)
|
||||
.catch(() => null)
|
||||
)).then(rows => {
|
||||
pdfUrlFiles.value = urls.map((url, index) => {
|
||||
const row = rows[index];
|
||||
return {
|
||||
name: (row && (row.originalName || row.fileName)) || getFileName(url),
|
||||
url: (row && row.url) || url,
|
||||
ossId: row && row.ossId
|
||||
};
|
||||
});
|
||||
}).catch(() => {
|
||||
pdfUrlFiles.value = urls.map(url => ({ name: getFileName(url), url }));
|
||||
});
|
||||
}
|
||||
|
||||
// 返回列表
|
||||
function handleBack() {
|
||||
router.back();
|
||||
}
|
||||
|
||||
// 获取文件名
|
||||
function getFileName(url) {
|
||||
if (!url) return '';
|
||||
return url.substring(url.lastIndexOf('/') + 1);
|
||||
}
|
||||
|
||||
// 预览PDF
|
||||
function previewPdf(pdf) {
|
||||
if (!pdf || !pdf.url) return;
|
||||
window.open(pdf.url, '_blank');
|
||||
}
|
||||
|
||||
// 下载PDF
|
||||
function downloadPdf(pdf) {
|
||||
if (!pdf || !pdf.url) return;
|
||||
const link = document.createElement('a');
|
||||
link.href = pdf.url;
|
||||
link.download = pdf.name || getFileName(pdf.url);
|
||||
link.click();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getProductDetail();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.product-info {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
min-width: 80px;
|
||||
}
|
||||
|
||||
.product-images {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.image-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.product-pdfs {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.pdf-list {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.pdf-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px;
|
||||
background-color: #f5f7fa;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.pdf-icon {
|
||||
font-size: 24px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.pdf-name {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.material-section {
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
background-color: #f5f7fa;
|
||||
padding: 10px;
|
||||
border-left: 4px solid #409eff;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.section-summary {
|
||||
text-align: right;
|
||||
padding: 10px;
|
||||
background-color: #f9f9f9;
|
||||
border-top: 1px solid #e4e7ed;
|
||||
margin-top: -1px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.total-section {
|
||||
margin-top: 30px;
|
||||
padding: 20px;
|
||||
background-color: #f0f9eb;
|
||||
border: 1px solid #b7eb8f;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.total-item {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.total-label {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.total-value {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
color: #f56c6c;
|
||||
}
|
||||
</style>
|
||||
@@ -45,10 +45,29 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="产品图片" align="center" prop="productImages">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row.productImages && scope.row.productImages.trim()" class="image-preview">
|
||||
<el-image
|
||||
v-for="(image, index) in scope.row.productImages.split(',')"
|
||||
:key="index"
|
||||
:src="image"
|
||||
:preview-src-list="scope.row.productImages.split(',')"
|
||||
:z-index="9999"
|
||||
:preview-teleported="true"
|
||||
style="width: 40px; height: 40px; margin-right: 8px;"
|
||||
/>
|
||||
</div>
|
||||
<span v-else>无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Plus" @click="handleBom(scope.row)">配方</el-button>
|
||||
<el-button link type="primary" icon="View" @click="handleDetail(scope.row)">详情</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Setting" @click="handleAddition(scope.row)">附加属性</el-button>
|
||||
<el-button link type="primary" @click="handleLabor(scope.row)">工价</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -75,6 +94,45 @@
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品图片" prop="productImages">
|
||||
<el-upload
|
||||
v-model:file-list="imageFileList"
|
||||
:action="uploadUrl"
|
||||
:headers="headers"
|
||||
:on-success="handleImageUploadSuccess"
|
||||
:on-remove="handleImageRemove"
|
||||
multiple
|
||||
list-type="picture"
|
||||
:limit="5"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<el-button type="primary" icon="Upload">上传图片</el-button>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
最多上传5张图片,支持 JPG、PNG 格式
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品说明书" prop="productPdfs">
|
||||
<el-upload
|
||||
v-model:file-list="pdfFileList"
|
||||
:action="uploadUrl"
|
||||
:headers="headers"
|
||||
:on-success="handlePdfUploadSuccess"
|
||||
:on-remove="handlePdfRemove"
|
||||
multiple
|
||||
:limit="5"
|
||||
:before-upload="beforePdfUpload"
|
||||
>
|
||||
<el-button type="primary" icon="Upload">上传说明书</el-button>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">
|
||||
最多上传5个PDF文件,支持 PDF 格式
|
||||
</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@@ -88,6 +146,65 @@
|
||||
<bom :productId="currentProductId" @close="bomOpen = false" />
|
||||
</el-dialog>
|
||||
|
||||
<!-- 产品附加属性对话框 -->
|
||||
<el-dialog title="产品附加属性" v-model="additionOpen" width="600px" append-to-body>
|
||||
<div class="addition-container">
|
||||
<el-button type="primary" icon="Plus" @click="addAdditionItem" style="margin-bottom: 10px">添加属性</el-button>
|
||||
<el-table :data="additionList" style="width: 100%" border>
|
||||
<el-table-column prop="attrName" label="属性名" width="150">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.attrName" placeholder="请输入属性名" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="attrValue" label="属性值">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.attrValue" placeholder="请输入属性值" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" icon="Delete" @click="removeAdditionItem(scope.$index)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="saveAdditions">保存</el-button>
|
||||
<el-button @click="additionOpen = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="产品工价" v-model="laborOpen" width="600px" append-to-body>
|
||||
<div class="addition-container">
|
||||
<el-button type="primary" icon="Plus" @click="addLaborItem" style="margin-bottom: 10px">添加工价</el-button>
|
||||
<el-table :data="laborList" style="width: 100%" border>
|
||||
<el-table-column prop="laborName" label="工价说明" width="200">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.laborName" placeholder="请输入工价说明" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="laborPrice" label="金额(元)">
|
||||
<template #default="scope">
|
||||
<el-input-number style="width: 100%" v-model="scope.row.laborPrice" :controls="false" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="100" align="center">
|
||||
<template #default="scope">
|
||||
<el-button link type="danger" icon="Delete" @click="removeLaborItem(scope.$index)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="saveLabors">保存</el-button>
|
||||
<el-button @click="laborOpen = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 将这个表格改为始终吸底,且外层容器可以拖拽调节高度 -->
|
||||
<!-- <StickyDragContainer v-if="currentProduct.productId" :parent-ref="appContainer"> -->
|
||||
<div v-if="currentProduct.productId">
|
||||
@@ -110,16 +227,30 @@
|
||||
<el-empty v-else description="选择产品查看配料信息" />
|
||||
|
||||
<!-- </StickyDragContainer> -->
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Product">
|
||||
import { ref, computed } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mat/product";
|
||||
import { listProductMaterialRelation } from "@/api/mat/productMaterialRelation";
|
||||
import { getMaterial } from "@/api/mat/material";
|
||||
import { listProductAddition, addProductAddition, updateProductAddition, delProductAddition } from "@/api/mat/productAddition";
|
||||
import { listProductLabor, addProductLabor, updateProductLabor, delProductLabor } from "@/api/mat/productLabor";
|
||||
import { listByIds, listOss } from "@/api/system/oss";
|
||||
import bom from "@/views/mat/components/bom.vue";
|
||||
import StickyDragContainer from "@/components/StickyDragContainer/index.vue";
|
||||
import { formatDecimal } from '@/utils/gear'
|
||||
import Raw from '@/components/Renderer/Raw.vue';
|
||||
import { formatDecimal } from '@/utils/gear';
|
||||
import { getToken } from '@/utils/auth';
|
||||
|
||||
const router = useRouter();
|
||||
const bomOpen = ref(false);
|
||||
const additionOpen = ref(false);
|
||||
const laborOpen = ref(false);
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@@ -136,13 +267,46 @@ const title = ref("");
|
||||
const currentProductId = ref(null);
|
||||
const currentProduct = ref({});
|
||||
const appContainer = ref(null);
|
||||
const imageFileList = ref([]);
|
||||
const pdfFileList = ref([]);
|
||||
const pdfUseOssId = ref(true);
|
||||
const additionList = ref([]);
|
||||
const laborList = ref([]);
|
||||
const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + '/system/oss/upload');
|
||||
const headers = ref({ Authorization: "Bearer " + getToken() });
|
||||
|
||||
const isOssIdList = (val) => {
|
||||
if (val === null || val === undefined) return false;
|
||||
const str = String(val).trim();
|
||||
return /^[0-9]+(,[0-9]+)*$/.test(str);
|
||||
};
|
||||
|
||||
const getFileNameFromUrl = (url) => {
|
||||
if (!url) return '';
|
||||
const str = String(url);
|
||||
return str.substring(str.lastIndexOf('/') + 1);
|
||||
};
|
||||
|
||||
const formatterTime = (time) => {
|
||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
form: {
|
||||
productId: null,
|
||||
productName: null,
|
||||
spec: null,
|
||||
model: null,
|
||||
unitPrice: null,
|
||||
delFlag: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null,
|
||||
productImages: null,
|
||||
productPdfs: null
|
||||
},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
@@ -185,8 +349,13 @@ function reset() {
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
remark: null
|
||||
remark: null,
|
||||
productImages: null,
|
||||
productPdfs: null
|
||||
};
|
||||
imageFileList.value = [];
|
||||
pdfFileList.value = [];
|
||||
pdfUseOssId.value = true;
|
||||
proxy.resetForm("productRef");
|
||||
}
|
||||
|
||||
@@ -220,37 +389,226 @@ function handleAdd() {
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset();
|
||||
const _productId = row.productId || ids.value
|
||||
const _productId = row.productId || ids.value;
|
||||
getProduct(_productId).then(response => {
|
||||
loading.value = false;
|
||||
form.value = response.data;
|
||||
|
||||
// 处理图片文件列表
|
||||
if (form.value.productImages) {
|
||||
imageFileList.value = form.value.productImages.split(',').map((url, index) => ({
|
||||
name: url.substring(url.lastIndexOf('/') + 1),
|
||||
url: url,
|
||||
uid: Date.now() + index
|
||||
}));
|
||||
} else {
|
||||
imageFileList.value = [];
|
||||
}
|
||||
|
||||
// 处理PDF文件列表
|
||||
if (form.value.productPdfs) {
|
||||
const raw = String(form.value.productPdfs).trim();
|
||||
if (isOssIdList(raw)) {
|
||||
pdfUseOssId.value = true;
|
||||
listByIds(raw).then(res => {
|
||||
const list = res.data || [];
|
||||
pdfFileList.value = list.map((oss, index) => ({
|
||||
name: oss.originalName || oss.fileName || String(oss.ossId),
|
||||
url: oss.url,
|
||||
ossId: oss.ossId,
|
||||
uid: Date.now() + index + 100
|
||||
}));
|
||||
}).catch(() => {
|
||||
pdfFileList.value = [];
|
||||
});
|
||||
} else {
|
||||
const urls = raw.split(',').map(s => String(s).trim()).filter(Boolean);
|
||||
Promise.all(urls.map((url) =>
|
||||
listOss({ url, pageNum: 1, pageSize: 1 })
|
||||
.then(r => (r && r.rows && r.rows[0]) ? r.rows[0] : null)
|
||||
.catch(() => null)
|
||||
)).then(rows => {
|
||||
const mapped = urls.map((url, index) => {
|
||||
const row = rows[index];
|
||||
return {
|
||||
name: (row && (row.originalName || row.fileName)) || getFileNameFromUrl(url),
|
||||
url: (row && row.url) || url,
|
||||
ossId: row && row.ossId,
|
||||
uid: Date.now() + index + 100
|
||||
};
|
||||
});
|
||||
pdfFileList.value = mapped;
|
||||
const ossIds = mapped.map(f => f.ossId).filter(Boolean);
|
||||
const allResolved = ossIds.length === mapped.length && mapped.length > 0;
|
||||
pdfUseOssId.value = allResolved;
|
||||
if (allResolved) {
|
||||
form.value.productPdfs = ossIds.join(',');
|
||||
} else {
|
||||
form.value.productPdfs = urls.join(',');
|
||||
}
|
||||
}).catch(() => {
|
||||
pdfUseOssId.value = false;
|
||||
pdfFileList.value = urls.map((url, index) => ({
|
||||
name: getFileNameFromUrl(url),
|
||||
url,
|
||||
uid: Date.now() + index + 100
|
||||
}));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
pdfFileList.value = [];
|
||||
}
|
||||
|
||||
open.value = true;
|
||||
title.value = "修改产品基础信息";
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError("获取产品信息失败");
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 图片上传成功处理 */
|
||||
function handleImageUploadSuccess(response, uploadFile, uploadFiles) {
|
||||
if (response.code === 200) {
|
||||
const imageUrl = response.data.url;
|
||||
uploadFile.url = imageUrl;
|
||||
|
||||
const urls = uploadFiles
|
||||
.map(f => f.url)
|
||||
.filter(url => url && !url.startsWith('blob:'));
|
||||
form.value.productImages = urls.join(',');
|
||||
} else {
|
||||
proxy.$modal.msgError('上传失败:' + response.msg);
|
||||
const index = imageFileList.value.findIndex(f => f.uid === uploadFile.uid);
|
||||
if (index > -1) {
|
||||
imageFileList.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 图片移除处理 */
|
||||
function handleImageRemove(uploadFile, uploadFiles) {
|
||||
const urls = uploadFiles
|
||||
.map(f => f.url)
|
||||
.filter(url => url && !url.startsWith('blob:'));
|
||||
form.value.productImages = urls.length > 0 ? urls.join(',') : null;
|
||||
}
|
||||
|
||||
/** PDF上传成功处理 */
|
||||
function handlePdfUploadSuccess(response, uploadFile, uploadFiles) {
|
||||
if (response.code === 200) {
|
||||
uploadFile.url = response.data.url;
|
||||
uploadFile.name = response.data.fileName || uploadFile.name;
|
||||
uploadFile.ossId = response.data.ossId;
|
||||
|
||||
if (pdfUseOssId.value) {
|
||||
const ossIds = uploadFiles
|
||||
.map(f => f.ossId)
|
||||
.filter(Boolean);
|
||||
form.value.productPdfs = ossIds.length > 0 ? ossIds.join(',') : null;
|
||||
} else {
|
||||
const urls = uploadFiles
|
||||
.map(f => f.url)
|
||||
.filter(url => url && !url.startsWith('blob:'));
|
||||
form.value.productPdfs = urls.length > 0 ? urls.join(',') : null;
|
||||
}
|
||||
} else {
|
||||
proxy.$modal.msgError('上传失败:' + response.msg);
|
||||
const index = pdfFileList.value.findIndex(f => f.uid === uploadFile.uid);
|
||||
if (index > -1) {
|
||||
pdfFileList.value.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** PDF移除处理 */
|
||||
function handlePdfRemove(uploadFile, uploadFiles) {
|
||||
if (pdfUseOssId.value) {
|
||||
const ossIds = uploadFiles
|
||||
.map(f => f.ossId)
|
||||
.filter(Boolean);
|
||||
form.value.productPdfs = ossIds.length > 0 ? ossIds.join(',') : null;
|
||||
} else {
|
||||
const urls = uploadFiles
|
||||
.map(f => f.url)
|
||||
.filter(url => url && !url.startsWith('blob:'));
|
||||
form.value.productPdfs = urls.length > 0 ? urls.join(',') : null;
|
||||
}
|
||||
}
|
||||
|
||||
/** PDF上传前校验 */
|
||||
function beforePdfUpload(file) {
|
||||
const isPdf = file.type === 'application/pdf';
|
||||
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||
if (!isPdf) {
|
||||
proxy.$modal.msgError('只能上传 PDF 格式的文件');
|
||||
return false;
|
||||
}
|
||||
if (!isLt10M) {
|
||||
proxy.$modal.msgError('PDF文件大小不能超过 10MB');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 图片上传前校验 */
|
||||
function beforeUpload(file) {
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
if (!isJpgOrPng) {
|
||||
proxy.$modal.msgError('只能上传 JPG/PNG 格式的图片');
|
||||
return false;
|
||||
}
|
||||
if (!isLt2M) {
|
||||
proxy.$modal.msgError('图片大小不能超过 2MB');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
if (buttonLoading.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
proxy.$refs["productRef"].validate(valid => {
|
||||
if (valid) {
|
||||
const submitData = {
|
||||
productId: form.value.productId,
|
||||
productName: form.value.productName,
|
||||
spec: form.value.spec,
|
||||
model: form.value.model,
|
||||
unitPrice: form.value.unitPrice,
|
||||
remark: form.value.remark,
|
||||
productImages: form.value.productImages,
|
||||
productPdfs: form.value.productPdfs
|
||||
};
|
||||
|
||||
buttonLoading.value = true;
|
||||
if (form.value.productId != null) {
|
||||
updateProduct(form.value).then(response => {
|
||||
updateProduct(submitData).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError("修改失败");
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
} else {
|
||||
addProduct(form.value).then(response => {
|
||||
addProduct(submitData).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
}).catch(err => {
|
||||
proxy.$modal.msgError("新增失败");
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -287,5 +645,146 @@ function handleRowClick(row) {
|
||||
currentProduct.value = row;
|
||||
}
|
||||
|
||||
function handleDetail(row) {
|
||||
// 跳转到产品详情页
|
||||
router.push(`/mat/product/detail/${row.productId}`);
|
||||
}
|
||||
|
||||
function handleAddition(row) {
|
||||
currentProductId.value = row.productId;
|
||||
// 清空附加属性列表
|
||||
additionList.value = [];
|
||||
// 获取已有的附加属性数据
|
||||
listProductAddition({ productId: row.productId }).then(response => {
|
||||
if (response.code === 200) {
|
||||
additionList.value = response.rows || [];
|
||||
}
|
||||
});
|
||||
additionOpen.value = true;
|
||||
}
|
||||
|
||||
function addAdditionItem() {
|
||||
additionList.value.push({ attrName: '', attrValue: '' });
|
||||
}
|
||||
|
||||
function removeAdditionItem(index) {
|
||||
additionList.value.splice(index, 1);
|
||||
}
|
||||
|
||||
function saveAdditions() {
|
||||
// 过滤掉空的属性项
|
||||
const validAdditions = additionList.value.filter(item => item.attrName && item.attrName.trim());
|
||||
|
||||
// 保存附加属性
|
||||
validAdditions.forEach(item => {
|
||||
const additionData = {
|
||||
productId: currentProductId.value,
|
||||
attrName: item.attrName.trim(),
|
||||
attrValue: item.attrValue ? item.attrValue.trim() : ''
|
||||
};
|
||||
|
||||
// 如果有addId,则是更新操作
|
||||
if (item.addId) {
|
||||
additionData.addId = item.addId;
|
||||
// 调用API更新附加属性
|
||||
updateProductAddition(additionData).then(response => {
|
||||
if (response.code === 200) {
|
||||
proxy.$modal.msgSuccess('保存成功');
|
||||
} else {
|
||||
proxy.$modal.msgError('保存失败');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 调用API新增附加属性
|
||||
addProductAddition(additionData).then(response => {
|
||||
if (response.code === 200) {
|
||||
proxy.$modal.msgSuccess('保存成功');
|
||||
} else {
|
||||
proxy.$modal.msgError('保存失败');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
additionOpen.value = false;
|
||||
}
|
||||
|
||||
function handleLabor(row) {
|
||||
currentProductId.value = row.productId;
|
||||
laborList.value = [];
|
||||
listProductLabor({ productId: row.productId }).then(response => {
|
||||
if (response.code === 200) {
|
||||
laborList.value = response.rows || [];
|
||||
}
|
||||
});
|
||||
laborOpen.value = true;
|
||||
}
|
||||
|
||||
function addLaborItem() {
|
||||
laborList.value.push({ laborName: '', laborPrice: 0 });
|
||||
}
|
||||
|
||||
function removeLaborItem(index) {
|
||||
const item = laborList.value[index];
|
||||
if (item && item.laborId) {
|
||||
delProductLabor(item.laborId).finally(() => {
|
||||
laborList.value.splice(index, 1);
|
||||
});
|
||||
return;
|
||||
}
|
||||
laborList.value.splice(index, 1);
|
||||
}
|
||||
|
||||
async function saveLabors() {
|
||||
const valid = laborList.value
|
||||
.map(item => ({
|
||||
...item,
|
||||
laborName: item.laborName ? String(item.laborName).trim() : ''
|
||||
}))
|
||||
.filter(item => item.laborName);
|
||||
|
||||
const tasks = valid.map(item => {
|
||||
const data = {
|
||||
laborId: item.laborId,
|
||||
productId: currentProductId.value,
|
||||
laborName: item.laborName,
|
||||
laborPrice: item.laborPrice ?? 0
|
||||
};
|
||||
if (data.laborId) return updateProductLabor(data);
|
||||
return addProductLabor(data);
|
||||
});
|
||||
|
||||
try {
|
||||
await Promise.all(tasks);
|
||||
proxy.$modal.msgSuccess('保存成功');
|
||||
} catch (e) {
|
||||
proxy.$modal.msgError('保存失败');
|
||||
} finally {
|
||||
laborOpen.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 表格样式 */
|
||||
:deep(.el-table th) {
|
||||
background-color: #f5f7fa;
|
||||
font-weight: bold;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
:deep(.el-table tr:hover) {
|
||||
background-color: #ecf5ff;
|
||||
}
|
||||
|
||||
:deep(.el-table td) {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* 图片预览层样式 */
|
||||
:deep(.el-image-viewer__wrapper) {
|
||||
z-index: 9999 !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
<el-form-item label="厂家" prop="factory">
|
||||
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="物料类型" prop="materialType">
|
||||
<el-select v-model="queryParams.materialType" placeholder="请选择物料类型" @change="handleQuery" disabled>
|
||||
<el-option label="原料" value="2" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<!-- <el-form-item label="计量单位 个/公斤/米等" prop="unit">
|
||||
<el-input v-model="queryParams.unit" placeholder="请输入计量单位 个/公斤/米等" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
@@ -45,6 +50,11 @@
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="配料ID 主键" align="center" prop="materialId" v-if="true" /> -->
|
||||
<el-table-column label="配料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="物料类型" align="center" prop="materialType">
|
||||
<template #default="scope">
|
||||
{{ scope.row.materialType === 1 ? '辅料' : '主材' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="配料规格" align="center" prop="spec" />
|
||||
<el-table-column label="配料型号" align="center" prop="model" />
|
||||
<el-table-column label="厂家" align="center" prop="factory" />
|
||||
@@ -79,6 +89,11 @@
|
||||
<el-form-item label="配料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入配料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型" prop="materialType">
|
||||
<el-select v-model="form.materialType" placeholder="请选择物料类型" disabled>
|
||||
<el-option label="主材" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="配料规格" prop="spec">
|
||||
<el-input v-model="form.spec" placeholder="请输入配料规格" />
|
||||
</el-form-item>
|
||||
@@ -232,6 +247,7 @@ const data = reactive({
|
||||
factory: undefined,
|
||||
unit: undefined,
|
||||
currentStock: undefined,
|
||||
materialType: 2, // 固定为原料
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
@@ -260,6 +276,7 @@ function reset() {
|
||||
form.value = {
|
||||
materialId: null,
|
||||
materialName: null,
|
||||
materialType: 2, // 固定为原料
|
||||
spec: null,
|
||||
model: null,
|
||||
factory: null,
|
||||
@@ -284,6 +301,7 @@ function handleQuery() {
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
queryParams.value.materialType = 2; // 重置后仍为原料
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
<el-col :span="2.5">
|
||||
<el-button size="small" type="info" plain icon="RefreshRight" @click="handleInitDaily(true)">重置当日名单</el-button>
|
||||
</el-col>
|
||||
<el-col :span="2.5">
|
||||
<el-button size="small" type="danger" plain icon="Refresh" @click="resetCumulativeAmounts">重置累计金额</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.8">
|
||||
<el-button size="small" type="primary" plain icon="Check" @click="saveAllRows">全部保存</el-button>
|
||||
</el-col>
|
||||
@@ -72,6 +75,7 @@
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="总金额" align="center" prop="totalAmount" width="110" />
|
||||
<el-table-column label="累计金额" align="center" prop="cumulativeAmount" width="110" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="170">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Check" @click="saveRow(scope.row)">保存</el-button>
|
||||
@@ -95,6 +99,27 @@ const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const total = ref(0)
|
||||
|
||||
// 存储累计金额数据
|
||||
const cumulativeAmounts = ref({})
|
||||
|
||||
// 从localStorage加载累计金额数据
|
||||
function loadCumulativeAmounts() {
|
||||
const stored = localStorage.getItem('wageCumulativeAmounts')
|
||||
if (stored) {
|
||||
try {
|
||||
cumulativeAmounts.value = JSON.parse(stored)
|
||||
} catch (e) {
|
||||
console.error('Failed to parse cumulative amounts:', e)
|
||||
cumulativeAmounts.value = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保存累计金额数据到localStorage
|
||||
function saveCumulativeAmounts() {
|
||||
localStorage.setItem('wageCumulativeAmounts', JSON.stringify(cumulativeAmounts.value))
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
@@ -149,18 +174,43 @@ function recalcRowAmount(row) {
|
||||
const baseAmount = round2(workload * unitPrice)
|
||||
row.baseAmount = baseAmount
|
||||
row.totalAmount = round2(baseAmount + extraAmount)
|
||||
|
||||
// 重新计算累计金额
|
||||
updateCumulativeAmounts()
|
||||
}
|
||||
|
||||
function updateCumulativeAmounts() {
|
||||
// 计算当前页面的总金额
|
||||
const currentEmpAmounts = {}
|
||||
wageEntryDetailList.value.forEach(row => {
|
||||
const empName = row.empName
|
||||
if (!currentEmpAmounts[empName]) {
|
||||
currentEmpAmounts[empName] = 0
|
||||
}
|
||||
currentEmpAmounts[empName] += parseFloat(row.totalAmount) || 0
|
||||
})
|
||||
|
||||
// 更新每个员工的累计金额(基于存储的数据)
|
||||
wageEntryDetailList.value.forEach(row => {
|
||||
row.cumulativeAmount = cumulativeAmounts.value[row.empName] || 0
|
||||
})
|
||||
}
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
// 加载存储的累计金额数据
|
||||
loadCumulativeAmounts()
|
||||
|
||||
listWageEntryDetail(queryParams.value).then(response => {
|
||||
const rows = response.rows || []
|
||||
|
||||
wageEntryDetailList.value = rows.map(row => {
|
||||
const r = {
|
||||
...row,
|
||||
workload: normalizeEditableValue(row.workload),
|
||||
unitPrice: normalizeEditableValue(row.unitPrice),
|
||||
extraAmount: normalizeEditableValue(row.extraAmount)
|
||||
extraAmount: normalizeEditableValue(row.extraAmount),
|
||||
cumulativeAmount: cumulativeAmounts.value[row.empName] || 0
|
||||
}
|
||||
recalcRowAmount(r)
|
||||
return r
|
||||
@@ -202,6 +252,13 @@ function buildRowPayload(row) {
|
||||
function saveRow(row) {
|
||||
const payload = buildRowPayload(row)
|
||||
updateWageEntryDetail(payload).then(() => {
|
||||
// 更新累计金额
|
||||
if (!cumulativeAmounts.value[row.empName]) {
|
||||
cumulativeAmounts.value[row.empName] = 0
|
||||
}
|
||||
cumulativeAmounts.value[row.empName] += parseFloat(payload.totalAmount) || 0
|
||||
saveCumulativeAmounts()
|
||||
|
||||
proxy.$modal.msgSuccess('保存成功')
|
||||
getList()
|
||||
})
|
||||
@@ -219,11 +276,19 @@ async function saveAllRows() {
|
||||
const payload = buildRowPayload(row)
|
||||
try {
|
||||
await updateWageEntryDetail(payload)
|
||||
// 更新累计金额
|
||||
if (!cumulativeAmounts.value[row.empName]) {
|
||||
cumulativeAmounts.value[row.empName] = 0
|
||||
}
|
||||
cumulativeAmounts.value[row.empName] += parseFloat(payload.totalAmount) || 0
|
||||
successCount++
|
||||
} catch (e) {
|
||||
failCount++
|
||||
}
|
||||
}
|
||||
// 保存累计金额数据
|
||||
saveCumulativeAmounts()
|
||||
|
||||
loading.value = false
|
||||
if (failCount === 0) {
|
||||
proxy.$modal.msgSuccess(`全部保存完成,共 ${successCount} 条`)
|
||||
@@ -244,10 +309,20 @@ function handleDelete(row) {
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('oa/wageEntryDetail/export', {
|
||||
...queryParams.value
|
||||
...queryParams.value,
|
||||
cumulativeAmounts: cumulativeAmounts.value
|
||||
}, `wage_entry_detail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
function resetCumulativeAmounts() {
|
||||
proxy.$modal.confirm('是否确认重置所有员工的累计金额?此操作不可恢复。').then(() => {
|
||||
cumulativeAmounts.value = {}
|
||||
saveCumulativeAmounts()
|
||||
proxy.$modal.msgSuccess('累计金额已重置')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleInitDaily(forceReset = false) {
|
||||
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||
const text = forceReset ? `确认重置 ${entryDate} 的当日名单吗?将先删除后重建。` : `确认初始化 ${entryDate} 的工人名单吗?`
|
||||
@@ -260,15 +335,25 @@ function handleInitDaily(forceReset = false) {
|
||||
proxy.$modal.msgSuccess(`操作成功,共写入 ${res.data || 0} 人`)
|
||||
}
|
||||
getList()
|
||||
}).catch(err => {
|
||||
console.error('重置当日名单失败:', err)
|
||||
proxy.$modal.msgError('操作失败,请稍后重试')
|
||||
})
|
||||
}
|
||||
|
||||
async function autoInitFirstEnter() {
|
||||
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||
try {
|
||||
await initDailyWorkers({ entryDate, forceReset: false })
|
||||
} catch (err) {
|
||||
console.error('自动初始化当日名单失败:', err)
|
||||
// 静默失败,不影响页面加载
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 加载存储的累计金额数据
|
||||
loadCumulativeAmounts()
|
||||
await autoInitFirstEnter()
|
||||
getList()
|
||||
})
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
<script setup name="WageMakeup">
|
||||
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail } from '@/api/oa/wageEntryDetail'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
@@ -102,6 +103,27 @@ const open = ref(false)
|
||||
const title = ref('')
|
||||
const buttonLoading = ref(false)
|
||||
|
||||
// 存储累计金额数据
|
||||
const cumulativeAmounts = ref({})
|
||||
|
||||
// 从localStorage加载累计金额数据
|
||||
function loadCumulativeAmounts() {
|
||||
const stored = localStorage.getItem('wageCumulativeAmounts')
|
||||
if (stored) {
|
||||
try {
|
||||
cumulativeAmounts.value = JSON.parse(stored)
|
||||
} catch (e) {
|
||||
console.error('Failed to parse cumulative amounts:', e)
|
||||
cumulativeAmounts.value = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保存累计金额数据到localStorage
|
||||
function saveCumulativeAmounts() {
|
||||
localStorage.setItem('wageCumulativeAmounts', JSON.stringify(cumulativeAmounts.value))
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
@@ -197,6 +219,18 @@ function submitForm() {
|
||||
}
|
||||
// 本页面补录语义:更新当前记录并标记为已补录
|
||||
updateWageEntryDetail(payload).then(() => {
|
||||
// 更新累计金额
|
||||
const workload = parseFloat(payload.workload) || 0
|
||||
const unitPrice = parseFloat(payload.unitPrice) || 0
|
||||
const extraAmount = parseFloat(payload.extraAmount) || 0
|
||||
const totalAmount = workload * unitPrice + extraAmount
|
||||
|
||||
if (!cumulativeAmounts.value[payload.empName]) {
|
||||
cumulativeAmounts.value[payload.empName] = 0
|
||||
}
|
||||
cumulativeAmounts.value[payload.empName] += totalAmount
|
||||
saveCumulativeAmounts()
|
||||
|
||||
proxy.$modal.msgSuccess('补录成功')
|
||||
open.value = false
|
||||
getList()
|
||||
@@ -229,5 +263,8 @@ function handleExport() {
|
||||
proxy.download('oa/wageEntryDetail/export', { ...buildQuery() }, `wage_makeup_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
onMounted(() => {
|
||||
loadCumulativeAmounts()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
0
script/sql/mysql/item/ACT_EVT_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_EVT_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_GE_BYTEARRAY.sql
Normal file
0
script/sql/mysql/item/ACT_GE_BYTEARRAY.sql
Normal file
13
script/sql/mysql/item/ACT_GE_PROPERTY.sql
Normal file
13
script/sql/mysql/item/ACT_GE_PROPERTY.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('batch.schema.version', '6.7.2.3', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('cfg.execution-related-entities-count', 'true', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('cfg.task-related-entities-count', 'true', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('common.schema.version', '6.8.0.0', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('entitylink.schema.version', '6.8.0.0', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('eventsubscription.schema.version', '6.8.0.0', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('identitylink.schema.version', '6.8.0.0', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('job.schema.version', '6.8.0.0', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('next.dbid', '1', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('schema.history', 'upgrade(6.7.2.0->6.8.0.0)', 2);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('schema.version', '6.8.0.0', 2);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('task.schema.version', '6.8.0.0', 1);
|
||||
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('variable.schema.version', '6.8.0.0', 1);
|
||||
0
script/sql/mysql/item/ACT_HI_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ATTACHMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ATTACHMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_COMMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_COMMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_DETAIL.sql
Normal file
0
script/sql/mysql/item/ACT_HI_DETAIL.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_IDENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_IDENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_PROCINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_PROCINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TASKINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TASKINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TSK_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TSK_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_HI_VARINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_VARINST.sql
Normal file
0
script/sql/mysql/item/ACT_ID_BYTEARRAY.sql
Normal file
0
script/sql/mysql/item/ACT_ID_BYTEARRAY.sql
Normal file
0
script/sql/mysql/item/ACT_ID_GROUP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_GROUP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_ID_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_ID_MEMBERSHIP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_MEMBERSHIP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV_MAPPING.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV_MAPPING.sql
Normal file
1
script/sql/mysql/item/ACT_ID_PROPERTY.sql
Normal file
1
script/sql/mysql/item/ACT_ID_PROPERTY.sql
Normal file
@@ -0,0 +1 @@
|
||||
INSERT INTO `ACT_ID_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('schema.version', '6.7.2.0', 1);
|
||||
0
script/sql/mysql/item/ACT_ID_TOKEN.sql
Normal file
0
script/sql/mysql/item/ACT_ID_TOKEN.sql
Normal file
0
script/sql/mysql/item/ACT_ID_USER.sql
Normal file
0
script/sql/mysql/item/ACT_ID_USER.sql
Normal file
0
script/sql/mysql/item/ACT_PROCDEF_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_PROCDEF_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_RE_DEPLOYMENT.sql
Normal file
0
script/sql/mysql/item/ACT_RE_DEPLOYMENT.sql
Normal file
0
script/sql/mysql/item/ACT_RE_MODEL.sql
Normal file
0
script/sql/mysql/item/ACT_RE_MODEL.sql
Normal file
0
script/sql/mysql/item/ACT_RE_PROCDEF.sql
Normal file
0
script/sql/mysql/item/ACT_RE_PROCDEF.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_RU_DEADLETTER_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_DEADLETTER_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_RU_EVENT_SUBSCR.sql
Normal file
0
script/sql/mysql/item/ACT_RU_EVENT_SUBSCR.sql
Normal file
0
script/sql/mysql/item/ACT_RU_EXECUTION.sql
Normal file
0
script/sql/mysql/item/ACT_RU_EXECUTION.sql
Normal file
0
script/sql/mysql/item/ACT_RU_EXTERNAL_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_EXTERNAL_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_HISTORY_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_HISTORY_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_IDENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_RU_IDENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_RU_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_SUSPENDED_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_SUSPENDED_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_TASK.sql
Normal file
0
script/sql/mysql/item/ACT_RU_TASK.sql
Normal file
0
script/sql/mysql/item/ACT_RU_TIMER_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_TIMER_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_VARIABLE.sql
Normal file
0
script/sql/mysql/item/ACT_RU_VARIABLE.sql
Normal file
0
script/sql/mysql/item/FLW_CHANNEL_DEFINITION.sql
Normal file
0
script/sql/mysql/item/FLW_CHANNEL_DEFINITION.sql
Normal file
0
script/sql/mysql/item/FLW_EVENT_DEFINITION.sql
Normal file
0
script/sql/mysql/item/FLW_EVENT_DEFINITION.sql
Normal file
0
script/sql/mysql/item/FLW_EVENT_DEPLOYMENT.sql
Normal file
0
script/sql/mysql/item/FLW_EVENT_DEPLOYMENT.sql
Normal file
0
script/sql/mysql/item/FLW_EVENT_RESOURCE.sql
Normal file
0
script/sql/mysql/item/FLW_EVENT_RESOURCE.sql
Normal file
3
script/sql/mysql/item/FLW_EV_DATABASECHANGELOG.sql
Normal file
3
script/sql/mysql/item/FLW_EV_DATABASECHANGELOG.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
INSERT INTO `FLW_EV_DATABASECHANGELOG` (`ID`, `AUTHOR`, `FILENAME`, `DATEEXECUTED`, `ORDEREXECUTED`, `EXECTYPE`, `MD5SUM`, `DESCRIPTION`, `COMMENTS`, `TAG`, `LIQUIBASE`, `CONTEXTS`, `LABELS`, `DEPLOYMENT_ID`) VALUES ('1', 'flowable', 'org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml', '2022-03-12 08:37:27', 1, 'EXECUTED', '8:1b0c48c9cf7945be799d868a2626d687', 'createTable tableName=FLW_EVENT_DEPLOYMENT; createTable tableName=FLW_EVENT_RESOURCE; createTable tableName=FLW_EVENT_DEFINITION; createIndex indexName=ACT_IDX_EVENT_DEF_UNIQ, tableName=FLW_EVENT_DEFINITION; createTable tableName=FLW_CHANNEL_DEFIN...', '', NULL, '4.5.0', NULL, NULL, '7074247706');
|
||||
INSERT INTO `FLW_EV_DATABASECHANGELOG` (`ID`, `AUTHOR`, `FILENAME`, `DATEEXECUTED`, `ORDEREXECUTED`, `EXECTYPE`, `MD5SUM`, `DESCRIPTION`, `COMMENTS`, `TAG`, `LIQUIBASE`, `CONTEXTS`, `LABELS`, `DEPLOYMENT_ID`) VALUES ('2', 'flowable', 'org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml', '2022-03-12 08:37:28', 2, 'EXECUTED', '8:0ea825feb8e470558f0b5754352b9cda', 'addColumn tableName=FLW_CHANNEL_DEFINITION; addColumn tableName=FLW_CHANNEL_DEFINITION', '', NULL, '4.5.0', NULL, NULL, '7074247706');
|
||||
INSERT INTO `FLW_EV_DATABASECHANGELOG` (`ID`, `AUTHOR`, `FILENAME`, `DATEEXECUTED`, `ORDEREXECUTED`, `EXECTYPE`, `MD5SUM`, `DESCRIPTION`, `COMMENTS`, `TAG`, `LIQUIBASE`, `CONTEXTS`, `LABELS`, `DEPLOYMENT_ID`) VALUES ('3', 'flowable', 'org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml', '2022-03-12 08:37:28', 3, 'EXECUTED', '8:3c2bb293350b5cbe6504331980c9dcee', 'customChange', '', NULL, '4.5.0', NULL, NULL, '7074247706');
|
||||
1
script/sql/mysql/item/FLW_EV_DATABASECHANGELOGLOCK.sql
Normal file
1
script/sql/mysql/item/FLW_EV_DATABASECHANGELOGLOCK.sql
Normal file
@@ -0,0 +1 @@
|
||||
INSERT INTO `FLW_EV_DATABASECHANGELOGLOCK` (`ID`, `LOCKED`, `LOCKGRANTED`, `LOCKEDBY`) VALUES (1, b'0', NULL, NULL);
|
||||
0
script/sql/mysql/item/FLW_RU_BATCH.sql
Normal file
0
script/sql/mysql/item/FLW_RU_BATCH.sql
Normal file
0
script/sql/mysql/item/FLW_RU_BATCH_PART.sql
Normal file
0
script/sql/mysql/item/FLW_RU_BATCH_PART.sql
Normal file
2
script/sql/mysql/item/dv_check_machinery.sql
Normal file
2
script/sql/mysql/item/dv_check_machinery.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
INSERT INTO `dv_check_machinery` (`record_id`, `plan_id`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (203, 207, 214, 'M0046', 'WG-A1型纺织机', '万国', 'WG-A1', '', NULL, NULL, 0, 0, '', '2022-09-01 23:01:54', '', NULL);
|
||||
INSERT INTO `dv_check_machinery` (`record_id`, `plan_id`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (204, 208, 214, 'M0046', 'WG-A1型纺织机', '万国', 'WG-A1', '', NULL, NULL, 0, 0, '', '2022-09-01 23:02:52', '', NULL);
|
||||
2
script/sql/mysql/item/dv_check_plan.sql
Normal file
2
script/sql/mysql/item/dv_check_plan.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
INSERT INTO `dv_check_plan` (`plan_id`, `plan_code`, `plan_name`, `plan_type`, `start_date`, `end_date`, `cycle_type`, `cycle_count`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (207, 'PLAN2022048', '1', 'CHECK', NULL, NULL, 'DAY', 1, 'FINISHED', '', NULL, NULL, 0, 0, '', '2022-09-01 23:01:41', '', '2025-08-07 11:58:02');
|
||||
INSERT INTO `dv_check_plan` (`plan_id`, `plan_code`, `plan_name`, `plan_type`, `start_date`, `end_date`, `cycle_type`, `cycle_count`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (208, 'PLAN2022050', '2', 'MAINTEN', '2025-04-09 00:00:00', '2025-04-29 00:00:00', 'WEEK', 4, 'PREPARE', '', NULL, NULL, 0, 0, '', '2022-09-01 23:02:44', '', '2025-08-07 20:07:20');
|
||||
6
script/sql/mysql/item/dv_check_record.sql
Normal file
6
script/sql/mysql/item/dv_check_record.sql
Normal file
@@ -0,0 +1,6 @@
|
||||
INSERT INTO `dv_check_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `check_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (201, 207, 'PLAN2022048', '1', 'CHECK', 213, 'M0036', '测试人员', '1', '12', '2024-12-26 00:00:00', NULL, NULL, NULL, 'FINISHED', '', NULL, NULL, 0, 0, '', '2024-12-26 16:14:18', '', '2024-12-26 16:23:24');
|
||||
INSERT INTO `dv_check_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `check_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (202, 207, 'PLAN2022048', '1', 'CHECK', 212, 'M0024', 'QQQQQ', 'QW', 'Q1001', '2024-12-26 18:18:20', NULL, NULL, NULL, 'PREPARE', '', NULL, NULL, 0, 0, '', '2024-12-26 18:18:25', '', NULL);
|
||||
INSERT INTO `dv_check_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `check_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (203, 207, 'PLAN2022048', '1', 'CHECK', 212, 'M0024', 'QQQQQ', 'QW', 'Q1001', '2024-12-26 18:36:46', NULL, NULL, NULL, 'PREPARE', '', NULL, NULL, 0, 0, '', '2024-12-26 18:36:54', '', NULL);
|
||||
INSERT INTO `dv_check_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `check_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (204, 207, 'PLAN2022048', '1', 'CHECK', 212, 'M0024', 'QQQQQ', 'QW', 'Q1001', '2024-12-26 18:37:49', NULL, NULL, NULL, 'PREPARE', '', NULL, NULL, 0, 0, '', '2024-12-26 18:38:01', '', '2024-12-27 15:16:53');
|
||||
INSERT INTO `dv_check_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `check_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (205, 207, 'PLAN2022048', '1', 'CHECK', 212, 'M0024', 'QQQQQ', 'QW', 'Q1001', '2024-12-26 18:47:05', 100, 'test', '测试员', 'PREPARE', '', NULL, NULL, 0, 0, '', '2024-12-26 18:47:27', '', NULL);
|
||||
INSERT INTO `dv_check_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `check_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (212, 207, 'PLAN2022048', '1', 'CHECK', 214, 'M0046', 'WG-A1型纺织机', '万国', 'WG-A1', '2025-04-30 17:22:13', 1947580187189002242, 'neko', 'neko', 'PREPARE', '', NULL, NULL, 0, 0, '', '2025-04-30 17:22:19', '', '2025-08-07 13:10:29');
|
||||
4
script/sql/mysql/item/dv_check_record_line.sql
Normal file
4
script/sql/mysql/item/dv_check_record_line.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
INSERT INTO `dv_check_record_line` (`line_id`, `record_id`, `subject_id`, `subject_code`, `subject_name`, `subject_type`, `subject_content`, `subject_standard`, `check_status`, `check_result`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (204, 205, 202, 'SUB039', '123', 'CHECK', '123', '123', 'Y', NULL, NULL, NULL, 0, 0, '', '2024-12-27 15:17:04', '', NULL);
|
||||
INSERT INTO `dv_check_record_line` (`line_id`, `record_id`, `subject_id`, `subject_code`, `subject_name`, `subject_type`, `subject_content`, `subject_standard`, `check_status`, `check_result`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (212, 212, 202, 'SUB039', '123', 'CHECK', '123', '123', 'Y', NULL, NULL, NULL, 0, 0, '', '2025-08-07 13:14:43', '', NULL);
|
||||
INSERT INTO `dv_check_record_line` (`line_id`, `record_id`, `subject_id`, `subject_code`, `subject_name`, `subject_type`, `subject_content`, `subject_standard`, `check_status`, `check_result`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (213, 212, 202, 'SUB039', '123', 'CHECK', '123', '123', 'Y', NULL, NULL, NULL, 0, 0, '', '2025-08-07 17:54:14', '', NULL);
|
||||
INSERT INTO `dv_check_record_line` (`line_id`, `record_id`, `subject_id`, `subject_code`, `subject_name`, `subject_type`, `subject_content`, `subject_standard`, `check_status`, `check_result`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (214, 212, 202, 'SUB039', '123', 'CHECK', '123', '123', 'N', NULL, NULL, NULL, 0, 0, '', '2025-08-07 17:54:26', '', NULL);
|
||||
3
script/sql/mysql/item/dv_check_subject.sql
Normal file
3
script/sql/mysql/item/dv_check_subject.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
INSERT INTO `dv_check_subject` (`record_id`, `plan_id`, `subject_id`, `subject_code`, `subject_name`, `subject_type`, `subject_content`, `subject_standard`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, 207, 202, 'SUB039', '123', 'CHECK', '123', '123', '', NULL, NULL, 0, 0, '', '2024-12-26 16:03:48', '', NULL);
|
||||
INSERT INTO `dv_check_subject` (`record_id`, `plan_id`, `subject_id`, `subject_code`, `subject_name`, `subject_type`, `subject_content`, `subject_standard`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (2, 207, 203, 'SUB049', '点检项目2', 'CHECK', '液压是否正常', NULL, '', NULL, NULL, 0, 0, '', '2024-12-26 16:03:48', '', NULL);
|
||||
INSERT INTO `dv_check_subject` (`record_id`, `plan_id`, `subject_id`, `subject_code`, `subject_name`, `subject_type`, `subject_content`, `subject_standard`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (4, 208, 202, 'SUB039', '123', 'CHECK', '123', '123', '', NULL, NULL, 0, 0, '', '2025-08-07 11:55:04', '', NULL);
|
||||
4
script/sql/mysql/item/dv_machinery.sql
Normal file
4
script/sql/mysql/item/dv_machinery.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
INSERT INTO `dv_machinery` (`machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `workshop_id`, `workshop_code`, `workshop_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`, `last_mainten_time`, `last_check_time`) VALUES (212, 'M0024', 'QQQQ', 'QW', 'Q1001', 202, NULL, NULL, 213, 'WS079', '组装车间', 'REPAIR', 'QQ', NULL, NULL, 0, 0, '', '2022-08-18 11:01:42', '', '2025-08-07 11:22:18', NULL, NULL);
|
||||
INSERT INTO `dv_machinery` (`machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `workshop_id`, `workshop_code`, `workshop_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`, `last_mainten_time`, `last_check_time`) VALUES (213, 'M0036', '测试人员', '1', '12', 213, NULL, NULL, 213, 'WS079', '组装车间', 'STOP', '123', NULL, NULL, 0, 0, '', '2022-08-19 14:36:15', '', '2025-05-16 14:09:23', NULL, NULL);
|
||||
INSERT INTO `dv_machinery` (`machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `workshop_id`, `workshop_code`, `workshop_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`, `last_mainten_time`, `last_check_time`) VALUES (214, 'M0046', 'WG-A1型纺织机', '万国', 'WG-A1', 214, NULL, NULL, 209, NULL, NULL, 'STOP', '', NULL, NULL, 0, 0, '', '2022-08-21 19:42:53', '', NULL, NULL, NULL);
|
||||
INSERT INTO `dv_machinery` (`machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `workshop_id`, `workshop_code`, `workshop_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`, `last_mainten_time`, `last_check_time`) VALUES (215, 'M0047', 'uytuyu', 'tyu', 'utu', 204, NULL, NULL, 200, NULL, NULL, 'STOP', '', NULL, NULL, 0, 0, '', '2022-08-22 09:48:52', '', NULL, NULL, NULL);
|
||||
19
script/sql/mysql/item/dv_machinery_type.sql
Normal file
19
script/sql/mysql/item/dv_machinery_type.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (1, 'M_TYPE_000', '设备分类', 0, '0', 'Y', '', NULL, NULL, 0, 0, 'admin', '2022-05-08 19:26:57', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (200, 'M_TYPE_002', '注塑机', 210, '0,1', 'Y', '这个是一种类型的裁剪机', NULL, NULL, 0, 0, '', '2022-05-08 19:50:41', '', '2022-08-22 09:47:02');
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (201, 'M_TYPE_003', '组装机', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-08 19:50:57', '', '2025-07-25 14:01:56');
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (202, 'M_TYPE_004', '大型注塑机', 200, '0,1,200', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-08 19:51:10', '', '2022-05-14 13:39:51');
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (203, 'M_TYPE_005', '大型组装机', 201, '0,1,201', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-08 19:51:25', '', '2022-07-17 12:19:14');
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (204, 'M_TYPE_006', '包装机', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-14 13:40:03', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (205, 'M_TYPE_007', '清洗类', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-14 13:43:59', '', '2022-05-14 13:44:11');
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (206, 'M_TYPE_008', '喷砂机', 205, '0,1,205', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-14 13:44:23', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (207, 'M_TYPE_009', '清洗机', 205, '0,1,205', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-14 13:44:33', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (208, 'M_TYPE_010', '检测类', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-14 13:49:13', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (209, 'M_TYPE_011', 'CCD检测台', 208, '0,1,208', 'Y', '', NULL, NULL, 0, 0, '', '2022-05-14 13:49:25', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (210, 'M_TYPE_015', '臂架焊机', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-08-17 15:32:56', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (211, 'M_TYPE_016', '华远焊机', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-08-17 15:33:16', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (212, 'M_TYPE_017', '麦格米特焊机', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-08-17 15:33:24', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (213, 'M_TYPE_018', '测试类', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-08-19 14:35:27', '', '2022-08-19 14:35:45');
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (214, 'M_TYPE_021', '纺织机', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2022-08-21 19:03:44', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (215, 'MT-CE80374768A6', '1', 1, '0,1', 'Y', '', NULL, NULL, 0, 0, '', '2025-08-06 23:18:59', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (216, 'MT-3BF121D84891', '2', 215, '0,1,215', 'Y', '', NULL, NULL, 0, 0, '', '2025-08-06 23:21:33', '', NULL);
|
||||
INSERT INTO `dv_machinery_type` (`machinery_type_id`, `machinery_type_code`, `machinery_type_name`, `parent_type_id`, `ancestors`, `enable_flag`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (217, 'MT-BF779FBC7492', '设备1', 0, '0', 'Y', '1111', NULL, NULL, 0, 0, '', '2025-09-24 15:01:48', '', NULL);
|
||||
4
script/sql/mysql/item/dv_mainten_record.sql
Normal file
4
script/sql/mysql/item/dv_mainten_record.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
INSERT INTO `dv_mainten_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `mainten_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (200, NULL, NULL, NULL, NULL, 212, 'M0024', 'QQQQQ', 'QW', 'Q1001', '2024-12-26 00:00:00', 1, 'admin', '若依', 'FINISHED', '', NULL, NULL, 0, 0, '', '2024-12-26 19:20:14', '', '2024-12-26 19:23:12');
|
||||
INSERT INTO `dv_mainten_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `mainten_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (201, NULL, NULL, '', NULL, 212, 'M0024', 'QQQQQ', 'QW', 'Q1001', '2025-07-10 00:00:00', NULL, 'admin', NULL, 'FINISHED', '', NULL, NULL, 0, 0, '', '2025-07-25 14:03:57', '', '2025-07-25 14:04:02');
|
||||
INSERT INTO `dv_mainten_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `mainten_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (202, NULL, NULL, NULL, NULL, 212, 'M0024', 'QQQQQ', 'QW', 'Q1001', '2025-06-29 00:00:00', NULL, 'admin', NULL, 'PREPARE', '', NULL, NULL, 0, 0, '', '2025-07-25 14:04:24', '', '2025-07-25 14:05:24');
|
||||
INSERT INTO `dv_mainten_record` (`record_id`, `plan_id`, `plan_code`, `plan_name`, `plan_type`, `machinery_id`, `machinery_code`, `machinery_name`, `machinery_brand`, `machinery_spec`, `mainten_time`, `user_id`, `user_name`, `nick_name`, `status`, `remark`, `attr1`, `attr2`, `attr3`, `attr4`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (204, NULL, NULL, NULL, NULL, 215, 'M0047', 'uytuyu', 'tyu', 'utu', '2025-08-12 00:00:00', 1947579932234039297, 'xinlei', 'xinlei', 'PREPARE', '', NULL, NULL, 0, 0, '', '2025-08-07 13:26:08', '', NULL);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user