缺陷记录前端修改

This commit is contained in:
JinLu.Yin 2022-08-30 20:45:35 +08:00
parent 07e8b92943
commit bf62aabbb6
7 changed files with 504 additions and 11 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询检验单缺陷记录列表
export function listDefectrecord(query) {
return request({
url: '/mes/qc/defectrecord/list',
method: 'get',
params: query
})
}
// 查询检验单缺陷记录详细
export function getDefectrecord(recordId) {
return request({
url: '/mes/qc/defectrecord/' + recordId,
method: 'get'
})
}
// 新增检验单缺陷记录
export function addDefectrecord(data) {
return request({
url: '/mes/qc/defectrecord',
method: 'post',
data: data
})
}
// 修改检验单缺陷记录
export function updateDefectrecord(data) {
return request({
url: '/mes/qc/defectrecord',
method: 'put',
data: data
})
}
// 删除检验单缺陷记录
export function delDefectrecord(recordId) {
return request({
url: '/mes/qc/defectrecord/' + recordId,
method: 'delete'
})
}

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询过程检验单行列表
export function listIpqcline(query) {
return request({
url: '/mes/qc/ipqcline/list',
method: 'get',
params: query
})
}
// 查询过程检验单行详细
export function getIpqcline(lineId) {
return request({
url: '/mes/qc/ipqcline/' + lineId,
method: 'get'
})
}
// 新增过程检验单行
export function addIpqcline(data) {
return request({
url: '/mes/qc/ipqcline',
method: 'post',
data: data
})
}
// 修改过程检验单行
export function updateIpqcline(data) {
return request({
url: '/mes/qc/ipqcline',
method: 'put',
data: data
})
}
// 删除过程检验单行
export function delIpqcline(lineId) {
return request({
url: '/mes/qc/ipqcline/' + lineId,
method: 'delete'
})
}

View File

