Compare commits

...

17 Commits

Author SHA1 Message Date
朱昊天
3d386ff650 产品最终版,薪资优化 2026-04-30 17:06:47 +08:00
朱昊天
fe13e952f2 明细计算,产品详情页 2026-04-28 16:53:35 +08:00
539889a346 完善全局样式 2026-04-28 16:52:22 +08:00
6eca9768cc text按钮误伤了 2026-04-28 15:49:29 +08:00
6d9f24bfd4 修改全局样式(工业风,提交工业风skill 2026-04-28 15:37:17 +08:00
朱昊天
1ce1ffad5a 工人热更新(js),初版详情页 2026-04-27 10:40:56 +08:00
朱昊天
1fe6e030d4 Merge remote-tracking branch 'origin/master' 2026-04-27 10:14:03 +08:00
朱昊天
96a1f9f9bc 工人热更新 2026-04-27 10:09:33 +08:00
2099a01bc1 设计文档简化状态机 2026-04-23 10:42:05 +08:00
d5c1c1485c 设计文档简化状态机 2026-04-23 10:26:36 +08:00
2aa0ae83c2 设计文档完善状态机 2026-04-23 10:22:08 +08:00
774fe86941 提交sql 2026-04-23 10:15:22 +08:00
朱昊天
d02ef34751 辅材修正,详情页迭代,产品图片加载 2026-04-22 18:33:04 +08:00
朱昊天
2e7a50bf64 月工资计算,产品详情页补充 2026-04-20 18:47:36 +08:00
朱昊天
3ae6403bd3 Merge remote-tracking branch 'origin/master' 2026-04-17 16:59:27 +08:00
朱昊天
855dbbe099 增加辅料字段,辅料页面 2026-04-17 16:58:29 +08:00
f41a17c885 config(application): 配置文件中添加环境变量占位符
- 将application.yml中的active profile配置改为@profiles.active@占位符
- 支持通过外部配置动态设置激活的环境profile
- 便于不同部署环境下的配置管理
2026-04-17 15:52:18 +08:00
193 changed files with 12345 additions and 404 deletions

View File

@@ -0,0 +1,194 @@
---
name: ruoyi-industrial-dashboard-style
description: Recreate the industrial dashboard style from `ruoyi-ui/src/views/index.vue` and apply it consistently across the UI, especially buttons, inputs, tables, cards, tags, and other Element-UI components. Use when the user asks for an industrial monitoring layout, blue-themed controls, or a RuoYi UI style based on `ruoyi-ui/src/views/index.vue`.
---
# RuoYi Industrial Dashboard Style
## Goal
Produce UI that matches the look and feel of `ruoyi-ui/src/views/index.vue` and extends it into the global component system:
- Compact, information-dense layout
- Industrial control-room aesthetic
- Dark top status bar
- White cards with subtle borders and soft shadows
- Small typography and tight spacing
- Strong blue accents across all controls, not green
- Table-first monitoring views with status badges and communication indicators
## Core color direction
- Primary actions, links, active states, and focused controls should use blue shades.
- Use deep navy and steel blue as the main palette.
- Avoid default Element-UI green success styling unless the semantics truly require success.
- Reserve red for alarms, orange for warnings, and gray for neutral states.
- Buttons, tags, table headers, and form focus states should visually align with the blue industrial palette.
## Design rules
### Overall layout
- Use a light gray page background.
- Keep padding and gaps tight.
- Prefer multiple horizontal sections over tall stacked blocks.
- Treat each section as a bordered card with a small header.
### Top status bar
- Use a full-width dark header strip.
- Left side should show system name, divider, and unit tag.
- Right side should show online/offline state and a live clock.
- Keep the bar compact, stable, and highly legible.
### KPI cards
- Use white cards with a small colored icon block.
- Show a large numeric value and a smaller label.
- Keep card height short and consistent.
- Prefer blue for normal metrics, orange for in-progress, red for warnings.
### Equipment or station cards
- Use a dark card header with the equipment name and runtime badge.
- Use a grid for dense parameter display.
- Display values in monospace or tabular-style text where possible.
- Add a slim footer with current coil/order, grade, shift, or similar operational context.
### Tables
- Prefer compact tables with borders and stripes.
- Use small button sizes and small tags.
- Keep column widths tight and practical.
- Use status text and colors to show workflow state.
### Communication or alarm indicators
- Use small dots, compact labels, and timestamps.
- Use blue for healthy connections.
- Use red and subtle blinking for alarms or disconnects.
## Visual tokens
Use these as the default visual language unless the user asks otherwise:
- Background: `#f0f2f5`
- Card border: `#dde1e6`
- Primary dark: `#1c2b3a`
- Primary blue: `#1d4e89`
- Secondary blue: `#2471a3`
- Warning orange: `#d68910`
- Danger red: `#c0392b`
- Muted text: `#7f8c8d`
- Soft shadow: `0 1px 4px rgba(0,0,0,.05)`
## Typography and spacing
- Use 11?C13px text for most labels and chrome.
- Use bold, larger numeric values for KPIs.
- Keep corner radii small, around 2?C4px.
- Use subtle dividers and minimal decoration.
## SCSS conventions
- Prefer scoped SCSS.
- Use BEM-style nested blocks like `card__header`, `card__body`, `card__footer`.
- Keep component styles compact and local.
- Use monospace for clocks and numeric readings when appropriate.
## When implementing a new screen
1. Start with the overall page shell and background.
2. Add the dark status bar.
3. Add KPI cards in a tight grid.
4. Add one or more dense equipment/status panels.
5. Add a compact table or communication panel.
6. Apply the color, spacing, border, and blue-control rules above.
## Example prompt behavior
If the user says they like the style from `ruoyi-ui/src/views/index.vue`, interpret that as a request to reuse this exact industrial dashboard language in new pages, components, or screens.
## Design rules
### Overall layout
- Use a light gray page background.
- Keep padding and gaps tight.
- Prefer multiple horizontal sections over tall stacked blocks.
- Treat each section as a bordered card with a small header.
### Top status bar
- Use a full-width dark header strip.
- Left side should show system name, divider, and unit tag.
- Right side should show online/offline state and a live clock.
- Keep the bar compact, stable, and highly legible.
### KPI cards
- Use white cards with a small colored icon block.
- Show a large numeric value and a smaller label.
- Keep card height short and consistent.
- Prefer blue for normal metrics, orange for in-progress, red for warnings.
### Equipment or station cards
- Use a dark card header with the equipment name and runtime badge.
- Use a grid for dense parameter display.
- Display values in monospace or tabular-style text where possible.
- Add a slim footer with current coil/order, grade, shift, or similar operational context.
### Tables
- Prefer compact tables with borders and stripes.
- Use small button sizes and small tags.
- Keep column widths tight and practical.
- Use status text and colors to show workflow state.
### Communication or alarm indicators
- Use small dots, compact labels, and timestamps.
- Use blue for healthy connections.
- Use red and subtle blinking for alarms or disconnects.
## Visual tokens
Use these as the default visual language unless the user asks otherwise:
- Background: `#f0f2f5`
- Card border: `#dde1e6`
- Primary dark: `#1c2b3a`
- Primary blue: `#1d4e89`
- Secondary blue: `#2471a3`
- Warning orange: `#d68910`
- Danger red: `#c0392b`
- Muted text: `#7f8c8d`
- Soft shadow: `0 1px 4px rgba(0,0,0,.05)`
## Typography and spacing
- Use 11?C13px text for most labels and chrome.
- Use bold, larger numeric values for KPIs.
- Keep corner radii small, around 2?C4px.
- Use subtle dividers and minimal decoration.
## SCSS conventions
- Prefer scoped SCSS.
- Use BEM-style nested blocks like `card__header`, `card__body`, `card__footer`.
- Keep component styles compact and local.
- Use monospace for clocks and numeric readings when appropriate.
## When implementing a new screen
1. Start with the overall page shell and background.
2. Add the dark status bar.
3. Add KPI cards in a tight grid.
4. Add one or more dense equipment/status panels.
5. Add a compact table or communication panel.
6. Apply the color, spacing, and border rules above.
## Example prompt behavior
If the user says they like the style from `ruoyi-ui/src/views/index.vue`, interpret that as a request to reuse this exact industrial dashboard language in new pages, components, or screens.

View File

@@ -105,13 +105,13 @@ spring:
spring:
redis:
# 地址
host: localhost
host: 49.232.154.205
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码(如没有密码请注释掉)
# password:
password: WANGyu11!
# 连接超时时间
timeout: 10s
# 是否开启ssl
@@ -128,7 +128,7 @@ redisson:
singleServerConfig:
# 客户端名称
clientName: ${ruoyi.name}
# 最小空闲连接数
# 最小空闲连接数ACT_ID_PROPERTY
connectionMinimumIdleSize: 32
# 连接池大小
connectionPoolSize: 64

View File

@@ -71,6 +71,7 @@ spring:
basename: i18n/messages
profiles:
active: prod
# @profiles.active@
# 文件上传
servlet:
multipart:

View File

@@ -0,0 +1,94 @@
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 lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
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);
}
@PostMapping("/listByProductIds")
public R<Map<Long, List<MatProductAdditionVo>>> listByProductIds(@RequestBody List<Long> productIds) {
return R.ok(productAdditionService.listByProductIds(productIds));
}
/**
* 新增产品属性附加表
*/
@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);
}
@Log(title = "产品属性附加表", businessType = BusinessType.UPDATE)
@PostMapping("/batchSave")
public R<Boolean> batchSave(@RequestBody BatchSaveRequest payload) {
if (payload == null) {
return R.ok(false);
}
return R.ok(productAdditionService.batchSaveProductAddition(payload.getProductId(), payload.getItems()));
}
@Data
public static class BatchSaveRequest {
private Long productId;
private List<MatProductAdditionBo> items;
}
}

View File

