新增缺陷检测图像

This commit is contained in:
zhoumingxiu 2024-01-11 17:02:33 +08:00
parent 88e895c60d
commit 1114137e5f
8 changed files with 971 additions and 0 deletions

View File

@ -0,0 +1,98 @@
package com.god.web.controller.machineVision;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.god.common.annotation.Log;
import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult;
import com.god.common.enums.BusinessType;
import com.god.machineVision.domain.MachineVisionDefectDetection;
import com.god.machineVision.service.IMachineVisionDefectDetectionService;
import com.god.common.utils.poi.ExcelUtil;
import com.god.common.core.page.TableDataInfo;
/**
* 机器视觉缺陷检测Controller
*
* @author god
* @date 2024-01-11
*/
@RestController
@RequestMapping("/machineVision/detection")
public class MachineVisionDefectDetectionController extends BaseController
{
@Autowired
private IMachineVisionDefectDetectionService machineVisionDefectDetectionService;
/**
* 查询机器视觉缺陷检测列表
*/
@GetMapping("/list")
public TableDataInfo list(MachineVisionDefectDetection machineVisionDefectDetection)
{
startPage();
List<MachineVisionDefectDetection> list = machineVisionDefectDetectionService.selectMachineVisionDefectDetectionList(machineVisionDefectDetection);
return getDataTable(list);
}
/**
* 导出机器视觉缺陷检测列表
*/
@Log(title = "机器视觉缺陷检测", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MachineVisionDefectDetection machineVisionDefectDetection)
{
List<MachineVisionDefectDetection> list = machineVisionDefectDetectionService.selectMachineVisionDefectDetectionList(machineVisionDefectDetection);
ExcelUtil<MachineVisionDefectDetection> util = new ExcelUtil<MachineVisionDefectDetection>(MachineVisionDefectDetection.class);
util.exportExcel(response, list, "机器视觉缺陷检测数据");
}
/**
* 获取机器视觉缺陷检测详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(machineVisionDefectDetectionService.selectMachineVisionDefectDetectionById(id));
}
/**
* 新增机器视觉缺陷检测
*/
@Log(title = "机器视觉缺陷检测", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MachineVisionDefectDetection machineVisionDefectDetection)
{
return toAjax(machineVisionDefectDetectionService.insertMachineVisionDefectDetection(machineVisionDefectDetection));
}
/**
* 修改机器视觉缺陷检测
*/
@Log(title = "机器视觉缺陷检测", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MachineVisionDefectDetection machineVisionDefectDetection)
{
return toAjax(machineVisionDefectDetectionService.updateMachineVisionDefectDetection(machineVisionDefectDetection));
}
/**
* 删除机器视觉缺陷检测
*/
@Log(title = "机器视觉缺陷检测", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(machineVisionDefectDetectionService.deleteMachineVisionDefectDetectionByIds(ids));
}
}

View File

