新增缺陷检测

This commit is contained in:
zhoumingxiu 2024-01-12 17:26:26 +08:00
parent dd74a623a3
commit b2f0d0b2d9
2 changed files with 656 additions and 0 deletions

View File

@ -0,0 +1,332 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<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-select v-model="queryParams.zoom" placeholder="请选择输入/输出" style="width: 100%;" clearable>
<el-option
v-for="dict in dict.type.machinevision_detection_io"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="接口类型" prop="position">
<el-select v-model="queryParams.position" placeholder="请选择接口类型" style="width: 100%;" clearable>
<el-option
v-for="dict in dict.type.machinevision_detection_interface_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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="grayScale" />
<el-table-column label="输入/输出" align="center" prop="zoom" >
<template slot-scope="scope">
<dict-tag :options="dict.type.machinevision_detection_io" :value="scope.row.zoom"/>
</template>
</el-table-column>
<el-table-column label="接口类型" align="center" prop="position" >
<template slot-scope="scope">
<dict-tag :options="dict.type.machinevision_detection_interface_type" :value="scope.row.position"/>
</template>
</el-table-column>
<el-table-column label="命令" align="center" prop="colOne" />
<el-table-column label="传输速率" align="center" prop="roi" />
<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="colTwo" />
<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="grayScale">
<el-input v-model="form.grayScale" placeholder="请输入设备编号" />
</el-form-item>
<el-form-item label="输入/输出" prop="zoom">
<el-select v-model="form.zoom" placeholder="请选择输入/输出" style="width: 100%;">
<el-option
v-for="dict in dict.type.machinevision_detection_io"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="接口类型" prop="position">
<el-select v-model="form.position" placeholder="请选择接口类型" style="width: 100%;">
<el-option
v-for="dict in dict.type.machinevision_detection_interface_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="命令" prop="colOne">
<el-input v-model="form.colOne" placeholder="请输入命令" />
</el-form-item>
<el-form-item label="传输速率" prop="roi">
<el-input v-model="form.roi" placeholder="请输入传输速率" />
</el-form-item>
<el-form-item label="传输图像" prop="imageId">
<image-upload v-model="form.imageId"/>
</el-form-item>
<el-form-item label="传输数据" prop="colTwo">
<el-input v-model="form.colTwo" placeholder="请输入传输数据" />
</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 = "HardwareIO"
export default {
name: "Detection",
dicts: ['machinevision_detection_io', 'machinevision_detection_interface_type'],
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>

View File

@ -0,0 +1,324 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<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="OCV" prop="position">
<el-select v-model="queryParams.position" placeholder="请选择OCV" style="width: 100%;" clearable>
<el-option
v-for="dict in dict.type.machinevision_detection_ocv"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="分类" prop="colOne">
<el-input
v-model="queryParams.colOne"
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="grayScale" />
<el-table-column label="OCR" align="center" prop="zoom" >
</el-table-column>
<el-table-column label="OCV" align="center" prop="position" >
<template slot-scope="scope">
<dict-tag :options="dict.type.machinevision_detection_ocv" :value="scope.row.position"/>
</template>
</el-table-column>
<el-table-column label="分类" align="center" prop="colOne" />
<el-table-column label="一维码" align="center" prop="roi" />
<!--<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="colTwo" />
<el-table-column label="二维码质量评估" align="center" prop="colThree" />
<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="110px">
<el-form-item label="识别编号" prop="grayScale">
<el-input v-model="form.grayScale" placeholder="请输入识别编号" />
</el-form-item>
<el-form-item label="OCR" prop="zoom">
<el-input v-model="form.zoom" placeholder="请输入OCR" />
</el-form-item>
<el-form-item label="OCV" prop="position">
<el-select v-model="form.position" placeholder="请选择OCV" style="width: 100%;">
<el-option
v-for="dict in dict.type.machinevision_detection_ocv"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="分类" prop="colOne">
<el-input v-model="form.colOne" placeholder="请输入分类" />
</el-form-item>
<el-form-item label="一维码" prop="roi">
<el-input v-model="form.roi" placeholder="请输入一维码" />
</el-form-item>
<!-- <el-form-item label="传输图像" prop="imageId">
<image-upload v-model="form.imageId"/>
</el-form-item>-->
<el-form-item label="二维码" prop="colTwo">
<el-input v-model="form.colTwo" placeholder="请输入二维码" />
</el-form-item>
<el-form-item label="二维码质量评估" prop="colThree">
<el-input v-model="form.colThree" placeholder="请输入二维码质量评估" />
</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 = "IdentifyVerify"
export default {
name: "Detection",
dicts: ['machinevision_detection_io', 'machinevision_detection_ocv'],
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>