@@ -23,8 +23,13 @@ import com.gear.common.utils.poi.ExcelUtil;
import com.gear.mat.domain.vo.MatProductVo;
import com.gear.mat.domain.vo.MatProductWithMaterialsVo;
import com.gear.mat.domain.bo.MatProductBo;
import com.gear.mat.domain.bo.MatProductImportBo;
import com.gear.mat.service.IMatProductService;
import com.gear.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream;
import java.util.Collections;
/**
* 产品基础信息
@@ -48,6 +53,14 @@ public class MatProductController extends BaseController {
return iMatProductService.queryPageListWithMaterials(bo, pageQuery);
}
/**
* 查询产品基础信息列表(不包含配料信息,用于列表页加速)
*/
@GetMapping("/listBase")
public TableDataInfo<MatProductVo> listBase(MatProductBo bo, PageQuery pageQuery) {
return iMatProductService.queryPageList(bo, pageQuery);
}
/**
* 导出产品基础信息列表
*/
@@ -58,6 +71,25 @@ public class MatProductController extends BaseController {
ExcelUtil.exportExcel(list, "产品基础信息", MatProductVo.class, response);
}
@RequestMapping(value = "/importTemplate", method = {RequestMethod.GET, RequestMethod.POST})
public void importTemplate(HttpServletResponse response) {
ExcelUtil.exportExcel(Collections.singletonList(new MatProductImportBo()), "产品导入模板", MatProductImportBo.class, response);
}
@Log(title = "产品基础信息", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public R<String> importData(@RequestPart("file") MultipartFile file,
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
if (file == null || file.isEmpty()) {
return R.fail("导入文件不能为空");
}
try (InputStream is = file.getInputStream()) {
List<MatProductImportBo> list = ExcelUtil.importExcel(is, MatProductImportBo.class);
String msg = iMatProductService.importByExcel(list, updateSupport);
return R.ok(msg);
}
}
/**
* 获取产品基础信息详细信息
*

View File

@@ -0,0 +1,65 @@
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 lombok.Data;
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);
}
@Log(title = "产品手动工价", businessType = BusinessType.UPDATE)
@PostMapping("/batchSave")
public R<Boolean> batchSave(@RequestBody BatchSaveRequest payload) {
if (payload == null) {
return R.ok(false);
}
return R.ok(productLaborService.batchSaveProductLabor(payload.getProductId(), payload.getItems()));
}
@Data
public static class BatchSaveRequest {
private Long productId;
private List<MatProductLaborBo> items;
}
}

View File

@@ -32,6 +32,10 @@ public class MatMaterial extends BaseEntity {
* 配料名称
*/
private String materialName;
/**
* 物料类型1=辅料2=原料
*/
private Integer materialType;
/**
* 配料规格
*/

View File

@@ -54,4 +54,14 @@ public class MatProduct extends BaseEntity {
*/
private String remark;
/**
* 产品图片,多个图片以逗号分隔
*/
private String productImages;
/**
* 产品说明书多个PDF以逗号分隔
*/
private String productPdfs;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -32,6 +32,11 @@ public class MatMaterialBo extends BaseEntity {
*/
private String materialName;
/**
* 物料类型1=辅料2=原料
*/
private Integer materialType;
/**
* 配料规格
*/

View File

@@ -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;
}

View File

@@ -52,5 +52,14 @@ public class MatProductBo extends BaseEntity {
*/
private String remark;
/**
* 产品图片,多个图片以逗号分隔
*/
private String productImages;
/**
* 产品说明书多个PDF以逗号分隔
*/
private String productPdfs;
}

View File

@@ -0,0 +1,30 @@
package com.gear.mat.domain.bo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 产品导入模板对象
*/
@Data
@ExcelIgnoreUnannotated
public class MatProductImportBo {
@ExcelProperty("产品名称")
private String productName;
@ExcelProperty("产品规格")
private String spec;
@ExcelProperty("产品型号")
private String model;
@ExcelProperty("产品单价")
private BigDecimal unitPrice;
@ExcelProperty("备注")
private String remark;
}

View File

@@ -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;
}

View File

@@ -34,6 +34,12 @@ public class MatMaterialVo {
@ExcelProperty(value = "配料名称")
private String materialName;
/**
* 物料类型1=辅料2=原料
*/
@ExcelProperty(value = "物料类型")
private Integer materialType;
/**
* 配料规格
*/
@@ -65,6 +71,11 @@ public class MatMaterialVo {
@ExcelDictFormat(readConverterExp = "已=入库")
private BigDecimal currentStock;
/**
* 单价(用于成本测算:默认取最新入库单价,其次取最新采购单价)
*/
private BigDecimal unitPrice;
/**
* 备注
*/

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -58,5 +58,17 @@ public class MatProductVo {
@ExcelProperty(value = "备注")
private String remark;
/**
* 产品图片,多个图片以逗号分隔
*/
@ExcelProperty(value = "产品图片")
private String productImages;
/**
* 产品说明书多个PDF以逗号分隔
*/
@ExcelProperty(value = "产品说明书")
private String productPdfs;
}

View File

@@ -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;
/**
* 关联的配料信息列表
*/

View File

@@ -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> {
}

View File

@@ -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> {
}

View File

@@ -0,0 +1,52 @@
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.Map;
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);
boolean batchSaveProductAddition(Long productId, List<MatProductAdditionBo> items);
Map<Long, List<MatProductAdditionVo>> listByProductIds(List<Long> productIds);
}

View File

@@ -0,0 +1,21 @@
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);
boolean batchSaveProductLabor(Long productId, List<MatProductLaborBo> items);
}

View File

@@ -1,6 +1,7 @@
package com.gear.mat.service;
import com.gear.mat.domain.MatProduct;
import com.gear.mat.domain.bo.MatProductImportBo;
import com.gear.mat.domain.vo.MatProductVo;
import com.gear.mat.domain.vo.MatProductWithMaterialsVo;
import com.gear.mat.domain.bo.MatProductBo;
@@ -52,4 +53,9 @@ public interface IMatProductService {
* 校验并批量删除产品基础信息信息
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
/**
* Excel导入产品基础信息
*/
String importByExcel(List<MatProductImportBo> list, Boolean updateSupport);
}

View File

