前端去掉之前的来料检验单缺陷记录代码

This commit is contained in:
JinLu.Yin 2022-08-31 21:43:52 +08:00
parent f53ee15ba7
commit eeea812cfe
6 changed files with 41 additions and 320 deletions

View File

@ -1,44 +0,0 @@
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

@ -180,7 +180,7 @@ export default {
updateDefectrecord(this.defectrecordList).then(res => {
this.$modal.msgSuccess(res.msg);
if (res.code === 200) {
this.open = false;
this.showFlag = false;
this.getList();
this.$parent.getList();
}

View File

@ -151,6 +151,7 @@
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="scope.row.status =='PREPARE'"
v-hasPermi="['mes:qc:ipqc:edit']"
>修改</el-button>
<el-button
@ -158,6 +159,7 @@
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-if="scope.row.status =='PREPARE'"
v-hasPermi="['mes:qc:ipqc:remove']"
>删除</el-button>
</template>
@ -211,9 +213,12 @@
</el-col>
<el-col :span="8">
<el-form-item label="工单编码" prop="workorderCode">
<el-input v-model="form.workorderCode" placeholder="请选择生产工单" >
<el-input v-if="form.ipqcId == null" v-model="form.workorderCode" placeholder="请选择生产工单" >
<el-button slot="append" icon="el-icon-search" @click="handleWorkorderSelect"></el-button>
</el-input>
<!--保存过则不允许修改工单需要修改则删除重做-->
<el-input v-else v-model="form.workorderCode" >
</el-input>
</el-form-item>
<WorkorderSelect ref="woSelect" @onSelected="onWorkorderSelected"></WorkorderSelect>
</el-col>
@ -368,8 +373,9 @@
<Ipqcline ref=line :ipqcId="form.ipqcId" :optType="optType"></Ipqcline>
</el-card>
<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="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </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="success" @click="handleFinish" v-if="form.status =='PREPARE' && optType !='view' && form.ipqcId !=null">完成</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -593,19 +599,39 @@ export default {
if (this.form.ipqcId != null) {
updateIpqc(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
//this.open = false;
this.getList();
});
} else {
addIpqc(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.form.ipqcId = response.data; //ID
//this.open = false;
this.getList();
});
}
}
});
},
//
handleFinish(){
let that = this;
if(this.form.checkResult == null){
this.$modal.msgError("请选择检测结果!");
return;
}
this.$refs["form"].validate(valid => {
if (valid) {
this.$modal.confirm('是否完成检验单编制?【完成后将不能更改】').then(function(){
that.form.status = 'CONFIRMED';
that.submitForm();
that.open = false;
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ipqcIds = row.ipqcId || this.ids;

View File

@ -247,9 +247,12 @@
<el-row>
<el-col :span="8">
<el-form-item label="产品物料编码" prop="itemCode">
<el-input v-model="form.itemCode" placeholder="请输入产品物料编码" >
<el-input v-if="form.iqcId ==null " v-model="form.itemCode" placeholder="请输入产品物料编码" >
<el-button slot="append" @click="handleSelectProduct" icon="el-icon-search"></el-button>
</el-input>
<!--如果已经保存过则产品不允许再修改需要修改就删除重做-->
<el-input v-else v-model="form.itemCode">
</el-input>
</el-form-item>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected" > </ItemSelect>
</el-col>
@ -388,7 +391,7 @@
</el-form>
<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="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>
<el-button type="success" @click="handleFinish" v-if="form.status =='PREPARE' && optType !='view' && form.iqcId !=null">完成</el-button>
<el-button @click="cancel"> </el-button>
</div>

View File

@ -1,265 +0,0 @@
<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
},
watch :{
iqcId(){
this.queryParams.iqcId = this.iqcId;
},
lineId(){
this.queryParams.lineId = this.lineId;
}
},
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() {
debugger;
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) {
},
/** 提交按钮 */
confirm() {
if(this.iqcdefectList.length !=0){
updateIqcdefect(this.iqcdefectList).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.iqcdefectList.forEach(function(item,i,arr){
if(i == index){
if(that.iqcdefectList[index].flag=='add'){
//
that.iqcdefectList.splice(index,1);
}else{
//
delIqcdefect(recordIds).then(res=>{
that.getList();
});
}
}
})
});
this.$parent.getList();
}
}
};
</script>

View File

@ -37,13 +37,13 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<Iqcdefect ref="defectDialog" :iqcId="defect_iqcid" :lineId="defect_lineid" :optType="optType"></Iqcdefect>
<Defectrecord ref="defectDialog" :qcId="defect_iqcid" :lineId="defect_lineid" :qcType="defect_qctype" :optType="optType"></Defectrecord>
</div>
</template>
<script>
import { listIqcline, getIqcline, delIqcline, addIqcline, updateIqcline } from "@/api/mes/qc/iqcline";
import Iqcdefect from "./iqcdefect.vue"
import Defectrecord from "../defectrecord/index.vue"
export default {
name: "IqcLine",
dicts: ['mes_index_type'],
@ -51,11 +51,12 @@ export default {
iqcId: null,
optType: null,
},
components:{Iqcdefect},
components:{Defectrecord},
data() {
return {
defect_iqcid:null,
defect_lineid:null,
defect_qctype: 'IQC',
//
loading: true,
//