Compare commits
18 Commits
897c690996
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe13e952f2 | ||
| 539889a346 | |||
| 6eca9768cc | |||
| 6d9f24bfd4 | |||
|
|
1ce1ffad5a | ||
|
|
1fe6e030d4 | ||
|
|
96a1f9f9bc | ||
| 2099a01bc1 | |||
| d5c1c1485c | |||
| 2aa0ae83c2 | |||
| 774fe86941 | |||
|
|
d02ef34751 | ||
|
|
2e7a50bf64 | ||
|
|
3ae6403bd3 | ||
|
|
855dbbe099 | ||
| f41a17c885 | |||
|
|
6aa1d581e7 | ||
|
|
595b9fbd68 |
194
.cursor/skills/ruoyi-industrial-dashboard-style/SKILL.md
Normal file
194
.cursor/skills/ruoyi-industrial-dashboard-style/SKILL.md
Normal 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.
|
||||||
@@ -105,13 +105,13 @@ spring:
|
|||||||
spring:
|
spring:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
host: localhost
|
host: 49.232.154.205
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 数据库索引
|
# 数据库索引
|
||||||
database: 0
|
database: 0
|
||||||
# 密码(如没有密码请注释掉)
|
# 密码(如没有密码请注释掉)
|
||||||
# password:
|
password: WANGyu11!
|
||||||
# 连接超时时间
|
# 连接超时时间
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
# 是否开启ssl
|
# 是否开启ssl
|
||||||
@@ -128,7 +128,7 @@ redisson:
|
|||||||
singleServerConfig:
|
singleServerConfig:
|
||||||
# 客户端名称
|
# 客户端名称
|
||||||
clientName: ${ruoyi.name}
|
clientName: ${ruoyi.name}
|
||||||
# 最小空闲连接数
|
# 最小空闲连接数ACT_ID_PROPERTY
|
||||||
connectionMinimumIdleSize: 32
|
connectionMinimumIdleSize: 32
|
||||||
# 连接池大小
|
# 连接池大小
|
||||||
connectionPoolSize: 64
|
connectionPoolSize: 64
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
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.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品属性附加表Controller
|
||||||
|
*
|
||||||
|
* @author gear
|
||||||
|
* @date 2026-04-22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/mat/productAddition")
|
||||||
|
public class MatProductAdditionController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMatProductAdditionService productAdditionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询产品属性附加表列表
|
||||||
|
*
|
||||||
|
* @param productAdditionBo 产品属性附加表业务对象
|
||||||
|
* @return 产品属性附加表列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(MatProductAdditionBo productAdditionBo) {
|
||||||
|
List<MatProductAdditionVo> list = productAdditionService.listProductAddition(productAdditionBo);
|
||||||
|
return TableDataInfo.build(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增产品属性附加表
|
||||||
|
*/
|
||||||
|
@Log(title = "产品属性附加表", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public R<Boolean> add(@RequestBody MatProductAdditionBo productAdditionBo) {
|
||||||
|
boolean result = productAdditionService.addProductAddition(productAdditionBo);
|
||||||
|
return R.ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改产品属性附加表
|
||||||
|
*/
|
||||||
|
@Log(title = "产品属性附加表", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public R<Boolean> update(@RequestBody MatProductAdditionBo productAdditionBo) {
|
||||||
|
boolean result = productAdditionService.updateProductAddition(productAdditionBo);
|
||||||
|
return R.ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除产品属性附加表
|
||||||
|
*
|
||||||
|
* @param addId 主键ID
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
@Log(title = "产品属性附加表", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{addId}")
|
||||||
|
public R<Boolean> del(@PathVariable Long addId) {
|
||||||
|
boolean result = productAdditionService.delProductAddition(addId);
|
||||||
|
return R.ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,6 +32,10 @@ public class MatMaterial extends BaseEntity {
|
|||||||
* 配料名称
|
* 配料名称
|
||||||
*/
|
*/
|
||||||
private String materialName;
|
private String materialName;
|
||||||
|
/**
|
||||||
|
* 物料类型:1=辅料,2=原料
|
||||||
|
*/
|
||||||
|
private Integer materialType;
|
||||||
/**
|
/**
|
||||||
* 配料规格
|
* 配料规格
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -54,4 +54,14 @@ public class MatProduct extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片,多个图片以逗号分隔
|
||||||
|
*/
|
||||||
|
private String productImages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品说明书,多个PDF以逗号分隔
|
||||||
|
*/
|
||||||
|
private String productPdfs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.gear.mat.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.gear.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品属性附加表
|
||||||
|
*
|
||||||
|
* @author gear
|
||||||
|
* @date 2026-04-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("gear_product_addition")
|
||||||
|
public class MatProductAddition extends BaseEntity {
|
||||||
|
/** 主键ID */
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long addId;
|
||||||
|
|
||||||
|
/** 属性名 */
|
||||||
|
private String attrName;
|
||||||
|
|
||||||
|
/** 属性值 */
|
||||||
|
private String attrValue;
|
||||||
|
|
||||||
|
/** 产品ID */
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/** 删除标识 0-未删除 1-已删除 */
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.gear.mat.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.gear.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("gear_product_labor")
|
||||||
|
public class MatProductLabor extends BaseEntity {
|
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long laborId;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
private String laborName;
|
||||||
|
|
||||||
|
private BigDecimal laborPrice;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
}
|
||||||
@@ -32,6 +32,11 @@ public class MatMaterialBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String materialName;
|
private String materialName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料类型:1=辅料,2=原料
|
||||||
|
*/
|
||||||
|
private Integer materialType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配料规格
|
* 配料规格
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.gear.mat.domain.bo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品属性附加表业务对象
|
||||||
|
*
|
||||||
|
* @author gear
|
||||||
|
* @date 2026-04-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MatProductAdditionBo {
|
||||||
|
/** 主键ID */
|
||||||
|
private Long addId;
|
||||||
|
|
||||||
|
/** 属性名 */
|
||||||
|
private String attrName;
|
||||||
|
|
||||||
|
/** 属性值 */
|
||||||
|
private String attrValue;
|
||||||
|
|
||||||
|
/** 产品ID */
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -52,5 +52,14 @@ public class MatProductBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片,多个图片以逗号分隔
|
||||||
|
*/
|
||||||
|
private String productImages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品说明书,多个PDF以逗号分隔
|
||||||
|
*/
|
||||||
|
private String productPdfs;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.gear.mat.domain.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MatProductLaborBo {
|
||||||
|
|
||||||
|
private Long laborId;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
private String laborName;
|
||||||
|
|
||||||
|
private BigDecimal laborPrice;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -34,6 +34,12 @@ public class MatMaterialVo {
|
|||||||
@ExcelProperty(value = "配料名称")
|
@ExcelProperty(value = "配料名称")
|
||||||
private String materialName;
|
private String materialName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料类型:1=辅料,2=原料
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "物料类型")
|
||||||
|
private Integer materialType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配料规格
|
* 配料规格
|
||||||
*/
|
*/
|
||||||
@@ -65,6 +71,11 @@ public class MatMaterialVo {
|
|||||||
@ExcelDictFormat(readConverterExp = "已=入库")
|
@ExcelDictFormat(readConverterExp = "已=入库")
|
||||||
private BigDecimal currentStock;
|
private BigDecimal currentStock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价(用于成本测算:默认取最新入库单价,其次取最新采购单价)
|
||||||
|
*/
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.gear.mat.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品属性附加表视图对象
|
||||||
|
*
|
||||||
|
* @author gear
|
||||||
|
* @date 2026-04-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class MatProductAdditionVo {
|
||||||
|
/** 主键ID */
|
||||||
|
private Long addId;
|
||||||
|
|
||||||
|
/** 属性名 */
|
||||||
|
private String attrName;
|
||||||
|
|
||||||
|
/** 属性值 */
|
||||||
|
private String attrValue;
|
||||||
|
|
||||||
|
/** 产品ID */
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 创建人 */
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/** 更新人 */
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.gear.mat.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MatProductLaborVo {
|
||||||
|
|
||||||
|
private Long laborId;
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
private String laborName;
|
||||||
|
|
||||||
|
private BigDecimal laborPrice;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -58,5 +58,17 @@ public class MatProductVo {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片,多个图片以逗号分隔
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品图片")
|
||||||
|
private String productImages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品说明书,多个PDF以逗号分隔
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品说明书")
|
||||||
|
private String productPdfs;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,18 @@ public class MatProductWithMaterialsVo {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品图片,多个图片以逗号分隔
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品图片")
|
||||||
|
private String productImages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品PDF文件,多个PDF以逗号分隔
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "产品PDF文件")
|
||||||
|
private String productPdfs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联的配料信息列表
|
* 关联的配料信息列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.gear.mat.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gear.mat.domain.MatProductAddition;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品属性附加表Mapper接口
|
||||||
|
*
|
||||||
|
* @author gear
|
||||||
|
* @date 2026-04-22
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MatProductAdditionMapper extends BaseMapper<MatProductAddition> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.gear.mat.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.gear.mat.domain.MatProductLabor;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MatProductLaborMapper extends BaseMapper<MatProductLabor> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.gear.mat.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.gear.mat.domain.MatProductAddition;
|
||||||
|
import com.gear.mat.domain.bo.MatProductAdditionBo;
|
||||||
|
import com.gear.mat.domain.vo.MatProductAdditionVo;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品属性附加表Service接口
|
||||||
|
*
|
||||||
|
* @author gear
|
||||||
|
* @date 2026-04-22
|
||||||
|
*/
|
||||||
|
public interface IMatProductAdditionService extends IService<MatProductAddition> {
|
||||||
|
/**
|
||||||
|
* 查询产品属性附加表列表
|
||||||
|
*
|
||||||
|
* @param productAdditionBo 产品属性附加表业务对象
|
||||||
|
* @return 产品属性附加表列表
|
||||||
|
*/
|
||||||
|
List<MatProductAdditionVo> listProductAddition(MatProductAdditionBo productAdditionBo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增产品属性附加表
|
||||||
|
*
|
||||||
|
* @param productAdditionBo 产品属性附加表业务对象
|
||||||
|
* @return 新增结果
|
||||||
|
*/
|
||||||
|
boolean addProductAddition(MatProductAdditionBo productAdditionBo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改产品属性附加表
|
||||||
|
*
|
||||||
|
* @param productAdditionBo 产品属性附加表业务对象
|
||||||
|
* @return 修改结果
|
||||||
|
*/
|
||||||
|
boolean updateProductAddition(MatProductAdditionBo productAdditionBo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除产品属性附加表
|
||||||
|
*
|
||||||
|
* @param addId 主键ID
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
boolean delProductAddition(Long addId);
|
||||||
|
|
||||||
|
boolean batchSaveProductAddition(Long productId, List<MatProductAdditionBo> items);
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -49,7 +49,41 @@ public class MatMaterialServiceImpl implements IMatMaterialService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public MatMaterialVo queryById(Long materialId){
|
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();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<MatMaterial> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<MatMaterial> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getMaterialName()), MatMaterial::getMaterialName, bo.getMaterialName());
|
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.getSpec()), MatMaterial::getSpec, bo.getSpec());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getModel()), MatMaterial::getModel, bo.getModel());
|
lqw.eq(StringUtils.isNotBlank(bo.getModel()), MatMaterial::getModel, bo.getModel());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getFactory()), MatMaterial::getFactory, bo.getFactory());
|
lqw.eq(StringUtils.isNotBlank(bo.getFactory()), MatMaterial::getFactory, bo.getFactory());
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
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.List;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -112,6 +112,8 @@ public class MatProductServiceImpl implements IMatProductService {
|
|||||||
productWithMaterialsVo.setModel(productVo.getModel());
|
productWithMaterialsVo.setModel(productVo.getModel());
|
||||||
productWithMaterialsVo.setUnitPrice(productVo.getUnitPrice());
|
productWithMaterialsVo.setUnitPrice(productVo.getUnitPrice());
|
||||||
productWithMaterialsVo.setRemark(productVo.getRemark());
|
productWithMaterialsVo.setRemark(productVo.getRemark());
|
||||||
|
productWithMaterialsVo.setProductImages(productVo.getProductImages());
|
||||||
|
productWithMaterialsVo.setProductPdfs(productVo.getProductPdfs());
|
||||||
|
|
||||||
// 查询并设置关联的配料信息
|
// 查询并设置关联的配料信息
|
||||||
List<MatProductMaterialRelationVo> relations = productMaterialRelationService.queryList(
|
List<MatProductMaterialRelationVo> relations = productMaterialRelationService.queryList(
|
||||||
@@ -168,7 +170,9 @@ public class MatProductServiceImpl implements IMatProductService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(MatProductBo bo) {
|
public Boolean insertByBo(MatProductBo bo) {
|
||||||
|
System.out.println("插入产品,productPdfs: " + bo.getProductPdfs());
|
||||||
MatProduct add = BeanUtil.toBean(bo, MatProduct.class);
|
MatProduct add = BeanUtil.toBean(bo, MatProduct.class);
|
||||||
|
System.out.println("转换后,productPdfs: " + add.getProductPdfs());
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -182,7 +186,9 @@ public class MatProductServiceImpl implements IMatProductService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(MatProductBo bo) {
|
public Boolean updateByBo(MatProductBo bo) {
|
||||||
|
System.out.println("修改产品,productPdfs: " + bo.getProductPdfs());
|
||||||
MatProduct update = BeanUtil.toBean(bo, MatProduct.class);
|
MatProduct update = BeanUtil.toBean(bo, MatProduct.class);
|
||||||
|
System.out.println("转换后,productPdfs: " + update.getProductPdfs());
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<resultMap type="com.gear.mat.domain.MatMaterial" id="MatMaterialResult">
|
<resultMap type="com.gear.mat.domain.MatMaterial" id="MatMaterialResult">
|
||||||
<result property="materialId" column="material_id"/>
|
<result property="materialId" column="material_id"/>
|
||||||
<result property="materialName" column="material_name"/>
|
<result property="materialName" column="material_name"/>
|
||||||
|
<result property="materialType" column="material_type"/>
|
||||||
<result property="spec" column="spec"/>
|
<result property="spec" column="spec"/>
|
||||||
<result property="model" column="model"/>
|
<result property="model" column="model"/>
|
||||||
<result property="factory" column="factory"/>
|
<result property="factory" column="factory"/>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="updateTime" column="update_time"/>
|
<result property="updateTime" column="update_time"/>
|
||||||
<result property="updateBy" column="update_by"/>
|
<result property="updateBy" column="update_by"/>
|
||||||
<result property="remark" column="remark"/>
|
<result property="remark" column="remark"/>
|
||||||
|
<!-- <result property="productImages" column="product_images"/>-->
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -93,4 +93,6 @@ public class GearWorkerController extends BaseController {
|
|||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] workerIds) {
|
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] workerIds) {
|
||||||
return toAjax(iGearWorkerService.deleteWithValidByIds(Arrays.asList(workerIds), true));
|
return toAjax(iGearWorkerService.deleteWithValidByIds(Arrays.asList(workerIds), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,16 @@ public class GearWageEntryDetail extends BaseEntity {
|
|||||||
|
|
||||||
private String extraReason;
|
private String extraReason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细计算金额(多行乘法合计)
|
||||||
|
*/
|
||||||
|
private BigDecimal calcAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 明细计算行JSON(两列乘法)
|
||||||
|
*/
|
||||||
|
private String calcDetail;
|
||||||
|
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ import com.gear.common.core.domain.BaseEntity;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
|
||||||
* 工人主数据对象 gear_worker
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("gear_worker")
|
@TableName("gear_worker")
|
||||||
@@ -26,19 +23,16 @@ public class GearWorker extends BaseEntity {
|
|||||||
|
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
|
||||||
* 默认计费类型(1小时工 2计件工 3天工)
|
|
||||||
*/
|
|
||||||
private String defaultBillingType;
|
private String defaultBillingType;
|
||||||
|
|
||||||
private String defaultWorkTypeName;
|
private String defaultWorkTypeName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态(0在职 1离职)
|
|
||||||
*/
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@TableLogic
|
/**
|
||||||
|
* 逻辑删除标记:0-未删除,2-已删除
|
||||||
|
*/
|
||||||
|
@TableLogic(value = "0", delval = "2")
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import javax.validation.constraints.NotBlank;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工资录入明细业务对象 gear_wage_entry_detail
|
* 工资录入明细业务对象 gear_wage_entry_detail
|
||||||
@@ -58,6 +59,10 @@ public class GearWageEntryDetailBo extends BaseEntity {
|
|||||||
|
|
||||||
private String extraReason;
|
private String extraReason;
|
||||||
|
|
||||||
|
private BigDecimal calcAmount;
|
||||||
|
|
||||||
|
private String calcDetail;
|
||||||
|
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
private String isMakeup;
|
private String isMakeup;
|
||||||
@@ -71,4 +76,6 @@ public class GearWageEntryDetailBo extends BaseEntity {
|
|||||||
private String makeupReason;
|
private String makeupReason;
|
||||||
|
|
||||||
private String remark;
|
private String remark;
|
||||||
|
// 新增累计金额
|
||||||
|
private Map<String, BigDecimal> cumulativeAmounts;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ public class GearWageEntryDetailVo {
|
|||||||
@ExcelProperty(value = "额外原因")
|
@ExcelProperty(value = "额外原因")
|
||||||
private String extraReason;
|
private String extraReason;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "明细计算金额")
|
||||||
|
private BigDecimal calcAmount;
|
||||||
|
|
||||||
|
private String calcDetail;
|
||||||
|
|
||||||
@ExcelProperty(value = "总金额")
|
@ExcelProperty(value = "总金额")
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
@@ -77,4 +82,6 @@ public class GearWageEntryDetailVo {
|
|||||||
|
|
||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
@ExcelProperty(value = "累计金额")
|
||||||
|
private BigDecimal cumulativeAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,40 @@ package com.gear.oa.mapper;
|
|||||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||||
import com.gear.oa.domain.GearWorker;
|
import com.gear.oa.domain.GearWorker;
|
||||||
import com.gear.oa.domain.vo.GearWorkerVo;
|
import com.gear.oa.domain.vo.GearWorkerVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import org.apache.ibatis.annotations.Update;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工人主数据Mapper接口
|
* 工人主数据Mapper接口
|
||||||
*/
|
*/
|
||||||
public interface GearWorkerMapper extends BaseMapperPlus<GearWorkerMapper, GearWorker, GearWorkerVo> {
|
public interface GearWorkerMapper extends BaseMapperPlus<GearWorkerMapper, GearWorker, GearWorkerVo> {
|
||||||
|
/**
|
||||||
|
* 根据工号查询所有记录(包括逻辑删除的),绕过 MyBatis-Plus 自动过滤
|
||||||
|
*
|
||||||
|
* @param workerNo 工号
|
||||||
|
* @return 工人记录(可能为 null)
|
||||||
|
*/
|
||||||
|
@Select("SELECT * FROM gear_worker WHERE worker_no = #{workerNo}")
|
||||||
|
GearWorker selectByWorkerNoIncludeDeleted(@Param("workerNo") String workerNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 强制恢复并更新已删除的工人记录
|
||||||
|
* 直接将 del_flag 更新为 0,并更新其他字段
|
||||||
|
*
|
||||||
|
* @param worker 包含新数据的工人对象(必须包含 workerNo 和需要更新的字段)
|
||||||
|
* @return 影响行数
|
||||||
|
*/
|
||||||
|
@Update("UPDATE gear_worker SET " +
|
||||||
|
"worker_name = #{workerName}, " +
|
||||||
|
"phone = #{phone}, " +
|
||||||
|
"default_billing_type = #{defaultBillingType}, " +
|
||||||
|
"default_work_type_name = #{defaultWorkTypeName}, " +
|
||||||
|
"status = #{status}, " +
|
||||||
|
"del_flag = '0', " +
|
||||||
|
"remark = #{remark}, " +
|
||||||
|
"update_by = #{updateBy}, " +
|
||||||
|
"update_time = NOW() " +
|
||||||
|
"WHERE worker_no = #{workerNo}")
|
||||||
|
int recoverByWorkerNo(GearWorker worker);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.gear.common.core.domain.PageQuery;
|
import com.gear.common.core.domain.PageQuery;
|
||||||
import com.gear.common.core.page.TableDataInfo;
|
import com.gear.common.core.page.TableDataInfo;
|
||||||
import com.gear.common.helper.LoginHelper;
|
import com.gear.common.helper.LoginHelper;
|
||||||
|
import com.gear.common.utils.DateUtils;
|
||||||
import com.gear.common.utils.StringUtils;
|
import com.gear.common.utils.StringUtils;
|
||||||
import com.gear.oa.domain.GearWageEntryDetail;
|
import com.gear.oa.domain.GearWageEntryDetail;
|
||||||
import com.gear.oa.domain.GearWageRateConfig;
|
import com.gear.oa.domain.GearWageRateConfig;
|
||||||
@@ -23,7 +24,10 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工资录入明细Service业务层处理
|
* 工资录入明细Service业务层处理
|
||||||
@@ -44,15 +48,96 @@ public class GearWageEntryDetailServiceImpl implements IGearWageEntryDetailServi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<GearWageEntryDetailVo> queryPageList(GearWageEntryDetailBo bo, PageQuery pageQuery) {
|
public TableDataInfo<GearWageEntryDetailVo> queryPageList(GearWageEntryDetailBo bo, PageQuery pageQuery) {
|
||||||
|
syncTodayWorkers(bo.getEntryDate());
|
||||||
LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
|
||||||
Page<GearWageEntryDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<GearWageEntryDetailVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<GearWageEntryDetailVo> queryList(GearWageEntryDetailBo bo) {
|
||||||
|
// LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
|
||||||
|
// return baseMapper.selectVoList(lqw);
|
||||||
|
//
|
||||||
|
// }
|
||||||
@Override
|
@Override
|
||||||
public List<GearWageEntryDetailVo> queryList(GearWageEntryDetailBo bo) {
|
public List<GearWageEntryDetailVo> queryList(GearWageEntryDetailBo bo) {
|
||||||
LambdaQueryWrapper<GearWageEntryDetail> lqw = buildQueryWrapper(bo);
|
syncTodayWorkers(bo.getEntryDate());
|
||||||
return baseMapper.selectVoList(lqw);
|
// 将 selectList 改为 selectVoList
|
||||||
|
List<GearWageEntryDetailVo> list = baseMapper.selectVoList(buildQueryWrapper(bo));
|
||||||
|
// 处理累计金额
|
||||||
|
if (bo.getCumulativeAmounts() != null) {
|
||||||
|
for (GearWageEntryDetailVo vo : list) {
|
||||||
|
vo.setCumulativeAmount(bo.getCumulativeAmounts().get(vo.getEmpName()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncTodayWorkers(Date entryDate) {
|
||||||
|
if (entryDate == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!DateUtils.isSameDay(entryDate, DateUtils.getNowDate())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
java.sql.Date date = new java.sql.Date(entryDate.getTime());
|
||||||
|
|
||||||
|
List<GearWageEntryDetail> existList = baseMapper.selectList(Wrappers.<GearWageEntryDetail>lambdaQuery()
|
||||||
|
.select(GearWageEntryDetail::getEmpId, GearWageEntryDetail::getBillingType, GearWageEntryDetail::getRateId, GearWageEntryDetail::getOrderNo)
|
||||||
|
.eq(GearWageEntryDetail::getEntryDate, date)
|
||||||
|
.eq(GearWageEntryDetail::getOrderNo, ""));
|
||||||
|
|
||||||
|
Set<String> existKeys = new HashSet<>();
|
||||||
|
for (GearWageEntryDetail d : existList) {
|
||||||
|
existKeys.add(buildDailyKey(d.getEmpId(), d.getBillingType(), d.getRateId(), d.getOrderNo()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<GearWorker> workers = gearWorkerMapper.selectList(Wrappers.<GearWorker>lambdaQuery()
|
||||||
|
.eq(GearWorker::getStatus, "0")
|
||||||
|
.orderByAsc(GearWorker::getWorkerNo));
|
||||||
|
|
||||||
|
for (GearWorker worker : workers) {
|
||||||
|
String billingType = StringUtils.isBlank(worker.getDefaultBillingType()) ? "1" : worker.getDefaultBillingType();
|
||||||
|
GearWageRateConfig rateConfig = gearWageRateConfigMapper.selectOne(Wrappers.<GearWageRateConfig>lambdaQuery()
|
||||||
|
.eq(GearWageRateConfig::getBillingType, billingType)
|
||||||
|
.eq(StringUtils.isNotBlank(worker.getDefaultWorkTypeName()), GearWageRateConfig::getRateName, worker.getDefaultWorkTypeName())
|
||||||
|
.eq(GearWageRateConfig::getStatus, "0")
|
||||||
|
.last("limit 1"));
|
||||||
|
Long rateId = rateConfig == null ? 0L : rateConfig.getRateId();
|
||||||
|
String orderNo = "";
|
||||||
|
|
||||||
|
String key = buildDailyKey(worker.getWorkerId(), billingType, rateId, orderNo);
|
||||||
|
if (existKeys.contains(key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
GearWageEntryDetail detail = new GearWageEntryDetail();
|
||||||
|
detail.setEntryDate(date);
|
||||||
|
detail.setEmpId(worker.getWorkerId());
|
||||||
|
detail.setEmpName(worker.getWorkerName());
|
||||||
|
detail.setBillingType(billingType);
|
||||||
|
detail.setWorkTypeName(StringUtils.isNotBlank(worker.getDefaultWorkTypeName()) ? worker.getDefaultWorkTypeName() : (rateConfig == null ? null : rateConfig.getRateName()));
|
||||||
|
detail.setRateId(rateId);
|
||||||
|
detail.setWorkload(BigDecimal.ZERO);
|
||||||
|
detail.setUnitPrice(rateConfig == null || rateConfig.getUnitPrice() == null ? BigDecimal.ZERO : rateConfig.getUnitPrice());
|
||||||
|
detail.setBaseAmount(BigDecimal.ZERO);
|
||||||
|
detail.setExtraAmount(BigDecimal.ZERO);
|
||||||
|
detail.setTotalAmount(BigDecimal.ZERO);
|
||||||
|
detail.setIsMakeup("0");
|
||||||
|
detail.setOrderNo(orderNo);
|
||||||
|
detail.setRemark("当日名单热更新");
|
||||||
|
try {
|
||||||
|
baseMapper.insert(detail);
|
||||||
|
existKeys.add(key);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildDailyKey(Long empId, String billingType, Long rateId, String orderNo) {
|
||||||
|
return String.valueOf(empId) + "|" + String.valueOf(billingType) + "|" + String.valueOf(rateId) + "|" + String.valueOf(orderNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<GearWageEntryDetail> buildQueryWrapper(GearWageEntryDetailBo bo) {
|
private LambdaQueryWrapper<GearWageEntryDetail> buildQueryWrapper(GearWageEntryDetailBo bo) {
|
||||||
@@ -103,6 +188,7 @@ public class GearWageEntryDetailServiceImpl implements IGearWageEntryDetailServi
|
|||||||
private void fillAmountFields(GearWageEntryDetail entity) {
|
private void fillAmountFields(GearWageEntryDetail entity) {
|
||||||
BigDecimal workload = entity.getWorkload() == null ? BigDecimal.ZERO : entity.getWorkload();
|
BigDecimal workload = entity.getWorkload() == null ? BigDecimal.ZERO : entity.getWorkload();
|
||||||
BigDecimal extraAmount = entity.getExtraAmount() == null ? BigDecimal.ZERO : entity.getExtraAmount();
|
BigDecimal extraAmount = entity.getExtraAmount() == null ? BigDecimal.ZERO : entity.getExtraAmount();
|
||||||
|
BigDecimal calcAmount = entity.getCalcAmount() == null ? BigDecimal.ZERO : entity.getCalcAmount();
|
||||||
|
|
||||||
// 小时工/天工默认按1个计量单位计算基础金额(1小时或1天)
|
// 小时工/天工默认按1个计量单位计算基础金额(1小时或1天)
|
||||||
if (("1".equals(entity.getBillingType()) || "3".equals(entity.getBillingType())) && workload.compareTo(BigDecimal.ZERO) <= 0) {
|
if (("1".equals(entity.getBillingType()) || "3".equals(entity.getBillingType())) && workload.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
@@ -127,7 +213,8 @@ public class GearWageEntryDetailServiceImpl implements IGearWageEntryDetailServi
|
|||||||
BigDecimal baseAmount = workload.multiply(unitPrice);
|
BigDecimal baseAmount = workload.multiply(unitPrice);
|
||||||
entity.setBaseAmount(baseAmount);
|
entity.setBaseAmount(baseAmount);
|
||||||
entity.setExtraAmount(extraAmount);
|
entity.setExtraAmount(extraAmount);
|
||||||
entity.setTotalAmount(baseAmount.add(extraAmount));
|
entity.setCalcAmount(calcAmount);
|
||||||
|
entity.setTotalAmount(baseAmount.add(extraAmount).add(calcAmount));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillMakeupFields(GearWageEntryDetail entity) {
|
private void fillMakeupFields(GearWageEntryDetail entity) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gear.common.core.domain.PageQuery;
|
import com.gear.common.core.domain.PageQuery;
|
||||||
import com.gear.common.core.page.TableDataInfo;
|
import com.gear.common.core.page.TableDataInfo;
|
||||||
|
import com.gear.common.exception.ServiceException;
|
||||||
import com.gear.common.utils.StringUtils;
|
import com.gear.common.utils.StringUtils;
|
||||||
import com.gear.oa.domain.GearWorker;
|
import com.gear.oa.domain.GearWorker;
|
||||||
import com.gear.oa.domain.bo.GearWorkerBo;
|
import com.gear.oa.domain.bo.GearWorkerBo;
|
||||||
@@ -14,14 +15,13 @@ import com.gear.oa.domain.vo.GearWorkerVo;
|
|||||||
import com.gear.oa.mapper.GearWorkerMapper;
|
import com.gear.oa.mapper.GearWorkerMapper;
|
||||||
import com.gear.oa.service.IGearWorkerService;
|
import com.gear.oa.service.IGearWorkerService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
@Slf4j
|
||||||
* 工人主数据Service业务层处理
|
|
||||||
*/
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class GearWorkerServiceImpl implements IGearWorkerService {
|
public class GearWorkerServiceImpl implements IGearWorkerService {
|
||||||
@@ -48,6 +48,8 @@ public class GearWorkerServiceImpl implements IGearWorkerService {
|
|||||||
|
|
||||||
private LambdaQueryWrapper<GearWorker> buildQueryWrapper(GearWorkerBo bo) {
|
private LambdaQueryWrapper<GearWorker> buildQueryWrapper(GearWorkerBo bo) {
|
||||||
LambdaQueryWrapper<GearWorker> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<GearWorker> lqw = Wrappers.lambdaQuery();
|
||||||
|
// 只查询未删除的数据(del_flag = '0')
|
||||||
|
lqw.eq(GearWorker::getDelFlag, "0");
|
||||||
lqw.eq(bo.getWorkerId() != null, GearWorker::getWorkerId, bo.getWorkerId());
|
lqw.eq(bo.getWorkerId() != null, GearWorker::getWorkerId, bo.getWorkerId());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getWorkerNo()), GearWorker::getWorkerNo, bo.getWorkerNo());
|
lqw.eq(StringUtils.isNotBlank(bo.getWorkerNo()), GearWorker::getWorkerNo, bo.getWorkerNo());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getWorkerName()), GearWorker::getWorkerName, bo.getWorkerName());
|
lqw.like(StringUtils.isNotBlank(bo.getWorkerName()), GearWorker::getWorkerName, bo.getWorkerName());
|
||||||
@@ -59,17 +61,48 @@ public class GearWorkerServiceImpl implements IGearWorkerService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(GearWorkerBo bo) {
|
public Boolean insertByBo(GearWorkerBo bo) {
|
||||||
|
// 使用自定义方法查询所有记录(包括逻辑删除的)
|
||||||
|
GearWorker existing = baseMapper.selectByWorkerNoIncludeDeleted(bo.getWorkerNo());
|
||||||
|
|
||||||
|
if (existing != null) {
|
||||||
|
// 记录存在
|
||||||
|
if ("0".equals(existing.getDelFlag())) {
|
||||||
|
throw new ServiceException("工号 " + bo.getWorkerNo() + " 已存在且未删除,不能重复添加");
|
||||||
|
} else {
|
||||||
|
// 已删除,执行强制恢复更新
|
||||||
|
GearWorker update = BeanUtil.toBean(bo, GearWorker.class);
|
||||||
|
// 必须设置工号,用于 WHERE 条件
|
||||||
|
update.setWorkerNo(bo.getWorkerNo());
|
||||||
|
// 调用自定义恢复方法,直接更新数据库
|
||||||
|
int rows = baseMapper.recoverByWorkerNo(update);
|
||||||
|
if (rows > 0) {
|
||||||
|
bo.setWorkerId(existing.getWorkerId());
|
||||||
|
log.info("恢复并更新已删除工人成功,workerNo={}", bo.getWorkerNo());
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
throw new ServiceException("恢复工人数据失败,请稍后重试");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 完全新增
|
||||||
|
log.info("新增工人,workerNo={}", bo.getWorkerNo());
|
||||||
GearWorker add = BeanUtil.toBean(bo, GearWorker.class);
|
GearWorker add = BeanUtil.toBean(bo, GearWorker.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
baseMapper.insert(add);
|
||||||
if (flag) {
|
|
||||||
bo.setWorkerId(add.getWorkerId());
|
bo.setWorkerId(add.getWorkerId());
|
||||||
}
|
return true;
|
||||||
return flag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByBo(GearWorkerBo bo) {
|
public Boolean updateByBo(GearWorkerBo bo) {
|
||||||
|
GearWorker existing = baseMapper.selectById(bo.getWorkerId());
|
||||||
|
if (existing == null) {
|
||||||
|
throw new ServiceException("记录不存在");
|
||||||
|
}
|
||||||
|
if (!"0".equals(existing.getDelFlag())) {
|
||||||
|
throw new ServiceException("该记录已被删除,无法更新");
|
||||||
|
}
|
||||||
GearWorker update = BeanUtil.toBean(bo, GearWorker.class);
|
GearWorker update = BeanUtil.toBean(bo, GearWorker.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
@@ -82,10 +115,14 @@ public class GearWorkerServiceImpl implements IGearWorkerService {
|
|||||||
if (StringUtils.isBlank(entity.getDefaultBillingType())) {
|
if (StringUtils.isBlank(entity.getDefaultBillingType())) {
|
||||||
entity.setDefaultBillingType("1");
|
entity.setDefaultBillingType("1");
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isBlank(entity.getDelFlag())) {
|
||||||
|
entity.setDelFlag("0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
// 由于 @TableLogic(value="0", delval="2") 配置,此处会执行 UPDATE gear_worker SET del_flag='2'
|
||||||
return baseMapper.deleteBatchIds(ids) > 0;
|
return baseMapper.deleteBatchIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,17 +140,16 @@ public class GearWorkerServiceImpl implements IGearWorkerService {
|
|||||||
msg.append("[工号/姓名为空]");
|
msg.append("[工号/姓名为空]");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
GearWorker exist = baseMapper.selectOne(Wrappers.<GearWorker>lambdaQuery()
|
|
||||||
.eq(GearWorker::getWorkerNo, item.getWorkerNo()));
|
|
||||||
|
|
||||||
if (exist == null) {
|
// 使用自定义方法查询所有记录(包括逻辑删除的)
|
||||||
GearWorker add = BeanUtil.toBean(item, GearWorker.class);
|
GearWorker existing = baseMapper.selectByWorkerNoIncludeDeleted(item.getWorkerNo());
|
||||||
validEntityBeforeSave(add);
|
|
||||||
baseMapper.insert(add);
|
if (existing != null) {
|
||||||
success++;
|
if ("0".equals(existing.getDelFlag())) {
|
||||||
} else if (Boolean.TRUE.equals(updateSupport)) {
|
// 未删除,根据 updateSupport 决定
|
||||||
|
if (Boolean.TRUE.equals(updateSupport)) {
|
||||||
GearWorker update = BeanUtil.toBean(item, GearWorker.class);
|
GearWorker update = BeanUtil.toBean(item, GearWorker.class);
|
||||||
update.setWorkerId(exist.getWorkerId());
|
update.setWorkerId(existing.getWorkerId());
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
baseMapper.updateById(update);
|
baseMapper.updateById(update);
|
||||||
success++;
|
success++;
|
||||||
@@ -121,6 +157,26 @@ public class GearWorkerServiceImpl implements IGearWorkerService {
|
|||||||
fail++;
|
fail++;
|
||||||
msg.append("[工号重复:").append(item.getWorkerNo()).append("]");
|
msg.append("[工号重复:").append(item.getWorkerNo()).append("]");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// 已删除,强制恢复
|
||||||
|
GearWorker recover = BeanUtil.toBean(item, GearWorker.class);
|
||||||
|
recover.setWorkerNo(item.getWorkerNo());
|
||||||
|
int rows = baseMapper.recoverByWorkerNo(recover);
|
||||||
|
if (rows > 0) {
|
||||||
|
success++;
|
||||||
|
} else {
|
||||||
|
fail++;
|
||||||
|
msg.append("[恢复失败:").append(item.getWorkerNo()).append("]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 完全新增
|
||||||
|
GearWorker add = BeanUtil.toBean(item, GearWorker.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
baseMapper.insert(add);
|
||||||
|
success++;
|
||||||
}
|
}
|
||||||
return "导入完成,成功" + success + "条,失败" + fail + "条" + (msg.length() > 0 ? "," + msg : "");
|
return "导入完成,成功" + success + "条,失败" + fail + "条" + (msg.length() > 0 ? "," + msg : "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class SysOssServiceImpl implements ISysOssService, OssService {
|
|||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable(cacheNames = CacheNames.SYS_OSS, key = "#ossId")
|
@Cacheable(cacheNames = CacheNames.SYS_OSS, key = "'v2:' + #ossId")
|
||||||
@Override
|
@Override
|
||||||
public SysOssVo getById(Long ossId) {
|
public SysOssVo getById(Long ossId) {
|
||||||
return baseMapper.selectVoById(ossId);
|
return baseMapper.selectVoById(ossId);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<resultMap type="com.gear.system.domain.SysOss" id="SysOssResult">
|
<resultMap type="com.gear.system.domain.SysOss" id="SysOssResult">
|
||||||
<result property="ossId" column="oss_id"/>
|
<result property="ossId" column="oss_id"/>
|
||||||
<result property="fileName" column="file_name"/>
|
<result property="fileName" column="file_name"/>
|
||||||
|
<result property="originalName" column="original_name"/>
|
||||||
<result property="fileSuffix" column="file_suffix"/>
|
<result property="fileSuffix" column="file_suffix"/>
|
||||||
<result property="url" column="url"/>
|
<result property="url" column="url"/>
|
||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
|
|||||||
0
gear-ui3/.npm-cache/_update-notifier-last-checked
Normal file
0
gear-ui3/.npm-cache/_update-notifier-last-checked
Normal file
@@ -27,6 +27,7 @@
|
|||||||
"element-plus": "2.9.9",
|
"element-plus": "2.9.9",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"fuse.js": "6.6.2",
|
"fuse.js": "6.6.2",
|
||||||
|
"i": "^0.3.7",
|
||||||
"js-beautify": "1.14.11",
|
"js-beautify": "1.14.11",
|
||||||
"js-cookie": "3.0.5",
|
"js-cookie": "3.0.5",
|
||||||
"jsencrypt": "3.3.2",
|
"jsencrypt": "3.3.2",
|
||||||
@@ -39,7 +40,8 @@
|
|||||||
"vue-cropper": "1.1.1",
|
"vue-cropper": "1.1.1",
|
||||||
"vue-router": "4.5.1",
|
"vue-router": "4.5.1",
|
||||||
"vue3-treeselect": "^0.1.10",
|
"vue3-treeselect": "^0.1.10",
|
||||||
"vuedraggable": "4.1.0"
|
"vuedraggable": "4.1.0",
|
||||||
|
"xlsx": "^0.18.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "5.2.4",
|
"@vitejs/plugin-vue": "5.2.4",
|
||||||
|
|||||||
44
gear-ui3/src/api/mat/productAddition.js
Normal file
44
gear-ui3/src/api/mat/productAddition.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
40
gear-ui3/src/api/mat/productLabor.js
Normal file
40
gear-ui3/src/api/mat/productLabor.js
Normal 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
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -35,10 +35,26 @@ export function updateWorker(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除工人
|
// // 删除工人
|
||||||
export function delWorker(workerId) {
|
// export function delWorker(workerIds) {
|
||||||
|
// return request({
|
||||||
|
// url: '/oa/worker/' + workerId,
|
||||||
|
// // url: '/oa/worker/' + workerIds.join(','),
|
||||||
|
// method: 'delete'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// 删除工人(修复后,支持单个+批量删除)
|
||||||
|
export function delWorker(workerIds) {
|
||||||
|
let url = ''
|
||||||
|
if (Array.isArray(workerIds)) {
|
||||||
|
// 数组 → 拼接成 1,2,3
|
||||||
|
url = '/oa/worker/' + workerIds.join(',')
|
||||||
|
} else {
|
||||||
|
// 单个ID
|
||||||
|
url = '/oa/worker/' + workerIds
|
||||||
|
}
|
||||||
return request({
|
return request({
|
||||||
url: '/oa/worker/' + workerId,
|
url: url,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
background: $color;
|
background: $color;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: $color;
|
color: #fff;
|
||||||
|
|
||||||
&:before,
|
&:before,
|
||||||
&:after {
|
&:after {
|
||||||
@@ -82,13 +82,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.custom-button {
|
.custom-button {
|
||||||
display: inline-block;
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background: #fff;
|
background: var(--app-primary);
|
||||||
color: #fff;
|
color: #fff !important;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
outline: 0;
|
outline: 0;
|
||||||
@@ -97,3 +100,10 @@
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 按钮结构样式(颜色逻辑统一在 index.scss 管理) */
|
||||||
|
.el-button {
|
||||||
|
border-radius: 4px !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
letter-spacing: 0.4px !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,6 +7,12 @@ $--spacing-lg: $--spacing-base * 2;
|
|||||||
$--form-item-margin: $--spacing-base;
|
$--form-item-margin: $--spacing-base;
|
||||||
$--btn-height: 24px;
|
$--btn-height: 24px;
|
||||||
|
|
||||||
|
$industrial-primary: #1d4e89;
|
||||||
|
$industrial-secondary: #2471a3;
|
||||||
|
$industrial-dark: #1c2b3a;
|
||||||
|
$industrial-border: #dde1e6;
|
||||||
|
$industrial-bg: #f0f2f5;
|
||||||
|
|
||||||
|
|
||||||
// ====================== 2. CSS尺寸变量(与Sass变量同步)======================
|
// ====================== 2. CSS尺寸变量(与Sass变量同步)======================
|
||||||
:root {
|
:root {
|
||||||
@@ -47,44 +53,45 @@ body {
|
|||||||
// ====================== 5. 组件尺寸样式(按优先级合并)======================
|
// ====================== 5. 组件尺寸样式(按优先级合并)======================
|
||||||
// ---------------------- 5.1 按钮(紧凑尺寸)----------------------
|
// ---------------------- 5.1 按钮(紧凑尺寸)----------------------
|
||||||
@mixin button-variant() {
|
@mixin button-variant() {
|
||||||
border-radius: 6px;
|
border-radius: 4px;
|
||||||
transition: all .25s ease;
|
transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
|
||||||
height: $--btn-height;
|
height: $--btn-height;
|
||||||
padding: 0 var(--spacing-lg);
|
padding: 0 var(--spacing-lg);
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.4px;
|
||||||
|
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus {
|
&:focus {
|
||||||
transform: translateY(-1px);
|
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
transform: translateY(1px);
|
filter: brightness(0.88);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.is-disabled,
|
&.is-disabled,
|
||||||
&[disabled] {
|
&[disabled] {
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
|
opacity: 0.55;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 主按钮(尺寸相关)
|
// 各类型按钮统一套 mixin(颜色由 index.scss CSS变量控制)
|
||||||
.el-button--primary {
|
.el-button--primary,
|
||||||
@include button-variant();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 功能按钮(尺寸相关)
|
|
||||||
.el-button--success,
|
.el-button--success,
|
||||||
.el-button--warning,
|
|
||||||
.el-button--danger,
|
.el-button--danger,
|
||||||
.el-button--info {
|
.el-button--info,
|
||||||
|
.el-button--warning {
|
||||||
@include button-variant();
|
@include button-variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文本按钮(尺寸相关)
|
// 文本/Link按钮
|
||||||
.el-button--text {
|
.el-button--text,
|
||||||
|
.el-button.is-text {
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 4px 8px;
|
padding: 2px 6px;
|
||||||
|
border-radius: 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 图标按钮(圆形紧凑尺寸)
|
// 图标按钮(圆形紧凑尺寸)
|
||||||
@@ -142,9 +149,19 @@ body {
|
|||||||
|
|
||||||
// ---------------------- 5.2 表格(紧凑尺寸)----------------------
|
// ---------------------- 5.2 表格(紧凑尺寸)----------------------
|
||||||
.el-table {
|
.el-table {
|
||||||
border-radius: 8px;
|
border-radius: 6px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-top: $--form-item-margin * 2; // 与表单间距
|
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)
|
// 表头(紧凑padding)
|
||||||
.el-table__header-wrapper {
|
.el-table__header-wrapper {
|
||||||
@@ -429,8 +446,10 @@ body {
|
|||||||
// ---------------------- 5.5 卡片/对话框(尺寸层级)----------------------
|
// ---------------------- 5.5 卡片/对话框(尺寸层级)----------------------
|
||||||
// 卡片尺寸
|
// 卡片尺寸
|
||||||
.el-card {
|
.el-card {
|
||||||
border-radius: 8px;
|
border-radius: 6px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
border: 1px solid $industrial-border;
|
||||||
|
box-shadow: 0 1px 4px rgba(0,0,0,.05);
|
||||||
|
|
||||||
// 卡片头部尺寸
|
// 卡片头部尺寸
|
||||||
.el-card__header {
|
.el-card__header {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
@use './mixin.scss';
|
@use './mixin.scss';
|
||||||
@use './transition.scss';
|
@use './transition.scss';
|
||||||
@use './element-ui.scss';
|
@use './element-ui.scss';
|
||||||
@@ -5,9 +6,25 @@
|
|||||||
@use './btn.scss';
|
@use './btn.scss';
|
||||||
@use './ruoyi.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 {
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
background: var(--app-page-bg);
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
@@ -15,7 +32,17 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
label {
|
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 {
|
html {
|
||||||
@@ -98,31 +125,32 @@ div:focus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aside {
|
aside {
|
||||||
background: #eef1f6;
|
background: #eef3f8;
|
||||||
padding: 8px 24px;
|
padding: 8px 16px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 16px;
|
||||||
border-radius: 2px;
|
border: 1px solid var(--app-card-border);
|
||||||
|
border-radius: 4px;
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 32px;
|
line-height: 28px;
|
||||||
font-size: 16px;
|
font-size: 14px;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
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;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #337ab7;
|
color: var(--app-primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: rgb(32, 160, 255);
|
color: var(--app-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//main-container全局样式
|
//main-container全局样式
|
||||||
.app-container {
|
.app-container {
|
||||||
padding: 20px;
|
padding: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.components-container {
|
.components-container {
|
||||||
@@ -135,36 +163,39 @@ aside {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sub-navbar {
|
.sub-navbar {
|
||||||
height: 50px;
|
height: 44px;
|
||||||
line-height: 50px;
|
line-height: 44px;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding-right: 20px;
|
padding-right: 16px;
|
||||||
transition: 600ms ease position;
|
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 {
|
.subtitle {
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.draft {
|
&.draft {
|
||||||
background: #d0d0d0;
|
background: #dfe5ec;
|
||||||
|
color: var(--app-primary-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.deleted {
|
&.deleted {
|
||||||
background: #d0d0d0;
|
background: #dfe5ec;
|
||||||
|
color: var(--app-primary-dark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.link-type,
|
.link-type,
|
||||||
.link-type:focus {
|
.link-type:focus {
|
||||||
color: #337ab7;
|
color: var(--app-primary);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
color: rgb(32, 160, 255);
|
color: var(--app-secondary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,4 +207,212 @@ aside {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
background: #1c2b3a;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-menu-item, .menu-title {
|
.el-menu-item, .menu-title {
|
||||||
@@ -83,21 +84,25 @@
|
|||||||
// menu hover
|
// menu hover
|
||||||
.sub-menu-title-noDropdown,
|
.sub-menu-title-noDropdown,
|
||||||
.el-sub-menu__title {
|
.el-sub-menu__title {
|
||||||
|
color: #d7e2ee !important;
|
||||||
|
|
||||||
&:hover {
|
&: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 {
|
& .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,
|
& .nest-menu .el-sub-menu>.el-sub-menu__title,
|
||||||
& .el-sub-menu .el-menu-item {
|
& .el-sub-menu .el-menu-item {
|
||||||
min-width: vars.$base-sidebar-width !important;
|
min-width: vars.$base-sidebar-width !important;
|
||||||
|
color: #d7e2ee !important;
|
||||||
|
|
||||||
&:hover {
|
&: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,
|
.nest-menu .el-sub-menu>.el-sub-menu__title,
|
||||||
.el-menu-item {
|
.el-menu-item {
|
||||||
|
color: #d7e2ee !important;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
// you can use $sub-menuHover
|
background-color: rgba(255, 255, 255, 0.05) !important;
|
||||||
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,42 +1,42 @@
|
|||||||
// base color
|
// industrial palette
|
||||||
$blue: #324157;
|
$blue: #1d4e89;
|
||||||
$light-blue: #333c46;
|
$light-blue: #2471a3;
|
||||||
$red: #C03639;
|
$red: #c0392b;
|
||||||
$pink: #E65D6E;
|
$pink: #e65d6e;
|
||||||
$green: #30B08F;
|
$green: #4b8b3b;
|
||||||
$tiffany: #4AB7BD;
|
$tiffany: #4ab7bd;
|
||||||
$yellow: #FEC171;
|
$yellow: #d68910;
|
||||||
$panGreen: #30B08F;
|
$panGreen: #2f8f5b;
|
||||||
|
|
||||||
// 默认主题变量
|
// 默认主题变量
|
||||||
$menuText: #bfcbd9;
|
$menuText: #d7e2ee;
|
||||||
$menuActiveText: #409eff;
|
$menuActiveText: #7cc0ff;
|
||||||
$menuBg: #304156;
|
$menuBg: #1c2b3a;
|
||||||
$menuHover: #263445;
|
$menuHover: #25384a;
|
||||||
|
|
||||||
// 浅色主题theme-light
|
// 浅色主题theme-light
|
||||||
$menuLightBg: #ffffff;
|
$menuLightBg: #f5f7fa;
|
||||||
$menuLightHover: #f0f1f5;
|
$menuLightHover: #e9eef5;
|
||||||
$menuLightText: #303133;
|
$menuLightText: #2f3a4a;
|
||||||
$menuLightActiveText: #409EFF;
|
$menuLightActiveText: #1d4e89;
|
||||||
|
|
||||||
// 基础变量
|
// 基础变量
|
||||||
$base-sidebar-width: 200px;
|
$base-sidebar-width: 200px;
|
||||||
$sideBarWidth: 200px;
|
$sideBarWidth: 200px;
|
||||||
|
|
||||||
// 菜单暗色变量
|
// 菜单暗色变量
|
||||||
$base-menu-color: #bfcbd9;
|
$base-menu-color: #d7e2ee;
|
||||||
$base-menu-color-active: #f4f4f5;
|
$base-menu-color-active: #ffffff;
|
||||||
$base-menu-background: #304156;
|
$base-menu-background: #1c2b3a;
|
||||||
$base-sub-menu-background: #1f2d3d;
|
$base-sub-menu-background: #16212d;
|
||||||
$base-sub-menu-hover: #001528;
|
$base-sub-menu-hover: #223243;
|
||||||
|
|
||||||
// 组件变量
|
// 组件变量
|
||||||
$--color-primary: #409EFF;
|
$--color-primary: #1d4e89;
|
||||||
$--color-success: #67C23A;
|
$--color-success: #4b8b3b;
|
||||||
$--color-warning: #E6A23C;
|
$--color-warning: #d68910;
|
||||||
$--color-danger: #F56C6C;
|
$--color-danger: #c0392b;
|
||||||
$--color-info: #909399;
|
$--color-info: #7f8c8d;
|
||||||
|
|
||||||
:export {
|
:export {
|
||||||
menuText: $menuText;
|
menuText: $menuText;
|
||||||
@@ -71,12 +71,20 @@ $--color-info: #909399;
|
|||||||
--sidebar-bg: #{$menuBg};
|
--sidebar-bg: #{$menuBg};
|
||||||
--sidebar-text: #{$menuText};
|
--sidebar-text: #{$menuText};
|
||||||
--menu-hover: #{$menuHover};
|
--menu-hover: #{$menuHover};
|
||||||
|
--navbar-bg: #f5f7fa;
|
||||||
--navbar-bg: #ffffff;
|
--navbar-text: #2f3a4a;
|
||||||
--navbar-text: #303133;
|
--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-theme 变量 */
|
||||||
--splitpanes-default-bg: #ffffff;
|
--splitpanes-default-bg: #f5f7fa;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,31 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="{ 'hidden': hidden }" class="pagination-container">
|
<div v-if="!hidden" class="gear-pagination">
|
||||||
<el-pagination
|
<span class="gear-pg-info">共 <b>{{ total }}</b> 条</span>
|
||||||
:background="background"
|
|
||||||
v-model:current-page="currentPage"
|
<select v-model="pageSize" class="gear-pg-select" @change="handleSizeChange">
|
||||||
v-model:page-size="pageSize"
|
<option v-for="s in pageSizes" :key="s" :value="s">{{ s }}条/页</option>
|
||||||
:layout="layout"
|
</select>
|
||||||
:page-sizes="pageSizes"
|
|
||||||
:pager-count="pagerCount"
|
<div class="gear-pg-pager">
|
||||||
:total="total"
|
<button class="gear-pg-btn gear-pg-nav" :disabled="currentPage <= 1" @click="changePage(currentPage - 1)">
|
||||||
@size-change="handleSizeChange"
|
<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>
|
||||||
@current-change="handleCurrentChange"
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -18,88 +33,194 @@
|
|||||||
import { scrollTo } from '@/utils/scroll-to'
|
import { scrollTo } from '@/utils/scroll-to'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
total: {
|
total: { required: true, type: Number },
|
||||||
required: true,
|
page: { type: Number, default: 1 },
|
||||||
type: Number
|
limit: { type: Number, default: 20 },
|
||||||
},
|
pageSizes: { type: Array, default: () => [10, 20, 30, 50] },
|
||||||
page: {
|
pagerCount: { type: Number, default: document.body.clientWidth < 992 ? 5 : 7 },
|
||||||
type: Number,
|
autoScroll: { type: Boolean, default: true },
|
||||||
default: 1
|
hidden: { type: Boolean, default: false }
|
||||||
},
|
|
||||||
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
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits()
|
const emit = defineEmits(['update:page', 'update:limit', 'pagination'])
|
||||||
|
const jumpVal = ref(props.page)
|
||||||
|
|
||||||
const currentPage = computed({
|
const currentPage = computed({
|
||||||
get() {
|
get: () => props.page,
|
||||||
return props.page
|
set: val => emit('update:page', val)
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
emit('update:page', val)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const pageSize = computed({
|
const pageSize = computed({
|
||||||
get() {
|
get: () => props.limit,
|
||||||
return props.limit
|
set: val => emit('update:limit', val)
|
||||||
},
|
|
||||||
set(val){
|
|
||||||
emit('update:limit', val)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleSizeChange(val) {
|
const totalPages = computed(() => Math.max(1, Math.ceil(props.total / props.limit)))
|
||||||
if (currentPage.value * val > props.total) {
|
|
||||||
currentPage.value = 1
|
const displayPages = computed(() => {
|
||||||
}
|
const total = totalPages.value
|
||||||
emit('pagination', { page: currentPage.value, limit: val })
|
const cur = currentPage.value
|
||||||
if (props.autoScroll) {
|
const count = props.pagerCount
|
||||||
scrollTo(0, 800)
|
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) {
|
function handleSizeChange() {
|
||||||
emit('pagination', { page: val, limit: pageSize.value })
|
const newPage = currentPage.value * pageSize.value > props.total ? 1 : currentPage.value
|
||||||
if (props.autoScroll) {
|
currentPage.value = newPage
|
||||||
scrollTo(0, 800)
|
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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped lang="scss">
|
||||||
.pagination-container {
|
$p: #1d4e89;
|
||||||
background: #fff;
|
$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>
|
</style>
|
||||||
@@ -11,10 +11,32 @@
|
|||||||
</div>
|
</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
|
<el-table :data="list" style="width: 100%" border stripe @row-click="handleRowSelect" highlight-current-row
|
||||||
row-key="materialId" :current-row-key="materialId">
|
row-key="materialId" :current-row-key="materialId">
|
||||||
<el-table-column prop="materialName" label="配料名称" min-width="120" align="center" />
|
<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="spec" label="配料规格" min-width="100" align="center" />
|
||||||
<el-table-column prop="model" 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" />
|
<el-table-column prop="factory" label="生产厂家" min-width="120" align="center" />
|
||||||
@@ -64,6 +86,12 @@ const emit = defineEmits(['change']);
|
|||||||
const list = ref([]); // 物料列表
|
const list = ref([]); // 物料列表
|
||||||
const open = ref(false); // 弹窗显隐
|
const open = ref(false); // 弹窗显隐
|
||||||
|
|
||||||
|
// 搜索表单数据
|
||||||
|
const searchForm = ref({
|
||||||
|
materialName: '',
|
||||||
|
materialType: ''
|
||||||
|
});
|
||||||
|
|
||||||
// 分页响应式数据(核心新增)
|
// 分页响应式数据(核心新增)
|
||||||
const pageNum = ref(1); // 当前页码
|
const pageNum = ref(1); // 当前页码
|
||||||
const pageSize = ref(10); // 每页条数
|
const pageSize = ref(10); // 每页条数
|
||||||
@@ -77,7 +105,15 @@ onMounted(async () => {
|
|||||||
// 加载物料列表(适配分页参数)
|
// 加载物料列表(适配分页参数)
|
||||||
async function fetchMaterialList() {
|
async function fetchMaterialList() {
|
||||||
try {
|
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;
|
list.value = res.rows;
|
||||||
total.value = res.total; // 赋值总条数供分页使用
|
total.value = res.total; // 赋值总条数供分页使用
|
||||||
@@ -95,6 +131,16 @@ async function fetchMaterialList() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 重置搜索
|
||||||
|
function resetSearch() {
|
||||||
|
searchForm.value = {
|
||||||
|
materialName: '',
|
||||||
|
materialType: ''
|
||||||
|
};
|
||||||
|
pageNum.value = 1;
|
||||||
|
fetchMaterialList();
|
||||||
|
}
|
||||||
|
|
||||||
// 表格行选择物料
|
// 表格行选择物料
|
||||||
function handleRowSelect(row) {
|
function handleRowSelect(row) {
|
||||||
if (row.materialId === materialId.value) return;
|
if (row.materialId === materialId.value) return;
|
||||||
|
|||||||
@@ -170,8 +170,8 @@ onMounted(() => {
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.topmenu-container.el-menu--horizontal > .el-menu-item {
|
:deep(.el-menu > .el-menu-item) {
|
||||||
float: left;
|
float: left;
|
||||||
height: 50px !important;
|
height: 50px !important;
|
||||||
line-height: 50px !important;
|
line-height: 50px !important;
|
||||||
@@ -180,13 +180,14 @@ onMounted(() => {
|
|||||||
margin: 0 10px !important;
|
margin: 0 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topmenu-container.el-menu--horizontal > .el-menu-item.is-active, .el-menu--horizontal > .el-sub-menu.is-active .el-submenu__title {
|
:deep(.el-menu > .el-menu-item.is-active), :deep(.el-menu > .el-sub-menu.is-active .el-submenu__title) {
|
||||||
border-bottom: 2px solid #{'var(--theme)'} !important;
|
border-bottom: 2px solid #{'var(--theme)'} !important;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
|
background-color: #f5f7fa !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sub-menu item */
|
/* sub-menu item */
|
||||||
.topmenu-container.el-menu--horizontal > .el-sub-menu .el-sub-menu__title {
|
:deep(.el-menu > .el-sub-menu .el-sub-menu__title) {
|
||||||
float: left;
|
float: left;
|
||||||
height: 50px !important;
|
height: 50px !important;
|
||||||
line-height: 50px !important;
|
line-height: 50px !important;
|
||||||
@@ -196,17 +197,17 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 背景色隐藏 */
|
/* 背景色隐藏 */
|
||||||
.topmenu-container.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus, .topmenu-container.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover, .topmenu-container.el-menu--horizontal>.el-submenu .el-submenu__title:hover {
|
:deep(.el-menu>.el-menu-item:not(.is-disabled):focus), :deep(.el-menu>.el-menu-item:not(.is-disabled):hover), :deep(.el-menu>.el-sub-menu .el-sub-menu__title:hover) {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 图标右间距 */
|
/* 图标右间距 */
|
||||||
.topmenu-container .svg-icon {
|
:deep(.svg-icon) {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* topmenu more arrow */
|
/* topmenu more arrow */
|
||||||
.topmenu-container .el-sub-menu .el-sub-menu__icon-arrow {
|
:deep(.el-sub-menu .el-sub-menu__icon-arrow) {
|
||||||
position: static;
|
position: static;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ function addIframe() {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
background: var(--app-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-main:has(.copyright) {
|
.app-main:has(.copyright) {
|
||||||
@@ -78,11 +79,11 @@ function addIframe() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-track {
|
::-webkit-scrollbar-track {
|
||||||
background-color: #f1f1f1;
|
background-color: #edf2f7;
|
||||||
}
|
}
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
::-webkit-scrollbar-thumb {
|
||||||
background-color: #c0c0c0;
|
background-color: #aab7c4;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -102,11 +102,13 @@ function toggleTheme() {
|
|||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
.navbar {
|
.navbar {
|
||||||
height: 50px;
|
height: 48px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--navbar-bg);
|
background: linear-gradient(90deg, #1c2b3a 0%, #25384a 100%);
|
||||||
box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
|
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 {
|
.hamburger-container {
|
||||||
line-height: 46px;
|
line-height: 46px;
|
||||||
@@ -115,9 +117,10 @@ function toggleTheme() {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background 0.3s;
|
transition: background 0.3s;
|
||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
color: #d7e2ee;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: rgba(0, 0, 0, 0.025);
|
background: rgba(255, 255, 255, 0.04);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +141,7 @@ function toggleTheme() {
|
|||||||
.right-menu {
|
.right-menu {
|
||||||
float: right;
|
float: right;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
line-height: 50px;
|
line-height: 48px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
@@ -147,10 +150,10 @@ function toggleTheme() {
|
|||||||
|
|
||||||
.right-menu-item {
|
.right-menu-item {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0 8px;
|
padding: 0 10px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-size: 18px;
|
font-size: 16px;
|
||||||
color: #5a5e66;
|
color: #d7e2ee;
|
||||||
vertical-align: text-bottom;
|
vertical-align: text-bottom;
|
||||||
|
|
||||||
&.hover-effect {
|
&.hover-effect {
|
||||||
@@ -158,7 +161,7 @@ function toggleTheme() {
|
|||||||
transition: background 0.3s;
|
transition: background 0.3s;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: rgba(0, 0, 0, 0.025);
|
background: rgba(255, 255, 255, 0.05);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,23 +184,28 @@ function toggleTheme() {
|
|||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
|
|
||||||
.avatar-wrapper {
|
.avatar-wrapper {
|
||||||
margin-top: 10px;
|
margin-top: 9px;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
|
||||||
.user-avatar {
|
.user-avatar {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 30px;
|
width: 28px;
|
||||||
height: 30px;
|
height: 28px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-nickname{
|
.user-nickname{
|
||||||
position: relative;
|
position: relative;
|
||||||
left: 5px;
|
left: 0;
|
||||||
bottom: 10px;
|
bottom: 0;
|
||||||
font-size: 14px;
|
font-size: 13px;
|
||||||
font-weight: bold;
|
font-weight: 600;
|
||||||
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
i {
|
i {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const getLogoBackground = computed(() => {
|
|||||||
if (settingsStore.isDark) {
|
if (settingsStore.isDark) {
|
||||||
return 'var(--sidebar-bg)'
|
return 'var(--sidebar-bg)'
|
||||||
}
|
}
|
||||||
return sideTheme.value === 'theme-dark' ? variables.menuBg : variables.menuLightBg
|
return '#1c2b3a'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取Logo文字颜色
|
// 获取Logo文字颜色
|
||||||
@@ -43,7 +43,7 @@ const getLogoTextColor = computed(() => {
|
|||||||
if (settingsStore.isDark) {
|
if (settingsStore.isDark) {
|
||||||
return 'var(--sidebar-text)'
|
return 'var(--sidebar-text)'
|
||||||
}
|
}
|
||||||
return sideTheme.value === 'theme-dark' ? '#fff' : variables.menuLightText
|
return '#fff'
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -70,34 +70,45 @@ const activeMenu = computed(() => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.sidebar-container {
|
.sidebar-container {
|
||||||
background-color: v-bind(getMenuBackground);
|
background: #1c2b3a !important;
|
||||||
|
border-right: 1px solid rgba(255, 255, 255, 0.08) !important;
|
||||||
|
|
||||||
.scrollbar-wrapper {
|
.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 {
|
.el-menu {
|
||||||
border: none;
|
border: none;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
|
background: #1c2b3a !important;
|
||||||
|
|
||||||
.el-menu-item, .el-sub-menu__title {
|
.el-menu-item, .el-sub-menu__title {
|
||||||
|
color: #d7e2ee !important;
|
||||||
|
|
||||||
&:hover {
|
&: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 {
|
.el-menu-item {
|
||||||
color: v-bind(getMenuTextColor);
|
|
||||||
|
|
||||||
&.is-active {
|
&.is-active {
|
||||||
color: var(--menu-active-text, #409eff);
|
color: #ffffff !important;
|
||||||
background-color: var(--menu-hover, rgba(0, 0, 0, 0.06)) !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 {
|
.el-sub-menu__title {
|
||||||
color: v-bind(getMenuTextColor);
|
color: #d7e2ee !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,8 +90,9 @@ function isActive(r) {
|
|||||||
function activeStyle(tag) {
|
function activeStyle(tag) {
|
||||||
if (!isActive(tag)) return {}
|
if (!isActive(tag)) return {}
|
||||||
return {
|
return {
|
||||||
"background-color": theme.value,
|
"background-color": "#1d4e89",
|
||||||
"border-color": theme.value
|
"border-color": "#1d4e89",
|
||||||
|
"color": "#fff"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,9 +264,9 @@ function handleScroll() {
|
|||||||
.tags-view-container {
|
.tags-view-container {
|
||||||
height: 34px;
|
height: 34px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background: var(--tags-bg, #fff);
|
background: #f5f7fa;
|
||||||
border-bottom: 1px solid var(--tags-item-border, #d8dce5);
|
border-bottom: 1px solid #dde1e6;
|
||||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
|
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-wrapper {
|
||||||
.tags-view-item {
|
.tags-view-item {
|
||||||
@@ -274,9 +275,9 @@ function handleScroll() {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
height: 26px;
|
height: 26px;
|
||||||
line-height: 26px;
|
line-height: 26px;
|
||||||
border: 1px solid var(--tags-item-border, #d8dce5);
|
border: 1px solid #d8dce5;
|
||||||
color: var(--tags-item-text, #495060);
|
color: #495060;
|
||||||
background: var(--tags-item-bg, #fff);
|
background: #fff;
|
||||||
padding: 0 8px;
|
padding: 0 8px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
@@ -291,13 +292,13 @@ function handleScroll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
background-color: #42b983;
|
background-color: #1d4e89;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-color: #42b983;
|
border-color: #1d4e89;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
background: #fff;
|
background: #7cc0ff;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 8px;
|
width: 8px;
|
||||||
height: 8px;
|
height: 8px;
|
||||||
@@ -315,7 +316,7 @@ function handleScroll() {
|
|||||||
|
|
||||||
.contextmenu {
|
.contextmenu {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
background: var(--el-bg-color-overlay, #fff);
|
background: #fff;
|
||||||
z-index: 3000;
|
z-index: 3000;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
@@ -323,7 +324,7 @@ function handleScroll() {
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: var(--tags-item-text, #333);
|
color: #333;
|
||||||
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
|
box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
|
||||||
border: 1px solid var(--el-border-color-light, #e4e7ed);
|
border: 1px solid var(--el-border-color-light, #e4e7ed);
|
||||||
|
|
||||||
@@ -333,7 +334,7 @@ function handleScroll() {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: var(--tags-item-hover, #eee);
|
background: #eef3f8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ function setLayout() {
|
|||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
background: #f0f2f5;
|
||||||
|
|
||||||
&.mobile.openSidebar {
|
&.mobile.openSidebar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@@ -106,6 +107,10 @@ function setLayout() {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.main-container {
|
||||||
|
background: #f0f2f5;
|
||||||
|
}
|
||||||
|
|
||||||
.mobile .fixed-header {
|
.mobile .fixed-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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: '/mat/product', component: Layout, hidden: true, children: [ { path: 'detail/:id(\\d+)', component: () => import('@/views/mat/product/detail'), name: 'ProductDetail', meta: { title: '产品详情', activeMenu: '/mat/product' } } ] }
|
||||||
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' }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
// 动态路由,基于用户权限动态去加载
|
// 动态路由,基于用户权限动态去加载
|
||||||
@@ -151,7 +138,7 @@ export const dynamicRoutes = [
|
|||||||
permissions: ['tool:gen:edit'],
|
permissions: ['tool:gen:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:tableId(\\d+)',
|
path: 'index/:tableId(\d+)',
|
||||||
component: () => import('@/views/tool/gen/editTable'),
|
component: () => import('@/views/tool/gen/editTable'),
|
||||||
name: 'GenEdit',
|
name: 'GenEdit',
|
||||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const service = axios.create({
|
|||||||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||||
baseURL: import.meta.env.VITE_APP_BASE_API,
|
baseURL: import.meta.env.VITE_APP_BASE_API,
|
||||||
// 超时
|
// 超时
|
||||||
timeout: 10000
|
timeout: 30000
|
||||||
})
|
})
|
||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
|
|||||||
@@ -247,23 +247,23 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 对话框样式 */
|
/* 对话框样式 */
|
||||||
::v-deep .el-dialog__header {
|
:deep(.el-dialog__header) {
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-dialog__body {
|
:deep(.el-dialog__body) {
|
||||||
padding: 10px 15px;
|
padding: 10px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-dialog__footer {
|
:deep(.el-dialog__footer) {
|
||||||
padding: 8px 15px;
|
padding: 8px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-form-item {
|
:deep(.el-form-item) {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-input__inner {
|
:deep(.el-input__inner) {
|
||||||
height: 30px;
|
height: 30px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|||||||
@@ -154,25 +154,22 @@ getCookie()
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang='scss' scoped>
|
<style lang='scss' scoped>
|
||||||
// 亮色主题(默认)
|
|
||||||
.login {
|
.login {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-size: cover;
|
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-form: rgba(255, 255, 255, 0.9);
|
||||||
--color-bg-primary: #f5f7fa90;
|
--color-bg-input: #f7fbff;
|
||||||
--color-bg-form: #f5f7fa90;
|
--color-border-input: #cfd8e3;
|
||||||
--color-bg-input: #f0f2f5;
|
--color-text-primary: #1c2b3a;
|
||||||
--color-border-input: #dcdfe6;
|
--color-text-secondary: #54708a;
|
||||||
--color-text-primary: #303133;
|
--color-text-placeholder: #8a99a8;
|
||||||
--color-text-secondary: #606266;
|
--color-btn-primary: #1d4e89;
|
||||||
--color-text-placeholder: #909399;
|
--color-btn-primary-hover: #2471a3;
|
||||||
--color-btn-primary: #409eff;
|
|
||||||
--color-btn-primary-hover: #66b1ff;
|
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
margin: 0px auto 30px auto;
|
margin: 0px auto 30px auto;
|
||||||
@@ -181,6 +178,8 @@ getCookie()
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.right-img {
|
.right-img {
|
||||||
@@ -202,15 +201,16 @@ getCookie()
|
|||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
background: var(--color-bg-form);
|
background: var(--color-bg-form);
|
||||||
padding: 25px;
|
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
padding: 25px 25px 5px 25px;
|
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) {
|
:deep(.el-input__wrapper) {
|
||||||
background: var(--color-bg-input);
|
background: var(--color-bg-input);
|
||||||
border-radius: 6px;
|
border-radius: 4px;
|
||||||
border: 1px solid var(--color-border-input);
|
border: 1px solid var(--color-border-input);
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.el-input {
|
.el-input {
|
||||||
@@ -221,9 +221,7 @@ getCookie()
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
flex: 3;
|
flex: 3;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
// background: var(--color-bg-form);
|
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
// box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
|
|
||||||
.el-input {
|
.el-input {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
@@ -288,7 +286,6 @@ getCookie()
|
|||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Element组件样式调整 */
|
|
||||||
:deep(.el-checkbox__label) {
|
:deep(.el-checkbox__label) {
|
||||||
color: var(--color-text-primary);
|
color: var(--color-text-primary);
|
||||||
}
|
}
|
||||||
@@ -308,21 +305,18 @@ getCookie()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 暗色主题
|
|
||||||
.login.dark {
|
.login.dark {
|
||||||
/* 暗色主题变量 - 覆盖亮色变量 */
|
--color-bg-form: rgba(28, 43, 58, 0.92);
|
||||||
--color-bg-primary: #1a1a1a;
|
--color-bg-input: #223243;
|
||||||
--color-bg-form: #292929;
|
--color-border-input: #3f5569;
|
||||||
--color-bg-input: #333333;
|
--color-text-primary: #edf3f9;
|
||||||
--color-border-input: #444444;
|
--color-text-secondary: #b9c7d4;
|
||||||
--color-text-primary: #ebebeb;
|
--color-text-placeholder: #8fa1b2;
|
||||||
--color-text-secondary: #bfbfbf;
|
--color-btn-primary: #2471a3;
|
||||||
--color-text-placeholder: #999999;
|
--color-btn-primary-hover: #1d4e89;
|
||||||
--color-btn-primary: #409eff;
|
|
||||||
--color-btn-primary-hover: #66b1ff;
|
|
||||||
|
|
||||||
.login-form {
|
.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>
|
</style>
|
||||||
|
|||||||
464
gear-ui3/src/views/mat/auxiliary/index.vue
Normal file
464
gear-ui3/src/views/mat/auxiliary/index.vue
Normal file
@@ -0,0 +1,464 @@
|
|||||||
|
<!-- 辅料管理 -->
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="辅料名称" prop="materialName">
|
||||||
|
<el-input v-model="queryParams.materialName" placeholder="请输入辅料名称" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="辅料规格" prop="spec">
|
||||||
|
<el-input v-model="queryParams.spec" placeholder="请输入辅料规格" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="辅料型号" prop="model">
|
||||||
|
<el-input v-model="queryParams.model" placeholder="请输入辅料型号" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="厂家" prop="factory">
|
||||||
|
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="计量单位 个/公斤/米等" prop="unit">
|
||||||
|
<el-input v-model="queryParams.unit" placeholder="请输入计量单位 个/公斤/米等" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="现存库存" prop="currentStock">
|
||||||
|
<el-input v-model="queryParams.currentStock" placeholder="请输入现存库存" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange" @row-click="handleRowClick">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="辅料ID 主键" align="center" prop="materialId" v-if="true" /> -->
|
||||||
|
<el-table-column label="辅料名称" align="center" prop="materialName" />
|
||||||
|
<el-table-column label="物料类型" align="center" prop="materialType">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.materialType === 1 ? '辅料' : '原料' }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="辅料规格" align="center" prop="spec" />
|
||||||
|
<el-table-column label="辅料型号" align="center" prop="model" />
|
||||||
|
<el-table-column label="厂家" align="center" prop="factory" />
|
||||||
|
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||||
|
<el-table-column label="现存库存" align="center" prop="currentStock">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatDecimal(scope.row.currentStock) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="在途数量" align="center" prop="inTransitNum">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ formatDecimal(scope.row.inTransitNum) }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="primary" icon="Plus" @click="handleIn(scope.row)">入库</el-button>
|
||||||
|
<el-button link type="primary" icon="Minus" @click="handleOut(scope.row)">出库</el-button>
|
||||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
|
||||||
|
v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
|
<!-- 添加或修改辅料基础信息对话框 -->
|
||||||
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="辅料名称" prop="materialName">
|
||||||
|
<el-input v-model="form.materialName" placeholder="请输入辅料名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料类型" prop="materialType">
|
||||||
|
<el-select v-model="form.materialType" placeholder="请选择物料类型" disabled>
|
||||||
|
<el-option label="辅料" value="1" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="辅料规格" prop="spec">
|
||||||
|
<el-input v-model="form.spec" placeholder="请输入辅料规格" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="辅料型号" prop="model">
|
||||||
|
<el-input v-model="form.model" placeholder="请输入辅料型号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="厂家" prop="factory">
|
||||||
|
<el-input v-model="form.factory" placeholder="请输入厂家" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="计量单位" prop="unit">
|
||||||
|
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="现存库存" prop="currentStock">
|
||||||
|
<el-input v-model="form.currentStock" placeholder="请输入现存库存" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="入库" v-model="inOpen" width="500px" append-to-body>
|
||||||
|
<el-form ref="materialInRef" :model="inForm" label-width="80px">
|
||||||
|
<el-form-item label="辅料" prop="materialId">
|
||||||
|
<raw-selector ref="rawSelector" v-model="inForm.materialId" placeholder="请选择辅料" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="入库数量" prop="inNum">
|
||||||
|
<el-input v-model="inForm.inNum" placeholder="请输入入库数量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="入库单价" prop="inPrice">
|
||||||
|
<el-input v-model="inForm.inPrice" placeholder="请输入入库单价" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="入库时间" prop="inTime">
|
||||||
|
<el-date-picker clearable v-model="inForm.inTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
placeholder="请选择实际入库时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="操作人" prop="operator">
|
||||||
|
<el-input v-model="inForm.operator" placeholder="请输入入库操作人" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="inForm.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitFormIn">确 定</el-button>
|
||||||
|
<el-button @click="cancelIn">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="出库" v-model="outOpen" width="500px" append-to-body>
|
||||||
|
<el-form ref="materialOutRef" :model="outForm" label-width="80px">
|
||||||
|
<el-form-item label="出库单号" prop="outNo">
|
||||||
|
<el-input v-model="outForm.outNo" placeholder="请输入出库单号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="辅料" prop="materialId">
|
||||||
|
<raw-selector ref="rawSelector" v-model="outForm.materialId" placeholder="请选择辅料" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出库数量" prop="outNum">
|
||||||
|
<el-input v-model="outForm.outNum" placeholder="请输入出库数量" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出库原因" prop="outReason">
|
||||||
|
<el-input v-model="outForm.outReason" placeholder="请输入出库原因" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="操作人" prop="operator">
|
||||||
|
<el-input v-model="outForm.operator" placeholder="请输入操作人" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="出库时间" prop="outTime">
|
||||||
|
<el-date-picker clearable v-model="outForm.outTime" type="datetime" value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
placeholder="请选择实际出库时间">
|
||||||
|
</el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="outForm.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitFormOut">确 定</el-button>
|
||||||
|
<el-button @click="cancelOut">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
|
<Price :materialId="currentMaterialId" ref="priceRef" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup name="AuxiliaryMaterial">
|
||||||
|
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/mat/material";
|
||||||
|
import { addPurchaseInDetail } from "@/api/mat/purchaseInDetail";
|
||||||
|
import { addMaterialOut } from "@/api/mat/materialOut";
|
||||||
|
import Price from "@/views/mat/components/price.vue";
|
||||||
|
import RawSelector from "@/components/RawSelector/index.vue";
|
||||||
|
import { formatDecimal } from '@/utils/gear'
|
||||||
|
|
||||||
|
import useUserStore from '@/store/modules/user'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
|
const materialList = ref([]);
|
||||||
|
const open = ref(false);
|
||||||
|
const buttonLoading = ref(false);
|
||||||
|
const loading = ref(true);
|
||||||
|
const showSearch = ref(true);
|
||||||
|
const ids = ref([]);
|
||||||
|
const single = ref(true);
|
||||||
|
const multiple = ref(true);
|
||||||
|
const total = ref(0);
|
||||||
|
const title = ref("");
|
||||||
|
|
||||||
|
const inForm = ref({});
|
||||||
|
const outForm = ref({});
|
||||||
|
const inOpen = ref(false);
|
||||||
|
const outOpen = ref(false);
|
||||||
|
|
||||||
|
const currentMaterialId = ref(null);
|
||||||
|
|
||||||
|
function handleRowClick(row) {
|
||||||
|
currentMaterialId.value = row.materialId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const priceHistoryList = ref([]);
|
||||||
|
|
||||||
|
const nickName = computed(() => userStore.nickName)
|
||||||
|
|
||||||
|
|
||||||
|
const formatterTime = (time) => {
|
||||||
|
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = reactive({
|
||||||
|
form: {},
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
materialName: undefined,
|
||||||
|
spec: undefined,
|
||||||
|
model: undefined,
|
||||||
|
factory: undefined,
|
||||||
|
unit: undefined,
|
||||||
|
currentStock: undefined,
|
||||||
|
materialType: 1, // 固定为辅料
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const { queryParams, form, rules } = toRefs(data);
|
||||||
|
|
||||||
|
/** 查询辅料基础信息列表 */
|
||||||
|
function getList() {
|
||||||
|
loading.value = true;
|
||||||
|
listMaterial(queryParams.value).then(response => {
|
||||||
|
materialList.value = response.rows;
|
||||||
|
total.value = response.total;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消按钮
|
||||||
|
function cancel() {
|
||||||
|
open.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表单重置
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
materialId: null,
|
||||||
|
materialName: null,
|
||||||
|
materialType: 1, // 固定为辅料
|
||||||
|
spec: null,
|
||||||
|
model: null,
|
||||||
|
factory: null,
|
||||||
|
unit: null,
|
||||||
|
currentStock: null,
|
||||||
|
delFlag: null,
|
||||||
|
createTime: null,
|
||||||
|
createBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
remark: null
|
||||||
|
};
|
||||||
|
proxy.resetForm("materialRef");
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
function handleQuery() {
|
||||||
|
queryParams.value.pageNum = 1;
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
function resetQuery() {
|
||||||
|
proxy.resetForm("queryRef");
|
||||||
|
queryParams.value.materialType = 1; // 重置后仍为辅料
|
||||||
|
handleQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 多选框选中数据
|
||||||
|
function handleSelectionChange(selection) {
|
||||||
|
ids.value = selection.map(item => item.materialId);
|
||||||
|
single.value = selection.length != 1;
|
||||||
|
multiple.value = !selection.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
function handleAdd() {
|
||||||
|
reset();
|
||||||
|
open.value = true;
|
||||||
|
title.value = "添加辅料基础信息";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
function handleUpdate(row) {
|
||||||
|
loading.value = true
|
||||||
|
reset();
|
||||||
|
const _materialId = row.materialId || ids.value
|
||||||
|
getMaterial(_materialId).then(response => {
|
||||||
|
loading.value = false;
|
||||||
|
form.value = response.data;
|
||||||
|
open.value = true;
|
||||||
|
title.value = "修改辅料基础信息";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交按钮 */
|
||||||
|
function submitForm() {
|
||||||
|
proxy.$refs["materialRef"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
buttonLoading.value = true;
|
||||||
|
if (form.value.materialId != null) {
|
||||||
|
updateMaterial(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
}).finally(() => {
|
||||||
|
buttonLoading.value = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addMaterial(form.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
|
open.value = false;
|
||||||
|
getList();
|
||||||
|
}).finally(() => {
|
||||||
|
buttonLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
function handleDelete(row) {
|
||||||
|
const _materialIds = row.materialId || ids.value;
|
||||||
|
proxy.$modal.confirm('是否确认删除辅料基础信息编号为"' + _materialIds + '"的数据项?').then(function () {
|
||||||
|
loading.value = true;
|
||||||
|
return delMaterial(_materialIds);
|
||||||
|
}).then(() => {
|
||||||
|
loading.value = true;
|
||||||
|
getList();
|
||||||
|
proxy.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
}).finally(() => {
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
function handleExport() {
|
||||||
|
proxy.download('mat/material/export', {
|
||||||
|
...queryParams.value
|
||||||
|
}, `auxiliary_material_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleIn(row) {
|
||||||
|
const inTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||||
|
inOpen.value = true;
|
||||||
|
|
||||||
|
inForm.value = {
|
||||||
|
detailId: null,
|
||||||
|
purchaseId: null,
|
||||||
|
materialId: row.materialId,
|
||||||
|
inNum: null,
|
||||||
|
inPrice: null,
|
||||||
|
inAmount: null,
|
||||||
|
inTime: inTime,
|
||||||
|
operator: nickName,
|
||||||
|
delFlag: null,
|
||||||
|
createTime: null,
|
||||||
|
createBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
remark: null
|
||||||
|
};
|
||||||
|
proxy.resetForm("materialInRef");
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelIn() {
|
||||||
|
inOpen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const priceRef = ref(null);
|
||||||
|
|
||||||
|
function submitFormIn() {
|
||||||
|
loading.value = true;
|
||||||
|
buttonLoading.value = true;
|
||||||
|
addPurchaseInDetail(inForm.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
|
inOpen.value = false;
|
||||||
|
getList();
|
||||||
|
priceRef.value.getListChart();
|
||||||
|
}).finally(() => {
|
||||||
|
buttonLoading.value = false;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleOut(row) {
|
||||||
|
const outNo = proxy.parseTime(new Date(), '{y}{m}{d}{hh}{i}{s}')
|
||||||
|
const outTime = proxy.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||||
|
outOpen.value = true;
|
||||||
|
|
||||||
|
outForm.value = {
|
||||||
|
outId: null,
|
||||||
|
outNo: outNo,
|
||||||
|
materialId: row.materialId,
|
||||||
|
outNum: null,
|
||||||
|
outReason: null,
|
||||||
|
operator: nickName,
|
||||||
|
outTime: outTime,
|
||||||
|
delFlag: null,
|
||||||
|
createTime: null,
|
||||||
|
createBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
remark: null
|
||||||
|
};
|
||||||
|
proxy.resetForm("materialOutRef");
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelOut() {
|
||||||
|
outOpen.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function submitFormOut() {
|
||||||
|
loading.value = true;
|
||||||
|
buttonLoading.value = true;
|
||||||
|
addMaterialOut(outForm.value).then(response => {
|
||||||
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
|
outOpen.value = false;
|
||||||
|
getList();
|
||||||
|
}).finally(() => {
|
||||||
|
buttonLoading.value = false;
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getList();
|
||||||
|
</script>
|
||||||
@@ -25,6 +25,11 @@
|
|||||||
<raw :data="scope.row" :materialId="scope.row.materialId" />
|
<raw :data="scope.row" :materialId="scope.row.materialId" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<el-table-column label="所需数量" align="center" prop="materialNum">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
{{ formatDecimal(scope.row.materialNum) }}
|
{{ formatDecimal(scope.row.materialNum) }}
|
||||||
@@ -75,6 +80,7 @@
|
|||||||
|
|
||||||
<script setup name="ProductMaterialRelation">
|
<script setup name="ProductMaterialRelation">
|
||||||
import { listProductMaterialRelation, getProductMaterialRelation, delProductMaterialRelation, addProductMaterialRelation, updateProductMaterialRelation } from "@/api/mat/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 RawSelector from '@/components/RawSelector/index.vue'
|
||||||
import Raw from '@/components/Renderer/Raw.vue'
|
import Raw from '@/components/Renderer/Raw.vue'
|
||||||
import { formatDecimal } from '@/utils/gear'
|
import { formatDecimal } from '@/utils/gear'
|
||||||
@@ -128,8 +134,21 @@ watch(() => props.productId, (newVal, oldVal) => {
|
|||||||
function getList() {
|
function getList() {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
listProductMaterialRelation(queryParams.value).then(response => {
|
listProductMaterialRelation(queryParams.value).then(response => {
|
||||||
productMaterialRelationList.value = response.rows;
|
const relations = response.rows;
|
||||||
total.value = response.total;
|
// 为每个配方项获取物料详细信息,包括物料类型
|
||||||
|
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;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
529
gear-ui3/src/views/mat/product/detail.vue
Normal file
529
gear-ui3/src/views/mat/product/detail.vue
Normal file
@@ -0,0 +1,529 @@
|
|||||||
|
<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 class="media-tabs" type="border-card">
|
||||||
|
<el-tab-pane label="图片">
|
||||||
|
<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="说明书">
|
||||||
|
<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">
|
||||||
|
合计:{{ formatDecimal(totalAmount) }} 元
|
||||||
|
</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 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 totalAmount = computed(() => {
|
||||||
|
const mainTotal = mainMaterials.value.reduce((sum, item) => sum + item.subtotal, 0);
|
||||||
|
const auxiliaryTotal = auxiliaryMaterials.value.reduce((sum, item) => sum + item.subtotal, 0);
|
||||||
|
const manualLaborTotal = productLaborList.value.reduce((sum, item) => {
|
||||||
|
const price = item && item.laborPrice !== undefined && item.laborPrice !== null ? Number(item.laborPrice) : 0;
|
||||||
|
return sum + (Number.isFinite(price) ? price : 0);
|
||||||
|
}, 0);
|
||||||
|
return mainTotal + auxiliaryTotal + manualLaborTotal;
|
||||||
|
});
|
||||||
|
|
||||||
|
const isOssIdList = (val) => {
|
||||||
|
if (val === null || val === undefined) return false;
|
||||||
|
const str = String(val).trim();
|
||||||
|
return /^[0-9]+(,[0-9]+)*$/.test(str);
|
||||||
|
};
|
||||||
|
|
||||||
|
const pdfDisplayList = computed(() => {
|
||||||
|
const raw = String(productDetail.value.productPdfs || '').trim();
|
||||||
|
if (!raw) return [];
|
||||||
|
if (isOssIdList(raw)) return pdfFiles.value;
|
||||||
|
return pdfUrlFiles.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取产品详情
|
||||||
|
function getProductDetail() {
|
||||||
|
const productId = route.params.id;
|
||||||
|
if (productId) {
|
||||||
|
loading.value = true;
|
||||||
|
getProduct(productId).then(response => {
|
||||||
|
productDetail.value = response.data;
|
||||||
|
loading.value = false;
|
||||||
|
resolvePdfFiles();
|
||||||
|
// 获取材料明细
|
||||||
|
getMaterialDetail(productId);
|
||||||
|
// 获取产品附加属性
|
||||||
|
getProductAddition(productId);
|
||||||
|
getProductLabor(productId);
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('获取产品详情失败:', error);
|
||||||
|
loading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取产品附加属性
|
||||||
|
function getProductAddition(productId) {
|
||||||
|
additionLoading.value = true;
|
||||||
|
listProductAddition({ productId }).then(response => {
|
||||||
|
productAdditionList.value = response.rows || [];
|
||||||
|
additionLoading.value = false;
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('获取产品附加属性失败:', error);
|
||||||
|
additionLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取材料明细
|
||||||
|
function getMaterialDetail(productId) {
|
||||||
|
materialLoading.value = true;
|
||||||
|
listProductMaterialRelation({ productId }).then(response => {
|
||||||
|
const relations = response.rows;
|
||||||
|
// 为每个配方项获取物料详细信息,包括物料类型
|
||||||
|
const promises = relations.map(item => {
|
||||||
|
return getMaterial(item.materialId).then(materialResponse => {
|
||||||
|
item.material = materialResponse.data;
|
||||||
|
return item;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return Promise.all(promises);
|
||||||
|
}).then(relationsWithMaterial => {
|
||||||
|
productMaterialRelationList.value = relationsWithMaterial;
|
||||||
|
materialLoading.value = false;
|
||||||
|
}).catch(error => {
|
||||||
|
console.error('获取材料明细失败:', error);
|
||||||
|
materialLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProductLabor(productId) {
|
||||||
|
listProductLabor({ productId }).then(response => {
|
||||||
|
productLaborList.value = response.rows || [];
|
||||||
|
}).catch(() => {
|
||||||
|
productLaborList.value = [];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolvePdfFiles() {
|
||||||
|
const raw = String(productDetail.value.productPdfs || '').trim();
|
||||||
|
if (!raw) {
|
||||||
|
pdfFiles.value = [];
|
||||||
|
pdfUrlFiles.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isOssIdList(raw)) {
|
||||||
|
pdfUrlFiles.value = [];
|
||||||
|
listByIds(raw).then(res => {
|
||||||
|
const list = res.data || [];
|
||||||
|
pdfFiles.value = list.map(oss => ({
|
||||||
|
name: oss.originalName || oss.fileName || String(oss.ossId),
|
||||||
|
url: oss.url,
|
||||||
|
ossId: oss.ossId
|
||||||
|
}));
|
||||||
|
}).catch(() => {
|
||||||
|
pdfFiles.value = [];
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pdfFiles.value = [];
|
||||||
|
const urls = raw.split(',').map(s => String(s).trim()).filter(Boolean);
|
||||||
|
Promise.all(urls.map((url) =>
|
||||||
|
listOss({ url, pageNum: 1, pageSize: 1 })
|
||||||
|
.then(r => (r && r.rows && r.rows[0]) ? r.rows[0] : null)
|
||||||
|
.catch(() => null)
|
||||||
|
)).then(rows => {
|
||||||
|
pdfUrlFiles.value = urls.map((url, index) => {
|
||||||
|
const row = rows[index];
|
||||||
|
return {
|
||||||
|
name: (row && (row.originalName || row.fileName)) || getFileName(url),
|
||||||
|
url: (row && row.url) || url,
|
||||||
|
ossId: row && row.ossId
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
pdfUrlFiles.value = urls.map(url => ({ name: getFileName(url), url }));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回列表
|
||||||
|
function handleBack() {
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取文件名
|
||||||
|
function getFileName(url) {
|
||||||
|
if (!url) return '';
|
||||||
|
return url.substring(url.lastIndexOf('/') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 预览PDF
|
||||||
|
function previewPdf(pdf) {
|
||||||
|
if (!pdf || !pdf.url) return;
|
||||||
|
window.open(pdf.url, '_blank');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下载PDF
|
||||||
|
function downloadPdf(pdf) {
|
||||||
|
if (!pdf || !pdf.url) return;
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = pdf.url;
|
||||||
|
link.download = pdf.name || getFileName(pdf.url);
|
||||||
|
link.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getProductDetail();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.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 {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #f56c6c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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>
|
||||||
@@ -45,11 +45,32 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="备注" align="center" prop="remark" />
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="产品图片" align="center" prop="productImages">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
<div v-if="scope.row.productImages && scope.row.productImages.trim()" class="image-preview">
|
||||||
|
<el-image
|
||||||
|
v-for="(image, index) in scope.row.productImages.split(',')"
|
||||||
|
:key="index"
|
||||||
|
:src="image"
|
||||||
|
:preview-src-list="scope.row.productImages.split(',')"
|
||||||
|
:z-index="9999"
|
||||||
|
:preview-teleported="true"
|
||||||
|
style="width: 40px; height: 40px; margin-right: 8px;"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span v-else>无</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="320" fixed="right">
|
||||||
|
<template #default="scope">
|
||||||
|
<div class="product-op-actions">
|
||||||
|
<el-button link type="primary" icon="View" @click="handleDetail(scope.row)">详情</el-button>
|
||||||
<el-button link type="primary" icon="Plus" @click="handleBom(scope.row)">配方</el-button>
|
<el-button link type="primary" icon="Plus" @click="handleBom(scope.row)">配方</el-button>
|
||||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(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>
|
<el-button link type="primary" icon="Setting" @click="handleAddition(scope.row)">附加属性</el-button>
|
||||||
|
<el-button link type="primary" icon="Money" @click="handleLabor(scope.row)">工价</el-button>
|
||||||
|
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -75,6 +96,45 @@
|
|||||||
<el-form-item label="备注" prop="remark">
|
<el-form-item label="备注" prop="remark">
|
||||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="产品图片" prop="productImages">
|
||||||
|
<el-upload
|
||||||
|
v-model:file-list="imageFileList"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:headers="headers"
|
||||||
|
:on-success="handleImageUploadSuccess"
|
||||||
|
:on-remove="handleImageRemove"
|
||||||
|
multiple
|
||||||
|
list-type="picture"
|
||||||
|
:limit="5"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
>
|
||||||
|
<el-button type="primary" icon="Upload">上传图片</el-button>
|
||||||
|
<template #tip>
|
||||||
|
<div class="el-upload__tip">
|
||||||
|
最多上传5张图片,支持 JPG、PNG 格式
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="产品说明书" prop="productPdfs">
|
||||||
|
<el-upload
|
||||||
|
v-model:file-list="pdfFileList"
|
||||||
|
:action="uploadUrl"
|
||||||
|
:headers="headers"
|
||||||
|
:on-success="handlePdfUploadSuccess"
|
||||||
|
:on-remove="handlePdfRemove"
|
||||||
|
multiple
|
||||||
|
:limit="5"
|
||||||
|
:before-upload="beforePdfUpload"
|
||||||
|
>
|
||||||
|
<el-button type="primary" icon="Upload">上传说明书</el-button>
|
||||||
|
<template #tip>
|
||||||
|
<div class="el-upload__tip">
|
||||||
|
最多上传5个PDF文件,支持 PDF 格式
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<div class="dialog-footer">
|
<div class="dialog-footer">
|
||||||
@@ -88,6 +148,65 @@
|
|||||||
<bom :productId="currentProductId" @close="bomOpen = false" />
|
<bom :productId="currentProductId" @close="bomOpen = false" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 产品附加属性对话框 -->
|
||||||
|
<el-dialog title="产品附加属性" v-model="additionOpen" width="600px" append-to-body>
|
||||||
|
<div class="addition-container">
|
||||||
|
<el-button type="primary" icon="Plus" @click="addAdditionItem" style="margin-bottom: 10px">添加属性</el-button>
|
||||||
|
<el-table :data="additionList" style="width: 100%" border>
|
||||||
|
<el-table-column prop="attrName" label="属性名" width="150">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input v-model="scope.row.attrName" placeholder="请输入属性名" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="attrValue" label="属性值">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input v-model="scope.row.attrValue" placeholder="请输入属性值" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="danger" icon="Delete" @click="removeAdditionItem(scope.$index)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="saveAdditions">保存</el-button>
|
||||||
|
<el-button @click="additionOpen = false">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog title="产品工价" v-model="laborOpen" width="600px" append-to-body>
|
||||||
|
<div class="addition-container">
|
||||||
|
<el-button type="primary" icon="Plus" @click="addLaborItem" style="margin-bottom: 10px">添加工价</el-button>
|
||||||
|
<el-table :data="laborList" style="width: 100%" border>
|
||||||
|
<el-table-column prop="laborName" label="工价说明" width="200">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input v-model="scope.row.laborName" placeholder="请输入工价说明" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="laborPrice" label="金额(元)">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input-number style="width: 100%" v-model="scope.row.laborPrice" :controls="false" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="100" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button link type="danger" icon="Delete" @click="removeLaborItem(scope.$index)" />
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<template #footer>
|
||||||
|
<div class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="saveLabors">保存</el-button>
|
||||||
|
<el-button @click="laborOpen = false">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 将这个表格改为始终吸底,且外层容器可以拖拽调节高度 -->
|
<!-- 将这个表格改为始终吸底,且外层容器可以拖拽调节高度 -->
|
||||||
<!-- <StickyDragContainer v-if="currentProduct.productId" :parent-ref="appContainer"> -->
|
<!-- <StickyDragContainer v-if="currentProduct.productId" :parent-ref="appContainer"> -->
|
||||||
<div v-if="currentProduct.productId">
|
<div v-if="currentProduct.productId">
|
||||||
@@ -110,16 +229,30 @@
|
|||||||
<el-empty v-else description="选择产品查看配料信息" />
|
<el-empty v-else description="选择产品查看配料信息" />
|
||||||
|
|
||||||
<!-- </StickyDragContainer> -->
|
<!-- </StickyDragContainer> -->
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup name="Product">
|
<script setup name="Product">
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mat/product";
|
import { listProduct, getProduct, delProduct, addProduct, updateProduct } from "@/api/mat/product";
|
||||||
|
import { listProductMaterialRelation } from "@/api/mat/productMaterialRelation";
|
||||||
|
import { getMaterial } from "@/api/mat/material";
|
||||||
|
import { listProductAddition, batchSaveProductAddition } from "@/api/mat/productAddition";
|
||||||
|
import { listProductLabor, batchSaveProductLabor } from "@/api/mat/productLabor";
|
||||||
|
import { listByIds, listOss } from "@/api/system/oss";
|
||||||
import bom from "@/views/mat/components/bom.vue";
|
import bom from "@/views/mat/components/bom.vue";
|
||||||
import StickyDragContainer from "@/components/StickyDragContainer/index.vue";
|
import StickyDragContainer from "@/components/StickyDragContainer/index.vue";
|
||||||
import { formatDecimal } from '@/utils/gear'
|
import Raw from '@/components/Renderer/Raw.vue';
|
||||||
|
import { formatDecimal } from '@/utils/gear';
|
||||||
|
import { getToken } from '@/utils/auth';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
const bomOpen = ref(false);
|
const bomOpen = ref(false);
|
||||||
|
const additionOpen = ref(false);
|
||||||
|
const laborOpen = ref(false);
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance();
|
const { proxy } = getCurrentInstance();
|
||||||
|
|
||||||
@@ -136,13 +269,46 @@ const title = ref("");
|
|||||||
const currentProductId = ref(null);
|
const currentProductId = ref(null);
|
||||||
const currentProduct = ref({});
|
const currentProduct = ref({});
|
||||||
const appContainer = ref(null);
|
const appContainer = ref(null);
|
||||||
|
const imageFileList = ref([]);
|
||||||
|
const pdfFileList = ref([]);
|
||||||
|
const pdfUseOssId = ref(true);
|
||||||
|
const additionList = ref([]);
|
||||||
|
const laborList = ref([]);
|
||||||
|
const uploadUrl = ref(import.meta.env.VITE_APP_BASE_API + '/system/oss/upload');
|
||||||
|
const headers = ref({ Authorization: "Bearer " + getToken() });
|
||||||
|
|
||||||
|
const isOssIdList = (val) => {
|
||||||
|
if (val === null || val === undefined) return false;
|
||||||
|
const str = String(val).trim();
|
||||||
|
return /^[0-9]+(,[0-9]+)*$/.test(str);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getFileNameFromUrl = (url) => {
|
||||||
|
if (!url) return '';
|
||||||
|
const str = String(url);
|
||||||
|
return str.substring(str.lastIndexOf('/') + 1);
|
||||||
|
};
|
||||||
|
|
||||||
const formatterTime = (time) => {
|
const formatterTime = (time) => {
|
||||||
return proxy.parseTime(time, '{y}-{m}-{d}')
|
return proxy.parseTime(time, '{y}-{m}-{d}')
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {
|
||||||
|
productId: null,
|
||||||
|
productName: null,
|
||||||
|
spec: null,
|
||||||
|
model: null,
|
||||||
|
unitPrice: null,
|
||||||
|
delFlag: null,
|
||||||
|
createTime: null,
|
||||||
|
createBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
remark: null,
|
||||||
|
productImages: null,
|
||||||
|
productPdfs: null
|
||||||
|
},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
@@ -185,8 +351,13 @@ function reset() {
|
|||||||
createBy: null,
|
createBy: null,
|
||||||
updateTime: null,
|
updateTime: null,
|
||||||
updateBy: null,
|
updateBy: null,
|
||||||
remark: null
|
remark: null,
|
||||||
|
productImages: null,
|
||||||
|
productPdfs: null
|
||||||
};
|
};
|
||||||
|
imageFileList.value = [];
|
||||||
|
pdfFileList.value = [];
|
||||||
|
pdfUseOssId.value = true;
|
||||||
proxy.resetForm("productRef");
|
proxy.resetForm("productRef");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,37 +391,226 @@ function handleAdd() {
|
|||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
reset();
|
reset();
|
||||||
const _productId = row.productId || ids.value
|
const _productId = row.productId || ids.value;
|
||||||
getProduct(_productId).then(response => {
|
getProduct(_productId).then(response => {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
form.value = response.data;
|
form.value = response.data;
|
||||||
|
|
||||||
|
// 处理图片文件列表
|
||||||
|
if (form.value.productImages) {
|
||||||
|
imageFileList.value = form.value.productImages.split(',').map((url, index) => ({
|
||||||
|
name: url.substring(url.lastIndexOf('/') + 1),
|
||||||
|
url: url,
|
||||||
|
uid: Date.now() + index
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
imageFileList.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理PDF文件列表
|
||||||
|
if (form.value.productPdfs) {
|
||||||
|
const raw = String(form.value.productPdfs).trim();
|
||||||
|
if (isOssIdList(raw)) {
|
||||||
|
pdfUseOssId.value = true;
|
||||||
|
listByIds(raw).then(res => {
|
||||||
|
const list = res.data || [];
|
||||||
|
pdfFileList.value = list.map((oss, index) => ({
|
||||||
|
name: oss.originalName || oss.fileName || String(oss.ossId),
|
||||||
|
url: oss.url,
|
||||||
|
ossId: oss.ossId,
|
||||||
|
uid: Date.now() + index + 100
|
||||||
|
}));
|
||||||
|
}).catch(() => {
|
||||||
|
pdfFileList.value = [];
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const urls = raw.split(',').map(s => String(s).trim()).filter(Boolean);
|
||||||
|
Promise.all(urls.map((url) =>
|
||||||
|
listOss({ url, pageNum: 1, pageSize: 1 })
|
||||||
|
.then(r => (r && r.rows && r.rows[0]) ? r.rows[0] : null)
|
||||||
|
.catch(() => null)
|
||||||
|
)).then(rows => {
|
||||||
|
const mapped = urls.map((url, index) => {
|
||||||
|
const row = rows[index];
|
||||||
|
return {
|
||||||
|
name: (row && (row.originalName || row.fileName)) || getFileNameFromUrl(url),
|
||||||
|
url: (row && row.url) || url,
|
||||||
|
ossId: row && row.ossId,
|
||||||
|
uid: Date.now() + index + 100
|
||||||
|
};
|
||||||
|
});
|
||||||
|
pdfFileList.value = mapped;
|
||||||
|
const ossIds = mapped.map(f => f.ossId).filter(Boolean);
|
||||||
|
const allResolved = ossIds.length === mapped.length && mapped.length > 0;
|
||||||
|
pdfUseOssId.value = allResolved;
|
||||||
|
if (allResolved) {
|
||||||
|
form.value.productPdfs = ossIds.join(',');
|
||||||
|
} else {
|
||||||
|
form.value.productPdfs = urls.join(',');
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
pdfUseOssId.value = false;
|
||||||
|
pdfFileList.value = urls.map((url, index) => ({
|
||||||
|
name: getFileNameFromUrl(url),
|
||||||
|
url,
|
||||||
|
uid: Date.now() + index + 100
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pdfFileList.value = [];
|
||||||
|
}
|
||||||
|
|
||||||
open.value = true;
|
open.value = true;
|
||||||
title.value = "修改产品基础信息";
|
title.value = "修改产品基础信息";
|
||||||
|
}).catch(err => {
|
||||||
|
proxy.$modal.msgError("获取产品信息失败");
|
||||||
|
loading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 图片上传成功处理 */
|
||||||
|
function handleImageUploadSuccess(response, uploadFile, uploadFiles) {
|
||||||
|
if (response.code === 200) {
|
||||||
|
const imageUrl = response.data.url;
|
||||||
|
uploadFile.url = imageUrl;
|
||||||
|
|
||||||
|
const urls = uploadFiles
|
||||||
|
.map(f => f.url)
|
||||||
|
.filter(url => url && !url.startsWith('blob:'));
|
||||||
|
form.value.productImages = urls.join(',');
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('上传失败:' + response.msg);
|
||||||
|
const index = imageFileList.value.findIndex(f => f.uid === uploadFile.uid);
|
||||||
|
if (index > -1) {
|
||||||
|
imageFileList.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 图片移除处理 */
|
||||||
|
function handleImageRemove(uploadFile, uploadFiles) {
|
||||||
|
const urls = uploadFiles
|
||||||
|
.map(f => f.url)
|
||||||
|
.filter(url => url && !url.startsWith('blob:'));
|
||||||
|
form.value.productImages = urls.length > 0 ? urls.join(',') : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PDF上传成功处理 */
|
||||||
|
function handlePdfUploadSuccess(response, uploadFile, uploadFiles) {
|
||||||
|
if (response.code === 200) {
|
||||||
|
uploadFile.url = response.data.url;
|
||||||
|
uploadFile.name = response.data.fileName || uploadFile.name;
|
||||||
|
uploadFile.ossId = response.data.ossId;
|
||||||
|
|
||||||
|
if (pdfUseOssId.value) {
|
||||||
|
const ossIds = uploadFiles
|
||||||
|
.map(f => f.ossId)
|
||||||
|
.filter(Boolean);
|
||||||
|
form.value.productPdfs = ossIds.length > 0 ? ossIds.join(',') : null;
|
||||||
|
} else {
|
||||||
|
const urls = uploadFiles
|
||||||
|
.map(f => f.url)
|
||||||
|
.filter(url => url && !url.startsWith('blob:'));
|
||||||
|
form.value.productPdfs = urls.length > 0 ? urls.join(',') : null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('上传失败:' + response.msg);
|
||||||
|
const index = pdfFileList.value.findIndex(f => f.uid === uploadFile.uid);
|
||||||
|
if (index > -1) {
|
||||||
|
pdfFileList.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PDF移除处理 */
|
||||||
|
function handlePdfRemove(uploadFile, uploadFiles) {
|
||||||
|
if (pdfUseOssId.value) {
|
||||||
|
const ossIds = uploadFiles
|
||||||
|
.map(f => f.ossId)
|
||||||
|
.filter(Boolean);
|
||||||
|
form.value.productPdfs = ossIds.length > 0 ? ossIds.join(',') : null;
|
||||||
|
} else {
|
||||||
|
const urls = uploadFiles
|
||||||
|
.map(f => f.url)
|
||||||
|
.filter(url => url && !url.startsWith('blob:'));
|
||||||
|
form.value.productPdfs = urls.length > 0 ? urls.join(',') : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** PDF上传前校验 */
|
||||||
|
function beforePdfUpload(file) {
|
||||||
|
const isPdf = file.type === 'application/pdf';
|
||||||
|
const isLt10M = file.size / 1024 / 1024 < 10;
|
||||||
|
if (!isPdf) {
|
||||||
|
proxy.$modal.msgError('只能上传 PDF 格式的文件');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isLt10M) {
|
||||||
|
proxy.$modal.msgError('PDF文件大小不能超过 10MB');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 图片上传前校验 */
|
||||||
|
function beforeUpload(file) {
|
||||||
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||||
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||||
|
if (!isJpgOrPng) {
|
||||||
|
proxy.$modal.msgError('只能上传 JPG/PNG 格式的图片');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!isLt2M) {
|
||||||
|
proxy.$modal.msgError('图片大小不能超过 2MB');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
|
if (buttonLoading.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
proxy.$refs["productRef"].validate(valid => {
|
proxy.$refs["productRef"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
const submitData = {
|
||||||
|
productId: form.value.productId,
|
||||||
|
productName: form.value.productName,
|
||||||
|
spec: form.value.spec,
|
||||||
|
model: form.value.model,
|
||||||
|
unitPrice: form.value.unitPrice,
|
||||||
|
remark: form.value.remark,
|
||||||
|
productImages: form.value.productImages,
|
||||||
|
productPdfs: form.value.productPdfs
|
||||||
|
};
|
||||||
|
|
||||||
buttonLoading.value = true;
|
buttonLoading.value = true;
|
||||||
if (form.value.productId != null) {
|
if (form.value.productId != null) {
|
||||||
updateProduct(form.value).then(response => {
|
updateProduct(submitData).then(response => {
|
||||||
proxy.$modal.msgSuccess("修改成功");
|
proxy.$modal.msgSuccess("修改成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
|
}).catch(err => {
|
||||||
|
proxy.$modal.msgError("修改失败");
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
buttonLoading.value = false;
|
buttonLoading.value = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addProduct(form.value).then(response => {
|
addProduct(submitData).then(response => {
|
||||||
proxy.$modal.msgSuccess("新增成功");
|
proxy.$modal.msgSuccess("新增成功");
|
||||||
open.value = false;
|
open.value = false;
|
||||||
getList();
|
getList();
|
||||||
|
}).catch(err => {
|
||||||
|
proxy.$modal.msgError("新增失败");
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
buttonLoading.value = false;
|
buttonLoading.value = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -287,5 +647,133 @@ function handleRowClick(row) {
|
|||||||
currentProduct.value = row;
|
currentProduct.value = row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleDetail(row) {
|
||||||
|
// 跳转到产品详情页
|
||||||
|
router.push(`/mat/product/detail/${row.productId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleAddition(row) {
|
||||||
|
currentProductId.value = row.productId;
|
||||||
|
// 清空附加属性列表
|
||||||
|
additionList.value = [];
|
||||||
|
// 获取已有的附加属性数据
|
||||||
|
listProductAddition({ productId: row.productId }).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
additionList.value = response.rows || [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
additionOpen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addAdditionItem() {
|
||||||
|
additionList.value.push({ attrName: '', attrValue: '' });
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeAdditionItem(index) {
|
||||||
|
additionList.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveAdditions() {
|
||||||
|
const items = (additionList.value || [])
|
||||||
|
.map(item => ({
|
||||||
|
addId: item?.addId,
|
||||||
|
attrName: item?.attrName ? String(item.attrName).trim() : '',
|
||||||
|
attrValue: item?.attrValue ? String(item.attrValue).trim() : ''
|
||||||
|
}))
|
||||||
|
.filter(item => item.attrName);
|
||||||
|
|
||||||
|
batchSaveProductAddition({
|
||||||
|
productId: currentProductId.value,
|
||||||
|
items
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
|
additionOpen.value = false;
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('保存失败');
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
proxy.$modal.msgError('保存失败');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleLabor(row) {
|
||||||
|
currentProductId.value = row.productId;
|
||||||
|
laborList.value = [];
|
||||||
|
listProductLabor({ productId: row.productId }).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
laborList.value = response.rows || [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
laborOpen.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function addLaborItem() {
|
||||||
|
laborList.value.push({ laborName: '', laborPrice: 0 });
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeLaborItem(index) {
|
||||||
|
laborList.value.splice(index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function saveLabors() {
|
||||||
|
try {
|
||||||
|
const items = (laborList.value || [])
|
||||||
|
.map(item => ({
|
||||||
|
laborId: item?.laborId,
|
||||||
|
laborName: item?.laborName ? String(item.laborName).trim() : '',
|
||||||
|
laborPrice: item?.laborPrice ?? 0
|
||||||
|
}))
|
||||||
|
.filter(item => item.laborName);
|
||||||
|
|
||||||
|
const res = await batchSaveProductLabor({
|
||||||
|
productId: currentProductId.value,
|
||||||
|
items
|
||||||
|
});
|
||||||
|
if (res.code === 200 && res.data) {
|
||||||
|
proxy.$modal.msgSuccess('保存成功');
|
||||||
|
} else {
|
||||||
|
proxy.$modal.msgError('保存失败');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
proxy.$modal.msgError('保存失败');
|
||||||
|
} finally {
|
||||||
|
laborOpen.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getList();
|
getList();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 表格样式 */
|
||||||
|
:deep(.el-table th) {
|
||||||
|
background-color: #f5f7fa;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #606266;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-table tr:hover) {
|
||||||
|
background-color: #ecf5ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.el-table td) {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 图片预览层样式 */
|
||||||
|
:deep(.el-image-viewer__wrapper) {
|
||||||
|
z-index: 9999 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-op-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 4px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.product-op-actions .el-button + .el-button) {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -13,6 +13,11 @@
|
|||||||
<el-form-item label="厂家" prop="factory">
|
<el-form-item label="厂家" prop="factory">
|
||||||
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.factory" placeholder="请输入厂家" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</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-form-item label="计量单位 个/公斤/米等" prop="unit">
|
||||||
<el-input v-model="queryParams.unit" placeholder="请输入计量单位 个/公斤/米等" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.unit" placeholder="请输入计量单位 个/公斤/米等" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -45,6 +50,11 @@
|
|||||||
<el-table-column type="selection" width="55" align="center" />
|
<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="配料ID 主键" align="center" prop="materialId" v-if="true" /> -->
|
||||||
<el-table-column label="配料名称" align="center" prop="materialName" />
|
<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="spec" />
|
||||||
<el-table-column label="配料型号" align="center" prop="model" />
|
<el-table-column label="配料型号" align="center" prop="model" />
|
||||||
<el-table-column label="厂家" align="center" prop="factory" />
|
<el-table-column label="厂家" align="center" prop="factory" />
|
||||||
@@ -79,6 +89,11 @@
|
|||||||
<el-form-item label="配料名称" prop="materialName">
|
<el-form-item label="配料名称" prop="materialName">
|
||||||
<el-input v-model="form.materialName" placeholder="请输入配料名称" />
|
<el-input v-model="form.materialName" placeholder="请输入配料名称" />
|
||||||
</el-form-item>
|
</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-form-item label="配料规格" prop="spec">
|
||||||
<el-input v-model="form.spec" placeholder="请输入配料规格" />
|
<el-input v-model="form.spec" placeholder="请输入配料规格" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -232,6 +247,7 @@ const data = reactive({
|
|||||||
factory: undefined,
|
factory: undefined,
|
||||||
unit: undefined,
|
unit: undefined,
|
||||||
currentStock: undefined,
|
currentStock: undefined,
|
||||||
|
materialType: 2, // 固定为原料
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
}
|
}
|
||||||
@@ -260,6 +276,7 @@ function reset() {
|
|||||||
form.value = {
|
form.value = {
|
||||||
materialId: null,
|
materialId: null,
|
||||||
materialName: null,
|
materialName: null,
|
||||||
|
materialType: 2, // 固定为原料
|
||||||
spec: null,
|
spec: null,
|
||||||
model: null,
|
model: null,
|
||||||
factory: null,
|
factory: null,
|
||||||
@@ -284,6 +301,7 @@ function handleQuery() {
|
|||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
proxy.resetForm("queryRef");
|
proxy.resetForm("queryRef");
|
||||||
|
queryParams.value.materialType = 2; // 重置后仍为原料
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -539,8 +539,8 @@ export default {
|
|||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .el-input-group__append,
|
:deep(.el-input-group__append),
|
||||||
::v-deep .el-input-group__prepend {
|
:deep(.el-input-group__prepend) {
|
||||||
width: 20px !important;
|
width: 20px !important;
|
||||||
box-sizing: border-box !important;
|
box-sizing: border-box !important;
|
||||||
padding: 0 10px !important;
|
padding: 0 10px !important;
|
||||||
|
|||||||
@@ -98,8 +98,8 @@
|
|||||||
<el-date-picker
|
<el-date-picker
|
||||||
clearable
|
clearable
|
||||||
v-model="form.uploadTime"
|
v-model="form.uploadTime"
|
||||||
type="date"
|
type="datetime"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
placeholder="请选择上传时间"
|
placeholder="请选择上传时间"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -25,6 +25,9 @@
|
|||||||
<el-col :span="2.5">
|
<el-col :span="2.5">
|
||||||
<el-button size="small" type="info" plain icon="RefreshRight" @click="handleInitDaily(true)">重置当日名单</el-button>
|
<el-button size="small" type="info" plain icon="RefreshRight" @click="handleInitDaily(true)">重置当日名单</el-button>
|
||||||
</el-col>
|
</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-col :span="1.8">
|
||||||
<el-button size="small" type="primary" plain icon="Check" @click="saveAllRows">全部保存</el-button>
|
<el-button size="small" type="primary" plain icon="Check" @click="saveAllRows">全部保存</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -71,16 +74,54 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column 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" prop="totalAmount" width="110" />
|
<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 label="累计金额" align="center" prop="cumulativeAmount" width="110" />
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="220">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" icon="Check" @click="saveRow(scope.row)">保存</el-button>
|
<el-button link type="primary" icon="Check" @click="saveRow(scope.row)">保存</el-button>
|
||||||
|
<el-button link type="primary" icon="Document" @click="openCalcDialog(scope.row)">明细</el-button>
|
||||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
|
<el-dialog 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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -95,6 +136,27 @@ const loading = ref(true)
|
|||||||
const showSearch = ref(true)
|
const showSearch = ref(true)
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
|
|
||||||
|
// 存储累计金额数据
|
||||||
|
const cumulativeAmounts = ref({})
|
||||||
|
|
||||||
|
// 从localStorage加载累计金额数据
|
||||||
|
function loadCumulativeAmounts() {
|
||||||
|
const stored = localStorage.getItem('wageCumulativeAmounts')
|
||||||
|
if (stored) {
|
||||||
|
try {
|
||||||
|
cumulativeAmounts.value = JSON.parse(stored)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Failed to parse cumulative amounts:', e)
|
||||||
|
cumulativeAmounts.value = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存累计金额数据到localStorage
|
||||||
|
function saveCumulativeAmounts() {
|
||||||
|
localStorage.setItem('wageCumulativeAmounts', JSON.stringify(cumulativeAmounts.value))
|
||||||
|
}
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
@@ -142,25 +204,122 @@ function round2(v) {
|
|||||||
return Math.round(v * 100) / 100
|
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)
|
||||||
|
calcOpen.value = false
|
||||||
|
proxy.$modal.msgSuccess('明细已保存,请点击该行“保存”提交')
|
||||||
|
}
|
||||||
|
|
||||||
function recalcRowAmount(row) {
|
function recalcRowAmount(row) {
|
||||||
const workload = toNumber(row.workload)
|
const workload = toNumber(row.workload)
|
||||||
const unitPrice = row.billingType === '2' ? toNumber(row.unitPrice) : toNumber(row.unitPrice)
|
const unitPrice = row.billingType === '2' ? toNumber(row.unitPrice) : toNumber(row.unitPrice)
|
||||||
const extraAmount = toNumber(row.extraAmount)
|
const extraAmount = toNumber(row.extraAmount)
|
||||||
|
const calcAmount = toNumber(row.calcAmount)
|
||||||
const baseAmount = round2(workload * unitPrice)
|
const baseAmount = round2(workload * unitPrice)
|
||||||
row.baseAmount = baseAmount
|
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() {
|
function getList() {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
// 加载存储的累计金额数据
|
||||||
|
loadCumulativeAmounts()
|
||||||
|
|
||||||
listWageEntryDetail(queryParams.value).then(response => {
|
listWageEntryDetail(queryParams.value).then(response => {
|
||||||
const rows = response.rows || []
|
const rows = response.rows || []
|
||||||
|
|
||||||
wageEntryDetailList.value = rows.map(row => {
|
wageEntryDetailList.value = rows.map(row => {
|
||||||
const r = {
|
const r = {
|
||||||
...row,
|
...row,
|
||||||
workload: normalizeEditableValue(row.workload),
|
workload: normalizeEditableValue(row.workload),
|
||||||
unitPrice: normalizeEditableValue(row.unitPrice),
|
unitPrice: normalizeEditableValue(row.unitPrice),
|
||||||
extraAmount: normalizeEditableValue(row.extraAmount)
|
extraAmount: normalizeEditableValue(row.extraAmount),
|
||||||
|
calcAmount: row.calcAmount ?? 0,
|
||||||
|
calcDetail: row.calcDetail,
|
||||||
|
cumulativeAmount: cumulativeAmounts.value[row.empName] || 0
|
||||||
}
|
}
|
||||||
recalcRowAmount(r)
|
recalcRowAmount(r)
|
||||||
return r
|
return r
|
||||||
@@ -191,6 +350,9 @@ function buildRowPayload(row) {
|
|||||||
if (payload.extraAmount === '' || payload.extraAmount === null || payload.extraAmount === undefined) {
|
if (payload.extraAmount === '' || payload.extraAmount === null || payload.extraAmount === undefined) {
|
||||||
payload.extraAmount = 0
|
payload.extraAmount = 0
|
||||||
}
|
}
|
||||||
|
if (payload.calcAmount === '' || payload.calcAmount === null || payload.calcAmount === undefined) {
|
||||||
|
payload.calcAmount = 0
|
||||||
|
}
|
||||||
if (payload.billingType !== '2') {
|
if (payload.billingType !== '2') {
|
||||||
payload.unitPrice = null
|
payload.unitPrice = null
|
||||||
} else if (payload.unitPrice === '' || payload.unitPrice === null || payload.unitPrice === undefined) {
|
} else if (payload.unitPrice === '' || payload.unitPrice === null || payload.unitPrice === undefined) {
|
||||||
@@ -202,6 +364,13 @@ function buildRowPayload(row) {
|
|||||||
function saveRow(row) {
|
function saveRow(row) {
|
||||||
const payload = buildRowPayload(row)
|
const payload = buildRowPayload(row)
|
||||||
updateWageEntryDetail(payload).then(() => {
|
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('保存成功')
|
proxy.$modal.msgSuccess('保存成功')
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
@@ -219,11 +388,19 @@ async function saveAllRows() {
|
|||||||
const payload = buildRowPayload(row)
|
const payload = buildRowPayload(row)
|
||||||
try {
|
try {
|
||||||
await updateWageEntryDetail(payload)
|
await updateWageEntryDetail(payload)
|
||||||
|
// 更新累计金额
|
||||||
|
if (!cumulativeAmounts.value[row.empName]) {
|
||||||
|
cumulativeAmounts.value[row.empName] = 0
|
||||||
|
}
|
||||||
|
cumulativeAmounts.value[row.empName] += parseFloat(payload.totalAmount) || 0
|
||||||
successCount++
|
successCount++
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
failCount++
|
failCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 保存累计金额数据
|
||||||
|
saveCumulativeAmounts()
|
||||||
|
|
||||||
loading.value = false
|
loading.value = false
|
||||||
if (failCount === 0) {
|
if (failCount === 0) {
|
||||||
proxy.$modal.msgSuccess(`全部保存完成,共 ${successCount} 条`)
|
proxy.$modal.msgSuccess(`全部保存完成,共 ${successCount} 条`)
|
||||||
@@ -244,10 +421,20 @@ function handleDelete(row) {
|
|||||||
|
|
||||||
function handleExport() {
|
function handleExport() {
|
||||||
proxy.download('oa/wageEntryDetail/export', {
|
proxy.download('oa/wageEntryDetail/export', {
|
||||||
...queryParams.value
|
...queryParams.value,
|
||||||
|
cumulativeAmounts: cumulativeAmounts.value
|
||||||
}, `wage_entry_detail_${new Date().getTime()}.xlsx`)
|
}, `wage_entry_detail_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetCumulativeAmounts() {
|
||||||
|
proxy.$modal.confirm('是否确认重置所有员工的累计金额?此操作不可恢复。').then(() => {
|
||||||
|
cumulativeAmounts.value = {}
|
||||||
|
saveCumulativeAmounts()
|
||||||
|
proxy.$modal.msgSuccess('累计金额已重置')
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function handleInitDaily(forceReset = false) {
|
function handleInitDaily(forceReset = false) {
|
||||||
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||||
const text = forceReset ? `确认重置 ${entryDate} 的当日名单吗?将先删除后重建。` : `确认初始化 ${entryDate} 的工人名单吗?`
|
const text = forceReset ? `确认重置 ${entryDate} 的当日名单吗?将先删除后重建。` : `确认初始化 ${entryDate} 的工人名单吗?`
|
||||||
@@ -260,15 +447,25 @@ function handleInitDaily(forceReset = false) {
|
|||||||
proxy.$modal.msgSuccess(`操作成功,共写入 ${res.data || 0} 人`)
|
proxy.$modal.msgSuccess(`操作成功,共写入 ${res.data || 0} 人`)
|
||||||
}
|
}
|
||||||
getList()
|
getList()
|
||||||
|
}).catch(err => {
|
||||||
|
console.error('重置当日名单失败:', err)
|
||||||
|
proxy.$modal.msgError('操作失败,请稍后重试')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function autoInitFirstEnter() {
|
async function autoInitFirstEnter() {
|
||||||
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||||
|
try {
|
||||||
await initDailyWorkers({ entryDate, forceReset: false })
|
await initDailyWorkers({ entryDate, forceReset: false })
|
||||||
|
} catch (err) {
|
||||||
|
console.error('自动初始化当日名单失败:', err)
|
||||||
|
// 静默失败,不影响页面加载
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
// 加载存储的累计金额数据
|
||||||
|
loadCumulativeAmounts()
|
||||||
await autoInitFirstEnter()
|
await autoInitFirstEnter()
|
||||||
getList()
|
getList()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -91,6 +91,7 @@
|
|||||||
<script setup name="WageMakeup">
|
<script setup name="WageMakeup">
|
||||||
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail } from '@/api/oa/wageEntryDetail'
|
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail } from '@/api/oa/wageEntryDetail'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import { onMounted } from 'vue'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
@@ -102,6 +103,27 @@ const open = ref(false)
|
|||||||
const title = ref('')
|
const title = ref('')
|
||||||
const buttonLoading = ref(false)
|
const buttonLoading = ref(false)
|
||||||
|
|
||||||
|
// 存储累计金额数据
|
||||||
|
const cumulativeAmounts = ref({})
|
||||||
|
|
||||||
|
// 从localStorage加载累计金额数据
|
||||||
|
function loadCumulativeAmounts() {
|
||||||
|
const stored = localStorage.getItem('wageCumulativeAmounts')
|
||||||
|
if (stored) {
|
||||||
|
try {
|
||||||
|
cumulativeAmounts.value = JSON.parse(stored)
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Failed to parse cumulative amounts:', e)
|
||||||
|
cumulativeAmounts.value = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 保存累计金额数据到localStorage
|
||||||
|
function saveCumulativeAmounts() {
|
||||||
|
localStorage.setItem('wageCumulativeAmounts', JSON.stringify(cumulativeAmounts.value))
|
||||||
|
}
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@@ -197,6 +219,18 @@ function submitForm() {
|
|||||||
}
|
}
|
||||||
// 本页面补录语义:更新当前记录并标记为已补录
|
// 本页面补录语义:更新当前记录并标记为已补录
|
||||||
updateWageEntryDetail(payload).then(() => {
|
updateWageEntryDetail(payload).then(() => {
|
||||||
|
// 更新累计金额
|
||||||
|
const workload = parseFloat(payload.workload) || 0
|
||||||
|
const unitPrice = parseFloat(payload.unitPrice) || 0
|
||||||
|
const extraAmount = parseFloat(payload.extraAmount) || 0
|
||||||
|
const totalAmount = workload * unitPrice + extraAmount
|
||||||
|
|
||||||
|
if (!cumulativeAmounts.value[payload.empName]) {
|
||||||
|
cumulativeAmounts.value[payload.empName] = 0
|
||||||
|
}
|
||||||
|
cumulativeAmounts.value[payload.empName] += totalAmount
|
||||||
|
saveCumulativeAmounts()
|
||||||
|
|
||||||
proxy.$modal.msgSuccess('补录成功')
|
proxy.$modal.msgSuccess('补录成功')
|
||||||
open.value = false
|
open.value = false
|
||||||
getList()
|
getList()
|
||||||
@@ -229,5 +263,8 @@ function handleExport() {
|
|||||||
proxy.download('oa/wageEntryDetail/export', { ...buildQuery() }, `wage_makeup_${new Date().getTime()}.xlsx`)
|
proxy.download('oa/wageEntryDetail/export', { ...buildQuery() }, `wage_makeup_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadCumulativeAmounts()
|
||||||
getList()
|
getList()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -26,6 +26,8 @@
|
|||||||
<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="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.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="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>
|
||||||
|
|
||||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@@ -122,6 +124,21 @@
|
|||||||
<el-button @click="importOpen = false">取 消</el-button>
|
<el-button @click="importOpen = false">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
<!-- 选择系统用户导入弹窗 -->
|
||||||
|
<el-dialog title="选择需要导入的用户" v-model="userSelectOpen" width="700px" append-to-body>
|
||||||
|
<el-input v-model="userSearchKey" placeholder="搜索账号/昵称/手机号" clearable style="width: 300px; margin-bottom: 10px"/>
|
||||||
|
<el-table ref="userSelectTableRef" v-model:selection="selectedUserIds" :data="filterUserList" border height="350" @selection-change="handleUserSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="账号" prop="userName" align="center" />
|
||||||
|
<el-table-column label="昵称" prop="nickName" align="center" />
|
||||||
|
<el-table-column label="手机号" prop="phonenumber" align="center" />
|
||||||
|
</el-table>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="userSelectOpen = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="confirmImportSelectedUser">确认导入</el-button>
|
||||||
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -129,6 +146,7 @@
|
|||||||
<script setup name="Worker">
|
<script setup name="Worker">
|
||||||
import { listWorker, getWorker, addWorker, updateWorker, delWorker, importWorkerData } from '@/api/oa/worker'
|
import { listWorker, getWorker, addWorker, updateWorker, delWorker, importWorkerData } from '@/api/oa/worker'
|
||||||
import { listWageRateConfig } from '@/api/oa/wageRateConfig'
|
import { listWageRateConfig } from '@/api/oa/wageRateConfig'
|
||||||
|
import { listUser } from '@/api/system/user'
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
|
||||||
@@ -148,8 +166,37 @@ const importLoading = ref(false)
|
|||||||
const updateSupport = ref(false)
|
const updateSupport = ref(false)
|
||||||
const importFile = ref(null)
|
const importFile = ref(null)
|
||||||
|
|
||||||
|
// 选择用户导入相关
|
||||||
|
const userSelectOpen = ref(false)
|
||||||
|
const allUserList = ref([])
|
||||||
|
const selectedUserIds = ref([])
|
||||||
|
// 已存在工号缓存
|
||||||
|
const existWorkerNos = ref([])
|
||||||
|
// 用户检索关键词
|
||||||
|
const userSearchKey = ref('')
|
||||||
|
|
||||||
|
// 过滤后的用户列表(账号/昵称/手机号模糊检索)
|
||||||
|
const filterUserList = computed(() => {
|
||||||
|
const key = userSearchKey.value.trim()
|
||||||
|
if (!key) return allUserList.value
|
||||||
|
return allUserList.value.filter(item =>
|
||||||
|
item.userName?.includes(key) ||
|
||||||
|
item.nickName?.includes(key) ||
|
||||||
|
item.phonenumber?.includes(key)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
// 表格ref
|
||||||
|
const userSelectTableRef = ref(null)
|
||||||
|
|
||||||
|
// 同步选中的用户ID
|
||||||
|
function handleUserSelectionChange(selection) {
|
||||||
|
selectedUserIds.value = selection.map(item => item.userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const rateOptions = ref([])
|
const rateOptions = ref([])
|
||||||
|
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
form: {},
|
form: {},
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@@ -358,5 +405,86 @@ function submitImport() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 打开用户选择弹窗【修复空值初始化】
|
||||||
|
async function openUserSelectDialog() {
|
||||||
|
// 每次打开都严格初始化所有变量,避免 undefined
|
||||||
|
allUserList.value = []
|
||||||
|
selectedUserIds.value = []
|
||||||
|
userSearchKey.value = ''
|
||||||
|
|
||||||
|
try {
|
||||||
|
loading.value = true
|
||||||
|
// 加载系统用户列表
|
||||||
|
const userRes = await listUser({ pageNum: 1, pageSize: 9999, status: '0' })
|
||||||
|
// 确保赋值为数组,避免 undefined
|
||||||
|
allUserList.value = userRes?.rows || []
|
||||||
|
} catch (err) {
|
||||||
|
console.error("加载用户失败", err)
|
||||||
|
proxy.$modal.msgError('加载用户列表失败')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
userSelectOpen.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 确认导入选中用户【前端终极兜底 · 零报错】
|
||||||
|
async function confirmImportSelectedUser() {
|
||||||
|
if (!selectedUserIds.value?.length) {
|
||||||
|
proxy.$modal.msgWarning('请至少选择一条用户')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!filterUserList.value?.length) {
|
||||||
|
proxy.$modal.msgWarning('用户列表为空,无法导入')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loading.value = true
|
||||||
|
let success = 0, update = 0
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 1. 一次性查询所有已存在工号,构建Map
|
||||||
|
const { rows: existWorkers } = await listWorker({ pageNum: 1, pageSize: 9999 })
|
||||||
|
const existMap = new Map(existWorkers.map(w => [w.workerNo, w]))
|
||||||
|
|
||||||
|
// 2. 过滤有效用户
|
||||||
|
const users = filterUserList.value.filter(u =>
|
||||||
|
u?.userId && selectedUserIds.value.includes(u.userId)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 3. 分批次处理,避免并发冲突
|
||||||
|
for (const user of users) {
|
||||||
|
const workerNo = user.userName
|
||||||
|
const data = {
|
||||||
|
workerNo,
|
||||||
|
workerName: user.nickName || user.userName,
|
||||||
|
phone: user.phonenumber,
|
||||||
|
status: '0',
|
||||||
|
defaultBillingType: '1',
|
||||||
|
defaultWorkTypeName: '普通工人',
|
||||||
|
remark: '从系统用户导入'
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 严格判断:Map中存在 → 更新,不存在 → 新增
|
||||||
|
if (existMap.has(workerNo)) {
|
||||||
|
data.workerId = existMap.get(workerNo).workerId
|
||||||
|
await updateWorker(data)
|
||||||
|
update++
|
||||||
|
} else {
|
||||||
|
await addWorker(data)
|
||||||
|
success++
|
||||||
|
// 同步更新Map,避免后续重复判断
|
||||||
|
existMap.set(workerNo, { workerNo })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy.$modal.msgSuccess(`导入完成:新增 ${success} 条,更新 ${update} 条`)
|
||||||
|
userSelectOpen.value = false
|
||||||
|
getList()
|
||||||
|
} catch (err) {
|
||||||
|
console.error('导入失败:', err)
|
||||||
|
proxy.$modal.msgError('导入失败,请查看控制台日志')
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
getList()
|
getList()
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -501,6 +501,14 @@ function handleAdd() {
|
|||||||
function handleUpdate(row) {
|
function handleUpdate(row) {
|
||||||
reset()
|
reset()
|
||||||
const userId = row.userId || ids.value
|
const userId = row.userId || ids.value
|
||||||
|
// let userId
|
||||||
|
// if (row && row.userId) {
|
||||||
|
// userId = row.userId
|
||||||
|
// } else if (ids.value && ids.value.length > 0) {
|
||||||
|
// userId = ids.value[0]
|
||||||
|
// } else {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
getUser(userId).then(response => {
|
getUser(userId).then(response => {
|
||||||
form.value = response.data
|
form.value = response.data
|
||||||
postOptions.value = response.data.posts
|
postOptions.value = response.data.posts
|
||||||
@@ -509,7 +517,7 @@ function handleUpdate(row) {
|
|||||||
form.value.roleIds = response.data.roleIds
|
form.value.roleIds = response.data.roleIds
|
||||||
open.value = true
|
open.value = true
|
||||||
title.value = "修改用户"
|
title.value = "修改用户"
|
||||||
form.password = ""
|
form.value.password = ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
0
script/sql/mysql/item/ACT_EVT_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_EVT_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_GE_BYTEARRAY.sql
Normal file
0
script/sql/mysql/item/ACT_GE_BYTEARRAY.sql
Normal file
13
script/sql/mysql/item/ACT_GE_PROPERTY.sql
Normal file
13
script/sql/mysql/item/ACT_GE_PROPERTY.sql
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('batch.schema.version', '6.7.2.3', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('cfg.execution-related-entities-count', 'true', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('cfg.task-related-entities-count', 'true', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('common.schema.version', '6.8.0.0', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('entitylink.schema.version', '6.8.0.0', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('eventsubscription.schema.version', '6.8.0.0', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('identitylink.schema.version', '6.8.0.0', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('job.schema.version', '6.8.0.0', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('next.dbid', '1', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('schema.history', 'upgrade(6.7.2.0->6.8.0.0)', 2);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('schema.version', '6.8.0.0', 2);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('task.schema.version', '6.8.0.0', 1);
|
||||||
|
INSERT INTO `ACT_GE_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('variable.schema.version', '6.8.0.0', 1);
|
||||||
0
script/sql/mysql/item/ACT_HI_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ATTACHMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ATTACHMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_COMMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_COMMENT.sql
Normal file
0
script/sql/mysql/item/ACT_HI_DETAIL.sql
Normal file
0
script/sql/mysql/item/ACT_HI_DETAIL.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_ENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_IDENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_IDENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_HI_PROCINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_PROCINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TASKINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TASKINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TSK_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_HI_TSK_LOG.sql
Normal file
0
script/sql/mysql/item/ACT_HI_VARINST.sql
Normal file
0
script/sql/mysql/item/ACT_HI_VARINST.sql
Normal file
0
script/sql/mysql/item/ACT_ID_BYTEARRAY.sql
Normal file
0
script/sql/mysql/item/ACT_ID_BYTEARRAY.sql
Normal file
0
script/sql/mysql/item/ACT_ID_GROUP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_GROUP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_ID_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_ID_MEMBERSHIP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_MEMBERSHIP.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV_MAPPING.sql
Normal file
0
script/sql/mysql/item/ACT_ID_PRIV_MAPPING.sql
Normal file
1
script/sql/mysql/item/ACT_ID_PROPERTY.sql
Normal file
1
script/sql/mysql/item/ACT_ID_PROPERTY.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `ACT_ID_PROPERTY` (`NAME_`, `VALUE_`, `REV_`) VALUES ('schema.version', '6.7.2.0', 1);
|
||||||
0
script/sql/mysql/item/ACT_ID_TOKEN.sql
Normal file
0
script/sql/mysql/item/ACT_ID_TOKEN.sql
Normal file
0
script/sql/mysql/item/ACT_ID_USER.sql
Normal file
0
script/sql/mysql/item/ACT_ID_USER.sql
Normal file
0
script/sql/mysql/item/ACT_PROCDEF_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_PROCDEF_INFO.sql
Normal file
0
script/sql/mysql/item/ACT_RE_DEPLOYMENT.sql
Normal file
0
script/sql/mysql/item/ACT_RE_DEPLOYMENT.sql
Normal file
0
script/sql/mysql/item/ACT_RE_MODEL.sql
Normal file
0
script/sql/mysql/item/ACT_RE_MODEL.sql
Normal file
0
script/sql/mysql/item/ACT_RE_PROCDEF.sql
Normal file
0
script/sql/mysql/item/ACT_RE_PROCDEF.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ACTINST.sql
Normal file
0
script/sql/mysql/item/ACT_RU_DEADLETTER_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_DEADLETTER_JOB.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ENTITYLINK.sql
Normal file
0
script/sql/mysql/item/ACT_RU_ENTITYLINK.sql
Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user