@@ -49,7 +49,41 @@ public class MatMaterialServiceImpl implements IMatMaterialService {
*/
@Override
public MatMaterialVo queryById(Long materialId){
return baseMapper.selectVoById(materialId);
MatMaterialVo vo = baseMapper.selectVoById(materialId);
if (vo == null) {
return null;
}
vo.setUnitPrice(resolveUnitPrice(materialId));
return vo;
}
private BigDecimal resolveUnitPrice(Long materialId) {
QueryWrapper<MatPurchaseInDetail> inDetailQw = new QueryWrapper<>();
inDetailQw.eq("material_id", materialId);
inDetailQw.eq("del_flag", 0);
inDetailQw.isNotNull("in_price");
inDetailQw.orderByDesc("in_time");
inDetailQw.orderByDesc("create_time");
inDetailQw.last("LIMIT 1");
MatPurchaseInDetail latestInDetail = matPurchaseInDetailMapper.selectOne(inDetailQw);
if (latestInDetail != null && latestInDetail.getInPrice() != null) {
return latestInDetail.getInPrice();
}
QueryWrapper<MatPurchase> purchaseQw = new QueryWrapper<>();
purchaseQw.eq("material_id", materialId);
purchaseQw.eq("del_flag", 0);
purchaseQw.ne("status", 3);
purchaseQw.isNotNull("purchase_price");
purchaseQw.orderByDesc("update_time");
purchaseQw.orderByDesc("create_time");
purchaseQw.last("LIMIT 1");
MatPurchase latestPurchase = matPurchaseMapper.selectOne(purchaseQw);
if (latestPurchase != null && latestPurchase.getPurchasePrice() != null) {
return latestPurchase.getPurchasePrice();
}
return null;
}
/**
@@ -75,6 +109,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());

View File

@@ -0,0 +1,133 @@
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 org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 产品属性附加表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);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean batchSaveProductAddition(Long productId, List<MatProductAdditionBo> items) {
if (productId == null) {
return false;
}
List<MatProductAddition> exist = baseMapper.selectList(new LambdaQueryWrapper<MatProductAddition>()
.select(MatProductAddition::getAddId)
.eq(MatProductAddition::getProductId, productId)
.eq(MatProductAddition::getDelFlag, 0));
Set<Long> existIds = exist.stream()
.map(MatProductAddition::getAddId)
.filter(id -> id != null && id > 0)
.collect(Collectors.toSet());
Set<Long> incomingIds = items == null ? java.util.Collections.emptySet() : items.stream()
.map(MatProductAdditionBo::getAddId)
.filter(id -> id != null && id > 0)
.collect(Collectors.toSet());
List<Long> deleteIds = existIds.stream()
.filter(id -> !incomingIds.contains(id))
.collect(Collectors.toList());
if (!deleteIds.isEmpty()) {
removeByIds(deleteIds);
}
if (items == null || items.isEmpty()) {
return true;
}
for (MatProductAdditionBo item : items) {
if (item == null) {
continue;
}
MatProductAddition addition = BeanCopyUtils.copy(item, MatProductAddition.class);
if (addition == null) {
continue;
}
addition.setProductId(productId);
if (addition.getAddId() == null) {
save(addition);
} else {
updateById(addition);
}
}
return true;
}
@Override
public Map<Long, List<MatProductAdditionVo>> listByProductIds(List<Long> productIds) {
if (productIds == null || productIds.isEmpty()) {
return Collections.emptyMap();
}
List<MatProductAddition> list = baseMapper.selectList(new LambdaQueryWrapper<MatProductAddition>()
.in(MatProductAddition::getProductId, productIds)
.eq(MatProductAddition::getDelFlag, 0)
.orderByAsc(MatProductAddition::getProductId)
.orderByAsc(MatProductAddition::getAddId));
Map<Long, List<MatProductAdditionVo>> result = new HashMap<>();
for (MatProductAddition item : list) {
if (item == null || item.getProductId() == null) {
continue;
}
MatProductAdditionVo vo = BeanCopyUtils.copy(item, MatProductAdditionVo.class);
result.computeIfAbsent(item.getProductId(), k -> new java.util.ArrayList<>()).add(vo);
}
return result;
}
}

View File

@@ -0,0 +1,99 @@
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 org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@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);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean batchSaveProductLabor(Long productId, List<MatProductLaborBo> items) {
if (productId == null) {
return false;
}
List<MatProductLabor> exist = baseMapper.selectList(new LambdaQueryWrapper<MatProductLabor>()
.select(MatProductLabor::getLaborId)
.eq(MatProductLabor::getProductId, productId)
.eq(MatProductLabor::getDelFlag, 0));
Set<Long> existIds = exist.stream()
.map(MatProductLabor::getLaborId)
.filter(id -> id != null && id > 0)
.collect(Collectors.toSet());
Set<Long> incomingIds = items == null ? java.util.Collections.emptySet() : items.stream()
.map(MatProductLaborBo::getLaborId)
.filter(id -> id != null && id > 0)
.collect(Collectors.toSet());
List<Long> deleteIds = existIds.stream()
.filter(id -> !incomingIds.contains(id))
.collect(Collectors.toList());
if (!deleteIds.isEmpty()) {
removeByIds(deleteIds);
}
if (items == null || items.isEmpty()) {
return true;
}
for (MatProductLaborBo item : items) {
if (item == null) {
continue;
}
MatProductLabor labor = BeanCopyUtils.copy(item, MatProductLabor.class);
if (labor == null) {
continue;
}
labor.setProductId(productId);
if (labor.getLaborId() == null) {
save(labor);
} else {
updateById(labor);
}
}
return true;
}
}

View File

@@ -7,6 +7,7 @@ import com.gear.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.gear.mat.domain.bo.MatProductImportBo;
import com.gear.mat.domain.bo.MatProductMaterialRelationBo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -25,6 +26,7 @@ import com.gear.mat.domain.vo.MatProductMaterialRelationVo;
import java.util.List;
import java.util.Map;
import java.util.Collection;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.ArrayList;
@@ -112,6 +114,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 +172,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 +188,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;
}
@@ -204,4 +212,46 @@ public class MatProductServiceImpl implements IMatProductService {
}
return baseMapper.deleteBatchIds(ids) > 0;
}
@Override
public String importByExcel(List<MatProductImportBo> list, Boolean updateSupport) {
if (list == null || list.isEmpty()) {
return "导入数据为空";
}
int success = 0;
int skipped = 0;
for (MatProductImportBo row : list) {
String productName = row == null ? null : StringUtils.trim(row.getProductName());
String spec = row == null ? null : StringUtils.trim(row.getSpec());
String model = row == null ? null : StringUtils.trim(row.getModel());
if (StringUtils.isBlank(productName)) {
skipped++;
continue;
}
LambdaQueryWrapper<MatProduct> lqw = Wrappers.lambdaQuery();
lqw.eq(MatProduct::getProductName, productName)
.eq(MatProduct::getSpec, Objects.toString(spec, ""))
.eq(MatProduct::getModel, Objects.toString(model, ""))
.last("limit 1");
MatProduct exist = baseMapper.selectOne(lqw);
if (exist != null && !Boolean.TRUE.equals(updateSupport)) {
skipped++;
continue;
}
MatProduct data = exist == null ? new MatProduct() : exist;
data.setProductName(productName);
data.setSpec(spec);
data.setModel(model);
data.setUnitPrice(row.getUnitPrice());
data.setRemark(row.getRemark());
if (exist == null) {
baseMapper.insert(data);
} else {
baseMapper.updateById(data);
}
success++;
}
return "导入完成,成功 " + success + " 条,跳过 " + skipped + "";
}
}

View File

@@ -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"/>

View File

@@ -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>

View File

@@ -57,6 +57,16 @@ public class GearWageEntryDetail extends BaseEntity {
private String extraReason;
/**
* 明细计算金额(多行乘法合计)
*/
private BigDecimal calcAmount;
/**
* 明细计算行JSON两列乘法
*/
private String calcDetail;
private BigDecimal totalAmount;
/**

View File

@@ -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
@@ -58,6 +59,10 @@ public class GearWageEntryDetailBo extends BaseEntity {
private String extraReason;
private BigDecimal calcAmount;
private String calcDetail;
private BigDecimal totalAmount;
private String isMakeup;
@@ -71,4 +76,6 @@ public class GearWageEntryDetailBo extends BaseEntity {
private String makeupReason;
private String remark;
// 新增累计金额
private Map<String, BigDecimal> cumulativeAmounts;
}

View File

@@ -16,7 +16,6 @@ import java.util.Date;
@ExcelIgnoreUnannotated
public class GearWageEntryDetailVo {
@ExcelProperty(value = "明细ID")
private Long detailId;
@ExcelProperty(value = "业务日期")
@@ -24,57 +23,50 @@ public class GearWageEntryDetailVo {
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date entryDate;
@ExcelProperty(value = "员工ID")
private Long empId;
@ExcelProperty(value = "员工姓名")
private String empName;
@ExcelProperty(value = "计费类型")
private String billingType;
@ExcelProperty(value = "费率配置ID")
private Long rateId;
@ExcelProperty(value = "工种")
private String workTypeName;
@ExcelProperty(value = "加工物品")
private String itemName;
@ExcelProperty(value = "工序")
private String processName;
@ExcelProperty(value = "订单号")
private String orderNo;
@ExcelProperty(value = "工作量")
private BigDecimal workload;
@ExcelProperty(value = "单价")
private BigDecimal unitPrice;
@ExcelProperty(value = "基础金额")
private BigDecimal baseAmount;
@ExcelProperty(value = "额外金额")
private BigDecimal extraAmount;
@ExcelProperty(value = "额外原因")
private String extraReason;
@ExcelProperty(value = "总金额")
private BigDecimal calcAmount;
private String calcDetail;
@ExcelProperty(value = "每天工资")
private BigDecimal dailyWage;
@ExcelProperty(value = "当天金额")
private BigDecimal totalAmount;
@ExcelProperty(value = "是否补录")
private String isMakeup;
@ExcelProperty(value = "补录责任人")
private String makeupResponsible;
@ExcelProperty(value = "补录原因")
private String makeupReason;
@ExcelProperty(value = "备注")
private String remark;
@ExcelProperty(value = "累计金额")
private BigDecimal cumulativeAmount;
}

View File

@@ -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,110 @@ 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);
if (result != null && result.getRecords() != null) {
for (GearWageEntryDetailVo vo : result.getRecords()) {
if (vo != null) {
vo.setDailyWage(vo.getTotalAmount());
}
}
}
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 (list != null) {
for (GearWageEntryDetailVo vo : list) {
if (vo != null) {
vo.setDailyWage(vo.getTotalAmount());
}
}
}
// 处理累计金额
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) {
@@ -103,6 +202,7 @@ public class GearWageEntryDetailServiceImpl implements IGearWageEntryDetailServi
private void fillAmountFields(GearWageEntryDetail entity) {
BigDecimal workload = entity.getWorkload() == null ? BigDecimal.ZERO : entity.getWorkload();
BigDecimal extraAmount = entity.getExtraAmount() == null ? BigDecimal.ZERO : entity.getExtraAmount();
BigDecimal calcAmount = entity.getCalcAmount() == null ? BigDecimal.ZERO : entity.getCalcAmount();
// 小时工/天工默认按1个计量单位计算基础金额1小时或1天
if (("1".equals(entity.getBillingType()) || "3".equals(entity.getBillingType())) && workload.compareTo(BigDecimal.ZERO) <= 0) {
@@ -127,7 +227,8 @@ public class GearWageEntryDetailServiceImpl implements IGearWageEntryDetailServi
BigDecimal baseAmount = workload.multiply(unitPrice);
entity.setBaseAmount(baseAmount);
entity.setExtraAmount(extraAmount);
entity.setTotalAmount(baseAmount.add(extraAmount));
entity.setCalcAmount(calcAmount);
entity.setTotalAmount(baseAmount.add(extraAmount).add(calcAmount));
}
private void fillMakeupFields(GearWageEntryDetail entity) {

View File

@@ -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);

View File

@@ -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"/>

View 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",

View File

@@ -9,6 +9,15 @@ export function listProduct(query) {
})
}
// 查询产品基础信息列表(不包含配料信息,用于列表页加速)
export function listProductBase(query) {
return request({
url: '/mat/product/listBase',
method: 'get',
params: query
})
}
// 查询产品基础信息详细
export function getProduct(productId) {
return request({
@@ -42,3 +51,21 @@ export function delProduct(productId) {
method: 'delete'
})
}
// 下载导入模板
export function importTemplateProduct() {
return request({
url: '/mat/product/importTemplate',
method: 'post',
responseType: 'blob'
})
}
// 导入产品数据
export function importProductData(data, updateSupport) {
return request({
url: '/mat/product/importData?updateSupport=' + (updateSupport ? 1 : 0),
method: 'post',
data: data
})
}

View File

@@ -0,0 +1,52 @@
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'
})
}
export function batchSaveProductAddition(data) {
return request({
url: '/api/mat/productAddition/batchSave',
method: 'post',
data
})
}
export function listProductAdditionByProductIds(productIds) {
return request({
url: '/api/mat/productAddition/listByProductIds',
method: 'post',
data: productIds
})
}

View File

@@ -0,0 +1,40 @@
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'
})
}
export function batchSaveProductLabor(data) {
return request({
url: '/api/mat/productLabor/batchSave',
method: 'post',
data
})
}

View File

@@ -4,7 +4,7 @@
background: $color;
&:hover {
color: $color;
color: #fff;
&:before,
&:after {
@@ -82,13 +82,16 @@
}
.custom-button {
display: inline-block;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
white-space: nowrap;
cursor: pointer;
background: #fff;
color: #fff;
background: var(--app-primary);
color: #fff !important;
-webkit-appearance: none;
appearance: none;
text-align: center;
box-sizing: border-box;
outline: 0;
@@ -97,3 +100,10 @@
font-size: 14px;
border-radius: 4px;
}
/* 按钮结构样式(颜色逻辑统一在 index.scss 管理) */
.el-button {
border-radius: 4px !important;
font-weight: 600 !important;
letter-spacing: 0.4px !important;
}

View File

@@ -7,6 +7,12 @@ $--spacing-lg: $--spacing-base * 2;
$--form-item-margin: $--spacing-base;
$--btn-height: 24px;
$industrial-primary: #1d4e89;
$industrial-secondary: #2471a3;
$industrial-dark: #1c2b3a;
$industrial-border: #dde1e6;
$industrial-bg: #f0f2f5;
// ====================== 2. CSS尺寸变量与Sass变量同步======================
:root {
@@ -47,44 +53,45 @@ body {
// ====================== 5. 组件尺寸样式(按优先级合并)======================
// ---------------------- 5.1 按钮(紧凑尺寸)----------------------
@mixin button-variant() {
border-radius: 6px;
transition: all .25s ease;
border-radius: 4px;
transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
height: $--btn-height;
padding: 0 var(--spacing-lg);
font-size: 13px;
font-weight: 600;
letter-spacing: 0.4px;
&:hover,
&:focus {
transform: translateY(-1px);
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
&:active {
transform: translateY(1px);
filter: brightness(0.88);
}
&.is-disabled,
&[disabled] {
cursor: not-allowed;
opacity: 0.55;
}
}
// 主按钮(尺寸相关
.el-button--primary {
@include button-variant();
}
// 功能按钮(尺寸相关)
// 各类型按钮统一套 mixin颜色由 index.scss CSS变量控制
.el-button--primary,
.el-button--success,
.el-button--warning,
.el-button--danger,
.el-button--info {
.el-button--info,
.el-button--warning {
@include button-variant();
}
// 文本按钮(尺寸相关)
.el-button--text {
// 文本/Link按钮
.el-button--text,
.el-button.is-text {
height: auto;
padding: 4px 8px;
padding: 2px 6px;
border-radius: 4px !important;
}
// 图标按钮(圆形紧凑尺寸)
@@ -142,9 +149,19 @@ body {
// ---------------------- 5.2 表格(紧凑尺寸)----------------------
.el-table {
border-radius: 8px;
border-radius: 6px;
overflow: hidden;
margin-top: $--form-item-margin * 2; // 与表单间距
border: 1px solid $industrial-border;
.el-table__header-wrapper,
.el-table__fixed-header-wrapper {
th.el-table__cell {
background: #eef3f8;
color: $industrial-dark;
border-bottom: 1px solid $industrial-border;
}
}
// 表头紧凑padding
.el-table__header-wrapper {
@@ -429,8 +446,10 @@ body {
// ---------------------- 5.5 卡片/对话框(尺寸层级)----------------------
// 卡片尺寸
.el-card {
border-radius: 8px;
border-radius: 6px;
overflow: hidden;
border: 1px solid $industrial-border;
box-shadow: 0 1px 4px rgba(0,0,0,.05);
// 卡片头部尺寸
.el-card__header {

View File

@@ -6,9 +6,25 @@
@use './btn.scss';
@use './ruoyi.scss';
:root {
color-scheme: light;
--app-page-bg: #f0f2f5;
--app-card-bg: #ffffff;
--app-card-border: #dde1e6;
--app-primary-dark: #1c2b3a;
--app-primary: #1d4e89;
--app-secondary: #2471a3;
--app-warning: #d68910;
--app-danger: #c0392b;
--app-muted: #7f8c8d;
--app-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
html,
body {
height: 100%;
margin: 0;
background: var(--app-page-bg);
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
@@ -16,7 +32,17 @@ body {
}
label {
font-weight: 700;
font-weight: 600;
color: var(--app-primary-dark);
}
:root {
--app-bg: #f0f2f5;
--app-card-border: #dde1e6;
--app-primary-dark: #1c2b3a;
--app-primary: #1d4e89;
--app-secondary: #2471a3;
--app-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
html {
@@ -99,31 +125,32 @@ div:focus {
}
aside {
background: #eef1f6;
padding: 8px 24px;
margin-bottom: 20px;
border-radius: 2px;
background: #eef3f8;
padding: 8px 16px;
margin-bottom: 16px;
border: 1px solid var(--app-card-border);
border-radius: 4px;
display: block;
line-height: 32px;
font-size: 16px;
line-height: 28px;
font-size: 14px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
color: #2c3e50;
color: var(--app-primary-dark);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
a {
color: #337ab7;
color: var(--app-primary);
cursor: pointer;
&:hover {
color: rgb(32, 160, 255);
color: var(--app-secondary);
}
}
}
//main-container全局样式
.app-container {
padding: 20px;
padding: 16px;
}
.components-container {
@@ -136,36 +163,39 @@ aside {
}
.sub-navbar {
height: 50px;
line-height: 50px;
height: 44px;
line-height: 44px;
position: relative;
width: 100%;
text-align: right;
padding-right: 20px;
padding-right: 16px;
transition: 600ms ease position;
background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);
background: linear-gradient(90deg, #1c2b3a 0%, #1d4e89 100%);
color: #fff;
.subtitle {
font-size: 20px;
font-size: 18px;
color: #fff;
}
&.draft {
background: #d0d0d0;
background: #dfe5ec;
color: var(--app-primary-dark);
}
&.deleted {
background: #d0d0d0;
background: #dfe5ec;
color: var(--app-primary-dark);
}
}
.link-type,
.link-type:focus {
color: #337ab7;
color: var(--app-primary);
cursor: pointer;
&:hover {
color: rgb(32, 160, 255);
color: var(--app-secondary);
}
}
@@ -179,3 +209,210 @@ aside {
}
}
.table-card,
.dashboard-card,
.el-card {
border: 1px solid var(--app-card-border);
border-radius: 4px;
box-shadow: var(--app-shadow);
}
.el-button {
/* 不在此设全局 color由各类型规则单独控制 */
}
.el-button > span,
.el-button .svg-icon,
.el-button i {
color: inherit;
fill: currentColor;
}
/* ════════════════════════════════════════════
按钮色彩系统
实心按钮 → 白字
Plain变体 → 浅底色 + 比边框更深的文字
Link/Text变体 → 透明底 + 各类型色文字
════════════════════════════════════════════ */
/* 子元素颜色继承 */
.el-button > span,
.el-button .svg-icon,
.el-button i {
color: inherit !important;
fill: currentColor;
}
/* ── Default白底工业蓝描边 ── */
.el-button--default:not(.is-link):not(.is-text) {
color: #1d4e89 !important;
}
.el-button--default.is-link,
.el-button--default.is-text,
.el-button--text {
color: #1d4e89 !important;
background: transparent !important;
border-color: transparent !important;
}
/* ── Primary ── */
.el-button.el-button--primary:not(.is-plain):not(.is-link):not(.is-text) { color: #ffffff !important; }
.el-button.el-button--primary.is-plain { color: #122f55 !important; }
.el-button.el-button--primary.is-link,
.el-button.el-button--primary.is-text { color: #1d4e89 !important; background: transparent !important; border-color: transparent !important; }
.el-button.el-button--primary.is-link:hover,
.el-button.el-button--primary.is-text:hover { color: #2471a3 !important; }
/* ── Success ── */
.el-button.el-button--success:not(.is-plain):not(.is-link):not(.is-text) { color: #ffffff !important; }
.el-button.el-button--success.is-plain { color: #1b5e20 !important; }
.el-button.el-button--success.is-link,
.el-button.el-button--success.is-text { color: #388e3c !important; background: transparent !important; border-color: transparent !important; }
.el-button.el-button--success.is-link:hover,
.el-button.el-button--success.is-text:hover { color: #2e7d32 !important; }
/* ── Warning ── */
.el-button.el-button--warning:not(.is-plain):not(.is-link):not(.is-text) { color: #ffffff !important; }
.el-button.el-button--warning.is-plain { color: #7f3300 !important; }
.el-button.el-button--warning.is-link,
.el-button.el-button--warning.is-text { color: #e65100 !important; background: transparent !important; border-color: transparent !important; }
.el-button.el-button--warning.is-link:hover,
.el-button.el-button--warning.is-text:hover { color: #f57c00 !important; }
/* ── Danger ── */
.el-button.el-button--danger:not(.is-plain):not(.is-link):not(.is-text) { color: #ffffff !important; }
.el-button.el-button--danger.is-plain { color: #7f0000 !important; }
.el-button.el-button--danger.is-link,
.el-button.el-button--danger.is-text { color: #c62828 !important; background: transparent !important; border-color: transparent !important; }
.el-button.el-button--danger.is-link:hover,
.el-button.el-button--danger.is-text:hover { color: #e53935 !important; }
/* ── Info ── */
.el-button.el-button--info:not(.is-plain):not(.is-link):not(.is-text) { color: #ffffff !important; }
.el-button.el-button--info.is-plain { color: #263238 !important; }
.el-button.el-button--info.is-link,
.el-button.el-button--info.is-text { color: #455a64 !important; background: transparent !important; border-color: transparent !important; }
.el-button.el-button--info.is-link:hover,
.el-button.el-button--info.is-text:hover { color: #37474f !important; }
/* ── Link / Text hover 通用背景 ── */
.el-button.is-link:hover,
.el-button.is-text:hover,
.el-button--text:hover {
background: rgba(0, 0, 0, 0.04) !important;
border-color: transparent !important;
}
.el-card__header {
background: linear-gradient(90deg, #1c2b3a 0%, #25384a 100%);
color: #fff;
font-size: 13px;
font-weight: 600;
}
.el-table {
--el-table-header-bg-color: #eef3f8;
--el-table-header-text-color: #1c2b3a;
--el-table-border-color: #dde1e6;
--el-table-row-hover-bg-color: #f7fbff;
}
/* ── Element Plus CSS变量 → 各类型独立色彩系统 ── */
.el-button--primary {
--el-button-bg-color: #1d4e89;
--el-button-border-color: #1d4e89;
--el-button-hover-bg-color: #2471a3;
--el-button-hover-border-color: #2471a3;
--el-button-active-bg-color: #163a68;
--el-button-active-border-color: #163a68;
--el-button-disabled-bg-color: #6b96c4;
--el-button-disabled-border-color: #6b96c4;
--el-button-text-color: #fff;
--el-button-disabled-text-color: rgba(255,255,255,.6);
}
.el-button--primary.is-plain {
--el-button-bg-color: #e8f0fb;
--el-button-border-color: #1d4e89;
--el-button-hover-bg-color: #d4e4f7;
--el-button-hover-border-color: #2471a3;
--el-button-text-color: #122f55;
}
.el-button--success {
--el-button-bg-color: #388e3c;
--el-button-border-color: #388e3c;
--el-button-hover-bg-color: #2e7d32;
--el-button-hover-border-color: #2e7d32;
--el-button-active-bg-color: #1b5e20;
--el-button-active-border-color: #1b5e20;
--el-button-text-color: #fff;
--el-button-disabled-text-color: rgba(255,255,255,.6);
}
.el-button--success.is-plain {
--el-button-bg-color: #e8f5e9;
--el-button-border-color: #388e3c;
--el-button-hover-bg-color: #d4edda;
--el-button-hover-border-color: #2e7d32;
--el-button-text-color: #1b5e20;
}
.el-button--warning {
--el-button-bg-color: #f57c00;
--el-button-border-color: #f57c00;
--el-button-hover-bg-color: #e65100;
--el-button-hover-border-color: #e65100;
--el-button-active-bg-color: #bf360c;
--el-button-active-border-color: #bf360c;
--el-button-text-color: #fff;
--el-button-disabled-text-color: rgba(255,255,255,.6);
}
.el-button--warning.is-plain {
--el-button-bg-color: #fff3e0;
--el-button-border-color: #f57c00;
--el-button-hover-bg-color: #ffe0b2;
--el-button-hover-border-color: #e65100;
--el-button-text-color: #bf360c;
}
.el-button--danger {
--el-button-bg-color: #c62828;
--el-button-border-color: #c62828;
--el-button-hover-bg-color: #b71c1c;
--el-button-hover-border-color: #b71c1c;
--el-button-active-bg-color: #8b0000;
--el-button-active-border-color: #8b0000;
--el-button-text-color: #fff;
--el-button-disabled-text-color: rgba(255,255,255,.6);
}
.el-button--danger.is-plain {
--el-button-bg-color: #ffebee;
--el-button-border-color: #c62828;
--el-button-hover-bg-color: #ffcdd2;
--el-button-hover-border-color: #b71c1c;
--el-button-text-color: #8b0000;
}
.el-button--info {
--el-button-bg-color: #455a64;
--el-button-border-color: #455a64;
--el-button-hover-bg-color: #37474f;
--el-button-hover-border-color: #37474f;
--el-button-active-bg-color: #263238;
--el-button-active-border-color: #263238;
--el-button-text-color: #fff;
--el-button-disabled-text-color: rgba(255,255,255,.6);
}
.el-button--info.is-plain {
--el-button-bg-color: #eceff1;
--el-button-border-color: #455a64;
--el-button-hover-bg-color: #cfd8dc;
--el-button-hover-border-color: #37474f;
--el-button-text-color: #263238;
}
.el-tag--success {
--el-tag-bg-color: rgba(29, 78, 137, 0.12);
--el-tag-border-color: rgba(29, 78, 137, 0.24);
--el-tag-text-color: #1d4e89;
}

View File

@@ -68,6 +68,7 @@
border: none;
height: 100%;
width: 100% !important;
background: #1c2b3a;
}
.el-menu-item, .menu-title {
@@ -83,21 +84,25 @@
// menu hover
.sub-menu-title-noDropdown,
.el-sub-menu__title {
color: #d7e2ee !important;
&:hover {
background-color: rgba(0, 0, 0, 0.06) !important;
background-color: rgba(255, 255, 255, 0.05) !important;
}
}
& .theme-dark .is-active > .el-sub-menu__title {
color: vars.$base-menu-color-active !important;
color: #ffffff !important;
background: linear-gradient(90deg, rgba(29, 78, 137, 0.95), rgba(36, 113, 163, 0.95));
}
& .nest-menu .el-sub-menu>.el-sub-menu__title,
& .el-sub-menu .el-menu-item {
min-width: vars.$base-sidebar-width !important;
color: #d7e2ee !important;
&:hover {
background-color: rgba(0, 0, 0, 0.06) !important;
background-color: rgba(255, 255, 255, 0.05) !important;
}
}
@@ -211,9 +216,10 @@
.nest-menu .el-sub-menu>.el-sub-menu__title,
.el-menu-item {
color: #d7e2ee !important;
&:hover {
// you can use $sub-menuHover
background-color: rgba(0, 0, 0, 0.06) !important;
background-color: rgba(255, 255, 255, 0.05) !important;
}
}

View File

@@ -1,42 +1,42 @@
// base color
$blue: #324157;
$light-blue: #333c46;
$red: #C03639;
$pink: #E65D6E;
$green: #30B08F;
$tiffany: #4AB7BD;
$yellow: #FEC171;
$panGreen: #30B08F;
// industrial palette
$blue: #1d4e89;
$light-blue: #2471a3;
$red: #c0392b;
$pink: #e65d6e;
$green: #4b8b3b;
$tiffany: #4ab7bd;
$yellow: #d68910;
$panGreen: #2f8f5b;
// 默认主题变量
$menuText: #bfcbd9;
$menuActiveText: #409eff;
$menuBg: #304156;
$menuHover: #263445;
$menuText: #d7e2ee;
$menuActiveText: #7cc0ff;
$menuBg: #1c2b3a;
$menuHover: #25384a;
// 浅色主题theme-light
$menuLightBg: #ffffff;
$menuLightHover: #f0f1f5;
$menuLightText: #303133;
$menuLightActiveText: #409EFF;
$menuLightBg: #f5f7fa;
$menuLightHover: #e9eef5;
$menuLightText: #2f3a4a;
$menuLightActiveText: #1d4e89;
// 基础变量
$base-sidebar-width: 200px;
$sideBarWidth: 200px;
// 菜单暗色变量
$base-menu-color: #bfcbd9;
$base-menu-color-active: #f4f4f5;
$base-menu-background: #304156;
$base-sub-menu-background: #1f2d3d;
$base-sub-menu-hover: #001528;
$base-menu-color: #d7e2ee;
$base-menu-color-active: #ffffff;
$base-menu-background: #1c2b3a;
$base-sub-menu-background: #16212d;
$base-sub-menu-hover: #223243;
// 组件变量
$--color-primary: #409EFF;
$--color-success: #67C23A;
$--color-warning: #E6A23C;
$--color-danger: #F56C6C;
$--color-info: #909399;
$--color-primary: #1d4e89;
$--color-success: #4b8b3b;
$--color-warning: #d68910;
$--color-danger: #c0392b;
$--color-info: #7f8c8d;
:export {
menuText: $menuText;
@@ -71,12 +71,20 @@ $--color-info: #909399;
--sidebar-bg: #{$menuBg};
--sidebar-text: #{$menuText};
--menu-hover: #{$menuHover};
--navbar-bg: #ffffff;
--navbar-text: #303133;
--navbar-bg: #f5f7fa;
--navbar-text: #2f3a4a;
--navbar-hover: #e9eef5;
--page-bg: #f0f2f5;
--card-bg: #ffffff;
--card-border: #dde1e6;
--panel-header-bg: #1c2b3a;
--panel-header-text: #ffffff;
--panel-accent: #1d4e89;
--panel-accent-2: #2471a3;
--muted-text: #7f8c8d;
/* splitpanes default-theme 变量 */
--splitpanes-default-bg: #ffffff;
--splitpanes-default-bg: #f5f7fa;
}

View File

@@ -1,16 +1,31 @@
<template>
<div :class="{ 'hidden': hidden }" class="pagination-container">
<el-pagination
:background="background"
v-model:current-page="currentPage"
v-model:page-size="pageSize"
:layout="layout"
:page-sizes="pageSizes"
:pager-count="pagerCount"
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
<div v-if="!hidden" class="gear-pagination">
<span class="gear-pg-info"> <b>{{ total }}</b> </span>
<select v-model="pageSize" class="gear-pg-select" @change="handleSizeChange">
<option v-for="s in pageSizes" :key="s" :value="s">{{ s }}/</option>
</select>
<div class="gear-pg-pager">
<button class="gear-pg-btn gear-pg-nav" :disabled="currentPage <= 1" @click="changePage(currentPage - 1)">
<svg width="8" height="8" viewBox="0 0 8 8" fill="none"><path d="M5.5 1L2.5 4L5.5 7" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"/></svg>
</button>
<template v-for="(p, i) in displayPages" :key="i">
<span v-if="p === '...'" class="gear-pg-ellipsis">···</span>
<button v-else :class="['gear-pg-btn', { active: p === currentPage }]" @click="changePage(p)">{{ p }}</button>
</template>
<button class="gear-pg-btn gear-pg-nav" :disabled="currentPage >= totalPages" @click="changePage(currentPage + 1)">
<svg width="8" height="8" viewBox="0 0 8 8" fill="none"><path d="M2.5 1L5.5 4L2.5 7" stroke="currentColor" stroke-width="1.5" stroke-linecap="square"/></svg>
</button>
</div>
<div class="gear-pg-jumper">
<span class="gear-pg-label">前往</span>
<input v-model.number="jumpVal" type="number" class="gear-pg-input" :min="1" :max="totalPages" @keyup.enter="handleJump" />
<span class="gear-pg-label"></span>
</div>
</div>
</template>
@@ -18,88 +33,194 @@
import { scrollTo } from '@/utils/scroll-to'
const props = defineProps({
total: {
required: true,
type: Number
},
page: {
type: Number,
default: 1
},
limit: {
type: Number,
default: 20
},
pageSizes: {
type: Array,
default() {
return [10, 20, 30, 50]
}
},
// 移动端页码按钮的数量端默认值5
pagerCount: {
type: Number,
default: document.body.clientWidth < 992 ? 5 : 7
},
layout: {
type: String,
default: 'total, sizes, prev, pager, next, jumper'
},
background: {
type: Boolean,
default: true
},
autoScroll: {
type: Boolean,
default: true
},
hidden: {
type: Boolean,
default: false
}
total: { required: true, type: Number },
page: { type: Number, default: 1 },
limit: { type: Number, default: 20 },
pageSizes: { type: Array, default: () => [10, 20, 30, 50] },
pagerCount: { type: Number, default: document.body.clientWidth < 992 ? 5 : 7 },
autoScroll: { type: Boolean, default: true },
hidden: { type: Boolean, default: false }
})
const emit = defineEmits()
const emit = defineEmits(['update:page', 'update:limit', 'pagination'])
const jumpVal = ref(props.page)
const currentPage = computed({
get() {
return props.page
},
set(val) {
emit('update:page', val)
}
get: () => props.page,
set: val => emit('update:page', val)
})
const pageSize = computed({
get() {
return props.limit
},
set(val){
emit('update:limit', val)
}
get: () => props.limit,
set: val => emit('update:limit', val)
})
function handleSizeChange(val) {
if (currentPage.value * val > props.total) {
currentPage.value = 1
}
emit('pagination', { page: currentPage.value, limit: val })
if (props.autoScroll) {
scrollTo(0, 800)
}
const totalPages = computed(() => Math.max(1, Math.ceil(props.total / props.limit)))
const displayPages = computed(() => {
const total = totalPages.value
const cur = currentPage.value
const count = props.pagerCount
if (total <= count) return Array.from({ length: total }, (_, i) => i + 1)
const half = Math.floor(count / 2)
let start = Math.max(1, cur - half)
let end = Math.min(total, start + count - 1)
if (end - start < count - 1) start = Math.max(1, end - count + 1)
const pages = []
if (start > 1) { pages.push(1); if (start > 2) pages.push('...') }
for (let i = start; i <= end; i++) pages.push(i)
if (end < total) { if (end < total - 1) pages.push('...'); pages.push(total) }
return pages
})
function changePage(p) {
if (p < 1 || p > totalPages.value || p === currentPage.value) return
currentPage.value = p
jumpVal.value = p
emit('pagination', { page: p, limit: pageSize.value })
if (props.autoScroll) scrollTo(0, 800)
}
function handleCurrentChange(val) {
emit('pagination', { page: val, limit: pageSize.value })
if (props.autoScroll) {
scrollTo(0, 800)
function handleSizeChange() {
const newPage = currentPage.value * pageSize.value > props.total ? 1 : currentPage.value
currentPage.value = newPage
emit('pagination', { page: newPage, limit: pageSize.value })
if (props.autoScroll) scrollTo(0, 800)
}
function handleJump() {
changePage(Math.min(Math.max(1, Math.round(jumpVal.value)), totalPages.value))
}
watch(() => props.page, val => { jumpVal.value = val })
</script>
<style scoped>
.pagination-container {
background: #fff;
<style scoped lang="scss">
$p: #1d4e89;
$pd: #122f55;
$pl: #2471a3;
$bd: #c8d4e4;
$h: 22px;
.gear-pagination {
display: flex;
align-items: center;
gap: 8px;
padding: 4px 0;
margin-top: 8px;
border-top: 2px solid $p;
flex-wrap: wrap;
}
.pagination-container.hidden {
display: none;
.gear-pg-info {
font-size: 12px;
color: #7a8fa6;
white-space: nowrap;
b { color: $p; font-weight: 700; }
}
.gear-pg-select {
height: $h;
padding: 0 18px 0 6px;
border: 1px solid $bd;
border-left: 2px solid $p;
background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%231d4e89'/%3E%3C/svg%3E") right 5px center no-repeat;
background-size: 7px;
appearance: none;
font-size: 12px;
font-weight: 600;
color: #1c2b3a;
cursor: pointer;
border-radius: 2px;
outline: none;
&:hover { border-color: $pl; }
}
.gear-pg-pager {
display: flex;
align-items: center;
gap: 2px;
}
.gear-pg-btn {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: $h;
height: $h;
padding: 0 4px;
border: 1px solid $bd;
background: #fff;
color: #1c2b3a;
font-size: 12px;
font-weight: 600;
cursor: pointer;
border-radius: 2px;
transition: background .1s, color .1s, border-color .1s;
&:hover:not(:disabled) {
border-color: $p;
color: $p;
background: #f0f5ff;
}
&.active {
background: $p;
border-color: $p;
border-left: 2px solid $pd;
color: #fff;
}
}
.gear-pg-nav {
color: $p;
border-color: $p;
&:disabled { opacity: 0.3; cursor: not-allowed; }
}
.gear-pg-ellipsis {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: $h;
font-size: 11px;
color: #7a8fa6;
user-select: none;
}
.gear-pg-jumper {
display: flex;
align-items: center;
gap: 3px;
margin-left: auto;
}
.gear-pg-label {
font-size: 12px;
color: #7a8fa6;
white-space: nowrap;
}
.gear-pg-input {
width: 36px;
height: $h;
border: 1px solid $bd;
border-left: 2px solid $p;
border-radius: 2px;
padding: 0 3px;
font-size: 12px;
font-weight: 600;
color: #1c2b3a;
text-align: center;
outline: none;
-moz-appearance: textfield;
transition: border-color .1s;
&::-webkit-inner-spin-button, &::-webkit-outer-spin-button { display: none; }
&:hover, &:focus { border-color: $pl; }
}
@media (max-width: 768px) {
.gear-pg-jumper, .gear-pg-select { display: none; }
}
</style>

View File

@@ -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;

View File

@@ -42,6 +42,7 @@ function addIframe() {
width: 100%;
position: relative;
overflow: hidden;
background: var(--app-bg);
}
.app-main:has(.copyright) {
@@ -78,11 +79,11 @@ function addIframe() {
}
::-webkit-scrollbar-track {
background-color: #f1f1f1;
background-color: #edf2f7;
}
::-webkit-scrollbar-thumb {
background-color: #c0c0c0;
background-color: #aab7c4;
border-radius: 3px;
}
</style>

View File

@@ -102,11 +102,13 @@ function toggleTheme() {
<style lang='scss' scoped>
.navbar {
height: 50px;
height: 48px;
overflow: hidden;
position: relative;
background: var(--navbar-bg);
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
background: linear-gradient(90deg, #1c2b3a 0%, #25384a 100%);
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
color: #d7e2ee;
.hamburger-container {
line-height: 46px;
@@ -115,9 +117,10 @@ function toggleTheme() {
cursor: pointer;
transition: background 0.3s;
-webkit-tap-highlight-color: transparent;
color: #d7e2ee;
&:hover {
background: rgba(0, 0, 0, 0.025);
background: rgba(255, 255, 255, 0.04);
}
}
@@ -138,7 +141,7 @@ function toggleTheme() {
.right-menu {
float: right;
height: 100%;
line-height: 50px;
line-height: 48px;
display: flex;
&:focus {
@@ -147,10 +150,10 @@ function toggleTheme() {
.right-menu-item {
display: inline-block;
padding: 0 8px;
padding: 0 10px;
height: 100%;
font-size: 18px;
color: #5a5e66;
font-size: 16px;
color: #d7e2ee;
vertical-align: text-bottom;
&.hover-effect {
@@ -158,7 +161,7 @@ function toggleTheme() {
transition: background 0.3s;
&:hover {
background: rgba(0, 0, 0, 0.025);
background: rgba(255, 255, 255, 0.05);
}
}
@@ -181,23 +184,28 @@ function toggleTheme() {
padding-right: 0px;
.avatar-wrapper {
margin-top: 10px;
margin-top: 9px;
right: 5px;
position: relative;
display: flex;
align-items: center;
gap: 8px;
.user-avatar {
cursor: pointer;
width: 30px;
height: 30px;
width: 28px;
height: 28px;
border-radius: 50%;
border: 1px solid rgba(255, 255, 255, 0.2);
}
.user-nickname{
position: relative;
left: 5px;
bottom: 10px;
font-size: 14px;
font-weight: bold;
left: 0;
bottom: 0;
font-size: 13px;
font-weight: 600;
color: #fff;
}
i {

View File

@@ -35,7 +35,7 @@ const getLogoBackground = computed(() => {
if (settingsStore.isDark) {
return 'var(--sidebar-bg)'
}
return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg
return '#1c2b3a'
})
// 获取Logo文字颜色
@@ -43,7 +43,7 @@ const getLogoTextColor = computed(() => {
if (settingsStore.isDark) {
return 'var(--sidebar-text)'
}
return sideTheme.value === 'theme-dark' ? '#fff' : variables.menuLightText
return '#fff'
})
</script>

View File

@@ -70,34 +70,45 @@ const activeMenu = computed(() => {
<style lang="scss" scoped>
.sidebar-container {
background-color: v-bind(getMenuBackground);
background: #1c2b3a !important;
border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
.scrollbar-wrapper {
background-color: v-bind(getMenuBackground);
background: #1c2b3a !important;
}
:deep(.el-scrollbar__view),
:deep(.el-scrollbar__wrap),
:deep(.el-scrollbar__bar),
:deep(.el-menu),
:deep(.el-menu--popup) {
background: #1c2b3a !important;
}
.el-menu {
border: none;
height: 100%;
width: 100% !important;
background: #1c2b3a !important;
.el-menu-item, .el-sub-menu__title {
color: #d7e2ee !important;
&:hover {
background-color: var(--menu-hover, rgba(0, 0, 0, 0.06)) !important;
background-color: rgba(255, 255, 255, 0.05) !important;
}
}
.el-menu-item {
color: v-bind(getMenuTextColor);
&.is-active {
color: var(--menu-active-text, #409eff);
background-color: var(--menu-hover, rgba(0, 0, 0, 0.06)) !important;
color: #ffffff !important;
background: linear-gradient(90deg, rgba(29, 78, 137, 0.92), rgba(36, 113, 163, 0.92)) !important;
box-shadow: inset 3px 0 0 #7cc0ff;
}
}
.el-sub-menu__title {
color: v-bind(getMenuTextColor);
color: #d7e2ee !important;
}
}
}

View File

@@ -90,9 +90,9 @@ function isActive(r) {
function activeStyle(tag) {
if (!isActive(tag)) return {}
return {
"background-color": "#f5f7fa",
"border-color": "#f5f7fa",
"color": "#303133"
"background-color": "#1d4e89",
"border-color": "#1d4e89",
"color": "#fff"
}
}
@@ -264,9 +264,9 @@ function handleScroll() {
.tags-view-container {
height: 34px;
width: 100%;
background: var(--tags-bg, #fff);
border-bottom: 1px solid var(--tags-item-border, #d8dce5);
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
background: #f5f7fa;
border-bottom: 1px solid #dde1e6;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .08), 0 0 3px 0 rgba(0, 0, 0, .03);
.tags-view-wrapper {
.tags-view-item {
@@ -275,9 +275,9 @@ function handleScroll() {
cursor: pointer;
height: 26px;
line-height: 26px;
border: 1px solid var(--tags-item-border, #d8dce5);
color: var(--tags-item-text, #495060);
background: var(--tags-item-bg, #fff);
border: 1px solid #d8dce5;
color: #495060;
background: #fff;
padding: 0 8px;
font-size: 12px;
margin-left: 5px;
@@ -292,13 +292,13 @@ function handleScroll() {
}
&.active {
background-color: #f5f7fa;
color: #303133;
border-color: #f5f7fa;
background-color: #1d4e89;
color: #fff;
border-color: #1d4e89;
&::before {
content: '';
background: #42b983;
background: #7cc0ff;
display: inline-block;
width: 8px;
height: 8px;
@@ -316,7 +316,7 @@ function handleScroll() {
.contextmenu {
margin: 0;
background: var(--el-bg-color-overlay, #fff);
background: #fff;
z-index: 3000;
position: absolute;
list-style-type: none;
@@ -324,7 +324,7 @@ function handleScroll() {
border-radius: 4px;
font-size: 12px;
font-weight: 400;
color: var(--tags-item-text, #333);
color: #333;
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
border: 1px solid var(--el-border-color-light, #e4e7ed);
@@ -334,7 +334,7 @@ function handleScroll() {
cursor: pointer;
&:hover {
background: var(--tags-item-hover, #eee);
background: #eef3f8;
}
}
}

View File

@@ -72,6 +72,7 @@ function setLayout() {
position: relative;
height: 100%;
width: 100%;
background: #f0f2f5;
&.mobile.openSidebar {
position: fixed;
@@ -106,6 +107,10 @@ function setLayout() {
width: 100%;
}
.main-container {
background: #f0f2f5;
}
.mobile .fixed-header {
width: 100%;
}

View File

@@ -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' }

View File

@@ -17,7 +17,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: import.meta.env.VITE_APP_BASE_API,
// 超时
timeout: 10000
timeout: 30000
})
// request拦截器

View File

@@ -154,25 +154,22 @@ getCookie()
</script>
<style lang='scss' scoped>
// 亮色主题(默认)
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-size: cover;
background-image: url('@/assets/images/back.jpg');
background-image: linear-gradient(rgba(28, 43, 58, 0.65), rgba(28, 43, 58, 0.65)), url('@/assets/images/back.jpg');
/* 亮色主题变量 */
--color-bg-primary: #f5f7fa90;
--color-bg-form: #f5f7fa90;
--color-bg-input: #f0f2f5;
--color-border-input: #dcdfe6;
--color-text-primary: #303133;
--color-text-secondary: #606266;
--color-text-placeholder: #909399;
--color-btn-primary: #409eff;
--color-btn-primary-hover: #66b1ff;
--color-bg-form: rgba(255, 255, 255, 0.9);
--color-bg-input: #f7fbff;
--color-border-input: #cfd8e3;
--color-text-primary: #1c2b3a;
--color-text-secondary: #54708a;
--color-text-placeholder: #8a99a8;
--color-btn-primary: #1d4e89;
--color-btn-primary-hover: #2471a3;
.title {
margin: 0px auto 30px auto;
@@ -181,6 +178,8 @@ getCookie()
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
letter-spacing: 1px;
}
.right-img {
@@ -202,15 +201,16 @@ getCookie()
border-radius: 6px;
backdrop-filter: blur(10px);
background: var(--color-bg-form);
padding: 25px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
padding: 25px 25px 5px 25px;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
border: 1px solid rgba(255, 255, 255, 0.55);
}
:deep(.el-input__wrapper) {
background: var(--color-bg-input);
border-radius: 6px;
border-radius: 4px;
border: 1px solid var(--color-border-input);
box-shadow: none;
}
.el-input {
@@ -221,9 +221,7 @@ getCookie()
z-index: 1;
flex: 3;
border-radius: 6px;
// background: var(--color-bg-form);
padding: 25px;
// box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
.el-input {
height: 40px;
@@ -288,7 +286,6 @@ getCookie()
padding-left: 12px;
}
/* Element组件样式调整 */
:deep(.el-checkbox__label) {
color: var(--color-text-primary);
}
@@ -308,21 +305,18 @@ getCookie()
}
}
// 暗色主题
.login.dark {
/* 暗色主题变量 - 覆盖亮色变量 */
--color-bg-primary: #1a1a1a;
--color-bg-form: #292929;
--color-bg-input: #333333;
--color-border-input: #444444;
--color-text-primary: #ebebeb;
--color-text-secondary: #bfbfbf;
--color-text-placeholder: #999999;
--color-btn-primary: #409eff;
--color-btn-primary-hover: #66b1ff;
--color-bg-form: rgba(28, 43, 58, 0.92);
--color-bg-input: #223243;
--color-border-input: #3f5569;
--color-text-primary: #edf3f9;
--color-text-secondary: #b9c7d4;
--color-text-placeholder: #8fa1b2;
--color-btn-primary: #2471a3;
--color-btn-primary-hover: #1d4e89;
.login-form {
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}
}
</style>

View 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>

View File

@@ -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;
});
}

View File

@@ -0,0 +1,568 @@
<template>
<div class="app-container product-detail">
<el-card class="detail-card" v-loading="loading">
<template #header>
<div class="card-header">
<div class="header-title">
<div class="product-name">{{ productDetail.productName || '-' }}</div>
<div class="sub-title">产品详情</div>
</div>
<el-button type="primary" plain @click="handleBack">返回列表</el-button>
</div>
</template>
<el-row :gutter="16">
<el-col :xs="24" :md="14">
<el-descriptions class="detail-desc" :column="2" border>
<el-descriptions-item label="产品名称">
{{ productDetail.productName || '-' }}
</el-descriptions-item>
<el-descriptions-item label="产品单价">
{{ formatDecimal(productDetail.unitPrice) }}
</el-descriptions-item>
<el-descriptions-item label="产品规格">
{{ productDetail.spec || '-' }}
</el-descriptions-item>
<el-descriptions-item label="产品型号">
{{ productDetail.model || '-' }}
</el-descriptions-item>
<el-descriptions-item label="备注" :span="2">
<span class="remark-text">{{ productDetail.remark || '无' }}</span>
</el-descriptions-item>
</el-descriptions>
<div class="section" v-loading="additionLoading">
<div class="section-title">附加属性</div>
<el-empty v-if="!productAdditionList.length" description="暂无附加属性" />
<el-descriptions v-else :column="2" border size="small">
<el-descriptions-item
v-for="item in productAdditionList"
:key="item.addId || item.attrName"
:label="item.attrName"
>
{{ item.attrValue || '-' }}
</el-descriptions-item>
</el-descriptions>
</div>
</el-col>
<el-col :xs="24" :md="10">
<el-tabs v-model="mediaTab" class="media-tabs" type="border-card">
<el-tab-pane label="图片" name="images">
<el-empty
v-if="!(productDetail.productImages && productDetail.productImages.trim())"
description="暂无图片"
/>
<div v-else class="image-grid">
<div
v-for="(image, index) in productDetail.productImages.split(',').filter(img => img.trim())"
:key="index"
class="image-item"
>
<el-image
:src="image"
:preview-src-list="productDetail.productImages.split(',').filter(img => img.trim())"
fit="cover"
class="image"
/>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="说明书" name="pdf">
<el-empty v-if="!pdfDisplayList.length" description="暂无说明书" />
<div v-else class="pdf-list">
<div v-for="(pdf, index) in pdfDisplayList" :key="index" class="pdf-item">
<div class="pdf-left">
<el-icon class="pdf-icon"><Document /></el-icon>
<div class="pdf-meta">
<div class="pdf-name" :title="pdf.name">{{ pdf.name }}</div>
<div class="pdf-sub">{{ pdf.ossId ? `ID: ${pdf.ossId}` : '' }}</div>
</div>
</div>
<div class="pdf-actions">
<el-button type="primary" link @click="previewPdf(pdf)">预览</el-button>
<el-button type="success" link @click="downloadPdf(pdf)">下载</el-button>
</div>
</div>
</div>
</el-tab-pane>
</el-tabs>
</el-col>
</el-row>
</el-card>
<el-card class="detail-card" v-loading="materialLoading">
<template #header>
<div class="card-header">
<div class="header-title">
<div class="product-name">成本明细</div>
<div class="sub-title">主材 / 辅材 / 工价</div>
</div>
<div class="total-badge">
<div class="total-main">合计:{{ formatDecimal(totalAmount) }} 元</div>
<div class="total-breakdown">
主材:{{ formatDecimal(mainSubtotal) }} 元
<span class="sep">|</span>
辅材:{{ formatDecimal(auxiliarySubtotal) }} 元
<span class="sep">|</span>
工价:{{ formatDecimal(laborSubtotal) }} 元
</div>
</div>
</div>
</template>
<div class="cost-section">
<div class="cost-title">主材</div>
<el-empty v-if="!mainMaterials.length" description="暂无主材" />
<div v-else>
<el-table :data="mainMaterials" border stripe>
<el-table-column prop="materialName" label="配料名称" min-width="140" />
<el-table-column prop="spec" label="材料规格" min-width="140" />
<el-table-column prop="quantity" label="数量" width="120" align="center" />
<el-table-column prop="price" label="单价" width="120" align="center">
<template #default="scope">{{ formatDecimal(scope.row.price) }}</template>
</el-table-column>
<el-table-column prop="subtotal" label="小计" width="120" align="center">
<template #default="scope">{{ formatDecimal(scope.row.subtotal) }}</template>
</el-table-column>
</el-table>
<div class="section-summary">
主材小计:{{ formatDecimal(mainMaterials.reduce((sum, item) => sum + item.subtotal, 0)) }} 元
</div>
</div>
</div>
<div class="cost-section">
<div class="cost-title">辅材</div>
<el-empty v-if="!auxiliaryMaterials.length" description="暂无辅材" />
<div v-else>
<el-table :data="auxiliaryMaterials" border stripe>
<el-table-column prop="materialName" label="配料名称" min-width="140" />
<el-table-column prop="spec" label="材料规格" min-width="140" />
<el-table-column prop="quantity" label="数量" width="120" align="center" />
<el-table-column prop="price" label="单价" width="120" align="center">
<template #default="scope">{{ formatDecimal(scope.row.price) }}</template>
</el-table-column>
<el-table-column prop="subtotal" label="小计" width="120" align="center">
<template #default="scope">{{ formatDecimal(scope.row.subtotal) }}</template>
</el-table-column>
</el-table>
<div class="section-summary">
辅材小计:{{ formatDecimal(auxiliaryMaterials.reduce((sum, item) => sum + item.subtotal, 0)) }} 元
</div>
</div>
</div>
<div class="cost-section">
<div class="cost-title">工价</div>
<el-empty v-if="!productLaborList.length" description="暂无工价" />
<div v-else>
<el-table :data="productLaborList" border stripe>
<el-table-column prop="laborName" label="工价说明" min-width="200" />
<el-table-column prop="laborPrice" label="金额()" width="160" align="center">
<template #default="scope">{{ formatDecimal(scope.row.laborPrice) }}</template>
</el-table-column>
</el-table>
<div class="section-summary">
工价小计:{{ formatDecimal(productLaborList.reduce((sum, item) => sum + (Number(item.laborPrice) || 0), 0)) }} 元
</div>
</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 mediaTab = ref('images');
// 材料明细数据
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 mainSubtotal = computed(() => {
return mainMaterials.value.reduce((sum, item) => sum + item.subtotal, 0);
});
const auxiliarySubtotal = computed(() => {
return auxiliaryMaterials.value.reduce((sum, item) => sum + item.subtotal, 0);
});
const laborSubtotal = computed(() => {
return 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);
});
// 计算总金额
const totalAmount = computed(() => {
return mainSubtotal.value + auxiliarySubtotal.value + laborSubtotal.value;
});
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(() => {
if (String(route.query?.tab || '') === 'pdf') {
mediaTab.value = 'pdf';
}
getProductDetail();
});
</script>
<style scoped>
.detail-card {
margin-bottom: 16px;
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.header-title {
display: flex;
flex-direction: column;
gap: 4px;
}
.product-name {
font-weight: 600;
font-size: 16px;
line-height: 22px;
}
.sub-title {
color: var(--el-text-color-secondary);
font-size: 12px;
line-height: 18px;
}
.detail-desc :deep(.el-descriptions__label) {
width: 88px;
}
.remark-text {
white-space: pre-wrap;
word-break: break-word;
}
.section {
margin-top: 14px;
}
.section-title {
font-weight: 600;
margin-bottom: 10px;
}
.media-tabs :deep(.el-tabs__content) {
padding: 12px;
}
.image-grid {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.image-item {
width: 112px;
height: 112px;
border-radius: 8px;
overflow: hidden;
border: 1px solid var(--el-border-color-light);
background: var(--el-fill-color-blank);
}
.image {
width: 100%;
height: 100%;
}
.pdf-list {
display: flex;
flex-direction: column;
gap: 10px;
}
.pdf-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
border: 1px solid var(--el-border-color-light);
border-radius: 8px;
background: var(--el-fill-color-blank);
}
.pdf-left {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.pdf-icon {
font-size: 24px;
color: #409eff;
}
.pdf-meta {
min-width: 0;
}
.pdf-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 320px;
}
.pdf-sub {
font-size: 12px;
color: var(--el-text-color-secondary);
line-height: 18px;
}
.pdf-actions {
display: flex;
align-items: center;
gap: 6px;
}
.total-badge {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 4px;
font-weight: 600;
color: #f56c6c;
}
.total-main {
font-size: 14px;
line-height: 18px;
}
.total-breakdown {
font-size: 12px;
line-height: 18px;
color: var(--el-text-color-secondary);
}
.sep {
margin: 0 6px;
}
.cost-section {
margin-top: 14px;
}
.cost-title {
font-weight: 600;
margin-bottom: 10px;
}
.section-summary {
text-align: right;
padding: 10px;
background-color: var(--el-fill-color-light);
border-top: 1px solid var(--el-border-color-light);
margin-top: -1px;
font-weight: bold;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -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();
}

View File

@@ -4,7 +4,7 @@
<el-form-item label="员工姓名" prop="empName">
<el-input v-model="queryParams.empName" placeholder="请输入员工姓名" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="计费类型" prop="billingType">
<el-form-item v-if="!simpleMode" label="计费类型" prop="billingType">
<el-select v-model="queryParams.billingType" placeholder="请选择计费类型" clearable style="width: 180px">
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
@@ -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>
@@ -34,15 +37,15 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="wageEntryDetailList">
<el-table-column label="业务日期" align="center" prop="entryDate" width="120" />
<el-table-column label="员工姓名" align="center" prop="empName" width="120" />
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
<el-table v-loading="loading" :data="wageEntryDetailList" style="width: 100%">
<el-table-column label="业务日期" align="center" prop="entryDate" width="130" />
<el-table-column label="员工姓名" align="center" prop="empName" width="140" />
<el-table-column v-if="!simpleMode" label="计费类型" align="center" prop="billingType" width="100">
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
</el-table-column>
<el-table-column label="工种" align="center" prop="workTypeName" min-width="140" />
<el-table-column v-if="!simpleMode" label="工种" align="center" prop="workTypeName" min-width="160" />
<el-table-column label="工作时间/加工数量" align="center" min-width="170">
<el-table-column v-if="!simpleMode" label="工作时间/加工数量" align="center" min-width="170">
<template #default="scope">
<el-input
v-model="scope.row.workload"
@@ -52,27 +55,47 @@
</template>
</el-table-column>
<el-table-column label="单价" align="center" min-width="150">
<el-table-column v-if="!simpleMode" label="单价" align="center" min-width="150">
<template #default="scope">
<el-input v-if="scope.row.billingType === '2'" v-model="scope.row.unitPrice" placeholder="多少钱/件" @input="recalcRowAmount(scope.row)" />
<span v-else>{{ formatUnitPrice(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="奖惩金额" align="center" min-width="130">
<el-table-column v-if="!simpleMode" label="奖惩金额" align="center" min-width="130">
<template #default="scope">
<el-input v-model="scope.row.extraAmount" placeholder="奖惩金额(负数为惩罚)" @input="recalcRowAmount(scope.row)" />
</template>
</el-table-column>
<el-table-column label="奖惩原因" align="center" min-width="180">
<el-table-column v-if="!simpleMode" label="奖惩原因" align="center" min-width="180">
<template #default="scope">
<el-input v-model="scope.row.extraReason" placeholder="奖惩原因" />
</template>
</el-table-column>
<el-table-column label="总金额" align="center" prop="totalAmount" width="110" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="170">
<el-table-column v-if="!simpleMode" label="明细金额" align="center" prop="calcAmount" width="110">
<template #default="scope">{{ round2(toNumber(scope.row.calcAmount)) }}</template>
</el-table-column>
<el-table-column label="每天工资" align="center" min-width="120">
<template #default="scope">
<el-input v-model="scope.row.dailyWage" placeholder="请输入每天工资" @input="applyDailyWage(scope.row)" />
</template>
</el-table-column>
<el-table-column label="当天金额" align="center" min-width="150">
<template #default="scope">
<el-input :model-value="round2(toNumber(scope.row.totalAmount))" disabled />
</template>
</el-table-column>
<el-table-column label="累计金额" align="center" min-width="150">
<template #default="scope">
<el-input :model-value="round2(toNumber(scope.row.cumulativeAmount))" disabled />
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" min-width="140">
<template #default="scope">
<el-button link type="primary" icon="Check" @click="saveRow(scope.row)">保存</el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
@@ -81,6 +104,39 @@
</el-table>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
<el-dialog v-if="!simpleMode" v-model="calcOpen" title="明细计算" width="720px" append-to-body>
<div class="calc-toolbar">
<el-button size="small" type="primary" plain icon="Plus" @click="addCalcLine">新增一行</el-button>
<div class="calc-sum">合计{{ calcTotal }} </div>
</div>
<el-table :data="calcLines" border stripe>
<el-table-column label="数值A" min-width="160">
<template #default="scope">
<el-input v-model="scope.row.a" placeholder="请输入" />
</template>
</el-table-column>
<el-table-column label="数值B" min-width="160">
<template #default="scope">
<el-input v-model="scope.row.b" placeholder="请输入" />
</template>
</el-table-column>
<el-table-column label="小计(A×B)" width="150" align="center">
<template #default="scope">
{{ lineAmount(scope.row) }}
</template>
</el-table-column>
<el-table-column label="操作" width="90" align="center">
<template #default="scope">
<el-button link type="danger" icon="Delete" @click="removeCalcLine(scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button @click="calcOpen = false">取消</el-button>
<el-button type="primary" @click="saveCalcToRow">保存</el-button>
</template>
</el-dialog>
</div>
</template>
@@ -94,12 +150,34 @@ const wageEntryDetailList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const total = ref(0)
const simpleMode = ref(true)
// 存储累计金额数据
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,
pageSize: 100,
entryDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
entryDate: proxy.parseTime(new Date(Date.now() - 24 * 60 * 60 * 1000), '{y}-{m}-{d}'),
empName: undefined,
billingType: undefined,
isMakeup: '0'
@@ -142,25 +220,137 @@ function round2(v) {
return Math.round(v * 100) / 100
}
const calcOpen = ref(false)
const calcTargetRow = ref(null)
const calcLines = ref([])
function safeParseCalcDetail(val) {
if (!val) return null
try {
return JSON.parse(val)
} catch (e) {
return null
}
}
function openCalcDialog(row) {
calcTargetRow.value = row
const parsed = safeParseCalcDetail(row.calcDetail)
const items = parsed && Array.isArray(parsed.items) ? parsed.items : null
if (items && items.length) {
calcLines.value = items.map(i => ({
a: i && i.a !== undefined && i.a !== null ? String(i.a) : '',
b: i && i.b !== undefined && i.b !== null ? String(i.b) : ''
}))
} else {
calcLines.value = [{ a: '', b: '' }]
}
calcOpen.value = true
}
function addCalcLine() {
calcLines.value.push({ a: '', b: '' })
}
function removeCalcLine(index) {
if (calcLines.value.length <= 1) {
calcLines.value = [{ a: '', b: '' }]
return
}
calcLines.value.splice(index, 1)
}
function lineAmount(line) {
return round2(toNumber(line?.a) * toNumber(line?.b))
}
const calcTotal = computed(() => {
const sum = calcLines.value.reduce((acc, line) => acc + lineAmount(line), 0)
return round2(sum)
})
function saveCalcToRow() {
const row = calcTargetRow.value
if (!row) {
calcOpen.value = false
return
}
const normalizedItems = calcLines.value
.map(l => ({
a: l && l.a !== undefined && l.a !== null ? String(l.a).trim() : '',
b: l && l.b !== undefined && l.b !== null ? String(l.b).trim() : ''
}))
.filter(l => l.a !== '' || l.b !== '')
row.calcAmount = calcTotal.value
row.calcDetail = JSON.stringify({ v: 1, items: normalizedItems })
recalcRowAmount(row)
row.dailyWage = normalizeEditableValue(row.totalAmount)
calcOpen.value = false
proxy.$modal.msgSuccess('明细已保存,请点击该行“保存”提交')
}
function applyDailyWage(row) {
const desired = toNumber(row.dailyWage)
const rawWorkload = toNumber(row.workload)
const workload = (row.billingType === '1' || row.billingType === '3') && rawWorkload <= 0 ? 1 : rawWorkload
const unitPrice = toNumber(row.unitPrice)
const calcAmount = toNumber(row.calcAmount)
const baseAmount = round2(workload * unitPrice)
const extraAmount = round2(desired - baseAmount - calcAmount)
row.extraAmount = extraAmount
recalcRowAmount(row)
}
function recalcRowAmount(row) {
const workload = toNumber(row.workload)
const rawWorkload = toNumber(row.workload)
const workload = (row.billingType === '1' || row.billingType === '3') && rawWorkload <= 0 ? 1 : rawWorkload
const unitPrice = row.billingType === '2' ? toNumber(row.unitPrice) : toNumber(row.unitPrice)
const extraAmount = toNumber(row.extraAmount)
const calcAmount = toNumber(row.calcAmount)
const baseAmount = round2(workload * unitPrice)
row.baseAmount = baseAmount
row.totalAmount = round2(baseAmount + extraAmount)
row.totalAmount = round2(baseAmount + extraAmount + calcAmount)
// 重新计算累计金额
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),
calcAmount: row.calcAmount ?? 0,
calcDetail: row.calcDetail,
dailyWage: normalizeEditableValue(row.totalAmount),
cumulativeAmount: cumulativeAmounts.value[row.empName] || 0
}
recalcRowAmount(r)
return r
@@ -178,7 +368,7 @@ function handleQuery() {
function resetQuery() {
proxy.resetForm('queryRef')
queryParams.value.entryDate = proxy.parseTime(new Date(), '{y}-{m}-{d}')
queryParams.value.entryDate = proxy.parseTime(new Date(Date.now() - 24 * 60 * 60 * 1000), '{y}-{m}-{d}')
queryParams.value.isMakeup = '0'
handleQuery()
}
@@ -191,6 +381,9 @@ function buildRowPayload(row) {
if (payload.extraAmount === '' || payload.extraAmount === null || payload.extraAmount === undefined) {
payload.extraAmount = 0
}
if (payload.calcAmount === '' || payload.calcAmount === null || payload.calcAmount === undefined) {
payload.calcAmount = 0
}
if (payload.billingType !== '2') {
payload.unitPrice = null
} else if (payload.unitPrice === '' || payload.unitPrice === null || payload.unitPrice === undefined) {
@@ -202,6 +395,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 +419,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 +452,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 +478,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()
})

View File

@@ -30,25 +30,30 @@
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
<el-table v-loading="loading" :data="list">
<el-table-column label="业务日期" align="center" prop="entryDate" width="120" />
<el-table-column label="员工姓名" align="center" prop="empName" width="120" />
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
<el-table v-loading="loading" :data="list" style="width: 100%">
<el-table-column label="业务日期" align="center" prop="entryDate" width="130" />
<el-table-column label="员工姓名" align="center" prop="empName" width="140" />
<el-table-column v-if="!simpleMode" label="计费类型" align="center" prop="billingType" width="100">
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
</el-table-column>
<el-table-column label="工种" align="center" prop="workTypeName" min-width="140" />
<el-table-column label="工作时间/加工数量" align="center" prop="workload" width="140" />
<el-table-column label="单价" align="center" prop="unitPrice" width="110" />
<el-table-column label="奖惩金额" align="center" prop="extraAmount" width="130" />
<el-table-column label="奖惩原因" align="center" prop="extraReason" min-width="160" :show-overflow-tooltip="true" />
<el-table-column v-if="!simpleMode" label="工种" align="center" prop="workTypeName" min-width="140" />
<el-table-column label="每天工资" align="center" min-width="120">
<template #default="scope">{{ formatAmount(scope.row.totalAmount) }}</template>
</el-table-column>
<el-table-column label="当天金额" align="center" min-width="150">
<template #default="scope">{{ formatAmount(scope.row.totalAmount) }}</template>
</el-table-column>
<el-table-column label="累计金额" align="center" min-width="150">
<template #default="scope">{{ formatAmount(scope.row.cumulativeAmount) }}</template>
</el-table-column>
<el-table-column label="补录状态" align="center" prop="isMakeup" width="100">
<template #default="scope">
<el-tag :type="scope.row.isMakeup === '1' ? 'warning' : 'info'">{{ scope.row.isMakeup === '1' ? '已补录' : '未补录' }}</el-tag>
</template>
</el-table-column>
<el-table-column label="补录责任人" align="center" prop="makeupResponsible" width="120" />
<el-table-column label="补录原因" align="center" prop="makeupReason" min-width="180" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="220">
<el-table-column v-if="!simpleMode" label="补录责任人" align="center" prop="makeupResponsible" width="120" />
<el-table-column v-if="!simpleMode" label="补录原因" align="center" prop="makeupReason" min-width="180" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" min-width="140">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleMakeup(scope.row)">补录</el-button>
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
@@ -61,21 +66,10 @@
<el-dialog :title="title" v-model="open" width="640px" append-to-body>
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
<el-form-item label="业务日期" prop="entryDate">
<el-date-picker clearable v-model="form.entryDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
<el-date-picker clearable v-model="form.entryDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" disabled />
</el-form-item>
<el-form-item label="员工姓名" prop="empName"><el-input v-model="form.empName" /></el-form-item>
<el-form-item label="计费类型" prop="billingType">
<el-select v-model="form.billingType" style="width: 100%">
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
<el-option label="天工" value="3" />
</el-select>
</el-form-item>
<el-form-item label="工种" prop="workTypeName"><el-input v-model="form.workTypeName" /></el-form-item>
<el-form-item :label="form.billingType === '2' ? '加工数量' : '工作时间'" prop="workload"><el-input v-model="form.workload" /></el-form-item>
<el-form-item label="单价" prop="unitPrice" v-if="form.billingType === '2'"><el-input v-model="form.unitPrice" placeholder="元/件" /></el-form-item>
<el-form-item label="奖惩金额" prop="extraAmount"><el-input v-model="form.extraAmount" placeholder="负数为惩罚金额" /></el-form-item>
<el-form-item label="奖惩原因" prop="extraReason"><el-input v-model="form.extraReason" placeholder="请输入奖惩原因" /></el-form-item>
<el-form-item label="员工姓名" prop="empName"><el-input v-model="form.empName" disabled /></el-form-item>
<el-form-item label="每天工资" prop="dailyWage"><el-input v-model="form.dailyWage" placeholder="请输入每天工资" /></el-form-item>
<el-form-item label="补录原因" prop="makeupReason"><el-input type="textarea" v-model="form.makeupReason" /></el-form-item>
</el-form>
<template #footer>
@@ -91,6 +85,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()
@@ -101,22 +96,42 @@ const showSearch = ref(true)
const open = ref(false)
const title = ref('')
const buttonLoading = ref(false)
const simpleMode = ref(true)
// 存储累计金额数据
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: {
pageNum: 1,
pageSize: 50,
entryDate: undefined,
entryDate: proxy.parseTime(new Date(Date.now() - 24 * 60 * 60 * 1000), '{y}-{m}-{d}'),
empName: undefined,
makeupView: 'all'
},
rules: {
entryDate: [{ required: true, message: '业务日期不能为空', trigger: 'change' }],
empId: [{ required: true, message: '员工ID不能为空', trigger: 'blur' }],
billingType: [{ required: true, message: '计费类型不能为空', trigger: 'change' }],
rateId: [{ required: true, message: '费率ID不能为空', trigger: 'blur' }],
workload: [{ required: true, message: '工作量不能为空', trigger: 'blur' }],
dailyWage: [{ required: true, message: '每天工资不能为空', trigger: 'blur' }],
makeupReason: [{ required: true, message: '补录原因不能为空', trigger: 'blur' }]
}
})
@@ -130,6 +145,25 @@ function formatBillingType(type) {
return '-'
}
function toNumber(v) {
const n = Number(v)
return Number.isFinite(n) ? n : 0
}
function round2(v) {
return Math.round(v * 100) / 100
}
function normalizeEditableValue(v) {
if (v === null || v === undefined) return ''
if (String(v) === '0' || String(v) === '0.00') return ''
return v
}
function formatAmount(v) {
return round2(toNumber(v))
}
function buildQuery() {
const q = {
pageNum: queryParams.value.pageNum,
@@ -146,7 +180,11 @@ function buildQuery() {
function getList() {
loading.value = true
listWageEntryDetail(buildQuery()).then(res => {
list.value = res.rows || []
const rows = res.rows || []
list.value = rows.map(r => ({
...r,
cumulativeAmount: cumulativeAmounts.value[r.empName] || 0
}))
total.value = res.total || 0
}).finally(() => {
loading.value = false
@@ -181,7 +219,9 @@ function handleMakeup(row) {
isMakeup: '1',
makeupResponsibleId: userStore.id || row.makeupResponsibleId || null,
makeupResponsible: userStore.nickName || row.makeupResponsible || null,
makeupReason: row.makeupReason || null
makeupReason: row.makeupReason || null,
dailyWage: normalizeEditableValue(row.totalAmount),
originalTotalAmount: toNumber(row.totalAmount)
}
title.value = '补录 补录负责人:'+form.value.makeupResponsible
open.value = true
@@ -191,12 +231,23 @@ function submitForm() {
proxy.$refs.formRef.validate(valid => {
if (!valid) return
buttonLoading.value = true
const payload = {
...form.value,
isMakeup: '1'
}
const payload = { ...form.value, isMakeup: '1' }
const desired = toNumber(payload.dailyWage)
const rawWorkload = toNumber(payload.workload)
const workload = (payload.billingType === '1' || payload.billingType === '3') && rawWorkload <= 0 ? 1 : rawWorkload
const unitPrice = toNumber(payload.unitPrice)
const calcAmount = toNumber(payload.calcAmount)
const baseAmount = round2(workload * unitPrice)
payload.extraAmount = round2(desired - baseAmount - calcAmount)
// 本页面补录语义:更新当前记录并标记为已补录
updateWageEntryDetail(payload).then(() => {
const oldTotal = toNumber(payload.originalTotalAmount)
const nextTotal = toNumber(payload.totalAmount || desired)
const diff = nextTotal - oldTotal
cumulativeAmounts.value[payload.empName] = toNumber(cumulativeAmounts.value[payload.empName]) + diff
saveCumulativeAmounts()
proxy.$modal.msgSuccess('补录成功')
open.value = false
getList()
@@ -220,7 +271,7 @@ function handleQuery() {
function resetQuery() {
proxy.resetForm('queryRef')
queryParams.value.entryDate = undefined
queryParams.value.entryDate = proxy.parseTime(new Date(Date.now() - 24 * 60 * 60 * 1000), '{y}-{m}-{d}')
queryParams.value.makeupView = 'all'
handleQuery()
}
@@ -229,5 +280,8 @@ function handleExport() {
proxy.download('oa/wageEntryDetail/export', { ...buildQuery() }, `wage_makeup_${new Date().getTime()}.xlsx`)
}
onMounted(() => {
loadCumulativeAmounts()
getList()
})
</script>

View File

@@ -19,27 +19,24 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5"><el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button></el-col>
<el-col :span="1.5"><el-button size="small" type="info" plain icon="Upload" @click="openImport">导入</el-button></el-col>
<el-col :span="1.8"><el-button size="small" plain icon="Download" @click="downloadTemplate">下载模板</el-button></el-col>
<el-col :span="2.2"><el-button size="small" type="primary" plain icon="User" @click="openUserSelectDialog">选择用户导入</el-button></el-col>
<div class="worker-toolbar mb8">
<el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
<el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
<el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
<el-button size="small" type="info" plain icon="Upload" @click="openImport">导入</el-button>
<el-button size="small" plain icon="Download" @click="downloadTemplate">下载模板</el-button>
<el-button size="small" type="primary" plain icon="User" @click="openUserSelectDialog">选择用户导入</el-button>
<div class="toolbar-right">
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
</el-row>
</div>
</div>
<el-table v-loading="loading" :data="workerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="工号" align="center" prop="workerNo" width="140" />
<el-table-column label="姓名" align="center" prop="workerName" width="120" />
<el-table-column label="手机号" align="center" prop="phone" width="140" />
<el-table-column label="默认计费类型" align="center" prop="defaultBillingType" width="120">
<template #default="scope">{{ formatBillingType(scope.row.defaultBillingType) }}</template>
</el-table-column>
<el-table-column label="默认工种" align="center" prop="defaultWorkTypeName" min-width="140" />
<el-table-column label="状态" align="center" prop="status" width="100">
<template #default="scope"><el-tag :type="scope.row.status === '0' ? 'success' : 'info'">{{ scope.row.status === '0' ? '在职' : '离职' }}</el-tag></template>
</el-table-column>
@@ -62,25 +59,6 @@
<el-form-item label="姓名" prop="workerName"><el-input v-model="form.workerName" placeholder="请输入姓名" /></el-form-item>
<el-form-item label="手机号" prop="phone"><el-input v-model="form.phone" placeholder="请输入手机号" /></el-form-item>
<el-form-item label="默认工种" prop="selectedRateId">
<el-select v-model="form.selectedRateId" placeholder="请选择默认工种" style="width: 100%" clearable @change="handleRateChange">
<el-option
v-for="item in rateOptions"
:key="item.rateId"
:label="rateOptionLabel(item)"
:value="item.rateId"
/>
</el-select>
</el-form-item>
<el-form-item label="默认计费类型" prop="defaultBillingType">
<el-select v-model="form.defaultBillingType" placeholder="请选择" style="width: 100%" disabled>
<el-option label="小时工" value="1" />
<el-option label="计件工" value="2" />
<el-option label="天工" value="3" />
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio label="0">在职</el-radio>
@@ -208,8 +186,7 @@ const data = reactive({
},
rules: {
workerNo: [{ required: true, message: '工号不能为空', trigger: 'blur' }],
workerName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
selectedRateId: [{ required: true, message: '默认工种不能为空', trigger: 'change' }]
workerName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }]
}
})
@@ -309,25 +286,19 @@ function handleSelectionChange(selection) {
}
function handleAdd() {
loadRateOptions().then(() => {
reset()
open.value = true
title.value = '新增工人'
})
}
function handleUpdate(row) {
const workerId = row?.workerId || ids.value[0]
if (!workerId) return
Promise.all([loadRateOptions(), getWorker(workerId)]).then(([, response]) => {
getWorker(workerId).then((response) => {
form.value = {
...response.data,
selectedRateId: null
}
const matched = rateOptions.value.find(i => i.rateName === form.value.defaultWorkTypeName && i.billingType === form.value.defaultBillingType)
if (matched) {
form.value.selectedRateId = matched.rateId
}
open.value = true
title.value = '修改工人'
})
@@ -488,3 +459,21 @@ async function confirmImportSelectedUser() {
}
getList()
</script>
<style scoped>
.worker-toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
}
.toolbar-right {
margin-left: auto;
}
:deep(.el-table .el-table__cell) {
padding-top: 8px;
padding-bottom: 8px;
}
</style>

View File

View 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);

View File

View File

View File

View File

View File

View File

View File

View File

View File

@@ -0,0 +1 @@
INSERT INTO `ACT_ID_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('schema.version', '6.7.2.0', 1);

View File

View File

View File

View File

View File

Some files were not shown because too many files have changed in this diff Show More