缺陷描述

This commit is contained in:
JinLu.Yin 2022-05-21 00:01:27 +08:00
parent 633a75c673
commit b47663cc7b
3 changed files with 320 additions and 3 deletions

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询来料检验单缺陷记录列表
export function listIqcdefect(query) {
return request({
url: '/mes/qc/iqcdefect/list',
method: 'get',
params: query
})
}
// 查询来料检验单缺陷记录详细
export function getIqcdefect(recordId) {
return request({
url: '/mes/qc/iqcdefect/' + recordId,
method: 'get'
})
}
// 新增来料检验单缺陷记录
export function addIqcdefect(data) {
return request({
url: '/mes/qc/iqcdefect',
method: 'post',
data: data
})
}
// 修改来料检验单缺陷记录
export function updateIqcdefect(data) {
return request({
url: '/mes/qc/iqcdefect',
method: 'put',
data: data
})
}
// 删除来料检验单缺陷记录
export function delIqcdefect(recordId) {
return request({
url: '/mes/qc/iqcdefect/' + recordId,
method: 'delete'
})
}

View File

@ -0,0 +1,263 @@
<template>
<el-dialog title="缺陷记录"
v-if="showFlag"
:visible.sync="showFlag"
:modal= false
width="80%"
center
>
<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:iqcdefect: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:iqcdefect:edit']"
>常见缺陷</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="iqcdefectList" @selection-change="handleSelectionChange">
<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:iqcdefect: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:iqcdefect:update']" v-else @click="confirm"> </el-button>
<el-button @click="showFlag=false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listIqcdefect, getIqcdefect, delIqcdefect, addIqcdefect, updateIqcdefect } from "@/api/mes/qc/iqcdefect";
export default {
name: "Iqcdefect",
dicts: ['mes_defect_level'],
props:{
iqcId: null,
lineId: null,
optType: null
},
data() {
return {
showFlag: false,
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
iqcdefectList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
iqcId: this.iqcId,
lineId: this.lineId,
defectName: null,
defectLevel: null,
defectQuantity: null,
},
//
form: {},
//
rules: {
iqcId: [
{ required: true, message: "来料检验单ID不能为空", trigger: "blur" }
],
lineId: [
{ required: true, message: "来料检验单行ID不能为空", trigger: "blur" }
],
defectName: [
{ required: true, message: "缺陷描述不能为空", trigger: "blur" }
],
defectLevel: [
{ required: true, message: "缺陷等级不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询来料检验单缺陷记录列表 */
getList() {
this.loading = true;
listIqcdefect(this.queryParams).then(response => {
this.iqcdefectList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.showFlag = false;
},
//
reset() {
this.form = {
recordId: null,
iqcId: null,
lineId: null,
defectName: null,
defectLevel: null,
defectQuantity: 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.recordId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
var row = {
recordId: null,
iqcId: this.iqcId,
lineId: this.lineId,
defectName: null,
defectLevel: null,
defectQuantity: null,
flag:'add',
remark: null
}
this.iqcdefectList.unshift(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() {
if(this.iqcdefectList.length !=0){
updateIqcdefect(this.iqcdefectList).then(res => {
debugger;
this.$modal.msgSuccess(res.msg);
if (res.code === 200) {
this.open = false;
this.getList();
}
});
}
},
/** 删除按钮操作 */
handleDelete(index,row) {
debugger;
const recordIds = row.recordId || this.ids;
let that = this;
this.$modal.confirm('是否确认删除缺陷记录?').then(function() {
that.iqcdefectList.forEach(function(item,i,arr){
debugger;
if(i == index){
if(that.iqcdefectList[index].flag=='add'){
//
that.iqcdefectList.splice(index,1);
}else{
//
delIqcdefect(recordIds).then(res=>{
that.getList();
});
}
}
})
});
}
}
};
</script>

View File

@ -17,13 +17,13 @@
<el-table-column label="严重缺陷数量" align="center" prop="majQuantity" /> <el-table-column label="严重缺陷数量" align="center" prop="majQuantity" />
<el-table-column label="轻微缺陷数量" align="center" prop="minQuantity" /> <el-table-column label="轻微缺陷数量" align="center" prop="minQuantity" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" v-if="optType !='view'" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleDefect(scope.row)"
v-hasPermi="['mes:qc:iqcline:edit']" v-hasPermi="['mes:qc:iqcline:edit']"
>缺陷记录</el-button> >缺陷记录</el-button>
</template> </template>
@ -37,12 +37,13 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<Iqcdefect ref="defectDialog" :iqcId="defect_iqcid" :lineId="defect_lineid" :optType="optType"></Iqcdefect>
</div> </div>
</template> </template>
<script> <script>
import { listIqcline, getIqcline, delIqcline, addIqcline, updateIqcline } from "@/api/mes/qc/iqcline"; import { listIqcline, getIqcline, delIqcline, addIqcline, updateIqcline } from "@/api/mes/qc/iqcline";
import Iqcdefect from "./iqcdefect.vue"
export default { export default {
name: "IqcLine", name: "IqcLine",
dicts: ['mes_index_type'], dicts: ['mes_index_type'],
@ -50,8 +51,11 @@ export default {
iqcId: null, iqcId: null,
optType: null, optType: null,
}, },
components:{Iqcdefect},
data() { data() {
return { return {
defect_iqcid:null,
defect_lineid:null,
// //
loading: true, loading: true,
// //
@ -157,6 +161,12 @@ export default {
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
handleDefect(row){
this.defect_iqcid = row.iqcId;
this.defect_lineid = row.lineId;
this.$refs.defectDialog.showFlag = true;
this.$refs.defectDialog.getList();
}
} }
}; };
</script> </script>