Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3363214076 | ||
|
|
2796cf3b8f | ||
|
|
3fd207a42c | ||
| d6d3e9d054 | |||
| 89cbe18c72 | |||
|
|
475a051b1c | ||
|
|
b5c1cdac12 | ||
| 1d402f4d72 | |||
| 49606bf823 | |||
|
|
048aeefa77 | ||
| fdba2fb78d | |||
| e74cd653e2 | |||
| 32f7290778 | |||
| b0a332fda1 | |||
| a83a8147a4 | |||
| ee17d558f2 | |||
| 30a4b11faf | |||
|
|
6ef6d70a1a | ||
|
|
07ec810550 | ||
|
|
2279eae481 |
@@ -0,0 +1,95 @@
|
||||
package com.klp.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.klp.common.annotation.RepeatSubmit;
|
||||
import com.klp.common.annotation.Log;
|
||||
import com.klp.common.core.controller.BaseController;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.common.core.validate.AddGroup;
|
||||
import com.klp.common.core.validate.EditGroup;
|
||||
import com.klp.common.enums.BusinessType;
|
||||
import com.klp.common.utils.poi.ExcelUtil;
|
||||
import com.klp.system.domain.vo.SysFileImageVo;
|
||||
import com.klp.system.domain.bo.SysFileImageBo;
|
||||
import com.klp.system.service.ISysFileImageService;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 文件图片关联
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-13
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/system/fileImage")
|
||||
public class SysFileImageController extends BaseController {
|
||||
|
||||
private final ISysFileImageService iSysFileImageService;
|
||||
|
||||
/**
|
||||
* 查询文件图片关联列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SysFileImageVo> list(SysFileImageBo bo, PageQuery pageQuery) {
|
||||
return iSysFileImageService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出文件图片关联列表
|
||||
*/
|
||||
@Log(title = "文件图片关联", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SysFileImageBo bo, HttpServletResponse response) {
|
||||
List<SysFileImageVo> list = iSysFileImageService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "文件图片关联", SysFileImageVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件图片关联详细信息
|
||||
*/
|
||||
@GetMapping("/{imageId}")
|
||||
public R<SysFileImageVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long imageId) {
|
||||
return R.ok(iSysFileImageService.queryById(imageId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件图片关联
|
||||
*/
|
||||
@Log(title = "文件图片关联", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysFileImageBo bo) {
|
||||
return toAjax(iSysFileImageService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件图片关联
|
||||
*/
|
||||
@Log(title = "文件图片关联", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysFileImageBo bo) {
|
||||
return toAjax(iSysFileImageService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件图片关联
|
||||
*/
|
||||
@Log(title = "文件图片关联", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{imageIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] imageIds) {
|
||||
return toAjax(iSysFileImageService.deleteWithValidByIds(Arrays.asList(imageIds), true));
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class TsComplaintAcceptController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起流程:创建质量部+生产部并行任务
|
||||
* 发起流程(串行):创建技术部任务
|
||||
*
|
||||
* @param acceptId 受理单ID
|
||||
*/
|
||||
|
||||
@@ -48,7 +48,7 @@ public interface ITsComplaintAcceptService {
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 发起流程:创建质量部+生产部并行任务,更新flowStatus=1
|
||||
* 发起流程(串行):创建技术部任务,更新flowStatus=1
|
||||
*/
|
||||
Boolean opinionDispatch(Long acceptId);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class TsComplaintAcceptServiceImpl implements ITsComplaintAcceptService {
|
||||
}).collect(java.util.stream.Collectors.toList());
|
||||
tsAcceptCoilRelMapper.insertBatch(relList);
|
||||
}
|
||||
// 自动创建质量部+生产部并行任务,发起流程
|
||||
// 自动创建技术部任务,发起串行流程
|
||||
opinionDispatch(add.getAcceptId());
|
||||
}
|
||||
return flag;
|
||||
@@ -132,30 +132,23 @@ public class TsComplaintAcceptServiceImpl implements ITsComplaintAcceptService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起流程
|
||||
* 创建质量部(deptId=2) + 生产部(deptId=1) 两个并行代办任务
|
||||
* 更新受理单flow_status=1(质量部·生产部处理中)
|
||||
* 发起流程(串行)
|
||||
* 创建技术部(deptId=2) 代办任务
|
||||
* 更新受理单flow_status=1(技术部处理中)
|
||||
*/
|
||||
@Override
|
||||
public Boolean opinionDispatch(Long acceptId) {
|
||||
if (acceptId == null) {
|
||||
return false;
|
||||
}
|
||||
// 1. 创建质量部task deptId=2
|
||||
TsComplaintTask qaTask = new TsComplaintTask();
|
||||
qaTask.setAcceptId(acceptId);
|
||||
qaTask.setDeptId(2L);
|
||||
qaTask.setTaskStatus(0L);
|
||||
qaTask.setRejectMark(0L);
|
||||
tsComplaintTaskMapper.insert(qaTask);
|
||||
// 2. 创建生产部task deptId=1
|
||||
TsComplaintTask prodTask = new TsComplaintTask();
|
||||
prodTask.setAcceptId(acceptId);
|
||||
prodTask.setDeptId(1L);
|
||||
prodTask.setTaskStatus(0L);
|
||||
prodTask.setRejectMark(0L);
|
||||
tsComplaintTaskMapper.insert(prodTask);
|
||||
// 3. 更新受理单流程状态为1(质量部·生产部处理中)
|
||||
// 1. 创建技术部task deptId=2
|
||||
TsComplaintTask techTask = new TsComplaintTask();
|
||||
techTask.setAcceptId(acceptId);
|
||||
techTask.setDeptId(2L);
|
||||
techTask.setTaskStatus(0L);
|
||||
techTask.setRejectMark(0L);
|
||||
tsComplaintTaskMapper.insert(techTask);
|
||||
// 2. 更新受理单流程状态为1(技术部处理中)
|
||||
LambdaUpdateWrapper<TsComplaintAccept> uw = Wrappers.lambdaUpdate();
|
||||
uw.eq(TsComplaintAccept::getAcceptId, acceptId)
|
||||
.set(TsComplaintAccept::getFlowStatus, 1L);
|
||||
|
||||
@@ -157,10 +157,11 @@ public class TsComplaintTaskServiceImpl implements ITsComplaintTaskService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步受理单流程状态 — 串行推进逻辑
|
||||
* Step 1: 质量部(deptId=2) + 生产部(deptId=1) 都完成 → 创建陈总task(deptId=4), flowStatus=2
|
||||
* Step 2: 陈总完成 → 创建吴部长task(deptId=3), flowStatus=3
|
||||
* Step 3: 吴部长完成 → flowStatus=4 已办结
|
||||
* 同步受理单流程状态 — 严格串行推进逻辑
|
||||
* Step 1: 技术部(deptId=2)完成 → 创建生产部task(deptId=1), flowStatus=2
|
||||
* Step 2: 生产部(deptId=1)完成 → 创建陈总task(deptId=4), flowStatus=3
|
||||
* Step 3: 陈总(deptId=4)完成 → 创建吴部长task(deptId=3), flowStatus=4
|
||||
* Step 4: 吴部长(deptId=3)完成 → flowStatus=5 已办结
|
||||
*/
|
||||
private void syncAcceptFlowStatus(Long acceptId) {
|
||||
if (acceptId == null) {
|
||||
@@ -178,52 +179,49 @@ public class TsComplaintTaskServiceImpl implements ITsComplaintTaskService {
|
||||
Map<Long, List<TsComplaintTask>> taskByDept = taskList.stream()
|
||||
.collect(Collectors.groupingBy(TsComplaintTask::getDeptId));
|
||||
|
||||
// Step 1: 质量部(deptId=2) 和 生产部(deptId=1) 是否都完成
|
||||
boolean qaDone = taskByDept.containsKey(2L) &&
|
||||
taskByDept.get(2L).stream().allMatch(t -> t.getTaskStatus() != null && t.getTaskStatus() == 1L);
|
||||
boolean prodDone = taskByDept.containsKey(1L) &&
|
||||
taskByDept.get(1L).stream().allMatch(t -> t.getTaskStatus() != null && t.getTaskStatus() == 1L);
|
||||
|
||||
if (qaDone && prodDone) {
|
||||
// 两者都完成 → 检查陈总节点(deptId=4)是否存在
|
||||
boolean chenExists = taskByDept.containsKey(4L);
|
||||
if (!chenExists) {
|
||||
// 创建陈总task deptId=4
|
||||
TsComplaintTask chenTask = new TsComplaintTask();
|
||||
chenTask.setAcceptId(acceptId);
|
||||
chenTask.setDeptId(4L);
|
||||
chenTask.setRejectMark(0L);
|
||||
chenTask.setTaskStatus(0L);
|
||||
baseMapper.insert(chenTask);
|
||||
updateFlowStatus(acceptId, 2L); // 待陈总审批
|
||||
} else {
|
||||
// 陈总节点已存在,检查是否完成
|
||||
boolean chenDone = taskByDept.get(4L).stream()
|
||||
.allMatch(t -> t.getTaskStatus() != null && t.getTaskStatus() == 1L);
|
||||
if (chenDone) {
|
||||
// 陈总完成 → 检查吴部长节点(deptId=3)是否存在
|
||||
boolean wuExists = taskByDept.containsKey(3L);
|
||||
if (!wuExists) {
|
||||
// 创建吴部长task deptId=3
|
||||
TsComplaintTask wuTask = new TsComplaintTask();
|
||||
wuTask.setAcceptId(acceptId);
|
||||
wuTask.setDeptId(3L);
|
||||
wuTask.setRejectMark(0L);
|
||||
wuTask.setTaskStatus(0L);
|
||||
baseMapper.insert(wuTask);
|
||||
updateFlowStatus(acceptId, 3L); // 待吴部长处理
|
||||
} else {
|
||||
// 吴部长已完成 → 办结
|
||||
boolean wuDone = taskByDept.get(3L).stream()
|
||||
.allMatch(t -> t.getTaskStatus() != null && t.getTaskStatus() == 1L);
|
||||
if (wuDone) {
|
||||
updateFlowStatus(acceptId, 4L); // 已办结
|
||||
}
|
||||
}
|
||||
// 辅助方法:检查某部门的所有任务是否都已完成
|
||||
java.util.function.BiFunction<Long, Long, Boolean> isDeptDone = (deptId, nextFlowStatus) -> {
|
||||
if (!taskByDept.containsKey(deptId)) {
|
||||
return false;
|
||||
}
|
||||
boolean done = taskByDept.get(deptId).stream()
|
||||
.allMatch(t -> t.getTaskStatus() != null && t.getTaskStatus() == 1L);
|
||||
if (done) {
|
||||
// 检查是否已存在下一节点,若不存在则创建
|
||||
Long nextDeptId = getNextDept(deptId);
|
||||
if (nextDeptId != null && !taskByDept.containsKey(nextDeptId)) {
|
||||
TsComplaintTask nextTask = new TsComplaintTask();
|
||||
nextTask.setAcceptId(acceptId);
|
||||
nextTask.setDeptId(nextDeptId);
|
||||
nextTask.setRejectMark(0L);
|
||||
nextTask.setTaskStatus(0L);
|
||||
baseMapper.insert(nextTask);
|
||||
updateFlowStatus(acceptId, nextFlowStatus);
|
||||
} else if (nextDeptId == null) {
|
||||
// 最后一步(吴部长完成)→ 办结
|
||||
updateFlowStatus(acceptId, 5L);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 质/产未全部完成时不做任何事,等待
|
||||
return done;
|
||||
};
|
||||
|
||||
// 按串行顺序依次推进:技术部→生产部→陈总→吴部长→办结
|
||||
// flowStatus: 1→2→3→4→5
|
||||
isDeptDone.apply(2L, 2L); // 技术部完成 → 生产部, flowStatus=2
|
||||
isDeptDone.apply(1L, 3L); // 生产部完成 → 陈总, flowStatus=3
|
||||
isDeptDone.apply(4L, 4L); // 陈总完成 → 吴部长, flowStatus=4
|
||||
isDeptDone.apply(3L, 5L); // 吴部长完成 → 办结, flowStatus=5
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取串行流程中当前部门完成后应创建的下一个部门
|
||||
* 2(技术部) → 1(生产部) → 4(陈总) → 3(吴部长) → null(办结)
|
||||
*/
|
||||
private Long getNextDept(Long deptId) {
|
||||
if (deptId == 2L) return 1L; // 技术部 → 生产部
|
||||
if (deptId == 1L) return 4L; // 生产部 → 陈总
|
||||
if (deptId == 4L) return 3L; // 陈总 → 吴部长
|
||||
return null; // 吴部长 → 办结
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.klp.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 文件图片关联对象 sys_file_image
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-13
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_file_image")
|
||||
public class SysFileImage {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 图片ID
|
||||
*/
|
||||
@TableId(value = "image_id")
|
||||
private Long imageId;
|
||||
/**
|
||||
* 主记录ID 关联sys_file.file_id
|
||||
*/
|
||||
private Long fileId;
|
||||
/**
|
||||
* 图片原始名称
|
||||
*/
|
||||
private String imageName;
|
||||
/**
|
||||
* 图片存储路径/对象存储地址
|
||||
*/
|
||||
private String imagePath;
|
||||
/**
|
||||
* 图片大小(字节)
|
||||
*/
|
||||
private Long imageSize;
|
||||
/**
|
||||
* 后缀 jpg/png
|
||||
*/
|
||||
private String suffix;
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.klp.system.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import com.klp.system.domain.bo.SysFileImageBo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 文件主信息业务对象 sys_file
|
||||
@@ -72,4 +75,9 @@ public class SysFileBo extends BaseEntity {
|
||||
*/
|
||||
private Long viewCount;
|
||||
|
||||
/**
|
||||
* 图片列表(多图模式)
|
||||
*/
|
||||
private List<SysFileImageBo> imageList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.klp.system.domain.bo;
|
||||
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
|
||||
/**
|
||||
* 文件图片关联业务对象 sys_file_image
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-13
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysFileImageBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 图片ID
|
||||
*/
|
||||
private Long imageId;
|
||||
|
||||
/**
|
||||
* 主记录ID 关联sys_file.file_id
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 图片原始名称
|
||||
*/
|
||||
private String imageName;
|
||||
|
||||
/**
|
||||
* 图片存储路径/对象存储地址
|
||||
*/
|
||||
private String imagePath;
|
||||
|
||||
/**
|
||||
* 图片大小(字节)
|
||||
*/
|
||||
private Long imageSize;
|
||||
|
||||
/**
|
||||
* 后缀 jpg/png
|
||||
*/
|
||||
private String suffix;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.klp.system.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 文件图片关联视图对象 sys_file_image
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-13
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class SysFileImageVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 图片ID
|
||||
*/
|
||||
@ExcelProperty(value = "图片ID")
|
||||
private Long imageId;
|
||||
|
||||
/**
|
||||
* 主记录ID 关联sys_file.file_id
|
||||
*/
|
||||
@ExcelProperty(value = "主记录ID")
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 图片原始名称
|
||||
*/
|
||||
@ExcelProperty(value = "图片原始名称")
|
||||
private String imageName;
|
||||
|
||||
/**
|
||||
* 图片存储路径/对象存储地址
|
||||
*/
|
||||
@ExcelProperty(value = "图片存储路径")
|
||||
private String imagePath;
|
||||
|
||||
/**
|
||||
* 图片大小(字节)
|
||||
*/
|
||||
@ExcelProperty(value = "图片大小")
|
||||
private Long imageSize;
|
||||
|
||||
/**
|
||||
* 后缀 jpg/png
|
||||
*/
|
||||
@ExcelProperty(value = "后缀")
|
||||
private String suffix;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
@ExcelProperty(value = "排序号")
|
||||
private Integer sortOrder;
|
||||
|
||||
}
|
||||
@@ -5,8 +5,11 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import com.klp.system.domain.vo.SysFileImageVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 文件主信息视图对象 sys_file
|
||||
@@ -92,4 +95,9 @@ public class SysFileVo extends BaseEntity {
|
||||
@ExcelProperty(value = "创建者昵称")
|
||||
private String createByName;
|
||||
|
||||
/**
|
||||
* 图片列表(多图模式)
|
||||
*/
|
||||
private List<SysFileImageVo> imageList;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.klp.system.mapper;
|
||||
|
||||
import com.klp.system.domain.SysFileImage;
|
||||
import com.klp.system.domain.vo.SysFileImageVo;
|
||||
import com.klp.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 文件图片关联Mapper接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-13
|
||||
*/
|
||||
public interface SysFileImageMapper extends BaseMapperPlus<SysFileImageMapper, SysFileImage, SysFileImageVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.klp.system.service;
|
||||
|
||||
import com.klp.system.domain.SysFileImage;
|
||||
import com.klp.system.domain.vo.SysFileImageVo;
|
||||
import com.klp.system.domain.bo.SysFileImageBo;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件图片关联Service接口
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-13
|
||||
*/
|
||||
public interface ISysFileImageService {
|
||||
|
||||
/**
|
||||
* 查询文件图片关联
|
||||
*/
|
||||
SysFileImageVo queryById(Long imageId);
|
||||
|
||||
/**
|
||||
* 查询文件图片关联列表
|
||||
*/
|
||||
TableDataInfo<SysFileImageVo> queryPageList(SysFileImageBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询文件图片关联列表
|
||||
*/
|
||||
List<SysFileImageVo> queryList(SysFileImageBo bo);
|
||||
|
||||
/**
|
||||
* 新增文件图片关联
|
||||
*/
|
||||
Boolean insertByBo(SysFileImageBo bo);
|
||||
|
||||
/**
|
||||
* 修改文件图片关联
|
||||
*/
|
||||
Boolean updateByBo(SysFileImageBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除文件图片关联信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 根据文件ID查询图片列表
|
||||
*/
|
||||
List<SysFileImageVo> queryListByFileId(Long fileId);
|
||||
|
||||
/**
|
||||
* 批量保存图片
|
||||
*/
|
||||
void saveImageList(Long fileId, List<SysFileImageBo> imageList);
|
||||
|
||||
/**
|
||||
* 根据文件ID删除所有图片
|
||||
*/
|
||||
void deleteByFileId(Long fileId);
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.klp.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.system.domain.bo.SysFileImageBo;
|
||||
import com.klp.system.domain.vo.SysFileImageVo;
|
||||
import com.klp.system.domain.SysFileImage;
|
||||
import com.klp.system.mapper.SysFileImageMapper;
|
||||
import com.klp.system.service.ISysFileImageService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 文件图片关联Service业务层处理
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-13
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysFileImageServiceImpl implements ISysFileImageService {
|
||||
|
||||
private final SysFileImageMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询文件图片关联
|
||||
*/
|
||||
@Override
|
||||
public SysFileImageVo queryById(Long imageId){
|
||||
return baseMapper.selectVoById(imageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件图片关联列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysFileImageVo> queryPageList(SysFileImageBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SysFileImage> lqw = buildQueryWrapper(bo);
|
||||
Page<SysFileImageVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件图片关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<SysFileImageVo> queryList(SysFileImageBo bo) {
|
||||
LambdaQueryWrapper<SysFileImage> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysFileImage> buildQueryWrapper(SysFileImageBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysFileImage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getFileId() != null, SysFileImage::getFileId, bo.getFileId());
|
||||
lqw.orderByAsc(SysFileImage::getSortOrder);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysFileImageVo> queryListByFileId(Long fileId) {
|
||||
LambdaQueryWrapper<SysFileImage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(SysFileImage::getFileId, fileId);
|
||||
lqw.orderByAsc(SysFileImage::getSortOrder);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存图片(先删后插)
|
||||
*/
|
||||
@Override
|
||||
public void saveImageList(Long fileId, List<SysFileImageBo> imageList) {
|
||||
if (fileId == null) return;
|
||||
// 先删除原有图片
|
||||
deleteByFileId(fileId);
|
||||
// 批量插入
|
||||
if (imageList != null && !imageList.isEmpty()) {
|
||||
for (int i = 0; i < imageList.size(); i++) {
|
||||
SysFileImageBo bo = imageList.get(i);
|
||||
SysFileImage entity = BeanUtil.toBean(bo, SysFileImage.class);
|
||||
entity.setFileId(fileId);
|
||||
entity.setSortOrder(i);
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByFileId(Long fileId) {
|
||||
baseMapper.delete(Wrappers.<SysFileImage>lambdaQuery()
|
||||
.eq(SysFileImage::getFileId, fileId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件图片关联
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SysFileImageBo bo) {
|
||||
SysFileImage add = BeanUtil.toBean(bo, SysFileImage.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setImageId(add.getImageId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件图片关联
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SysFileImageBo bo) {
|
||||
SysFileImage update = BeanUtil.toBean(bo, SysFileImage.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SysFileImage entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除文件图片关联
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,11 @@ import org.springframework.stereotype.Service;
|
||||
import com.klp.system.domain.bo.SysFileBo;
|
||||
import com.klp.system.domain.vo.SysFileVo;
|
||||
import com.klp.system.domain.SysFile;
|
||||
import com.klp.system.domain.SysFileImage;
|
||||
import com.klp.system.domain.SysFileVisibleUser;
|
||||
import com.klp.system.domain.bo.SysFileImageBo;
|
||||
import com.klp.system.domain.vo.SysFileImageVo;
|
||||
import com.klp.system.mapper.SysFileImageMapper;
|
||||
import com.klp.system.mapper.SysFileMapper;
|
||||
import com.klp.system.mapper.SysFileVisibleUserMapper;
|
||||
import com.klp.system.mapper.SysUserMapper;
|
||||
@@ -39,6 +43,7 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
|
||||
private final SysFileMapper baseMapper;
|
||||
private final SysFileVisibleUserMapper visibleUserMapper;
|
||||
private final SysFileImageMapper fileImageMapper;
|
||||
private final SysUserMapper userMapper;
|
||||
|
||||
/**
|
||||
@@ -46,7 +51,16 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
*/
|
||||
@Override
|
||||
public SysFileVo queryById(Long fileId){
|
||||
return baseMapper.selectVoById(fileId);
|
||||
SysFileVo vo = baseMapper.selectVoById(fileId);
|
||||
if (vo != null) {
|
||||
// 加载图片列表
|
||||
List<SysFileImageVo> imageList = fileImageMapper.selectVoList(
|
||||
Wrappers.<SysFileImage>lambdaQuery()
|
||||
.eq(SysFileImage::getFileId, fileId)
|
||||
.orderByAsc(SysFileImage::getSortOrder));
|
||||
vo.setImageList(imageList);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,10 +110,25 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setFileId(add.getFileId());
|
||||
// 保存图片列表
|
||||
saveImageList(add.getFileId(), bo.getImageList());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
private void saveImageList(Long fileId, List<SysFileImageBo> imageList) {
|
||||
if (fileId == null || imageList == null || imageList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < imageList.size(); i++) {
|
||||
SysFileImageBo imageBo = imageList.get(i);
|
||||
SysFileImage entity = BeanUtil.toBean(imageBo, SysFileImage.class);
|
||||
entity.setFileId(fileId);
|
||||
entity.setSortOrder(i);
|
||||
fileImageMapper.insert(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件主信息
|
||||
*/
|
||||
@@ -107,7 +136,14 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
public Boolean updateByBo(SysFileBo bo) {
|
||||
SysFile update = BeanUtil.toBean(bo, SysFile.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
boolean flag = baseMapper.updateById(update) > 0;
|
||||
if (flag && bo.getImageList() != null) {
|
||||
// 先删后插图片列表
|
||||
fileImageMapper.delete(Wrappers.<SysFileImage>lambdaQuery()
|
||||
.eq(SysFileImage::getFileId, bo.getFileId()));
|
||||
saveImageList(bo.getFileId(), bo.getImageList());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,6 +223,11 @@ public class SysFileServiceImpl implements ISysFileService {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
if (ids != null && !ids.isEmpty()) {
|
||||
// 删除关联的图片
|
||||
fileImageMapper.delete(Wrappers.<SysFileImage>lambdaQuery()
|
||||
.in(SysFileImage::getFileId, ids));
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.klp.system.mapper.SysFileImageMapper">
|
||||
|
||||
<resultMap type="com.klp.system.domain.SysFileImage" id="SysFileImageResult">
|
||||
<result property="imageId" column="image_id"/>
|
||||
<result property="fileId" column="file_id"/>
|
||||
<result property="imageName" column="image_name"/>
|
||||
<result property="imagePath" column="image_path"/>
|
||||
<result property="imageSize" column="image_size"/>
|
||||
<result property="suffix" column="suffix"/>
|
||||
<result property="sortOrder" column="sort_order"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
@@ -1,11 +1,12 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询参数列表
|
||||
export function listConfig(query) {
|
||||
export function listConfig(query, requestOptions = {}) {
|
||||
return request({
|
||||
url: '/system/config/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
params: query,
|
||||
...requestOptions
|
||||
})
|
||||
}
|
||||
|
||||
@@ -18,28 +19,31 @@ export function getConfig(configId) {
|
||||
}
|
||||
|
||||
// 根据参数键名查询参数值
|
||||
export function getConfigKey(configKey) {
|
||||
export function getConfigKey(configKey, requestOptions = {}) {
|
||||
return request({
|
||||
url: '/system/config/configKey/' + configKey,
|
||||
method: 'get'
|
||||
method: 'get',
|
||||
...requestOptions
|
||||
})
|
||||
}
|
||||
|
||||
// 新增参数配置
|
||||
export function addConfig(data) {
|
||||
export function addConfig(data, requestOptions = {}) {
|
||||
return request({
|
||||
url: '/system/config',
|
||||
method: 'post',
|
||||
data: data
|
||||
data: data,
|
||||
...requestOptions
|
||||
})
|
||||
}
|
||||
|
||||
// 修改参数配置
|
||||
export function updateConfig(data) {
|
||||
export function updateConfig(data, requestOptions = {}) {
|
||||
return request({
|
||||
url: '/system/config',
|
||||
method: 'put',
|
||||
data: data
|
||||
data: data,
|
||||
...requestOptions
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -105,3 +105,45 @@ export function listVisibleUserByFileId(fileId) {
|
||||
params: { fileId: fileId }
|
||||
})
|
||||
}
|
||||
|
||||
// ============ OSS 上传 ============
|
||||
|
||||
// 上传文件到OSS
|
||||
export function uploadFile(file) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return request({
|
||||
url: '/system/oss/upload',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
headers: { 'Content-Type': 'multipart/form-data' }
|
||||
})
|
||||
}
|
||||
|
||||
// ============ 文件图片关联 ============
|
||||
|
||||
// 新增图片关联
|
||||
export function addFileImage(data) {
|
||||
return request({
|
||||
url: '/system/fileImage',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改图片关联(替换图片)
|
||||
export function updateFileImage(data) {
|
||||
return request({
|
||||
url: '/system/fileImage',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除图片关联
|
||||
export function delFileImage(imageIds) {
|
||||
return request({
|
||||
url: '/system/fileImage/' + imageIds,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,3 +8,12 @@ export function getAnnealPerformance(query) {
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询退火计划中的加工前钢卷列表
|
||||
export function getAnnealRawCoils(query) {
|
||||
return request({
|
||||
url: '/wms/anneal/performance/rawCoils',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
10
klp-ui/src/api/wms/coilChangeLog.js
Normal file
10
klp-ui/src/api/wms/coilChangeLog.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 根据钢卷ID查询钢卷变更日志
|
||||
export function getCoilChangeLogByCoilId(coilId) {
|
||||
return request({
|
||||
url: '/wms/coilChangeLog/byCoilId/' + coilId,
|
||||
method: 'get',
|
||||
timeout: 100000
|
||||
})
|
||||
}
|
||||
1
klp-ui/src/assets/icons/svg/shuzi4.svg
Normal file
1
klp-ui/src/assets/icons/svg/shuzi4.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1783757563583" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5111" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 102.4c-226.304 0-409.6 183.296-409.6 409.6s183.296 409.6 409.6 409.6 409.6-183.296 409.6-409.6-183.296-409.6-409.6-409.6z m0 760.832c-193.536 0-351.232-157.696-351.232-351.232S318.464 160.768 512 160.768 863.232 318.464 863.232 512 705.536 863.232 512 863.232z" fill="#9D9D9D" p-id="5112"></path><path d="M590.848 564.224h-16.384V368.64c0-12.288-3.072-21.504-8.192-27.648-6.144-6.144-15.36-8.192-29.696-8.192-6.144 0-11.264 1.024-15.36 2.048-4.096 1.024-8.192 3.072-12.288 7.168-4.096 3.072-8.192 8.192-12.288 14.336-4.096 6.144-10.24 14.336-16.384 24.576L366.592 552.96c-3.072 3.072-5.12 6.144-6.144 9.216-1.024 2.048-2.048 5.12-3.072 8.192-1.024 3.072-1.024 5.12-1.024 8.192v10.24c0 9.216 2.048 17.408 6.144 22.528 4.096 6.144 11.264 9.216 21.504 9.216H512v51.2c0 7.168 2.048 12.288 6.144 15.36 4.096 3.072 12.288 4.096 24.576 4.096s21.504-1.024 25.6-4.096c4.096-3.072 6.144-8.192 6.144-15.36v-51.2h16.384c9.216 0 14.336-9.216 14.336-28.672 0-18.432-5.12-27.648-14.336-27.648z m-78.848 0h-86.016L512 425.984v138.24z" fill="#9D9D9D" p-id="5113"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
1
klp-ui/src/assets/icons/svg/shuzi5.svg
Normal file
1
klp-ui/src/assets/icons/svg/shuzi5.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1783921253053" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5373" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512.048762 0C794.770286 0 1024 229.205333 1024 512.048762 1024 794.819048 794.770286 1024 512.048762 1024 229.229714 1024 0 794.794667 0 512.048762 0 229.229714 229.229714 0 512.048762 0z m0 97.52381C283.111619 97.52381 97.52381 283.062857 97.52381 512.048762 97.52381 740.937143 283.111619 926.47619 512.048762 926.47619 740.937143 926.47619 926.47619 740.937143 926.47619 512.048762 926.47619 283.111619 740.937143 97.52381 512.048762 97.52381z m-12.068572 725.333333c63.951238 0 111.981714-18.18819 144.091429-54.613333 32.109714-36.449524 48.176762-83.797333 48.176762-142.092191 0-61.513143-15.262476-109.689905-45.738667-144.481524-30.500571-34.816-73.142857-51.95581-127.902476-51.419428a166.034286 166.034286 0 0 0-53.248 8.899047 163.693714 163.693714 0 0 0-41.472 21.065143l17.798095-155.794286h229.10781V219.428571h-310.857143l-34.011429 334.262858 84.187429 6.899809c5.948952-16.725333 15.457524-29.42781 28.525714-38.034286 13.116952-8.655238 33.158095-12.970667 60.123429-12.970666 30.47619 0 53.979429 10.727619 70.436571 32.182857 16.457143 21.455238 24.673524 49.859048 24.673524 85.187047 0 36.717714-7.94819 65.438476-23.868952 86.235429-15.920762 20.772571-39.253333 31.158857-70.022096 31.158857-26.721524 0-48.37181-7.753143-64.975238-23.283809-16.579048-15.506286-24.868571-37.034667-24.868571-64.560762l-92.306286 2.852571-0.804571 2.023619c-1.340952 51.809524 15.847619 91.672381 51.614476 119.588572 35.742476 27.940571 79.530667 41.910857 131.34019 41.910857z" fill="#878F95" p-id="5374"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -802,6 +802,8 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
configKey,
|
||||
}, {
|
||||
silentError: true,
|
||||
})
|
||||
const rows = (res && res.rows) || []
|
||||
const hit = rows.find(item => item && item.configKey === configKey)
|
||||
@@ -839,7 +841,6 @@ export default {
|
||||
this.debugLog('saveConfig-payload-too-long', { payloadLength: payload.length, persistPayload })
|
||||
if (this.$cache) this.$cache.local.setJSON(storageKey, persistPayload)
|
||||
this.configVisible = false
|
||||
if (this.$modal) this.$modal.msgWarning(`配置内容过多,后端参数长度上限为500,当前为${payload.length},已使用本地保存`)
|
||||
return
|
||||
}
|
||||
try {
|
||||
@@ -848,6 +849,8 @@ export default {
|
||||
const updateRes = await updateConfig({
|
||||
...existsConfig,
|
||||
configValue: payload,
|
||||
}, {
|
||||
silentError: true,
|
||||
})
|
||||
this.debugLog('saveConfig-updateConfig-success', { storageKey, updateRes, existsConfig })
|
||||
} else {
|
||||
@@ -859,6 +862,8 @@ export default {
|
||||
configValue: payload,
|
||||
configType: 'Y',
|
||||
remark: `工作台快捷入口配置(${label})`,
|
||||
}, {
|
||||
silentError: true,
|
||||
})
|
||||
this.debugLog('saveConfig-addConfig-success', { storageKey, addRes })
|
||||
}
|
||||
@@ -869,7 +874,6 @@ export default {
|
||||
this.debugLog('saveConfig-upsert-error', e)
|
||||
if (this.$cache) this.$cache.local.setJSON(storageKey, persistPayload)
|
||||
this.configVisible = false
|
||||
if (this.$modal) this.$modal.msgWarning('保存失败,已使用本地保存')
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -24,4 +24,8 @@ export const MemoInputStorageKey = {
|
||||
maintenanceTotalHours: 'maintenanceTotalHours', // 维修明细-总耗时
|
||||
maintenanceAcceptanceUser: 'maintenanceAcceptanceUser', // 维修明细-验收人
|
||||
maintenanceRemark: 'maintenanceRemark', // 维修明细-备注
|
||||
objectionInternalConfirmer: 'objectionInternalConfirmer', // 异议-内部确认人
|
||||
objectionExternalConfirmer: 'objectionExternalConfirmer', // 异议-外部确认人
|
||||
objectionResponsibleUnit: 'objectionResponsibleUnit', // 异议-责任单位
|
||||
objectionReceiver: 'objectionReceiver', // 异议-接收人
|
||||
}
|
||||
|
||||
@@ -49,7 +49,11 @@ export function parseTime(time, pattern) {
|
||||
// 表单重置
|
||||
export function resetForm(refName) {
|
||||
if (this.$refs[refName]) {
|
||||
this.$refs[refName].resetFields();
|
||||
try {
|
||||
this.$refs[refName].resetFields();
|
||||
} catch (e) {
|
||||
console.warn('resetFields error:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ service.interceptors.response.use(res => {
|
||||
const code = res.data.code || 200;
|
||||
// 获取错误信息
|
||||
const msg = errorCode[code] || res.data.msg || errorCode['default']
|
||||
const silentError = !!(res.config && res.config.silentError)
|
||||
// 二进制数据则直接返回
|
||||
if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') {
|
||||
return res.data
|
||||
@@ -120,13 +121,19 @@ service.interceptors.response.use(res => {
|
||||
}
|
||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||
} else if (code === 500) {
|
||||
Message({ message: msg, type: 'error' })
|
||||
if (!silentError) {
|
||||
Message({ message: msg, type: 'error' })
|
||||
}
|
||||
return Promise.reject(new Error(msg))
|
||||
} else if (code === 601) {
|
||||
Message({ message: msg, type: 'warning' })
|
||||
if (!silentError) {
|
||||
Message({ message: msg, type: 'warning' })
|
||||
}
|
||||
return Promise.reject('error')
|
||||
} else if (code !== 200) {
|
||||
Notification.error({ title: msg })
|
||||
if (!silentError) {
|
||||
Notification.error({ title: msg })
|
||||
}
|
||||
return Promise.reject('error')
|
||||
} else {
|
||||
return res.data
|
||||
@@ -142,7 +149,9 @@ service.interceptors.response.use(res => {
|
||||
} else if (message.includes("Request failed with status code")) {
|
||||
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
||||
}
|
||||
Message({ message: message, type: 'error', duration: 5 * 1000 })
|
||||
if (!(error.config && error.config.silentError)) {
|
||||
Message({ message: message, type: 'error', duration: 5 * 1000 })
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -337,12 +337,38 @@
|
||||
<AnomalyAnalysis :visible.sync="anomalyOpen" :reportId="activeReport ? activeReport.reportId : null" :allItems="allItems" :gridRows="gridRows" :allCols="allCols" @anomaly-found="onAnomalyFound" />
|
||||
|
||||
<!-- Line chart -->
|
||||
<el-dialog title="折线图统计" :visible.sync="chartOpen" width="100%" top="0" append-to-body :close-on-click-modal="false" custom-class="chart-fullscreen" @opened="renderCharts" @closed="disposeCharts">
|
||||
<div class="chart-grid" v-if="chartDataCols.length">
|
||||
<div v-for="(col, idx) in chartDataCols" :key="idx" class="chart-item">
|
||||
<el-dialog title="折线图统计" :visible.sync="chartOpen" width="100%" top="0" append-to-body :close-on-click-modal="false" custom-class="chart-fullscreen" @opened="onChartOpen" @closed="disposeCharts">
|
||||
<div class="chart-tag-bar" v-if="chartDataCols.length">
|
||||
<div class="chart-tag-row" v-if="chartActiveCols.length">
|
||||
<span class="chart-tag-label">已选</span>
|
||||
<el-tag v-for="(col, idx) in chartActiveCols" :key="getColKey(col)"
|
||||
type="primary" effect="dark" size="small"
|
||||
draggable="true"
|
||||
:class="{ 'is-dragging': _chartTagDragIdx === idx, 'drag-over': _chartTagDragOverIdx === idx }"
|
||||
closable
|
||||
@close="removeChartCol(getColKey(col))"
|
||||
@dragstart.native="onChartTagDragStart($event, idx)"
|
||||
@dragenter.native="onChartTagDragEnter(idx)"
|
||||
@dragleave.native="onChartTagDragLeave"
|
||||
@dragover.native.prevent
|
||||
@drop.native="onChartTagDrop(idx)"
|
||||
@dragend.native="onChartTagDragEnd"
|
||||
>{{ col.itemName || col.metricName || '' }}</el-tag>
|
||||
</div>
|
||||
<div class="chart-tag-row" v-if="chartUnselectedCols.length">
|
||||
<span class="chart-tag-label">待选</span>
|
||||
<el-tag v-for="col in chartUnselectedCols" :key="getColKey(col)"
|
||||
type="info" effect="plain" size="small"
|
||||
@click="addChartCol(getColKey(col))"
|
||||
>{{ col.itemName || col.metricName || '' }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-grid" v-if="chartActiveCols.length">
|
||||
<div v-for="(col, idx) in chartActiveCols" :key="'c'+idx" class="chart-item">
|
||||
<div :ref="'chart_'+idx" style="width:100%;height:280px"></div>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else-if="chartDataCols.length" description="请在上方「待选」中点击添加列" />
|
||||
<el-empty v-else description="暂无数据" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
@@ -498,7 +524,10 @@ export default {
|
||||
backfilling: false,
|
||||
progressOpen: false, progressTitle: '', progressTasks: [],
|
||||
anomalyOpen: false, anomalyMap: {},
|
||||
chartOpen: false, _chartInstances: []
|
||||
chartOpen: false, _chartInstances: [],
|
||||
chartSelectedKeys: [],
|
||||
_chartTagDragIdx: -1,
|
||||
_chartTagDragOverIdx: -1
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -599,6 +628,15 @@ export default {
|
||||
const key = 'mv' + col.mIdx
|
||||
return this.gridRows.some(r => r[key] != null)
|
||||
})
|
||||
},
|
||||
chartActiveCols() {
|
||||
return this.chartSelectedKeys
|
||||
.map(key => this.chartDataCols.find(c => this.getColKey(c) === key))
|
||||
.filter(Boolean)
|
||||
},
|
||||
chartUnselectedCols() {
|
||||
const set = new Set(this.chartSelectedKeys)
|
||||
return this.chartDataCols.filter(c => !set.has(this.getColKey(c)))
|
||||
}
|
||||
},
|
||||
watch: { configOpen(v) { if (!v) this.rpOpen = false } },
|
||||
@@ -1266,11 +1304,71 @@ export default {
|
||||
}
|
||||
return makeOption(label, [{ type: 'line', data: rows.map(r => { const v = parseFloat(r['mv'+col.mIdx]); return isNaN(v) ? 0 : v }), smooth: true }])
|
||||
},
|
||||
getColKey(col) {
|
||||
if (col.$type === 'detail') return 'd-' + col.itemId
|
||||
return 'm-' + (col.metricId != null ? col.metricId : 'idx' + col.mIdx)
|
||||
},
|
||||
loadChartSelection() {
|
||||
if (!this.activeReport) return
|
||||
const key = 'cost_chart_cols_' + this.activeReport.reportId
|
||||
const allKeys = this.chartDataCols.map(c => this.getColKey(c))
|
||||
let selected = []
|
||||
try {
|
||||
const saved = localStorage.getItem(key)
|
||||
if (saved) {
|
||||
const parsed = JSON.parse(saved)
|
||||
selected = (parsed.selected || []).filter(k => allKeys.includes(k))
|
||||
}
|
||||
} catch (e) { /* ignore */ }
|
||||
this.chartSelectedKeys = selected
|
||||
// default: select all
|
||||
if (!this.chartSelectedKeys.length) this.chartSelectedKeys = [...allKeys]
|
||||
},
|
||||
saveChartSelection() {
|
||||
if (!this.activeReport) return
|
||||
const key = 'cost_chart_cols_' + this.activeReport.reportId
|
||||
localStorage.setItem(key, JSON.stringify({
|
||||
selected: this.chartSelectedKeys
|
||||
}))
|
||||
},
|
||||
addChartCol(key) {
|
||||
this.chartSelectedKeys.push(key)
|
||||
this.saveChartSelection()
|
||||
this.renderCharts()
|
||||
},
|
||||
removeChartCol(key) {
|
||||
const idx = this.chartSelectedKeys.indexOf(key)
|
||||
if (idx >= 0) this.chartSelectedKeys.splice(idx, 1)
|
||||
this.saveChartSelection()
|
||||
this.renderCharts()
|
||||
},
|
||||
onChartTagDragStart(e, idx) {
|
||||
this._chartTagDragIdx = idx
|
||||
this._chartTagDragOverIdx = -1
|
||||
if (e.dataTransfer) e.dataTransfer.effectAllowed = 'move'
|
||||
},
|
||||
onChartTagDragEnter(idx) { this._chartTagDragOverIdx = idx },
|
||||
onChartTagDragLeave() { this._chartTagDragOverIdx = -1 },
|
||||
onChartTagDragEnd() { this._chartTagDragIdx = -1; this._chartTagDragOverIdx = -1 },
|
||||
onChartTagDrop(targetIdx) {
|
||||
if (this._chartTagDragIdx < 0 || this._chartTagDragIdx === targetIdx) { this._chartTagDragIdx = -1; this._chartTagDragOverIdx = -1; return }
|
||||
const [item] = this.chartSelectedKeys.splice(this._chartTagDragIdx, 1)
|
||||
const insertAt = this._chartTagDragIdx < targetIdx ? targetIdx - 1 : targetIdx
|
||||
this.chartSelectedKeys.splice(insertAt, 0, item)
|
||||
this._chartTagDragIdx = -1
|
||||
this._chartTagDragOverIdx = -1
|
||||
this.saveChartSelection()
|
||||
this.renderCharts()
|
||||
},
|
||||
onChartOpen() {
|
||||
this.loadChartSelection()
|
||||
this.renderCharts()
|
||||
},
|
||||
renderCharts() {
|
||||
this.disposeCharts()
|
||||
this.$nextTick(() => {
|
||||
this._chartInstances = []
|
||||
this.chartDataCols.forEach((col, idx) => {
|
||||
this.chartActiveCols.forEach((col, idx) => {
|
||||
const el = this.$refs['chart_'+idx]
|
||||
if (!el || !el[0]) return
|
||||
const chart = echarts.init(el[0])
|
||||
@@ -1344,9 +1442,16 @@ export default {
|
||||
/deep/ .summary-row td .cell { color: #303133; }
|
||||
.summary-label { font-weight: bold; color: #303133; padding: 0 5px; }
|
||||
.summary-val { font-weight: bold; color: #303133; }
|
||||
/deep/ .chart-fullscreen { width: 100% !important; max-width: 100% !important; height: 100vh !important; margin: 0 !important; }
|
||||
/deep/ .chart-fullscreen .el-dialog__body { height: calc(100vh - 90px); overflow: auto; padding: 16px 20px; }
|
||||
/deep/ .chart-fullscreen .el-dialog__header { padding: 12px 20px; }
|
||||
/deep/ .chart-fullscreen { width: 100% !important; max-width: 100% !important; height: 100vh !important; margin: 0 !important; display: flex; flex-direction: column; }
|
||||
/deep/ .chart-fullscreen .el-dialog__body { flex: 1; max-height: none; overflow: auto; padding: 16px 20px; }
|
||||
/deep/ .chart-fullscreen .el-dialog__header { padding: 12px 20px; flex-shrink: 0; }
|
||||
.chart-tag-bar { padding: 0 4px 8px; }
|
||||
.chart-tag-row { display: flex; flex-wrap: wrap; align-items: center; margin-bottom: 4px; }
|
||||
.chart-tag-row:last-child { margin-bottom: 0; }
|
||||
.chart-tag-label { font-size: 12px; color: #909399; margin-right: 4px; flex-shrink: 0; }
|
||||
/deep/ .chart-tag-row .el-tag { transition: transform 0.15s, opacity 0.15s; user-select: none; margin: 1px 4px 1px 0; }
|
||||
/deep/ .chart-tag-row .el-tag.is-dragging { opacity: 0.3; transform: scale(0.92); }
|
||||
/deep/ .chart-tag-row .el-tag.drag-over { transform: translateY(-2px); border-color: #409eff !important; }
|
||||
.chart-grid { display: flex; flex-wrap: wrap; }
|
||||
.chart-item { width: 33.33%; padding: 6px; box-sizing: border-box; }
|
||||
</style>
|
||||
|
||||
@@ -75,10 +75,11 @@
|
||||
<el-option label="原料" value="raw_material" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发货状态">
|
||||
<el-select v-model="productCoilBo.status" placeholder="全部" clearable style="width: 100px;">
|
||||
<el-option label="在库" :value="0" />
|
||||
<el-option label="已发货" :value="1" />
|
||||
<el-form-item label="钢卷状态">
|
||||
<el-select v-model="productCoilBo.coilStatusType" placeholder="全部" clearable style="width: 100px;" @change="handleProductCoilStatusChange">
|
||||
<el-option label="在库" value="in_stock" />
|
||||
<el-option label="已发货" value="shipped" />
|
||||
<el-option label="历史卷" value="history" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="质量状态">
|
||||
@@ -134,10 +135,11 @@
|
||||
<el-option label="原料" value="raw_material" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发货状态">
|
||||
<el-select v-model="deliveryCoilBo.status" placeholder="全部" clearable style="width: 100px;">
|
||||
<el-option label="在库" :value="0" />
|
||||
<el-option label="已发货" :value="1" />
|
||||
<el-form-item label="钢卷状态">
|
||||
<el-select v-model="deliveryCoilBo.coilStatusType" placeholder="全部" clearable style="width: 100px;" @change="handleDeliveryCoilStatusChange">
|
||||
<el-option label="在库" value="in_stock" />
|
||||
<el-option label="已发货" value="shipped" />
|
||||
<el-option label="历史卷" value="history" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="质量状态">
|
||||
@@ -417,7 +419,7 @@ export default {
|
||||
orderId: this.orderId,
|
||||
pageNum: this.productPagination.currentPage,
|
||||
pageSize: this.productPagination.pageSize,
|
||||
...this.productCoilBo
|
||||
coilBo: this.productCoilBo
|
||||
}).then(res => {
|
||||
this.productCoilList = res.rows || [];
|
||||
this.productPagination.total = res.total || 0;
|
||||
@@ -431,7 +433,7 @@ export default {
|
||||
});
|
||||
},
|
||||
fetchProductCoilStatistics() {
|
||||
getProductCoilsStatisticsByContract({ ...this.productCoilBo, orderId: this.orderId }).then(res => {
|
||||
getProductCoilsStatisticsByContract({ orderId: this.orderId, coilBo: this.productCoilBo }).then(res => {
|
||||
this.productCoilStatistics = res.data || {};
|
||||
});
|
||||
},
|
||||
@@ -445,6 +447,21 @@ export default {
|
||||
this.productCoilBo = {};
|
||||
this.handleProductFilter();
|
||||
},
|
||||
handleProductCoilStatusChange(val) {
|
||||
if (val === 'in_stock') {
|
||||
this.productCoilBo.status = 0;
|
||||
this.productCoilBo.dataType = 1;
|
||||
} else if (val === 'shipped') {
|
||||
this.productCoilBo.status = 1;
|
||||
this.productCoilBo.dataType = undefined;
|
||||
} else if (val === 'history') {
|
||||
this.productCoilBo.status = 0;
|
||||
this.productCoilBo.dataType = 0;
|
||||
} else {
|
||||
this.productCoilBo.status = undefined;
|
||||
this.productCoilBo.dataType = undefined;
|
||||
}
|
||||
},
|
||||
handleDeliveryFilter() {
|
||||
this.deliveryCoilBo.selectType = this.deliveryCoilBo.itemType || '';
|
||||
this.deliveryPagination.currentPage = 1;
|
||||
@@ -455,6 +472,21 @@ export default {
|
||||
this.deliveryCoilBo = {};
|
||||
this.handleDeliveryFilter();
|
||||
},
|
||||
handleDeliveryCoilStatusChange(val) {
|
||||
if (val === 'in_stock') {
|
||||
this.deliveryCoilBo.status = 0;
|
||||
this.deliveryCoilBo.dataType = 1;
|
||||
} else if (val === 'shipped') {
|
||||
this.deliveryCoilBo.status = 1;
|
||||
this.deliveryCoilBo.dataType = undefined;
|
||||
} else if (val === 'history') {
|
||||
this.deliveryCoilBo.status = 0;
|
||||
this.deliveryCoilBo.dataType = 0;
|
||||
} else {
|
||||
this.deliveryCoilBo.status = undefined;
|
||||
this.deliveryCoilBo.dataType = undefined;
|
||||
}
|
||||
},
|
||||
handleProductPageChange({ currentPage, pageSize }) {
|
||||
this.productPagination.currentPage = currentPage;
|
||||
this.productPagination.pageSize = pageSize;
|
||||
|
||||
@@ -93,10 +93,11 @@
|
||||
<el-option label="原料" value="raw_material" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发货状态">
|
||||
<el-select v-model="productCoilBo.status" placeholder="全部" clearable style="width: 100px;">
|
||||
<el-option label="在库" :value="0" />
|
||||
<el-option label="已发货" :value="1" />
|
||||
<el-form-item label="钢卷状态">
|
||||
<el-select v-model="productCoilBo.coilStatusType" placeholder="全部" clearable style="width: 100px;" @change="handleCoilStatusChange">
|
||||
<el-option label="在库" value="in_stock" />
|
||||
<el-option label="已发货" value="shipped" />
|
||||
<el-option label="历史卷" value="history" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="质量状态">
|
||||
@@ -144,6 +145,13 @@
|
||||
<el-option label="原料" value="raw_material" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="钢卷状态">
|
||||
<el-select v-model="deliveryCoilBo.coilStatusType" placeholder="全部" clearable style="width: 100px;" @change="handleDeliveryCoilStatusChange">
|
||||
<el-option label="在库" value="in_stock" />
|
||||
<el-option label="已发货" value="shipped" />
|
||||
<el-option label="历史卷" value="history" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="质量状态">
|
||||
<muti-select v-model="deliveryCoilBo.qualityStatusCsv" :options="dict.type.coil_quality_status" placeholder="请选择品质" clearable style="width: 160px;" />
|
||||
</el-form-item>
|
||||
@@ -470,6 +478,36 @@ export default {
|
||||
this.productCoilBo = {};
|
||||
this.handleProductFilter();
|
||||
},
|
||||
handleCoilStatusChange(val) {
|
||||
if (val === 'in_stock') {
|
||||
this.productCoilBo.status = 0;
|
||||
this.productCoilBo.dataType = 1;
|
||||
} else if (val === 'shipped') {
|
||||
this.productCoilBo.status = 1;
|
||||
this.productCoilBo.dataType = undefined;
|
||||
} else if (val === 'history') {
|
||||
this.productCoilBo.status = 0;
|
||||
this.productCoilBo.dataType = 0;
|
||||
} else {
|
||||
this.productCoilBo.status = undefined;
|
||||
this.productCoilBo.dataType = undefined;
|
||||
}
|
||||
},
|
||||
handleDeliveryCoilStatusChange(val) {
|
||||
if (val === 'in_stock') {
|
||||
this.deliveryCoilBo.status = 0;
|
||||
this.deliveryCoilBo.dataType = 1;
|
||||
} else if (val === 'shipped') {
|
||||
this.deliveryCoilBo.status = 1;
|
||||
this.deliveryCoilBo.dataType = undefined;
|
||||
} else if (val === 'history') {
|
||||
this.deliveryCoilBo.status = 0;
|
||||
this.deliveryCoilBo.dataType = 0;
|
||||
} else {
|
||||
this.deliveryCoilBo.status = undefined;
|
||||
this.deliveryCoilBo.dataType = undefined;
|
||||
}
|
||||
},
|
||||
fetchDeliveryCoils(principal) {
|
||||
this.deliveryCoilLoading = true;
|
||||
return listDeliveryCoilsByPrincipal({
|
||||
|
||||
@@ -751,7 +751,7 @@ export default {
|
||||
.cell-input {
|
||||
width: 100%;
|
||||
height: 28px;
|
||||
border: none;
|
||||
border: 1px solid #dcdfe6;
|
||||
outline: none;
|
||||
text-align: right;
|
||||
padding: 0 6px;
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
@clear="handleQuery"
|
||||
/>
|
||||
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">上传文件</el-button>
|
||||
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
<el-button v-if="isAdmin" type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
<span v-if="selectedCardIds.length > 0" class="selected-count">已选 {{ selectedCardIds.length }} 项</span>
|
||||
</div>
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<el-button type="text" size="mini" icon="el-icon-view" @click.stop="handleShowInfo(file)">详情</el-button>
|
||||
<el-button v-if="isAdmin || file.createBy === $store.getters.name" type="text" size="mini" icon="el-icon-edit" @click.stop="handleUpdate(file)">编辑</el-button>
|
||||
<el-button type="text" size="mini" icon="el-icon-download" @click.stop="downloadFile(file)">下载</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -139,25 +140,75 @@
|
||||
<el-dialog :title="dialogTitle" :visible.sync="open" width="650px" append-to-body @close="handleDialogClose">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-input v-model="form.fileName" placeholder="请输入文件名称" :disabled="isEdit" />
|
||||
<el-input v-model="form.fileName" placeholder="请输入文件名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上传文件" v-if="!isEdit">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="uploadUrl"
|
||||
:headers="uploadHeaders"
|
||||
:file-list="uploadFileList"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:on-error="handleUploadError"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
class="upload-demo"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击选取</em></div>
|
||||
</el-upload>
|
||||
<!-- 上传模式 - 选择方式 -->
|
||||
<el-form-item label="上传方式" v-if="!isEdit">
|
||||
<el-radio-group v-model="uploadMode">
|
||||
<el-radio label="file">上传文件</el-radio>
|
||||
<el-radio label="image">上传图片</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- 上传文件 -->
|
||||
<el-form-item v-if="!isEdit && uploadMode === 'file'" label="选择文件" required>
|
||||
<div class="file-upload-area">
|
||||
<input type="file" ref="mainFileInput" style="display:none" @change="handleMainFileSelect" />
|
||||
<el-button type="primary" @click="$refs.mainFileInput.click()">选择文件</el-button>
|
||||
<span class="upload-hint">支持 pdf / xlsx / docx / 图片 等格式</span>
|
||||
<div v-if="mainFile" class="main-file-info">
|
||||
<i class="el-icon-document"></i>
|
||||
<span class="main-file-name">{{ mainFile.name }}</span>
|
||||
<span class="main-file-size">({{ formatFileSize(mainFile.size) }})</span>
|
||||
<el-button type="text" size="mini" icon="el-icon-delete" @click="removeMainFile" style="color:#f56c6c;"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 上传图片(多张) -->
|
||||
<el-form-item v-if="!isEdit && uploadMode === 'image'" label="选择图片" required>
|
||||
<div class="image-upload-area">
|
||||
<input type="file" multiple accept="image/*" ref="fileInput" style="display:none" @change="handleFileSelect" />
|
||||
<el-button @click="$refs.fileInput.click()">选择图片</el-button>
|
||||
<span class="upload-hint">支持多选 jpg/png/webp/bmp</span>
|
||||
<div v-if="stagedImages.length > 0" class="image-grid">
|
||||
<div v-for="(img, idx) in stagedImages" :key="idx" class="image-item">
|
||||
<img :src="img.url" />
|
||||
<div class="image-item-mask">
|
||||
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="removeStagedImage(idx)"></el-button>
|
||||
</div>
|
||||
<div class="image-item-name">{{ img.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 编辑模式 - 主文件信息 -->
|
||||
<el-form-item label="当前文件" v-if="isEdit && form.filePath">
|
||||
<div class="main-file-info">
|
||||
<i class="el-icon-document"></i>
|
||||
<span class="main-file-name">{{ form.fileName }}</span>
|
||||
<span class="main-file-size" v-if="form.fileSize">({{ formatFileSize(form.fileSize) }})</span>
|
||||
<el-button type="text" size="mini" icon="el-icon-refresh" @click="handleReplaceMainFile" style="margin-left:8px;">替换</el-button>
|
||||
<el-button type="text" size="mini" icon="el-icon-download" @click="downloadFile(form)" v-if="form.filePath">下载</el-button>
|
||||
<input type="file" ref="replaceMainFileInput" style="display:none" @change="handleReplaceMainFileSelect" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 编辑模式 - 图片管理 -->
|
||||
<el-form-item label="文件图片" v-if="isEdit">
|
||||
<div v-if="form.imageList && form.imageList.length > 0" class="image-grid">
|
||||
<div v-for="(img, idx) in form.imageList" :key="img.imageId || idx" class="image-item">
|
||||
<img :src="img.imagePath" />
|
||||
<div class="image-item-mask">
|
||||
<el-button type="warning" size="mini" icon="el-icon-refresh" circle @click="handleReplaceImage(idx)" title="替换"></el-button>
|
||||
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="handleRemoveImage(idx)" title="删除"></el-button>
|
||||
</div>
|
||||
<div class="image-item-name">{{ img.imageName }}</div>
|
||||
</div>
|
||||
<div class="image-item image-add-btn" @click="handleAddImage">
|
||||
<i class="el-icon-plus"></i>
|
||||
<span>添加图片</span>
|
||||
</div>
|
||||
<input type="file" multiple accept="image/*" ref="editFileInput" style="display:none" @change="handleEditFileSelect" />
|
||||
</div>
|
||||
<div v-else class="no-images-hint">暂无图片,<el-button type="text" @click="handleAddImage">添加图片</el-button></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单编号" prop="orderNo">
|
||||
<el-input v-model="form.orderNo" placeholder="请输入订单编号" />
|
||||
@@ -194,14 +245,33 @@
|
||||
<div v-if="infoFile" class="info-dialog-body">
|
||||
<div class="info-main-row">
|
||||
<div class="info-preview">
|
||||
<ImagePreview v-if="infoFileCategory === 'image'" :src="infoFile.filePath" />
|
||||
<PdfPreview v-else-if="infoFileCategory === 'pdf'" :src="infoFile.filePath" />
|
||||
<DocxPreview v-else-if="infoFileCategory === 'docx'" :src="infoFile.filePath" />
|
||||
<XlsxPreview v-else-if="infoFileCategory === 'xlsx'" :src="infoFile.filePath" />
|
||||
<XlsPreview v-else-if="infoFileCategory === 'xls'" :src="infoFile.filePath" />
|
||||
<div v-else class="info-preview-empty">
|
||||
<el-empty description="暂不支持预览此文件类型" />
|
||||
</div>
|
||||
<!-- 多图模式 -->
|
||||
<template v-if="infoFile.imageList && infoFile.imageList.length > 0">
|
||||
<div class="image-carousel-wrap">
|
||||
<el-carousel height="400px" indicator-position="none" arrow="always" ref="previewCarousel" @change="handlePreviewChange">
|
||||
<el-carousel-item v-for="(img, idx) in infoFile.imageList" :key="idx">
|
||||
<el-image :src="img.imagePath" fit="contain" :preview-src-list="previewSrcList" :initial-index="idx" class="carousel-image" />
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
<div class="thumbnail-strip">
|
||||
<div v-for="(img, idx) in infoFile.imageList" :key="idx" class="thumbnail-item" :class="{ active: activeImageIndex === idx }" @click="handleThumbnailClick(idx)">
|
||||
<img :src="img.imagePath" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="image-counter">{{ activeImageIndex + 1 }} / {{ infoFile.imageList.length }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 单文件模式 -->
|
||||
<template v-else>
|
||||
<ImagePreview v-if="infoFileCategory === 'image'" :src="infoFile.filePath" />
|
||||
<PdfPreview v-else-if="infoFileCategory === 'pdf'" :src="infoFile.filePath" />
|
||||
<DocxPreview v-else-if="infoFileCategory === 'docx'" :src="infoFile.filePath" />
|
||||
<XlsxPreview v-else-if="infoFileCategory === 'xlsx'" :src="infoFile.filePath" />
|
||||
<XlsPreview v-else-if="infoFileCategory === 'xls'" :src="infoFile.filePath" />
|
||||
<div v-else class="info-preview-empty">
|
||||
<el-empty description="暂不支持预览此文件类型" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="info-meta">
|
||||
<el-descriptions :column="1" border size="small">
|
||||
@@ -260,9 +330,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listFile, getFile, addFile, updateFile, delFile, exportFile, listVisibleUser, addVisibleUser, delVisibleUser, listVisibleUserByFileId, listRelatedToMe, incrementView } from '@/api/system/file'
|
||||
import { listFile, getFile, addFile, updateFile, delFile, exportFile, listVisibleUser, addVisibleUser, delVisibleUser, listVisibleUserByFileId, listRelatedToMe, incrementView, uploadFile, delFileImage } from '@/api/system/file'
|
||||
import { listFileComment, addFileComment } from '@/api/system/fileComment'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import UserSelect from '@/components/KLPService/UserSelect/index'
|
||||
import ImagePreview from '@/components/FilePreview/preview/image/index.vue'
|
||||
import PdfPreview from '@/components/FilePreview/preview/pdf/index.vue'
|
||||
@@ -326,7 +395,8 @@ export default {
|
||||
fileType: undefined,
|
||||
scopeType: 1,
|
||||
visibleUsers: [],
|
||||
remark: undefined
|
||||
remark: undefined,
|
||||
imageList: []
|
||||
},
|
||||
// 可见用户原始数据(编辑时回显)
|
||||
originalVisibleUsers: [],
|
||||
@@ -346,12 +416,12 @@ export default {
|
||||
privateFiles: 0,
|
||||
myFiles: 0
|
||||
},
|
||||
// 上传相关
|
||||
uploadUrl: process.env.VUE_APP_BASE_API + '/system/oss/upload',
|
||||
uploadHeaders: {
|
||||
Authorization: 'Bearer ' + getToken()
|
||||
},
|
||||
uploadFileList: [],
|
||||
// 上传方式 file | image
|
||||
uploadMode: 'file',
|
||||
// 多图上传
|
||||
mainFile: null,
|
||||
stagedImages: [],
|
||||
uploading: false,
|
||||
// 文件详情弹窗
|
||||
infoVisible: false,
|
||||
infoTitle: '',
|
||||
@@ -360,7 +430,9 @@ export default {
|
||||
comments: [],
|
||||
commentExpanded: false,
|
||||
commentInput: '',
|
||||
commentLoading: false
|
||||
commentLoading: false,
|
||||
// 详情弹窗多图预览
|
||||
activeImageIndex: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -380,6 +452,22 @@ export default {
|
||||
if (ext === 'xlsx') return 'xlsx'
|
||||
if (ext === 'xls') return 'xls'
|
||||
return 'other'
|
||||
},
|
||||
/** 多图预览源列表(用于全屏查看) */
|
||||
previewSrcList() {
|
||||
if (this.infoFile && this.infoFile.imageList && this.infoFile.imageList.length > 0) {
|
||||
return this.infoFile.imageList.map(img => img.imagePath)
|
||||
}
|
||||
return []
|
||||
},
|
||||
/** 是否管理员 */
|
||||
isAdmin() {
|
||||
try {
|
||||
const roles = this.$store.getters.roles
|
||||
return roles && roles.some && roles.some(r => r === 'admin')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -446,10 +534,6 @@ export default {
|
||||
if (size < 1024 * 1024) return (size / 1024).toFixed(1) + ' KB'
|
||||
return (size / 1024 / 1024).toFixed(1) + ' MB'
|
||||
},
|
||||
/** 是否可编辑 */
|
||||
canEdit(row) {
|
||||
return row.createBy === this.$store.getters.name
|
||||
},
|
||||
/** 卡片选中判断 */
|
||||
isSelected(fileId) {
|
||||
return this.selectedCardIds.includes(fileId)
|
||||
@@ -492,11 +576,14 @@ export default {
|
||||
fileType: undefined,
|
||||
scopeType: 1,
|
||||
visibleUsers: [],
|
||||
remark: undefined
|
||||
remark: undefined,
|
||||
imageList: []
|
||||
}
|
||||
this.uploadFileList = []
|
||||
this.stagedImages = []
|
||||
this.mainFile = null
|
||||
this.originalVisibleUsers = []
|
||||
this.isEdit = false
|
||||
this.uploadMode = 'file'
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 可见范围切换 */
|
||||
@@ -547,6 +634,9 @@ export default {
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
this.isEdit = true
|
||||
this.dialogTitle = '编辑文件'
|
||||
// 先打开对话框,让用户感知操作已触发
|
||||
this.open = true
|
||||
const fileId = row.fileId || this.ids[0]
|
||||
getFile(fileId).then(response => {
|
||||
const data = response.data
|
||||
@@ -561,55 +651,225 @@ export default {
|
||||
fileType: data.fileType,
|
||||
scopeType: data.scopeType,
|
||||
visibleUsers: [],
|
||||
remark: data.remark
|
||||
remark: data.remark,
|
||||
imageList: data.imageList || []
|
||||
}
|
||||
if (data.scopeType === 2) {
|
||||
listVisibleUserByFileId(fileId).then(res => {
|
||||
const rows = res.rows || []
|
||||
this.form.visibleUsers = rows.map(r => r.userId)
|
||||
this.originalVisibleUsers = [...this.form.visibleUsers]
|
||||
// 去重,防止重复 userId 导致 el-select 渲染异常
|
||||
const userIds = [...new Set(rows.map(r => r.userId).filter(id => id != null))]
|
||||
this.form.visibleUsers = userIds
|
||||
this.originalVisibleUsers = [...userIds]
|
||||
}).catch(() => {
|
||||
// 可见用户加载失败不影响对话框使用
|
||||
})
|
||||
}
|
||||
this.open = true
|
||||
this.dialogTitle = '编辑文件'
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('获取文件信息失败')
|
||||
this.open = false
|
||||
})
|
||||
},
|
||||
/** 上传前校验 */
|
||||
handleBeforeUpload(file) {
|
||||
/** 上传模式:选择图片 */
|
||||
handleFileSelect(event) {
|
||||
const files = Array.from(event.target.files || [])
|
||||
files.forEach(file => {
|
||||
if (!file.type.startsWith('image/')) return
|
||||
this.stagedImages.push({
|
||||
file: file,
|
||||
url: URL.createObjectURL(file),
|
||||
name: file.name
|
||||
})
|
||||
})
|
||||
event.target.value = ''
|
||||
},
|
||||
|
||||
/** 上传模式:移除已选图片 */
|
||||
removeStagedImage(idx) {
|
||||
const img = this.stagedImages[idx]
|
||||
if (img && img.url) {
|
||||
URL.revokeObjectURL(img.url)
|
||||
}
|
||||
this.stagedImages.splice(idx, 1)
|
||||
},
|
||||
|
||||
/** 编辑模式:替换图片 */
|
||||
handleReplaceImage(idx) {
|
||||
this._replaceIndex = idx
|
||||
this.$refs.editFileInput.click()
|
||||
},
|
||||
|
||||
/** 编辑模式:删除图片 */
|
||||
handleRemoveImage(idx) {
|
||||
this.$modal.confirm('是否确认删除此图片?').then(() => {
|
||||
this.form.imageList.splice(idx, 1)
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/** 编辑模式:添加新图片 */
|
||||
handleAddImage() {
|
||||
this._replaceIndex = null
|
||||
this.$refs.editFileInput.click()
|
||||
},
|
||||
|
||||
/** 编辑模式:文件选择后上传到 OSS */
|
||||
handleEditFileSelect(event) {
|
||||
const files = Array.from(event.target.files || [])
|
||||
if (files.length === 0) return
|
||||
event.target.value = ''
|
||||
|
||||
this.uploading = true
|
||||
const promises = files
|
||||
.filter(file => file.type.startsWith('image/'))
|
||||
.map(file => {
|
||||
return uploadFile(file).then(res => {
|
||||
if (res.code === 200) {
|
||||
return {
|
||||
imageName: file.name,
|
||||
imagePath: res.data.url,
|
||||
imageSize: file.size,
|
||||
suffix: file.name.split('.').pop().toLowerCase()
|
||||
}
|
||||
} else {
|
||||
this.$modal.msgError(res.msg || file.name + ' 上传失败')
|
||||
return null
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Promise.all(promises).then(results => {
|
||||
const validResults = results.filter(r => r != null)
|
||||
if (validResults.length === 0) return
|
||||
if (this._replaceIndex !== null && this._replaceIndex !== undefined) {
|
||||
validResults.forEach((img, i) => {
|
||||
const idx = this._replaceIndex + i
|
||||
if (idx < this.form.imageList.length) {
|
||||
this.$set(this.form.imageList, idx, img)
|
||||
} else {
|
||||
this.form.imageList.push(img)
|
||||
}
|
||||
})
|
||||
this._replaceIndex = null
|
||||
} else {
|
||||
validResults.forEach(img => this.form.imageList.push(img))
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('图片上传失败,请重试')
|
||||
}).finally(() => {
|
||||
this.uploading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 上传模式:选择主文件 */
|
||||
handleMainFileSelect(event) {
|
||||
const file = event.target.files && event.target.files[0]
|
||||
if (!file) return
|
||||
event.target.value = ''
|
||||
this.mainFile = file
|
||||
if (!this.form.fileName) {
|
||||
this.form.fileName = file.name
|
||||
}
|
||||
const ext = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase()
|
||||
this.form.suffix = ext
|
||||
this.form.fileSize = file.size
|
||||
},
|
||||
/** 上传成功 */
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
if (response.code === 200) {
|
||||
this.form.filePath = response.data.url
|
||||
this.form.fileName = this.form.fileName || response.data.fileName
|
||||
this.$modal.msgSuccess('文件上传成功')
|
||||
this.doSubmit()
|
||||
} else {
|
||||
this.$modal.msgError(response.msg || '上传失败')
|
||||
const name = file.name.lastIndexOf('.') > 0
|
||||
? file.name.substring(0, file.name.lastIndexOf('.'))
|
||||
: file.name
|
||||
this.form.fileName = name
|
||||
}
|
||||
},
|
||||
/** 上传失败 */
|
||||
handleUploadError(err, file, fileList) {
|
||||
this.$modal.msgError('文件上传失败')
|
||||
|
||||
/** 上传模式:移除已选主文件 */
|
||||
removeMainFile() {
|
||||
this.mainFile = null
|
||||
},
|
||||
|
||||
/** 编辑模式:触发替换主文件 */
|
||||
handleReplaceMainFile() {
|
||||
this.$refs.replaceMainFileInput.click()
|
||||
},
|
||||
|
||||
/** 编辑模式:选择替换的主文件后直接上传 OSS 并更新表单 */
|
||||
handleReplaceMainFileSelect(event) {
|
||||
const file = event.target.files && event.target.files[0]
|
||||
if (!file) return
|
||||
event.target.value = ''
|
||||
this.uploading = true
|
||||
uploadFile(file).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.form.filePath = res.data.url
|
||||
this.form.fileSize = file.size
|
||||
const ext = file.name.split('.').pop().toLowerCase()
|
||||
this.form.suffix = ext
|
||||
if (!this.form.fileName) {
|
||||
this.form.fileName = file.name.lastIndexOf('.') > 0
|
||||
? file.name.substring(0, file.name.lastIndexOf('.'))
|
||||
: file.name
|
||||
}
|
||||
this.$modal.msgSuccess('文件替换成功')
|
||||
} else {
|
||||
this.$modal.msgError(res.msg || '文件上传失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('文件上传失败')
|
||||
}).finally(() => {
|
||||
this.uploading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 提交表单 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.isEdit) {
|
||||
this.doSubmit()
|
||||
} else {
|
||||
if (this.$refs.upload && this.$refs.upload.uploadFiles.length > 0) {
|
||||
this.$refs.upload.submit()
|
||||
} else {
|
||||
} else if (this.uploadMode === 'file') {
|
||||
// 上传文件模式
|
||||
if (!this.mainFile) {
|
||||
this.$modal.msgWarning('请选择要上传的文件')
|
||||
return
|
||||
}
|
||||
this.uploading = true
|
||||
uploadFile(this.mainFile).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.form.filePath = res.data.url
|
||||
this.form.fileSize = this.mainFile.size
|
||||
this.form.suffix = this.mainFile.name.split('.').pop().toLowerCase()
|
||||
this.doSubmit()
|
||||
} else {
|
||||
this.$modal.msgError(res.msg || '文件上传失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('文件上传失败,请重试')
|
||||
}).finally(() => {
|
||||
this.uploading = false
|
||||
})
|
||||
} else if (this.uploadMode === 'image') {
|
||||
// 上传图片模式(串行避免前端防重复提交拦截)
|
||||
if (!this.stagedImages || this.stagedImages.length === 0) {
|
||||
this.$modal.msgWarning('请选择要上传的图片')
|
||||
return
|
||||
}
|
||||
this.uploading = true
|
||||
const imageList = []
|
||||
const uploadNext = (idx) => {
|
||||
if (idx >= this.stagedImages.length) {
|
||||
this.form.imageList = imageList
|
||||
this.doSubmit()
|
||||
return
|
||||
}
|
||||
const img = this.stagedImages[idx]
|
||||
uploadFile(img.file).then(res => {
|
||||
if (res.code === 200) {
|
||||
imageList.push({
|
||||
imageName: img.name,
|
||||
imagePath: res.data.url,
|
||||
imageSize: img.file.size,
|
||||
suffix: img.name.split('.').pop().toLowerCase()
|
||||
})
|
||||
}
|
||||
uploadNext(idx + 1)
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('图片上传失败:' + img.name)
|
||||
this.uploading = false
|
||||
})
|
||||
}
|
||||
uploadNext(0)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -679,10 +939,30 @@ export default {
|
||||
},
|
||||
/** 打开详情弹窗 */
|
||||
handleShowInfo(row) {
|
||||
this.infoFile = row
|
||||
this.activeImageIndex = 0
|
||||
this.infoTitle = '文件详情 - ' + row.fileName
|
||||
this.infoVisible = true
|
||||
incrementView(row.fileId)
|
||||
// 加载完整详情(含 imageList)
|
||||
getFile(row.fileId).then(response => {
|
||||
this.infoFile = response.data
|
||||
}).catch(() => {
|
||||
// 详情加载失败时用行数据兜底
|
||||
this.infoFile = row
|
||||
})
|
||||
},
|
||||
|
||||
/** 多图预览切换 */
|
||||
handlePreviewChange(idx) {
|
||||
this.activeImageIndex = idx
|
||||
},
|
||||
|
||||
/** 缩略图点击跳转 */
|
||||
handleThumbnailClick(idx) {
|
||||
this.activeImageIndex = idx
|
||||
if (this.$refs.previewCarousel) {
|
||||
this.$refs.previewCarousel.setActiveItem(idx)
|
||||
}
|
||||
},
|
||||
/** 点击行选中 */
|
||||
handleRowClick(row) {
|
||||
@@ -1168,4 +1448,206 @@ export default {
|
||||
padding: 8px 12px;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
/* 图片上传/编辑区域 */
|
||||
.image-upload-area {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.upload-hint {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.image-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.image-item {
|
||||
position: relative;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: default;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.image-item img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.image-item-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.image-item:hover .image-item-mask {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.image-item-name {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 2px 4px;
|
||||
font-size: 11px;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.image-add-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
border: 1px dashed #dcdfe6;
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.image-add-btn:hover {
|
||||
border-color: #409eff;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.image-add-btn i {
|
||||
font-size: 28px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.image-count {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* 主文件上传区域 */
|
||||
.file-upload-area {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.main-file-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
padding: 8px 12px;
|
||||
background: #f5f7fa;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.main-file-info .el-icon-document {
|
||||
font-size: 18px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.main-file-name {
|
||||
color: #303133;
|
||||
max-width: 260px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.main-file-size {
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.no-images-hint {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
/* 详情弹窗多图轮播 */
|
||||
.image-carousel-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.image-carousel-wrap .el-carousel {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.carousel-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.carousel-image /deep/ .el-image__inner {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.thumbnail-strip {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
padding: 8px 0;
|
||||
overflow-x: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.thumbnail-item {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.thumbnail-item:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.thumbnail-item.active {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.thumbnail-item img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.image-counter {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -150,25 +150,75 @@
|
||||
<el-dialog :title="dialogTitle" :visible.sync="open" width="650px" append-to-body @close="handleDialogClose">
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="文件名称" prop="fileName">
|
||||
<el-input v-model="form.fileName" placeholder="请输入文件名称" :disabled="isEdit" />
|
||||
<el-input v-model="form.fileName" placeholder="请输入文件名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="上传文件" v-if="!isEdit">
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:action="uploadUrl"
|
||||
:headers="uploadHeaders"
|
||||
:file-list="uploadFileList"
|
||||
:before-upload="handleBeforeUpload"
|
||||
:on-success="handleUploadSuccess"
|
||||
:on-error="handleUploadError"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
class="upload-demo"
|
||||
drag
|
||||
>
|
||||
<i class="el-icon-upload"></i>
|
||||
<div class="el-upload__text">将文件拖到此处,或<em>点击选取</em></div>
|
||||
</el-upload>
|
||||
<!-- 上传模式 - 选择方式 -->
|
||||
<el-form-item label="上传方式" v-if="!isEdit">
|
||||
<el-radio-group v-model="uploadMode">
|
||||
<el-radio label="file">上传文件</el-radio>
|
||||
<el-radio label="image">上传图片</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<!-- 上传文件 -->
|
||||
<el-form-item v-if="!isEdit && uploadMode === 'file'" label="选择文件" required>
|
||||
<div class="file-upload-area">
|
||||
<input type="file" ref="mainFileInput" style="display:none" @change="handleMainFileSelect" />
|
||||
<el-button type="primary" @click="$refs.mainFileInput.click()">选择文件</el-button>
|
||||
<span class="upload-hint">支持 pdf / xlsx / docx / 图片 等格式</span>
|
||||
<div v-if="mainFile" class="main-file-info">
|
||||
<i class="el-icon-document"></i>
|
||||
<span class="main-file-name">{{ mainFile.name }}</span>
|
||||
<span class="main-file-size">({{ formatFileSize(mainFile.size) }})</span>
|
||||
<el-button type="text" size="mini" icon="el-icon-delete" @click="removeMainFile" style="color:#f56c6c;"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 上传图片(多张) -->
|
||||
<el-form-item v-if="!isEdit && uploadMode === 'image'" label="选择图片" required>
|
||||
<div class="image-upload-area">
|
||||
<input type="file" multiple accept="image/*" ref="fileInput" style="display:none" @change="handleFileSelect" />
|
||||
<el-button @click="$refs.fileInput.click()">选择图片</el-button>
|
||||
<span class="upload-hint">支持多选 jpg/png/webp/bmp</span>
|
||||
<div v-if="stagedImages.length > 0" class="image-grid">
|
||||
<div v-for="(img, idx) in stagedImages" :key="idx" class="image-item">
|
||||
<img :src="img.url" />
|
||||
<div class="image-item-mask">
|
||||
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="removeStagedImage(idx)"></el-button>
|
||||
</div>
|
||||
<div class="image-item-name">{{ img.name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 编辑模式 - 主文件信息 -->
|
||||
<el-form-item label="当前文件" v-if="isEdit && form.filePath">
|
||||
<div class="main-file-info">
|
||||
<i class="el-icon-document"></i>
|
||||
<span class="main-file-name">{{ form.fileName }}</span>
|
||||
<span class="main-file-size" v-if="form.fileSize">({{ formatFileSize(form.fileSize) }})</span>
|
||||
<el-button type="text" size="mini" icon="el-icon-refresh" @click="handleReplaceMainFile" style="margin-left:8px;">替换</el-button>
|
||||
<el-button type="text" size="mini" icon="el-icon-download" @click="downloadFile(form)" v-if="form.filePath">下载</el-button>
|
||||
<input type="file" ref="replaceMainFileInput" style="display:none" @change="handleReplaceMainFileSelect" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- 编辑模式 - 图片管理 -->
|
||||
<el-form-item label="文件图片" v-if="isEdit">
|
||||
<div v-if="form.imageList && form.imageList.length > 0" class="image-grid">
|
||||
<div v-for="(img, idx) in form.imageList" :key="img.imageId || idx" class="image-item">
|
||||
<img :src="img.imagePath" />
|
||||
<div class="image-item-mask">
|
||||
<el-button type="warning" size="mini" icon="el-icon-refresh" circle @click="handleReplaceImage(idx)" title="替换"></el-button>
|
||||
<el-button type="danger" size="mini" icon="el-icon-delete" circle @click="handleRemoveImage(idx)" title="删除"></el-button>
|
||||
</div>
|
||||
<div class="image-item-name">{{ img.imageName }}</div>
|
||||
</div>
|
||||
<div class="image-item image-add-btn" @click="handleAddImage">
|
||||
<i class="el-icon-plus"></i>
|
||||
<span>添加图片</span>
|
||||
</div>
|
||||
<input type="file" multiple accept="image/*" ref="editFileInput" style="display:none" @change="handleEditFileSelect" />
|
||||
</div>
|
||||
<div v-else class="no-images-hint">暂无图片,<el-button type="text" @click="handleAddImage">添加图片</el-button></div>
|
||||
</el-form-item>
|
||||
<el-form-item label="订单编号" prop="orderNo">
|
||||
<el-input v-model="form.orderNo" placeholder="请输入订单编号" />
|
||||
@@ -204,14 +254,33 @@
|
||||
<el-dialog :title="infoTitle" :visible.sync="infoVisible" width="1100px" append-to-body top="5vh" @close="handleInfoClose">
|
||||
<div v-if="infoFile" class="info-dialog-body">
|
||||
<div class="info-preview">
|
||||
<ImagePreview v-if="infoFileCategory === 'image'" :src="infoFile.filePath" />
|
||||
<PdfPreview v-else-if="infoFileCategory === 'pdf'" :src="infoFile.filePath" />
|
||||
<DocxPreview v-else-if="infoFileCategory === 'docx'" :src="infoFile.filePath" />
|
||||
<XlsxPreview v-else-if="infoFileCategory === 'xlsx'" :src="infoFile.filePath" />
|
||||
<XlsPreview v-else-if="infoFileCategory === 'xls'" :src="infoFile.filePath" />
|
||||
<div v-else class="info-preview-empty">
|
||||
<el-empty description="暂不支持预览此文件类型" />
|
||||
</div>
|
||||
<!-- 多图模式 -->
|
||||
<template v-if="infoFile.imageList && infoFile.imageList.length > 0">
|
||||
<div class="image-carousel-wrap">
|
||||
<el-carousel height="400px" indicator-position="none" arrow="always" ref="previewCarousel" @change="handlePreviewChange">
|
||||
<el-carousel-item v-for="(img, idx) in infoFile.imageList" :key="idx">
|
||||
<el-image :src="img.imagePath" fit="contain" :preview-src-list="previewSrcList" :initial-index="idx" class="carousel-image" />
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
<div class="thumbnail-strip">
|
||||
<div v-for="(img, idx) in infoFile.imageList" :key="idx" class="thumbnail-item" :class="{ active: activeImageIndex === idx }" @click="handleThumbnailClick(idx)">
|
||||
<img :src="img.imagePath" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="image-counter">{{ activeImageIndex + 1 }} / {{ infoFile.imageList.length }}</div>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 单文件模式 -->
|
||||
<template v-else>
|
||||
<ImagePreview v-if="infoFileCategory === 'image'" :src="infoFile.filePath" />
|
||||
<PdfPreview v-else-if="infoFileCategory === 'pdf'" :src="infoFile.filePath" />
|
||||
<DocxPreview v-else-if="infoFileCategory === 'docx'" :src="infoFile.filePath" />
|
||||
<XlsxPreview v-else-if="infoFileCategory === 'xlsx'" :src="infoFile.filePath" />
|
||||
<XlsPreview v-else-if="infoFileCategory === 'xls'" :src="infoFile.filePath" />
|
||||
<div v-else class="info-preview-empty">
|
||||
<el-empty description="暂不支持预览此文件类型" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="info-meta">
|
||||
<el-descriptions :column="1" border size="small">
|
||||
@@ -269,9 +338,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listFile, getFile, addFile, updateFile, delFile, exportFile, listVisibleUser, addVisibleUser, delVisibleUser, listVisibleUserByFileId, listRelatedToMe, incrementView } from '@/api/system/file'
|
||||
import { listFile, getFile, addFile, updateFile, delFile, exportFile, listVisibleUser, addVisibleUser, delVisibleUser, listVisibleUserByFileId, listRelatedToMe, incrementView, uploadFile, delFileImage } from '@/api/system/file'
|
||||
import { listFileComment, addFileComment } from '@/api/system/fileComment'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import UserSelect from '@/components/KLPService/UserSelect/index'
|
||||
import ImagePreview from '@/components/FilePreview/preview/image/index.vue'
|
||||
import PdfPreview from '@/components/FilePreview/preview/pdf/index.vue'
|
||||
@@ -338,7 +406,8 @@ export default {
|
||||
fileType: undefined,
|
||||
scopeType: 1,
|
||||
visibleUsers: [],
|
||||
remark: undefined
|
||||
remark: undefined,
|
||||
imageList: []
|
||||
},
|
||||
// 可见用户原始数据(编辑时回显)
|
||||
originalVisibleUsers: [],
|
||||
@@ -351,12 +420,12 @@ export default {
|
||||
{ required: true, message: '请选择文件类型', trigger: 'change' }
|
||||
]
|
||||
},
|
||||
// 上传相关
|
||||
uploadUrl: process.env.VUE_APP_BASE_API + '/system/oss/upload',
|
||||
uploadHeaders: {
|
||||
Authorization: 'Bearer ' + getToken()
|
||||
},
|
||||
uploadFileList: [],
|
||||
// 上传方式 file | image
|
||||
uploadMode: 'file',
|
||||
// 多图上传
|
||||
mainFile: null,
|
||||
stagedImages: [],
|
||||
uploading: false,
|
||||
// 文件详情弹窗
|
||||
infoVisible: false,
|
||||
infoTitle: '',
|
||||
@@ -365,7 +434,9 @@ export default {
|
||||
comments: [],
|
||||
commentExpanded: false,
|
||||
commentInput: '',
|
||||
commentLoading: false
|
||||
commentLoading: false,
|
||||
// 详情弹窗多图预览
|
||||
activeImageIndex: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -385,6 +456,13 @@ export default {
|
||||
if (ext === 'xlsx') return 'xlsx'
|
||||
if (ext === 'xls') return 'xls'
|
||||
return 'other'
|
||||
},
|
||||
/** 多图预览源列表(用于全屏查看) */
|
||||
previewSrcList() {
|
||||
if (this.infoFile && this.infoFile.imageList && this.infoFile.imageList.length > 0) {
|
||||
return this.infoFile.imageList.map(img => img.imagePath)
|
||||
}
|
||||
return []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -458,20 +536,23 @@ export default {
|
||||
reset() {
|
||||
this.form = {
|
||||
fileId: undefined,
|
||||
fileName: undefined,
|
||||
filePath: undefined,
|
||||
fileSize: undefined,
|
||||
suffix: undefined,
|
||||
orderNo: undefined,
|
||||
dept: undefined,
|
||||
fileType: undefined,
|
||||
fileName: '',
|
||||
filePath: '',
|
||||
fileSize: '',
|
||||
suffix: '',
|
||||
orderNo: '',
|
||||
dept: '',
|
||||
fileType: '',
|
||||
scopeType: 1,
|
||||
visibleUsers: [],
|
||||
remark: undefined
|
||||
remark: '',
|
||||
imageList: []
|
||||
}
|
||||
this.uploadFileList = []
|
||||
this.stagedImages = []
|
||||
this.mainFile = null
|
||||
this.originalVisibleUsers = []
|
||||
this.isEdit = false
|
||||
this.uploadMode = 'file'
|
||||
this.resetForm('form')
|
||||
},
|
||||
/** 可见范围切换 */
|
||||
@@ -527,6 +608,9 @@ export default {
|
||||
handleUpdate(row) {
|
||||
this.reset()
|
||||
this.isEdit = true
|
||||
this.dialogTitle = '编辑文件'
|
||||
// 先打开对话框,让用户感知操作已触发
|
||||
this.open = true
|
||||
const fileId = row.fileId || this.ids[0]
|
||||
getFile(fileId).then(response => {
|
||||
const data = response.data
|
||||
@@ -541,55 +625,228 @@ export default {
|
||||
fileType: data.fileType,
|
||||
scopeType: data.scopeType,
|
||||
visibleUsers: [],
|
||||
remark: data.remark
|
||||
remark: data.remark,
|
||||
imageList: data.imageList || []
|
||||
}
|
||||
if (data.scopeType === 2) {
|
||||
listVisibleUserByFileId(fileId).then(res => {
|
||||
const rows = res.rows || []
|
||||
this.form.visibleUsers = rows.map(r => r.userId)
|
||||
this.originalVisibleUsers = [...this.form.visibleUsers]
|
||||
// 去重,防止重复 userId 导致 el-select 渲染异常
|
||||
const userIds = [...new Set(rows.map(r => r.userId).filter(id => id != null))]
|
||||
this.form.visibleUsers = userIds
|
||||
this.originalVisibleUsers = [...userIds]
|
||||
}).catch(() => {
|
||||
// 可见用户加载失败不影响对话框使用
|
||||
})
|
||||
}
|
||||
this.open = true
|
||||
this.dialogTitle = '编辑文件'
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('获取文件信息失败')
|
||||
this.open = false
|
||||
})
|
||||
},
|
||||
/** 上传前校验 */
|
||||
handleBeforeUpload(file) {
|
||||
/** 上传模式:选择图片 */
|
||||
handleFileSelect(event) {
|
||||
const files = Array.from(event.target.files || [])
|
||||
files.forEach(file => {
|
||||
if (!file.type.startsWith('image/')) return
|
||||
this.stagedImages.push({
|
||||
file: file,
|
||||
url: URL.createObjectURL(file),
|
||||
name: file.name
|
||||
})
|
||||
})
|
||||
event.target.value = ''
|
||||
},
|
||||
|
||||
/** 上传模式:移除已选图片 */
|
||||
removeStagedImage(idx) {
|
||||
const img = this.stagedImages[idx]
|
||||
if (img && img.url) {
|
||||
URL.revokeObjectURL(img.url)
|
||||
}
|
||||
this.stagedImages.splice(idx, 1)
|
||||
},
|
||||
|
||||
/** 编辑模式:替换图片 */
|
||||
handleReplaceImage(idx) {
|
||||
this._replaceIndex = idx
|
||||
this.$refs.editFileInput.click()
|
||||
},
|
||||
|
||||
/** 编辑模式:删除图片 */
|
||||
handleRemoveImage(idx) {
|
||||
this.$modal.confirm('是否确认删除此图片?').then(() => {
|
||||
this.form.imageList.splice(idx, 1)
|
||||
}).catch(() => {})
|
||||
},
|
||||
|
||||
/** 编辑模式:添加新图片 */
|
||||
handleAddImage() {
|
||||
this._replaceIndex = null
|
||||
this.$refs.editFileInput.click()
|
||||
},
|
||||
|
||||
/** 编辑模式:文件选择后上传到 OSS */
|
||||
handleEditFileSelect(event) {
|
||||
const files = Array.from(event.target.files || [])
|
||||
if (files.length === 0) return
|
||||
event.target.value = ''
|
||||
|
||||
this.uploading = true
|
||||
const promises = files
|
||||
.filter(file => file.type.startsWith('image/'))
|
||||
.map(file => {
|
||||
return uploadFile(file).then(res => {
|
||||
if (res.code === 200) {
|
||||
return {
|
||||
imageName: file.name,
|
||||
imagePath: res.data.url,
|
||||
imageSize: file.size,
|
||||
suffix: file.name.split('.').pop().toLowerCase()
|
||||
}
|
||||
} else {
|
||||
this.$modal.msgError(res.msg || file.name + ' 上传失败')
|
||||
return null
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Promise.all(promises).then(results => {
|
||||
const validResults = results.filter(r => r != null)
|
||||
if (validResults.length === 0) return
|
||||
if (this._replaceIndex !== null && this._replaceIndex !== undefined) {
|
||||
// 替换已有图片
|
||||
validResults.forEach((img, i) => {
|
||||
const idx = this._replaceIndex + i
|
||||
if (idx < this.form.imageList.length) {
|
||||
this.$set(this.form.imageList, idx, img)
|
||||
} else {
|
||||
this.form.imageList.push(img)
|
||||
}
|
||||
})
|
||||
this._replaceIndex = null
|
||||
} else {
|
||||
// 新增图片
|
||||
validResults.forEach(img => this.form.imageList.push(img))
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('图片上传失败,请重试')
|
||||
}).finally(() => {
|
||||
this.uploading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 上传模式:选择主文件 */
|
||||
handleMainFileSelect(event) {
|
||||
const file = event.target.files && event.target.files[0]
|
||||
if (!file) return
|
||||
event.target.value = ''
|
||||
this.mainFile = file
|
||||
// 自动填充文件名(不含扩展名)
|
||||
if (!this.form.fileName) {
|
||||
this.form.fileName = file.name
|
||||
}
|
||||
const ext = file.name.substring(file.name.lastIndexOf('.') + 1).toLowerCase()
|
||||
this.form.suffix = ext
|
||||
this.form.fileSize = file.size
|
||||
},
|
||||
/** 上传成功 */
|
||||
handleUploadSuccess(response, file, fileList) {
|
||||
if (response.code === 200) {
|
||||
this.form.filePath = response.data.url
|
||||
this.form.fileName = this.form.fileName || response.data.fileName
|
||||
this.$modal.msgSuccess('文件上传成功')
|
||||
this.doSubmit()
|
||||
} else {
|
||||
this.$modal.msgError(response.msg || '上传失败')
|
||||
const name = file.name.lastIndexOf('.') > 0
|
||||
? file.name.substring(0, file.name.lastIndexOf('.'))
|
||||
: file.name
|
||||
this.form.fileName = name
|
||||
}
|
||||
},
|
||||
/** 上传失败 */
|
||||
handleUploadError(err, file, fileList) {
|
||||
this.$modal.msgError('文件上传失败')
|
||||
|
||||
/** 上传模式:移除已选主文件 */
|
||||
removeMainFile() {
|
||||
this.mainFile = null
|
||||
},
|
||||
|
||||
/** 编辑模式:触发替换主文件 */
|
||||
handleReplaceMainFile() {
|
||||
this.$refs.replaceMainFileInput.click()
|
||||
},
|
||||
|
||||
/** 编辑模式:选择替换的主文件后直接上传 OSS 并更新表单 */
|
||||
handleReplaceMainFileSelect(event) {
|
||||
const file = event.target.files && event.target.files[0]
|
||||
if (!file) return
|
||||
event.target.value = ''
|
||||
this.uploading = true
|
||||
uploadFile(file).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.form.filePath = res.data.url
|
||||
this.form.fileSize = file.size
|
||||
const ext = file.name.split('.').pop().toLowerCase()
|
||||
this.form.suffix = ext
|
||||
if (!this.form.fileName) {
|
||||
this.form.fileName = file.name.lastIndexOf('.') > 0
|
||||
? file.name.substring(0, file.name.lastIndexOf('.'))
|
||||
: file.name
|
||||
}
|
||||
this.$modal.msgSuccess('文件替换成功')
|
||||
} else {
|
||||
this.$modal.msgError(res.msg || '文件上传失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('文件上传失败')
|
||||
}).finally(() => {
|
||||
this.uploading = false
|
||||
})
|
||||
},
|
||||
|
||||
/** 提交表单 */
|
||||
submitForm() {
|
||||
this.$refs['form'].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.isEdit) {
|
||||
this.doSubmit()
|
||||
} else {
|
||||
if (this.$refs.upload && this.$refs.upload.uploadFiles.length > 0) {
|
||||
this.$refs.upload.submit()
|
||||
} else {
|
||||
} else if (this.uploadMode === 'file') {
|
||||
// 上传文件模式
|
||||
if (!this.mainFile) {
|
||||
this.$modal.msgWarning('请选择要上传的文件')
|
||||
return
|
||||
}
|
||||
this.uploading = true
|
||||
uploadFile(this.mainFile).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.form.filePath = res.data.url
|
||||
this.form.fileSize = this.mainFile.size
|
||||
this.form.suffix = this.mainFile.name.split('.').pop().toLowerCase()
|
||||
this.doSubmit()
|
||||
} else {
|
||||
this.$modal.msgError(res.msg || '文件上传失败')
|
||||
}
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('文件上传失败,请重试')
|
||||
}).finally(() => {
|
||||
this.uploading = false
|
||||
})
|
||||
} else if (this.uploadMode === 'image') {
|
||||
// 上传图片模式(串行避免前端防重复提交拦截)
|
||||
if (!this.stagedImages || this.stagedImages.length === 0) {
|
||||
this.$modal.msgWarning('请选择要上传的图片')
|
||||
return
|
||||
}
|
||||
this.uploading = true
|
||||
const imageList = []
|
||||
const uploadNext = (idx) => {
|
||||
if (idx >= this.stagedImages.length) {
|
||||
this.form.imageList = imageList
|
||||
this.doSubmit()
|
||||
return
|
||||
}
|
||||
const img = this.stagedImages[idx]
|
||||
uploadFile(img.file).then(res => {
|
||||
if (res.code === 200) {
|
||||
imageList.push({
|
||||
imageName: img.name,
|
||||
imagePath: res.data.url,
|
||||
imageSize: img.file.size,
|
||||
suffix: img.name.split('.').pop().toLowerCase()
|
||||
})
|
||||
}
|
||||
uploadNext(idx + 1)
|
||||
}).catch(() => {
|
||||
this.$modal.msgError('图片上传失败:' + img.name)
|
||||
this.uploading = false
|
||||
})
|
||||
}
|
||||
uploadNext(0)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -665,10 +922,30 @@ export default {
|
||||
},
|
||||
/** 打开详情弹窗 */
|
||||
handleShowInfo(row) {
|
||||
this.infoFile = row
|
||||
this.activeImageIndex = 0
|
||||
this.infoTitle = '文件详情 - ' + row.fileName
|
||||
this.infoVisible = true
|
||||
incrementView(row.fileId)
|
||||
// 加载完整详情(含 imageList)
|
||||
getFile(row.fileId).then(response => {
|
||||
this.infoFile = response.data
|
||||
}).catch(() => {
|
||||
// 详情加载失败时用行数据兜底
|
||||
this.infoFile = row
|
||||
})
|
||||
},
|
||||
|
||||
/** 多图预览切换 */
|
||||
handlePreviewChange(idx) {
|
||||
this.activeImageIndex = idx
|
||||
},
|
||||
|
||||
/** 缩略图点击跳转 */
|
||||
handleThumbnailClick(idx) {
|
||||
this.activeImageIndex = idx
|
||||
if (this.$refs.previewCarousel) {
|
||||
this.$refs.previewCarousel.setActiveItem(idx)
|
||||
}
|
||||
},
|
||||
/** 点击行选中 */
|
||||
handleRowClick(row) {
|
||||
@@ -829,11 +1106,6 @@ export default {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 上传区域 */
|
||||
.upload-demo {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 操作列按钮对齐 */
|
||||
.action-cell {
|
||||
display: flex;
|
||||
@@ -962,6 +1234,208 @@ export default {
|
||||
padding: 8px 12px;
|
||||
border-top: 1px solid #f2f2f2;
|
||||
}
|
||||
|
||||
/* 图片上传/编辑区域 */
|
||||
.image-upload-area {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.upload-hint {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.image-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.image-item {
|
||||
position: relative;
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: default;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.image-item img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.image-item-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s;
|
||||
}
|
||||
|
||||
.image-item:hover .image-item-mask {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.image-item-name {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 2px 4px;
|
||||
font-size: 11px;
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.image-add-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
border: 1px dashed #dcdfe6;
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.image-add-btn:hover {
|
||||
border-color: #409eff;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.image-add-btn i {
|
||||
font-size: 28px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.image-count {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* 主文件上传区域 */
|
||||
.file-upload-area {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.main-file-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
padding: 8px 12px;
|
||||
background: #f5f7fa;
|
||||
border: 1px solid #e4e7ed;
|
||||
border-radius: 4px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.main-file-info .el-icon-document {
|
||||
font-size: 18px;
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.main-file-name {
|
||||
color: #303133;
|
||||
max-width: 260px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.main-file-size {
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.no-images-hint {
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
/* 详情弹窗多图轮播 */
|
||||
.image-carousel-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.image-carousel-wrap .el-carousel {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.carousel-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.carousel-image /deep/ .el-image__inner {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.thumbnail-strip {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
padding: 8px 0;
|
||||
overflow-x: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.thumbnail-item {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.thumbnail-item:hover {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.thumbnail-item.active {
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.thumbnail-item img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.image-counter {
|
||||
text-align: center;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 表格选中行高亮 -->
|
||||
|
||||
@@ -1,75 +1,119 @@
|
||||
<template>
|
||||
<div class="app-container" v-loading="loading">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="90px">
|
||||
<el-form-item label="时间">
|
||||
<time-range-picker v-model="timeRangeParams" start-key="startTime" end-key="endTime"
|
||||
:default-start-time="queryParams.startTime" :default-end-time="queryParams.endTime"
|
||||
@quick-select="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="目标炉" prop="targetFurnaceId">
|
||||
<el-select v-model="queryParams.targetFurnaceId" placeholder="请选择" clearable filterable>
|
||||
<el-option v-for="item in furnaceOptions" :key="item.furnaceId" :label="item.furnaceName"
|
||||
:value="item.furnaceId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划号" prop="planNo">
|
||||
<el-input v-model="queryParams.planNo" placeholder="请输入计划号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||
<el-input v-model="queryParams.enterCoilNo" placeholder="请输入入场钢卷号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||
<el-input v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="出炉库区" prop="warehouseId">
|
||||
<WarehouseSelect v-model="queryParams.warehouseId" placeholder="请选择" clearable filterable />
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑库区" prop="coilWarehouseId">
|
||||
<WarehouseSelect v-model="queryParams.coilWarehouseId" placeholder="请选择" clearable filterable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button icon="el-icon-download" size="mini" @click="exportData">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<!-- <el-tabs v-model="activeTab" @tab-click="handleTabClick">
|
||||
<el-tab-pane label="退火后" name="processed" />
|
||||
<el-tab-pane label="加工前" name="raw" />
|
||||
</el-tabs> -->
|
||||
|
||||
<el-descriptions title="统计信息" :column="3" class="summary-block" border>
|
||||
<el-descriptions-item label="计划数量">{{ summary.planCount || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="钢卷数量">{{ summary.coilCount || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总重量">{{ summary.totalWeight || 0 }} t</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<!-- ========== 退火后 ========== -->
|
||||
<template v-if="activeTab === 'processed'">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="90px">
|
||||
<el-form-item label="时间">
|
||||
<time-range-picker v-model="timeRangeParams" start-key="startTime" end-key="endTime"
|
||||
:default-start-time="queryParams.startTime" :default-end-time="queryParams.endTime"
|
||||
@quick-select="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="目标炉" prop="targetFurnaceId">
|
||||
<el-select v-model="queryParams.targetFurnaceId" placeholder="请选择" clearable filterable>
|
||||
<el-option v-for="item in furnaceOptions" :key="item.furnaceId" :label="item.furnaceName"
|
||||
:value="item.furnaceId" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划号" prop="planNo">
|
||||
<el-input v-model="queryParams.planNo" placeholder="请输入计划号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||
<el-input v-model="queryParams.enterCoilNo" placeholder="请输入入场钢卷号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||
<el-input v-model="queryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="出炉库区" prop="warehouseId">
|
||||
<WarehouseSelect v-model="queryParams.warehouseId" placeholder="请选择" clearable filterable />
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑库区" prop="coilWarehouseId">
|
||||
<WarehouseSelect v-model="queryParams.coilWarehouseId" placeholder="请选择" clearable filterable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
<el-button icon="el-icon-download" size="mini" @click="exportData">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table :data="detailList" border height="calc(100vh - 330px)">
|
||||
<el-table-column label="计划号" prop="planNo" align="center" />
|
||||
<el-table-column label="目标炉" prop="targetFurnaceName" align="center" />
|
||||
<el-table-column label="开始时间" prop="actualStartTime" align="center" width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ parseTime(scope.row.actualStartTime, '{y}-{m}-{d} {h}:{i}') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" prop="endTime" align="center" width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品类型" align="center" width="250">
|
||||
<template slot-scope="scope">
|
||||
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row" />
|
||||
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出炉库区" prop="logicWarehouseName" align="center" />
|
||||
<el-table-column label="逻辑库区" prop="warehouseName" align="center" />
|
||||
<el-table-column label="入场钢卷号" prop="enterCoilNo" align="center" />
|
||||
<el-table-column label="当前钢卷号" prop="currentCoilNo" align="center" />
|
||||
<el-table-column label="重量(t)" prop="netWeight" align="center" />
|
||||
</el-table>
|
||||
<el-descriptions title="统计信息" :column="3" class="summary-block" border>
|
||||
<el-descriptions-item label="计划数量">{{ summary.planCount || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="钢卷数量">{{ summary.coilCount || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总重量">{{ summary.totalWeight || 0 }} t</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-table :data="detailList" border height="calc(100vh - 330px)">
|
||||
<el-table-column label="计划号" prop="planNo" align="center" />
|
||||
<el-table-column label="目标炉" prop="targetFurnaceName" align="center" />
|
||||
<el-table-column label="开始时间" prop="actualStartTime" align="center" width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ parseTime(scope.row.actualStartTime, '{y}-{m}-{d} {h}:{i}') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="结束时间" prop="endTime" align="center" width="160">
|
||||
<template slot-scope="scope">
|
||||
{{ parseTime(scope.row.endTime, '{y}-{m}-{d} {h}:{i}') }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产品类型" align="center" width="250">
|
||||
<template slot-scope="scope">
|
||||
<ProductInfo v-if="scope.row.itemType == 'product'" :product="scope.row" />
|
||||
<RawMaterialInfo v-else-if="scope.row.itemType === 'raw_material'" :material="scope.row" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="出炉库区" prop="logicWarehouseName" align="center" />
|
||||
<el-table-column label="逻辑库区" prop="warehouseName" align="center" />
|
||||
<el-table-column label="入场钢卷号" prop="enterCoilNo" align="center" />
|
||||
<el-table-column label="当前钢卷号" prop="currentCoilNo" align="center" />
|
||||
<el-table-column label="重量(t)" prop="netWeight" align="center" />
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<!-- ========== 加工前 ========== -->
|
||||
<template v-if="activeTab === 'raw'">
|
||||
<el-form :model="rawQueryParams" ref="rawQueryForm" size="small" :inline="true" label-width="90px">
|
||||
<el-form-item label="入场钢卷号" prop="enterCoilNo">
|
||||
<el-input v-model="rawQueryParams.enterCoilNo" placeholder="请输入入场钢卷号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="当前钢卷号" prop="currentCoilNo">
|
||||
<el-input v-model="rawQueryParams.currentCoilNo" placeholder="请输入当前钢卷号" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑库区" prop="warehouseId">
|
||||
<WarehouseSelect v-model="rawQueryParams.warehouseId" placeholder="请选择" clearable filterable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetRawQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-descriptions title="统计信息" :column="2" class="summary-block" border>
|
||||
<el-descriptions-item label="钢卷数量">{{ rawSummary.coilCount || 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总重量">{{ rawSummary.totalWeight || 0 }} t</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<el-table :data="rawDetailList" border height="calc(100vh - 330px)">
|
||||
<el-table-column label="入场钢卷号" prop="enterCoilNo" align="center" width="140" />
|
||||
<el-table-column label="当前钢卷号" prop="currentCoilNo" align="center" width="140" />
|
||||
<el-table-column label="物料名称" prop="itemName" align="center" />
|
||||
<el-table-column label="物料编码" prop="itemCode" align="center" />
|
||||
<el-table-column label="规格" prop="specification" align="center" />
|
||||
<el-table-column label="材质" prop="material" align="center" />
|
||||
<el-table-column label="锌层" prop="zincLayer" align="center" />
|
||||
<el-table-column label="重量(t)" prop="netWeight" align="center" />
|
||||
<el-table-column label="逻辑库区" prop="warehouseName" align="center" />
|
||||
</el-table>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAnnealPerformance } from "@/api/wms/annealPerformance";
|
||||
import { getAnnealPerformance, getAnnealRawCoils } from "@/api/wms/annealPerformance";
|
||||
import { listAnnealFurnace } from "@/api/wms/annealFurnace";
|
||||
import ProductInfo from "@/components/KLPService/Renderer/ProductInfo";
|
||||
import RawMaterialInfo from "@/components/KLPService/Renderer/RawMaterialInfo";
|
||||
@@ -96,7 +140,9 @@ export default {
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')} 00:00:00`;
|
||||
})()
|
||||
return {
|
||||
activeTab: 'processed',
|
||||
loading: false,
|
||||
// 退火后查询参数
|
||||
timeRangeParams: {
|
||||
startTime,
|
||||
endTime,
|
||||
@@ -114,6 +160,14 @@ export default {
|
||||
summary: {},
|
||||
detailList: [],
|
||||
furnaceOptions: [],
|
||||
// 加工前查询参数
|
||||
rawQueryParams: {
|
||||
enterCoilNo: undefined,
|
||||
currentCoilNo: undefined,
|
||||
warehouseId: undefined,
|
||||
},
|
||||
rawSummary: {},
|
||||
rawDetailList: [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
@@ -138,26 +192,42 @@ export default {
|
||||
},
|
||||
handleQuery() {
|
||||
this.loading = true;
|
||||
getAnnealPerformance(this.queryParams).then(response => {
|
||||
const data = response.data || {};
|
||||
this.summary = data.summary || {};
|
||||
this.detailList = data.details.map(item => {
|
||||
return item.coils?.map(coil => {
|
||||
return {
|
||||
...item,
|
||||
...coil,
|
||||
}
|
||||
}) || []
|
||||
}).flat();
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
if (this.activeTab === 'raw') {
|
||||
getAnnealRawCoils(this.rawQueryParams).then(response => {
|
||||
const list = response.data || [];
|
||||
this.rawDetailList = list;
|
||||
this.rawSummary = {
|
||||
coilCount: list.length,
|
||||
totalWeight: list.reduce((s, r) => s + Number(r.netWeight || 0), 0).toFixed(3),
|
||||
};
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
getAnnealPerformance(this.queryParams).then(response => {
|
||||
const data = response.data || {};
|
||||
this.summary = data.summary || {};
|
||||
this.detailList = (data.details || []).map(item => {
|
||||
return item.coil ? { ...item, ...item.coil } : item;
|
||||
});
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
handleTabClick() {
|
||||
this.handleQuery();
|
||||
},
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
resetRawQuery() {
|
||||
this.resetForm("rawQueryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
exportData() {
|
||||
this.download('/wms/materialCoil/exportAnneal', {
|
||||
coilIds: this.detailList.map(item => item.coilId).join(','),
|
||||
|
||||
486
klp-ui/src/views/wms/coil/info/components/ChangeLogSection.vue
Normal file
486
klp-ui/src/views/wms/coil/info/components/ChangeLogSection.vue
Normal file
@@ -0,0 +1,486 @@
|
||||
<template>
|
||||
<div class="section change-log-section">
|
||||
<div class="section-header">
|
||||
<span class="section-icon">📝</span>
|
||||
<span class="section-title">修改日志</span>
|
||||
</div>
|
||||
<div class="section-body">
|
||||
<el-table
|
||||
v-if="changeLogs.length"
|
||||
:data="changeLogs"
|
||||
border
|
||||
stripe
|
||||
size="small"
|
||||
v-loading="loading"
|
||||
:header-cell-style="{ background: '#f5f7fa', color: '#303133', fontWeight: 600 }"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column prop="operationDesc" label="操作类型" min-width="120" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span class="operation-badge">{{ scope.row.operationDesc }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="修改信息" min-width="420">
|
||||
<template slot-scope="scope">
|
||||
<div class="change-log-line">
|
||||
<div class="change-log-line-boxes">
|
||||
<div
|
||||
v-for="(item, idx) in scope.row.previewItems"
|
||||
:key="scope.row.logId + '-' + idx"
|
||||
class="mini-change-item"
|
||||
:title="previewText(item)"
|
||||
>
|
||||
<span class="mini-change-label">{{ item.label }}</span>
|
||||
<span class="mini-change-box old">{{ item.oldText }}</span>
|
||||
<span class="mini-change-arrow">→</span>
|
||||
<span class="mini-change-box new">{{ item.newText }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-button
|
||||
v-if="scope.row.moreCount > 0"
|
||||
type="text"
|
||||
size="mini"
|
||||
class="more-btn"
|
||||
@click="openMoreDialog(scope.row)"
|
||||
>
|
||||
更多 {{ scope.row.moreCount }} 项
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createBy" label="修改人" width="120" show-overflow-tooltip />
|
||||
<el-table-column label="修改时间" width="170" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ formatDateTime(scope.row.createTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty
|
||||
v-else-if="!loading"
|
||||
description="暂无修改日志"
|
||||
:image-size="60"
|
||||
/>
|
||||
|
||||
<el-dialog
|
||||
title="全部修改信息"
|
||||
:visible.sync="dialogVisible"
|
||||
width="960px"
|
||||
append-to-body
|
||||
>
|
||||
<div v-if="activeLog" class="change-log-dialog">
|
||||
<div class="change-log-dialog-meta">
|
||||
<span>操作类型:{{ activeLog.operationDesc }}</span>
|
||||
<span>修改人:{{ activeLog.createBy }}</span>
|
||||
<span>修改时间:{{ formatDateTime(activeLog.createTime) }}</span>
|
||||
</div>
|
||||
<div class="change-log-grid all-items">
|
||||
<div
|
||||
v-for="(item, idx) in activeLog.summaryItems"
|
||||
:key="'dialog-' + activeLog.logId + '-' + idx"
|
||||
class="change-log-card"
|
||||
>
|
||||
<div class="change-log-card-header">
|
||||
<span class="change-field-name">{{ item.label }}</span>
|
||||
</div>
|
||||
<div class="change-log-card-body">
|
||||
<div class="change-value-box old">
|
||||
<span class="change-value-label">原值</span>
|
||||
<span class="change-value-text">{{ item.oldText }}</span>
|
||||
</div>
|
||||
<span class="change-arrow">→</span>
|
||||
<div class="change-value-box new">
|
||||
<span class="change-value-label">新值</span>
|
||||
<span class="change-value-text">{{ item.newText }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getCoilChangeLogByCoilId } from '@/api/wms/coilChangeLog'
|
||||
|
||||
const CHANGE_FIELD_LABELS = {
|
||||
currentCoilNo: '当前钢卷号',
|
||||
enterCoilNo: '入场钢卷号',
|
||||
supplierCoilNo: '厂家原料号',
|
||||
itemName: '物料名称',
|
||||
specification: '规格',
|
||||
material: '材质',
|
||||
netWeight: '净重',
|
||||
grossWeight: '毛重',
|
||||
warehouseName: '库位',
|
||||
actualWarehouseName: '实际库区',
|
||||
qualityStatus: '质量状态',
|
||||
manufacturer: '厂家',
|
||||
zincLayer: '镀层质量',
|
||||
status: '状态',
|
||||
remark: '备注',
|
||||
saleName: '销售员',
|
||||
actualLength: '实际长度',
|
||||
actualWidth: '实际宽度',
|
||||
actualThickness: '实际厚度',
|
||||
length: '长度',
|
||||
theoreticalLength: '理论长度',
|
||||
theoreticalThickness: '理论厚度',
|
||||
trimmingRequirement: '净边料要求',
|
||||
packagingRequirement: '包装要求',
|
||||
contractNo: '合同号',
|
||||
chromePlateCoilNo: '镀铬卷号',
|
||||
productionStartTime: '生产开始时间',
|
||||
productionEndTime: '生产结束时间',
|
||||
productionDuration: '生产时长'
|
||||
}
|
||||
|
||||
const HIDDEN_CHANGE_FIELDS = new Set([
|
||||
'warehouseId',
|
||||
'actualWarehouseId',
|
||||
'itemId',
|
||||
'parentCoilId',
|
||||
'parentCoilIds',
|
||||
'parentCoilNos',
|
||||
'hasMergeSplit',
|
||||
'exclusiveStatus'
|
||||
])
|
||||
|
||||
const PREVIEW_ITEM_LIMIT = 3
|
||||
|
||||
export default {
|
||||
name: 'ChangeLogSection',
|
||||
props: {
|
||||
coilId: { type: [String, Number], default: '' }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
changeLogs: [],
|
||||
dialogVisible: false,
|
||||
activeLog: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
coilId: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.loadChangeLogs()
|
||||
} else {
|
||||
this.changeLogs = []
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDateTime(val) {
|
||||
if (!val) return '-'
|
||||
const date = new Date(val)
|
||||
if (isNaN(date.getTime())) return String(val)
|
||||
const y = date.getFullYear()
|
||||
const m = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const d = String(date.getDate()).padStart(2, '0')
|
||||
const hh = String(date.getHours()).padStart(2, '0')
|
||||
const mm = String(date.getMinutes()).padStart(2, '0')
|
||||
const ss = String(date.getSeconds()).padStart(2, '0')
|
||||
return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
|
||||
},
|
||||
getFieldLabel(field) {
|
||||
return CHANGE_FIELD_LABELS[field] || field
|
||||
},
|
||||
shouldHideField(field, diffMap) {
|
||||
if (HIDDEN_CHANGE_FIELDS.has(field)) return true
|
||||
if (field.endsWith('Id') && diffMap[`${field.slice(0, -2)}Name`]) return true
|
||||
return false
|
||||
},
|
||||
normalizeDisplayValue(field, val) {
|
||||
if (val === null || val === undefined || val === '') return '-'
|
||||
if (typeof val === 'number' && /Time$/.test(field)) {
|
||||
return this.formatDateTime(val)
|
||||
}
|
||||
if (typeof val === 'string' && /^\d{13}$/.test(val) && /Time$/.test(field)) {
|
||||
return this.formatDateTime(Number(val))
|
||||
}
|
||||
if (Array.isArray(val)) return val.length ? val.join(', ') : '-'
|
||||
if (typeof val === 'object') {
|
||||
try {
|
||||
return JSON.stringify(val)
|
||||
} catch (e) {
|
||||
return String(val)
|
||||
}
|
||||
}
|
||||
return String(val)
|
||||
},
|
||||
buildSummaryItem(field, oldVal, newVal) {
|
||||
const oldText = this.normalizeDisplayValue(field, oldVal)
|
||||
const newText = this.normalizeDisplayValue(field, newVal)
|
||||
if (oldText === newText) return null
|
||||
return {
|
||||
field,
|
||||
label: this.getFieldLabel(field),
|
||||
oldText,
|
||||
newText
|
||||
}
|
||||
},
|
||||
buildSummaryItems(log) {
|
||||
const items = []
|
||||
if (log.changedFields) {
|
||||
try {
|
||||
const diffMap = JSON.parse(log.changedFields)
|
||||
Object.keys(diffMap || {}).forEach(key => {
|
||||
if (this.shouldHideField(key, diffMap)) return
|
||||
const item = diffMap[key] || {}
|
||||
const summaryItem = this.buildSummaryItem(key, item.old, item.new)
|
||||
if (summaryItem) items.push(summaryItem)
|
||||
})
|
||||
} catch (e) {
|
||||
items.push({
|
||||
field: 'raw',
|
||||
label: '修改内容',
|
||||
oldText: '-',
|
||||
newText: log.changedFields
|
||||
})
|
||||
}
|
||||
}
|
||||
if (!items.length && log.oldCoilNo !== log.newCoilNo) {
|
||||
items.push(this.buildSummaryItem('currentCoilNo', log.oldCoilNo, log.newCoilNo))
|
||||
}
|
||||
if (!items.length && log.operationDesc) {
|
||||
items.push({
|
||||
field: 'operationDesc',
|
||||
label: '修改内容',
|
||||
oldText: '-',
|
||||
newText: log.operationDesc
|
||||
})
|
||||
}
|
||||
return items.length ? items : [{
|
||||
field: 'empty',
|
||||
label: '修改内容',
|
||||
oldText: '-',
|
||||
newText: '-'
|
||||
}]
|
||||
},
|
||||
previewText(item) {
|
||||
if (!item) return '-'
|
||||
return `${item.label}:${item.oldText}→${item.newText}`
|
||||
},
|
||||
openMoreDialog(row) {
|
||||
this.activeLog = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
async loadChangeLogs() {
|
||||
if (!this.coilId) return
|
||||
this.loading = true
|
||||
try {
|
||||
const res = await getCoilChangeLogByCoilId(this.coilId)
|
||||
const rows = (res && res.data) || []
|
||||
this.changeLogs = rows.map(item => ({
|
||||
...item,
|
||||
createBy: item.createBy || '-',
|
||||
operationDesc: item.operationDesc || '-',
|
||||
summaryItems: this.buildSummaryItems(item)
|
||||
})).map(item => {
|
||||
const previewItems = (item.summaryItems || []).slice(0, PREVIEW_ITEM_LIMIT)
|
||||
return {
|
||||
...item,
|
||||
previewItems,
|
||||
moreCount: Math.max(item.summaryItems.length - previewItems.length, 0)
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('获取钢卷修改日志失败:', e)
|
||||
this.changeLogs = []
|
||||
this.activeLog = null
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.operation-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 22px;
|
||||
padding: 0 8px;
|
||||
border-radius: 11px;
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
border: 1px solid rgba(59, 130, 246, 0.18);
|
||||
color: #2563eb;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.change-log-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.change-log-line-boxes {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.mini-change-item {
|
||||
flex: 0 0 auto;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 2px 6px;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.mini-change-label {
|
||||
color: #475569;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.mini-change-box {
|
||||
display: inline-block;
|
||||
max-width: 140px;
|
||||
padding: 0 6px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid transparent;
|
||||
font-size: 11px;
|
||||
line-height: 18px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.mini-change-box.old {
|
||||
background: #fff7ed;
|
||||
border-color: #fed7aa;
|
||||
}
|
||||
|
||||
.mini-change-box.new {
|
||||
background: #ecfdf5;
|
||||
border-color: #a7f3d0;
|
||||
}
|
||||
|
||||
.mini-change-arrow {
|
||||
color: #94a3b8;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.change-log-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||||
gap: 6px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.change-log-grid.all-items {
|
||||
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
padding: 0;
|
||||
font-size: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.change-log-card {
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 4px;
|
||||
background: #fff;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.change-log-card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 26px;
|
||||
padding: 0 8px;
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid #edf2f7;
|
||||
}
|
||||
|
||||
.change-field-name {
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.change-log-card-body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 8px;
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.change-value-box {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
padding: 6px 8px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ebeef5;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.change-value-box.old {
|
||||
background: #fff7ed;
|
||||
border-color: #fed7aa;
|
||||
}
|
||||
|
||||
.change-value-box.new {
|
||||
background: #ecfdf5;
|
||||
border-color: #a7f3d0;
|
||||
}
|
||||
|
||||
.change-value-label {
|
||||
margin-bottom: 2px;
|
||||
font-size: 10px;
|
||||
color: #94a3b8;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.change-value-text {
|
||||
color: #1e293b;
|
||||
font-size: 11px;
|
||||
line-height: 1.35;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.change-arrow {
|
||||
flex: 0 0 auto;
|
||||
color: #94a3b8;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.change-log-dialog-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px 20px;
|
||||
margin-bottom: 10px;
|
||||
color: #606266;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.change-log-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -53,6 +53,7 @@
|
||||
<div v-else-if="!pathLoading && pathChecked" class="cost-chart-wrap">
|
||||
<el-empty description="暂无加工路径数据" :image-size="60" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -704,4 +705,5 @@ export default {
|
||||
font-weight: 600;
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="coil-info-page" v-loading="loading">
|
||||
<div class="content-container">
|
||||
<BasicInfoSection :coilInfo="coilInfo" :initialQualityStatus="initialQualityStatus" />
|
||||
@@ -42,6 +42,8 @@
|
||||
<ProductionCharts v-if="isColdHardCoil"
|
||||
:segData="segData" :gaugeRows="gaugeRows" :shapeRows="shapeRows"
|
||||
:perfSegCount="perfSegCount" :segLoading="segLoading" :realtimeLoading="realtimeLoading" />
|
||||
|
||||
<ChangeLogSection :coil-id="coilId" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -64,6 +66,7 @@ import LifecycleTrace from './components/LifecycleTrace.vue'
|
||||
import ContractInfo from './components/ContractInfo.vue'
|
||||
import SalesObjectionTable from './components/SalesObjectionTable.vue'
|
||||
import TransferRecords from './components/TransferRecords.vue'
|
||||
import ChangeLogSection from './components/ChangeLogSection.vue'
|
||||
// import InspectionInfo from './components/InspectionInfo.vue'
|
||||
import ProductionCharts from './components/ProductionCharts.vue'
|
||||
|
||||
@@ -77,6 +80,7 @@ export default {
|
||||
ContractInfo,
|
||||
SalesObjectionTable,
|
||||
TransferRecords,
|
||||
ChangeLogSection,
|
||||
// InspectionInfo,
|
||||
ProductionCharts
|
||||
},
|
||||
|
||||
@@ -2298,8 +2298,9 @@ export default {
|
||||
});
|
||||
},
|
||||
handleExportCoil(row) {
|
||||
exportCoil(row.coilId).then(response => {
|
||||
this.$modal.msgSuccess("发货成功");
|
||||
this.$modal.confirm('是否确认将钢卷"' + row.currentCoilNo + '"进行发货?').then(() => {
|
||||
exportCoil(row.coilId).then(response => {
|
||||
this.$modal.msgSuccess("发货成功");
|
||||
// 2. 插入一条已完成的待操作记录
|
||||
addPendingAction({
|
||||
coilId: row.coilId,
|
||||
@@ -2318,6 +2319,8 @@ export default {
|
||||
}).catch(error => {
|
||||
this.$modal.msgError("发货失败");
|
||||
});
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
async handleNewExport(row) {
|
||||
this.loading = true
|
||||
|
||||
@@ -142,10 +142,11 @@
|
||||
<el-option label="原料" value="raw_material" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="发货状态">
|
||||
<el-select v-model="productCoilBo.status" placeholder="全部" clearable style="width: 100px;">
|
||||
<el-option label="在库" :value="0" />
|
||||
<el-option label="已发货" :value="1" />
|
||||
<el-form-item label="钢卷状态">
|
||||
<el-select v-model="productCoilBo.coilStatusType" placeholder="全部" clearable style="width: 100px;" @change="handleCoilStatusChange">
|
||||
<el-option label="在库" value="in_stock" />
|
||||
<el-option label="已发货" value="shipped" />
|
||||
<el-option label="历史卷" value="history" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="质量状态">
|
||||
@@ -433,7 +434,7 @@ export default {
|
||||
orderId: this.currentOrder.orderId,
|
||||
pageNum: this.productPagination.currentPage,
|
||||
pageSize: this.productPagination.pageSize,
|
||||
...this.productCoilBo
|
||||
coilBo: this.productCoilBo
|
||||
}).then(res => {
|
||||
this.productCoilList = res.rows || []
|
||||
this.productPagination.total = res.total || 0
|
||||
@@ -443,7 +444,7 @@ export default {
|
||||
},
|
||||
fetchProductCoilStatistics() {
|
||||
if (!this.currentOrder || !this.currentOrder.orderId) return
|
||||
getProductCoilsStatisticsByContract({ ...this.productCoilBo, orderId: this.currentOrder.orderId }).then(res => {
|
||||
getProductCoilsStatisticsByContract({ orderId: this.currentOrder.orderId, coilBo: this.productCoilBo }).then(res => {
|
||||
this.productCoilStatistics = res.data || {}
|
||||
})
|
||||
},
|
||||
@@ -457,6 +458,21 @@ export default {
|
||||
this.productCoilBo = {}
|
||||
this.handleProductFilter()
|
||||
},
|
||||
handleCoilStatusChange(val) {
|
||||
if (val === 'in_stock') {
|
||||
this.productCoilBo.status = 0;
|
||||
this.productCoilBo.dataType = 1;
|
||||
} else if (val === 'shipped') {
|
||||
this.productCoilBo.status = 1;
|
||||
this.productCoilBo.dataType = undefined;
|
||||
} else if (val === 'history') {
|
||||
this.productCoilBo.status = 0;
|
||||
this.productCoilBo.dataType = 0;
|
||||
} else {
|
||||
this.productCoilBo.status = undefined;
|
||||
this.productCoilBo.dataType = undefined;
|
||||
}
|
||||
},
|
||||
handleProductSelectionChange(selection) {
|
||||
this.selectedProductRows = selection
|
||||
},
|
||||
|
||||
@@ -104,10 +104,10 @@ const NODE_EVENT_CONFIG = {
|
||||
],
|
||||
afterSales: [
|
||||
{ id: 'A', label: '创建售后单', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/index' } },
|
||||
{ id: 'C', label: '质量部处理', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/opinion' } },
|
||||
{ id: 'D', label: '生产部处理', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/opinion' } },
|
||||
{ id: 'G', label: '陈总审批', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/summary' } },
|
||||
{ id: 'H', label: '吴部长(销售部)处理', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/opinion' } },
|
||||
{ id: 'B', label: '技术部处理', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/opinion' } },
|
||||
{ id: 'C', label: '生产部处理', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/opinion' } },
|
||||
{ id: 'D', label: '陈总审批', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/summary' } },
|
||||
{ id: 'E', label: '吴部长(销售部)处理', handler: 'handleOpen', params: { componentPath: 'wms/post/objection/opinion' } },
|
||||
],
|
||||
inventoryCheck: [
|
||||
{ id: 'A', label: '创建盘库计划', handler: 'handleOpen', params: { componentPath: 'wms/post/InvCount/index' } },
|
||||
@@ -246,21 +246,16 @@ graph TD
|
||||
afterSales: `
|
||||
graph TD
|
||||
A["<b>创建售后单</b><br/>销售内勤发起"]:::step
|
||||
A --> B["<b>质量部·生产部</b><br/>并行处理"]:::fork
|
||||
B --> C["<b>质量部</b><br/>出具处理意见"]:::dept1
|
||||
B --> D["<b>生产部</b><br/>出具处理意见"]:::dept2
|
||||
C --> F{"两部门<br/>均已完成?"}:::decision
|
||||
D --> F
|
||||
F -->|是| G["<b>陈总审批</b>"]:::dept3
|
||||
G --> H["<b>吴部长</b><br/>(销售部)<br/>处理客诉"]:::approve
|
||||
H --> J(["<b>售后单封存</b><br/>流程结束"]):::end
|
||||
A --> B["<b>技术部处理</b><br/>出具技术意见"]:::dept1
|
||||
B --> C["<b>生产部处理</b><br/>出具处理意见"]:::dept2
|
||||
C --> D["<b>陈总审批</b><br/>审阅意见并审批"]:::dept3
|
||||
D --> E["<b>吴部长</b><br/>(销售部)<br/>根据审批意见处理客诉"]:::approve
|
||||
E --> F(["<b>售后单办结</b><br/>流程结束"]):::end
|
||||
|
||||
classDef step fill:#409eff,stroke:#337ecc,color:#fff,stroke-width:2px
|
||||
classDef fork fill:#f0f5ff,stroke:#409eff,color:#303133,stroke-width:2px
|
||||
classDef dept1 fill:#e6fffa,stroke:#00b4a0,color:#303133,stroke-width:2px
|
||||
classDef dept2 fill:#fff7e6,stroke:#fa8c16,color:#303133,stroke-width:2px
|
||||
classDef dept3 fill:#fff0f6,stroke:#eb2f96,color:#303133,stroke-width:2px
|
||||
classDef decision fill:#f9f0ff,stroke:#722ed1,color:#303133,stroke-width:2px
|
||||
classDef approve fill:#e6f7ff,stroke:#1890ff,color:#303133,stroke-width:2px
|
||||
classDef end fill:#dcf7e8,stroke:#52c41a,color:#303133,stroke-width:2px,rx:10,ry:10
|
||||
linkStyle default stroke:#bfbfbf,stroke-width:2px
|
||||
|
||||
@@ -66,7 +66,7 @@ export default {
|
||||
}
|
||||
},
|
||||
getDeptName(deptId) {
|
||||
const map = { 1: '生产部', 2: '质量部', 3: '销售部(吴部长)', 4: '陈总审批' };
|
||||
const map = { 1: '生产部', 2: '技术部', 3: '销售部(吴部长)', 4: '陈总审批' };
|
||||
return map[deptId] || '部门' + deptId;
|
||||
},
|
||||
parseTime(time, option) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="确认人" prop="internalConfirmer">
|
||||
<el-input v-model="formData.internalConfirmer" placeholder="请输入确认人" @input="emitJson" />
|
||||
<MemoInput v-model="formData.internalConfirmer" storageKey="objectionInternalConfirmer" placeholder="请输入确认人" @input="emitJson" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -23,7 +23,7 @@
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="确认人" prop="externalConfirmer">
|
||||
<el-input v-model="formData.externalConfirmer" placeholder="请输入确认人" @input="emitJson" />
|
||||
<MemoInput v-model="formData.externalConfirmer" storageKey="objectionExternalConfirmer" placeholder="请输入确认人" @input="emitJson" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -33,12 +33,12 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item label="责任单位" prop="responsibleUnit">
|
||||
<el-input v-model="formData.responsibleUnit" placeholder="请输入责任单位" @input="emitJson" />
|
||||
<MemoInput v-model="formData.responsibleUnit" storageKey="objectionResponsibleUnit" placeholder="请输入责任单位" @input="emitJson" />
|
||||
</el-form-item>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="接收人" prop="receiver">
|
||||
<el-input v-model="formData.receiver" placeholder="请输入接收人" @input="emitJson" />
|
||||
<MemoInput v-model="formData.receiver" storageKey="objectionReceiver" placeholder="请输入接收人" @input="emitJson" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -49,7 +49,7 @@
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<!-- 质量部 deptId=2 -->
|
||||
<!-- 技术部 deptId=2 -->
|
||||
<template v-else-if="deptId === 2">
|
||||
<el-form-item label="产生原因" prop="cause">
|
||||
<el-input v-model="formData.cause" type="textarea" :rows="3" placeholder="请描述产生原因" @input="emitJson" />
|
||||
@@ -60,7 +60,7 @@
|
||||
<el-form-item label="纠正措施" prop="correctiveAction">
|
||||
<el-input v-model="formData.correctiveAction" type="textarea" :rows="3" placeholder="请输入纠正措施" @input="emitJson" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预计整改完成日期" prop="rectifyDate">
|
||||
<el-form-item label="预计完成日期" prop="rectifyDate">
|
||||
<el-date-picker v-model="formData.rectifyDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width:100%" @change="emitJson" />
|
||||
</el-form-item>
|
||||
<el-form-item label="主管意见" prop="supervisorOpinion">
|
||||
@@ -72,7 +72,7 @@
|
||||
<template v-else-if="deptId === 4">
|
||||
<el-form-item label="审阅意见" prop="reviewOpinion">
|
||||
<el-input v-model="formData.reviewOpinion" type="textarea" :rows="4"
|
||||
placeholder="请审阅质量部、生产部意见后填写审批意见" @input="emitJson" />
|
||||
placeholder="请审阅技术部、生产部意见后填写审批意见" @input="emitJson" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批结论" prop="approvalResult">
|
||||
<el-radio-group v-model="formData.approvalResult" @change="emitJson">
|
||||
@@ -91,16 +91,19 @@
|
||||
<el-form-item label="处理意见" prop="handlingOpinion">
|
||||
<el-input v-model="formData.handlingOpinion" type="textarea" :rows="4" placeholder="请输入处理意见" @input="emitJson" />
|
||||
</el-form-item>
|
||||
<el-form-item label="领导意见" prop="leaderOpinion">
|
||||
<el-input v-model="formData.leaderOpinion" type="textarea" :rows="3" placeholder="请输入领导意见" @input="emitJson" />
|
||||
<el-form-item label="处理方案" prop="leaderOpinion">
|
||||
<el-input v-model="formData.leaderOpinion" type="textarea" :rows="3" placeholder="请输入处理方案" @input="emitJson" />
|
||||
</el-form-item>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MemoInput from '@/components/MemoInput'
|
||||
|
||||
export default {
|
||||
name: 'DeptOpinionForm',
|
||||
components: { MemoInput },
|
||||
props: {
|
||||
deptId: {
|
||||
type: Number,
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 质量部 deptId=2 -->
|
||||
<!-- 技术部 deptId=2 -->
|
||||
<template v-else-if="deptId === 2">
|
||||
<div class="preview-row" v-if="parsedData.cause">
|
||||
<span class="preview-label">产生原因</span>
|
||||
|
||||
@@ -51,7 +51,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
getDeptName(deptId) {
|
||||
const map = { 1: '生产部', 2: '质量部', 3: '销售部' };
|
||||
const map = { 1: '生产部', 2: '技术部', 3: '销售部' };
|
||||
return map[deptId] || '部门' + deptId;
|
||||
},
|
||||
parseTime(time, option) {
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
<span>流程总览 <span class="en-sub">· Process Overview</span></span>
|
||||
</div>
|
||||
<el-steps :active="activeStep" align-center class="flow-steps">
|
||||
<el-step title="质量部·生产部" icon="el-icon-s-operation" />
|
||||
<el-step title="技术部处理" icon="el-icon-s-operation" />
|
||||
<el-step title="生产部处理" icon="el-icon-s-operation" />
|
||||
<el-step title="陈总审批" icon="el-icon-s-check" />
|
||||
<el-step title="吴部长处理" icon="el-icon-s-custom" />
|
||||
<el-step title="已办结" icon="el-icon-circle-check" />
|
||||
@@ -33,29 +34,31 @@ export default {
|
||||
computed: {
|
||||
/**
|
||||
* el-steps active 从 0 开始。
|
||||
* 1=技术部·生产部→0, 2=陈总审批→1, 3=吴部长处理→2, 4=已办结→3
|
||||
* 1=技术部处理→0, 2=生产部处理→1, 3=陈总审批→2, 4=吴部长处理→3, 5=已办结→4
|
||||
*/
|
||||
activeStep() {
|
||||
if (this.flowStatus == null) return -1;
|
||||
const v = Number(this.flowStatus);
|
||||
if (v >= 4) return 3;
|
||||
if (v >= 5) return 4;
|
||||
return v - 1;
|
||||
},
|
||||
flowStatusText() {
|
||||
const map = {
|
||||
1: '质量部·生产部处理中',
|
||||
2: '待陈总审批',
|
||||
3: '待吴部长处理',
|
||||
4: '已办结'
|
||||
1: '技术部处理中',
|
||||
2: '生产部处理中',
|
||||
3: '待陈总审批',
|
||||
4: '待吴部长处理',
|
||||
5: '已办结'
|
||||
};
|
||||
return map[this.flowStatus] || '未知';
|
||||
},
|
||||
tagType() {
|
||||
const map = {
|
||||
1: 'warning',
|
||||
2: 'primary',
|
||||
3: 'warning',
|
||||
4: 'success'
|
||||
2: 'warning',
|
||||
3: 'primary',
|
||||
4: 'warning',
|
||||
5: 'success'
|
||||
};
|
||||
return map[this.flowStatus] || '';
|
||||
}
|
||||
|
||||
@@ -57,10 +57,11 @@ export default {
|
||||
computed: {
|
||||
flowStatusText() {
|
||||
const map = {
|
||||
1: '待审核',
|
||||
2: '意见填写中',
|
||||
3: '待汇总方案',
|
||||
4: '全部办结'
|
||||
1: '技术部处理中',
|
||||
2: '生产部处理中',
|
||||
3: '待陈总审批',
|
||||
4: '待吴部长处理',
|
||||
5: '已办结'
|
||||
};
|
||||
return map[this.flowStatus] || '未知';
|
||||
},
|
||||
@@ -68,8 +69,9 @@ export default {
|
||||
const map = {
|
||||
1: 'info',
|
||||
2: 'warning',
|
||||
3: '',
|
||||
4: 'success'
|
||||
3: 'warning',
|
||||
4: '',
|
||||
5: 'success'
|
||||
};
|
||||
return map[this.flowStatus] || '';
|
||||
}
|
||||
|
||||
@@ -12,10 +12,11 @@
|
||||
</div>
|
||||
<el-select v-model="queryParams.flowStatus" placeholder="全部阶段" clearable size="mini" @change="handleQuery"
|
||||
class="header-filter">
|
||||
<el-option label="质量部·生产部处理" :value="1" />
|
||||
<el-option label="待陈总审批" :value="2" />
|
||||
<el-option label="待吴部长处理" :value="3" />
|
||||
<el-option label="已办结" :value="4" />
|
||||
<el-option label="技术部处理中" :value="1" />
|
||||
<el-option label="生产部处理中" :value="2" />
|
||||
<el-option label="待陈总审批" :value="3" />
|
||||
<el-option label="待吴部长处理" :value="4" />
|
||||
<el-option label="已办结" :value="5" />
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
@@ -30,21 +31,22 @@
|
||||
<div v-loading="loading" class="list-body">
|
||||
<div v-for="item in dataList" :key="item.acceptId" class="list-item"
|
||||
:class="{ active: currentRow && currentRow.acceptId === item.acceptId }" @click="handleRowClick(item)">
|
||||
<div class="item-main">
|
||||
<div class="item-row-top">
|
||||
<span class="item-title">{{ item.complaintNo }}</span>
|
||||
<el-tag v-if="item.flowStatus === 1" type="warning" size="mini">技术部处理中</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 2" type="warning" size="mini">生产部处理中</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 3" type="primary" size="mini">待陈总审批</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 4" type="warning" size="mini">待吴部长处理</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 5" type="success" size="mini">已办结</el-tag>
|
||||
</div>
|
||||
<div class="item-row-bottom">
|
||||
<span class="item-sub">{{ parseTime(item.complaintDate, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<el-tag v-if="item.flowStatus === 1" type="warning" size="mini">质量部·生产部处理中</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 2" type="primary" size="mini">待陈总审批</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 3" type="warning" size="mini">待吴部长处理</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 4" type="success" size="mini">已办结</el-tag>
|
||||
</div>
|
||||
<div class="item-actions">
|
||||
<el-button size="mini" type="text" icon="el-icon-download"
|
||||
@click.stop="handleExportPdf(item)" title="导出PDF"></el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click.stop="handleUpdate(item)"></el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click.stop="handleDelete(item)"></el-button>
|
||||
<div class="item-actions">
|
||||
<el-button size="mini" type="text" icon="el-icon-download"
|
||||
@click.stop="handleExportPdf(item)" title="导出PDF"></el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click.stop="handleUpdate(item)"></el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click.stop="handleDelete(item)"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="dataList.length === 0 && !loading" class="list-empty">
|
||||
@@ -108,7 +110,7 @@
|
||||
<DepartmentOpinionSection :taskList="taskList" @refresh="refreshTaskList" />
|
||||
|
||||
<div class="section-gap" />
|
||||
<HandlingSchemeSection :content="currentRow.planContent" :editable="currentRow.flowStatus === 3" @save="handleSavePlan" />
|
||||
<HandlingSchemeSection :content="currentRow.planContent" :editable="currentRow.flowStatus === 4" @save="handleSavePlan" />
|
||||
|
||||
<div class="section-gap" />
|
||||
<template v-if="false">
|
||||
@@ -170,8 +172,9 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
<el-button v-if="form.acceptId" :loading="draftLoading" @click="saveDraft">暂 存</el-button>
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@@ -222,6 +225,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
buttonLoading: false,
|
||||
draftLoading: false,
|
||||
pdfLoading: false,
|
||||
loading: true,
|
||||
detailLoading: false,
|
||||
@@ -248,7 +252,7 @@ export default {
|
||||
selectedDeptIds: [],
|
||||
deptOptions: [
|
||||
{ deptId: 1, deptName: '生产部' },
|
||||
{ deptId: 2, deptName: '质量部' },
|
||||
{ deptId: 2, deptName: '技术部' },
|
||||
{ deptId: 3, deptName: '销售部' }
|
||||
],
|
||||
rules: {
|
||||
@@ -306,7 +310,7 @@ export default {
|
||||
}).finally(() => { this.coilLoading = false; });
|
||||
},
|
||||
getDeptName(deptId) {
|
||||
const map = { 1: '生产部', 2: '质量部', 3: '销售部' };
|
||||
const map = { 1: '生产部', 2: '技术部', 3: '销售部' };
|
||||
return map[deptId] || '部门' + deptId;
|
||||
},
|
||||
handleAdd() {
|
||||
@@ -332,6 +336,19 @@ export default {
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const acceptId = row.acceptId;
|
||||
// 检查是否有本地暂存
|
||||
const draftKey = 'draft_' + acceptId;
|
||||
const cached = localStorage.getItem(draftKey);
|
||||
if (cached) {
|
||||
try {
|
||||
const draft = JSON.parse(cached);
|
||||
this.form = draft.form;
|
||||
this.formCoilList = draft.formCoilList || [];
|
||||
this.open = true;
|
||||
this.title = "修改售后单(已恢复未保存内容)";
|
||||
return;
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
getComplaintAccept(acceptId).then(response => {
|
||||
this.form = response.data;
|
||||
listAcceptCoilRel({ acceptId, pageNum: 1, pageSize: 999 }).then(r => {
|
||||
@@ -370,6 +387,21 @@ export default {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
saveDraft() {
|
||||
this.draftLoading = true;
|
||||
const draftKey = 'draft_' + this.form.acceptId;
|
||||
localStorage.setItem(draftKey, JSON.stringify({
|
||||
form: this.form,
|
||||
formCoilList: this.formCoilList
|
||||
}));
|
||||
this.$modal.msgSuccess("已暂存");
|
||||
this.draftLoading = false;
|
||||
this.open = false;
|
||||
},
|
||||
clearDraft(acceptId) {
|
||||
const draftKey = 'draft_' + acceptId;
|
||||
localStorage.removeItem(draftKey);
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
@@ -377,6 +409,7 @@ export default {
|
||||
const formData = { ...this.form, coilIds: this.formCoilList.map(c => c.coilId) };
|
||||
if (this.form.acceptId != null) {
|
||||
updateComplaintAccept(formData).then(() => {
|
||||
this.clearDraft(this.form.acceptId);
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
@@ -610,8 +643,8 @@ export default {
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
flex-direction: column;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 2px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
@@ -631,15 +664,23 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
.item-row-top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.item-row-bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
@@ -654,8 +695,7 @@ export default {
|
||||
}
|
||||
|
||||
.item-meta {
|
||||
flex-shrink: 0;
|
||||
margin: 0 8px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-actions {
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
<div v-loading="loading" class="list-body">
|
||||
<div v-for="item in taskList" :key="item.taskId" class="list-item"
|
||||
:class="{ active: currentTask && currentTask.taskId === item.taskId }" @click="handleRowClick(item)">
|
||||
<div class="item-main">
|
||||
<div class="item-row-top">
|
||||
<span class="item-title">{{ (item.acceptInfo || {}).complaintNo || '' }}</span>
|
||||
<span class="item-sub">{{ parseTime((item.acceptInfo || {}).complaintDate, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<el-tag v-if="item.rejectMark === 1" type="danger" size="mini">已驳回</el-tag>
|
||||
<el-tag v-else-if="item.rejectMark === 2" type="info" size="mini">已隐藏</el-tag>
|
||||
<el-tag v-else-if="item.taskStatus === 0" type="warning" size="mini">待填写</el-tag>
|
||||
<el-tag v-else-if="item.taskStatus === 1" type="success" size="mini">已完成</el-tag>
|
||||
</div>
|
||||
<div class="item-actions">
|
||||
<el-button v-if="canEdit(item)" size="mini" type="text" icon="el-icon-edit" @click.stop="handleRowClick(item)"></el-button>
|
||||
<el-button v-else size="mini" type="text" icon="el-icon-view" @click.stop="handleRowClick(item)"></el-button>
|
||||
<div class="item-row-bottom">
|
||||
<span class="item-sub">{{ parseTime((item.acceptInfo || {}).complaintDate, '{y}-{m}-{d}') }}</span>
|
||||
<div class="item-actions">
|
||||
<el-button v-if="canEdit(item)" size="mini" type="text" icon="el-icon-edit" @click.stop="handleRowClick(item)"></el-button>
|
||||
<el-button v-else size="mini" type="text" icon="el-icon-view" @click.stop="handleRowClick(item)"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="taskList.length === 0 && !loading" class="list-empty">
|
||||
@@ -116,6 +116,7 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div class="form-actions">
|
||||
<el-button :loading="draftLoading" @click="saveDraft">暂 存</el-button>
|
||||
<el-button :loading="submitLoading" type="primary" @click="submitOpinion">提 交</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -151,6 +152,7 @@ export default {
|
||||
detailLoading: false,
|
||||
coilLoading: false,
|
||||
submitLoading: false,
|
||||
draftLoading: false,
|
||||
total: 0,
|
||||
|
||||
queryParams: {
|
||||
@@ -211,6 +213,17 @@ export default {
|
||||
this.dialogCoilList = r.rows || [];
|
||||
}).finally(() => { this.coilLoading = false; this.detailLoading = false; });
|
||||
|
||||
// 检查本地暂存
|
||||
const draftKey = 'draft_opinion_' + row.taskId;
|
||||
const cached = localStorage.getItem(draftKey);
|
||||
if (cached) {
|
||||
try {
|
||||
const draft = JSON.parse(cached);
|
||||
this.opinionForm = { deptOpinion: draft.deptOpinion || '', fillFile: draft.fillFile || '' };
|
||||
return;
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
|
||||
getComplaintTask(row.taskId).then(response => {
|
||||
const task = response.data || {};
|
||||
this.opinionForm = {
|
||||
@@ -236,13 +249,19 @@ export default {
|
||||
}).finally(() => { this.coilLoading = false; });
|
||||
},
|
||||
getDeptLabel() {
|
||||
const map = { 1: '生产部', 2: '质量部', 3: '销售部(吴部长)', 4: '陈总审批' };
|
||||
const map = { 1: '生产部', 2: '技术部', 3: '销售部(吴部长)', 4: '陈总审批' };
|
||||
return map[this.queryParams.deptId] || '';
|
||||
},
|
||||
canEdit(row) {
|
||||
const status = (row.acceptInfo || {}).flowStatus;
|
||||
// 只要节点task状态为待处理(0)就可编辑
|
||||
return status >= 1 && status <= 3;
|
||||
const deptId = row.deptId;
|
||||
// 技术部(deptId=2) 仅在 flowStatus=1 时可编辑
|
||||
// 生产部(deptId=1) 仅在 flowStatus=2 时可编辑
|
||||
// 吴部长(deptId=3) 仅在 flowStatus=4 时可编辑
|
||||
if (deptId === 2 && status === 1) return true;
|
||||
if (deptId === 1 && status === 2) return true;
|
||||
if (deptId === 3 && status === 4) return true;
|
||||
return false;
|
||||
},
|
||||
loadAllTasks() {
|
||||
if (!this.currentTask.acceptId) return;
|
||||
@@ -252,7 +271,7 @@ export default {
|
||||
pageSize: 999
|
||||
}).then(r => {
|
||||
const tasks = r.rows || [];
|
||||
// 按 deptId 排序: 质量部(2)→生产部(1)→陈总(4)
|
||||
// 按 deptId 排序: 技术部(2)→生产部(1)→陈总(4)
|
||||
const order = { 2: 1, 1: 2, 4: 3 };
|
||||
tasks.sort((a, b) => (order[a.deptId] || 99) - (order[b.deptId] || 99));
|
||||
this.allTaskList = tasks;
|
||||
@@ -285,11 +304,29 @@ export default {
|
||||
taskStatus: 1,
|
||||
fillTime: this.parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}')
|
||||
}).then(() => {
|
||||
this.clearDraft(this.currentTask.taskId);
|
||||
this.$modal.msgSuccess("已提交,流程已流转至下一节点");
|
||||
this.getList();
|
||||
this.currentTask = {};
|
||||
}).finally(() => { this.submitLoading = false; });
|
||||
}
|
||||
},
|
||||
saveDraft() {
|
||||
if (!this.currentTask.taskId) {
|
||||
this.$modal.msgWarning("请先在左侧选择一条任务");
|
||||
return;
|
||||
}
|
||||
this.draftLoading = true;
|
||||
const draftKey = 'draft_opinion_' + this.currentTask.taskId;
|
||||
localStorage.setItem(draftKey, JSON.stringify({
|
||||
deptOpinion: this.opinionForm.deptOpinion,
|
||||
fillFile: this.opinionForm.fillFile
|
||||
}));
|
||||
this.$modal.msgSuccess("已暂存");
|
||||
this.draftLoading = false;
|
||||
},
|
||||
clearDraft(taskId) {
|
||||
localStorage.removeItem('draft_opinion_' + taskId);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -350,8 +387,8 @@ export default {
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
flex-direction: column;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 2px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
@@ -371,15 +408,23 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
.item-row-top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.item-row-bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
@@ -393,9 +438,12 @@ export default {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-meta {
|
||||
flex-shrink: 0;
|
||||
margin: 0 8px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-actions {
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
</div>
|
||||
<el-select v-model="queryParams.flowStatus" placeholder="全部阶段" clearable size="mini" @change="handleQuery"
|
||||
class="header-filter">
|
||||
<el-option label="待审批" :value="2" />
|
||||
<el-option label="已办结" :value="4" />
|
||||
<el-option label="待审批" :value="3" />
|
||||
<el-option label="已办结" :value="5" />
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
<div v-loading="loading" class="list-body">
|
||||
<div v-for="item in dataList" :key="item.acceptId" class="list-item"
|
||||
:class="{ active: currentRow && currentRow.acceptId === item.acceptId }" @click="handleRowClick(item)">
|
||||
<div class="item-main">
|
||||
<div class="item-row-top">
|
||||
<span class="item-title">{{ item.complaintNo }}</span>
|
||||
<span class="item-sub">{{ parseTime(item.complaintDate, '{y}-{m}-{d}') }}</span>
|
||||
<el-tag v-if="item.flowStatus === 3" type="primary" size="mini">待陈总审批</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 5" type="success" size="mini">已办结</el-tag>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<el-tag v-if="item.flowStatus === 2" type="primary" size="mini">待陈总审批</el-tag>
|
||||
<el-tag v-else-if="item.flowStatus === 4" type="success" size="mini">已办结</el-tag>
|
||||
<div class="item-row-bottom">
|
||||
<span class="item-sub">{{ parseTime(item.complaintDate, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="dataList.length === 0 && !loading" class="list-empty">
|
||||
@@ -57,7 +57,7 @@
|
||||
<HeaderControlSection :complaintNo="currentRow.complaintNo" :flowStatus="currentRow.flowStatus"
|
||||
:meta="currentRow">
|
||||
<template #actions>
|
||||
<el-button v-if="currentRow.flowStatus === 4" size="mini" type="primary" plain
|
||||
<el-button v-if="currentRow.flowStatus === 5" size="mini" type="primary" plain
|
||||
icon="el-icon-download" @click="handleExportPdf">导出</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-refresh" @click="handleRefreshDetail"
|
||||
title="刷新详情">刷新</el-button>
|
||||
@@ -83,14 +83,15 @@
|
||||
<div class="section-gap" />
|
||||
<DepartmentOpinionSection :taskList="taskList" @refresh="refreshTaskList" />
|
||||
|
||||
<div v-if="currentRow.flowStatus === 2" class="section-gap" />
|
||||
<div v-if="currentRow.flowStatus === 2" class="approval-section">
|
||||
<div v-if="currentRow.flowStatus === 3" class="section-gap" />
|
||||
<div v-if="currentRow.flowStatus === 3" class="approval-section">
|
||||
<div class="section-title">
|
||||
<span>审批意见 <span class="en-sub">· Approval Opinion</span></span>
|
||||
</div>
|
||||
<el-input v-model="approvalOpinion" type="textarea" :rows="4"
|
||||
placeholder="请填写审批意见(审阅质量部、生产部意见后)" />
|
||||
placeholder="请填写审批意见(审阅技术部、生产部意见后)" />
|
||||
<div class="form-actions">
|
||||
<el-button :loading="draftLoading" @click="saveDraft">暂 存</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-circle-check" :loading="completeLoading"
|
||||
@click="handleComplete">提交审批</el-button>
|
||||
</div>
|
||||
@@ -132,6 +133,7 @@ export default {
|
||||
detailLoading: false,
|
||||
coilLoading: false,
|
||||
completeLoading: false,
|
||||
draftLoading: false,
|
||||
total: 0,
|
||||
dataList: [],
|
||||
currentRow: null,
|
||||
@@ -139,7 +141,7 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
complaintNo: undefined,
|
||||
flowStatus: 2
|
||||
flowStatus: 3
|
||||
},
|
||||
coilList: [],
|
||||
taskList: [],
|
||||
@@ -168,6 +170,16 @@ export default {
|
||||
},
|
||||
loadDetail(acceptId) {
|
||||
this.detailLoading = true;
|
||||
// 检查本地暂存
|
||||
const draftKey = 'draft_summary_' + acceptId;
|
||||
const cached = localStorage.getItem(draftKey);
|
||||
if (cached) {
|
||||
try {
|
||||
this.approvalOpinion = cached;
|
||||
} catch (e) { /* ignore */ }
|
||||
} else {
|
||||
this.approvalOpinion = '';
|
||||
}
|
||||
getComplaintAccept(acceptId).then(response => {
|
||||
this.currentRow = response.data;
|
||||
this.loadRelData(acceptId);
|
||||
@@ -223,6 +235,7 @@ export default {
|
||||
throw new Error('no chen task');
|
||||
}
|
||||
}).then(() => {
|
||||
this.clearDraft(this.currentRow.acceptId);
|
||||
this.$modal.msgSuccess("审批已提交,已流转至吴部长处理");
|
||||
this.completeLoading = false;
|
||||
this.approvalOpinion = '';
|
||||
@@ -230,6 +243,23 @@ export default {
|
||||
this.getList();
|
||||
}).catch(() => { this.completeLoading = false; });
|
||||
},
|
||||
saveDraft() {
|
||||
if (!this.currentRow || !this.currentRow.acceptId) {
|
||||
this.$modal.msgWarning("请先在左侧选择一条售后单");
|
||||
return;
|
||||
}
|
||||
if (!this.approvalOpinion) {
|
||||
this.$modal.msgWarning("请先填写审批意见再暂存");
|
||||
return;
|
||||
}
|
||||
this.draftLoading = true;
|
||||
localStorage.setItem('draft_summary_' + this.currentRow.acceptId, this.approvalOpinion);
|
||||
this.$modal.msgSuccess("已暂存");
|
||||
this.draftLoading = false;
|
||||
},
|
||||
clearDraft(acceptId) {
|
||||
localStorage.removeItem('draft_summary_' + acceptId);
|
||||
},
|
||||
handleExportPdf() {
|
||||
this.$refs.exportPdfDialog.open(this.currentRow.acceptId);
|
||||
}
|
||||
@@ -292,8 +322,8 @@ export default {
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
flex-direction: column;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 2px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
@@ -313,15 +343,23 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
.item-row-top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.item-row-bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
@@ -335,9 +373,12 @@ export default {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-meta {
|
||||
flex-shrink: 0;
|
||||
margin: 0 8px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.list-empty {
|
||||
|
||||
@@ -25,19 +25,19 @@
|
||||
<div v-loading="loading" class="list-body">
|
||||
<div v-for="item in dataList" :key="item.relId" class="list-item"
|
||||
:class="{ active: currentRel && currentRel.relId === item.relId }" @click="handleRowClick(item)">
|
||||
<div class="item-main">
|
||||
<div class="item-row-top">
|
||||
<span class="item-title">{{ (item.acceptInfo || {}).complaintNo || '' }}</span>
|
||||
<span class="item-sub">{{ getDeptName(item.deptId) }} · {{ parseTime((item.acceptInfo || {}).complaintDate, '{y}-{m}-{d}') }}</span>
|
||||
</div>
|
||||
<div class="item-meta">
|
||||
<el-tag v-if="item.rejectMark === 1" type="danger" size="mini">已驳回</el-tag>
|
||||
<el-tag v-else-if="item.rejectMark === 2" type="info" size="mini">已隐藏</el-tag>
|
||||
<el-tag v-else-if="item.executeStatus === 0" type="warning" size="mini">待执行</el-tag>
|
||||
<el-tag v-else-if="item.executeStatus === 1" type="success" size="mini">已反馈</el-tag>
|
||||
</div>
|
||||
<div class="item-actions">
|
||||
<el-button v-if="item.executeStatus === 0" size="mini" type="text" icon="el-icon-edit" @click.stop="handleRowClick(item)"></el-button>
|
||||
<el-button v-else size="mini" type="text" icon="el-icon-view" @click.stop="handleRowClick(item)"></el-button>
|
||||
<div class="item-row-bottom">
|
||||
<span class="item-sub">{{ getDeptName(item.deptId) }} · {{ parseTime((item.acceptInfo || {}).complaintDate, '{y}-{m}-{d}') }}</span>
|
||||
<div class="item-actions">
|
||||
<el-button v-if="item.executeStatus === 0" size="mini" type="text" icon="el-icon-edit" @click.stop="handleRowClick(item)"></el-button>
|
||||
<el-button v-else size="mini" type="text" icon="el-icon-view" @click.stop="handleRowClick(item)"></el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="dataList.length === 0 && !loading" class="list-empty">
|
||||
@@ -183,11 +183,11 @@ export default {
|
||||
}).finally(() => { this.loading = false; });
|
||||
},
|
||||
getDeptName(deptId) {
|
||||
const map = { 1: '生产部', 2: '质量部', 3: '销售部' };
|
||||
const map = { 1: '生产部', 2: '技术部', 3: '销售部' };
|
||||
return map[deptId] || '部门' + deptId;
|
||||
},
|
||||
getDeptLabel() {
|
||||
const map = { 1: '生产部', 2: '质量部', 3: '销售部' };
|
||||
const map = { 1: '生产部', 2: '技术部', 3: '销售部' };
|
||||
return map[this.currentRel.deptId] || '';
|
||||
},
|
||||
handleQuery() {
|
||||
@@ -326,8 +326,8 @@ export default {
|
||||
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
flex-direction: column;
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 2px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
@@ -347,15 +347,23 @@ export default {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
.item-row-top {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.item-row-bottom {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
@@ -369,9 +377,12 @@ export default {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.item-main {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-meta {
|
||||
flex-shrink: 0;
|
||||
margin: 0 8px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.item-actions {
|
||||
|
||||
@@ -524,14 +524,19 @@ export default {
|
||||
endDate = `${dateStr}-${lastDayOfMonth.toString().padStart(2, '0')}`;
|
||||
} else if (dayPattern.test(dateStr)) {
|
||||
startDate = dateStr;
|
||||
endDate = dateStr;
|
||||
const nextDay = new Date(dateStr);
|
||||
nextDay.setDate(nextDay.getDate() + 1);
|
||||
const nextYear = nextDay.getFullYear();
|
||||
const nextMonth = String(nextDay.getMonth() + 1).padStart(2, '0');
|
||||
const nextDayNum = String(nextDay.getDate()).padStart(2, '0');
|
||||
endDate = `${nextYear}-${nextMonth}-${nextDayNum}`;
|
||||
} else {
|
||||
throw new Error('输入格式错误,请传入 yyyy、yyyy-MM 或 yyyy-MM-dd 格式的字符串');
|
||||
}
|
||||
|
||||
return {
|
||||
start: `${startDate} 00:00:00`,
|
||||
end: `${endDate} 23:59:59`
|
||||
start: `${startDate} 07:00:00`,
|
||||
end: `${endDate} 07:00:00`
|
||||
};
|
||||
};
|
||||
|
||||
@@ -552,7 +557,7 @@ export default {
|
||||
defaultEndTime,
|
||||
getDayTimeRange,
|
||||
// all 类型专用
|
||||
viewType: 'custom',
|
||||
viewType: 'day',
|
||||
yesterdaySummary: {},
|
||||
monthChart: null,
|
||||
dayChart: null,
|
||||
@@ -734,9 +739,9 @@ export default {
|
||||
this.queryParams.byCreateTimeStart = start;
|
||||
this.queryParams.byCreateTimeEnd = end;
|
||||
} else if (this.reportType === 'all') {
|
||||
// all 类型默认使用当前月份作为自定义时间范围
|
||||
this.viewType = 'custom';
|
||||
const { start, end } = this.getDayTimeRange(this.monthDate);
|
||||
// all 类型默认使用日视图,选中今天,筛选今天07:00到明天07:00的数据
|
||||
this.viewType = 'day';
|
||||
const { start, end } = this.getDayTimeRange(this.dayDate);
|
||||
this.queryParams.startTime = start;
|
||||
this.queryParams.endTime = end;
|
||||
} else {
|
||||
@@ -812,8 +817,8 @@ export default {
|
||||
// all 类型:年视图日期变更
|
||||
handleYearDateChange() {
|
||||
if (this.yearDate) {
|
||||
this.queryParams.startTime = `${this.yearDate}-01-01 00:00:00`;
|
||||
this.queryParams.endTime = `${this.yearDate}-12-31 23:59:59`;
|
||||
this.queryParams.startTime = `${this.yearDate}-01-01 07:00:00`;
|
||||
this.queryParams.endTime = `${this.yearDate}-12-31 07:00:00`;
|
||||
this.handleQuery();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,14 +2,13 @@ package com.klp.controller;
|
||||
|
||||
import com.klp.common.core.domain.R;
|
||||
import com.klp.domain.bo.WmsAnnealPerformanceBo;
|
||||
import com.klp.domain.bo.WmsAnnealPlanCoilBo;
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import com.klp.domain.vo.anneal.WmsAnnealPerformanceVo;
|
||||
import com.klp.service.IWmsAnnealPerformanceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,8 +34,8 @@ public class WmsAnnealPerformanceController {
|
||||
/**
|
||||
* 查询退火计划中的加工前钢卷列表
|
||||
*/
|
||||
@GetMapping("/rawCoils")
|
||||
public R<List<WmsMaterialCoilVo>> getRawCoils(WmsAnnealPerformanceBo bo) {
|
||||
@PostMapping("/rawCoils")
|
||||
public R<List<WmsMaterialCoilVo>> getRawCoils(@RequestBody WmsAnnealPlanCoilBo bo) {
|
||||
return R.ok(performanceService.queryPlanCoils(bo));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,15 @@ public class WmsCoilChangeLogController extends BaseController {
|
||||
return R.ok(iWmsCoilChangeLogService.queryById(logId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 按钢卷ID查询变更日志
|
||||
*/
|
||||
@GetMapping("/byCoilId/{coilId}")
|
||||
public R<List<WmsCoilChangeLogVo>> getByCoilId(@NotNull(message = "钢卷ID不能为空")
|
||||
@PathVariable Long coilId) {
|
||||
return R.ok(iWmsCoilChangeLogService.queryByCoilId(coilId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增钢卷变更日志
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.klp.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 退火计划钢卷查询复合BO
|
||||
*
|
||||
* @author klp
|
||||
* @date 2026-07-14
|
||||
*/
|
||||
@Data
|
||||
public class WmsAnnealPlanCoilBo {
|
||||
|
||||
private WmsAnnealPerformanceBo planBo;
|
||||
|
||||
private WmsMaterialCoilBo coilBo;
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.klp.domain.vo;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.klp.common.annotation.ExcelDictFormat;
|
||||
import com.klp.common.core.domain.BaseEntity;
|
||||
import com.klp.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -15,7 +16,7 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class WmsCoilChangeLogVo {
|
||||
public class WmsCoilChangeLogVo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.klp.service;
|
||||
|
||||
import com.klp.domain.bo.WmsAnnealPerformanceBo;
|
||||
import com.klp.domain.bo.WmsAnnealPlanCoilBo;
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import com.klp.domain.vo.anneal.WmsAnnealPerformanceVo;
|
||||
|
||||
@@ -19,5 +20,5 @@ public interface IWmsAnnealPerformanceService {
|
||||
/**
|
||||
* 查询退火计划中的加工前钢卷列表
|
||||
*/
|
||||
List<WmsMaterialCoilVo> queryPlanCoils(WmsAnnealPerformanceBo bo);
|
||||
List<WmsMaterialCoilVo> queryPlanCoils(WmsAnnealPlanCoilBo bo);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,11 @@ public interface IWmsCoilChangeLogService {
|
||||
*/
|
||||
List<WmsCoilChangeLogVo> queryList(WmsCoilChangeLogBo bo);
|
||||
|
||||
/**
|
||||
* 按钢卷ID查询钢卷变更日志列表(匹配变更前/变更后钢卷)
|
||||
*/
|
||||
List<WmsCoilChangeLogVo> queryByCoilId(Long coilId);
|
||||
|
||||
/**
|
||||
* 新增钢卷变更日志
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.klp.common.core.domain.PageQuery;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.domain.bo.WmsAnnealPerformanceBo;
|
||||
import com.klp.domain.bo.WmsAnnealPlanCoilBo;
|
||||
import com.klp.domain.bo.WmsMaterialCoilBo;
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import com.klp.domain.vo.anneal.WmsAnnealPerformanceDetailVo;
|
||||
@@ -144,27 +145,32 @@ public class WmsAnnealPerformanceServiceImpl implements IWmsAnnealPerformanceSer
|
||||
continue; // 没找到加工后的卷,跳过
|
||||
}
|
||||
|
||||
// 如果传入了筛选条件,只保留匹配的钢卷
|
||||
if (bo.getEnterCoilNo() != null && !bo.getEnterCoilNo().isEmpty()) {
|
||||
// 筛选加工后的钢卷
|
||||
if (StringUtils.isNotBlank(bo.getEnterCoilNo())) {
|
||||
if (coilVo.getEnterCoilNo() == null ||
|
||||
!coilVo.getEnterCoilNo().contains(bo.getEnterCoilNo())) {
|
||||
continue; // 跳过不匹配的钢卷
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (bo.getCurrentCoilNo() != null && !bo.getCurrentCoilNo().isEmpty()) {
|
||||
if (StringUtils.isNotBlank(bo.getCurrentCoilNo())) {
|
||||
if (coilVo.getCurrentCoilNo() == null ||
|
||||
!coilVo.getCurrentCoilNo().contains(bo.getCurrentCoilNo())) {
|
||||
continue; // 跳过不匹配的钢卷
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 钢卷本身的逻辑库区筛选(coilVo.warehouseId保持不变)
|
||||
if (bo.getCoilWarehouseId() != null) {
|
||||
if (coilVo.getWarehouseId() == null ||
|
||||
!coilVo.getWarehouseId().equals(bo.getCoilWarehouseId())) {
|
||||
continue; // 跳过不匹配的钢卷
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 出炉逻辑库区筛选(planCoil.logicWarehouseId是加工后去向)
|
||||
if (bo.getWarehouseId() != null) {
|
||||
if (planCoil.getLogicWarehouseId() == null ||
|
||||
!planCoil.getLogicWarehouseId().equals(bo.getWarehouseId())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 为每个planCoil创建独立的detail,携带自身的logicWarehouseId/furnaceLevel
|
||||
WmsAnnealPerformanceDetailVo coilDetail = new WmsAnnealPerformanceDetailVo();
|
||||
coilDetail.setPlanId(detail.getPlanId());
|
||||
@@ -205,13 +211,18 @@ public class WmsAnnealPerformanceServiceImpl implements IWmsAnnealPerformanceSer
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WmsMaterialCoilVo> queryPlanCoils(WmsAnnealPerformanceBo bo) {
|
||||
public List<WmsMaterialCoilVo> queryPlanCoils(WmsAnnealPlanCoilBo bo) {
|
||||
WmsAnnealPerformanceBo planBo = bo.getPlanBo();
|
||||
WmsMaterialCoilBo coilBo = bo.getCoilBo();
|
||||
if (planBo == null || coilBo == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 1. 查询退火计划
|
||||
LambdaQueryWrapper<WmsFurnacePlan> planQw = new LambdaQueryWrapper<WmsFurnacePlan>()
|
||||
.ge(bo.getStartTime() != null, WmsFurnacePlan::getActualStartTime, bo.getStartTime())
|
||||
.le(bo.getEndTime() != null, WmsFurnacePlan::getActualStartTime, bo.getEndTime())
|
||||
.eq(bo.getTargetFurnaceId() != null, WmsFurnacePlan::getTargetFurnaceId, bo.getTargetFurnaceId())
|
||||
.like(StringUtils.isNotBlank(bo.getPlanNo()), WmsFurnacePlan::getPlanNo, bo.getPlanNo())
|
||||
.ge(planBo.getStartTime() != null, WmsFurnacePlan::getActualStartTime, planBo.getStartTime())
|
||||
.le(planBo.getEndTime() != null, WmsFurnacePlan::getActualStartTime, planBo.getEndTime())
|
||||
.eq(planBo.getTargetFurnaceId() != null, WmsFurnacePlan::getTargetFurnaceId, planBo.getTargetFurnaceId())
|
||||
.like(StringUtils.isNotBlank(planBo.getPlanNo()), WmsFurnacePlan::getPlanNo, planBo.getPlanNo())
|
||||
.eq(WmsFurnacePlan::getDelFlag, 0);
|
||||
List<WmsFurnacePlan> plans = planMapper.selectList(planQw);
|
||||
|
||||
@@ -237,8 +248,7 @@ public class WmsAnnealPerformanceServiceImpl implements IWmsAnnealPerformanceSer
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 3. 按coilId直接查询加工前的钢卷
|
||||
WmsMaterialCoilBo coilBo = new WmsMaterialCoilBo();
|
||||
// 3. 按coilId查询加工前的钢卷,筛选条件由coilBo带入
|
||||
coilBo.setCoilIds(coilIds.stream().map(String::valueOf).collect(Collectors.joining(",")));
|
||||
PageQuery pageQuery = new PageQuery();
|
||||
pageQuery.setPageNum(1);
|
||||
|
||||
@@ -58,6 +58,16 @@ public class WmsCoilChangeLogServiceImpl implements IWmsCoilChangeLogService {
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WmsCoilChangeLogVo> queryByCoilId(Long coilId) {
|
||||
return baseMapper.selectVoList(Wrappers.<WmsCoilChangeLog>lambdaQuery()
|
||||
.and(wrapper -> wrapper.eq(WmsCoilChangeLog::getOldCoilId, coilId)
|
||||
.or()
|
||||
.eq(WmsCoilChangeLog::getNewCoilId, coilId))
|
||||
.orderByDesc(WmsCoilChangeLog::getCreateTime)
|
||||
.orderByDesc(WmsCoilChangeLog::getLogId));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsCoilChangeLog> buildQueryWrapper(WmsCoilChangeLogBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WmsCoilChangeLog> lqw = Wrappers.lambdaQuery();
|
||||
|
||||
@@ -17,21 +17,6 @@
|
||||
<if test="planNo != null and planNo != ''">
|
||||
AND p.plan_no LIKE CONCAT('%', #{planNo}, '%')
|
||||
</if>
|
||||
<if test="enterCoilNo != null and enterCoilNo != ''">
|
||||
AND mc.enter_coil_no LIKE CONCAT('%', #{enterCoilNo}, '%')
|
||||
</if>
|
||||
<!-- 当前钢卷号匹配 -->
|
||||
<if test="currentCoilNo != null and currentCoilNo != ''">
|
||||
AND mc.current_coil_no LIKE CONCAT('%', #{currentCoilNo}, '%')
|
||||
</if>
|
||||
<!-- 出炉时的逻辑库区筛选(wms_furnace_plan_coil.logic_warehouse_id) -->
|
||||
<if test="warehouseId != null">
|
||||
AND pc.logic_warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<!-- 钢卷本身的逻辑库区筛选(wms_material_coil.warehouse_id) -->
|
||||
<if test="coilWarehouseId != null">
|
||||
AND mc.warehouse_id = #{coilWarehouseId}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
@@ -54,10 +39,6 @@
|
||||
p.end_time AS endTime
|
||||
FROM wms_furnace_plan p
|
||||
LEFT JOIN wms_furnace f ON f.furnace_id = p.target_furnace_id
|
||||
<if test="enterCoilNo != null and enterCoilNo != '' or currentCoilNo != null and currentCoilNo != '' or warehouseId != null or coilWarehouseId != null">
|
||||
INNER JOIN wms_furnace_plan_coil pc ON pc.plan_id = p.plan_id AND pc.del_flag = 0
|
||||
INNER JOIN wms_material_coil mc ON mc.coil_id = pc.coil_id AND mc.del_flag = 0
|
||||
</if>
|
||||
<include refid="AnnealPerformanceWhere" />
|
||||
GROUP BY p.plan_id, p.plan_no, p.target_furnace_id, f.furnace_name, p.actual_start_time, p.end_time
|
||||
ORDER BY p.actual_start_time DESC, p.plan_no DESC
|
||||
|
||||
Reference in New Issue
Block a user