@ -0,0 +1,205 @@
package com.god.machineVision.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.god.common.annotation.Excel;
import com.god.common.core.domain.BaseEntity;
/**
* 机器视觉缺陷检测对象 machine_vision_defect_detection
*
* @author god
* @date 2024-01-11
*/
public class MachineVisionDefectDetection extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 图像 */
@Excel(name = "图像")
private String imageId;
/** 位置 */
@Excel(name = "位置")
private String position;
/** 灰度值 */
@Excel(name = "灰度值")
private String grayScale;
/** 缩放 */
@Excel(name = "缩放")
private String zoom;
/** ROI */
@Excel(name = "ROI")
private String roi;
/** 字段1 */
@Excel(name = "字段1")
private String colOne;
/** 字段2 */
@Excel(name = "字段2")
private String colTwo;
/** 字段3 */
@Excel(name = "字段3")
private String colThree;
/** 字段4 */
@Excel(name = "字段4")
private String colFour;
/** 字段5 */
@Excel(name = "字段5")
private String colFive;
/** 字段6 */
@Excel(name = "字段6")
private String colSix;
/** 接口 */
@Excel(name = "接口")
private String interfaceType;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setImageId(String imageId)
{
this.imageId = imageId;
}
public String getImageId()
{
return imageId;
}
public void setPosition(String position)
{
this.position = position;
}
public String getPosition()
{
return position;
}
public void setGrayScale(String grayScale)
{
this.grayScale = grayScale;
}
public String getGrayScale()
{
return grayScale;
}
public void setZoom(String zoom)
{
this.zoom = zoom;
}
public String getZoom()
{
return zoom;
}
public void setRoi(String roi)
{
this.roi = roi;
}
public String getRoi()
{
return roi;
}
public void setColOne(String colOne)
{
this.colOne = colOne;
}
public String getColOne()
{
return colOne;
}
public void setColTwo(String colTwo)
{
this.colTwo = colTwo;
}
public String getColTwo()
{
return colTwo;
}
public void setColThree(String colThree)
{
this.colThree = colThree;
}
public String getColThree()
{
return colThree;
}
public void setColFour(String colFour)
{
this.colFour = colFour;
}
public String getColFour()
{
return colFour;
}
public void setColFive(String colFive)
{
this.colFive = colFive;
}
public String getColFive()
{
return colFive;
}
public void setColSix(String colSix)
{
this.colSix = colSix;
}
public String getColSix()
{
return colSix;
}
public void setInterfaceType(String interfaceType)
{
this.interfaceType = interfaceType;
}
public String getInterfaceType()
{
return interfaceType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("imageId", getImageId())
.append("position", getPosition())
.append("grayScale", getGrayScale())
.append("zoom", getZoom())
.append("roi", getRoi())
.append("colOne", getColOne())
.append("colTwo", getColTwo())
.append("colThree", getColThree())
.append("colFour", getColFour())
.append("colFive", getColFive())
.append("colSix", getColSix())
.append("interfaceType", getInterfaceType())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.god.machineVision.mapper;
import java.util.List;
import com.god.machineVision.domain.MachineVisionDefectDetection;
/**
* 机器视觉缺陷检测Mapper接口
*
* @author god
* @date 2024-01-11
*/
public interface MachineVisionDefectDetectionMapper
{
/**
* 查询机器视觉缺陷检测
*
* @param id 机器视觉缺陷检测主键
* @return 机器视觉缺陷检测
*/
public MachineVisionDefectDetection selectMachineVisionDefectDetectionById(String id);
/**
* 查询机器视觉缺陷检测列表
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 机器视觉缺陷检测集合
*/
public List<MachineVisionDefectDetection> selectMachineVisionDefectDetectionList(MachineVisionDefectDetection machineVisionDefectDetection);
/**
* 新增机器视觉缺陷检测
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 结果
*/
public int insertMachineVisionDefectDetection(MachineVisionDefectDetection machineVisionDefectDetection);
/**
* 修改机器视觉缺陷检测
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 结果
*/
public int updateMachineVisionDefectDetection(MachineVisionDefectDetection machineVisionDefectDetection);
/**
* 删除机器视觉缺陷检测
*
* @param id 机器视觉缺陷检测主键
* @return 结果
*/
public int deleteMachineVisionDefectDetectionById(String id);
/**
* 批量删除机器视觉缺陷检测
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteMachineVisionDefectDetectionByIds(String[] ids);
}

View File

@ -0,0 +1,61 @@
package com.god.machineVision.service;
import java.util.List;
import com.god.machineVision.domain.MachineVisionDefectDetection;
/**
* 机器视觉缺陷检测Service接口
*
* @author god
* @date 2024-01-11
*/
public interface IMachineVisionDefectDetectionService
{
/**
* 查询机器视觉缺陷检测
*
* @param id 机器视觉缺陷检测主键
* @return 机器视觉缺陷检测
*/
public MachineVisionDefectDetection selectMachineVisionDefectDetectionById(String id);
/**
* 查询机器视觉缺陷检测列表
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 机器视觉缺陷检测集合
*/
public List<MachineVisionDefectDetection> selectMachineVisionDefectDetectionList(MachineVisionDefectDetection machineVisionDefectDetection);
/**
* 新增机器视觉缺陷检测
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 结果
*/
public int insertMachineVisionDefectDetection(MachineVisionDefectDetection machineVisionDefectDetection);
/**
* 修改机器视觉缺陷检测
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 结果
*/
public int updateMachineVisionDefectDetection(MachineVisionDefectDetection machineVisionDefectDetection);
/**
* 批量删除机器视觉缺陷检测
*
* @param ids 需要删除的机器视觉缺陷检测主键集合
* @return 结果
*/
public int deleteMachineVisionDefectDetectionByIds(String[] ids);
/**
* 删除机器视觉缺陷检测信息
*
* @param id 机器视觉缺陷检测主键
* @return 结果
*/
public int deleteMachineVisionDefectDetectionById(String id);
}

View File

@ -0,0 +1,96 @@
package com.god.machineVision.service.impl;
import java.util.List;
import com.god.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.god.machineVision.mapper.MachineVisionDefectDetectionMapper;
import com.god.machineVision.domain.MachineVisionDefectDetection;
import com.god.machineVision.service.IMachineVisionDefectDetectionService;
/**
* 机器视觉缺陷检测Service业务层处理
*
* @author god
* @date 2024-01-11
*/
@Service
public class MachineVisionDefectDetectionServiceImpl implements IMachineVisionDefectDetectionService
{
@Autowired
private MachineVisionDefectDetectionMapper machineVisionDefectDetectionMapper;
/**
* 查询机器视觉缺陷检测
*
* @param id 机器视觉缺陷检测主键
* @return 机器视觉缺陷检测
*/
@Override
public MachineVisionDefectDetection selectMachineVisionDefectDetectionById(String id)
{
return machineVisionDefectDetectionMapper.selectMachineVisionDefectDetectionById(id);
}
/**
* 查询机器视觉缺陷检测列表
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 机器视觉缺陷检测
*/
@Override
public List<MachineVisionDefectDetection> selectMachineVisionDefectDetectionList(MachineVisionDefectDetection machineVisionDefectDetection)
{
return machineVisionDefectDetectionMapper.selectMachineVisionDefectDetectionList(machineVisionDefectDetection);
}
/**
* 新增机器视觉缺陷检测
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 结果
*/
@Override
public int insertMachineVisionDefectDetection(MachineVisionDefectDetection machineVisionDefectDetection)
{
machineVisionDefectDetection.setId(IdUtils.fastSimpleUUID());
return machineVisionDefectDetectionMapper.insertMachineVisionDefectDetection(machineVisionDefectDetection);
}
/**
* 修改机器视觉缺陷检测
*
* @param machineVisionDefectDetection 机器视觉缺陷检测
* @return 结果
*/
@Override
public int updateMachineVisionDefectDetection(MachineVisionDefectDetection machineVisionDefectDetection)
{
return machineVisionDefectDetectionMapper.updateMachineVisionDefectDetection(machineVisionDefectDetection);
}
/**
* 批量删除机器视觉缺陷检测
*
* @param ids 需要删除的机器视觉缺陷检测主键
* @return 结果
*/
@Override
public int deleteMachineVisionDefectDetectionByIds(String[] ids)
{
return machineVisionDefectDetectionMapper.deleteMachineVisionDefectDetectionByIds(ids);
}
/**
* 删除机器视觉缺陷检测信息
*
* @param id 机器视觉缺陷检测主键
* @return 结果
*/
@Override
public int deleteMachineVisionDefectDetectionById(String id)
{
return machineVisionDefectDetectionMapper.deleteMachineVisionDefectDetectionById(id);
}
}

View File

@ -0,0 +1,115 @@
<?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.god.machineVision.mapper.MachineVisionDefectDetectionMapper">
<resultMap type="MachineVisionDefectDetection" id="MachineVisionDefectDetectionResult">
<result property="id" column="id"/>
<result property="imageId" column="image_id"/>
<result property="position" column="position"/>
<result property="grayScale" column="gray_scale"/>
<result property="zoom" column="zoom"/>
<result property="roi" column="roi"/>
<result property="colOne" column="col_one"/>
<result property="colTwo" column="col_two"/>
<result property="colThree" column="col_three"/>
<result property="colFour" column="col_four"/>
<result property="colFive" column="col_five"/>
<result property="colSix" column="col_six"/>
<result property="interfaceType" column="interface_type"/>
</resultMap>
<sql id="selectMachineVisionDefectDetectionVo">
select id, image_id, position, gray_scale, zoom, roi, col_one, col_two, col_three, col_four, col_five, col_six, interface_type from machine_vision_defect_detection
</sql>
<select id="selectMachineVisionDefectDetectionList" parameterType="MachineVisionDefectDetection"
resultMap="MachineVisionDefectDetectionResult">
<include refid="selectMachineVisionDefectDetectionVo"/>
<where>
<if test="imageId != null and imageId != ''">and image_id = #{imageId}</if>
<if test="position != null and position != ''">and position = #{position}</if>
<if test="grayScale != null and grayScale != ''">and gray_scale = #{grayScale}</if>
<if test="zoom != null and zoom != ''">and zoom = #{zoom}</if>
<if test="roi != null and roi != ''">and roi = #{roi}</if>
<if test="colOne != null and colOne != ''">and col_one = #{colOne}</if>
<if test="colTwo != null and colTwo != ''">and col_two = #{colTwo}</if>
<if test="colThree != null and colThree != ''">and col_three = #{colThree}</if>
<if test="colFour != null and colFour != ''">and col_four = #{colFour}</if>
<if test="colFive != null and colFive != ''">and col_five = #{colFive}</if>
<if test="colSix != null and colSix != ''">and col_six = #{colSix}</if>
<if test="interfaceType != null and interfaceType != ''">and interface_type = #{interfaceType}</if>
</where>
</select>
<select id="selectMachineVisionDefectDetectionById" parameterType="String"
resultMap="MachineVisionDefectDetectionResult">
<include refid="selectMachineVisionDefectDetectionVo"/>
where id = #{id}
</select>
<insert id="insertMachineVisionDefectDetection" parameterType="MachineVisionDefectDetection">
insert into machine_vision_defect_detection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="imageId != null">image_id,</if>
<if test="position != null">position,</if>
<if test="grayScale != null">gray_scale,</if>
<if test="zoom != null">zoom,</if>
<if test="roi != null">roi,</if>
<if test="colOne != null">col_one,</if>
<if test="colTwo != null">col_two,</if>
<if test="colThree != null">col_three,</if>
<if test="colFour != null">col_four,</if>
<if test="colFive != null">col_five,</if>
<if test="colSix != null">col_six,</if>
<if test="interfaceType != null">interface_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="imageId != null">#{imageId},</if>
<if test="position != null">#{position},</if>
<if test="grayScale != null">#{grayScale},</if>
<if test="zoom != null">#{zoom},</if>
<if test="roi != null">#{roi},</if>
<if test="colOne != null">#{colOne},</if>
<if test="colTwo != null">#{colTwo},</if>
<if test="colThree != null">#{colThree},</if>
<if test="colFour != null">#{colFour},</if>
<if test="colFive != null">#{colFive},</if>
<if test="colSix != null">#{colSix},</if>
<if test="interfaceType != null">#{interfaceType},</if>
</trim>
</insert>
<update id="updateMachineVisionDefectDetection" parameterType="MachineVisionDefectDetection">
update machine_vision_defect_detection
<trim prefix="SET" suffixOverrides=",">
<if test="imageId != null">image_id = #{imageId},</if>
<if test="position != null">position = #{position},</if>
<if test="grayScale != null">gray_scale = #{grayScale},</if>
<if test="zoom != null">zoom = #{zoom},</if>
<if test="roi != null">roi = #{roi},</if>
<if test="colOne != null">col_one = #{colOne},</if>
<if test="colTwo != null">col_two = #{colTwo},</if>
<if test="colThree != null">col_three = #{colThree},</if>
<if test="colFour != null">col_four = #{colFour},</if>
<if test="colFive != null">col_five = #{colFive},</if>
<if test="colSix != null">col_six = #{colSix},</if>
<if test="interfaceType != null">interface_type = #{interfaceType},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteMachineVisionDefectDetectionById" parameterType="String">
delete from machine_vision_defect_detection where id = #{id}
</delete>
<delete id="deleteMachineVisionDefectDetectionByIds" parameterType="String">
delete from machine_vision_defect_detection where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询机器视觉缺陷检测列表
export function listDetection(query) {
return request({
url: '/machineVision/detection/list',
method: 'get',
params: query
})
}
// 查询机器视觉缺陷检测详细
export function getDetection(id) {
return request({
url: '/machineVision/detection/' + id,
method: 'get'
})
}
// 新增机器视觉缺陷检测
export function addDetection(data) {
return request({
url: '/machineVision/detection',
method: 'post',
data: data
})
}
// 修改机器视觉缺陷检测
export function updateDetection(data) {
return request({
url: '/machineVision/detection',
method: 'put',
data: data
})
}
// 删除机器视觉缺陷检测
export function delDetection(id) {
return request({
url: '/machineVision/detection/' + id,
method: 'delete'
})
}

View File

@ -0,0 +1,291 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="灰度值" prop="grayScale">
<el-input
v-model="queryParams.grayScale"
placeholder="请输入灰度值"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="缩放" prop="zoom">
<el-input
v-model="queryParams.zoom"
placeholder="请输入缩放"
clearable
@keyup.enter.native="handleQuery"
/>
</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-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="detectionList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="图像" align="center" prop="imageId" >
<template slot-scope="scope">
<image-preview :src="scope.row.imageId" :width="50" :height="50"/>
</template>
</el-table-column>
<el-table-column label="当前鼠标坐标" align="center" prop="position" />
<el-table-column label="灰度值" align="center" prop="grayScale" />
<el-table-column label="缩放" align="center" prop="zoom" >
<template slot-scope="scope">{{ scope.row.zoom + '%'}}</template>
</el-table-column>
<el-table-column label="ROI" align="center" prop="roi" />
<el-table-column label="时间" align="center" prop="colSix" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
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>
</template>
</el-table-column>
</el-table>
<pagination
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="100px">
<el-form-item label="图像" prop="imageId">
<image-upload v-model="form.imageId"/>
</el-form-item>
<el-form-item label="当前鼠标坐标" prop="position">
<el-input v-model="form.position" placeholder="请输入当前鼠标坐标" />
</el-form-item>
<el-form-item label="灰度值" prop="grayScale">
<el-input v-model="form.grayScale" placeholder="请输入灰度值" />
</el-form-item>
<el-form-item label="缩放" prop="zoom">
<el-input v-model="form.zoom" placeholder="请输入缩放" />
</el-form-item>
<el-form-item label="ROI" prop="roi">
<el-input v-model="form.roi" placeholder="请输入ROI" />
</el-form-item>
<el-form-item label="时间" prop="colSix">
<el-date-picker
style="width: 100%"
v-model="form.colSix"
type="datetime"
placeholder="请选择时间"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDetection, getDetection, delDetection, addDetection, updateDetection } from "@/api/machineVision/detection";
const interfaceType = "DetectionImage"
export default {
name: "Detection",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
detectionList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
imageId: null,
position: null,
grayScale: null,
zoom: null,
roi: null,
colOne: null,
colTwo: null,
colThree: null,
colFour: null,
colFive: null,
colSix: null,
interfaceType: interfaceType
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询缺陷检测图像界面列表 */
getList() {
this.loading = true;
listDetection(this.queryParams).then(response => {
this.detectionList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
imageId: null,
position: null,
grayScale: null,
zoom: null,
roi: null,
colOne: null,
colTwo: null,
colThree: null,
colFour: null,
colFive: null,
colSix: null,
interfaceType: interfaceType
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加缺陷检测图像界面";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getDetection(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改缺陷检测图像界面";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateDetection(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDetection(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除缺陷检测图像界面编号为"' + ids + '"的数据项?').then(function() {
return delDetection(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('machineVision/detection/export', {
...this.queryParams
}, `detection_${new Date().getTime()}.xlsx`)
}
}
};
</script>