@ -0,0 +1,213 @@
<template>
<el-dialog title="缺陷记录"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="80%"
center
>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['mes:qc:defectrecord: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:defectrecord:edit']"
>常见缺陷</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="defectrecordList">
<el-table-column label="缺陷描述" width="400px" align="center" prop="defectName" >
<template slot-scope="scope">
<el-input type="textarea" v-model="scope.row.defectName"></el-input>
</template>
</el-table-column>
<el-table-column label="缺陷等级" align="center" prop="defectLevel">
<template slot-scope="scope">
<el-select v-model="scope.row.defectLevel">
<el-option
v-for="dict in dict.type.mes_defect_level"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="缺陷数量" align="center" prop="defectQuantity" >
<template slot-scope="scope">
<el-input-number :min="1" v-model="scope.row.defectQuantity" />
</template>
</el-table-column>
<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-delete"
v-if="optType !='view'"
@click="handleDelete(scope.$index, scope.row)"
v-hasPermi="['mes:qc:defectrecord: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"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button>
<el-button type="primary" v-hasPermi="['mes:qc:defectrecord:update']" v-else @click="confirm"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listDefectrecord, getDefectrecord, delDefectrecord, addDefectrecord, updateDefectrecord } from "@/api/mes/qc/defectrecord";
export default {
name: "Defectrecord",
props: {
qcId: null,
qcType: null,
lineId:null,
optType:null
},
watch :{
qcId(){
this.queryParams.qcId = this.qcId;
},
qcType(){
this.queryParams.qcType = this.qcType;
},
lineId(){
this.queryParams.lineId = this.lineId;
}
},
data() {
return {
showFlag: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
defectrecordList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
qcType: this.qcType,
qcId: this.qcId,
lineId: this.lineId,
defectName: null,
defectLevel: null,
defectQuantity: null,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询检验单缺陷记录列表 */
getList() {
this.loading = true;
listDefectrecord(this.queryParams).then(response => {
this.defectrecordList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
var row = {
recordId: null,
qcId: this.qcId,
qcType: this.qcType,
lineId: this.lineId,
defectName: null,
defectLevel: null,
defectQuantity: null,
flag:'add',
remark: null
}
this.defectrecordList.unshift(row);
},
/** 选择常见缺陷 */
handleUpdate(row) {
},
/** 提交按钮 */
confirm() {
if(this.defectrecordList.length !=0){
updateDefectrecord(this.defectrecordList).then(res => {
this.$modal.msgSuccess(res.msg);
if (res.code === 200) {
this.open = false;
this.getList();
this.$parent.getList();
}
});
}
},
/** 删除按钮操作 */
handleDelete(index,row) {
const recordIds = row.recordId || this.ids;
let that = this;
this.$modal.confirm('是否确认删除缺陷记录?').then(function() {
that.defectrecordList.forEach(function(item,i,arr){
debugger;
if(i == index){
if(that.defectrecordList[index].flag=='add'){
//
that.defectrecordList.splice(index,1);
}else{
//
delDefectrecord(recordIds).then(res=>{
that.getList();
});
}
}
})
});
this.$parent.getList();
}
}
};
</script>

View File

@ -107,7 +107,15 @@
<el-table v-loading="loading" :data="ipqcList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="ipqcList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="检验单编号" width="150px" align="center" prop="ipqcCode" /> <el-table-column label="检验单编号" width="150px" align="center" prop="ipqcCode" >
<template slot-scope="scope">
<el-button
type="text"
@click="handleView(scope.row)"
v-hasPermi="['mes:qc:ipqc:query']"
>{{scope.row.ipqcCode}}</el-button>
</template>
</el-table-column>
<el-table-column label="检验类型" align="center" prop="ipqcType"> <el-table-column label="检验类型" align="center" prop="ipqcType">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.mes_ipqc_type" :value="scope.row.ipqcType"/> <dict-tag :options="dict.type.mes_ipqc_type" :value="scope.row.ipqcType"/>
@ -355,6 +363,10 @@
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<el-divider v-if="form.ipqcId !=null" content-position="center">检测项</el-divider>
<el-card shadow="always" v-if="form.ipqcId !=null" class="box-card">
<Ipqcline ref=line :ipqcId="form.ipqcId" :optType="optType"></Ipqcline>
</el-card>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button> <el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE' ">返回</el-button>
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button> <el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button>
@ -369,9 +381,10 @@ import { listIpqc, getIpqc, delIpqc, addIpqc, updateIpqc } from "@/api/mes/qc/ip
import {genCode} from "@/api/system/autocode/rule" import {genCode} from "@/api/system/autocode/rule"
import WorkorderSelect from "@/components/workorderSelect/single.vue" import WorkorderSelect from "@/components/workorderSelect/single.vue"
import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue" import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue"
import Ipqcline from "./line.vue"
export default { export default {
name: "Ipqc", name: "Ipqc",
components: {WorkorderSelect,WorkstationSelect}, components: {WorkorderSelect,WorkstationSelect,Ipqcline},
dicts: ['mes_ipqc_type','mes_qc_result','mes_order_status'], dicts: ['mes_ipqc_type','mes_qc_result','mes_order_status'],
data() { data() {
return { return {

View File

@ -0,0 +1,186 @@
<template>
<div class="app-container">
<el-table v-loading="loading" :data="ipqclineList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="检测项名称" width="120px" align="center" prop="indexName" />
<el-table-column label="检测项类型" width="100px" 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" />
<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="致命缺陷数量" align="center" prop="crQuantity" />
<el-table-column label="严重缺陷数量" align="center" prop="majQuantity" />
<el-table-column label="轻微缺陷数量" align="center" prop="minQuantity" />
<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="handleDefect(scope.row)"
v-hasPermi="['mes:qc:ipqc:edit']"
>缺陷记录</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"
/>
<Defectrecord ref="defectDialog" :qcId="defect_qcId" :lineId="defect_qcLineId" :qcType="defect_qcType" :optType="optType"></Defectrecord>
</div>
</template>
<script>
import { listIpqcline, getIpqcline, delIpqcline, addIpqcline, updateIpqcline } from "@/api/mes/qc/ipqcline";
import Defectrecord from "../defectrecord/index.vue"
export default {
name: "Ipqcline",
dicts: ['mes_index_type'],
props: {
ipqcId: null,
optType: undefined
},
components: {Defectrecord},
data() {
return {
defect_qcId: null,
defect_qcLineId: null,
defect_qcType: 'IPQC',
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
ipqclineList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
ipqcId: this.ipqcId,
indexId: null,
indexCode: null,
indexName: null,
indexType: null,
qcTool: null,
checkMethod: null,
standerVal: null,
unitOfMeasure: null,
thresholdMax: null,
thresholdMin: null,
crQuantity: null,
majQuantity: null,
minQuantity: null,
},
//
form: {},
//
rules: {
ipqcId: [
{ required: true, message: "检验单ID不能为空", trigger: "blur" }
],
indexId: [
{ required: true, message: "检测项ID不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询过程检验单行列表 */
getList() {
this.loading = true;
listIpqcline(this.queryParams).then(response => {
this.ipqclineList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
lineId: null,
ipqcId: null,
indexId: null,
indexCode: null,
indexName: null,
indexType: null,
qcTool: null,
checkMethod: null,
standerVal: null,
unitOfMeasure: null,
thresholdMax: null,
thresholdMin: null,
crQuantity: null,
majQuantity: null,
minQuantity: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: 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.lineId)
this.single = selection.length!==1
this.multiple = !selection.length
},
//
handleDefect(row){
this.defect_qcid = row.ipqcId;
this.defect_lineid = row.lineId;
this.$nextTick(() => {
this.$refs.defectDialog.showFlag = true;
this.$refs.defectDialog.getList();
})
}
}
};
</script>

View File

@ -222,15 +222,9 @@ export default {
} }
this.iqcdefectList.unshift(row); this.iqcdefectList.unshift(row);
}, },
/** 修改按钮操作 */ /** 选择常见缺陷 */
handleUpdate(row) { handleUpdate(row) {
this.reset();
const recordId = row.recordId || this.ids
getIqcdefect(recordId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改来料检验单缺陷记录";
});
}, },
/** 提交按钮 */ /** 提交按钮 */
confirm() { confirm() {

View File

@ -163,7 +163,6 @@ export default {
this.multiple = !selection.length this.multiple = !selection.length
}, },
handleDefect(row){ handleDefect(row){
debugger;
this.defect_iqcid = row.iqcId; this.defect_iqcid = row.iqcId;
this.defect_lineid = row.lineId; this.defect_lineid = row.lineId;
this.$nextTick(() => { this.$nextTick(() => {