待检任务检测历史的前后端代码
This commit is contained in:
@@ -40,7 +40,6 @@ public class WmsCheckItemController extends BaseController {
|
||||
/**
|
||||
* 查询检查项列表
|
||||
*/
|
||||
@SaCheckPermission("qc:checkItem:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsCheckItemVo> list(WmsCheckItemBo bo, PageQuery pageQuery) {
|
||||
return iWmsCheckItemService.queryPageList(bo, pageQuery);
|
||||
@@ -49,7 +48,6 @@ public class WmsCheckItemController extends BaseController {
|
||||
/**
|
||||
* 导出检查项列表
|
||||
*/
|
||||
@SaCheckPermission("qc:checkItem:export")
|
||||
@Log(title = "检查项", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsCheckItemBo bo, HttpServletResponse response) {
|
||||
@@ -62,7 +60,6 @@ public class WmsCheckItemController extends BaseController {
|
||||
*
|
||||
* @param itemId 主键
|
||||
*/
|
||||
@SaCheckPermission("qc:checkItem:query")
|
||||
@GetMapping("/{itemId}")
|
||||
public R<WmsCheckItemVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long itemId) {
|
||||
@@ -72,7 +69,6 @@ public class WmsCheckItemController extends BaseController {
|
||||
/**
|
||||
* 新增检查项
|
||||
*/
|
||||
@SaCheckPermission("qc:checkItem:add")
|
||||
@Log(title = "检查项", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
@@ -83,7 +79,6 @@ public class WmsCheckItemController extends BaseController {
|
||||
/**
|
||||
* 修改检查项
|
||||
*/
|
||||
@SaCheckPermission("qc:checkItem:edit")
|
||||
@Log(title = "检查项", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
@@ -96,7 +91,6 @@ public class WmsCheckItemController extends BaseController {
|
||||
*
|
||||
* @param itemIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("qc:checkItem:remove")
|
||||
@Log(title = "检查项", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{itemIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
|
||||
@@ -40,16 +40,21 @@ public class WmsCheckTaskController extends BaseController {
|
||||
/**
|
||||
* 查询检查任务列表
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTask:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsCheckTaskVo> list(WmsCheckTaskBo bo, PageQuery pageQuery) {
|
||||
return iWmsCheckTaskService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
/**
|
||||
* 查询检查任务列表
|
||||
*/
|
||||
@GetMapping("/listHistory")
|
||||
public TableDataInfo<WmsCheckTaskVo> listHistory(WmsCheckTaskBo bo, PageQuery pageQuery) {
|
||||
return iWmsCheckTaskService.queryPageListHistory(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出检查任务列表
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTask:export")
|
||||
@Log(title = "检查任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsCheckTaskBo bo, HttpServletResponse response) {
|
||||
@@ -62,7 +67,6 @@ public class WmsCheckTaskController extends BaseController {
|
||||
*
|
||||
* @param taskId 主键
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTask:query")
|
||||
@GetMapping("/{taskId}")
|
||||
public R<WmsCheckTaskVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long taskId) {
|
||||
@@ -72,7 +76,6 @@ public class WmsCheckTaskController extends BaseController {
|
||||
/**
|
||||
* 新增检查任务
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTask:add")
|
||||
@Log(title = "检查任务", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
@@ -83,7 +86,6 @@ public class WmsCheckTaskController extends BaseController {
|
||||
/**
|
||||
* 修改检查任务
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTask:edit")
|
||||
@Log(title = "检查任务", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
@@ -96,7 +98,6 @@ public class WmsCheckTaskController extends BaseController {
|
||||
*
|
||||
* @param taskIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTask:remove")
|
||||
@Log(title = "检查任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{taskIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.klp.mes.qc.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -40,7 +41,6 @@ public class WmsCheckTaskItemController extends BaseController {
|
||||
/**
|
||||
* 查询检查任务与检查项关联列表
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTaskItem:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsCheckTaskItemVo> list(WmsCheckTaskItemBo bo, PageQuery pageQuery) {
|
||||
return iWmsCheckTaskItemService.queryPageList(bo, pageQuery);
|
||||
@@ -49,7 +49,6 @@ public class WmsCheckTaskItemController extends BaseController {
|
||||
/**
|
||||
* 导出检查任务与检查项关联列表
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTaskItem:export")
|
||||
@Log(title = "检查任务与检查项关联", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsCheckTaskItemBo bo, HttpServletResponse response) {
|
||||
@@ -62,7 +61,6 @@ public class WmsCheckTaskItemController extends BaseController {
|
||||
*
|
||||
* @param itemId 主键
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTaskItem:query")
|
||||
@GetMapping("/{itemId}")
|
||||
public R<WmsCheckTaskItemVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long itemId) {
|
||||
@@ -72,7 +70,6 @@ public class WmsCheckTaskItemController extends BaseController {
|
||||
/**
|
||||
* 新增检查任务与检查项关联
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTaskItem:add")
|
||||
@Log(title = "检查任务与检查项关联", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
@@ -83,7 +80,6 @@ public class WmsCheckTaskItemController extends BaseController {
|
||||
/**
|
||||
* 修改检查任务与检查项关联
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTaskItem:edit")
|
||||
@Log(title = "检查任务与检查项关联", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
@@ -96,11 +92,26 @@ public class WmsCheckTaskItemController extends BaseController {
|
||||
*
|
||||
* @param itemIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("qc:checkTaskItem:remove")
|
||||
@Log(title = "检查任务与检查项关联", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{itemIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] itemIds) {
|
||||
return toAjax(iWmsCheckTaskItemService.deleteWithValidByIds(Arrays.asList(itemIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 单独修改检查项状态(根据checkTaskId和checkItemId)
|
||||
*/
|
||||
@PutMapping("/updateStatus")
|
||||
public R<Void> updateStatus(@RequestBody Map<String, Object> params) {
|
||||
Long checkTaskId = params.get("checkTaskId") instanceof Number ? ((Number)params.get("checkTaskId")).longValue() : Long.valueOf(params.get("checkTaskId").toString());
|
||||
Long checkItemId = params.get("checkItemId") instanceof Number ? ((Number)params.get("checkItemId")).longValue() : Long.valueOf(params.get("checkItemId").toString());
|
||||
Integer status = params.get("status") instanceof Number ? ((Number)params.get("status")).intValue() : Integer.valueOf(params.get("status").toString());
|
||||
WmsCheckTaskItemBo bo = new WmsCheckTaskItemBo();
|
||||
bo.setCheckTaskId(checkTaskId);
|
||||
bo.setCheckItemId(checkItemId);
|
||||
bo.setStatus(status);
|
||||
boolean result = iWmsCheckTaskItemService.updateStatusByTaskAndItem(bo);
|
||||
return toAjax(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ public class WmsCommonDefectController extends BaseController {
|
||||
/**
|
||||
* 查询常见缺陷列表
|
||||
*/
|
||||
@SaCheckPermission("qc:commonDefect:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WmsCommonDefectVo> list(WmsCommonDefectBo bo, PageQuery pageQuery) {
|
||||
return iWmsCommonDefectService.queryPageList(bo, pageQuery);
|
||||
@@ -49,7 +48,6 @@ public class WmsCommonDefectController extends BaseController {
|
||||
/**
|
||||
* 导出常见缺陷列表
|
||||
*/
|
||||
@SaCheckPermission("qc:commonDefect:export")
|
||||
@Log(title = "常见缺陷", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(WmsCommonDefectBo bo, HttpServletResponse response) {
|
||||
@@ -62,7 +60,6 @@ public class WmsCommonDefectController extends BaseController {
|
||||
*
|
||||
* @param defectId 主键
|
||||
*/
|
||||
@SaCheckPermission("qc:commonDefect:query")
|
||||
@GetMapping("/{defectId}")
|
||||
public R<WmsCommonDefectVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long defectId) {
|
||||
@@ -72,7 +69,6 @@ public class WmsCommonDefectController extends BaseController {
|
||||
/**
|
||||
* 新增常见缺陷
|
||||
*/
|
||||
@SaCheckPermission("qc:commonDefect:add")
|
||||
@Log(title = "常见缺陷", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
@@ -83,7 +79,6 @@ public class WmsCommonDefectController extends BaseController {
|
||||
/**
|
||||
* 修改常见缺陷
|
||||
*/
|
||||
@SaCheckPermission("qc:commonDefect:edit")
|
||||
@Log(title = "常见缺陷", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
@@ -96,7 +91,6 @@ public class WmsCommonDefectController extends BaseController {
|
||||
*
|
||||
* @param defectIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("qc:commonDefect:remove")
|
||||
@Log(title = "常见缺陷", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{defectIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
|
||||
@@ -33,7 +33,7 @@ public class WmsCheckTaskItem extends BaseEntity {
|
||||
*/
|
||||
private Long checkItemId;
|
||||
/**
|
||||
* 状态:0=禁用,1=启用
|
||||
* 状态:0=未检测,1=通过,2=不通过
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,7 @@ public class WmsCheckTaskItemBo extends BaseEntity {
|
||||
private Long checkItemId;
|
||||
|
||||
/**
|
||||
* 状态:0=禁用,1=启用
|
||||
* 状态:0=未检测,1=通过,2=不通过
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -37,5 +37,9 @@ public class WmsCheckItemVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 检查项状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ public class WmsCheckTaskItemVo {
|
||||
private Long checkItemId;
|
||||
|
||||
/**
|
||||
* 状态:0=禁用,1=启用
|
||||
* 状态:0=未检测,1=通过,2=不通过
|
||||
*/
|
||||
@ExcelProperty(value = "状态:0=禁用,1=启用")
|
||||
@ExcelProperty(value = "状态:0=未检测,1=通过,2=不通过")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,10 +38,18 @@ public class WmsCheckTaskVo {
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
private String itemIds;
|
||||
/**
|
||||
* 检查项列表
|
||||
*/
|
||||
private List<WmsCheckItemVo> itemList;
|
||||
/**
|
||||
* 检查项状态(逗号分隔)
|
||||
*/
|
||||
private String itemStatus;
|
||||
/**
|
||||
* 检查项名称(逗号分隔)
|
||||
*/
|
||||
private String itemNames;
|
||||
|
||||
}
|
||||
|
||||
@@ -17,4 +17,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface WmsCheckTaskMapper extends BaseMapperPlus<WmsCheckTaskMapper, WmsCheckTask, WmsCheckTaskVo> {
|
||||
|
||||
Page<WmsCheckTaskVo> selectVoPagePlus(Page<Object> build,@Param("ew") LambdaQueryWrapper<WmsCheckTask> lqw);
|
||||
|
||||
WmsCheckTaskVo selectVoByIdPlus(Long taskId);
|
||||
}
|
||||
|
||||
@@ -46,4 +46,9 @@ public interface IWmsCheckTaskItemService {
|
||||
* 校验并批量删除检查任务与检查项关联信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 根据checkTaskId和checkItemId修改status
|
||||
*/
|
||||
Boolean updateStatusByTaskAndItem(WmsCheckTaskItemBo bo);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,10 @@ public interface IWmsCheckTaskService {
|
||||
* 查询检查任务列表
|
||||
*/
|
||||
TableDataInfo<WmsCheckTaskVo> queryPageList(WmsCheckTaskBo bo, PageQuery pageQuery);
|
||||
/**
|
||||
* 查询检查任务列表
|
||||
*/
|
||||
TableDataInfo<WmsCheckTaskVo> queryPageListHistory(WmsCheckTaskBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询检查任务列表
|
||||
|
||||
@@ -107,4 +107,17 @@ public class WmsCheckTaskItemServiceImpl implements IWmsCheckTaskItemService {
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据checkTaskId和checkItemId修改status
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateStatusByTaskAndItem(WmsCheckTaskItemBo bo) {
|
||||
LambdaQueryWrapper<WmsCheckTaskItem> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(WmsCheckTaskItem::getCheckTaskId, bo.getCheckTaskId());
|
||||
lqw.eq(WmsCheckTaskItem::getCheckItemId, bo.getCheckItemId());
|
||||
WmsCheckTaskItem update = new WmsCheckTaskItem();
|
||||
update.setStatus(bo.getStatus());
|
||||
return baseMapper.update(update, lqw) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.common.utils.StringUtils;
|
||||
import com.klp.mes.qc.domain.WmsCheckTaskItem;
|
||||
import com.klp.mes.qc.domain.vo.WmsCheckItemVo;
|
||||
import com.klp.mes.qc.mapper.WmsCheckItemMapper;
|
||||
import com.klp.mes.qc.mapper.WmsCheckTaskItemMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -18,6 +20,7 @@ import com.klp.mes.qc.mapper.WmsCheckTaskMapper;
|
||||
import com.klp.mes.qc.service.IWmsCheckTaskService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
@@ -39,8 +42,25 @@ public class WmsCheckTaskServiceImpl implements IWmsCheckTaskService {
|
||||
* 查询检查任务
|
||||
*/
|
||||
@Override
|
||||
public WmsCheckTaskVo queryById(Long taskId){
|
||||
return baseMapper.selectVoById(taskId);
|
||||
public WmsCheckTaskVo queryById(Long taskId) {
|
||||
WmsCheckTaskVo vo = baseMapper.selectVoByIdPlus(taskId);
|
||||
if (vo != null && vo.getItemIds() != null) {
|
||||
String[] ids = vo.getItemIds().split(",");
|
||||
String[] names = vo.getItemNames() != null ? vo.getItemNames().split(",") : new String[ids.length];
|
||||
String[] statusArr = vo.getItemStatus() != null ? vo.getItemStatus().split(",") : new String[ids.length];
|
||||
List<WmsCheckItemVo> itemList = new ArrayList<>();
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (!ids[i].isEmpty()) {
|
||||
WmsCheckItemVo item = new WmsCheckItemVo();
|
||||
item.setItemId(Long.valueOf(ids[i]));
|
||||
if (names.length > i) item.setItemName(names[i]);
|
||||
if (statusArr.length > i) item.setStatus(statusArr[i]);
|
||||
itemList.add(item);
|
||||
}
|
||||
}
|
||||
vo.setItemList(itemList);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,6 +72,15 @@ public class WmsCheckTaskServiceImpl implements IWmsCheckTaskService {
|
||||
Page<WmsCheckTaskVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
/**
|
||||
* 查询检查任务列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<WmsCheckTaskVo> queryPageListHistory(WmsCheckTaskBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsCheckTask> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsCheckTaskVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询检查任务列表
|
||||
|
||||
@@ -19,9 +19,21 @@
|
||||
FROM wms_check_task t
|
||||
LEFT JOIN wms_check_task_item ti ON t.task_id = ti.check_task_id AND ti.del_flag = 0
|
||||
LEFT JOIN wms_check_item i ON ti.check_item_id = i.item_id AND i.del_flag = 0
|
||||
WHERE t.del_flag = 0
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM wms_check_task_item ti2 WHERE ti2.check_task_id = t.task_id AND ti2.status = 0 AND ti2.del_flag = 0
|
||||
)
|
||||
${ew.customSqlSegment}
|
||||
GROUP BY t.task_id
|
||||
</select>
|
||||
<select id="selectVoByIdPlus" resultType="com.klp.mes.qc.domain.vo.WmsCheckTaskVo">
|
||||
SELECT t.*, GROUP_CONCAT(i.item_name) AS itemNames, GROUP_CONCAT(i.item_id) AS itemIds, GROUP_CONCAT(ti.status) AS itemStatus
|
||||
FROM wms_check_task t
|
||||
LEFT JOIN wms_check_task_item ti ON t.task_id = ti.check_task_id AND ti.del_flag = 0
|
||||
LEFT JOIN wms_check_item i ON ti.check_item_id = i.item_id AND i.del_flag = 0
|
||||
WHERE t.task_id = #{taskId}
|
||||
GROUP BY t.task_id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -41,4 +41,15 @@ export function delCheckTask(taskId) {
|
||||
url: '/qc/checkTask/' + taskId,
|
||||
method: 'delete'
|
||||
})
|
||||
|
||||
//查看历史任务
|
||||
}
|
||||
|
||||
// 查询历史检查任务列表
|
||||
export function listHistoryCheckTask(query) {
|
||||
return request({
|
||||
url: '/qc/checkTask/listHistory',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
@@ -42,3 +42,11 @@ export function delCheckTaskItem(itemId) {
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
export function updateCheckTaskItemStatus(data) {
|
||||
return request({
|
||||
url: '/qc/checkTaskItem/updateStatus',
|
||||
method: 'put',
|
||||
data // 需要包含checkTaskId、checkItemId、status
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input
|
||||
v-model="queryParams.taskName"
|
||||
@@ -39,196 +39,116 @@
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
@click="handleDetail(scope.row)"
|
||||
>详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改检查任务对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input v-model="form.taskName" placeholder="请输入任务名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</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>
|
||||
</div>
|
||||
<!-- 检查任务详情弹窗(可复用task页面的实现) -->
|
||||
<!-- ...如需详情弹窗可参考task/index.vue... -->
|
||||
<el-dialog :title="'检查任务详情'" :visible.sync="detailOpen" width="600px" append-to-body>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="任务名称">{{ detailData.taskName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ detailData.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="检查项">
|
||||
<div v-for="item in detailData.itemList" :key="item.itemId" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-tag type="info" style="margin-right: 12px;">{{ item.itemName }}</el-tag>
|
||||
<el-tag
|
||||
:type="item.status == 1 ? 'success' : (item.status == 2 ? 'danger' : 'info')"
|
||||
style="margin-right: 16px; min-width: 60px; text-align: center;"
|
||||
>
|
||||
<span v-if="item.status == 0">未检测</span>
|
||||
<span v-else-if="item.status == 1">通过</span>
|
||||
<span v-else-if="item.status == 2">不通过</span>
|
||||
<span v-else>未知</span>
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleDetailClose">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCheckTask, getCheckTask, delCheckTask, addCheckTask, updateCheckTask } from "@/api/mes/qc/checkTask";
|
||||
import { listHistoryCheckTask, getCheckTask } from '@/api/mes/qc/checkTask'
|
||||
|
||||
export default {
|
||||
name: "CheckTask",
|
||||
name: 'CheckTaskHistory',
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 检查任务表格数据
|
||||
checkTaskList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
taskName: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
detailOpen: false,
|
||||
detailData: {},
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
/** 查询检查任务列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCheckTask(this.queryParams).then(response => {
|
||||
this.checkTaskList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
this.loading = true
|
||||
listHistoryCheckTask(this.queryParams).then(response => {
|
||||
this.checkTaskList = response.rows
|
||||
this.total = response.total
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
taskId: undefined,
|
||||
taskName: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined,
|
||||
delFlag: undefined,
|
||||
remark: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
this.queryParams.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
this.resetForm('queryForm')
|
||||
this.handleQuery()
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.taskId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加检查任务";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const taskId = row.taskId || this.ids
|
||||
getCheckTask(taskId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改检查任务";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.taskId != null) {
|
||||
updateCheckTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addCheckTask(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const taskIds = row.taskId || this.ids;
|
||||
this.$modal.confirm('是否确认删除检查任务编号为"' + taskIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delCheckTask(taskIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('qc/checkTask/export', {
|
||||
...this.queryParams
|
||||
}, `checkTask_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
handleDetail(row) {
|
||||
this.loading = true
|
||||
getCheckTask(row.taskId).then(response => {
|
||||
this.detailData = response.data
|
||||
this.detailOpen = true
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
handleDetailClose() {
|
||||
this.detailOpen = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -106,16 +106,48 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 检查任务详情弹窗 -->
|
||||
<el-dialog :title="'检查任务详情'" :visible.sync="detailOpen" width="600px" append-to-body>
|
||||
<el-descriptions :column="1" border>
|
||||
<el-descriptions-item label="任务名称">{{ detailData.taskName }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">{{ detailData.remark }}</el-descriptions-item>
|
||||
<el-descriptions-item label="检查项">
|
||||
<div v-for="item in detailData.itemList" :key="item.itemId" style="margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between;">
|
||||
<div style="display: flex; align-items: center;">
|
||||
<el-tag type="info" style="margin-right: 12px;">{{ item.itemName }}</el-tag>
|
||||
<el-tag
|
||||
:type="item.status == 1 ? 'success' : (item.status == 2 ? 'danger' : 'info')"
|
||||
style="margin-right: 16px; min-width: 60px; text-align: center;"
|
||||
>
|
||||
<span v-if="item.status == 0">未检测</span>
|
||||
<span v-else-if="item.status == 1">通过</span>
|
||||
<span v-else-if="item.status == 2">不通过</span>
|
||||
<span v-else>未知</span>
|
||||
</el-tag>
|
||||
</div>
|
||||
<div>
|
||||
<el-button v-if="item.status == 0" size="mini" type="success" style="margin-right: 8px;" @click="changeItemStatus(detailData.taskId, item.itemId, 1)">通过</el-button>
|
||||
<el-button v-if="item.status == 0" size="mini" type="danger" @click="changeItemStatus(detailData.taskId, item.itemId, 2)">不通过</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="handleDetailClose">关 闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { listCheckTask, getCheckTask, delCheckTask, addCheckTask, updateCheckTask } from "@/api/mes/qc/checkTask";
|
||||
import { listCheckTask, getCheckTask, delCheckTask, addCheckTask, updateCheckTask } from '@/api/mes/qc/checkTask'
|
||||
import { updateCheckTaskItemStatus } from '@/api/mes/qc/checkTaskItem'
|
||||
import CheckItemSelect from '@/components/KLPService/CheckItemSelect/index'
|
||||
|
||||
export default {
|
||||
name: "CheckTask",
|
||||
name: 'CheckTask',
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
@@ -148,7 +180,9 @@ export default {
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
},
|
||||
detailOpen: false,
|
||||
detailData: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -221,6 +255,16 @@ export default {
|
||||
this.title = "修改检查任务";
|
||||
});
|
||||
},
|
||||
/** 详情按钮操作 */
|
||||
handleDetail(row) {
|
||||
this.loading = true
|
||||
getCheckTask(row.taskId).then(response => {
|
||||
this.detailData = response.data
|
||||
this.detailOpen = true
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
@@ -266,6 +310,23 @@ export default {
|
||||
this.download('qc/checkTask/export', {
|
||||
...this.queryParams
|
||||
}, `checkTask_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/** 修改检查项状态 */
|
||||
changeItemStatus(checkTaskId, checkItemId, status) {
|
||||
this.$modal.confirm('确定要将该检查项状态修改为' + (status === 1 ? '通过' : '不通过') + '吗?').then(() => {
|
||||
// 调用新接口
|
||||
return updateCheckTaskItemStatus({ checkTaskId, checkItemId, status })
|
||||
}).then(() => {
|
||||
this.$modal.msgSuccess('状态修改成功')
|
||||
// 重新拉取详情
|
||||
getCheckTask(this.detailData.taskId).then(response => {
|
||||
this.detailData = response.data
|
||||
})
|
||||
})
|
||||
},
|
||||
handleDetailClose() {
|
||||
this.detailOpen = false
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user