检测模板添加检测项

This commit is contained in:
JinLu.Yin 2022-05-18 15:14:57 +08:00
parent 4a022a1efe
commit 21f5d04eb7
5 changed files with 608 additions and 5 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询检测模板-检测项列表
export function listTemplateindex(query) {
return request({
url: '/mes/qc/templateindex/list',
method: 'get',
params: query
})
}
// 查询检测模板-检测项详细
export function getTemplateindex(recordId) {
return request({
url: '/mes/qc/templateindex/' + recordId,
method: 'get'
})
}
// 新增检测模板-检测项
export function addTemplateindex(data) {
return request({
url: '/mes/qc/templateindex',
method: 'post',
data: data
})
}
// 修改检测模板-检测项
export function updateTemplateindex(data) {
return request({
url: '/mes/qc/templateindex',
method: 'put',
data: data
})
}
// 删除检测模板-检测项
export function delTemplateindex(recordId) {
return request({
url: '/mes/qc/templateindex/' + recordId,
method: 'delete'
})
}

View File

@ -0,0 +1,187 @@
<template>
<el-dialog title="物料产品选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="60%"
center
>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="检测项类型" prop="indexType">
<el-radio-group v-model="queryParams.indexType" @change="handleQuery">
<el-radio-button v-for="dict in dict.type.mes_index_type"
:key="dict.value"
:label="dict.value"
:value="dict.value"
>{{dict.label}}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="检测项名称" prop="indexName">
<el-input
v-model="queryParams.indexName"
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-table v-loading="loading" :data="qcindexList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick">
<el-table-column width="50" align="center" >
<template v-slot="scope">
<el-radio v-model="selectedIndexId" :label="scope.row.indexId" @change="handleRowChange(scope.row)">{{""}}</el-radio>
</template>
</el-table-column>
<el-table-column label="检测项编码" align="center" prop="indexCode" />
<el-table-column label="检测项名称" align="center" prop="indexName" />
<el-table-column label="检测项类型" align="center" prop="indexType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_index_type" :value="scope.row.indexType"/>
</template>
</el-table-column>
<el-table-column label="检测工具" align="center" prop="qcTool" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelect"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listQcindex, getQcindex, delQcindex, addQcindex, updateQcindex } from "@/api/mes/qc/qcindex";
export default {
name: "QcindexSelect",
dicts: ['mes_index_type'],
data() {
return {
showFlag:false,
//
loading: true,
//
selectedIndexId: null,
selectedRows: undefined,
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
qcindexList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
indexCode: null,
indexName: null,
indexType: null,
qcTool: null,
},
//
form: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询检测项列表 */
getList() {
this.loading = true;
listQcindex(this.queryParams).then(response => {
this.qcindexList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
reset() {
this.form = {
indexId: null,
indexCode: null,
indexName: null,
indexType: null,
qcTool: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.autoGenFlag = false;
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.indexId)
this.single = selection.length!==1
this.multiple = !selection.length
},
handleCurrent(row){
if(row){
this.selectedRows = row;
}
},
handleRowDbClick(row){
if(row){
this.selectedRows = row;
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
},
//
handleRowChange(row) {
debugger;
if(row){
this.selectedRows = row;
}
},
//
confirmSelect(){
if(this.selectedIndexId ==null || this.selectedIndexId==0){
this.$notify({
title:'提示',
type:'warning',
message: '请至少选择一条数据!'
});
return;
}
this.$emit('onSelected',this.selectedRows);
this.showFlag = false;
}
}
};
</script>

View File

@ -122,7 +122,8 @@
</el-table-column>
<el-table-column label="物料名称" min-width="120" align="left" key="itemName" prop="itemName" v-if="columns[1].visible" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="left" key="specification" prop="specification" v-if="columns[2].visible" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" key="unitOfMeasure" prop="unitOfMeasure" v-if="columns[3].visible" :show-overflow-tooltip="true" />
<el-table-column label="单位" align="center" key="unitOfMeasure" prop="unitOfMeasure" v-if="columns[3].visible" :show-overflow-tooltip="true" >
</el-table-column>
<el-table-column label="物料/产品" align="center" key="itemOrProduct" prop="itemOrProduct" v-if="columns[4].visible" :show-overflow-tooltip="true" >
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_item_product" :value="scope.row.itemOrProduct"/>
@ -470,6 +471,7 @@ export default {
created() {
this.getList();
this.getTreeselect();
this.getUnits();
},
methods: {
/** 查询物料编码列表 */
@ -482,6 +484,11 @@ export default {
}
);
},
getUnits(){
listAllUnitmeasure().then(response =>{
this.measureOptions = response.data;
});
},
/** 查询分类下拉树结构 */
getTreeselect() {
treeselect().then(response => {
@ -555,9 +562,6 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.reset();
listAllUnitmeasure().then(response =>{
this.measureOptions = response.data;
});
this.getTreeselect();
if(this.queryParams.itemTypeId != 0){
this.form.itemTypeId = this.queryParams.itemTypeId;

View File

@ -85,7 +85,15 @@
<el-table v-loading="loading" :data="qctemplateList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="检测模板编号" align="center" prop="templateCode" />
<el-table-column label="检测模板编号" align="center" prop="templateCode" >
<template slot-scope="scope">
<el-button
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:qc:template:query']"
>{{scope.row.templateCode}}</el-button>
</template>
</el-table-column>
<el-table-column label="检测模板名称" align="center" prop="templateName" />
<el-table-column label="检测种类" align="center" prop="qcTypesParam" >
<template slot-scope="scope">
@ -187,6 +195,12 @@
</el-col>
</el-row>
</el-form>
<el-tabs type="border-card" v-if="form.templateId != null">
<el-tab-pane label="检测项">
<TemplateIndex ref="indexTab" :templateId="form.templateId" :optType="optType"></TemplateIndex>
</el-tab-pane>
</el-tabs>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
<el-button type="primary" @click="submitForm" v-else> </el-button>
@ -199,9 +213,11 @@
<script>
import { listQctemplate, getQctemplate, delQctemplate, addQctemplate, updateQctemplate } from "@/api/mes/qc/qctemplate";
import {genCode} from "@/api/system/autocode/rule"
import TemplateIndex from "./templateindex.vue"
export default {
name: "Qctemplate",
dicts: ['sys_yes_no','mes_qc_type'],
components: {TemplateIndex},
data() {
return {
//

View File

@ -0,0 +1,352 @@
<template>
<div class="app-container">
<el-row :gutter="10" v-if="optType !='view'" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:qc:templateindex:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['mes:qc:templateindex:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['mes:qc:templateindex:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="templateindexList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="检测项名称" align="center" prop="indexName" />
<el-table-column label="检测项类型" align="center" prop="indexType">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_index_type" :value="scope.row.indexType"/>
</template>
</el-table-column>
<el-table-column label="检测工具" align="center" prop="qcTool" />
<el-table-column label="检测方法" align="center" prop="checkMethod" :show-overflow-tooltip="true"/>
<el-table-column label="标准值" align="center" prop="standerVal" />
<el-table-column label="单位" align="center" prop="unitOfMeasure" />
<el-table-column label="误差上限" align="center" prop="thresholdMax" />
<el-table-column label="误差下限" align="center" prop="thresholdMin" />
<el-table-column label="操作" v-if="optType != 'view'" align="center" width="100px" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:qc:templateindex:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['mes:qc:templateindex:remove']"
>删除</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="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="检测项" prop="indexId">
<el-input v-model="form.indexName" placeholder="请选择检测项" >
<el-button slot="append" @click="handleSelectIndex" icon="el-icon-search"></el-button>
</el-input>
<IndexSelect ref="indexSelect" @onSelected="onIndexSelected" ></IndexSelect>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="检测工具" prop="qcTool">
<el-input v-model="form.qcTool" placeholder="请输入检测工具" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="检测方法" prop="checkMethod">
<el-input v-model="form.checkMethod" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="标准值" prop="standerVal">
<el-input v-model="form.standerVal" placeholder="请输入标准值" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单位" prop="unitOfMeasure">
<el-select v-model="form.unitOfMeasure" placeholder="请选择单位">
<el-option
v-for="item in measureOptions"
:key="item.measureCode"
:label="item.measureName"
:value="item.measureCode"
:disabled="item.enableFlag == 'N'"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="误差上限" prop="thresholdMax">
<el-input-number :min="0" v-model="form.thresholdMax" placeholder="请输入误差上限" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="误差下限" prop="thresholdMin">
<el-input-number :max="0" v-model="form.thresholdMin" placeholder="请输入误差下限" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="说明图" prop="docUrl">
<el-input v-model="form.docUrl" placeholder="请输入说明图" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
<el-button type="primary" @click="submitForm" v-else> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listTemplateindex, getTemplateindex, delTemplateindex, addTemplateindex, updateTemplateindex } from "@/api/mes/qc/templateindex";
import IndexSelect from "@/components/qcindexSelect/single.vue";
import { listAllUnitmeasure} from "@/api/mes/md/unitmeasure";
export default {
name: "Templateindex",
dicts: ['mes_index_type'],
props:{
optType: null,
templateId: null
},
components:{IndexSelect},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// -
templateindexList: [],
//
measureOptions:[],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
templateId: this.templateId,
indexId: null,
indexCode: null,
indexName: null,
indexType: null,
qcTool: null,
checkMethod: null,
standerVal: null,
unitOfMeasure: null,
thresholdMax: null,
thresholdMin: null,
docUrl: null,
},
//
form: {},
//
rules: {
templateId: [
{ required: true, message: "检测模板ID不能为空", trigger: "blur" }
],
indexId: [
{ required: true, message: "检测项不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
this.getUnits();
},
methods: {
/** 查询检测模板-检测项列表 */
getList() {
this.loading = true;
listTemplateindex(this.queryParams).then(response => {
this.templateindexList = response.rows;
this.total = response.total;
this.loading = false;
});
},
getUnits(){
listAllUnitmeasure().then(response =>{
this.measureOptions = response.data;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
recordId: null,
templateId: this.templateId,
indexId: null,
indexCode: null,
indexName: null,
indexType: null,
qcTool: null,
checkMethod: null,
standerVal: null,
unitOfMeasure: null,
thresholdMax: null,
thresholdMin: null,
docUrl: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.recordId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加检测模板-检测项";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const recordId = row.recordId || this.ids
getTemplateindex(recordId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改检测模板-检测项";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.recordId != null) {
updateTemplateindex(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTemplateindex(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const recordIds = row.recordId || this.ids;
this.$modal.confirm('是否确认删除检测模板-检测项编号为"' + recordIds + '"的数据项?').then(function() {
return delTemplateindex(recordIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
handleSelectIndex(){
this.$refs.indexSelect.showFlag = true;
},
//
onIndexSelected(obj){
if(obj != undefined && obj != null){
this.form.indexId = obj.indexId;
this.form.indexCode = obj.indexCode;
this.form.indexName = obj.indexName;
this.form.indexType = obj.indexType;
this.form.qcTool = obj.qcTool;
}
}
}
};
</script>